aboutsummaryrefslogtreecommitdiff
path: root/iconv/loop.c
diff options
context:
space:
mode:
Diffstat (limited to 'iconv/loop.c')
-rw-r--r--iconv/loop.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/iconv/loop.c b/iconv/loop.c
index 2fb73da7ea..deb0173930 100644
--- a/iconv/loop.c
+++ b/iconv/loop.c
@@ -282,6 +282,14 @@ FCTNAME (LOOPFCT) (struct __gconv_step *step,
/* `if' cases for MIN_NEEDED_OUTPUT ==/!= 1 is made to help the
compiler generating better code. They will be optimized away
since MIN_NEEDED_OUTPUT is always a constant. */
+ if (MIN_NEEDED_INPUT > 1
+ && __builtin_expect (inptr + MIN_NEEDED_INPUT > inend, 0))
+ {
+ /* We don't have enough input for another complete input
+ character. */
+ result = __GCONV_INCOMPLETE_INPUT;
+ break;
+ }
if ((MIN_NEEDED_OUTPUT != 1
&& __builtin_expect (outptr + MIN_NEEDED_OUTPUT > outend, 0))
|| (MIN_NEEDED_OUTPUT == 1
@@ -291,14 +299,6 @@ FCTNAME (LOOPFCT) (struct __gconv_step *step,
result = __GCONV_FULL_OUTPUT;
break;
}
- if (MIN_NEEDED_INPUT > 1
- && __builtin_expect (inptr + MIN_NEEDED_INPUT > inend, 0))
- {
- /* We don't have enough input for another complete input
- character. */
- result = __GCONV_INCOMPLETE_INPUT;
- break;
- }
/* Here comes the body the user provides. It can stop with
RESULT set to GCONV_INCOMPLETE_INPUT (if the size of the