diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-09-20 12:38:17 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-09-20 12:38:17 +0200 |
commit | bc836c1a57a408431071cf4242158c3ff1c0fd10 (patch) | |
tree | 6e70fd85c2bcb775cae2db59c0604a3e1d49a62e /src/libmdsserver/util.h | |
parent | typo (diff) | |
download | mds-bc836c1a57a408431071cf4242158c3ff1c0fd10.tar.gz mds-bc836c1a57a408431071cf4242158c3ff1c0fd10.tar.bz2 mds-bc836c1a57a408431071cf4242158c3ff1c0fd10.tar.xz |
add verify_utf8
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/libmdsserver/util.h')
-rw-r--r-- | src/libmdsserver/util.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/libmdsserver/util.h b/src/libmdsserver/util.h index 23804bc..514b86d 100644 --- a/src/libmdsserver/util.h +++ b/src/libmdsserver/util.h @@ -124,7 +124,7 @@ int full_write(int fd, const char* buffer, size_t length); * * @param fd The file descriptor * @param length Output parameter for the length of the file, may be `NULL` - * @return The content of the file, you will need to free it. `NULL` on error. + * @return The content of the file, you will need to free it. `NULL` on error */ char* full_read(int fd, size_t* length); @@ -151,6 +151,15 @@ int startswith_n(const char* haystack, const char* needle, size_t haystack_n, si */ pid_t uninterruptable_waitpid(pid_t pid, int* restrict status, int options); +/** + * 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 + */ +int verify_utf8(const char* string, int allow_modified_nul) __attribute__((pure)); + #endif |