1
0

StringUtils: Fixed the HexDump in DEBUG mode

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1538 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2013-06-02 10:39:10 +00:00
parent e9042ac098
commit a1e58728e5

View File

@ -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++)