diff options
author | Andreas Rottmann <a.rottmann@gmx.at> | 2010-05-27 18:23:17 +0200 |
---|---|---|
committer | Andreas Rottmann <a.rottmann@gmx.at> | 2010-05-27 18:23:17 +0200 |
commit | bd6adfa17d453e4c486e36fed4c5779db90a8a0e (patch) | |
tree | 9798677560d5f99061afe9f0db105a8c97f2438a /lib/uniconv/u-conv-from-enc.h | |
parent | 79ca645d222db2e158784642c3b464a47bea26f3 (diff) | |
parent | 3e0814cd9862b89c7a39672672937477bd87ddfb (diff) |
Merge commit 'upstream/0.9.3'
Diffstat (limited to 'lib/uniconv/u-conv-from-enc.h')
-rw-r--r-- | lib/uniconv/u-conv-from-enc.h | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/lib/uniconv/u-conv-from-enc.h b/lib/uniconv/u-conv-from-enc.h index fa0f0d3d..457bd0f8 100644 --- a/lib/uniconv/u-conv-from-enc.h +++ b/lib/uniconv/u-conv-from-enc.h @@ -1,5 +1,5 @@ /* Conversion to UTF-16/UTF-32 from legacy encodings. - Copyright (C) 2002, 2006-2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -26,7 +26,7 @@ FUNC (const char *fromcode, size_t length = *lengthp * sizeof (UNIT); if (mem_iconveha (src, srclen, fromcode, UTF_NAME, true, handler, - offsets, &result, &length) < 0) + offsets, &result, &length) < 0) return NULL; if (offsets != NULL) { @@ -35,8 +35,8 @@ FUNC (const char *fromcode, size_t *o; for (o = offsets; o < offsets_end; o++) - if (*o != (size_t)(-1)) - *o = *o / sizeof (UNIT); + if (*o != (size_t)(-1)) + *o = *o / sizeof (UNIT); } if ((length % sizeof (UNIT)) != 0) abort (); @@ -49,7 +49,7 @@ FUNC (const char *fromcode, utf8_string = u8_conv_from_encoding (fromcode, handler, src, srclen, offsets, - NULL, &utf8_length); + NULL, &utf8_length); if (utf8_string == NULL) return NULL; result = U8_TO_U (utf8_string, utf8_length, resultbuf, lengthp); @@ -65,25 +65,25 @@ FUNC (const char *fromcode, size_t length = *lengthp; size_t *offsets_end = offsets + srclen; size_t *o; - size_t off8 = 0; /* offset into utf8_string */ - size_t offunit = 0; /* offset into result */ + size_t off8 = 0; /* offset into utf8_string */ + size_t offunit = 0; /* offset into result */ for (o = offsets; o < offsets_end; o++) - if (*o != (size_t)(-1)) - { - while (off8 < *o) - { - int count8 = u8_mblen (utf8_string + off8, utf8_length - off8); - int countunit = U_MBLEN (result + offunit, length - offunit); - if (count8 < 0 || countunit < 0) - abort (); - off8 += count8; - offunit += countunit; - } - if (*o != off8) - abort (); - *o = offunit; - } + if (*o != (size_t)(-1)) + { + while (off8 < *o) + { + int count8 = u8_mblen (utf8_string + off8, utf8_length - off8); + int countunit = U_MBLEN (result + offunit, length - offunit); + if (count8 < 0 || countunit < 0) + abort (); + off8 += count8; + offunit += countunit; + } + if (*o != off8) + abort (); + *o = offunit; + } } free (utf8_string); return result; |