Merge pull request #1430 from gaul/ostringstream

Simplify use of ostringstream
This commit is contained in:
Takeshi Nakatani 2020-10-02 23:26:41 +09:00 committed by GitHub
commit 9e998877e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1382,11 +1382,9 @@ int S3fsCurl::ParallelMixMultipartUploadRequest(const char* tpath, headers_t& me
} }
}else{ }else{
// Multipart copy // Multipart copy
std::ostringstream strrange; std::ostringstream strrange;
strrange << "bytes=" << iter->offset << "-" << (iter->offset + iter->bytes - 1); strrange << "bytes=" << iter->offset << "-" << (iter->offset + iter->bytes - 1);
meta["x-amz-copy-source-range"] = strrange.str(); meta["x-amz-copy-source-range"] = strrange.str();
strrange.str("");
strrange.clear(std::stringstream::goodbit);
s3fscurl_para->b_from = SAFESTRPTR(tpath); s3fscurl_para->b_from = SAFESTRPTR(tpath);
s3fscurl_para->b_meta = meta; s3fscurl_para->b_meta = meta;
@ -3757,7 +3755,6 @@ int S3fsCurl::MultipartHeadRequest(const char* tpath, off_t size, headers_t& met
off_t chunk; off_t chunk;
off_t bytes_remaining; off_t bytes_remaining;
etaglist_t list; etaglist_t list;
std::ostringstream strrange;
S3FS_PRN_INFO3("[tpath=%s]", SAFESTRPTR(tpath)); S3FS_PRN_INFO3("[tpath=%s]", SAFESTRPTR(tpath));
@ -3774,10 +3771,9 @@ int S3fsCurl::MultipartHeadRequest(const char* tpath, off_t size, headers_t& met
for(bytes_remaining = size, chunk = 0; 0 < bytes_remaining; bytes_remaining -= chunk){ for(bytes_remaining = size, chunk = 0; 0 < bytes_remaining; bytes_remaining -= chunk){
chunk = bytes_remaining > MAX_MULTI_COPY_SOURCE_SIZE ? MAX_MULTI_COPY_SOURCE_SIZE : bytes_remaining; chunk = bytes_remaining > MAX_MULTI_COPY_SOURCE_SIZE ? MAX_MULTI_COPY_SOURCE_SIZE : bytes_remaining;
std::ostringstream strrange;
strrange << "bytes=" << (size - bytes_remaining) << "-" << (size - bytes_remaining + chunk - 1); strrange << "bytes=" << (size - bytes_remaining) << "-" << (size - bytes_remaining + chunk - 1);
meta["x-amz-copy-source-range"] = strrange.str(); meta["x-amz-copy-source-range"] = strrange.str();
strrange.str("");
strrange.clear(std::stringstream::goodbit);
// s3fscurl sub object // s3fscurl sub object
S3fsCurl* s3fscurl_para = new S3fsCurl(true); S3fsCurl* s3fscurl_para = new S3fsCurl(true);
@ -3922,7 +3918,6 @@ int S3fsCurl::MultipartRenameRequest(const char* from, const char* to, headers_t
off_t chunk; off_t chunk;
off_t bytes_remaining; off_t bytes_remaining;
etaglist_t list; etaglist_t list;
std::ostringstream strrange;
S3FS_PRN_INFO3("[from=%s][to=%s]", SAFESTRPTR(from), SAFESTRPTR(to)); S3FS_PRN_INFO3("[from=%s][to=%s]", SAFESTRPTR(from), SAFESTRPTR(to));
@ -3946,10 +3941,9 @@ int S3fsCurl::MultipartRenameRequest(const char* from, const char* to, headers_t
for(bytes_remaining = size, chunk = 0; 0 < bytes_remaining; bytes_remaining -= chunk){ for(bytes_remaining = size, chunk = 0; 0 < bytes_remaining; bytes_remaining -= chunk){
chunk = bytes_remaining > MAX_MULTI_COPY_SOURCE_SIZE ? MAX_MULTI_COPY_SOURCE_SIZE : bytes_remaining; chunk = bytes_remaining > MAX_MULTI_COPY_SOURCE_SIZE ? MAX_MULTI_COPY_SOURCE_SIZE : bytes_remaining;
std::ostringstream strrange;
strrange << "bytes=" << (size - bytes_remaining) << "-" << (size - bytes_remaining + chunk - 1); strrange << "bytes=" << (size - bytes_remaining) << "-" << (size - bytes_remaining + chunk - 1);
meta["x-amz-copy-source-range"] = strrange.str(); meta["x-amz-copy-source-range"] = strrange.str();
strrange.str("");
strrange.clear(std::stringstream::goodbit);
// s3fscurl sub object // s3fscurl sub object
S3fsCurl* s3fscurl_para = new S3fsCurl(true); S3fsCurl* s3fscurl_para = new S3fsCurl(true);