+static inline int32_t
+appendUChar(uint8_t *dest, int32_t destIndex, int32_t destCapacity, UChar c) {
+ int32_t length=U8_LENGTH(c);
+ if(length>(INT32_MAX-destIndex)) {
+ return -1; // integer overflow
+ }
+ int32_t limit=destIndex+length;
+ if(limit<destCapacity) {
+ U8_APPEND_UNSAFE(dest, destIndex, c);
+ }
+ return limit;
+}
+