X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Funistr%2Fu16-to-u8.c;h=38b27ec0e3e356c39afd574011268ccd08567298;hb=9a261f6811c5c700c952d8e08022e31c75305342;hp=c88db796072ba0855dd9d9c05de747fb5cfe05e5;hpb=3e1e3ce5a71da21d00938e7b8dff924825ecece0;p=gnulib.git diff --git a/lib/unistr/u16-to-u8.c b/lib/unistr/u16-to-u8.c index c88db7960..38b27ec0e 100644 --- a/lib/unistr/u16-to-u8.c +++ b/lib/unistr/u16-to-u8.c @@ -1,21 +1,19 @@ /* Convert UTF-16 string to UTF-8 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 @@ -60,7 +58,7 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp) int count; /* Fetch a Unicode character from the input string. */ - count = u16_mbtouc_safe (&uc, s, s_end - s); + count = u16_mbtouc (&uc, s, s_end - s); if (count < 0) { if (!(result == resultbuf || result == NULL)) @@ -71,7 +69,7 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp) s += count; /* Store it in the output string. */ - count = u8_uctomb (result, uc, allocated - length); + count = u8_uctomb (result + length, uc, allocated - length); if (count == -1) { if (!(result == resultbuf || result == NULL)) @@ -103,7 +101,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 = u8_uctomb (result, uc, allocated - length); + count = u8_uctomb (result + length, uc, allocated - length); if (count < 0) abort (); }