Merge pull request #904 from gaul/clang-tidy/c-str

Remove unnecessary calls to std::string::c_str
This commit is contained in:
Takeshi Nakatani 2019-01-20 14:13:46 +09:00 committed by GitHub
commit d373b0eca3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -231,11 +231,11 @@ bool StatCache::GetStat(string& key, struct stat* pst, headers_t* meta, bool ove
stat_cache_t::iterator iter = stat_cache.end();
if(overcheck && '/' != strpath[strpath.length() - 1]){
strpath += "/";
iter = stat_cache.find(strpath.c_str());
iter = stat_cache.find(strpath);
}
if(iter == stat_cache.end()){
strpath = key;
iter = stat_cache.find(strpath.c_str());
iter = stat_cache.find(strpath);
}
if(iter != stat_cache.end() && (*iter).second){
@ -320,11 +320,11 @@ bool StatCache::IsNoObjectCache(string& key, bool overcheck)
stat_cache_t::iterator iter = stat_cache.end();
if(overcheck && '/' != strpath[strpath.length() - 1]){
strpath += "/";
iter = stat_cache.find(strpath.c_str());
iter = stat_cache.find(strpath);
}
if(iter == stat_cache.end()){
strpath = key;
iter = stat_cache.find(strpath.c_str());
iter = stat_cache.find(strpath);
}
if(iter != stat_cache.end() && (*iter).second) {
@ -582,7 +582,7 @@ bool StatCache::DelStat(const char* key)
// If there is "path/" cache, delete it.
strpath += "/";
}
if(stat_cache.end() != (iter = stat_cache.find(strpath.c_str()))){
if(stat_cache.end() != (iter = stat_cache.find(strpath))){
if((*iter).second){
delete (*iter).second;
}

View File

@ -4342,10 +4342,10 @@ string prepare_url(const char* url)
uri = url_str.substr(0, uri_length);
if(!pathrequeststyle){
hostname = bucket + "." + url_str.substr(uri_length, bucket_pos - uri_length).c_str();
hostname = bucket + "." + url_str.substr(uri_length, bucket_pos - uri_length);
path = url_str.substr((bucket_pos + bucket_length));
}else{
hostname = url_str.substr(uri_length, bucket_pos - uri_length).c_str();
hostname = url_str.substr(uri_length, bucket_pos - uri_length);
string part = url_str.substr((bucket_pos + bucket_length));
if('/' != part[0]){
part = "/" + part;