From 6a90f3e67610b5a32cc701730773574ad36ae99c Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Wed, 12 Dec 2018 07:14:53 +0100 Subject: Fixed sign extension when decoding UTF-8 data. --- plugins/dexbnf/simple.c | 2 +- src/common/utf8.c | 2 +- src/common/utf8.h | 2 +- 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 *); -- cgit v0.11.2-87-g4458