summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-10-05 22:47:52 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-10-05 22:59:43 -0400
commita7176505e0083a073d03760f7b5435017a47c7c8 (patch)
tree7a1f7ba89dfcb041540e012206bcd097d10f6603 /src/shared
parentfc676b00a7545743429e0c9b12a0f0707b1059aa (diff)
utf8: fix utf8_is_printable
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/utf8.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/shared/utf8.c b/src/shared/utf8.c
index a8e28accd3..31120af046 100644
--- a/src/shared/utf8.c
+++ b/src/shared/utf8.c
@@ -141,14 +141,15 @@ bool utf8_is_printable(const char* str, size_t length) {
assert(str);
- for (p = (const uint8_t*) str; length; p++) {
+ for (p = (const uint8_t*) str; length;) {
int encoded_len = utf8_encoded_valid_unichar((const char *)p);
- int32_t val = utf8_encoded_to_unichar((const char*)p);
+ int val = utf8_encoded_to_unichar((const char*)p);
if (encoded_len < 0 || val < 0 || is_unicode_control(val))
return false;
length -= encoded_len;
+ p += encoded_len;
}
return true;