diff --git a/htp/htp_utf8_decoder.c b/htp/htp_utf8_decoder.c index 412e2909..6017a187 100644 --- a/htp/htp_utf8_decoder.c +++ b/htp/htp_utf8_decoder.c @@ -96,26 +96,6 @@ static const uint8_t utf8d_allow_overlong[] = { 1,3,1,1,1,1,1,3,1,3,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // s7..s8 }; -/** - * Process one byte of UTF-8 data and return a code point if one is available. - * - * @param[in] state - * @param[in] codep - * @param[in] byte - * @return HTP_UTF8_ACCEPT for a valid character, HTP_UTF8_REJECT for an invalid character, - * or something else if the character has not yet been formed - */ -uint32_t htp_utf8_decode(uint32_t* state, uint32_t* codep, uint32_t byte) { - uint32_t type = utf8d[byte]; - - *codep = (*state != HTP_UTF8_ACCEPT) ? - (byte & 0x3fu) | (*codep << 6) : - (0xff >> type) & (byte); - - *state = utf8d[256 + *state*16 + type]; - return *state; -} - /** * Process one byte of UTF-8 data and return a code point if one is available. Allows * overlong characters in input. diff --git a/htp/htp_utf8_decoder.h b/htp/htp_utf8_decoder.h index b90b9267..b39abdd0 100644 --- a/htp/htp_utf8_decoder.h +++ b/htp/htp_utf8_decoder.h @@ -76,7 +76,6 @@ extern "C" { #define HTP_UTF8_ACCEPT 0 #define HTP_UTF8_REJECT 1 -uint32_t htp_utf8_decode(uint32_t* state, uint32_t* codep, uint32_t byte); uint32_t htp_utf8_decode_allow_overlong(uint32_t* state, uint32_t* codep, uint32_t byte); #ifdef __cplusplus diff --git a/test/test_utils.cpp b/test/test_utils.cpp index 2aed63f2..acc1c607 100644 --- a/test/test_utils.cpp +++ b/test/test_utils.cpp @@ -43,17 +43,6 @@ #include #include -TEST(Utf8, SingleByte) { - uint32_t state = HTP_UTF8_ACCEPT; - uint32_t codep; - uint32_t result; - - result = htp_utf8_decode(&state, &codep, 0x00); - EXPECT_EQ(0, result); - EXPECT_EQ(HTP_UTF8_ACCEPT, state); - EXPECT_EQ(0, codep); -} - TEST(Base64, Single) { EXPECT_EQ(62, htp_base64_decode_single('+')); EXPECT_EQ(63, htp_base64_decode_single('/'));