diff options
author | Alexander Harkness <me@bearbin.net> | 2015-12-19 15:30:32 +0100 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2015-12-19 15:30:32 +0100 |
commit | 8b851d504875906afe3b40dd87f642fd7d5a93f1 (patch) | |
tree | bdc9006f78ba8ae91e26213130d07e67124b044f /src/StringUtils.cpp | |
parent | Merge pull request #2774 from cuberite/worktycho-patch-1 (diff) | |
download | cuberite-8b851d504875906afe3b40dd87f642fd7d5a93f1.tar cuberite-8b851d504875906afe3b40dd87f642fd7d5a93f1.tar.gz cuberite-8b851d504875906afe3b40dd87f642fd7d5a93f1.tar.bz2 cuberite-8b851d504875906afe3b40dd87f642fd7d5a93f1.tar.lz cuberite-8b851d504875906afe3b40dd87f642fd7d5a93f1.tar.xz cuberite-8b851d504875906afe3b40dd87f642fd7d5a93f1.tar.zst cuberite-8b851d504875906afe3b40dd87f642fd7d5a93f1.zip |
Diffstat (limited to '')
-rw-r--r-- | src/StringUtils.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp index cc71e048b..76b9fdbde 100644 --- a/src/StringUtils.cpp +++ b/src/StringUtils.cpp @@ -21,7 +21,7 @@ AString & AppendVPrintf(AString & str, const char * format, va_list args) { ASSERT(format != nullptr); - + char buffer[2048]; int len; #ifdef va_copy @@ -47,7 +47,7 @@ AString & AppendVPrintf(AString & str, const char * format, va_list args) #ifdef va_copy va_end(argsCopy); #endif - + // The result did not fit into the static buffer, use a dynamic buffer: #ifdef _MSC_VER // for MS CRT, we need to calculate the result length @@ -57,7 +57,7 @@ AString & AppendVPrintf(AString & str, const char * format, va_list args) return str; } #endif // _MSC_VER - + // Allocate a buffer and printf into it: #ifdef va_copy va_copy(argsCopy, args); @@ -232,7 +232,7 @@ AString TrimString(const AString & str) { return ""; } - + size_t end = len; while (end >= start) { @@ -242,7 +242,7 @@ AString TrimString(const AString & str) } --end; } - + return str.substr(start, end - start + 1); } @@ -396,7 +396,7 @@ AString & RawBEToUTF8(const char * a_RawData, size_t a_NumShorts, AString & a_UT // UTF-8 conversion code adapted from: -// http://stackoverflow.com/questions/2867123/convert-utf-16-to-utf-8-under-windows-and-linux-in-c +// https://stackoverflow.com/questions/2867123/convert-utf-16-to-utf-8-under-windows-and-linux-in-c //////////////////////////////////////////////////////////////////////////////// // Begin of Unicode, Inc.'s code / information @@ -524,7 +524,7 @@ std::u16string UTF8ToRawBEUTF16(const AString & a_UTF8) { return UTF16; } - + // The cases all fall through. See "Note A" below. switch (extraBytesToRead) { @@ -609,7 +609,7 @@ AString & CreateHexDump(AString & a_Out, const void * a_Data, size_t a_Size, siz char line[512]; char * p; char * q; - + a_Out.reserve(a_Size / a_BytesPerLine * (18 + 6 * a_BytesPerLine)); for (size_t i = 0; i < a_Size; i += a_BytesPerLine) { @@ -953,7 +953,7 @@ bool SplitZeroTerminatedStrings(const AString & a_Strings, AStringVector & a_Out a_Output.push_back(a_Strings.substr(start, size - start)); res = true; } - + return res; } @@ -1000,7 +1000,3 @@ AString StringsConcat(const AStringVector & a_Strings, char a_Separator) } return res; } - - - - |