rename qfcvt() and qecvt() functions

apparently there are non-standard qfcvt() and qecvt() functions that
behave like fcvt() and ecvt() except that they take long double
argument

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-06-11 18:36:22 +03:00
parent 7bcae4aab7
commit 0bfcac7ed2
3 changed files with 7 additions and 7 deletions

View file

@ -1904,7 +1904,7 @@ QString QLocalePrivate::doubleToString(const QChar _zero, const QChar plus, cons
// NOT thread safe! // NOT thread safe!
if (form == DFDecimal) { if (form == DFDecimal) {
QSTACKARRAY(char, qfcvtbuf, QECVT_BUFFSIZE); QSTACKARRAY(char, qfcvtbuf, QECVT_BUFFSIZE);
digits = QString::fromLatin1(qfcvt(d, precision, &decpt, &sign, qfcvtbuf)); digits = QString::fromLatin1(qFcvt(d, precision, &decpt, &sign, qfcvtbuf));
} else { } else {
int pr = precision; int pr = precision;
if (form == DFExponent) if (form == DFExponent)
@ -1912,7 +1912,7 @@ QString QLocalePrivate::doubleToString(const QChar _zero, const QChar plus, cons
else if (form == DFSignificantDigits && pr == 0) else if (form == DFSignificantDigits && pr == 0)
pr = 1; pr = 1;
QSTACKARRAY(char, qecvtbuf, QECVT_BUFFSIZE); QSTACKARRAY(char, qecvtbuf, QECVT_BUFFSIZE);
digits = QString::fromLatin1(qecvt(d, pr, &decpt, &sign, qecvtbuf)); digits = QString::fromLatin1(qEcvt(d, pr, &decpt, &sign, qecvtbuf));
// Chop trailing zeros // Chop trailing zeros
if (digits.length() > 0) { if (digits.length() > 0) {

View file

@ -323,7 +323,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
// the code bellow is copy from musl libc, modified to not use static buffer // the code bellow is copy from musl libc, modified to not use static buffer
// and use snprintf() instead of sprintf() // and use snprintf() instead of sprintf()
char *qfcvt(double x, int n, int *dp, int *sign, char* buf) char *qFcvt(double x, int n, int *dp, int *sign, char* buf)
{ {
QSTACKARRAY(char, tmp, 1500); QSTACKARRAY(char, tmp, 1500);
int i, lz; int i, lz;
@ -341,10 +341,10 @@ char *qfcvt(double x, int n, int *dp, int *sign, char* buf)
return (char*)"000000000000000"+14-n; return (char*)"000000000000000"+14-n;
} }
return qecvt(x, n-lz, dp, sign, buf); return qEcvt(x, n-lz, dp, sign, buf);
} }
char *qecvt(double x, int n, int *dp, int *sign, char* buf) char *qEcvt(double x, int n, int *dp, int *sign, char* buf)
{ {
QSTACKARRAY(char, tmp, 32); QSTACKARRAY(char, tmp, 32);
int i, j; int i, j;

View file

@ -101,8 +101,8 @@ bool qt_u_strToUpper(const QString &str, QString *out, const QLocale &locale);
bool qt_u_strToLower(const QString &str, QString *out, const QLocale &locale); bool qt_u_strToLower(const QString &str, QString *out, const QLocale &locale);
#define QECVT_BUFFSIZE 17 #define QECVT_BUFFSIZE 17
char *qfcvt(double x, int n, int *dp, int *sign, char* buf); char *qFcvt(double x, int n, int *dp, int *sign, char* buf);
char *qecvt(double x, int n, int *dp, int *sign, char* buf); char *qEcvt(double x, int n, int *dp, int *sign, char* buf);
QT_END_NAMESPACE QT_END_NAMESPACE