[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
striconveh: small fix
From: |
Bruno Haible |
Subject: |
striconveh: small fix |
Date: |
Wed, 28 Mar 2007 23:50:05 +0200 |
User-agent: |
KMail/1.5.4 |
This is probably not visible as a bug, but a small cleanup, preparing for more
changes.
2007-03-28 Bruno Haible <address@hidden>
* lib/striconveh.c (mem_cd_iconveh_internal): Use u8_mbtoucr instead
of u8_mbtouc in order to distinguish invalid and incomplete UTF-8
input.
* modules/striconveh (Depends-on): Add unistr/u8-mbtoucr. Replace
utf8-ucs4 with unistr/u8-mbtouc. Replace ucs4-utf8 with
unistr/u8-uctomb.
*** lib/striconveh.c 24 Mar 2007 14:11:25 -0000 1.12
--- lib/striconveh.c 28 Mar 2007 21:37:53 -0000
***************
*** 479,494 ****
int n;
int m;
! n = u8_mbtouc (&uc, (const uint8_t *) in1ptr, in1size);
! if (uc == 0xfffd
! && !(n >= 3
! && (uint8_t)in1ptr[0] == 0xEF
! && (uint8_t)in1ptr[1] == 0xBF
! && (uint8_t)in1ptr[2] == 0xBD))
{
in1ptr += n;
in1size -= n;
- errno = EILSEQ;
res1 = (size_t)(-1);
incremented1 = true;
break;
--- 484,496 ----
int n;
int m;
! n = u8_mbtoucr (&uc, (const uint8_t *) in1ptr, in1size);
! if (n < 0)
{
+ errno = (n == -2 ? EINVAL : EILSEQ);
+ n = u8_mbtouc (&uc, (const uint8_t *) in1ptr, in1size);
in1ptr += n;
in1size -= n;
res1 = (size_t)(-1);
incremented1 = true;
break;
*** modules/striconveh 28 Jan 2007 01:49:17 -0000 1.4
--- modules/striconveh 28 Mar 2007 21:41:46 -0000
***************
*** 8,17 ****
Depends-on:
stdbool
iconv
- utf8-ucs4
- ucs4-utf8
unistr/u8-prev
unistr/u8-mbtouc-unsafe
strdup
c-strcase
c-strcaseeq
--- 8,18 ----
Depends-on:
stdbool
iconv
unistr/u8-prev
unistr/u8-mbtouc-unsafe
+ unistr/u8-mbtouc
+ unistr/u8-mbtoucr
+ unistr/u8-uctomb
strdup
c-strcase
c-strcaseeq
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- striconveh: small fix,
Bruno Haible <=