diff options
Diffstat (limited to 'src/corelib/tools/qlocale_tools.cpp')
-rw-r--r-- | src/corelib/tools/qlocale_tools.cpp | 67 |
1 files changed, 7 insertions, 60 deletions
diff --git a/src/corelib/tools/qlocale_tools.cpp b/src/corelib/tools/qlocale_tools.cpp index 1b246a29de..56ac8fb58d 100644 --- a/src/corelib/tools/qlocale_tools.cpp +++ b/src/corelib/tools/qlocale_tools.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -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 |