X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/374ca955a76ecab1204ca8bfa63ff9238d998416..refs/heads/master:/icuSources/samples/numfmt/util.cpp diff --git a/icuSources/samples/numfmt/util.cpp b/icuSources/samples/numfmt/util.cpp index b4025444..f6e405bd 100644 --- a/icuSources/samples/numfmt/util.cpp +++ b/icuSources/samples/numfmt/util.cpp @@ -1,14 +1,23 @@ /******************************************************************** + * © 2016 and later: Unicode, Inc. and others. + * License & terms of use: http://www.unicode.org/copyright.html#License + ************************************************************************* + ************************************************************************* * COPYRIGHT: - * Copyright (c) 1999-2003, International Business Machines Corporation and + * Copyright (c) 1999-2009, International Business Machines Corporation and * others. All Rights Reserved. - ********************************************************************/ + *************************************************************************/ + +#define __STDC_FORMAT_MACROS 1 +#include #include "unicode/unistr.h" #include "unicode/fmtable.h" #include #include +using namespace icu; + enum { U_SPACE=0x20, U_DQUOTE=0x22, @@ -72,7 +81,7 @@ void uprintf(const UnicodeString &str) { } printf("%s", buf); if(buf != stackBuffer) { - delete buf; + delete[] buf; } } @@ -89,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: