X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Funistr%2Fu32-to-u16.c;h=3a32162cfa14fa25e2d9a7a44f0eb268bca49a5d;hb=3d986f521cac261e29c043be50bb626f7641d841;hp=fe2a96aabd872938cf6f697ef123ceeef1fa4bb9;hpb=6b71498544661a4c86ea78b4fbfccd1987fa1fbc;p=gnulib.git diff --git a/lib/unistr/u32-to-u16.c b/lib/unistr/u32-to-u16.c index fe2a96aab..3a32162cf 100644 --- a/lib/unistr/u32-to-u16.c +++ b/lib/unistr/u32-to-u16.c @@ -1,21 +1,19 @@ /* Convert UTF-32 string to UTF-16 string. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. Written by Bruno Haible , 2002. - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. + 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 + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #include @@ -61,11 +59,11 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp) /* Fetch a Unicode character from the input string. */ uc = *s++; - /* No need to call the safe variant u32_mbtouc_safe, because + /* No need to call the safe variant u32_mbtouc, because u16_uctomb will verify uc anyway. */ /* Store it in the output string. */ - count = u16_uctomb (result, uc, allocated - length); + count = u16_uctomb (result + length, uc, allocated - length); if (count == -1) { if (!(result == resultbuf || result == NULL)) @@ -97,7 +95,7 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp) memcpy ((char *) memory, (char *) result, length * sizeof (DST_UNIT)); result = memory; - count = u16_uctomb (result, uc, allocated - length); + count = u16_uctomb (result + length, uc, allocated - length); if (count < 0) abort (); }