This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[patch:] iconv/gconv_simple.c: Correct buffer in/out empty/full test order.


Before I noticed and defined _STRING_ARCH_unaligned (not documented it
seems) in the CRIS port, this code caused tst-iconv1 to fail during
execution.  When comparing the corresponding piece of code in the
neighboring functions, it seems like the order is wrong.

2001-04-08  Hans-Peter Nilsson  <hp@axis.com>

	* iconv/gconv_simple.c (internal_ucs4_loop_unaligned): Check for
	empty input before checking full output.

Index: gconv_simple.c
===================================================================
RCS file: /cvs/glibc/libc/iconv/gconv_simple.c,v
retrieving revision 1.47
diff -p -c -r1.47 gconv_simple.c
*** gconv_simple.c	2001/01/05 08:09:02	1.47
--- gconv_simple.c	2001/04/08 21:40:09
*************** internal_ucs4_loop_unaligned (struct __g
*** 135,144 ****
  # endif
  
    /* Determine the status.  */
!   if (*outptrp + 4 > outend)
!     result = __GCONV_FULL_OUTPUT;
!   else if (*inptrp == inend)
      result = __GCONV_EMPTY_INPUT;
    else
      result = __GCONV_INCOMPLETE_INPUT;
  
--- 135,144 ----
  # endif
  
    /* Determine the status.  */
!   if (*inptrp == inend)
      result = __GCONV_EMPTY_INPUT;
+   else if (*outptrp + 4 > outend)
+     result = __GCONV_FULL_OUTPUT;
    else
      result = __GCONV_INCOMPLETE_INPUT;
  
brgds, H-P


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]