Merge pull request #676 from gaul/sstream

Move str definition from header to implementation
This commit is contained in:
Takeshi Nakatani 2017-11-19 16:34:15 +09:00 committed by GitHub
commit e1928288fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 9 deletions

View File

@ -36,6 +36,7 @@
#include <libxml/tree.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <map>
#include <algorithm>
@ -4141,8 +4142,8 @@ string prepare_url(const char* url)
string uri;
string host;
string path;
string url_str = str(url);
string token = str("/" + bucket);
string url_str = string(url);
string token = string("/") + bucket;
int bucket_pos = url_str.find(token);
int bucket_length = token.size();
int uri_length = 0;
@ -4170,7 +4171,7 @@ string prepare_url(const char* url)
S3FS_PRN_INFO3("URL changed is %s", url_str.c_str());
return str(url_str);
return url_str;
}
/*

View File

@ -32,6 +32,21 @@
using namespace std;
template <class T> std::string str(T value) {
std::stringstream s;
s << value;
return s.str();
}
template std::string str(short value);
template std::string str(unsigned short value);
template std::string str(int value);
template std::string str(unsigned int value);
template std::string str(long value);
template std::string str(unsigned long value);
template std::string str(long long value);
template std::string str(unsigned long long value);
static const char hexAlphabet[] = "0123456789ABCDEF";
off_t s3fs_strtoofft(const char* str, bool is_base_16)

View File

@ -28,17 +28,12 @@
#include <sys/types.h>
#include <string>
#include <sstream>
static const std::string SPACES = " \t\r\n";
static inline int STR2NCMP(const char *str1, const char *str2) { return strncmp(str1, str2, strlen(str2)); }
template<typename T> std::string str(T value) {
std::stringstream s;
s << value;
return s.str();
}
template <class T> std::string str(T value);
off_t s3fs_strtoofft(const char* str, bool is_base_16 = false);