mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +00:00
Kernel: Resolve clang-tidy readability-implicit-bool-conversion warnings
... In files included from Kernel/Process.cpp and Kernel/Thread.cpp
This commit is contained in:
parent
6f580f2047
commit
a92132e44a
17 changed files with 85 additions and 84 deletions
|
@ -30,9 +30,9 @@ inline bool is_regular_file(mode_t mode) { return (mode & S_IFMT) == S_IFREG; }
|
|||
inline bool is_fifo(mode_t mode) { return (mode & S_IFMT) == S_IFIFO; }
|
||||
inline bool is_symlink(mode_t mode) { return (mode & S_IFMT) == S_IFLNK; }
|
||||
inline bool is_socket(mode_t mode) { return (mode & S_IFMT) == S_IFSOCK; }
|
||||
inline bool is_sticky(mode_t mode) { return mode & S_ISVTX; }
|
||||
inline bool is_setuid(mode_t mode) { return mode & S_ISUID; }
|
||||
inline bool is_setgid(mode_t mode) { return mode & S_ISGID; }
|
||||
inline bool is_sticky(mode_t mode) { return (mode & S_ISVTX) == S_ISVTX; }
|
||||
inline bool is_setuid(mode_t mode) { return (mode & S_ISUID) == S_ISUID; }
|
||||
inline bool is_setgid(mode_t mode) { return (mode & S_ISGID) == S_ISGID; }
|
||||
|
||||
struct InodeMetadata {
|
||||
bool is_valid() const { return inode.is_valid(); }
|
||||
|
@ -46,10 +46,10 @@ struct InodeMetadata {
|
|||
if (u == 0)
|
||||
return true;
|
||||
if (uid == u)
|
||||
return mode & S_IRUSR;
|
||||
return (mode & S_IRUSR) == S_IRUSR;
|
||||
if (gid == g || eg.contains_slow(gid))
|
||||
return mode & S_IRGRP;
|
||||
return mode & S_IROTH;
|
||||
return (mode & S_IRGRP) == S_IRGRP;
|
||||
return (mode & S_IROTH) == S_IROTH;
|
||||
}
|
||||
|
||||
bool may_write(UserID u, GroupID g, Span<GroupID const> eg) const
|
||||
|
@ -57,10 +57,10 @@ struct InodeMetadata {
|
|||
if (u == 0)
|
||||
return true;
|
||||
if (uid == u)
|
||||
return mode & S_IWUSR;
|
||||
return (mode & S_IWUSR) == S_IWUSR;
|
||||
if (gid == g || eg.contains_slow(gid))
|
||||
return mode & S_IWGRP;
|
||||
return mode & S_IWOTH;
|
||||
return (mode & S_IWGRP) == S_IWGRP;
|
||||
return (mode & S_IWOTH) == S_IWOTH;
|
||||
}
|
||||
|
||||
bool may_execute(UserID u, GroupID g, Span<GroupID const> eg) const
|
||||
|
@ -68,10 +68,10 @@ struct InodeMetadata {
|
|||
if (u == 0)
|
||||
return true;
|
||||
if (uid == u)
|
||||
return mode & S_IXUSR;
|
||||
return (mode & S_IXUSR) == S_IXUSR;
|
||||
if (gid == g || eg.contains_slow(gid))
|
||||
return mode & S_IXGRP;
|
||||
return mode & S_IXOTH;
|
||||
return (mode & S_IXGRP) == S_IXGRP;
|
||||
return (mode & S_IXOTH) == S_IXOTH;
|
||||
}
|
||||
|
||||
bool is_directory() const { return Kernel::is_directory(mode); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue