summaryrefslogtreecommitdiff
path: root/src/common/string_util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/string_util.cpp')
-rw-r--r--src/common/string_util.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index 54943d306..dcec9275f 100644
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -121,11 +121,11 @@ std::string ArrayToString(const u8 *data, u32 size, int line_len, bool spaces)
121{ 121{
122 std::ostringstream oss; 122 std::ostringstream oss;
123 oss << std::setfill('0') << std::hex; 123 oss << std::setfill('0') << std::hex;
124 124
125 for (int line = 0; size; ++data, --size) 125 for (int line = 0; size; ++data, --size)
126 { 126 {
127 oss << std::setw(2) << (int)*data; 127 oss << std::setw(2) << (int)*data;
128 128
129 if (line_len == ++line) 129 if (line_len == ++line)
130 { 130 {
131 oss << '\n'; 131 oss << '\n';
@@ -168,7 +168,7 @@ bool TryParse(const std::string &str, u32 *const output)
168 errno = 0; 168 errno = 0;
169 169
170 unsigned long value = strtoul(str.c_str(), &endptr, 0); 170 unsigned long value = strtoul(str.c_str(), &endptr, 0);
171 171
172 if (!endptr || *endptr) 172 if (!endptr || *endptr)
173 return false; 173 return false;
174 174
@@ -294,7 +294,7 @@ std::string ReplaceAll(std::string result, const std::string& src, const std::st
294//#include <string> 294//#include <string>
295//#include <assert.h> 295//#include <assert.h>
296 296
297const char HEX2DEC[256] = 297const char HEX2DEC[256] =
298{ 298{
299 /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ 299 /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
300 /* 0 */ 16,16,16,16, 16,16,16,16, 16,16,16,16, 16,16,16,16, 300 /* 0 */ 16,16,16,16, 16,16,16,16, 16,16,16,16, 16,16,16,16,
@@ -327,7 +327,7 @@ std::string UriDecode(const std::string & sSrc)
327 const unsigned char * pSrc = (const unsigned char *)sSrc.c_str(); 327 const unsigned char * pSrc = (const unsigned char *)sSrc.c_str();
328 const size_t SRC_LEN = sSrc.length(); 328 const size_t SRC_LEN = sSrc.length();
329 const unsigned char * const SRC_END = pSrc + SRC_LEN; 329 const unsigned char * const SRC_END = pSrc + SRC_LEN;
330 const unsigned char * const SRC_LAST_DEC = SRC_END - 2; // last decodable '%' 330 const unsigned char * const SRC_LAST_DEC = SRC_END - 2; // last decodable '%'
331 331
332 char * const pStart = new char[SRC_LEN]; 332 char * const pStart = new char[SRC_LEN];
333 char * pEnd = pStart; 333 char * pEnd = pStart;
@@ -394,7 +394,7 @@ std::string UriEncode(const std::string & sSrc)
394 394
395 for (; pSrc < SRC_END; ++pSrc) 395 for (; pSrc < SRC_END; ++pSrc)
396 { 396 {
397 if (SAFE[*pSrc]) 397 if (SAFE[*pSrc])
398 *pEnd++ = *pSrc; 398 *pEnd++ = *pSrc;
399 else 399 else
400 { 400 {
@@ -518,9 +518,9 @@ static std::string CodeToUTF8(const char* fromcode, const std::basic_string<T>&
518 518
519 out_buffer.resize(out_buffer_size - dst_bytes); 519 out_buffer.resize(out_buffer_size - dst_bytes);
520 out_buffer.swap(result); 520 out_buffer.swap(result);
521 521
522 iconv_close(conv_desc); 522 iconv_close(conv_desc);
523 523
524 return result; 524 return result;
525} 525}
526 526
@@ -576,7 +576,7 @@ std::u16string UTF8ToUTF16(const std::string& input)
576 out_buffer.swap(result); 576 out_buffer.swap(result);
577 577
578 iconv_close(conv_desc); 578 iconv_close(conv_desc);
579 579
580 return result; 580 return result;
581} 581}
582 582