mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-12-23 01:08:54 +00:00
Prefer specific [io]stringstream where possible
These better communicate intent and are slightly more efficient.
This commit is contained in:
parent
a442e843be
commit
07636c8a8d
@ -93,7 +93,7 @@ bool AdditionalHeader::Load(const char* file)
|
||||
continue;
|
||||
}
|
||||
// load a line
|
||||
stringstream ss(line);
|
||||
istringstream ss(line);
|
||||
string key; // suffix(key)
|
||||
string head; // additional HTTP header
|
||||
string value; // header value
|
||||
@ -245,7 +245,7 @@ bool AdditionalHeader::Dump(void) const
|
||||
return true;
|
||||
}
|
||||
|
||||
stringstream ssdbg;
|
||||
ostringstream ssdbg;
|
||||
int cnt = 1;
|
||||
|
||||
ssdbg << "Additional Header list[" << addheadlist.size() << "] = {" << endl;
|
||||
|
@ -611,7 +611,7 @@ bool S3fsCurl::InitMimeType(const char* MimeFile)
|
||||
continue;
|
||||
}
|
||||
|
||||
stringstream tmp(line);
|
||||
istringstream tmp(line);
|
||||
string mimeType;
|
||||
tmp >> mimeType;
|
||||
while(tmp){
|
||||
@ -808,7 +808,7 @@ size_t S3fsCurl::HeaderCallback(void* data, size_t blockSize, size_t numBlocks,
|
||||
headers_t* headers = reinterpret_cast<headers_t*>(userPtr);
|
||||
string header(reinterpret_cast<char*>(data), blockSize * numBlocks);
|
||||
string key;
|
||||
stringstream ss(header);
|
||||
istringstream ss(header);
|
||||
|
||||
if(getline(ss, key, ':')){
|
||||
// Force to lower, only "x-amz"
|
||||
@ -3681,7 +3681,7 @@ int S3fsCurl::MultipartHeadRequest(const char* tpath, off_t size, headers_t& met
|
||||
off_t chunk;
|
||||
off_t bytes_remaining;
|
||||
etaglist_t list;
|
||||
stringstream strrange;
|
||||
ostringstream strrange;
|
||||
|
||||
S3FS_PRN_INFO3("[tpath=%s]", SAFESTRPTR(tpath));
|
||||
|
||||
@ -3814,7 +3814,7 @@ int S3fsCurl::MultipartRenameRequest(const char* from, const char* to, headers_t
|
||||
off_t chunk;
|
||||
off_t bytes_remaining;
|
||||
etaglist_t list;
|
||||
stringstream strrange;
|
||||
ostringstream strrange;
|
||||
|
||||
S3FS_PRN_INFO3("[from=%s][to=%s]", SAFESTRPTR(from), SAFESTRPTR(to));
|
||||
|
||||
|
@ -503,7 +503,7 @@ bool PageList::Serialize(CacheFileStat& file, bool is_output)
|
||||
//
|
||||
// put to file
|
||||
//
|
||||
stringstream ssall;
|
||||
ostringstream ssall;
|
||||
ssall << Size();
|
||||
|
||||
for(fdpage_list_t::iterator iter = pages.begin(); iter != pages.end(); ++iter){
|
||||
@ -544,7 +544,7 @@ bool PageList::Serialize(CacheFileStat& file, bool is_output)
|
||||
return false;
|
||||
}
|
||||
string oneline;
|
||||
stringstream ssall(ptmp);
|
||||
istringstream ssall(ptmp);
|
||||
|
||||
// loaded
|
||||
Clear();
|
||||
@ -561,7 +561,7 @@ bool PageList::Serialize(CacheFileStat& file, bool is_output)
|
||||
bool is_err = false;
|
||||
while(getline(ssall, oneline, '\n')){
|
||||
string part;
|
||||
stringstream ssparts(oneline);
|
||||
istringstream ssparts(oneline);
|
||||
// offset
|
||||
if(!getline(ssparts, part, ':')){
|
||||
is_err = true;
|
||||
|
@ -611,7 +611,7 @@ int mkdirp(const string& path, mode_t mode)
|
||||
{
|
||||
string base;
|
||||
string component;
|
||||
stringstream ss(path);
|
||||
istringstream ss(path);
|
||||
while (getline(ss, component, '/')) {
|
||||
base += "/" + component;
|
||||
|
||||
@ -635,7 +635,7 @@ string get_exist_directory_path(const string& path)
|
||||
string existed("/"); // "/" is existed.
|
||||
string base;
|
||||
string component;
|
||||
stringstream ss(path);
|
||||
istringstream ss(path);
|
||||
while (getline(ss, component, '/')) {
|
||||
if(base != "/"){
|
||||
base += "/";
|
||||
|
@ -33,7 +33,7 @@
|
||||
using namespace std;
|
||||
|
||||
template <class T> std::string str(T value) {
|
||||
std::stringstream s;
|
||||
std::ostringstream s;
|
||||
s << value;
|
||||
return s.str();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user