diff options
-rw-r--r-- | src/argv/ntapi_tt_array_utf16.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/argv/ntapi_tt_array_utf16.c b/src/argv/ntapi_tt_array_utf16.c index d035ad4..d125331 100644 --- a/src/argv/ntapi_tt_array_utf16.c +++ b/src/argv/ntapi_tt_array_utf16.c @@ -173,12 +173,12 @@ int32_t __stdcall __ntapi_tt_array_convert_utf16_to_utf8( ubound = (uint8_t *)buffer + buffer_len - 5; diff = (uintptr_t)base / sizeof(wchar16_t); - while (warrv && *warrv) { + for (; warrv && *warrv; arrv++,warrv++) { *arrv = (char *)(ch-(uintptr_t)base); wch = *warrv + diff; /* ubound already accounts for null termination, see above */ - while (*wch && (ch < ubound)) { + for (; *wch && (ch<ubound); ) { if (*wch <= 0x7F) { /* from: 00000000 0xxxxxxx (little endian) */ /* to: 0xxxxxxx (utf-8) */ @@ -284,14 +284,10 @@ int32_t __stdcall __ntapi_tt_array_convert_utf16_to_utf8( wch++; } - /* null termination */ if (*wch) return NT_STATUS_BUFFER_TOO_SMALL; - else - *ch++ = 0; - arrv++; - warrv++; + *ch++ = 0; } *arrv = 0; |