diff options
author | George Wang <gwang@php.net> | 2014-10-03 16:43:08 -0400 |
---|---|---|
committer | George Wang <gwang@php.net> | 2014-10-03 16:43:08 -0400 |
commit | ef0eed7f5ff34236b39d9c5914e1627ef30c7cb7 (patch) | |
tree | aa1b356321816109d462cacbb0c7986e3abe3153 /ext/mysqlnd/mysqlnd_ps_codec.c | |
parent | 0cc2600ec64d882df7f44390bfd5411750f86947 (diff) | |
parent | d67c05bb899f4db42dd568376112b9144de2b5f1 (diff) | |
download | php-git-ef0eed7f5ff34236b39d9c5914e1627ef30c7cb7.tar.gz |
Merge branch 'PHP-5.5' of git.php.net:php-src into PHP-5.5
Diffstat (limited to 'ext/mysqlnd/mysqlnd_ps_codec.c')
-rw-r--r-- | ext/mysqlnd/mysqlnd_ps_codec.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ext/mysqlnd/mysqlnd_ps_codec.c b/ext/mysqlnd/mysqlnd_ps_codec.c index fa4ed9da6f..d96091210b 100644 --- a/ext/mysqlnd/mysqlnd_ps_codec.c +++ b/ext/mysqlnd/mysqlnd_ps_codec.c @@ -200,17 +200,27 @@ ps_fetch_float(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_l /* The following cast is guaranteed to do the right thing */ dval = (double) d32val; } +#elif defined(PHP_WIN32) + { + /* float datatype on Winows is already 4 byte but has a precision of 7 digits */ + char num_buf[2048]; + (void)_gcvt_s(num_buf, 2048, fval, field->decimals >= 31 ? 7 : field->decimals); + dval = zend_strtod(num_buf, NULL); + } #else { char num_buf[2048]; /* Over allocated */ char *s; +#ifndef FLT_DIG +# define FLT_DIG 6 +#endif /* Convert to string. Ignoring localization, etc. * Following MySQL's rules. If precision is undefined (NOT_FIXED_DEC i.e. 31) * or larger than 31, the value is limited to 6 (FLT_DIG). */ s = php_gcvt(fval, - field->decimals >= 31 ? 6 : field->decimals, + field->decimals >= 31 ? FLT_DIG : field->decimals, '.', 'e', num_buf); |