dlls/msvcrt/strings.c - some 64bit functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



These are easy, mostly copied from ntdll.
Most windows software doesn't use them as
there were no 64bit parts in win16 IIRC.
It's perhaps different with more windows
software being targetted at 2K/XP. This
is more common with vertical software ;-)

The following functions are "stub"ed in
msvcrt.spec - I am not sure however how
to express it, there is a function that
does return a "long double" and others
have a "long long" argument. Please add
them. This patch had been lying around
for too long on my disk, so I am sending
it out now.

cheers, guido

Index: dlls/msvcrt/string.c
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/string.c,v
retrieving revision 1.8
diff -u -r1.8 string.c
--- dlls/msvcrt/string.c	23 Jul 2002 20:56:16 -0000	1.8
+++ dlls/msvcrt/string.c	16 Feb 2003 21:47:25 -0000
@@ -115,3 +115,117 @@
     }
   }
 }
+
+/*********************************************************************
+ *		_atodbl (MSVCRT.@)
+ */
+double _atodbl (LPCSTR ptr)
+{
+# if defined HAVE_ATOF || defined __GLIBC__
+    return atof(ptr);
+# else /* atleast in C99 */
+    return strtod(ptr, (char**)0);
+# endif
+}
+
+/*********************************************************************
+ *		_atoldbl (MSVCRT.@)
+ */
+long double _atoldbl (LPCSTR ptr)
+{
+# if defined HAVE_ATOLD || defined __GLIBC__
+    return atold(ptr);
+# else /* atleast in C99 */
+    return strtold(ptr, (char**)0);
+# endif
+}
+
+/*********************************************************************
+ *		_atoi64 (MSVCRT.@)
+ */
+LONGLONG _atoi64 (LPCSTR ptr)
+{
+# if defined HAVE_ATOLL || defined __GLIBC__
+    return atoll(ptr);
+# else /* atleast in C99 */
+    return strtoll(ptr, (char**)0);
+# endif
+}
+
+/*********************************************************************
+ *		_ui64toa (MSVCRT.@)
+ */
+LPSTR _ui64toa (LONGLONG x, LPSTR buf, INT radix)
+{
+    /* copied from ntdll.ultoa NOTE: ntdll.ultow looks different */
+    char buffer[64], *p;
+    
+    if (radix > 36) return 0;
+    if (radix <= 1) radix = 10;
+
+    p = buffer + sizeof(buffer);
+    *--p = 0;
+    do
+    {
+	int rem = x % radix;
+	*--p = (rem <= 9) ? rem + '0' : rem + 'a' - 10;
+	x /= radix;
+    } while (x);
+    strcpy( buf, p );
+    return buf;
+}
+
+/*********************************************************************
+ *              _i64toa   (MSVCRT.@)
+ */
+LPSTR _i64toa( long x, LPSTR buf, INT radix )
+{
+    /* copied from ntdll.ultoa */
+    LPSTR p = buf;
+    if (x < 0)
+    {
+        *p++ = '-';
+        x = -x;
+    }
+    _ui64toa( x, p, radix );
+    return buf;
+}
+
+/*********************************************************************
+ *		_ui64tow (MSVCRT.@)
+ */
+LPWSTR _ui64tow (LONGLONG x, LPWSTR buf, INT radix)
+{
+    /* copied from ntdll.ultoa NOTE: ntdll.ultow looks different */
+    WCHAR buffer[64], *p;
+
+    if (radix > 36) return 0;
+    if (radix <= 1) radix = 10;
+
+    p = buffer + sizeof(buffer);
+    *--p = 0;
+    do
+    {
+	int rem = x % radix;
+	*--p = (rem <= 9) ? rem + '0' : rem + 'a' - 10;
+	x /= radix;
+    } while (x);
+    strcpy( buf, p );
+    return buf;
+}
+
+/*********************************************************************
+ *              _i64tow   (MSVCRT.@)
+ */
+LWPSTR _i64tow( long x, LPWSTR buf, INT radix )
+{
+    /* copied from ntdll.ultoa */
+    LPWSTR p = buf;
+    if (x < 0)
+    {
+        *p++ = '-';
+        x = -x;
+    }
+    _ui64tow( x, p, radix );
+    return buf;
+}

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux