Alexandre Julliard : msvcrt: Added wrappers for a few functions instead of linking them

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


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

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

msvcrt: Added wrappers for a few functions instead of linking them
directly to libc.

---

 dlls/msvcrt/math.c      |   76 +++++++++++++++++++++++++++++++++++++++++++++++
 dlls/msvcrt/mbcs.c      |   26 ++++++++++++++++
 dlls/msvcrt/msvcrt.spec |   32 ++++++++++----------
 dlls/msvcrt/string.c    |   36 ++++++++++++++++++++++
 4 files changed, 154 insertions(+), 16 deletions(-)

diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index f5277b0..66a3ec0 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -490,6 +490,55 @@ double _scalb(double num, long power)
 }
 
 /*********************************************************************
+ *		_hypot (MSVCRT.@)
+ */
+double _hypot(double x, double y)
+{
+  /* FIXME: errno handling */
+  return hypot( x, y );
+}
+
+/*********************************************************************
+ *		ceil (MSVCRT.@)
+ */
+double MSVCRT_ceil( double x )
+{
+  return ceil(x);
+}
+
+/*********************************************************************
+ *		floor (MSVCRT.@)
+ */
+double MSVCRT_floor( double x )
+{
+  return floor(x);
+}
+
+/*********************************************************************
+ *		fabs (MSVCRT.@)
+ */
+double MSVCRT_fabs( double x )
+{
+  return fabs(x);
+}
+
+/*********************************************************************
+ *		frexp (MSVCRT.@)
+ */
+double MSVCRT_frexp( double x, int *exp )
+{
+  return frexp( x, exp );
+}
+
+/*********************************************************************
+ *		modf (MSVCRT.@)
+ */
+double MSVCRT_modf( double x, double *iptr )
+{
+  return modf( x, iptr );
+}
+
+/*********************************************************************
  *		_matherr (MSVCRT.@)
  */
 int MSVCRT__matherr(struct MSVCRT__exception *e)
@@ -715,6 +764,33 @@ INT  _isnan(double num)
 }
 
 /*********************************************************************
+ *		_j0 (MSVCRT.@)
+ */
+double _j0(double num)
+{
+  /* FIXME: errno handling */
+  return j0(num);
+}
+
+/*********************************************************************
+ *		_j1 (MSVCRT.@)
+ */
+double _j1(double num)
+{
+  /* FIXME: errno handling */
+  return j1(num);
+}
+
+/*********************************************************************
+ *		jn (MSVCRT.@)
+ */
+double _jn(int n, double num)
+{
+  /* FIXME: errno handling */
+  return jn(n, num);
+}
+
+/*********************************************************************
  *		_y0 (MSVCRT.@)
  */
 double _y0(double num)
diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c
index 939c314..59bb182 100644
--- a/dlls/msvcrt/mbcs.c
+++ b/dlls/msvcrt/mbcs.c
@@ -606,6 +606,32 @@ int _mbsnbicmp(const unsigned char* str,
 }
 
 /*********************************************************************
+ *		_mbscat (MSVCRT.@)
+ */
+unsigned char *_mbscat( unsigned char *dst, const unsigned char *src )
+{
+    strcat( (char *)dst, (const char *)src );
+    return dst;
+}
+
+/*********************************************************************
+ *		_mbscpy (MSVCRT.@)
+ */
+unsigned char* _mbscpy( unsigned char *dst, const unsigned char *src )
+{
+    strcpy( (char *)dst, (const char *)src );
+    return dst;
+}
+
+/*********************************************************************
+ *		_mbsstr (MSVCRT.@)
+ */
+unsigned char *_mbsstr(const unsigned char *haystack, const unsigned char *needle)
+{
+    return (unsigned char *)strstr( (const char *)haystack, (const char *)needle );
+}
+
+/*********************************************************************
  *		_mbschr(MSVCRT.@)
  *
  * Find a multibyte character in a multibyte string.
diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec
index 9a6da3a..66610ad 100644
--- a/dlls/msvcrt/msvcrt.spec
+++ b/dlls/msvcrt/msvcrt.spec
@@ -270,7 +270,7 @@
 @ cdecl _heapset(long)
 @ stub _heapused #(ptr ptr)
 @ cdecl _heapwalk(ptr)
-@ cdecl _hypot(double double) hypot
+@ cdecl _hypot(double double)
 @ cdecl _i64toa(long long ptr long) ntdll._i64toa
 @ cdecl _i64tow(long long ptr long) ntdll._i64tow
 @ cdecl _initterm(ptr ptr)
@@ -312,9 +312,9 @@
 @ cdecl _isnan( double )
 @ cdecl _itoa(long ptr long) ntdll._itoa
 @ cdecl _itow(long ptr long) ntdll._itow
-@ cdecl _j0(double) j0
-@ cdecl _j1(double) j1
-@ cdecl _jn(long double) jn
+@ cdecl _j0(double)
+@ cdecl _j1(double)
+@ cdecl _jn(long double)
 @ cdecl _kbhit()
 @ cdecl _lfind(ptr ptr ptr long ptr)
 @ cdecl _loaddll(str)
@@ -346,11 +346,11 @@
 @ cdecl _mbctoupper(long)
 @ extern _mbctype MSVCRT_mbctype
 @ stub _mbsbtype #(str long)
-@ cdecl _mbscat(str str) strcat
+@ cdecl _mbscat(str str)
 @ cdecl _mbschr(str long)
 @ cdecl _mbscmp(str str)
 @ cdecl _mbscoll(str str)
-@ cdecl _mbscpy(ptr str) strcpy
+@ cdecl _mbscpy(ptr str)
 @ cdecl _mbscspn (str str)
 @ cdecl _mbsdec(ptr ptr)
 @ cdecl _mbsdup(str) _strdup
@@ -383,7 +383,7 @@
 @ cdecl _mbsset(str long)
 @ cdecl _mbsspn(str str)
 @ stub _mbsspnp #(str str)
-@ cdecl _mbsstr(str str) strstr
+@ cdecl _mbsstr(str str)
 @ cdecl _mbstok(str str)
 @ cdecl _mbstrlen(str)
 @ cdecl _mbsupr(str)
@@ -575,12 +575,12 @@
 @ cdecl atan(double) MSVCRT_atan
 @ cdecl atan2(double double) MSVCRT_atan2
 @ cdecl atexit(ptr) MSVCRT_atexit
-@ cdecl atof(str)
+@ cdecl atof(str) MSVCRT_atof
 @ cdecl atoi(str)
 @ cdecl atol(str)
 @ cdecl bsearch(ptr ptr long long ptr)
 @ cdecl calloc(long long) MSVCRT_calloc
-@ cdecl ceil(double)
+@ cdecl ceil(double) MSVCRT_ceil
 @ cdecl clearerr(ptr) MSVCRT_clearerr
 @ cdecl clock() MSVCRT_clock
 @ cdecl cos(double) MSVCRT_cos
@@ -590,7 +590,7 @@
 @ cdecl div(long long) MSVCRT_div
 @ cdecl exit(long) MSVCRT_exit
 @ cdecl exp(double) MSVCRT_exp
-@ cdecl fabs(double)
+@ cdecl fabs(double) MSVCRT_fabs
 @ cdecl fclose(ptr) MSVCRT_fclose
 @ cdecl feof(ptr) MSVCRT_feof
 @ cdecl ferror(ptr) MSVCRT_ferror
@@ -600,7 +600,7 @@
 @ cdecl fgets(ptr long ptr) MSVCRT_fgets
 @ cdecl fgetwc(ptr) MSVCRT_fgetwc
 @ cdecl fgetws(ptr long ptr) MSVCRT_fgetws
-@ cdecl floor(double)
+@ cdecl floor(double) MSVCRT_floor
 @ cdecl fmod(double double) MSVCRT_fmod
 @ cdecl fopen(str str) MSVCRT_fopen
 @ varargs fprintf(ptr str) MSVCRT_fprintf
@@ -611,7 +611,7 @@
 @ cdecl fread(ptr long long ptr) MSVCRT_fread
 @ cdecl free(ptr) MSVCRT_free
 @ cdecl freopen(str str ptr) MSVCRT_freopen
-@ cdecl frexp(double ptr)
+@ cdecl frexp(double ptr) MSVCRT_frexp
 @ varargs fscanf(ptr str) MSVCRT_fscanf
 @ cdecl fseek(ptr long long) MSVCRT_fseek
 @ cdecl fsetpos(ptr ptr) MSVCRT_fsetpos
@@ -670,7 +670,7 @@
 @ cdecl memmove(ptr ptr long)
 @ cdecl memset(ptr long long)
 @ cdecl mktime(ptr) MSVCRT_mktime
-@ cdecl modf(double ptr)
+@ cdecl modf(double ptr) MSVCRT_modf
 @ cdecl perror(str) MSVCRT_perror
 @ cdecl pow(double double) MSVCRT_pow
 @ varargs printf(str) MSVCRT_printf
@@ -700,7 +700,7 @@
 @ cdecl strcat(str str)
 @ cdecl strchr(str long)
 @ cdecl strcmp(str str)
-@ cdecl strcoll(str str)
+@ cdecl strcoll(str str) MSVCRT_strcoll
 @ cdecl strcpy(ptr str)
 @ cdecl strcspn(str str)
 @ cdecl strerror(long) MSVCRT_strerror
@@ -713,11 +713,11 @@
 @ cdecl strrchr(str long)
 @ cdecl strspn(str str)
 @ cdecl strstr(str str)
-@ cdecl strtod(str ptr)
+@ cdecl strtod(str ptr) MSVCRT_strtod
 @ cdecl strtok(str str) MSVCRT_strtok
 @ cdecl strtol(str ptr long)
 @ cdecl strtoul(str ptr long)
-@ cdecl strxfrm(ptr str long)
+@ cdecl strxfrm(ptr str long) MSVCRT_strxfrm
 @ varargs swprintf(wstr wstr) MSVCRT_swprintf
 @ varargs swscanf(wstr wstr) MSVCRT_swscanf
 @ cdecl system(str) MSVCRT_system
diff --git a/dlls/msvcrt/string.c b/dlls/msvcrt/string.c
index 057dbf8..579c9bd 100644
--- a/dlls/msvcrt/string.c
+++ b/dlls/msvcrt/string.c
@@ -21,6 +21,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include <stdlib.h>
 #include "msvcrt.h"
 #include "wine/debug.h"
 
@@ -135,6 +136,41 @@ void MSVCRT__swab(char* src, char* dst, 
     }
   }
 }
+
+/*********************************************************************
+ *		atof  (MSVCRT.@)
+ */
+double MSVCRT_atof( const char *str )
+{
+    return atof( str );
+}
+
+/*********************************************************************
+ *		strtod  (MSVCRT.@)
+ */
+double MSVCRT_strtod( const char *str, char **end )
+{
+    return strtod( str, end );
+}
+
+/*********************************************************************
+ *		strcoll (MSVCRT.@)
+ */
+int MSVCRT_strcoll( const char* str1, const char* str2 )
+{
+    /* FIXME: handle Windows locale */
+    return strcoll( str1, str2 );
+}
+
+/*********************************************************************
+ *		strxfrm (MSVCRT.@)
+ */
+MSVCRT_size_t MSVCRT_strxfrm( char *dest, const char *src, MSVCRT_size_t len )
+{
+    /* FIXME: handle Windows locale */
+    return strxfrm( dest, src, len );
+}
+
 /*********************************************************************
  *		_stricoll (MSVCRT.@)
  */




More information about the wine-cvs mailing list