Merge pull request #233 from andrewgaul/remove-inttostr

Remove IntToStr
This commit is contained in:
Takeshi Nakatani 2015-08-20 00:34:21 +09:00
commit fd04b9a437
4 changed files with 14 additions and 12 deletions

View File

@ -2768,7 +2768,7 @@ int S3fsCurl::CompleteMultipartPostRequest(const char* tpath, string& upload_id,
return -1;
}
postContent += "<Part>\n";
postContent += " <PartNumber>" + IntToStr(cnt + 1) + "</PartNumber>\n";
postContent += " <PartNumber>" + str(cnt + 1) + "</PartNumber>\n";
postContent += " <ETag>\"" + parts[cnt] + "\"</ETag>\n";
postContent += "</Part>\n";
}
@ -2983,7 +2983,7 @@ int S3fsCurl::UploadMultipartPostSetup(const char* tpath, int part_num, string&
}
// 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 resource;
string turl;
@ -3070,7 +3070,7 @@ int S3fsCurl::CopyMultipartPostRequest(const char* from, const char* to, int par
if(!CreateCurlHandle(true)){
return -1;
}
string urlargs = "?partNumber=" + IntToStr(part_num) + "&uploadId=" + upload_id;
string urlargs = "?partNumber=" + str(part_num) + "&uploadId=" + upload_id;
string resource;
string turl;
MakeUrlResource(get_realpath(to).c_str(), resource, turl);

View File

@ -85,13 +85,6 @@ string lower(string 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 d(s);

View File

@ -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(const std::string &s, const std::string &t = SPACES);
std::string lower(std::string s);
std::string IntToStr(int);
std::string get_date_rfc850(void);
void get_date_sigv3(std::string& date, std::string& date8601);
std::string get_date_string(time_t tm);

View File

@ -18,6 +18,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <limits>
#include <stdint.h>
#include <string>
#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("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;
}