about summary refs log tree commit diff
path: root/iconvdata/utf-16.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-04-12 20:26:40 +0000
committerUlrich Drepper <drepper@redhat.com>2001-04-12 20:26:40 +0000
commitb721a2c03c079f8939fae82823b6f75ef5b6639b (patch)
treecf46fabfc0a8aabeeb23a13c2eeb4b862fda99d0 /iconvdata/utf-16.c
parent9dd7309ceee055ed98039f29982dc773bfc63bef (diff)
downloadglibc-b721a2c03c079f8939fae82823b6f75ef5b6639b.tar.gz
glibc-b721a2c03c079f8939fae82823b6f75ef5b6639b.tar.xz
glibc-b721a2c03c079f8939fae82823b6f75ef5b6639b.zip
Update.
2001-04-12  Bruno Haible  <haible@clisp.cons.org>

	* iconvdata/TESTS2: New file.
	* iconvdata/run-iconv-test.sh: Also run tests from TESTS2.
	* iconvdata/testdata/alfabeta..UTF-8: New file.
	* iconvdata/testdata/alfabeta..UTF-16.BE: New file.
	* iconvdata/testdata/alfabeta..UTF-16.LE: New file.
	* iconvdata/testdata/alfabeta..UTF-32.BE: New file.
	* iconvdata/testdata/alfabeta..UTF-32.LE: New file.

2001-04-11  Bruno Haible  <haible@clisp.cons.org>

	* iconvdata/utf-32.c: New file.
	* iconvdata/gconv-modules: Add entries for UTF-32, UTF-32LE, UTF-32BE.
	* iconvdata/Makefile (modules): Add UTF-32.
	(distribute): Add utf-32.c.

2001-04-11  Bruno Haible  <haible@clisp.cons.org>

	* iconvdata/utf-16.c (PREPARE_LOOP): Initialize 'swap' after possibly
	changing it in the state. After incrementing 'inptr', store it back.
	* iconvdata/unicode.c (PREPARE_LOOP): After incrementing 'inptr',
	store it back.

2001-04-11  Bruno Haible  <haible@clisp.cons.org>

	* iconvdata/utf-16.c (gconv_init): Use MAX_NEEDED_FROM, not
	MIN_NEEDED_FROM.
Diffstat (limited to 'iconvdata/utf-16.c')
-rw-r--r--iconvdata/utf-16.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/iconvdata/utf-16.c b/iconvdata/utf-16.c
index c40e29685a..6001b36cb7 100644
--- a/iconvdata/utf-16.c
+++ b/iconvdata/utf-16.c
@@ -1,5 +1,5 @@
 /* Conversion module for UTF-16.
-   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
@@ -44,7 +44,7 @@
 #define PREPARE_LOOP \
   enum direction dir = ((struct utf16_data *) step->__data)->dir;	      \
   enum variant var = ((struct utf16_data *) step->__data)->var;		      \
-  int swap = ((struct utf16_data *) step->__data)->swap;		      \
+  int swap;								      \
   if (FROM_DIRECTION && var == UTF_16)					      \
     {									      \
       if (data->__invocation_counter == 0)				      \
@@ -55,11 +55,11 @@
 									      \
 	  if (get16u (inptr) == BOM)					      \
 	    /* Simply ignore the BOM character.  */			      \
-	    inptr += 2;							      \
+	    *inptrp = inptr += 2;					      \
 	  else if (get16u (inptr) == BOM_OE)				      \
 	    {								      \
 	      ((struct utf16_data *) step->__data)->swap = 1;		      \
-	      inptr += 2;						      \
+	      *inptrp = inptr += 2;					      \
 	    }								      \
 	}								      \
     }									      \
@@ -72,7 +72,8 @@
 									      \
       put16u (outbuf, BOM);						      \
       outbuf += 2;							      \
-    }
+    }									      \
+  swap = ((struct utf16_data *) step->__data)->swap;
 #define EXTRA_LOOP_ARGS		, var, swap
 
 
@@ -159,7 +160,7 @@ gconv_init (struct __gconv_step *step)
 	  if (dir == from_utf16)
 	    {
 	      step->__min_needed_from = MIN_NEEDED_FROM;
-	      step->__max_needed_from = MIN_NEEDED_FROM;
+	      step->__max_needed_from = MAX_NEEDED_FROM;
 	      step->__min_needed_to = MIN_NEEDED_TO;
 	      step->__max_needed_to = MIN_NEEDED_TO;
 	    }
@@ -168,7 +169,7 @@ gconv_init (struct __gconv_step *step)
 	      step->__min_needed_from = MIN_NEEDED_TO;
 	      step->__max_needed_from = MIN_NEEDED_TO;
 	      step->__min_needed_to = MIN_NEEDED_FROM;
-	      step->__max_needed_to = MIN_NEEDED_FROM;
+	      step->__max_needed_to = MAX_NEEDED_FROM;
 	    }
 
 	  step->__stateful = 0;