mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2025-01-11 00:21:45 +00:00
Remove IntToStr
str duplicates this functionality. Also add unit test.
This commit is contained in:
parent
2e344bb48f
commit
0ea88a73c7
@ -2768,8 +2768,8 @@ int S3fsCurl::CompleteMultipartPostRequest(const char* tpath, string& upload_id,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
postContent += "<Part>\n";
|
postContent += "<Part>\n";
|
||||||
postContent += " <PartNumber>" + IntToStr(cnt + 1) + "</PartNumber>\n";
|
postContent += " <PartNumber>" + str(cnt + 1) + "</PartNumber>\n";
|
||||||
postContent += " <ETag>\"" + parts[cnt] + "\"</ETag>\n";
|
postContent += " <ETag>\"" + parts[cnt] + "\"</ETag>\n";
|
||||||
postContent += "</Part>\n";
|
postContent += "</Part>\n";
|
||||||
}
|
}
|
||||||
postContent += "</CompleteMultipartUpload>\n";
|
postContent += "</CompleteMultipartUpload>\n";
|
||||||
@ -2983,7 +2983,7 @@ int S3fsCurl::UploadMultipartPostSetup(const char* tpath, int part_num, string&
|
|||||||
}
|
}
|
||||||
|
|
||||||
// make request
|
// make request
|
||||||
string request_uri = "partNumber=" + IntToStr(part_num) + "&uploadId=" + upload_id;
|
string request_uri = "partNumber=" + str(part_num) + "&uploadId=" + upload_id;
|
||||||
string urlargs = "?" + request_uri;
|
string urlargs = "?" + request_uri;
|
||||||
string resource;
|
string resource;
|
||||||
string turl;
|
string turl;
|
||||||
@ -3070,7 +3070,7 @@ int S3fsCurl::CopyMultipartPostRequest(const char* from, const char* to, int par
|
|||||||
if(!CreateCurlHandle(true)){
|
if(!CreateCurlHandle(true)){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
string urlargs = "?partNumber=" + IntToStr(part_num) + "&uploadId=" + upload_id;
|
string urlargs = "?partNumber=" + str(part_num) + "&uploadId=" + upload_id;
|
||||||
string resource;
|
string resource;
|
||||||
string turl;
|
string turl;
|
||||||
MakeUrlResource(get_realpath(to).c_str(), resource, turl);
|
MakeUrlResource(get_realpath(to).c_str(), resource, turl);
|
||||||
|
@ -85,13 +85,6 @@ string lower(string s)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
string IntToStr(int n)
|
|
||||||
{
|
|
||||||
stringstream result;
|
|
||||||
result << n;
|
|
||||||
return result.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
string trim_left(const string &s, const string &t /* = SPACES */)
|
string trim_left(const string &s, const string &t /* = SPACES */)
|
||||||
{
|
{
|
||||||
string d(s);
|
string d(s);
|
||||||
|
@ -45,7 +45,6 @@ std::string trim_left(const std::string &s, const std::string &t = SPACES);
|
|||||||
std::string trim_right(const std::string &s, const std::string &t = SPACES);
|
std::string trim_right(const std::string &s, const std::string &t = SPACES);
|
||||||
std::string trim(const std::string &s, const std::string &t = SPACES);
|
std::string trim(const std::string &s, const std::string &t = SPACES);
|
||||||
std::string lower(std::string s);
|
std::string lower(std::string s);
|
||||||
std::string IntToStr(int);
|
|
||||||
std::string get_date_rfc850(void);
|
std::string get_date_rfc850(void);
|
||||||
void get_date_sigv3(std::string& date, std::string& date8601);
|
void get_date_sigv3(std::string& date, std::string& date8601);
|
||||||
std::string get_date_string(time_t tm);
|
std::string get_date_string(time_t tm);
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
|
#include <stdint.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "string_util.h"
|
#include "string_util.h"
|
||||||
@ -40,5 +42,13 @@ int main(int argc, char *argv[])
|
|||||||
ASSERT_EQUALS(std::string(" 1234"), trim_right(" 1234"));
|
ASSERT_EQUALS(std::string(" 1234"), trim_right(" 1234"));
|
||||||
ASSERT_EQUALS(std::string("1234"), trim_right("1234"));
|
ASSERT_EQUALS(std::string("1234"), trim_right("1234"));
|
||||||
|
|
||||||
|
ASSERT_EQUALS(std::string("0"), str(0));
|
||||||
|
ASSERT_EQUALS(std::string("1"), str(1));
|
||||||
|
ASSERT_EQUALS(std::string("-1"), str(-1));
|
||||||
|
ASSERT_EQUALS(std::string("9223372036854775807"), str(std::numeric_limits<int64_t>::max()));
|
||||||
|
ASSERT_EQUALS(std::string("-9223372036854775808"), str(std::numeric_limits<int64_t>::min()));
|
||||||
|
ASSERT_EQUALS(std::string("0"), str(std::numeric_limits<uint64_t>::min()));
|
||||||
|
ASSERT_EQUALS(std::string("18446744073709551615"), str(std::numeric_limits<uint64_t>::max()));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user