aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/util.c8
-rw-r--r--src/util.h2
2 files changed, 4 insertions, 6 deletions
diff --git a/src/util.c b/src/util.c
index 0d6b715..2fdbeae 100644
--- a/src/util.c
+++ b/src/util.c
@@ -195,11 +195,10 @@ void msleep(unsigned ms)
/**
* Check whether a NUL-terminated string is encoded in UTF-8
*
- * @param string The string
- * @param allow_modified_nul Whether Modified UTF-8 is allowed, which allows a two-byte encoding for NUL
- * @return Zero if good, -1 on encoding error
+ * @param string The string
+ * @return Zero if good, -1 on encoding error
*/
-int verify_utf8(const char* restrict string, int allow_modified_nul)
+int verify_utf8(const char* restrict string)
{
static long BYTES_TO_MIN_BITS[] = {0, 0, 8, 12, 17, 22, 37};
static long BYTES_TO_MAX_BITS[] = {0, 7, 11, 16, 21, 26, 31};
@@ -256,7 +255,6 @@ int verify_utf8(const char* restrict string, int allow_modified_nul)
/* Check that the character is not unnecessarily long. */
while (character)
character >>= 1, bits++;
- bits = ((bits == 0) && (bytes == 2) && allow_modified_nul) ? 8 : bits;
if ((bits < BYTES_TO_MIN_BITS[bytes]) || (BYTES_TO_MAX_BITS[bytes] < bits))
return -1;
diff --git a/src/util.h b/src/util.h
index 915c44a..6eafcb4 100644
--- a/src/util.h
+++ b/src/util.h
@@ -99,7 +99,7 @@ void msleep(unsigned ms);
* @return Zero if good, -1 on encoding error
*/
GCC_ONLY(__attribute__((pure, nonnull)))
-int verify_utf8(const char* restrict string, int allow_modified_nul);
+int verify_utf8(const char* restrict string);
/**
* Make identity mapping ramps