MySQL Forums
Forum List  »  Source, Builds, Binaries

Re: Build 5-5-9 in cygwin
Posted by: Hiroaki Kawai
Date: April 30, 2011 10:05PM

Finally, I renamed all dtoa() to _dtoa() in mysql/strings/dtoa.c. The function is static, and should be safe to be renamed.

Here is a patch
------------------------

--- mysql-5.5.11/strings/dtoa.c.orig 2011-03-31 22:36:18.000000000 +0900
+++ mysql-5.5.11/strings/dtoa.c 2011-05-01 13:03:54.028400000 +0900
@@ -48,11 +48,11 @@
*/
#define DTOA_BUFF_SIZE (420 * sizeof(void *))

-/* Magic value returned by dtoa() to indicate overflow */
+/* Magic value returned by _dtoa() to indicate overflow */
#define DTOA_OVERFLOW 9999

static double my_strtod_int(const char *, char **, int *, char *, size_t);
-static char *dtoa(double, int, int, int *, int *, char **, char *, size_t);
+static char *_dtoa(double, int, int, int *, int *, char **, char *, size_t);
static void dtoa_free(char *, char *, size_t);

/**
@@ -93,7 +93,7 @@
char buf[DTOA_BUFF_SIZE];
DBUG_ASSERT(precision >= 0 && precision < NOT_FIXED_DEC && to != NULL);

- res= dtoa(x, 5, precision, &decpt, &sign, &end, buf, sizeof(buf));
+ res= _dtoa(x, 5, precision, &decpt, &sign, &end, buf, sizeof(buf));

if (decpt == DTOA_OVERFLOW)
{
@@ -189,7 +189,7 @@

@todo
Check if it is possible and makes sense to do our own rounding on top of
- dtoa() instead of calling dtoa() twice in (rare) cases when the resulting
+ _dtoa() instead of calling _dtoa() twice in (rare) cases when the resulting
string representation does not fit in the specified field width and we want
to re-round the input number with fewer significant digits. Examples:

@@ -200,10 +200,10 @@

We do our best to minimize such cases by:

- - passing to dtoa() the field width as the number of significant digits
+ - passing to _dtoa() the field width as the number of significant digits

- removing the sign of the number early (and decreasing the width before
- passing it to dtoa())
+ passing it to _dtoa())

- choosing the proper format to preserve the most number of significant
digits.
@@ -222,7 +222,7 @@
if (x < 0.)
width--;

- res= dtoa(x, 4, type == MY_GCVT_ARG_DOUBLE ? width : min(width, FLT_DIG),
+ res= _dtoa(x, 4, type == MY_GCVT_ARG_DOUBLE ? width : min(width, FLT_DIG),
&decpt, &sign, &end, buf, sizeof(buf));
if (decpt == DTOA_OVERFLOW)
{
@@ -328,7 +328,7 @@
number of significant digits = (len-decpt) - (len-width) = width-decpt
*/
dtoa_free(res, buf, sizeof(buf));
- res= dtoa(x, 5, width - decpt, &decpt, &sign, &end, buf, sizeof(buf));
+ res= _dtoa(x, 5, width - decpt, &decpt, &sign, &end, buf, sizeof(buf));
src= res;
len= end - res;
}
@@ -394,7 +394,7 @@
{
/* Yes, re-convert with a smaller width */
dtoa_free(res, buf, sizeof(buf));
- res= dtoa(x, 4, width, &decpt, &sign, &end, buf, sizeof(buf));
+ res= _dtoa(x, 4, width, &decpt, &sign, &end, buf, sizeof(buf));
src= res;
len= end - res;
if (--decpt < 0)
@@ -506,7 +506,7 @@
* strtod() was modified to not expect a zero-terminated string.
It now honors 'se' (end of string) argument as the input parameter,
not just as the output one.
- * in dtoa(), in case of overflow/underflow/NaN result string now contains "0";
+ * in _dtoa(), in case of overflow/underflow/NaN result string now contains "0";
decpt is set to DTOA_OVERFLOW to indicate overflow.
* support for VAX, IBM mainframe and 16-bit hardware removed
* we always assume that 64-bit integer type is available
@@ -734,7 +734,7 @@


/*
- dtoa_free() must be used to free values s returned by dtoa()
+ dtoa_free() must be used to free values s returned by _dtoa()
This is the counterpart of dtoa_alloc()
*/

@@ -2137,7 +2137,7 @@
calculation.
*/

-static char *dtoa(double dd, int mode, int ndigits, int *decpt, int *sign,
+static char *_dtoa(double dd, int mode, int ndigits, int *decpt, int *sign,
char **rve, char *buf, size_t buf_size)
{
/*

Options: ReplyQuote


Subject
Views
Written By
Posted
9375
February 13, 2011 06:42PM
4285
February 17, 2011 10:19AM
3012
February 28, 2011 08:32AM
3466
February 28, 2011 01:57PM
3348
April 01, 2011 06:43PM
2651
May 03, 2011 02:43PM
2237
May 05, 2011 03:45AM
2599
May 10, 2011 10:07AM
2252
April 30, 2011 09:36PM
Re: Build 5-5-9 in cygwin
4068
April 30, 2011 10:05PM
2331
May 01, 2011 07:31AM
2192
May 27, 2011 06:03AM
2731
June 08, 2011 09:49AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.