diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-02 12:39:10 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-02 12:39:10 +0200 |
commit | a1e58728e5cf9b97d6adbc4d6c90267ec4ae7869 (patch) | |
tree | d8b0cdf011b7d3a43712246ae2bd9fb106bf4b0d /source/StringUtils.cpp | |
parent | ProtoProxy: Added logging for the window contents, item's metadata is saved to a separate file (diff) | |
download | cuberite-a1e58728e5cf9b97d6adbc4d6c90267ec4ae7869.tar cuberite-a1e58728e5cf9b97d6adbc4d6c90267ec4ae7869.tar.gz cuberite-a1e58728e5cf9b97d6adbc4d6c90267ec4ae7869.tar.bz2 cuberite-a1e58728e5cf9b97d6adbc4d6c90267ec4ae7869.tar.lz cuberite-a1e58728e5cf9b97d6adbc4d6c90267ec4ae7869.tar.xz cuberite-a1e58728e5cf9b97d6adbc4d6c90267ec4ae7869.tar.zst cuberite-a1e58728e5cf9b97d6adbc4d6c90267ec4ae7869.zip |
Diffstat (limited to '')
-rw-r--r-- | source/StringUtils.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source/StringUtils.cpp b/source/StringUtils.cpp index 0143bb8c4..536281054 100644 --- a/source/StringUtils.cpp +++ b/source/StringUtils.cpp @@ -526,12 +526,14 @@ AString & CreateHexDump(AString & a_Out, const void * a_Data, int a_Size, int a_ { k = a_LineLength; } - memset(line, ' ', sizeof(line)); - #ifdef _MSC_VER // MSVC provides a "secure" version of sprintf() - line[sprintf_s(line, sizeof(line), "%08x:", i)] = 32; // Remove the terminating NULL that sprintf puts there + #ifdef _MSC_VER + // MSVC provides a "secure" version of sprintf() + int Count = sprintf_s(line, sizeof(line), "%08x:", i); #else - line[sprintf(line, "%08x:", i)] = 32; // Remove the terminating NULL that sprintf puts there + int Count = sprintf(line, "%08x:", i); #endif + // Remove the terminating NULL / leftover garbage in line, after the sprintf-ed value + memset(line + Count, 32, sizeof(line) - Count); p = line + 10; q = p + 2 + a_LineLength * 3 + 1; for (int j = 0; j < k; j++) |