Add "qt_" prefix to asciiToDouble and doubleToAscii functions

Change-Id: Ie01831ddac5446fdbdeefffd154688839acbe838
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Thiago Macieira 2018-07-31 11:47:01 -07:00
parent 6c8160b0dc
commit 95c0b24cd8
4 changed files with 16 additions and 16 deletions

View File

@ -4142,8 +4142,8 @@ double QByteArray::toDouble(bool *ok) const
QByteArray nulled = nulTerminated(); QByteArray nulled = nulTerminated();
bool nonNullOk = false; bool nonNullOk = false;
int processed = 0; int processed = 0;
double d = asciiToDouble(nulled.constData(), nulled.length(), double d = qt_asciiToDouble(nulled.constData(), nulled.length(),
nonNullOk, processed, WhitespacesAllowed); nonNullOk, processed, WhitespacesAllowed);
if (ok) if (ok)
*ok = nonNullOk; *ok = nonNullOk;
return d; return d;

View File

@ -3077,7 +3077,7 @@ QString QLocaleData::doubleToString(const QChar _zero, const QChar plus, const Q
QVarLengthArray<char> buf(bufSize); QVarLengthArray<char> buf(bufSize);
int length; int length;
doubleToAscii(d, form, precision, buf.data(), bufSize, negative, length, decpt); qt_doubleToAscii(d, form, precision, buf.data(), bufSize, negative, length, decpt);
if (qstrncmp(buf.data(), "inf", 3) == 0 || qstrncmp(buf.data(), "nan", 3) == 0) { if (qstrncmp(buf.data(), "inf", 3) == 0 || qstrncmp(buf.data(), "nan", 3) == 0) {
num_str = QString::fromLatin1(buf.data(), length); num_str = QString::fromLatin1(buf.data(), length);
@ -3587,7 +3587,7 @@ double QLocaleData::stringToDouble(QStringView str, bool *ok,
} }
int processed = 0; int processed = 0;
bool nonNullOk = false; bool nonNullOk = false;
double d = asciiToDouble(buff.constData(), buff.length() - 1, nonNullOk, processed); double d = qt_asciiToDouble(buff.constData(), buff.length() - 1, nonNullOk, processed);
if (ok != nullptr) if (ok != nullptr)
*ok = nonNullOk; *ok = nonNullOk;
return d; return d;
@ -3625,7 +3625,7 @@ double QLocaleData::bytearrayToDouble(const char *num, bool *ok)
int len = static_cast<int>(strlen(num)); int len = static_cast<int>(strlen(num));
Q_ASSERT(len >= 0); Q_ASSERT(len >= 0);
int processed = 0; int processed = 0;
double d = asciiToDouble(num, len, nonNullOk, processed); double d = qt_asciiToDouble(num, len, nonNullOk, processed);
if (ok != nullptr) if (ok != nullptr)
*ok = nonNullOk; *ok = nonNullOk;
return d; return d;

View File

@ -75,8 +75,8 @@ QT_BEGIN_NAMESPACE
QT_CLOCALE_HOLDER QT_CLOCALE_HOLDER
void doubleToAscii(double d, QLocaleData::DoubleForm form, int precision, char *buf, int bufSize, void qt_doubleToAscii(double d, QLocaleData::DoubleForm form, int precision, char *buf, int bufSize,
bool &sign, int &length, int &decpt) bool &sign, int &length, int &decpt)
{ {
if (bufSize == 0) { if (bufSize == 0) {
decpt = 0; decpt = 0;
@ -277,8 +277,8 @@ void doubleToAscii(double d, QLocaleData::DoubleForm form, int precision, char *
--length; --length;
} }
double asciiToDouble(const char *num, int numLen, bool &ok, int &processed, double qt_asciiToDouble(const char *num, int numLen, bool &ok, int &processed,
StrayCharacterMode strayCharMode) StrayCharacterMode strayCharMode)
{ {
if (*num == '\0') { if (*num == '\0') {
ok = false; ok = false;
@ -548,7 +548,7 @@ double qstrntod(const char *s00, int len, const char **se, bool *ok)
{ {
int processed = 0; int processed = 0;
bool nonNullOk = false; bool nonNullOk = false;
double d = asciiToDouble(s00, len, nonNullOk, processed, TrailingJunkAllowed); double d = qt_asciiToDouble(s00, len, nonNullOk, processed, TrailingJunkAllowed);
if (se) if (se)
*se = s00 + processed; *se = s00 + processed;
if (ok) if (ok)
@ -564,8 +564,8 @@ QString qdtoa(qreal d, int *decpt, int *sign)
// Some versions of libdouble-conversion like an extra digit, probably for '\0' // Some versions of libdouble-conversion like an extra digit, probably for '\0'
char result[QLocaleData::DoubleMaxSignificant + 1]; char result[QLocaleData::DoubleMaxSignificant + 1];
doubleToAscii(d, QLocaleData::DFSignificantDigits, QLocale::FloatingPointShortest, result, qt_doubleToAscii(d, QLocaleData::DFSignificantDigits, QLocale::FloatingPointShortest, result,
QLocaleData::DoubleMaxSignificant + 1, nonNullSign, length, nonNullDecpt); QLocaleData::DoubleMaxSignificant + 1, nonNullSign, length, nonNullDecpt);
if (sign) if (sign)
*sign = nonNullSign ? 1 : 0; *sign = nonNullSign ? 1 : 0;

View File

@ -78,10 +78,10 @@ enum StrayCharacterMode {
WhitespacesAllowed WhitespacesAllowed
}; };
double asciiToDouble(const char *num, int numLen, bool &ok, int &processed, double qt_asciiToDouble(const char *num, int numLen, bool &ok, int &processed,
StrayCharacterMode strayCharMode = TrailingJunkProhibited); StrayCharacterMode strayCharMode = TrailingJunkProhibited);
void doubleToAscii(double d, QLocaleData::DoubleForm form, int precision, char *buf, int bufSize, void qt_doubleToAscii(double d, QLocaleData::DoubleForm form, int precision, char *buf, int bufSize,
bool &sign, int &length, int &decpt); bool &sign, int &length, int &decpt);
QString qulltoa(qulonglong l, int base, const QChar _zero); QString qulltoa(qulonglong l, int base, const QChar _zero);
Q_CORE_EXPORT QString qdtoa(qreal d, int *decpt, int *sign); Q_CORE_EXPORT QString qdtoa(qreal d, int *decpt, int *sign);