Using trio_snprintf now.

This commit is contained in:
Armin Novak 2014-08-19 10:01:13 +02:00
parent b22b897389
commit 25e9ebadc2

View File

@ -50,23 +50,23 @@ void winpr_HexDump(const char* tag, int level, const BYTE* data, int length)
while (offset < length) while (offset < length)
{ {
pos += snprintf(&buffer[pos], blen - pos, "%04x ", offset); pos += trio_snprintf(&buffer[pos], blen - pos, "%04x ", offset);
line = length - offset; line = length - offset;
if (line > WINPR_HEXDUMP_LINE_LENGTH) if (line > WINPR_HEXDUMP_LINE_LENGTH)
line = WINPR_HEXDUMP_LINE_LENGTH; line = WINPR_HEXDUMP_LINE_LENGTH;
for (i = 0; i < line; i++) for (i = 0; i < line; i++)
pos += snprintf(&buffer[pos], blen - pos, "%02x ", p[i]); pos += trio_snprintf(&buffer[pos], blen - pos, "%02x ", p[i]);
for (; i < WINPR_HEXDUMP_LINE_LENGTH; i++) for (; i < WINPR_HEXDUMP_LINE_LENGTH; i++)
pos += snprintf(&buffer[pos], blen - pos, " "); pos += trio_snprintf(&buffer[pos], blen - pos, " ");
for (i = 0; i < line; i++) for (i = 0; i < line; i++)
pos += snprintf(&buffer[pos], blen - pos, "%c", pos += trio_snprintf(&buffer[pos], blen - pos, "%c",
(p[i] >= 0x20 && p[i] < 0x7F) ? p[i] : '.'); (p[i] >= 0x20 && p[i] < 0x7F) ? p[i] : '.');
pos += snprintf(&buffer[pos], blen - pos, "\n"); pos += trio_snprintf(&buffer[pos], blen - pos, "\n");
WLog_LVL(tag, level, "%s", buffer); WLog_LVL(tag, level, "%s", buffer);
offset += line; offset += line;
p += line; p += line;
@ -100,7 +100,7 @@ void winpr_CArrayDump(const char* tag, int level, const BYTE* data, int length,
pos = 0; pos = 0;
for (i = 0; i < line; i++) for (i = 0; i < line; i++)
pos += snprintf(&buffer[pos], llen - pos, "\\x%02X", p[i]); pos += trio_snprintf(&buffer[pos], llen - pos, "\\x%02X", p[i]);
WLog_LVL(tag, level, "%s", buffer); WLog_LVL(tag, level, "%s", buffer);
offset += line; offset += line;