aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/StringUtil.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/FbTk/StringUtil.cc b/src/FbTk/StringUtil.cc
index 9cd2c9a..d6f2c8f 100644
--- a/src/FbTk/StringUtil.cc
+++ b/src/FbTk/StringUtil.cc
@@ -70,7 +70,7 @@ using std::transform;
70namespace { 70namespace {
71 71
72const size_t DIGITS10_ULONGLONGINT = 20; // ULLONG_MAX = 18446744073709551615 72const size_t DIGITS10_ULONGLONGINT = 20; // ULLONG_MAX = 18446744073709551615
73const size_t DIGITS16_ULONGLONGINT = 18; // ULLONG_MAX = 0xffffffffffffffff 73const size_t DIGITS16_ULONGLONGINT = 16; // ULLONG_MAX = ffffffffffffffff
74 74
75template <typename T> 75template <typename T>
76int extractBigNumber(const char* in, T (*extractFunc)(const char*, char**, int), T& out) { 76int extractBigNumber(const char* in, T (*extractFunc)(const char*, char**, int), T& out) {
@@ -173,15 +173,15 @@ int extractNumber(const std::string& in, unsigned long long& out) {
173 173
174 174
175std::string number2String(long long num) { 175std::string number2String(long long num) {
176 char s[DIGITS10_ULONGLONGINT]; 176 char s[DIGITS10_ULONGLONGINT+1];
177 snprintf(s, sizeof(s), "%lld", num); 177 int n = snprintf(s, sizeof(s), "%lld", num);
178 return std::string(s); 178 return std::string(s, n);
179} 179}
180 180
181std::string number2HexString(long long num) { 181std::string number2HexString(long long num) {
182 char s[DIGITS16_ULONGLONGINT]; 182 char s[DIGITS16_ULONGLONGINT+1];
183 snprintf(s, sizeof(s), "%llx", num); 183 int n = snprintf(s, sizeof(s), "%llx", num);
184 return std::string(s); 184 return std::string(s, n);
185} 185}
186 186
187 187