Commit b0a302cc authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Use wide-char string literals.

parent c302397c
......@@ -289,7 +289,7 @@ int CDECL MSVCRT__wchdir(const wchar_t * newdir)
*/
int CDECL MSVCRT__chdrive(int newdrive)
{
WCHAR buffer[] = {'A', ':', 0};
WCHAR buffer[] = L"A:";
buffer[0] += newdrive - 1;
if (!SetCurrentDirectoryW( buffer ))
......@@ -855,7 +855,7 @@ char* CDECL MSVCRT__getdcwd(int drive, char * buf, int size)
else
{
char dir[MAX_PATH];
char drivespec[] = {'A', ':', 0};
char drivespec[] = "A:";
int dir_len;
drivespec[0] += drive - 1;
......@@ -897,7 +897,7 @@ wchar_t* CDECL MSVCRT__wgetdcwd(int drive, wchar_t * buf, int size)
else
{
wchar_t dir[MAX_PATH];
wchar_t drivespec[4] = {'A', ':', '\\', 0};
wchar_t drivespec[4] = L"A:\\";
int dir_len;
drivespec[0] += drive - 1;
......@@ -940,7 +940,7 @@ wchar_t* CDECL MSVCRT__wgetdcwd(int drive, wchar_t * buf, int size)
*/
unsigned int CDECL MSVCRT__getdiskfree(unsigned int disk, struct _diskfree_t * d)
{
WCHAR drivespec[] = {'@', ':', '\\', 0};
WCHAR drivespec[] = L"@:\\";
DWORD ret[4];
unsigned int err;
......
......@@ -404,8 +404,6 @@ wchar_t* CDECL MSVCRT__wcserror(int err)
int CDECL MSVCRT___wcserror_s(wchar_t* buffer, MSVCRT_size_t nc, const wchar_t* str)
{
int err;
static const WCHAR colonW[] = {':', ' ', '\0'};
static const WCHAR nlW[] = {'\n', '\0'};
size_t len;
err = *MSVCRT__errno();
......@@ -421,12 +419,12 @@ int CDECL MSVCRT___wcserror_s(wchar_t* buffer, MSVCRT_size_t nc, const wchar_t*
if (str && *str)
{
lstrcpyW(buffer, str);
lstrcatW(buffer, colonW);
lstrcatW(buffer, L": ");
}
else buffer[0] = '\0';
len = MSVCRT_wcslen(buffer);
MultiByteToWideChar(CP_ACP, 0, MSVCRT__sys_errlist[err], -1, buffer + len, 256 - len);
lstrcatW(buffer, nlW);
lstrcatW(buffer, L"\n");
return 0;
}
......
......@@ -187,24 +187,19 @@ void CDECL MSVCRT__exit(int exitcode)
/* Print out an error message with an option to debug */
static void DoMessageBoxW(const wchar_t *lead, const wchar_t *message)
{
static const wchar_t message_format[] = {'%','l','s','\n','\n','P','r','o','g','r','a','m',':',' ','%','l','s','\n',
'%','l','s','\n','\n','P','r','e','s','s',' ','O','K',' ','t','o',' ','e','x','i','t',' ','t','h','e',' ',
'p','r','o','g','r','a','m',',',' ','o','r',' ','C','a','n','c','e','l',' ','t','o',' ','s','t','a','r','t',' ',
't','h','e',' ','W','i','n','e',' ','d','e','b','u','g','g','e','r','.','\n',0};
static const WCHAR title[] =
{'W','i','n','e',' ','C','+','+',' ','R','u','n','t','i','m','e',' ','L','i','b','r','a','r','y',0};
MSGBOXPARAMSW msgbox;
wchar_t text[2048];
INT ret;
MSVCRT__snwprintf(text, ARRAY_SIZE(text), message_format, lead, MSVCRT__wpgmptr, message);
MSVCRT__snwprintf(text, ARRAY_SIZE(text), L"%ls\n\nProgram: %ls\n%ls\n\n"
L"Press OK to exit the program, or Cancel to start the Wine debugger.\n",
lead, MSVCRT__wpgmptr, message);
msgbox.cbSize = sizeof(msgbox);
msgbox.hwndOwner = GetActiveWindow();
msgbox.hInstance = 0;
msgbox.lpszText = text;
msgbox.lpszCaption = title;
msgbox.lpszCaption = L"Wine C++ Runtime Library";
msgbox.dwStyle = MB_OKCANCEL|MB_ICONERROR;
msgbox.lpszIcon = NULL;
msgbox.dwContextHelpId = 0;
......@@ -289,23 +284,17 @@ unsigned int CDECL MSVCRT__set_abort_behavior(unsigned int flags, unsigned int m
*/
void CDECL MSVCRT__wassert(const wchar_t* str, const wchar_t* file, unsigned int line)
{
static const wchar_t assertion_failed[] = {'A','s','s','e','r','t','i','o','n',' ','f','a','i','l','e','d','!',0};
static const wchar_t format_msgbox[] = {'F','i','l','e',':',' ','%','l','s','\n','L','i','n','e',':',' ','%','d',
'\n','\n','E','x','p','r','e','s','s','i','o','n',':',' ','\"','%','l','s','\"',0};
static const wchar_t format_console[] = {'A','s','s','e','r','t','i','o','n',' ','f','a','i','l','e','d',':',' ',
'%','l','s',',',' ','f','i','l','e',' ','%','l','s',',',' ','l','i','n','e',' ','%','d','\n','\n',0};
TRACE("(%s,%s,%d)\n", debugstr_w(str), debugstr_w(file), line);
if ((MSVCRT_error_mode == MSVCRT__OUT_TO_MSGBOX) ||
((MSVCRT_error_mode == MSVCRT__OUT_TO_DEFAULT) && (MSVCRT_app_type == 2)))
{
wchar_t text[2048];
MSVCRT__snwprintf(text, sizeof(text), format_msgbox, file, line, str);
DoMessageBoxW(assertion_failed, text);
MSVCRT__snwprintf(text, sizeof(text), L"File: %ls\nLine: %d\n\nExpression: \"%ls\"", file, line, str);
DoMessageBoxW(L"Assertion failed!", text);
}
else
MSVCRT_fwprintf(MSVCRT_stderr, format_console, str, file, line);
MSVCRT_fwprintf(MSVCRT_stderr, L"Assertion failed: %ls, file %ls, line %d\n\n", str, file, line);
MSVCRT_raise(MSVCRT_SIGABRT);
MSVCRT__exit(3);
......@@ -367,13 +356,12 @@ MSVCRT__onexit_t CDECL MSVCRT__onexit(MSVCRT__onexit_t func)
void CDECL MSVCRT_exit(int exitcode)
{
HMODULE hmscoree;
static const WCHAR mscoreeW[] = {'m','s','c','o','r','e','e',0};
void (WINAPI *pCorExitProcess)(int);
TRACE("(%d)\n",exitcode);
MSVCRT__cexit();
hmscoree = GetModuleHandleW(mscoreeW);
hmscoree = GetModuleHandleW(L"mscoree");
if (hmscoree)
{
......
......@@ -1599,36 +1599,31 @@ static int msvcrt_get_flags(const wchar_t* mode, int *open_flags, int* stream_fl
if(*mode == ',')
{
static const WCHAR ccs[] = {'c','c','s'};
static const WCHAR utf8[] = {'u','t','f','-','8'};
static const WCHAR utf16le[] = {'u','t','f','-','1','6','l','e'};
static const WCHAR unicode[] = {'u','n','i','c','o','d','e'};
mode++;
while(*mode == ' ') mode++;
if(!MSVCRT_CHECK_PMT(!MSVCRT_wcsncmp(ccs, mode, ARRAY_SIZE(ccs))))
if(!MSVCRT_CHECK_PMT(!MSVCRT_wcsncmp(L"ccs", mode, 3)))
return -1;
mode += ARRAY_SIZE(ccs);
mode += 3;
while(*mode == ' ') mode++;
if(!MSVCRT_CHECK_PMT(*mode == '='))
return -1;
mode++;
while(*mode == ' ') mode++;
if(!MSVCRT__wcsnicmp(utf8, mode, ARRAY_SIZE(utf8)))
if(!MSVCRT__wcsnicmp(L"utf-8", mode, 5))
{
*open_flags |= MSVCRT__O_U8TEXT;
mode += ARRAY_SIZE(utf8);
mode += 5;
}
else if(!MSVCRT__wcsnicmp(utf16le, mode, ARRAY_SIZE(utf16le)))
else if(!MSVCRT__wcsnicmp(L"utf-16le", mode, 8))
{
*open_flags |= MSVCRT__O_U16TEXT;
mode += ARRAY_SIZE(utf16le);
mode += 8;
}
else if(!MSVCRT__wcsnicmp(unicode, mode, ARRAY_SIZE(unicode)))
else if(!MSVCRT__wcsnicmp(L"unicode", mode, 7))
{
*open_flags |= MSVCRT__O_WTEXT;
mode += ARRAY_SIZE(unicode);
mode += 7;
}
else
{
......@@ -3313,9 +3308,8 @@ char * CDECL MSVCRT__tempnam(const char *dir, const char *prefix)
*/
wchar_t * CDECL MSVCRT__wtempnam(const wchar_t *dir, const wchar_t *prefix)
{
static const wchar_t tmpW[] = {'T','M','P',0};
wchar_t tmpbuf[MAX_PATH];
const wchar_t *tmp_dir = MSVCRT__wgetenv(tmpW);
const wchar_t *tmp_dir = MSVCRT__wgetenv(L"TMP");
if (tmp_dir) dir = tmp_dir;
......
......@@ -51,53 +51,6 @@ BOOL initial_locale = TRUE;
#define MSVCRT_LEADBYTE 0x8000
#define MSVCRT_C1_DEFINED 0x200
static const wchar_t sun[] = {'S','u','n',0};
static const wchar_t mon[] = {'M','o','n',0};
static const wchar_t tue[] = {'T','u','e',0};
static const wchar_t wed[] = {'W','e','d',0};
static const wchar_t thu[] = {'T','h','u',0};
static const wchar_t fri[] = {'F','r','i',0};
static const wchar_t sat[] = {'S','a','t',0};
static const wchar_t sunday[] = {'S','u','n','d','a','y',0};
static const wchar_t monday[] = {'M','o','n','d','a','y',0};
static const wchar_t tuesday[] = {'T','u','e','s','d','a','y',0};
static const wchar_t wednesday[] = {'W','e','d','n','e','s','d','a','y',0};
static const wchar_t thursday[] = {'T','h','u','r','s','d','a','y',0};
static const wchar_t friday[] = {'F','r','i','d','a','y',0};
static const wchar_t saturday[] = {'S','a','t','u','r','d','a','y',0};
static const wchar_t jan[] = {'J','a','n',0};
static const wchar_t feb[] = {'F','e','b',0};
static const wchar_t mar[] = {'M','a','r',0};
static const wchar_t apr[] = {'A','p','r',0};
static const wchar_t may[] = {'M','a','y',0};
static const wchar_t jun[] = {'J','u','n',0};
static const wchar_t jul[] = {'J','u','l',0};
static const wchar_t aug[] = {'A','u','g',0};
static const wchar_t sep[] = {'S','e','p',0};
static const wchar_t oct[] = {'O','c','t',0};
static const wchar_t nov[] = {'N','o','v',0};
static const wchar_t dec[] = {'D','e','c',0};
static const wchar_t january[] = {'J','a','n','u','a','r','y',0};
static const wchar_t february[] = {'F','e','b','r','u','a','r','y',0};
static const wchar_t march[] = {'M','a','r','c','h',0};
static const wchar_t april[] = {'A','p','r','i','l',0};
static const wchar_t june[] = {'J','u','n','e',0};
static const wchar_t july[] = {'J','u','l','y',0};
static const wchar_t august[] = {'A','u','g','u','s','t',0};
static const wchar_t september[] = {'S','e','p','t','e','m','b','e','r',0};
static const wchar_t october[] = {'O','c','t','o','b','e','r',0};
static const wchar_t november[] = {'N','o','v','e','m','b','e','r',0};
static const wchar_t december[] = {'D','e','c','e','m','b','e','r',0};
static const wchar_t am[] = {'A','M',0};
static const wchar_t pm[] = {'P','M',0};
static const wchar_t cloc_short_date[] = {'M','M','/','d','d','/','y','y',0};
static const wchar_t cloc_date[] = {'d','d','d','d',',',' ','M','M','M','M',' ','d','d',',',' ','y','y','y','y',0};
static const wchar_t cloc_time[] = {'H','H',':','m','m',':','s','s',0};
#if _MSVCR_VER >= 110
static const wchar_t en_us[] = {'e','n','-','U','S',0};
#endif
__lc_time_data cloc_time_data =
{
{{"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
......@@ -110,14 +63,14 @@ __lc_time_data cloc_time_data =
MAKELCID(LANG_ENGLISH, SORT_DEFAULT),
#endif
1, 0,
{{sun, mon, tue, wed, thu, fri, sat,
sunday, monday, tuesday, wednesday, thursday, friday, saturday,
jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec,
january, february, march, april, may, june, july,
august, september, october, november, december,
am, pm, cloc_short_date, cloc_date, cloc_time}},
{{L"Sun", L"Mon", L"Tue", L"Wed", L"Thu", L"Fri", L"Sat",
L"Sunday", L"Monday", L"Tuesday", L"Wednesday", L"Thursday", L"Friday", L"Saturday",
L"Jan", L"Feb", L"Mar", L"Apr", L"May", L"Jun", L"Jul", L"Aug", L"Sep", L"Oct", L"Nov", L"Dec",
L"January", L"February", L"March", L"April", L"May", L"June", L"July",
L"August", L"September", L"October", L"November", L"December",
L"AM", L"PM", L"MM/dd/yy", L"dddd, MMMM dd, yyyy", L"HH:mm:ss"}},
#if _MSVCR_VER >= 110
en_us,
L"en-US",
#endif
};
......@@ -196,8 +149,8 @@ static const unsigned char cloc_cumap[256] =
static char empty[] = "";
static char cloc_dec_point[] = ".";
#if _MSVCR_VER >= 100
static wchar_t emptyW[] = {0};
static wchar_t cloc_dec_pointW[] = {'.', 0};
static wchar_t emptyW[] = L"";
static wchar_t cloc_dec_pointW[] = L".";
#endif
static struct lconv cloc_lconv =
{
......
......@@ -2397,7 +2397,7 @@ MSVCRT_size_t CDECL _mbstrlen(const char* str)
int CDECL MSVCRT_mbtowc_l(wchar_t *dst, const char* str, MSVCRT_size_t n, _locale_t locale)
{
pthreadlocinfo locinfo;
wchar_t tmpdst = '\0';
wchar_t tmpdst;
if(!locale)
locinfo = get_locinfo();
......
......@@ -247,10 +247,9 @@ static inline int FUNC_NAME(pf_handle_string)(FUNC_NAME(puts_clbk) pf_puts, void
BOOL api_is_wide = sizeof(APICHAR) == sizeof(wchar_t);
BOOL complement_is_narrow = legacy_wide ? api_is_wide : FALSE;
#ifdef PRINTF_WIDE
static const wchar_t nullW[] = {'(','n','u','l','l',')',0};
if(!str)
return FUNC_NAME(pf_output_format_wstr)(pf_puts, puts_ctx, nullW, 6, flags, locale);
return FUNC_NAME(pf_output_format_wstr)(pf_puts, puts_ctx, L"(null)", 6, flags, locale);
#else
if(!str)
return FUNC_NAME(pf_output_format_str)(pf_puts, puts_ctx, "(null)", 6, flags, locale);
......
......@@ -38,9 +38,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
static void msvcrt_search_executable(const wchar_t *name, wchar_t *fullname, int use_path)
{
static const wchar_t path[] = {'P','A','T','H',0};
static const wchar_t suffix[][5] =
{{'.','c','o','m',0}, {'.','e','x','e',0}, {'.','b','a','t',0}, {'.','c','m','d',0}};
{L".com", L".exe", L".bat", L".cmd"};
wchar_t buffer[MAX_PATH];
const wchar_t *env, *p, *end;
......@@ -84,7 +83,7 @@ static void msvcrt_search_executable(const wchar_t *name, wchar_t *fullname, int
extension = 0;
}
if (!use_path || !(env = MSVCRT__wgetenv(path))) return;
if (!use_path || !(env = MSVCRT__wgetenv(L"PATH"))) return;
/* now try search path */
do
......@@ -340,15 +339,13 @@ static wchar_t *msvcrt_valisttos_aw(const char *arg0, __ms_va_list alist, wchar_
/* INTERNAL: retrieve COMSPEC environment variable */
static wchar_t *msvcrt_get_comspec(void)
{
static const wchar_t cmd[] = {'c','m','d',0};
static const wchar_t comspec[] = {'C','O','M','S','P','E','C',0};
wchar_t *ret;
unsigned int len;
if (!(len = GetEnvironmentVariableW(comspec, NULL, 0))) len = ARRAY_SIZE(cmd);
if (!(len = GetEnvironmentVariableW(L"COMSPEC", NULL, 0))) len = 4;
if ((ret = HeapAlloc(GetProcessHeap(), 0, len * sizeof(wchar_t))))
{
if (!GetEnvironmentVariableW(comspec, ret, len)) MSVCRT_wcscpy(ret, cmd);
if (!GetEnvironmentVariableW(L"COMSPEC", ret, len)) MSVCRT_wcscpy(ret, L"cmd");
}
return ret;
}
......@@ -1046,7 +1043,6 @@ MSVCRT_FILE* CDECL MSVCRT__wpopen(const wchar_t* command, const wchar_t* mode)
const wchar_t *p;
wchar_t *comspec, *fullcmd;
unsigned int len;
static const wchar_t flag[] = {' ','/','c',' ',0};
struct popen_handle *container;
DWORD i;
......@@ -1109,7 +1105,7 @@ MSVCRT_FILE* CDECL MSVCRT__wpopen(const wchar_t* command, const wchar_t* mode)
MSVCRT__close(fds[fdToDup]);
if (!(comspec = msvcrt_get_comspec())) goto error;
len = MSVCRT_wcslen(comspec) + MSVCRT_wcslen(flag) + MSVCRT_wcslen(command) + 1;
len = MSVCRT_wcslen(comspec) + MSVCRT_wcslen(command) + 5;
if (!(fullcmd = HeapAlloc(GetProcessHeap(), 0, len * sizeof(wchar_t))))
{
......@@ -1118,7 +1114,7 @@ MSVCRT_FILE* CDECL MSVCRT__wpopen(const wchar_t* command, const wchar_t* mode)
}
MSVCRT_wcscpy(fullcmd, comspec);
MSVCRT_wcscat(fullcmd, flag);
MSVCRT_wcscat(fullcmd, L" /c ");
MSVCRT_wcscat(fullcmd, command);
if ((container->proc = (HANDLE)msvcrt_spawn(MSVCRT__P_NOWAIT, comspec, fullcmd, NULL, 1))
......@@ -1225,7 +1221,6 @@ int CDECL _wsystem(const wchar_t* cmd)
int res;
wchar_t *comspec, *fullcmd;
unsigned int len;
static const wchar_t flag[] = {' ','/','c',' ',0};
comspec = msvcrt_get_comspec();
......@@ -1240,10 +1235,10 @@ int CDECL _wsystem(const wchar_t* cmd)
return 1;
}
if ( comspec == NULL)
if (comspec == NULL)
return -1;
len = MSVCRT_wcslen(comspec) + MSVCRT_wcslen(flag) + MSVCRT_wcslen(cmd) + 1;
len = MSVCRT_wcslen(comspec) + MSVCRT_wcslen(cmd) + 5;
if (!(fullcmd = HeapAlloc(GetProcessHeap(), 0, len * sizeof(wchar_t))))
{
......@@ -1251,7 +1246,7 @@ int CDECL _wsystem(const wchar_t* cmd)
return -1;
}
MSVCRT_wcscpy(fullcmd, comspec);
MSVCRT_wcscat(fullcmd, flag);
MSVCRT_wcscat(fullcmd, L" /c ");
MSVCRT_wcscat(fullcmd, cmd);
res = msvcrt_spawn(MSVCRT__P_WAIT, comspec, fullcmd, NULL, 1);
......
......@@ -741,9 +741,9 @@ static struct fpnum fpnum_parse_bnum(wchar_t (*get)(void *ctx), void (*unget)(vo
void *ctx, pthreadlocinfo locinfo, BOOL ldouble, struct bnum *b)
{
#if _MSVCR_VER >= 140
wchar_t _infinity[] = { 'i', 'n', 'f', 'i', 'n', 'i', 't', 'y', 0 };
wchar_t _nan[] = { 'n', 'a', 'n', 0 };
wchar_t *str_match = NULL;
const wchar_t _infinity[] = L"infinity";
const wchar_t _nan[] = L"nan";
const wchar_t *str_match = NULL;
int matched=0;
#endif
BOOL found_digit = FALSE, found_dp = FALSE, found_sign = FALSE;
......
......@@ -591,10 +591,7 @@ struct MSVCRT_tm* CDECL MSVCRT_gmtime(const MSVCRT___time32_t* secs)
*/
char* CDECL MSVCRT__strdate(char* date)
{
static const char format[] = "MM'/'dd'/'yy";
GetDateFormatA(LOCALE_NEUTRAL, 0, NULL, format, date, 9);
GetDateFormatA(LOCALE_NEUTRAL, 0, NULL, "MM'/'dd'/'yy", date, 9);
return date;
}
......@@ -625,10 +622,7 @@ int CDECL _strdate_s(char* date, MSVCRT_size_t size)
*/
wchar_t* CDECL MSVCRT__wstrdate(wchar_t* date)
{
static const WCHAR format[] = { 'M','M','\'','/','\'','d','d','\'','/','\'','y','y',0 };
GetDateFormatW(LOCALE_NEUTRAL, 0, NULL, format, date, 9);
GetDateFormatW(LOCALE_NEUTRAL, 0, NULL, L"MM'/'dd'/'yy", date, 9);
return date;
}
......@@ -659,10 +653,7 @@ int CDECL _wstrdate_s(wchar_t* date, MSVCRT_size_t size)
*/
char* CDECL MSVCRT__strtime(char* time)
{
static const char format[] = "HH':'mm':'ss";
GetTimeFormatA(LOCALE_NEUTRAL, 0, NULL, format, time, 9);
GetTimeFormatA(LOCALE_NEUTRAL, 0, NULL, "HH':'mm':'ss", time, 9);
return time;
}
......@@ -693,10 +684,7 @@ int CDECL _strtime_s(char* time, MSVCRT_size_t size)
*/
wchar_t* CDECL MSVCRT__wstrtime(wchar_t* time)
{
static const WCHAR format[] = { 'H','H','\'',':','\'','m','m','\'',':','\'','s','s',0 };
GetTimeFormatW(LOCALE_NEUTRAL, 0, NULL, format, time, 9);
GetTimeFormatW(LOCALE_NEUTRAL, 0, NULL, L"HH':'mm':'ss", time, 9);
return time;
}
......@@ -990,9 +978,6 @@ static inline BOOL strftime_nstr(STRFTIME_CHAR *str, MSVCRT_size_t *pos,
static inline BOOL strftime_int(STRFTIME_CHAR *str, MSVCRT_size_t *pos, MSVCRT_size_t max,
int src, int prec, int l, int h)
{
#if _MSVCR_VER > 90
static const WCHAR fmt[] = {'%','0','*','d',0};
#endif
MSVCRT_size_t len;
if(!MSVCRT_CHECK_PMT(src>=l && src<=h)) {
......@@ -1003,7 +988,7 @@ static inline BOOL strftime_int(STRFTIME_CHAR *str, MSVCRT_size_t *pos, MSVCRT_s
#if _MSVCR_VER <= 90
len = MSVCRT__snprintf(str+*pos, max-*pos, "%0*d", prec, src);
#else
len = MSVCRT__snwprintf(str+*pos, max-*pos, fmt, prec, src);
len = MSVCRT__snwprintf(str+*pos, max-*pos, L"%0*d", prec, src);
#endif
if(len == -1) {
*str = 0;
......@@ -1236,9 +1221,7 @@ static MSVCRT_size_t strftime_impl(STRFTIME_CHAR *str, MSVCRT_size_t max,
#if _MSVCR_VER>=140
if(time_data == &cloc_time_data && !alternate)
{
static const WCHAR datetime_format[] =
{ '%','a',' ','%','b',' ','%','e',' ','%','T',' ','%','Y',0 };
tmp = strftime_impl(str+ret, max-ret, datetime_format, mstm, time_data, loc);
tmp = strftime_impl(str+ret, max-ret, L"%a %b %e %T %Y", mstm, time_data, loc);
if(!tmp)
return 0;
ret += tmp;
......
......@@ -987,7 +987,6 @@ static int MSVCRT_vsnwprintf_s_l_opt( wchar_t *str, MSVCRT_size_t sizeOfBuffer,
MSVCRT_size_t count, const wchar_t *format, DWORD options,
_locale_t locale, __ms_va_list valist)
{
static const wchar_t nullbyte = '\0';
struct _str_ctx_w ctx;
int len, ret;
......@@ -999,7 +998,7 @@ static int MSVCRT_vsnwprintf_s_l_opt( wchar_t *str, MSVCRT_size_t sizeOfBuffer,
ctx.buf = str;
ret = pf_printf_w(puts_clbk_str_w, &ctx, format, locale, MSVCRT_PRINTF_INVOKE_INVALID_PARAM_HANDLER | options,
arg_clbk_valist, NULL, &valist);
puts_clbk_str_w(&ctx, 1, &nullbyte);
puts_clbk_str_w(&ctx, 1, L"");
if(ret<0 || ret==len) {
if(count!=MSVCRT__TRUNCATE && count>sizeOfBuffer) {
......@@ -1296,13 +1295,12 @@ int WINAPIV MSVCRT__scprintf(const char *format, ...)
int CDECL MSVCRT_vsnwprintf(wchar_t *str, MSVCRT_size_t len,
const wchar_t *format, __ms_va_list valist)
{
static const wchar_t nullbyte = '\0';
struct _str_ctx_w ctx = {len, str};
int ret;
ret = pf_printf_w(puts_clbk_str_w, &ctx, format, NULL, 0,
arg_clbk_valist, NULL, &valist);
puts_clbk_str_w(&ctx, 1, &nullbyte);
puts_clbk_str_w(&ctx, 1, L"");
return ret;
}
......@@ -1313,13 +1311,12 @@ int CDECL MSVCRT_vsnwprintf_l(wchar_t *str, MSVCRT_size_t len,
const wchar_t *format, _locale_t locale,
__ms_va_list valist)
{
static const wchar_t nullbyte = '\0';
struct _str_ctx_w ctx = {len, str};
int ret;
ret = pf_printf_w(puts_clbk_str_w, &ctx, format, locale, 0,
arg_clbk_valist, NULL, &valist);
puts_clbk_str_w(&ctx, 1, &nullbyte);
puts_clbk_str_w(&ctx, 1, L"");
return ret;
}
......@@ -1345,7 +1342,6 @@ int CDECL MSVCRT_vswprintf_c(wchar_t *str, MSVCRT_size_t len,
static int MSVCRT_vswprintf_p_l_opt(wchar_t *buffer, MSVCRT_size_t length,
const wchar_t *format, DWORD options, _locale_t locale, __ms_va_list args)
{
static const wchar_t nullbyte = '\0';
printf_arg args_ctx[MSVCRT__ARGMAX+1];
struct _str_ctx_w puts_ctx = {length, buffer};
int ret;
......@@ -1365,7 +1361,7 @@ static int MSVCRT_vswprintf_p_l_opt(wchar_t *buffer, MSVCRT_size_t length,
MSVCRT_PRINTF_POSITIONAL_PARAMS | MSVCRT_PRINTF_INVOKE_INVALID_PARAM_HANDLER | options,
arg_clbk_positional, args_ctx, NULL);
puts_clbk_str_w(&puts_ctx, 1, &nullbyte);
puts_clbk_str_w(&puts_ctx, 1, L"");
return ret;
}
......@@ -1507,7 +1503,6 @@ int CDECL MSVCRT__stdio_common_vswprintf( unsigned __int64 options,
wchar_t *str, MSVCRT_size_t len, const wchar_t *format,
_locale_t locale, __ms_va_list valist )
{
static const wchar_t nullbyte = '\0';
struct _str_ctx_w ctx = {len, str};
int ret;
......@@ -1515,7 +1510,7 @@ int CDECL MSVCRT__stdio_common_vswprintf( unsigned __int64 options,
FIXME("options %s not handled\n", wine_dbgstr_longlong(options));
ret = pf_printf_w(puts_clbk_str_c99_w,
&ctx, format, locale, options & UCRTBASE_PRINTF_MASK, arg_clbk_valist, NULL, &valist);
puts_clbk_str_w(&ctx, 1, &nullbyte);
puts_clbk_str_w(&ctx, 1, L"");
if(!str)
return ret;
......
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