summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2015-01-28 11:09:09 +0100
committerErik Verbruggen <erik.verbruggen@theqtcompany.com>2015-01-28 12:44:55 +0000
commit467c2bc9c31514fa0f7de1dca768ad0c5bce12b5 (patch)
tree825f4f6f3ecd17133b732cbce0c8208e9983cf59 /src
parente1cdfc5529b0ca5ac5872a9c12ff3a4612d9b356 (diff)
Remove support for QT_QLOCALE_USES_FCVT.
We expect floating-point math to be IEEE754 compliant. Change-Id: I2b257177f2ef5fce38ac4d8fd76f746dc7b9fc15 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qlocale.cpp25
-rw-r--r--src/corelib/tools/qlocale_tools.cpp53
2 files changed, 0 insertions, 78 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index a923be50c0..78334563dd 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -2744,30 +2744,6 @@ QString QLocaleData::doubleToString(const QChar _zero, const QChar plus, const Q
int decpt, sign;
QString digits;
-#ifdef QT_QLOCALE_USES_FCVT
- // NOT thread safe!
- if (form == DFDecimal) {
- digits = QLatin1String(fcvt(d, precision, &decpt, &sign));
- } else {
- int pr = precision;
- if (form == DFExponent)
- ++pr;
- else if (form == DFSignificantDigits && pr == 0)
- pr = 1;
- digits = QLatin1String(ecvt(d, pr, &decpt, &sign));
-
- // Chop trailing zeros
- if (digits.length() > 0) {
- int last_nonzero_idx = digits.length() - 1;
- while (last_nonzero_idx > 0
- && digits.unicode()[last_nonzero_idx] == QLatin1Char('0'))
- --last_nonzero_idx;
- digits.truncate(last_nonzero_idx + 1);
- }
-
- }
-
-#else
int mode;
if (form == DFDecimal)
mode = 3;
@@ -2795,7 +2771,6 @@ QString QLocaleData::doubleToString(const QChar _zero, const QChar plus, const Q
}
if (buff != 0)
free(buff);
-#endif // QT_QLOCALE_USES_FCVT
if (_zero.unicode() != '0') {
ushort z = _zero.unicode() - '0';
diff --git a/src/corelib/tools/qlocale_tools.cpp b/src/corelib/tools/qlocale_tools.cpp
index 1b246a29de..fa4843361c 100644
--- a/src/corelib/tools/qlocale_tools.cpp
+++ b/src/corelib/tools/qlocale_tools.cpp
@@ -63,10 +63,8 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_QLOCALE_USES_FCVT
static char *_qdtoa( NEEDS_VOLATILE double d, int mode, int ndigits, int *decpt,
int *sign, char **rve, char **digits_str);
-#endif
QString qulltoa(qulonglong l, int base, const QChar _zero)
{
@@ -390,8 +388,6 @@ qlonglong qstrtoll(const char *nptr, const char **endptr, int base, bool *ok)
return acc;
}
-#ifndef QT_QLOCALE_USES_FCVT
-
/* From: NetBSD: strtod.c,v 1.26 1998/02/03 18:44:21 perry Exp */
/* $FreeBSD: src/lib/libc/stdlib/netbsd_strtod.c,v 1.2.2.2 2001/03/02 17:14:15 tegge Exp $ */
@@ -2780,54 +2776,5 @@ static char *_qdtoa( NEEDS_VOLATILE double d, int mode, int ndigits, int *decpt,
*rve = s;
return s0;
}
-#else
-// NOT thread safe!
-
-#include <errno.h>
-
-Q_CORE_EXPORT char *qdtoa( double d, int mode, int ndigits, int *decpt, int *sign, char **rve, char **resultp)
-{
- if(rve)
- *rve = 0;
-
- char *res;
- if (mode == 0)
- ndigits = 80;
-
- if (mode == 3)
- res = fcvt(d, ndigits, decpt, sign);
- else
- res = ecvt(d, ndigits, decpt, sign);
-
- int n = qstrlen(res);
- if (mode == 0) { // remove trailing 0's
- const int stop = qMax(1, *decpt);
- int i;
- for (i = n-1; i >= stop; --i) {
- if (res[i] != '0')
- break;
- }
- n = i + 1;
- }
- *resultp = static_cast<char*>(malloc(n + 1));
- Q_CHECK_PTR(resultp);
- qstrncpy(*resultp, res, n + 1);
- return *resultp;
-}
-
-Q_CORE_EXPORT double qstrtod(const char *s00, const char **se, bool *ok)
-{
- double ret = strtod((char*)s00, (char**)se);
- if (ok) {
- if((ret == 0.0l && errno == ERANGE)
- || ret == HUGE_VAL || ret == -HUGE_VAL)
- *ok = false;
- else
- *ok = true; // the result will be that we don't report underflow in this case
- }
- return ret;
-}
-
-#endif // QT_QLOCALE_USES_FCVT
QT_END_NAMESPACE