mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-12-23 17:28:56 +00:00
Pass by const reference where possible
This commit is contained in:
parent
a6455ef1bc
commit
b946b59522
12
src/curl.cpp
12
src/curl.cpp
@ -514,7 +514,7 @@ bool S3fsCurl::InitMimeType(const char* MimeFile)
|
|||||||
// @param s e.g., "index.html"
|
// @param s e.g., "index.html"
|
||||||
// @return e.g., "text/html"
|
// @return e.g., "text/html"
|
||||||
//
|
//
|
||||||
string S3fsCurl::LookupMimeType(string name)
|
string S3fsCurl::LookupMimeType(const string& name)
|
||||||
{
|
{
|
||||||
string result("application/octet-stream");
|
string result("application/octet-stream");
|
||||||
string::size_type last_pos = name.find_last_of('.');
|
string::size_type last_pos = name.find_last_of('.');
|
||||||
@ -1902,7 +1902,7 @@ int S3fsCurl::RequestPerform(void)
|
|||||||
// @param date e.g., get_date_rfc850()
|
// @param date e.g., get_date_rfc850()
|
||||||
// @param resource e.g., "/pub"
|
// @param resource e.g., "/pub"
|
||||||
//
|
//
|
||||||
string S3fsCurl::CalcSignatureV2(string method, string strMD5, string content_type, string date, string resource)
|
string S3fsCurl::CalcSignatureV2(const string& method, const string& strMD5, const string& content_type, const string& date, const string& resource)
|
||||||
{
|
{
|
||||||
string Signature;
|
string Signature;
|
||||||
string StringToSign;
|
string StringToSign;
|
||||||
@ -1944,7 +1944,7 @@ string S3fsCurl::CalcSignatureV2(string method, string strMD5, string content_ty
|
|||||||
return Signature;
|
return Signature;
|
||||||
}
|
}
|
||||||
|
|
||||||
string S3fsCurl::CalcSignature(string method, string canonical_uri, string query_string, string strdate, string payload_hash, string date8601)
|
string S3fsCurl::CalcSignature(const string& method, const string& canonical_uri, const string& query_string, const string& strdate, const string& payload_hash, const string& date8601)
|
||||||
{
|
{
|
||||||
string Signature, StringCQ, StringToSign;
|
string Signature, StringCQ, StringToSign;
|
||||||
string uriencode;
|
string uriencode;
|
||||||
@ -3079,7 +3079,7 @@ int S3fsCurl::AbortMultipartUpload(const char* tpath, string& upload_id)
|
|||||||
// Authorization: AWS VGhpcyBtZXNzYWdlIHNpZ25lZGGieSRlbHZpbmc=
|
// Authorization: AWS VGhpcyBtZXNzYWdlIHNpZ25lZGGieSRlbHZpbmc=
|
||||||
//
|
//
|
||||||
|
|
||||||
int S3fsCurl::UploadMultipartPostSetup(const char* tpath, int part_num, string& upload_id)
|
int S3fsCurl::UploadMultipartPostSetup(const char* tpath, int part_num, const string& upload_id)
|
||||||
{
|
{
|
||||||
S3FS_PRN_INFO3("[tpath=%s][start=%jd][size=%zd][part=%d]", SAFESTRPTR(tpath), (intmax_t)(partdata.startpos), partdata.size, part_num);
|
S3FS_PRN_INFO3("[tpath=%s][start=%jd][size=%zd][part=%d]", SAFESTRPTR(tpath), (intmax_t)(partdata.startpos), partdata.size, part_num);
|
||||||
|
|
||||||
@ -3158,7 +3158,7 @@ int S3fsCurl::UploadMultipartPostSetup(const char* tpath, int part_num, string&
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int S3fsCurl::UploadMultipartPostRequest(const char* tpath, int part_num, string& upload_id)
|
int S3fsCurl::UploadMultipartPostRequest(const char* tpath, int part_num, const string& upload_id)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
@ -3393,7 +3393,7 @@ int S3fsCurl::MultipartUploadRequest(const char* tpath, headers_t& meta, int fd,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int S3fsCurl::MultipartUploadRequest(string upload_id, const char* tpath, int fd, off_t offset, size_t size, etaglist_t& list)
|
int S3fsCurl::MultipartUploadRequest(const string& upload_id, const char* tpath, int fd, off_t offset, size_t size, etaglist_t& list)
|
||||||
{
|
{
|
||||||
S3FS_PRN_INFO3("[upload_id=%s][tpath=%s][fd=%d][offset=%jd][size=%jd]", upload_id.c_str(), SAFESTRPTR(tpath), fd, (intmax_t)offset, (intmax_t)size);
|
S3FS_PRN_INFO3("[upload_id=%s][tpath=%s][fd=%d][offset=%jd][size=%jd]", upload_id.c_str(), SAFESTRPTR(tpath), fd, (intmax_t)offset, (intmax_t)size);
|
||||||
|
|
||||||
|
12
src/curl.h
12
src/curl.h
@ -273,12 +273,12 @@ class S3fsCurl
|
|||||||
bool RemakeHandle(void);
|
bool RemakeHandle(void);
|
||||||
bool ClearInternalData(void);
|
bool ClearInternalData(void);
|
||||||
void insertV4Headers(const std::string &op, const std::string &path, const std::string &query_string, const std::string &payload_hash);
|
void insertV4Headers(const std::string &op, const std::string &path, const std::string &query_string, const std::string &payload_hash);
|
||||||
std::string CalcSignatureV2(std::string method, std::string strMD5, std::string content_type, std::string date, std::string resource);
|
std::string CalcSignatureV2(const std::string& method, const std::string& strMD5, const std::string& content_type, const std::string& date, const std::string& resource);
|
||||||
std::string CalcSignature(std::string method, std::string canonical_uri, std::string query_string, std::string strdate, std::string payload_hash, std::string date8601);
|
std::string CalcSignature(const std::string& method, const std::string& canonical_uri, const std::string& query_string, const std::string& strdate, const std::string& payload_hash, const std::string& date8601);
|
||||||
bool GetUploadId(std::string& upload_id);
|
bool GetUploadId(std::string& upload_id);
|
||||||
int GetIAMCredentials(void);
|
int GetIAMCredentials(void);
|
||||||
|
|
||||||
int UploadMultipartPostSetup(const char* tpath, int part_num, std::string& upload_id);
|
int UploadMultipartPostSetup(const char* tpath, int part_num, const std::string& upload_id);
|
||||||
int CopyMultipartPostRequest(const char* from, const char* to, int part_num, std::string& upload_id, headers_t& meta);
|
int CopyMultipartPostRequest(const char* from, const char* to, int part_num, std::string& upload_id, headers_t& meta);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -290,7 +290,7 @@ class S3fsCurl
|
|||||||
static bool CheckIAMCredentialUpdate(void);
|
static bool CheckIAMCredentialUpdate(void);
|
||||||
|
|
||||||
// class methods(valiables)
|
// class methods(valiables)
|
||||||
static std::string LookupMimeType(std::string name);
|
static std::string LookupMimeType(const std::string& name);
|
||||||
static bool SetCheckCertificate(bool isCertCheck);
|
static bool SetCheckCertificate(bool isCertCheck);
|
||||||
static bool SetDnsCache(bool isCache);
|
static bool SetDnsCache(bool isCache);
|
||||||
static bool SetSslSessionCache(bool isCache);
|
static bool SetSslSessionCache(bool isCache);
|
||||||
@ -357,12 +357,12 @@ class S3fsCurl
|
|||||||
int ListBucketRequest(const char* tpath, const char* query);
|
int ListBucketRequest(const char* tpath, const char* query);
|
||||||
int PreMultipartPostRequest(const char* tpath, headers_t& meta, std::string& upload_id, bool is_copy);
|
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, std::string& upload_id, etaglist_t& parts);
|
||||||
int UploadMultipartPostRequest(const char* tpath, int part_num, std::string& upload_id);
|
int UploadMultipartPostRequest(const char* tpath, int part_num, const std::string& upload_id);
|
||||||
int MultipartListRequest(std::string& body);
|
int MultipartListRequest(std::string& body);
|
||||||
int AbortMultipartUpload(const char* tpath, std::string& upload_id);
|
int AbortMultipartUpload(const char* tpath, std::string& upload_id);
|
||||||
int MultipartHeadRequest(const char* tpath, off_t size, headers_t& meta, bool is_copy);
|
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 char* tpath, headers_t& meta, int fd, bool is_copy);
|
||||||
int MultipartUploadRequest(std::string upload_id, const char* tpath, int fd, off_t offset, size_t size, etaglist_t& list);
|
int MultipartUploadRequest(const std::string& upload_id, const char* tpath, int fd, off_t offset, size_t size, etaglist_t& list);
|
||||||
int MultipartRenameRequest(const char* from, const char* to, headers_t& meta, off_t size);
|
int MultipartRenameRequest(const char* from, const char* to, headers_t& meta, off_t size);
|
||||||
|
|
||||||
// methods(valiables)
|
// methods(valiables)
|
||||||
|
Loading…
Reference in New Issue
Block a user