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

Alexandre Julliard julliard at wine.codeweavers.com
Sat Jan 14 10:56:39 CST 2006


Module: wine
Branch: refs/heads/master
Commit: ee603ce6ddf54b40d35f7c8c7f53376410041af4
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=ee603ce6ddf54b40d35f7c8c7f53376410041af4

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Sat Jan 14 17:30:02 2006 +0100

msvcrt: Make snprintf and snwprintf use the msvcrt version of printf.
Remove todos from tests that succeed now.

---

 dlls/msvcrt/msvcrt.spec    |    4 ++--
 dlls/msvcrt/tests/printf.c |   22 ++++++++--------------
 dlls/msvcrt/wcs.c          |   30 +++++++++++++++++++++++++++---
 3 files changed, 37 insertions(+), 19 deletions(-)

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 @@ 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);
     };
 }
 
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 @@ static int pf_vsnprintf( pf_output *out,
 
     /* 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, unsigne
 }
 
 /*********************************************************************
+ *		_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 *s
 }
 
 /*********************************************************************
+ *		_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, ... )




More information about the wine-cvs mailing list