X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/46f4442e9a5a4f3b98b7c1083586332f6a8a99a4..f59164e3d128c7675a4d3934206346a3384e53a5:/icuSources/io/uprntf_p.c diff --git a/icuSources/io/uprntf_p.c b/icuSources/io/uprntf_p.c index f303c0c8..fcb6ff80 100644 --- a/icuSources/io/uprntf_p.c +++ b/icuSources/io/uprntf_p.c @@ -1,7 +1,7 @@ /* ****************************************************************************** * -* Copyright (C) 1998-2008, International Business Machines +* Copyright (C) 1998-2016, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** @@ -19,10 +19,10 @@ #include "unicode/utypes.h" -#if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_CONVERSION #include "unicode/ustring.h" - +#include "unicode/utf16.h" #include "uprintf.h" #include "ufmt_cmn.h" #include "cmemory.h" @@ -143,7 +143,7 @@ u_printf_set_sign(UNumberFormat *format, symbolLen = unum_getSymbol(format, UNUM_PLUS_SIGN_SYMBOL, plusSymbol, - sizeof(plusSymbol)/sizeof(*plusSymbol), + UPRV_LENGTHOF(plusSymbol), status); unum_setTextAttribute(format, UNUM_POSITIVE_PREFIX, @@ -215,7 +215,7 @@ u_printf_string_handler(const u_printf_stream_handler *handler, } else { s = ufmt_defaultCPToUnicode(arg, argSize, buffer, - sizeof(buffer)/sizeof(UChar)); + UPRV_LENGTHOF(buffer)); } } else { @@ -246,12 +246,12 @@ u_printf_char_handler(const u_printf_stream_handler *handler, const u_printf_spec_info *info, const ufmt_args *args) { - UChar s[UTF_MAX_CHAR_LENGTH+1]; + UChar s[U16_MAX_LENGTH+1]; int32_t len = 1, written; unsigned char arg = (unsigned char)(args[0].int64Value); /* convert from default codepage to Unicode */ - ufmt_defaultCPToUnicode((const char *)&arg, 2, s, sizeof(s)/sizeof(UChar)); + ufmt_defaultCPToUnicode((const char *)&arg, 2, s, UPRV_LENGTHOF(s)); /* Remember that this may be an MBCS character */ if (arg != 0) { @@ -1508,6 +1508,7 @@ u_printf_parse(const u_printf_stream_handler *streamHandler, /* set the spec's width to the # of chars written */ info->fWidth = *written; /* fall through to set the pointer */ + U_FALLTHROUGH; case ufmt_string: case ufmt_ustring: case ufmt_pointer: @@ -1535,6 +1536,7 @@ u_printf_parse(const u_printf_stream_handler *streamHandler, /* set the spec's width to the # of chars written */ info->fWidth = *written; /* fall through to set the pointer */ + U_FALLTHROUGH; case ufmt_string: case ufmt_ustring: case ufmt_pointer: