X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/51004dcb01e06fef634b61be77ed73dd61cb6db9..0f5d89e82340278ed3d7d50029f37cab2c41a57e:/icuSources/i18n/umsg.cpp diff --git a/icuSources/i18n/umsg.cpp b/icuSources/i18n/umsg.cpp index 8143932e..31eeacbe 100644 --- a/icuSources/i18n/umsg.cpp +++ b/icuSources/i18n/umsg.cpp @@ -1,3 +1,5 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* * @@ -6,7 +8,7 @@ * ******************************************************************************* * file name: umsg.cpp -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -319,7 +321,7 @@ umsg_applyPattern(UMessageFormat *fmt, if(status ==NULL||U_FAILURE(*status)){ return ; } - if(fmt==NULL||pattern==NULL||patternLength<-1){ + if(fmt==NULL || (pattern==NULL && patternLength!=0) || patternLength<-1) { *status=U_ILLEGAL_ARGUMENT_ERROR; return ; } @@ -327,10 +329,8 @@ umsg_applyPattern(UMessageFormat *fmt, if(parseError==NULL){ parseError = &tErr; } - if(patternLength<-1){ - patternLength=u_strlen(pattern); - } + // UnicodeString(pattern, -1) calls u_strlen(). ((MessageFormat*)fmt)->applyPattern(UnicodeString(pattern,patternLength),*parseError,*status); } @@ -469,7 +469,7 @@ umsg_vformat( const UMessageFormat *fmt, } } UnicodeString resultStr; - FieldPosition fieldPosition(0); + FieldPosition fieldPosition(FieldPosition::DONT_CARE); /* format the message */ ((const MessageFormat*)fmt)->format(args,count,resultStr,fieldPosition,*status);