diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-10-13 11:10:04 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-10-21 09:12:10 +0000 |
commit | 944129e3022a28a5cb969c6adaf01378b4555375 (patch) | |
tree | 3a31ce94c3b26bb46341801d9b7a989a69139185 /src | |
parent | d570274da3ba262d85cf9a32de34678c85c1af9e (diff) | |
download | qtxmlpatterns-944129e3022a28a5cb969c6adaf01378b4555375.tar.gz |
Use simpler version of qdtoa()
This allows us to remove the original qdtoa() as qtxmlpatterns is the
last client outside qtbase.
Change-Id: Ic447898818c7cd1b117f0df87cc83f7b60a5d9c7
Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/xmlpatterns/data/qabstractfloat_p.h | 1 | ||||
-rw-r--r-- | src/xmlpatterns/data/qabstractfloat_tpl_p.h | 12 | ||||
-rw-r--r-- | src/xmlpatterns/data/qdecimal.cpp | 10 | ||||
-rw-r--r-- | src/xmlpatterns/data/qdecimal_p.h | 5 |
4 files changed, 5 insertions, 23 deletions
diff --git a/src/xmlpatterns/data/qabstractfloat_p.h b/src/xmlpatterns/data/qabstractfloat_p.h index cd8c467..ffd8c1b 100644 --- a/src/xmlpatterns/data/qabstractfloat_p.h +++ b/src/xmlpatterns/data/qabstractfloat_p.h @@ -53,6 +53,7 @@ #include <private/qschemanumeric_p.h> #include <private/qvalidationerror_p.h> #include <private/qbuiltintypes_p.h> +#include <private/qlocale_tools_p.h> QT_BEGIN_NAMESPACE diff --git a/src/xmlpatterns/data/qabstractfloat_tpl_p.h b/src/xmlpatterns/data/qabstractfloat_tpl_p.h index 48825e8..a6cc3b7 100644 --- a/src/xmlpatterns/data/qabstractfloat_tpl_p.h +++ b/src/xmlpatterns/data/qabstractfloat_tpl_p.h @@ -173,17 +173,7 @@ QString AbstractFloat<isDouble>::stringValue() const */ int sign; int decimalPoint; - char *result = 0; - static_cast<void>(qdtoa(m_value, -1, 0, &decimalPoint, &sign, 0, &result)); - - /* If the copy constructor is used instead of QString::operator=(), - * it doesn't compile. I have no idea why. */ - const QString qret(QString::fromLatin1(result)); - - /* We use free() instead of delete here, because qlocale.cpp use malloc(). Spotted - * by valgrind. */ - free(result); - + const QString qret = qdtoa(m_value, &decimalPoint, &sign); QString valueAsString; if(sign) diff --git a/src/xmlpatterns/data/qdecimal.cpp b/src/xmlpatterns/data/qdecimal.cpp index f47fe7e..2058fc0 100644 --- a/src/xmlpatterns/data/qdecimal.cpp +++ b/src/xmlpatterns/data/qdecimal.cpp @@ -33,6 +33,8 @@ #include <math.h> +#include <private/qlocale_tools_p.h> + #include "qabstractfloat_p.h" #include "qatomictype_p.h" #include "qbuiltintypes_p.h" @@ -105,13 +107,7 @@ QString Decimal::toString(const xsDecimal value) { int sign; int decimalPoint; - char *result = 0; - static_cast<void>(qdtoa(value, 0, 0, &decimalPoint, &sign, 0, &result)); - /* If the copy constructor is used instead of QString::operator=(), - * it doesn't compile. I have no idea why. */ - const QString qret(QString::fromLatin1(result)); - free(result); - + const QString qret = qdtoa(value, &decimalPoint, &sign); QString valueAsString; if(sign) diff --git a/src/xmlpatterns/data/qdecimal_p.h b/src/xmlpatterns/data/qdecimal_p.h index 93df8a9..bfaeea2 100644 --- a/src/xmlpatterns/data/qdecimal_p.h +++ b/src/xmlpatterns/data/qdecimal_p.h @@ -48,11 +48,6 @@ QT_BEGIN_NAMESPACE -/** - * Defined in QtCore's qlocale.cpp. - */ -Q_CORE_EXPORT char *qdtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve, char **resultp); - namespace QPatternist { |