mirror of git://sourceware.org/git/glibc.git
(__gconv_transform_utf8_internal): Use only one copy of error handling code.
This commit is contained in:
parent
a86573f471
commit
347bace2f2
|
@ -902,13 +902,12 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
|
||||||
start = outptr; \
|
start = outptr; \
|
||||||
*outptr = (unsigned char) (~0xff >> step); \
|
*outptr = (unsigned char) (~0xff >> step); \
|
||||||
outptr += step; \
|
outptr += step; \
|
||||||
--step; \
|
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
start[step] = 0x80 | (wc & 0x3f); \
|
start[--step] = 0x80 | (wc & 0x3f); \
|
||||||
wc >>= 6; \
|
wc >>= 6; \
|
||||||
} \
|
} \
|
||||||
while (--step > 0); \
|
while (step > 1); \
|
||||||
start[0] |= wc; \
|
start[0] |= wc; \
|
||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
|
@ -990,18 +989,17 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
|
||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
int skipped; \
|
|
||||||
\
|
|
||||||
/* Search the end of this ill-formed UTF-8 character. This \
|
/* Search the end of this ill-formed UTF-8 character. This \
|
||||||
is the next byte with (x & 0xc0) != 0x80. */ \
|
is the next byte with (x & 0xc0) != 0x80. */ \
|
||||||
skipped = 0; \
|
i = 0; \
|
||||||
do \
|
do \
|
||||||
++skipped; \
|
++i; \
|
||||||
while (inptr + skipped < inend \
|
while (inptr + i < inend \
|
||||||
&& (*(inptr + skipped) & 0xc0) == 0x80 \
|
&& (*(inptr + i) & 0xc0) == 0x80 \
|
||||||
&& skipped < 5); \
|
&& i < 5); \
|
||||||
\
|
\
|
||||||
STANDARD_FROM_LOOP_ERR_HANDLER (skipped); \
|
errout: \
|
||||||
|
STANDARD_FROM_LOOP_ERR_HANDLER (i); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
if (__builtin_expect (inptr + cnt > inend, 0)) \
|
if (__builtin_expect (inptr + cnt > inend, 0)) \
|
||||||
|
@ -1018,7 +1016,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
STANDARD_FROM_LOOP_ERR_HANDLER (i); \
|
goto errout; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
/* Read the possible remaining bytes. */ \
|
/* Read the possible remaining bytes. */ \
|
||||||
|
@ -1040,7 +1038,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
|
||||||
if (i < cnt || (cnt > 2 && (ch >> (5 * cnt - 4)) == 0)) \
|
if (i < cnt || (cnt > 2 && (ch >> (5 * cnt - 4)) == 0)) \
|
||||||
{ \
|
{ \
|
||||||
/* This is an illegal encoding. */ \
|
/* This is an illegal encoding. */ \
|
||||||
STANDARD_FROM_LOOP_ERR_HANDLER (i); \
|
goto errout; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
inptr += cnt; \
|
inptr += cnt; \
|
||||||
|
|
Loading…
Reference in New Issue