diff options
| author | Jörg Frings-Fürst <debian@jff.email> | 2026-03-08 17:28:50 +0100 |
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff.email> | 2026-03-08 17:28:50 +0100 |
| commit | ff33e1d252f46bec1a33e28700da3282fc24047a (patch) | |
| tree | 5c15bc695be820b393a8496c5807ecafbbdeb89b /lib/uniconv/u8-conv-from-enc.c | |
| parent | b2ac982cc8b5290699eb5f52fb043d3d15e2624b (diff) | |
| parent | 5f59a34ab747dde8ede7357f3431bf06bd6002fe (diff) | |
Update upstream source from tag 'upstream/1.4.2'
Update to upstream version '1.4.2'
with Debian dir 493e96bcd865e4f9990e20bee26408c96231d727
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 e292e954..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-2025 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 |
