Skip to content

Commit

Permalink
Merge pull request #28 from tf-maam/fix_type_casts
Browse files Browse the repository at this point in the history
Explicit cast from u32 to u16
  • Loading branch information
willdoescode authored Oct 25, 2020
2 parents 9d044a4 + 5f22ff3 commit 08020e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ fn get_user_name(uid: uid_t) -> String {


pub fn perms(mode: u16) -> String {
let user = triplet(mode, S_IRUSR, S_IWUSR, S_IXUSR);
let group = triplet(mode, S_IRGRP, S_IWGRP, S_IXGRP);
let other = triplet(mode, S_IROTH, S_IWOTH, S_IXOTH);
let user = triplet(mode, S_IRUSR as u16, S_IWUSR as u16, S_IXUSR as u16);
let group = triplet(mode, S_IRGRP as u16, S_IWGRP as u16, S_IXGRP as u16);
let other = triplet(mode, S_IROTH as u16, S_IWOTH as u16, S_IXOTH as u16);
[user, group, other].join("")
}

Expand Down
6 changes: 3 additions & 3 deletions src/single.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ fn triplet(mode: u16, read: u16, write: u16, execute: u16) -> String {
}

fn perms(mode: u16) -> String {
let user = triplet(mode, S_IRUSR, S_IWUSR, S_IXUSR);
let group = triplet(mode, S_IRGRP, S_IWGRP, S_IXGRP);
let other = triplet(mode, S_IROTH, S_IWOTH, S_IXOTH);
let user = triplet(mode, S_IRUSR as u16, S_IWUSR as u16, S_IXUSR as u16);
let group = triplet(mode, S_IRGRP as u16, S_IWGRP as u16, S_IXGRP as u16);
let other = triplet(mode, S_IROTH as u16, S_IWOTH as u16, S_IXOTH as u16);
[user, group, other].join("")
}

0 comments on commit 08020e3

Please sign in to comment.