diff --git a/configure b/configure index 7b3845dd177..92250c3ce90 100755 --- a/configure +++ b/configure @@ -13074,9 +13074,6 @@ fi - - - @@ -13091,13 +13088,10 @@ for ac_func in \ _vsnprintf \ chsize \ clone \ - ecvt \ - fcvt \ finite \ fpclass \ ftruncate \ ftruncate64 \ - gcvt \ getnetbyaddr \ getnetbyname \ getopt_long \ diff --git a/configure.ac b/configure.ac index 91437d2d6a8..2cce51b8339 100644 --- a/configure.ac +++ b/configure.ac @@ -916,13 +916,10 @@ AC_CHECK_FUNCS(\ _vsnprintf \ chsize \ clone \ - ecvt \ - fcvt \ finite \ fpclass \ ftruncate \ ftruncate64 \ - gcvt \ getnetbyaddr \ getnetbyname \ getopt_long \ diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index efc63539fa8..06f4eb523a6 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -21,6 +21,7 @@ #include "msvcrt.h" #include "msvcrt/errno.h" +#include #define __USE_ISOC9X 1 #define __USE_ISOC99 1 #include @@ -681,6 +682,53 @@ double _nextafter(double num, double next) return retval; } +/********************************************************************* + * _ecvt (MSVCRT.@) + */ +char *_ecvt( double number, int ndigits, int *decpt, int *sign ) +{ + MSVCRT_thread_data *data = msvcrt_get_thread_data(); + char *dec; + + if (!data->efcvt_buffer) + data->efcvt_buffer = MSVCRT_malloc( 80 ); /* ought to be enough */ + + snprintf(data->efcvt_buffer, 80, "%.*e", ndigits /* FIXME wrong */, number); + *sign = (number < 0); + dec = strchr(data->efcvt_buffer, '.'); + *decpt = (dec) ? dec - data->efcvt_buffer : -1; + return data->efcvt_buffer; +} + +/*********************************************************************** + * _fcvt (MSVCRT.@) + */ +char *_fcvt( double number, int ndigits, int *decpt, int *sign ) +{ + MSVCRT_thread_data *data = msvcrt_get_thread_data(); + char *dec; + + if (!data->efcvt_buffer) + data->efcvt_buffer = MSVCRT_malloc( 80 ); /* ought to be enough */ + + snprintf(data->efcvt_buffer, 80, "%.*e", ndigits, number); + *sign = (number < 0); + dec = strchr(data->efcvt_buffer, '.'); + *decpt = (dec) ? dec - data->efcvt_buffer : -1; + return data->efcvt_buffer; +} + +/*********************************************************************** + * _gcvt (MSVCRT.@) + * + * FIXME: uses both E and F. + */ +char *_gcvt( double number, int ndigit, char *buff ) +{ + sprintf(buff, "%.*E", ndigit, number); + return buff; +} + #include /* div_t, ldiv_t */ /********************************************************************* diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h index c2b381b5b3d..719948c136e 100644 --- a/dlls/msvcrt/msvcrt.h +++ b/dlls/msvcrt/msvcrt.h @@ -39,6 +39,7 @@ typedef struct __MSVCRT_thread_data int errno; unsigned long doserrno; char *mbstok_next; /* next ptr for mbstok() */ + char *efcvt_buffer; /* buffer for ecvt/fcvt */ terminate_function terminate_handler; unexpected_function unexpected_handler; _se_translator_function se_translator; diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index f9c71abc437..51e8a350ed1 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -197,7 +197,7 @@ @ stub _dstbias @ cdecl _dup (long) @ cdecl _dup2 (long long) -@ cdecl _ecvt( double long ptr ptr) ecvt +@ cdecl _ecvt(double long ptr ptr) @ cdecl _endthread () @ cdecl _endthreadex(long) @ extern _environ MSVCRT__environ @@ -216,7 +216,7 @@ @ cdecl _exit(long) MSVCRT__exit @ cdecl _expand(ptr long) @ cdecl _fcloseall() -@ cdecl _fcvt( double long ptr ptr) fcvt +@ cdecl _fcvt(double long ptr ptr) @ cdecl _fdopen(long str) @ cdecl _fgetchar() @ cdecl _fgetwchar() @@ -246,7 +246,7 @@ @ cdecl _ftol() ntdll._ftol @ cdecl _fullpath(ptr str long) @ cdecl _futime(long ptr) -@ cdecl _gcvt( double long str) gcvt +@ cdecl _gcvt(double long str) @ cdecl _get_osfhandle(long) @ stub _get_sbh_threshold #() @ cdecl _getch() diff --git a/include/config.h.in b/include/config.h.in index e2ea1acdbd2..91274d030a0 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -71,15 +71,9 @@ /* Define if you have dlopen */ #undef HAVE_DLOPEN -/* Define to 1 if you have the `ecvt' function. */ -#undef HAVE_ECVT - /* Define to 1 if you have the header file. */ #undef HAVE_ELF_H -/* Define to 1 if you have the `fcvt' function. */ -#undef HAVE_FCVT - /* Define to 1 if you have the `finite' function. */ #undef HAVE_FINITE @@ -125,9 +119,6 @@ /* Define to 1 if you have the `ftruncate64' function. */ #undef HAVE_FTRUNCATE64 -/* Define to 1 if you have the `gcvt' function. */ -#undef HAVE_GCVT - /* Define to 1 if you have the `getbkgd' function. */ #undef HAVE_GETBKGD diff --git a/library/port.c b/library/port.c index 6c10c6a7d8f..15f4e18a976 100644 --- a/library/port.c +++ b/library/port.c @@ -189,65 +189,6 @@ void *wine_anon_mmap( void *start, size_t size, int prot, int flags ) } -#ifndef HAVE_ECVT -/*********************************************************************** - * ecvt - */ -char *ecvt (double number, int ndigits, int *decpt, int *sign) -{ - static char buf[40]; /* ought to be enough */ - char *dec; - sprintf(buf, "%.*e", ndigits /* FIXME wrong */, number); - *sign = (number < 0); - dec = strchr(buf, '.'); - *decpt = (dec) ? (int)dec - (int)buf : -1; - return buf; -} -#endif /* HAVE_ECVT */ - -#ifndef HAVE_FCVT -/*********************************************************************** - * fcvt - */ -char *fcvt (double number, int ndigits, int *decpt, int *sign) -{ - static char buf[40]; /* ought to be enough */ - char *dec; - sprintf(buf, "%.*e", ndigits, number); - *sign = (number < 0); - dec = strchr(buf, '.'); - *decpt = (dec) ? (int)dec - (int)buf : -1; - return buf; -} -#endif /* HAVE_FCVT */ - -#ifndef HAVE_GCVT -/*********************************************************************** - * gcvt - * - * FIXME: uses both E and F. - */ -char *gcvt (double number, size_t ndigit, char *buff) -{ - sprintf(buff, "%.*E", (int)ndigit, number); - return buff; -} -#endif /* HAVE_GCVT */ - - -#ifndef wine_memcpy_unaligned -/*********************************************************************** - * wine_memcpy_unaligned - * - * This is necessary to defeat optimizations of memcpy by gcc. - */ -void *wine_memcpy_unaligned( void *dst, const void *src, size_t size ) -{ - return memcpy( dst, src, size ); -} -#endif - - /*********************************************************************** * pthread functions */