mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2025-01-09 07:59:52 +00:00
Merge pull request #1422 from gaul/c++/append-assign-at
Remove calls to append, assign, and at
This commit is contained in:
commit
0b42e08636
16
src/curl.cpp
16
src/curl.cpp
@ -517,7 +517,7 @@ bool S3fsCurl::LocateBundle()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
BF.close();
|
BF.close();
|
||||||
S3fsCurl::curl_ca_bundle.assign(CURL_CA_BUNDLE);
|
S3fsCurl::curl_ca_bundle = CURL_CA_BUNDLE;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
@ -549,22 +549,22 @@ bool S3fsCurl::LocateBundle()
|
|||||||
std::ifstream BF("/etc/pki/tls/certs/ca-bundle.crt");
|
std::ifstream BF("/etc/pki/tls/certs/ca-bundle.crt");
|
||||||
if(BF.good()){
|
if(BF.good()){
|
||||||
BF.close();
|
BF.close();
|
||||||
S3fsCurl::curl_ca_bundle.assign("/etc/pki/tls/certs/ca-bundle.crt");
|
S3fsCurl::curl_ca_bundle = "/etc/pki/tls/certs/ca-bundle.crt";
|
||||||
}else{
|
}else{
|
||||||
BF.open("/etc/ssl/certs/ca-certificates.crt");
|
BF.open("/etc/ssl/certs/ca-certificates.crt");
|
||||||
if(BF.good()){
|
if(BF.good()){
|
||||||
BF.close();
|
BF.close();
|
||||||
S3fsCurl::curl_ca_bundle.assign("/etc/ssl/certs/ca-certificates.crt");
|
S3fsCurl::curl_ca_bundle = "/etc/ssl/certs/ca-certificates.crt";
|
||||||
}else{
|
}else{
|
||||||
BF.open("/usr/share/ssl/certs/ca-bundle.crt");
|
BF.open("/usr/share/ssl/certs/ca-bundle.crt");
|
||||||
if(BF.good()){
|
if(BF.good()){
|
||||||
BF.close();
|
BF.close();
|
||||||
S3fsCurl::curl_ca_bundle.assign("/usr/share/ssl/certs/ca-bundle.crt");
|
S3fsCurl::curl_ca_bundle = "/usr/share/ssl/certs/ca-bundle.crt";
|
||||||
}else{
|
}else{
|
||||||
BF.open("/usr/local/share/certs/ca-root.crt");
|
BF.open("/usr/local/share/certs/ca-root.crt");
|
||||||
if(BF.good()){
|
if(BF.good()){
|
||||||
BF.close();
|
BF.close();
|
||||||
S3fsCurl::curl_ca_bundle.assign("/usr/share/ssl/certs/ca-bundle.crt");
|
S3fsCurl::curl_ca_bundle = "/usr/share/ssl/certs/ca-bundle.crt";
|
||||||
}else{
|
}else{
|
||||||
S3FS_PRN_ERR("%s: /.../ca-bundle.crt is not readable", program_name.c_str());
|
S3FS_PRN_ERR("%s: /.../ca-bundle.crt is not readable", program_name.c_str());
|
||||||
return false;
|
return false;
|
||||||
@ -3706,7 +3706,7 @@ bool S3fsCurl::UploadMultipartPostComplete()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
partdata.etaglist->at(partdata.etagpos).assign(it->second);
|
(*partdata.etaglist)[partdata.etagpos] = it->second;
|
||||||
partdata.uploaded = true;
|
partdata.uploaded = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -3726,9 +3726,9 @@ bool S3fsCurl::CopyMultipartPostComplete()
|
|||||||
std::string etag;
|
std::string etag;
|
||||||
partdata.uploaded = simple_parse_xml(bodydata.str(), bodydata.size(), "ETag", etag);
|
partdata.uploaded = simple_parse_xml(bodydata.str(), bodydata.size(), "ETag", etag);
|
||||||
if(etag.size() >= 2 && *etag.begin() == '"' && *etag.rbegin() == '"'){
|
if(etag.size() >= 2 && *etag.begin() == '"' && *etag.rbegin() == '"'){
|
||||||
etag.assign(etag.substr(1, etag.size() - 2));
|
etag = etag.substr(1, etag.size() - 2);
|
||||||
}
|
}
|
||||||
partdata.etaglist->at(partdata.etagpos).assign(etag);
|
(*partdata.etaglist)[partdata.etagpos] = etag;
|
||||||
|
|
||||||
bodydata.Clear();
|
bodydata.Clear();
|
||||||
headdata.Clear();
|
headdata.Clear();
|
||||||
|
@ -185,7 +185,7 @@ std::string get_canonical_headers(const struct curl_slist* list)
|
|||||||
// skip empty-value headers (as they are discarded by libcurl)
|
// skip empty-value headers (as they are discarded by libcurl)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
strhead = strkey.append(":").append(strval);
|
strhead = strkey + ":" + strval;
|
||||||
}else{
|
}else{
|
||||||
strhead = trim(lower(strhead));
|
strhead = trim(lower(strhead));
|
||||||
}
|
}
|
||||||
@ -214,7 +214,7 @@ std::string get_canonical_headers(const struct curl_slist* list, bool only_amz)
|
|||||||
// skip empty-value headers (as they are discarded by libcurl)
|
// skip empty-value headers (as they are discarded by libcurl)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
strhead = strkey.append(":").append(strval);
|
strhead = strkey + ":" + strval;
|
||||||
}else{
|
}else{
|
||||||
strhead = trim(lower(strhead));
|
strhead = trim(lower(strhead));
|
||||||
}
|
}
|
||||||
|
12
src/s3fs.cpp
12
src/s3fs.cpp
@ -3862,7 +3862,7 @@ static int get_access_keys()
|
|||||||
char * AWS_CREDENTIAL_FILE;
|
char * AWS_CREDENTIAL_FILE;
|
||||||
AWS_CREDENTIAL_FILE = getenv("AWS_CREDENTIAL_FILE");
|
AWS_CREDENTIAL_FILE = getenv("AWS_CREDENTIAL_FILE");
|
||||||
if(AWS_CREDENTIAL_FILE != NULL){
|
if(AWS_CREDENTIAL_FILE != NULL){
|
||||||
passwd_file.assign(AWS_CREDENTIAL_FILE);
|
passwd_file = AWS_CREDENTIAL_FILE;
|
||||||
if(!passwd_file.empty()){
|
if(!passwd_file.empty()){
|
||||||
std::ifstream PF(passwd_file.c_str());
|
std::ifstream PF(passwd_file.c_str());
|
||||||
if(PF.good()){
|
if(PF.good()){
|
||||||
@ -3888,8 +3888,8 @@ static int get_access_keys()
|
|||||||
char * HOME;
|
char * HOME;
|
||||||
HOME = getenv ("HOME");
|
HOME = getenv ("HOME");
|
||||||
if(HOME != NULL){
|
if(HOME != NULL){
|
||||||
passwd_file.assign(HOME);
|
passwd_file = HOME;
|
||||||
passwd_file.append("/.passwd-s3fs");
|
passwd_file += "/.passwd-s3fs";
|
||||||
std::ifstream PF(passwd_file.c_str());
|
std::ifstream PF(passwd_file.c_str());
|
||||||
if(PF.good()){
|
if(PF.good()){
|
||||||
PF.close();
|
PF.close();
|
||||||
@ -3906,7 +3906,7 @@ static int get_access_keys()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 5 - from the system default location
|
// 5 - from the system default location
|
||||||
passwd_file.assign("/etc/passwd-s3fs");
|
passwd_file = "/etc/passwd-s3fs";
|
||||||
std::ifstream PF(passwd_file.c_str());
|
std::ifstream PF(passwd_file.c_str());
|
||||||
if(PF.good()){
|
if(PF.good()){
|
||||||
PF.close();
|
PF.close();
|
||||||
@ -3966,7 +3966,7 @@ static int set_bucket(const char* arg)
|
|||||||
}
|
}
|
||||||
mount_prefix = pmount_prefix;
|
mount_prefix = pmount_prefix;
|
||||||
// remove trailing slash
|
// remove trailing slash
|
||||||
if(mount_prefix.at(mount_prefix.size() - 1) == '/'){
|
if(mount_prefix[mount_prefix.size() - 1] == '/'){
|
||||||
mount_prefix = mount_prefix.substr(0, mount_prefix.size() - 1);
|
mount_prefix = mount_prefix.substr(0, mount_prefix.size() - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4687,7 +4687,7 @@ int main(int argc, char* argv[])
|
|||||||
init_sysconf_vars();
|
init_sysconf_vars();
|
||||||
|
|
||||||
// get program name - emulate basename
|
// get program name - emulate basename
|
||||||
program_name.assign(argv[0]);
|
program_name = argv[0];
|
||||||
size_t found = program_name.find_last_of('/');
|
size_t found = program_name.find_last_of('/');
|
||||||
if(found != std::string::npos){
|
if(found != std::string::npos){
|
||||||
program_name.replace(0, found+1, "");
|
program_name.replace(0, found+1, "");
|
||||||
|
@ -259,7 +259,7 @@ bool get_keyword_value(std::string& target, const char* keyword, std::string& va
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
spos += strlen(keyword);
|
spos += strlen(keyword);
|
||||||
if('=' != target.at(spos)){
|
if('=' != target[spos]){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
spos++;
|
spos++;
|
||||||
|
Loading…
Reference in New Issue
Block a user