Fixed snprintf.

This commit is contained in:
Branimir Karadžić
2018-11-20 13:07:49 -08:00
parent b4f42e2a2f
commit e94113ff0a
2 changed files with 22 additions and 34 deletions

View File

@@ -1124,8 +1124,7 @@ namespace bx
{
if (1 < _max)
{
StaticMemoryBlockWriter writer(_out, uint32_t(_max-1) );
_out[_max-1] = '\0';
StaticMemoryBlockWriter writer(_out, uint32_t(_max) );
Error err;
va_list argListCopy;
@@ -1138,6 +1137,10 @@ namespace bx
size += write(&writer, '\0', &err);
return size - 1 /* size without '\0' terminator */;
}
else
{
_out[_max-1] = '\0';
}
}
Error err;