Commit ee603ce6 authored by Alexandre Julliard's avatar Alexandre Julliard

msvcrt: Make snprintf and snwprintf use the msvcrt version of printf.

Remove todos from tests that succeed now.
parent ad8cb613
......@@ -433,8 +433,8 @@
@ cdecl _setmode(long long)
@ stub _setsystime #(ptr long)
@ cdecl _sleep(long)
@ varargs _snprintf(str long str) snprintf
@ varargs _snwprintf(wstr long wstr) ntdll._snwprintf
@ varargs _snprintf(str long str) MSVCRT__snprintf
@ varargs _snwprintf(wstr long wstr) MSVCRT__snwprintf
@ varargs _sopen(str long long) MSVCRT__sopen
@ varargs _spawnl(long str str)
@ varargs _spawnle(long str str)
......
......@@ -496,16 +496,12 @@ static void test_snprintf (void)
struct snprintf_test {
const char *format;
int expected;
struct {
int retval;
int render;
} todo;
};
/* Pre-2.1 libc behaviour, not C99 compliant. */
const struct snprintf_test tests[] = {{"short", 5, {0, 0}},
{"justfit", 7, {0, 0}},
{"justfits", 8, {0, 1}},
{"muchlonger", -1, {1, 1}}};
const struct snprintf_test tests[] = {{"short", 5},
{"justfit", 7},
{"justfits", 8},
{"muchlonger", -1}};
char buffer[8];
const int bufsiz = sizeof buffer;
unsigned int i;
......@@ -516,12 +512,10 @@ static void test_snprintf (void)
const int n = _snprintf (buffer, bufsiz, fmt);
const int valid = n < 0 ? bufsiz : (n == bufsiz ? n : n+1);
todo (tests[i].todo.retval ? "wine" : "none")
ok (n == expect, "\"%s\": expected %d, returned %d\n",
fmt, expect, n);
todo (tests[i].todo.render ? "wine" : "none")
ok (!memcmp (fmt, buffer, valid),
"\"%s\": rendered \"%.*s\"\n", fmt, valid, buffer);
ok (n == expect, "\"%s\": expected %d, returned %d\n",
fmt, expect, n);
ok (!memcmp (fmt, buffer, valid),
"\"%s\": rendered \"%.*s\"\n", fmt, valid, buffer);
};
}
......
......@@ -712,9 +712,7 @@ static int pf_vsnprintf( pf_output *out, const WCHAR *format, va_list valist )
/* check we reached the end, and null terminate the string */
assert( *p == 0 );
r = pf_output_stringW( out, p, 1 );
if( r<0 )
return r;
pf_output_stringW( out, p, 1 );
return out->used - 1;
}
......@@ -750,6 +748,19 @@ int MSVCRT_vsnprintf( char *str, unsigned int len,
}
/*********************************************************************
* _snprintf (MSVCRT.@)
*/
int MSVCRT__snprintf(char *str, unsigned int len, const char *format, ...)
{
int retval;
va_list valist;
va_start(valist, format);
retval = MSVCRT_vsnprintf(str, len, format, valist);
va_end(valist);
return retval;
}
/*********************************************************************
* _vsnwsprintf (MSVCRT.@)
*/
int MSVCRT_vsnwprintf( MSVCRT_wchar_t *str, unsigned int len,
......@@ -766,6 +777,19 @@ int MSVCRT_vsnwprintf( MSVCRT_wchar_t *str, unsigned int len,
}
/*********************************************************************
* _snwprintf (MSVCRT.@)
*/
int MSVCRT__snwprintf( MSVCRT_wchar_t *str, unsigned int len, const MSVCRT_wchar_t *format, ...)
{
int retval;
va_list valist;
va_start(valist, format);
retval = MSVCRT_vsnwprintf(str, len, format, valist);
va_end(valist);
return retval;
}
/*********************************************************************
* sprintf (MSVCRT.@)
*/
int MSVCRT_sprintf( char *str, const char *format, ... )
......
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