Make some methods const (#2614)

Found via cppcheck --inconclusive.
This commit is contained in:
Andrew Gaul 2024-12-01 10:31:03 +09:00 committed by GitHub
parent 65e4aef2a1
commit d4f3fb01fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 10 additions and 10 deletions

View File

@ -1089,7 +1089,7 @@ bool S3fsCurl::SetIPResolveType(const char* value)
return true;
}
int S3fsCurl::MapPutErrorResponse(int result)
int S3fsCurl::MapPutErrorResponse(int result) const
{
if(result != 0){
return result;

View File

@ -254,7 +254,7 @@ class S3fsCurl
int MultipartUploadCopyPartSetup(const char* from, const char* to, int part_num, const std::string& upload_id, const headers_t& meta);
bool MultipartUploadContentPartComplete();
bool MultipartUploadCopyPartComplete();
int MapPutErrorResponse(int result);
int MapPutErrorResponse(int result) const;
public:
// class methods

View File

@ -1000,7 +1000,7 @@ void PageList::Dump() const
// If it is a bad area in the previous case, it will be reported as an error.
// If the latter case does not match, it will be reported as a warning.
//
bool PageList::CompareSparseFile(int fd, size_t file_size, fdpage_list_t& err_area_list, fdpage_list_t& warn_area_list)
bool PageList::CompareSparseFile(int fd, size_t file_size, fdpage_list_t& err_area_list, fdpage_list_t& warn_area_list) const
{
err_area_list.clear();
warn_area_list.clear();

View File

@ -125,7 +125,7 @@ class PageList
bool Compress();
bool Deserialize(CacheFileStat& file, ino_t inode);
void Dump() const;
bool CompareSparseFile(int fd, size_t file_size, fdpage_list_t& err_area_list, fdpage_list_t& warn_area_list);
bool CompareSparseFile(int fd, size_t file_size, fdpage_list_t& err_area_list, fdpage_list_t& warn_area_list) const;
};
#endif // S3FS_FDCACHE_PAGE_H_

View File

@ -27,7 +27,7 @@
//------------------------------------------------
// UntreatedParts methods
//------------------------------------------------
bool UntreatedParts::empty()
bool UntreatedParts::empty() const
{
const std::lock_guard<std::mutex> lock(untreated_list_lock);
return untreated_list.empty();

View File

@ -48,7 +48,7 @@ class UntreatedParts
UntreatedParts& operator=(const UntreatedParts&) = delete;
UntreatedParts& operator=(UntreatedParts&&) = delete;
bool empty();
bool empty() const;
bool AddPart(off_t start, off_t size);
bool GetLastUpdatedPart(off_t& start, off_t& size, off_t max_size, off_t min_size = MIN_MULTIPART_SIZE) const { return RowGetPart(start, size, max_size, min_size, true); }

View File

@ -1039,7 +1039,7 @@ bool S3fsCred::InitialS3fsCredentials()
//-------------------------------------------------------------------
// Methods : for IAM
//-------------------------------------------------------------------
bool S3fsCred::ParseIAMCredentialResponse(const char* response, iamcredmap_t& keyval)
bool S3fsCred::ParseIAMCredentialResponse(const char* response, iamcredmap_t& keyval) const
{
if(!response){
return false;

View File

@ -148,7 +148,7 @@ class S3fsCred
bool ReadAwsCredentialFile(const std::string &filename) REQUIRES(S3fsCred::token_lock);
bool InitialS3fsCredentials() REQUIRES(S3fsCred::token_lock);
bool ParseIAMCredentialResponse(const char* response, iamcredmap_t& keyval);
bool ParseIAMCredentialResponse(const char* response, iamcredmap_t& keyval) const;
bool GetIAMCredentialsURL(std::string& url, bool check_iam_role) REQUIRES(S3fsCred::token_lock);
bool LoadIAMCredentials() REQUIRES(S3fsCred::token_lock);

View File

@ -234,7 +234,7 @@ S3fsLog::s3fs_log_level S3fsLog::LowSetLogLevel(s3fs_log_level level)
return old;
}
S3fsLog::s3fs_log_level S3fsLog::LowBumpupLogLevel()
S3fsLog::s3fs_log_level S3fsLog::LowBumpupLogLevel() const
{
if(S3fsLog::pSingleton != this){
S3FS_PRN_ERR("This object is not as same as S3fsLog::pSingleton.");

View File

@ -67,7 +67,7 @@ class S3fsLog
bool LowLoadEnv();
bool LowSetLogfile(const char* pfile);
s3fs_log_level LowSetLogLevel(s3fs_log_level level);
s3fs_log_level LowBumpupLogLevel();
s3fs_log_level LowBumpupLogLevel() const;
public:
static bool IsS3fsLogLevel(s3fs_log_level level);