mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-11-14 16:34:09 +00:00
Prefer C++-style casts over C-style casts
The former are easier to identify. Found via clang-tidy.
This commit is contained in:
parent
cc29bea81b
commit
8b7d80c63a
@ -37,7 +37,6 @@ Checks: '
|
|||||||
-cppcoreguidelines-special-member-functions,
|
-cppcoreguidelines-special-member-functions,
|
||||||
-fuchsia-*,
|
-fuchsia-*,
|
||||||
-google-build-using-namespace,
|
-google-build-using-namespace,
|
||||||
-google-readability-casting,
|
|
||||||
-google-readability-function-size,
|
-google-readability-function-size,
|
||||||
-google-readability-todo,
|
-google-readability-todo,
|
||||||
-google-runtime-int,
|
-google-runtime-int,
|
||||||
|
@ -615,7 +615,7 @@ size_t S3fsCurl::UploadReadCallback(void* ptr, size_t size, size_t nmemb, void*
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// read size
|
// read size
|
||||||
ssize_t copysize = (size * nmemb) < (size_t)pCurl->partdata.size ? (size * nmemb) : (size_t)pCurl->partdata.size;
|
ssize_t copysize = (size * nmemb) < static_cast<size_t>(pCurl->partdata.size) ? (size * nmemb) : static_cast<size_t>(pCurl->partdata.size);
|
||||||
ssize_t readbytes;
|
ssize_t readbytes;
|
||||||
ssize_t totalread;
|
ssize_t totalread;
|
||||||
// read and set
|
// read and set
|
||||||
@ -653,7 +653,7 @@ size_t S3fsCurl::DownloadWriteCallback(void* ptr, size_t size, size_t nmemb, voi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// write size
|
// write size
|
||||||
ssize_t copysize = (size * nmemb) < (size_t)pCurl->partdata.size ? (size * nmemb) : (size_t)pCurl->partdata.size;
|
ssize_t copysize = (size * nmemb) < static_cast<size_t>(pCurl->partdata.size) ? (size * nmemb) : static_cast<size_t>(pCurl->partdata.size);
|
||||||
ssize_t writebytes;
|
ssize_t writebytes;
|
||||||
ssize_t totalwrite;
|
ssize_t totalwrite;
|
||||||
|
|
||||||
|
10
src/s3fs.cpp
10
src/s3fs.cpp
@ -2088,10 +2088,10 @@ static int s3fs_chown(const char* _path, uid_t uid, gid_t gid)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((uid_t)(-1) == uid){
|
if(static_cast<uid_t>(-1) == uid){
|
||||||
uid = stbuf.st_uid;
|
uid = stbuf.st_uid;
|
||||||
}
|
}
|
||||||
if((gid_t)(-1) == gid){
|
if(static_cast<gid_t>(-1) == gid){
|
||||||
gid = stbuf.st_gid;
|
gid = stbuf.st_gid;
|
||||||
}
|
}
|
||||||
if(S_ISDIR(stbuf.st_mode)){
|
if(S_ISDIR(stbuf.st_mode)){
|
||||||
@ -2210,10 +2210,10 @@ static int s3fs_chown_nocopy(const char* _path, uid_t uid, gid_t gid)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((uid_t)(-1) == uid){
|
if(static_cast<uid_t>(-1) == uid){
|
||||||
uid = stbuf.st_uid;
|
uid = stbuf.st_uid;
|
||||||
}
|
}
|
||||||
if((gid_t)(-1) == gid){
|
if(static_cast<gid_t>(-1) == gid){
|
||||||
gid = stbuf.st_gid;
|
gid = stbuf.st_gid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2798,7 +2798,7 @@ static int s3fs_open(const char* _path, struct fuse_file_info* fi)
|
|||||||
FdEntity* ent;
|
FdEntity* ent;
|
||||||
headers_t meta;
|
headers_t meta;
|
||||||
|
|
||||||
if((unsigned int)fi->flags & O_TRUNC){
|
if(static_cast<unsigned int>(fi->flags) & O_TRUNC){
|
||||||
if(0 != st.st_size){
|
if(0 != st.st_size){
|
||||||
st.st_size = 0;
|
st.st_size = 0;
|
||||||
needs_flush = true;
|
needs_flush = true;
|
||||||
|
@ -51,7 +51,7 @@ int main(int argc, const char *argv[])
|
|||||||
|
|
||||||
// truncate
|
// truncate
|
||||||
if(0 != ftruncate(fd, size)){
|
if(0 != ftruncate(fd, size)){
|
||||||
fprintf(stderr, "[ERROR] Could not truncate file(%s) to %lld byte.\n", filepath, (long long)size);
|
fprintf(stderr, "[ERROR] Could not truncate file(%s) to %lld byte.\n", filepath, static_cast<long long>(size));
|
||||||
close(fd);
|
close(fd);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user