Merge pull request #1158 from ggtakec/fix_cppcheck

Fixed build error by cppcheck 1.89
This commit is contained in:
Takeshi Nakatani 2019-09-23 20:22:33 +09:00 committed by GitHub
commit b6349e9428
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 18 additions and 17 deletions

View File

@ -168,7 +168,7 @@ void AdditionalHeader::Unload()
{
is_enable = false;
for(addheadlist_t::iterator iter = addheadlist.begin(); iter != addheadlist.end(); iter = addheadlist.erase(iter)){
for(addheadlist_t::iterator iter = addheadlist.begin(); iter != addheadlist.end(); ++iter){
ADDHEAD *paddhead = *iter;
if(paddhead){
if(paddhead->pregex){
@ -178,6 +178,7 @@ void AdditionalHeader::Unload()
delete paddhead;
}
}
addheadlist.clear();
}
bool AdditionalHeader::AddHeader(headers_t& meta, const char* path) const

View File

@ -87,7 +87,7 @@ inline void InitStatCacheTime(struct timespec& ts)
ts.tv_nsec = 0;
}
inline int CompareStatCacheTime(struct timespec& ts1, struct timespec& ts2)
inline int CompareStatCacheTime(const struct timespec& ts1, const struct timespec& ts2)
{
// return -1: ts1 < ts2
// 0: ts1 == ts2
@ -304,7 +304,7 @@ bool StatCache::GetStat(const string& key, struct stat* pst, headers_t* meta, bo
return false;
}
bool StatCache::IsNoObjectCache(string& key, bool overcheck)
bool StatCache::IsNoObjectCache(const string& key, bool overcheck)
{
bool is_delete_cache = false;
string strpath = key;

View File

@ -110,7 +110,7 @@ class StatCache
}
// Cache For no object
bool IsNoObjectCache(std::string& key, bool overcheck = true);
bool IsNoObjectCache(const std::string& key, bool overcheck = true);
bool AddNoObjectCache(std::string& key);
// Add stat cache

View File

@ -3420,7 +3420,7 @@ int S3fsCurl::PreMultipartPostRequest(const char* tpath, headers_t& meta, string
return 0;
}
int S3fsCurl::CompleteMultipartPostRequest(const char* tpath, string& upload_id, etaglist_t& parts)
int S3fsCurl::CompleteMultipartPostRequest(const char* tpath, const string& upload_id, etaglist_t& parts)
{
S3FS_PRN_INFO3("[tpath=%s][parts=%zu]", SAFESTRPTR(tpath), parts.size());
@ -3530,7 +3530,7 @@ int S3fsCurl::MultipartListRequest(string& body)
return result;
}
int S3fsCurl::AbortMultipartUpload(const char* tpath, string& upload_id)
int S3fsCurl::AbortMultipartUpload(const char* tpath, const string& upload_id)
{
S3FS_PRN_INFO3("[tpath=%s]", SAFESTRPTR(tpath));
@ -3662,7 +3662,7 @@ int S3fsCurl::UploadMultipartPostRequest(const char* tpath, int part_num, const
return result;
}
int S3fsCurl::CopyMultipartPostSetup(const char* from, const char* to, int part_num, string& upload_id, headers_t& meta)
int S3fsCurl::CopyMultipartPostSetup(const char* from, const char* to, int part_num, const string& upload_id, headers_t& meta)
{
S3FS_PRN_INFO3("[from=%s][to=%s][part=%d]", SAFESTRPTR(from), SAFESTRPTR(to), part_num);

View File

@ -396,7 +396,7 @@ class S3fsCurl
int GetIAMCredentials(void);
int UploadMultipartPostSetup(const char* tpath, int part_num, const std::string& upload_id);
int CopyMultipartPostSetup(const char* from, const char* to, int part_num, std::string& upload_id, headers_t& meta);
int CopyMultipartPostSetup(const char* from, const char* to, int part_num, const std::string& upload_id, headers_t& meta);
bool UploadMultipartPostComplete();
bool CopyMultipartPostComplete();
@ -494,10 +494,10 @@ class S3fsCurl
int CheckBucket(void);
int ListBucketRequest(const char* tpath, const char* query);
int PreMultipartPostRequest(const char* tpath, headers_t& meta, std::string& upload_id, bool is_copy);
int CompleteMultipartPostRequest(const char* tpath, std::string& upload_id, etaglist_t& parts);
int CompleteMultipartPostRequest(const char* tpath, const std::string& upload_id, etaglist_t& parts);
int UploadMultipartPostRequest(const char* tpath, int part_num, const std::string& upload_id);
int MultipartListRequest(std::string& body);
int AbortMultipartUpload(const char* tpath, std::string& upload_id);
int AbortMultipartUpload(const char* tpath, const std::string& upload_id);
int MultipartHeadRequest(const char* tpath, off_t size, headers_t& meta, bool is_copy);
int MultipartUploadRequest(const char* tpath, headers_t& meta, int fd, bool is_copy);
int MultipartUploadRequest(const std::string& upload_id, const char* tpath, int fd, off_t offset, off_t size, etaglist_t& list);

View File

@ -172,7 +172,7 @@ static int check_parent_object_access(const char* path, int mask);
static FdEntity* get_local_fent(const char* path, bool is_load = false);
static bool multi_head_callback(S3fsCurl* s3fscurl);
static S3fsCurl* multi_head_retry_callback(S3fsCurl* s3fscurl);
static int readdir_multi_head(const char* path, S3ObjList& head, void* buf, fuse_fill_dir_t filler);
static int readdir_multi_head(const char* path, const S3ObjList& head, void* buf, fuse_fill_dir_t filler);
static int list_bucket(const char* path, S3ObjList& head, const char* delimiter, bool check_content_only = false);
static int directory_empty(const char* path);
static bool is_truncated(xmlDocPtr doc);
@ -2440,7 +2440,7 @@ static S3fsCurl* multi_head_retry_callback(S3fsCurl* s3fscurl)
return newcurl;
}
static int readdir_multi_head(const char* path, S3ObjList& head, void* buf, fuse_fill_dir_t filler)
static int readdir_multi_head(const char* path, const S3ObjList& head, void* buf, fuse_fill_dir_t filler)
{
S3fsMultiCurl curlmulti(S3fsCurl::GetMaxMultiRequest());
s3obj_list_t headlist;
@ -2750,7 +2750,7 @@ static bool GetXmlNsUrl(xmlDocPtr doc, string& nsurl)
bool result = false;
if(!doc){
return result;
return false;
}
if((tmLast + 60) < time(NULL)){
// refresh
@ -2877,7 +2877,7 @@ static bool is_truncated(xmlDocPtr doc)
xmlChar* strTruncate = get_base_exp(doc, "IsTruncated");
if(!strTruncate){
return result;
return false;
}
if(0 == strcasecmp((const char*)strTruncate, "true")){
result = true;

View File

@ -994,18 +994,18 @@ bool simple_parse_xml(const char* data, size_t len, const char* key, std::string
bool result = false;
if(!data || !key){
return result;
return false;
}
value.clear();
xmlDocPtr doc;
if(NULL == (doc = xmlReadMemory(data, len, "", NULL, 0))){
return result;
return false;
}
if(NULL == doc->children){
S3FS_XMLFREEDOC(doc);
return result;
return false;
}
for(xmlNodePtr cur_node = doc->children->children; NULL != cur_node; cur_node = cur_node->next){
// For DEBUG