diff --git a/src/cache.h b/src/cache.h index 82aa6e2..410d447 100644 --- a/src/cache.h +++ b/src/cache.h @@ -163,7 +163,7 @@ class StatCache // Delete stat cache bool DelStat(const char* key, bool lock_already_held = false); - bool DelStat(std::string& key, bool lock_already_held = false) + bool DelStat(const std::string& key, bool lock_already_held = false) { return DelStat(key.c_str(), lock_already_held); } diff --git a/src/curl.cpp b/src/curl.cpp index a1eb733..51a3671 100644 --- a/src/curl.cpp +++ b/src/curl.cpp @@ -761,9 +761,9 @@ storage_class_t S3fsCurl::SetStorageClass(storage_class_t storage_class) return old; } -bool S3fsCurl::PushbackSseKeys(std::string& onekey) +bool S3fsCurl::PushbackSseKeys(const std::string& input) { - onekey = trim(onekey); + std::string onekey = trim(input); if(onekey.empty()){ return false; } @@ -2770,8 +2770,9 @@ bool S3fsCurl::LoadIAMRoleFromMetaData() return (0 == result); } -bool S3fsCurl::AddSseRequestHead(sse_type_t ssetype, std::string& ssevalue, bool is_only_c, bool is_copy) +bool S3fsCurl::AddSseRequestHead(sse_type_t ssetype, const std::string& input, bool is_only_c, bool is_copy) { + std::string ssevalue = input; switch(ssetype){ case sse_type_t::SSE_DISABLE: return true; @@ -3133,7 +3134,7 @@ int S3fsCurl::PutRequest(const char* tpath, headers_t& meta, int fd) return result; } -int S3fsCurl::PreGetObjectRequest(const char* tpath, int fd, off_t start, off_t size, sse_type_t ssetype, std::string& ssevalue) +int S3fsCurl::PreGetObjectRequest(const char* tpath, int fd, off_t start, off_t size, sse_type_t ssetype, const std::string& ssevalue) { S3FS_PRN_INFO3("[tpath=%s][start=%lld][size=%lld]", SAFESTRPTR(tpath), static_cast(start), static_cast(size)); diff --git a/src/curl.h b/src/curl.h index 3d1c93e..9075f57 100644 --- a/src/curl.h +++ b/src/curl.h @@ -240,7 +240,7 @@ class S3fsCurl static bool SetIAMRoleFromMetaData(const char* response); static bool LoadEnvSseCKeys(); static bool LoadEnvSseKmsid(); - static bool PushbackSseKeys(std::string& onekey); + static bool PushbackSseKeys(const std::string& onekey); static bool AddUserAgent(CURL* hCurl); static int CurlDebugFunc(CURL* hcurl, curl_infotype type, char* data, size_t size, void* userptr); @@ -352,18 +352,18 @@ class S3fsCurl bool DestroyCurlHandle(bool restore_pool = true, bool clear_internal_data = true); bool LoadIAMRoleFromMetaData(); - bool AddSseRequestHead(sse_type_t ssetype, std::string& ssevalue, bool is_only_c, bool is_copy); + bool AddSseRequestHead(sse_type_t ssetype, const std::string& ssevalue, bool is_only_c, bool is_copy); bool GetResponseCode(long& responseCode, bool from_curl_handle = true); int RequestPerform(bool dontAddAuthHeaders=false); int DeleteRequest(const char* tpath); bool PreHeadRequest(const char* tpath, const char* bpath = NULL, const char* savedpath = NULL, int ssekey_pos = -1); - bool PreHeadRequest(std::string& tpath, std::string& bpath, std::string& savedpath, int ssekey_pos = -1) { + bool PreHeadRequest(const std::string& tpath, const std::string& bpath, const std::string& savedpath, int ssekey_pos = -1) { return PreHeadRequest(tpath.c_str(), bpath.c_str(), savedpath.c_str(), ssekey_pos); } int HeadRequest(const char* tpath, headers_t& meta); int PutHeadRequest(const char* tpath, headers_t& meta, bool is_copy); int PutRequest(const char* tpath, headers_t& meta, int fd); - int PreGetObjectRequest(const char* tpath, int fd, off_t start, off_t size, sse_type_t ssetype, std::string& ssevalue); + int PreGetObjectRequest(const char* tpath, int fd, off_t start, off_t size, sse_type_t ssetype, const std::string& ssevalue); int GetObjectRequest(const char* tpath, int fd, off_t start = -1, off_t size = -1); int CheckBucket(); int ListBucketRequest(const char* tpath, const char* query); diff --git a/src/curl_util.h b/src/curl_util.h index 889733d..b9fcb73 100644 --- a/src/curl_util.h +++ b/src/curl_util.h @@ -27,8 +27,6 @@ // Functions //---------------------------------------------- std::string GetContentMD5(int fd); -unsigned char* md5hexsum(int fd, off_t start, ssize_t size); -std::string md5sum(int fd, off_t start, ssize_t size); struct curl_slist* curl_slist_sort_insert(struct curl_slist* list, const char* data); struct curl_slist* curl_slist_sort_insert(struct curl_slist* list, const char* key, const char* value); std::string get_sorted_header_keys(const struct curl_slist* list); diff --git a/src/string_util.cpp b/src/string_util.cpp index 6e847e6..e1d073b 100644 --- a/src/string_util.cpp +++ b/src/string_util.cpp @@ -245,7 +245,7 @@ bool takeout_str_dquart(std::string& str) // // ex. target="http://......?keyword=value&..." // -bool get_keyword_value(std::string& target, const char* keyword, std::string& value) +bool get_keyword_value(const std::string& target, const char* keyword, std::string& value) { if(!keyword){ return false; diff --git a/src/string_util.h b/src/string_util.h index 427e8f7..84f6bc3 100644 --- a/src/string_util.h +++ b/src/string_util.h @@ -87,7 +87,7 @@ std::string urlEncode2(const std::string &s); std::string urlDecode(const std::string& s); bool takeout_str_dquart(std::string& str); -bool get_keyword_value(std::string& target, const char* keyword, std::string& value); +bool get_keyword_value(const std::string& target, const char* keyword, std::string& value); // // For binary string