Move str definition from header to implementation

Also clean up some char * to std::string conversions.
This commit is contained in:
Andrew Gaul 2017-11-18 10:10:29 -08:00
parent 259f028490
commit bbad76bb71
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>
@ -4130,8 +4131,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;
@ -4159,7 +4160,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,16 +28,11 @@
#include <sys/types.h>
#include <string>
#include <sstream>
#define SPACES " \t\r\n"
#define STR2NCMP(str1, str2) 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);