chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
kerne-command-line: introduce option 'systemd.restore_state'
[elogind.git]
/
src
/
shared
/
utf8.c
diff --git
a/src/shared/utf8.c
b/src/shared/utf8.c
index c3d97cc783f06e2805a4a2394a162e87a3b8b0e1..98b68ef657c076e53f108df96e43aa8762fea79e 100644
(file)
--- a/
src/shared/utf8.c
+++ b/
src/shared/utf8.c
@@
-3,6
+3,7
@@
/***
This file is part of systemd.
/***
This file is part of systemd.
+ Copyright 2008-2011 Kay Sievers
Copyright 2012 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
Copyright 2012 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
@@
-19,7
+20,7
@@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-/*
This file is
based on the GLIB utf8 validation functions. The
+/*
Parts of this file are
based on the GLIB utf8 validation functions. The
* original license text follows. */
/* gutf8.c - Operations on UTF-8 strings.
* original license text follows. */
/* gutf8.c - Operations on UTF-8 strings.
@@
-97,7
+98,7
@@
static int utf8_encoded_expected_len(const char *str) {
}
/* decode one unicode char */
}
/* decode one unicode char */
-
static
int utf8_encoded_to_unichar(const char *str) {
+int utf8_encoded_to_unichar(const char *str) {
int unichar;
int len;
int i;
int unichar;
int len;
int i;
@@
-140,14
+141,15
@@
bool utf8_is_printable(const char* str, size_t length) {
assert(str);
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);
int encoded_len = utf8_encoded_valid_unichar((const char *)p);
- int
32_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;
if (encoded_len < 0 || val < 0 || is_unicode_control(val))
return false;
length -= encoded_len;
+ p += encoded_len;
}
return true;
}
return true;