X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Funistr%2Fu32-to-u16.c;h=1d0bb4d2e3c802521a6dda61a85c9fa9be36aea3;hb=ccd54782ae73477aa3f3987ab04db9e6fde025d6;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..1d0bb4d2e 100644 --- a/lib/unistr/u32-to-u16.c +++ b/lib/unistr/u32-to-u16.c @@ -1,5 +1,5 @@ /* 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 @@ -61,11 +61,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 +97,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 (); }