@@ -237,28 +237,30 @@ static HashTable *umsg_parse_format(MessageFormatter_object *mfo,
237
237
UnicodeString typeString = mp.getSubstring (type_part);
238
238
/* This is all based on the rules in the docs for MessageFormat
239
239
* @see http://icu-project.org/apiref/icu4c/classMessageFormat.html */
240
- if (typeString == " number" ) {
240
+ #define ASCII_LITERAL (s ) UNICODE_STRING(s, sizeof (s)-1 )
241
+ if (typeString == ASCII_LITERAL (" number" )) {
241
242
MessagePattern::Part style_part = mp.getPart (i + 1 ); /* Not advancing i */
242
243
if (style_part.getType () == UMSGPAT_PART_TYPE_ARG_STYLE) {
243
244
UnicodeString styleString = mp.getSubstring (style_part);
244
- if (styleString == " integer" ) {
245
+ if (styleString == ASCII_LITERAL ( " integer" ) ) {
245
246
type = Formattable::kInt64 ;
246
- } else if (styleString == " currency" ) {
247
+ } else if (styleString == ASCII_LITERAL ( " currency" ) ) {
247
248
type = Formattable::kDouble ;
248
- } else if (styleString == " percent" ) {
249
+ } else if (styleString == ASCII_LITERAL ( " percent" ) ) {
249
250
type = Formattable::kDouble ;
250
251
} else { /* some style invalid/unknown to us */
251
252
type = Formattable::kDouble ;
252
253
}
253
254
} else { // if missing style, part, make it a double
254
255
type = Formattable::kDouble ;
255
256
}
256
- } else if ((typeString == " date" ) || (typeString == " time" )) {
257
+ } else if ((typeString == ASCII_LITERAL ( " date" )) || (typeString == ASCII_LITERAL ( " time" ) )) {
257
258
type = Formattable::kDate ;
258
- } else if ((typeString == " spellout" ) || (typeString == " ordinal" )
259
- || (typeString == " duration" )) {
259
+ } else if ((typeString == ASCII_LITERAL ( " spellout" )) || (typeString == ASCII_LITERAL ( " ordinal" ) )
260
+ || (typeString == ASCII_LITERAL ( " duration" ) )) {
260
261
type = Formattable::kDouble ;
261
262
}
263
+ #undef ASCII_LITERAL
262
264
} else {
263
265
/* If there's no UMSGPAT_PART_TYPE_ARG_TYPE right after a
264
266
* UMSGPAT_ARG_TYPE_SIMPLE argument, then the pattern
0 commit comments