diff options
Diffstat (limited to 'lib/uniconv/u8-conv-from-enc.c')
| -rw-r--r-- | lib/uniconv/u8-conv-from-enc.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/lib/uniconv/u8-conv-from-enc.c b/lib/uniconv/u8-conv-from-enc.c index 424a949e..fa2bb59c 100644 --- a/lib/uniconv/u8-conv-from-enc.c +++ b/lib/uniconv/u8-conv-from-enc.c @@ -1,5 +1,5 @@ /* Conversion to UTF-8 from legacy encodings. - Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -39,7 +39,6 @@ u8_conv_from_encoding (const char *fromcode, if (STRCASEEQ (fromcode, "UTF-8", 'U','T','F','-','8',0,0,0,0)) { /* Conversion from UTF-8 to UTF-8. No need to go through iconv(). */ - uint8_t *result; if (u8_check ((const uint8_t *) src, srclen)) { @@ -48,23 +47,20 @@ u8_conv_from_encoding (const char *fromcode, } if (offsets != NULL) - { - size_t i; - - for (i = 0; i < srclen; ) - { - int count = u8_mblen ((const uint8_t *) src + i, srclen - i); - /* We can rely on count > 0 because of the previous u8_check. */ - if (count <= 0) - abort (); - offsets[i] = i; - i++; - while (--count > 0) - offsets[i++] = (size_t)(-1); - } - } + for (size_t i = 0; i < srclen; ) + { + int count = u8_mblen ((const uint8_t *) src + i, srclen - i); + /* We can rely on count > 0 because of the previous u8_check. */ + if (count <= 0) + abort (); + offsets[i] = i; + i++; + while (--count > 0) + offsets[i++] = (size_t)(-1); + } /* Memory allocation. */ + uint8_t *result; if (resultbuf != NULL && *lengthp >= srclen) result = resultbuf; else |
