[3/6] msvcr80: _itow_s implementation (try 2, resend)

Vincas Miliūnas vincas.miliunas at gmail.com
Wed Nov 3 09:05:55 CDT 2010


qsort_s and _itow_s implementation and tests for bug #24925.
Because of Thunderbird's default text formatting, the patch got broken; a good resource on solving this is http://kerneltrap.org/Linux/Email_Clients_and_Patches

---
 dlls/msvcr80/msvcr80.c    |   26 ++++++++++++++++++++++++++
 dlls/msvcr80/msvcr80.spec |    2 +-
 2 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/dlls/msvcr80/msvcr80.c b/dlls/msvcr80/msvcr80.c
index ab48440..0674689 100644
--- a/dlls/msvcr80/msvcr80.c
+++ b/dlls/msvcr80/msvcr80.c
@@ -120,3 +120,29 @@ void CDECL MSVCR80_qsort_s(void *b, size_t n, size_t s,
     }
 }
 
+/*********************************************************************
+ * _itow_s (MSVCR80.@)
+ *
+ */
+errno_t CDECL MSVCR80_itow_s(int value, wchar_t *buffer,
+    size_t sizeInCharacters, int radix)
+{
+    /* Print the number as ASCII, reusing the buffer */
+    char * const buf = (char *) buffer;
+    const int ret = _itoa_s(value, buf, sizeInCharacters, radix);
+    if (ret)
+    {
+        buffer[0] = '\0';
+        return ret;
+    }
+
+    /* Convert from ASCII to wchars, moving from right to left */
+    const int len = strlen(buf);
+    signed int i;
+    for (i = len - 1; i >= 0; --i)
+        buffer[i] = buf[i];
+    buffer[len] = '\0';
+
+    return 0;
+}
+
diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec
index 0407886..767f24a 100644
--- a/dlls/msvcr80/msvcr80.spec
+++ b/dlls/msvcr80/msvcr80.spec
@@ -682,7 +682,7 @@
 @ cdecl _itoa(long ptr long) msvcrt._itoa
 @ cdecl _itoa_s(long ptr long long) msvcrt._itoa_s
 @ cdecl _itow(long ptr long) msvcrt._itow
-@ stub _itow_s
+@ cdecl _itow_s(long ptr long long) MSVCR80_itow_s
 @ cdecl _j0(double) msvcrt._j0
 @ cdecl _j1(double) msvcrt._j1
 @ cdecl _jn(long double) msvcrt._jn
-- 
1.7.2.3




More information about the wine-patches mailing list