static char *wc_to_utf8(PWCHAR wc_buffer, ULONG size)
{
- WCHAR wc_str[(size / sizeof(WCHAR)) + 1];
+ ULONG wc_length = size / sizeof(WCHAR);
+ WCHAR wc_str[wc_length + 1];
char *utf8_str;
/* Zero-terminate the wide char string. */
memcpy(wc_str, wc_buffer, size);
- wc_str[sizeof(wc_str) - 1] = 0;
+ wc_str[wc_length] = 0;
/* Compute the size of the UTF-8 converted string. */
if (!(size = WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, wc_str, -1,