diff --git a/src/stdlib/SDL_string.c b/src/stdlib/SDL_string.c index 7f43025fc9..4a870f6e0d 100644 --- a/src/stdlib/SDL_string.c +++ b/src/stdlib/SDL_string.c @@ -2358,6 +2358,10 @@ int SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FO int SDL_vswprintf(SDL_OUT_Z_CAP(maxlen) wchar_t *text, size_t maxlen, const wchar_t *fmt, va_list ap) { + if (text) { + text[0] = 0; + } + char *fmt_utf8 = NULL; if (fmt) { fmt_utf8 = SDL_iconv_string("UTF-8", "WCHAR_T", (const char *)fmt, (SDL_wcslen(fmt) + 1) * sizeof(wchar_t)); diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index 0f32f9733a..d9b6520a9a 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -901,6 +901,7 @@ static char *GetDeviceName(HANDLE hDevice, HDEVINFO devinfo, const char *instanc if (hid_loaded) { char devName[MAX_PATH + 1]; + devName[0] = '\0'; UINT cap = sizeof(devName) - 1; UINT len = GetRawInputDeviceInfoA(hDevice, RIDI_DEVICENAME, devName, &cap); if (len != (UINT)-1) { diff --git a/src/video/windows/SDL_windowskeyboard.c b/src/video/windows/SDL_windowskeyboard.c index ca15a1c1f8..9c03df7a49 100644 --- a/src/video/windows/SDL_windowskeyboard.c +++ b/src/video/windows/SDL_windowskeyboard.c @@ -599,7 +599,6 @@ static DWORD IME_GetId(SDL_VideoData *videodata, UINT uIndex) static HKL hklprev = 0; static DWORD dwRet[2] = { 0 }; DWORD dwVerSize = 0; - DWORD dwVerHandle = 0; LPVOID lpVerBuffer = 0; LPVOID lpVerData = 0; UINT cbVerData = 0; @@ -637,11 +636,11 @@ static DWORD IME_GetId(SDL_VideoData *videodata, UINT uIndex) return dwRet[0]; } #undef LCID_INVARIANT - dwVerSize = GetFileVersionInfoSizeA(szTemp, &dwVerHandle); + dwVerSize = GetFileVersionInfoSizeA(szTemp, NULL); if (dwVerSize) { lpVerBuffer = SDL_malloc(dwVerSize); if (lpVerBuffer) { - if (GetFileVersionInfoA(szTemp, dwVerHandle, dwVerSize, lpVerBuffer)) { + if (GetFileVersionInfoA(szTemp, 0, dwVerSize, lpVerBuffer)) { if (VerQueryValueA(lpVerBuffer, "\\", &lpVerData, &cbVerData)) { #define pVerFixedInfo ((VS_FIXEDFILEINFO FAR *)lpVerData) DWORD dwVer = pVerFixedInfo->dwFileVersionMS;