summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-12-12 06:14:53 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-12-12 06:16:14 (GMT)
commit6a90f3e67610b5a32cc701730773574ad36ae99c (patch)
tree8025dba67bac7dff319561de7a8a4fa20324d3e4
parentc9ee0db8f8012eb523ef26de6b8a0b86181c2609 (diff)
Fixed sign extension when decoding UTF-8 data.
-rw-r--r--plugins/dexbnf/simple.c2
-rw-r--r--src/common/utf8.c2
-rw-r--r--src/common/utf8.h2
3 files changed, 3 insertions, 3 deletions
diff --git a/plugins/dexbnf/simple.c b/plugins/dexbnf/simple.c
index e66e83c..f06fc4d 100644
--- a/plugins/dexbnf/simple.c
+++ b/plugins/dexbnf/simple.c
@@ -132,7 +132,7 @@ static size_t dcd_simple_name_char(input_buffer *buffer)
text = get_input_buffer_text_access(buffer);
remaining = count_input_buffer_remaining(buffer);
- wc = decode_utf8_char(text, remaining, &result);
+ wc = decode_utf8_char((unsigned char *)text, remaining, &result);
if (IS_UTF8_ERROR(wc))
return 0;
diff --git a/src/common/utf8.c b/src/common/utf8.c
index 3c23a1b..c5cfa03 100644
--- a/src/common/utf8.c
+++ b/src/common/utf8.c
@@ -39,7 +39,7 @@
* *
******************************************************************************/
-unichar_t decode_utf8_char(const char *text, size_t len, size_t *consumed)
+unichar_t decode_utf8_char(const unsigned char *text, size_t len, size_t *consumed)
{
unichar_t result; /* Valeur à retourner */
size_t expected; /* Quantité à traiter */
diff --git a/src/common/utf8.h b/src/common/utf8.h
index 1bc6620..4b8437d 100644
--- a/src/common/utf8.h
+++ b/src/common/utf8.h
@@ -48,7 +48,7 @@ typedef uint32_t unichar_t;
/* Procède à la lecture d'un caractère dans une chaîne en UTF-8. */
-unichar_t decode_utf8_char(const char *, size_t, size_t *);
+unichar_t decode_utf8_char(const unsigned char *, size_t, size_t *);