]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/samples/numfmt/util.cpp
ICU-66108.tar.gz
[apple/icu.git] / icuSources / samples / numfmt / util.cpp
index f5db0e1212339d14b6b294995ed4a1ef8fa62637..f6e405bdd7337465f4dbd944700489c6ddb216c5 100644 (file)
@@ -8,11 +8,16 @@
  * others. All Rights Reserved.
  *************************************************************************/
 
+#define __STDC_FORMAT_MACROS 1
+#include <inttypes.h>
+
 #include "unicode/unistr.h"
 #include "unicode/fmtable.h"
 #include <stdio.h>
 #include <stdlib.h>
 
+using namespace icu;
+
 enum {
     U_SPACE=0x20,
     U_DQUOTE=0x22,
@@ -93,10 +98,15 @@ UnicodeString formattableToString(const Formattable& f) {
             return UnicodeString(buf, "");
         }
     case Formattable::kLong:
+        {
+            char buf[256];
+            sprintf(buf, "%" PRId32 "L", f.getLong());
+            return UnicodeString(buf, "");
+        }
     case Formattable::kInt64:
         {
             char buf[256];
-            sprintf(buf, "%ldL", f.getLong());
+            sprintf(buf, "%" PRId64 "L", f.getInt64());
             return UnicodeString(buf, "");
         }
     case Formattable::kString: