diff options
Diffstat (limited to 'src/lib/string.c')
| -rw-r--r-- | src/lib/string.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/string.c b/src/lib/string.c index 123e81b..ecac9d7 100644 --- a/src/lib/string.c +++ b/src/lib/string.c @@ -1,7 +1,7 @@ #include "aplwc_internal.h" struct string * -chars_to_string(struct aplwc *aplwc, const char *chars) +chars_to_string(struct aplwc *aplwc, const char *chars, int len) { const uint8_t *utf8; size_t bytecount, charcount; @@ -12,7 +12,7 @@ chars_to_string(struct aplwc *aplwc, const char *chars) utf8 = (const uint8_t *)chars; seqlen = extra = 0; - for(bytecount = 0, charcount = 0; utf8[bytecount]; bytecount++){ + for(bytecount = 0, charcount = 0; ((bytecount < (unsigned int)len) || (len == -1)) && utf8[bytecount]; bytecount++){ b = utf8[bytecount]; if(extra == 0){ c = 0; |