/*
*******************************************************************************
*
-* Copyright (C) 1999-2013, International Business Machines
+* Copyright (C) 1999-2014, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
* @internal
*/
#define U8_COUNT_TRAIL_BYTES(leadByte) \
- ((leadByte)<0xf0 ? \
- ((leadByte)>=0xc0)+((leadByte)>=0xe0) : \
- (leadByte)<0xfe ? 3+((leadByte)>=0xf8)+((leadByte)>=0xfc) : 0)
+ ((uint8_t)(leadByte)<0xf0 ? \
+ ((uint8_t)(leadByte)>=0xc0)+((uint8_t)(leadByte)>=0xe0) : \
+ (uint8_t)(leadByte)<0xfe ? 3+((uint8_t)(leadByte)>=0xf8)+((uint8_t)(leadByte)>=0xfc) : 0)
/**
* Counts the trail bytes for a UTF-8 lead byte of a valid UTF-8 sequence.
U8_NEXT(s, _u8_get_index, length, c); \
}
-#ifndef U_HIDE_DRAFT_API
/**
* Get a code point from a string at a random-access offset,
* without changing the offset.
* @param length int32_t string length
* @param c output UChar32 variable, set to U+FFFD in case of an error
* @see U8_GET
- * @draft ICU 51
+ * @stable ICU 51
*/
#define U8_GET_OR_FFFD(s, start, i, length, c) { \
int32_t _u8_get_index=(i); \
U8_SET_CP_START(s, start, _u8_get_index); \
U8_NEXT_OR_FFFD(s, _u8_get_index, length, c); \
}
-#endif /* U_HIDE_DRAFT_API */
/* definitions with forward iteration --------------------------------------- */
} \
}
-#ifndef U_HIDE_DRAFT_API
/**
* Get a code point from a string at a code point boundary offset,
* and advance the offset to the next code point boundary.
* @param length int32_t string length
* @param c output UChar32 variable, set to U+FFFD in case of an error
* @see U8_NEXT
- * @draft ICU 51
+ * @stable ICU 51
*/
#define U8_NEXT_OR_FFFD(s, i, length, c) { \
(c)=(uint8_t)(s)[(i)++]; \
} \
} \
}
-#endif /* U_HIDE_DRAFT_API */
/**
* Append a code point to a string, overwriting 1 to 4 bytes.
} \
}
-#ifndef U_HIDE_DRAFT_API
/**
* Move the string offset from one code point boundary to the previous one
* and get the code point between them.
* @param i int32_t string offset, must be start<i
* @param c output UChar32 variable, set to U+FFFD in case of an error
* @see U8_PREV
- * @draft ICU 51
+ * @stable ICU 51
*/
#define U8_PREV_OR_FFFD(s, start, i, c) { \
(c)=(uint8_t)(s)[--(i)]; \
(c)=utf8_prevCharSafeBody((const uint8_t *)s, start, &(i), c, -3); \
} \
}
-#endif /* U_HIDE_DRAFT_API */
/**
* Move the string offset from one code point boundary to the previous one.