msvcrt: Make snprintf and snwprintf use the msvcrt version of printf.
Remove todos from tests that succeed now.
diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec
index a24f11b..e9e4298 100644
--- a/dlls/msvcrt/msvcrt.spec
+++ b/dlls/msvcrt/msvcrt.spec
@@ -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)
diff --git a/dlls/msvcrt/tests/printf.c b/dlls/msvcrt/tests/printf.c
index f13ac2d..64b5d5a 100644
--- a/dlls/msvcrt/tests/printf.c
+++ b/dlls/msvcrt/tests/printf.c
@@ -496,16 +496,12 @@
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 @@
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);
};
}
diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c
index 2a48003..992185d 100644
--- a/dlls/msvcrt/wcs.c
+++ b/dlls/msvcrt/wcs.c
@@ -712,9 +712,7 @@
/* 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 @@
}
/*********************************************************************
+ * _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 @@
}
/*********************************************************************
+ * _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, ... )