]> granicus.if.org Git - icu/commitdiff
ICU-11439 Improve portability of DecimalFormat::getFixedDecimal().
authorAndy Heninger <andy.heninger@gmail.com>
Fri, 19 Dec 2014 00:22:05 +0000 (00:22 +0000)
committerAndy Heninger <andy.heninger@gmail.com>
Fri, 19 Dec 2014 00:22:05 +0000 (00:22 +0000)
X-SVN-Rev: 36894

icu4c/source/test/intltest/numfmtst.cpp

index 8c898187d9d90408a0b6f6b814bb7ddbf0c859d3..b7d26c39ded2b6a8f4946bba00f9be444fb9f85d 100644 (file)
@@ -29,6 +29,7 @@
 #include <float.h>
 #include <string.h>
 #include <stdlib.h>
+#include <inttypes.h>
 #include "cstring.h"
 #include "unicode/numsys.h"
 #include "fmtableimp.h"
@@ -7752,22 +7753,22 @@ void NumberFormatTest::TestCurrencyUsage() {
 void NumberFormatTest::TestDoubleLimit11439() {
     char  buf[50];
     for (int64_t num = MAX_INT64_IN_DOUBLE-10; num<=MAX_INT64_IN_DOUBLE; num++) {
-        sprintf(buf, "%ld", num);
+        sprintf(buf, "%" PRId64, num);
         double fNum = 0.0;
         sscanf(buf, "%lf", &fNum);
         int64_t rtNum = fNum;
         if (num != rtNum) {
-            errln("%s:%d MAX_INT64_IN_DOUBLE test, %ld did not round trip. Got %ld", __FILE__, __LINE__, num, rtNum);
+            errln("%s:%d MAX_INT64_IN_DOUBLE test, %" PRId64 " did not round trip. Got %" PRId64 , __FILE__, __LINE__, num, rtNum);
             return;
         }
     }
     for (int64_t num = -MAX_INT64_IN_DOUBLE+10; num>=-MAX_INT64_IN_DOUBLE; num--) {
-        sprintf(buf, "%ld", num);
+        sprintf(buf, "%" PRId64, num);
         double fNum = 0.0;
         sscanf(buf, "%lf", &fNum);
         int64_t rtNum = fNum;
         if (num != rtNum) {
-            errln("%s:%d MAX_INT64_IN_DOUBLE test, %ld did not round trip. Got %ld", __FILE__, __LINE__, num, rtNum);
+            errln("%s:%d MAX_INT64_IN_DOUBLE test, %" PRId64 "did not round trip. Got %" PRId64 , __FILE__, __LINE__, num, rtNum);
             return;
         }
     }