[misc] use %S to print wchar_t strings where possible

* Also fix some Coverity warnings
This commit is contained in:
Pete Batard 2019-01-03 12:29:28 +00:00
parent 5309dc88e2
commit befe2606cf
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
5 changed files with 17 additions and 27 deletions

View file

@ -73,7 +73,6 @@ static BOOL WritePBR(HANDLE hLogicalDrive);
static void OutputUTF8Message(const char* src)
{
int len;
char *dst = NULL;
wchar_t* wdst = NULL;
if (src == NULL)
@ -90,13 +89,9 @@ static void OutputUTF8Message(const char* src)
wdst = (wchar_t*)calloc(len+1, sizeof(wchar_t));
if ((wdst == NULL) || (MultiByteToWideChar(CP_OEMCP, 0, src, len, wdst, len+1) == 0))
goto out;
dst = wchar_to_utf8(wdst);
if (dst == NULL)
goto out;
uprintf("%s", dst);
uprintf("%S", wdst);
out:
safe_free(dst);
safe_free(wdst);
}