Skip to content

Commit 08020e3

Browse files
authored
Merge pull request #28 from tf-maam/fix_type_casts
Explicit cast from u32 to u16
2 parents 9d044a4 + 5f22ff3 commit 08020e3

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,9 @@ fn get_user_name(uid: uid_t) -> String {
204204

205205

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

src/single.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ fn triplet(mode: u16, read: u16, write: u16, execute: u16) -> String {
9898
}
9999

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

0 commit comments

Comments
 (0)