Skip to content

Commit

Permalink
Fixed errors of cppcheck 2.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ggtakec committed Sep 24, 2023
1 parent 64642e1 commit bad5135
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ bool StatCache::AddStat(const std::string& key, const headers_t& meta, bool forc
// Since the file mode may change while the file is open, it is
// updated as well.
//
bool StatCache::UpdateMetaStats(const std::string& key, headers_t& meta)
bool StatCache::UpdateMetaStats(const std::string& key, const headers_t& meta)
{
if(CacheSize < 1){
return true;
Expand All @@ -423,7 +423,7 @@ bool StatCache::UpdateMetaStats(const std::string& key, headers_t& meta)
stat_cache_entry* ent = &iter->second;

// update only meta keys
for(headers_t::iterator metaiter = meta.begin(); metaiter != meta.end(); ++metaiter){
for(headers_t::const_iterator metaiter = meta.begin(); metaiter != meta.end(); ++metaiter){
std::string tag = lower(metaiter->first);
std::string value = metaiter->second;
if(tag == "content-type"){
Expand Down
2 changes: 1 addition & 1 deletion src/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class StatCache
bool AddStat(const std::string& key, const headers_t& meta, bool forcedir = false, bool no_truncate = false);

// Update meta stats
bool UpdateMetaStats(const std::string& key, headers_t& meta);
bool UpdateMetaStats(const std::string& key, const headers_t& meta);

// Change no truncate flag
void ChangeNoTruncateFlag(const std::string& key, bool no_truncate);
Expand Down
4 changes: 4 additions & 0 deletions src/curl_multi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ int S3fsMultiCurl::MultiRead()
isPostpone = true;
}else if(400 > responseCode){
// add into stat cache
// cppcheck-suppress unmatchedSuppression
// cppcheck-suppress knownPointerToBool
if(SuccessCallback && !SuccessCallback(s3fscurl.get(), pSuccessCallbackParam)){
S3FS_PRN_WARN("error from success callback function(%s).", s3fscurl->url.c_str());
}
Expand All @@ -232,6 +234,8 @@ int S3fsMultiCurl::MultiRead()
S3FS_PRN_WARN("failed a request(%ld: %s)", responseCode, s3fscurl->url.c_str());
}
// Call callback function
// cppcheck-suppress unmatchedSuppression
// cppcheck-suppress knownPointerToBool
if(NotFoundCallback && !NotFoundCallback(s3fscurl.get(), pNotFoundCallbackParam)){
S3FS_PRN_WARN("error from not found callback function(%s).", s3fscurl->url.c_str());
}
Expand Down
8 changes: 4 additions & 4 deletions src/mpu_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ utility_incomp_type utility_mode = utility_incomp_type::NO_UTILITY_MODE;
//-------------------------------------------------------------------
// Functions
//-------------------------------------------------------------------
static void print_incomp_mpu_list(incomp_mpu_list_t& list)
static void print_incomp_mpu_list(const incomp_mpu_list_t& list)
{
printf("\n");
printf("Lists the parts that have been uploaded for a specific multipart upload.\n");
Expand All @@ -47,7 +47,7 @@ static void print_incomp_mpu_list(incomp_mpu_list_t& list)
printf("---------------------------------------------------------------\n");

int cnt = 0;
for(incomp_mpu_list_t::iterator iter = list.begin(); iter != list.end(); ++iter, ++cnt){
for(incomp_mpu_list_t::const_iterator iter = list.begin(); iter != list.end(); ++iter, ++cnt){
printf(" Path : %s\n", (*iter).key.c_str());
printf(" UploadId : %s\n", (*iter).id.c_str());
printf(" Date : %s\n", (*iter).date.c_str());
Expand All @@ -60,7 +60,7 @@ static void print_incomp_mpu_list(incomp_mpu_list_t& list)
}
}

static bool abort_incomp_mpu_list(incomp_mpu_list_t& list, time_t abort_time)
static bool abort_incomp_mpu_list(const incomp_mpu_list_t& list, time_t abort_time)
{
if(list.empty()){
return true;
Expand All @@ -70,7 +70,7 @@ static bool abort_incomp_mpu_list(incomp_mpu_list_t& list, time_t abort_time)
// do removing.
S3fsCurl s3fscurl;
bool result = true;
for(incomp_mpu_list_t::iterator iter = list.begin(); iter != list.end(); ++iter){
for(incomp_mpu_list_t::const_iterator iter = list.begin(); iter != list.end(); ++iter){
const char* tpath = (*iter).key.c_str();
std::string upload_id = (*iter).id;

Expand Down

0 comments on commit bad5135

Please sign in to comment.