*
* @stable ICU 3.8
*/
+#if LOG_UTEXT_SETNATIVEINDEX
+/* Add logging for <rdar://problem/44884660> */
#define UTEXT_SETNATIVEINDEX(ut, ix) \
{ int64_t __offset = (ix) - (ut)->chunkNativeStart; \
- if (__offset>=0 && __offset<(int64_t)(ut)->nativeIndexingLimit && (ut)->chunkContents[__offset]<0xdc00) { \
+ if ((ut)->chunkContents!=0 && __offset>=0 && __offset<(int64_t)(ut)->nativeIndexingLimit && (ut)->chunkContents[__offset]<0xdc00) { \
(ut)->chunkOffset=(int32_t)__offset; \
+ } else if ((ut)->chunkContents==0 && __offset>=0 && __offset<(int64_t)(ut)->nativeIndexingLimit) { \
+ os_log(OS_LOG_DEFAULT, "# UTEXT_SETNATIVEINDEX (ut) %p, (ut)->chunkContents 0, __offset %lld", (ut), __offset); \
} else { \
utext_setNativeIndex((ut), (ix)); } }
+#else
+#define UTEXT_SETNATIVEINDEX(ut, ix) \
+ { int64_t __offset = (ix) - (ut)->chunkNativeStart; \
+ if ((ut)->chunkContents!=0 && __offset>=0 && __offset<(int64_t)(ut)->nativeIndexingLimit && (ut)->chunkContents[__offset]<0xdc00) { \
+ (ut)->chunkOffset=(int32_t)__offset; \
+ } else { \
+ utext_setNativeIndex((ut), (ix)); } }
+#endif
U_STABLE UText * U_EXPORT2
utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status);
-#ifndef U_HIDE_INTERNAL_API
+// do not use #ifndef U_HIDE_INTERNAL_API around the following!
/**
* @internal
* Value used to help identify correctly initialized UText structs.
enum {
UTEXT_MAGIC = 0x345ad82c
};
-#endif /* U_HIDE_INTERNAL_API */
/**
* initializer to be used with local (stack) instances of a UText