X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Funistr%2Fu16-to-u8.c;h=fa1b861dff404511184dba76747b2f95213ac781;hb=ccd54782ae73477aa3f3987ab04db9e6fde025d6;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..fa1b861df 100644 --- a/lib/unistr/u16-to-u8.c +++ b/lib/unistr/u16-to-u8.c @@ -1,5 +1,5 @@ /* 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 @@ -60,7 +60,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 +71,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 +103,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 (); }