Commit f8ba490e authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/datetime: Fix use of out-of-scope local buffer (Coverity).

parent 101c8ca5
...@@ -277,10 +277,11 @@ DATETIME_UseFormat (DATETIME_INFO *infoPtr, LPCWSTR formattxt) ...@@ -277,10 +277,11 @@ DATETIME_UseFormat (DATETIME_INFO *infoPtr, LPCWSTR formattxt)
static BOOL static BOOL
DATETIME_SetFormatW (DATETIME_INFO *infoPtr, LPCWSTR lpszFormat) DATETIME_SetFormatW (DATETIME_INFO *infoPtr, LPCWSTR format)
{ {
if (!lpszFormat) { WCHAR format_buf[80];
WCHAR format_buf[80];
if (!format) {
DWORD format_item; DWORD format_item;
if (infoPtr->dwStyle & DTS_LONGDATEFORMAT) if (infoPtr->dwStyle & DTS_LONGDATEFORMAT)
...@@ -290,13 +291,13 @@ DATETIME_SetFormatW (DATETIME_INFO *infoPtr, LPCWSTR lpszFormat) ...@@ -290,13 +291,13 @@ DATETIME_SetFormatW (DATETIME_INFO *infoPtr, LPCWSTR lpszFormat)
else /* DTS_SHORTDATEFORMAT */ else /* DTS_SHORTDATEFORMAT */
format_item = LOCALE_SSHORTDATE; format_item = LOCALE_SSHORTDATE;
GetLocaleInfoW(LOCALE_USER_DEFAULT, format_item, format_buf, sizeof(format_buf)/sizeof(format_buf[0])); GetLocaleInfoW(LOCALE_USER_DEFAULT, format_item, format_buf, sizeof(format_buf)/sizeof(format_buf[0]));
lpszFormat = format_buf; format = format_buf;
} }
DATETIME_UseFormat (infoPtr, lpszFormat); DATETIME_UseFormat (infoPtr, format);
InvalidateRect (infoPtr->hwndSelf, NULL, TRUE); InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
return 1; return TRUE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment