From 8a8fc52eec3cdc757662fd10c46e8fa19110f4f0 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Mon, 14 Aug 2006 02:19:10 +0200 Subject: [PATCH] cp_to_unicode: Simplify and cleanup --- src/intl/charsets.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/intl/charsets.c b/src/intl/charsets.c index 1ece95029..fb8faba3e 100644 --- a/src/intl/charsets.c +++ b/src/intl/charsets.c @@ -525,17 +525,17 @@ cp2utf_8(int from, int c) unicode_val_T cp_to_unicode(int codepage, unsigned char **string, unsigned char *end) { + unicode_val_T ret; + if (is_cp_utf8(codepage)) return utf_8_to_unicode(string, end); - else { - if (*string >= end) - return UCS_NO_CHAR; - else { - unicode_val_T ret = cp2u(codepage, **string); - ++*string; - return ret; - } - } + + if (*string >= end) + return UCS_NO_CHAR; + + ret = cp2u(codepage, **string); + ++*string; + return ret; } #endif /* CONFIG_UTF_8 */