From 635e76f560b3b3ca075aa2cb5d6d661601968e04 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Fri, 15 May 2015 10:55:30 -0600 Subject: [PATCH] utf8.h: Add assertions to macro --- utf8.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utf8.h b/utf8.h index 2e1aa02..271796b 100644 --- a/utf8.h +++ b/utf8.h @@ -356,8 +356,10 @@ encoded as UTF-8. C is a native (ASCII or EBCDIC) code point if less than * Note that the result can be larger than 255 if the input character is not * downgradable */ #define TWO_BYTE_UTF8_TO_NATIVE(HI, LO) \ + ( __ASSERT_(UTF8SKIP(HI) == 2) \ + __ASSERT_(UTF8_IS_CONTINUATION(LO)) \ UNI_TO_NATIVE(UTF8_ACCUMULATE((NATIVE_UTF8_TO_I8(HI) & UTF_START_MASK(2)), \ - (LO))) + (LO)))) /* Should never be used, and be deprecated */ #define TWO_BYTE_UTF8_TO_UNI(HI, LO) NATIVE_TO_UNI(TWO_BYTE_UTF8_TO_NATIVE(HI, LO)) -- 1.8.3.1