Commit 2b7c39f4 authored by Sebastian Oeste's avatar Sebastian Oeste
Browse files

fix: replace c-style casts with static_cast

parent 2bb75649
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ int chk_access(const Metadata& md, int mask) {
    //check user leftmost 3 bits for rwx in md->mode
    if (md.uid() == fuse_get_context()->uid) {
        // Because mode comes only with the first 3 bits used, the user bits have to be shifted to the right to compare
        if ((mask & md.mode() >> 6) == (unsigned int) mask)
        if ((mask & md.mode() >> 6) == static_cast<unsigned int>(mask))
            return 0;
        else
            return -EACCES;
@@ -31,7 +31,7 @@ int chk_access(const Metadata& md, int mask) {

    //check group middle 3 bits for rwx in md->mode
    if (md.gid() == fuse_get_context()->gid) {
        if ((mask & md.mode() >> 3) == (unsigned int) mask)
        if ((mask & md.mode() >> 3) == static_cast<unsigned int>(mask))
            return 0;
        else
            return -EACCES;
@@ -39,7 +39,7 @@ int chk_access(const Metadata& md, int mask) {

    //check other rightmost 3 bits for rwx in md->mode.
    // Because they are the rightmost bits they don't need to be shifted
    if ((mask & md.mode()) == (unsigned int) mask) {
    if ((mask & md.mode()) == static_cast<unsigned int>(mask)) {
        return 0;
    }

+3 −3
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ int init_chunk_space(const unsigned long hash) {
    chnk_path /= "data"s;
    bfs::ofstream ofs{chnk_path};

    return bfs::exists(chnk_path);
    return static_cast<int>(bfs::exists(chnk_path));
}
/**
 * Remove the directory in the chunk dir of a file.
@@ -39,5 +39,5 @@ int destroy_chunk_space(const unsigned long hash) {
    // create chunk dir
    bfs::remove_all(chnk_path);

    return !bfs::exists(chnk_path);
    return static_cast<int>(!bfs::exists(chnk_path));
}
+3 −3
Original line number Diff line number Diff line
@@ -76,10 +76,10 @@ int adafs_write(const char* p, const char* buf, size_t size, off_t offset, struc
    // Set new size of the file
    if (fi->flags & O_APPEND) {
        truncate(chnk_path.c_str(), md->size() + size);
        md->size(md->size() + (uint32_t) size);
        md->size(md->size() + static_cast<uint32_t>(size));
    } else {
        truncate(chnk_path.c_str(), size);
        md->size((uint32_t) size);
        md->size(static_cast<uint32_t>(size));
    }

    close(fd);
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ struct adafs_data {
    int32_t blocksize;
};

#define ADAFS_DATA ((struct adafs_data*) fuse_get_context()->private_data)
#define ADAFS_DATA ( static_cast<adafs_data*>(fuse_get_context()->private_data))
#define ADAFS_ROOT_INODE 1

namespace util {