about summary refs log tree commit diff
path: root/iconv
diff options
context:
space:
mode:
Diffstat (limited to 'iconv')
-rw-r--r--iconv/gconv.c6
-rw-r--r--iconv/gconv_simple.c6
2 files changed, 7 insertions, 5 deletions
diff --git a/iconv/gconv.c b/iconv/gconv.c
index 88d76056c8..7cb78694e0 100644
--- a/iconv/gconv.c
+++ b/iconv/gconv.c
@@ -1,6 +1,6 @@
 /* Convert characters in input buffer using conversion descriptor to
    output buffer.
-   Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -31,12 +31,14 @@ __gconv (__gconv_t cd, const unsigned char **inbuf,
 	 const unsigned char *inbufend, unsigned char **outbuf,
 	 unsigned char *outbufend, size_t *irreversible)
 {
-  size_t last_step = cd->__nsteps - 1;
+  size_t last_step;
   int result;
 
   if (cd == (__gconv_t) -1L)
     return __GCONV_ILLEGAL_DESCRIPTOR;
 
+  last_step = cd->__nsteps - 1;
+
   assert (irreversible != NULL);
   *irreversible = 0;
 
diff --git a/iconv/gconv_simple.c b/iconv/gconv_simple.c
index 8064bd9f8a..25914d9b5d 100644
--- a/iconv/gconv_simple.c
+++ b/iconv/gconv_simple.c
@@ -135,10 +135,10 @@ internal_ucs4_loop_unaligned (struct __gconv_step *step,
 # endif
 
   /* Determine the status.  */
-  if (*outptrp + 4 > outend)
-    result = __GCONV_FULL_OUTPUT;
-  else if (*inptrp == inend)
+  if (*inptrp == inend)
     result = __GCONV_EMPTY_INPUT;
+  else if (*outptrp + 4 > outend)
+    result = __GCONV_FULL_OUTPUT;
   else
     result = __GCONV_INCOMPLETE_INPUT;