merged main

This commit is contained in:
Kristján Valur Jónsson 2019-02-19 10:53:00 +00:00
commit 3c97c1b251
7 changed files with 12 additions and 7 deletions

View File

@ -32,6 +32,7 @@ cppcheck:
cppcheck --quiet --error-exitcode=1 \
--inline-suppr \
--std=c++03 \
--xml \
-D HAVE_ATTR_XATTR_H \
-D HAVE_SYS_EXTATTR_H \
-D HAVE_MALLOC_TRIM \
@ -40,4 +41,5 @@ cppcheck:
-U ENOATTR \
--enable=warning,style,information,missingInclude \
--suppress=missingIncludeSystem \
--suppress=unmatchedSuppression \
src/ test/

View File

@ -167,6 +167,7 @@ Generally S3 cannot offer the same performance or semantics as a local file syst
* no atomic renames of files or directories
* no coordination between multiple clients mounting the same bucket
* no hard links
* inotify detects only local modifications, not external ones by other clients or tools
References
----------

View File

@ -659,9 +659,8 @@ string S3fsCurl::LookupMimeType(const string& name)
return result;
}
// extract the last extension
if(last_pos != string::npos){
ext = name.substr(1+last_pos, string::npos);
}
ext = name.substr(1+last_pos, string::npos);
if (last_pos != string::npos) {
// one dot was found, now look for another
if (first_pos != string::npos && first_pos < last_pos) {

View File

@ -371,6 +371,7 @@ unsigned char* s3fs_sha256hexsum(int fd, off_t start, ssize_t size)
bool s3fs_sha256(const unsigned char* data, unsigned int datalen, unsigned char** digest, unsigned int* digestlen)
{
(*digestlen) = static_cast<unsigned int>(get_sha256_digest_length());
// cppcheck-suppress constArgument
if(NULL == ((*digest) = reinterpret_cast<unsigned char*>(malloc(*digestlen)))){
return false;
}

View File

@ -896,7 +896,7 @@ static int s3fs_getattr(const char* _path, struct stat* stbuf)
static int s3fs_readlink(const char* _path, char* buf, size_t size)
{
if(!_path || !buf || 0 >= size){
if(!_path || !buf || 0 == size){
return 0;
}
WTF8_ENCODE(path)
@ -2198,7 +2198,7 @@ static int s3fs_read(const char* _path, char* buf, size_t size, off_t offset, st
// check real file size
size_t realsize = 0;
if(!ent->GetSize(realsize) || realsize <= 0){
if(!ent->GetSize(realsize) || 0 == realsize){
S3FS_PRN_DBG("file size is 0, so break to read.");
FdManager::get()->Close(ent);
return 0;
@ -3302,7 +3302,7 @@ static int s3fs_listxattr(const char* path, char* list, size_t size)
}
// check parameters
if(size <= 0){
if(0 == size){
free_xattrs(xattrs);
return total;
}

View File

@ -152,7 +152,9 @@ bool S3ObjList::insert_normalized(const char* name, const char* normalized, bool
// found name --> over write
(*iter).second.orgname.erase();
(*iter).second.etag.erase();
// cppcheck-suppress unreadVariable
(*iter).second.normalname = normalized;
// cppcheck-suppress unreadVariable
(*iter).second.is_dir = is_dir;
}else{
// not found --> add new object

View File

@ -369,7 +369,7 @@ char* s3fs_base64(const unsigned char* input, size_t length)
static const char* base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
char* result;
if(!input || 0 >= length){
if(!input || 0 == length){
return NULL;
}
if(NULL == (result = reinterpret_cast<char*>(malloc((((length / 3) + 1) * 4 + 1) * sizeof(char))))){