ICU-12766 aix/escaper: tests now build on AIX

* fix to UNICODE_STRING_SIMPLE for char16_t aliasing

X-SVN-Rev: 39821
This commit is contained in:
Steven R. Loomis 2017-03-15 18:08:36 +00:00
parent f98c39a60f
commit 78b1977508
3 changed files with 11 additions and 11 deletions

View File

@ -291,9 +291,12 @@ typedef int8_t UBool;
#define U_SIZEOF_UCHAR 2
/**
* for AIX, uchar.h needs to be included
* \def U_CHAR16_IS_TYPEDEF
* If 1, then char16_t is a typedef and not a real type (yet)
* @internal
*/
#if (U_PLATFORM == U_PF_AIX) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11)
// for AIX, uchar.h needs to be included
# include <uchar.h>
# define U_CHAR16_IS_TYPEDEF 1
#else

View File

@ -119,7 +119,11 @@ class UnicodeStringAppendable; // unicode/appendable.h
* <code>NUL</code>, must be specified as a constant.
* @stable ICU 2.0
*/
#define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, u ## cs, _length)
#if !U_CHAR16_IS_TYPEDEF
# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, u ## cs, _length)
#else
# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, (const char16_t*)u ## cs, _length)
#endif
/**
* Unicode String literals in C++.
@ -3033,7 +3037,6 @@ public:
UnicodeString(ConstChar16Ptr(text)) {}
#endif
#if !U_NO_NULLPTR_T
/**
* nullptr_t constructor.
* Effectively the same as the default constructor, makes an empty string object.
@ -3045,7 +3048,6 @@ public:
* @draft ICU 59
*/
UNISTR_FROM_STRING_EXPLICIT inline UnicodeString(const std::nullptr_t text);
#endif
/**
* char16_t* constructor.
@ -3082,7 +3084,6 @@ public:
UnicodeString(ConstChar16Ptr(text), length) {}
#endif
#if !U_NO_NULLPTR_T
/**
* nullptr_t constructor.
* Effectively the same as the default constructor, makes an empty string object.
@ -3091,7 +3092,7 @@ public:
* @draft ICU 59
*/
inline UnicodeString(const std::nullptr_t text, int32_t length);
#endif
/**
* Readonly-aliasing char16_t* constructor.
* The text will be used for the UnicodeString object, but
@ -3165,7 +3166,6 @@ public:
UnicodeString(Char16Ptr(buffer), buffLength, buffCapacity) {}
#endif
#if !U_NO_NULLPTR_T
/**
* Writable-aliasing nullptr_t constructor.
* Effectively the same as the default constructor, makes an empty string object.
@ -3175,7 +3175,6 @@ public:
* @draft ICU 59
*/
inline UnicodeString(std::nullptr_t buffer, int32_t buffLength, int32_t buffCapacity);
#endif
#if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION
@ -3889,7 +3888,6 @@ UnicodeString::UnicodeString() {
fUnion.fStackFields.fLengthAndFlags=kShortString;
}
#if !U_NO_NULLPTR_T
inline UnicodeString::UnicodeString(const std::nullptr_t /*text*/) {
fUnion.fStackFields.fLengthAndFlags=kShortString;
}
@ -3901,7 +3899,6 @@ inline UnicodeString::UnicodeString(const std::nullptr_t /*text*/, int32_t /*len
inline UnicodeString::UnicodeString(std::nullptr_t /*buffer*/, int32_t /*buffLength*/, int32_t /*buffCapacity*/) {
fUnion.fStackFields.fLengthAndFlags=kShortString;
}
#endif
//========================================
// Read-only implementation methods

View File

@ -659,7 +659,7 @@ ConvertFile::convertFile(const char *pname,
parse.line = -1;
if (uprv_strchr(translit, ':') || uprv_strchr(translit, '>') || uprv_strchr(translit, '<') || uprv_strchr(translit, '>')) {
t = Transliterator::createFromRules(UnicodeString(u"Uconv"), str, UTRANS_FORWARD, parse, err);
t = Transliterator::createFromRules(UNICODE_STRING_SIMPLE("Uconv"), str, UTRANS_FORWARD, parse, err);
} else {
t = Transliterator::createInstance(UnicodeString(translit, -1, US_INV), UTRANS_FORWARD, err);
}