X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/51004dcb01e06fef634b61be77ed73dd61cb6db9..38fbf2fd31f5cd99b500914d6037b1d06b608645:/icuSources/extra/uconv/uwmsg.c diff --git a/icuSources/extra/uconv/uwmsg.c b/icuSources/extra/uconv/uwmsg.c index 67c12885..d5b0f627 100644 --- a/icuSources/extra/uconv/uwmsg.c +++ b/icuSources/extra/uconv/uwmsg.c @@ -1,6 +1,8 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** -* Copyright (C) 1998-2012, International Business Machines Corporation +* Copyright (C) 1998-2016, International Business Machines Corporation * and others. All Rights Reserved. ********************************************************************** * @@ -19,6 +21,7 @@ #include "unicode/uwmsg.h" #include "unicode/ures.h" #include "unicode/putil.h" +#include "cmemory.h" #include "cstring.h" #include @@ -26,8 +29,6 @@ #include #include -#define LENGTHOF(array) (sizeof(array)/sizeof((array)[0])) - #define BUF_SIZE 128 /* Print a ustring to the specified FILE* in the default codepage */ @@ -127,7 +128,7 @@ U_CFUNC int u_wmsg(FILE *fp, const char *tag, ... ) va_list ap; #endif UChar result[4096]; - int32_t resultLength = LENGTHOF(result); + int32_t resultLength = UPRV_LENGTHOF(result); if(gBundle == NULL) { @@ -145,8 +146,8 @@ U_CFUNC int u_wmsg(FILE *fp, const char *tag, ... ) } #if UCONFIG_NO_FORMATTING - resultLength = sizeof(gNoFormatting) / U_SIZEOF_UCHAR; - if((msgLen + resultLength) <= LENGTHOF(result)) { + resultLength = UPRV_LENGTHOF(gNoFormatting); + if((msgLen + resultLength) <= UPRV_LENGTHOF(result)) { memcpy(result, msg, msgLen * U_SIZEOF_UCHAR); memcpy(result + msgLen, gNoFormatting, resultLength); resultLength += msgLen;