about summary refs log tree commit diff
path: root/iconv
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-09-11 20:33:59 +0000
committerUlrich Drepper <drepper@redhat.com>2000-09-11 20:33:59 +0000
commitf6ad47269a0bcfb8d037d19579bd801efd7d926c (patch)
tree80d87ad6a4f4d48d0f03ea04bcaca5beebbb4912 /iconv
parentb81c896174dc98cb15cc80844751fb23cd9e02d1 (diff)
downloadglibc-f6ad47269a0bcfb8d037d19579bd801efd7d926c.tar.gz
glibc-f6ad47269a0bcfb8d037d19579bd801efd7d926c.tar.xz
glibc-f6ad47269a0bcfb8d037d19579bd801efd7d926c.zip
Update.
2000-09-10  Bruno Haible  <haible@clisp.cons.org>

	* locale/programs/ld-collate.c (collate_read): Fix typo in handling
	of decimal ellipsis.

2000-09-11  Bruno Haible <haible@clisp.cons.org>

	* locale/programs/ld-collate.c (collate_read): Always initialize
	error_section.next.

2000-09-10  Bruno Haible  <haible@clisp.cons.org>

	* locale/programs/ld-collate.c (collate_finish): Upper bound for
	ruleidx is 128, not 256.

2000-09-11  Ulrich Drepper  <drepper@redhat.com>

	* locale/programs/ld-collate.c (collate_read): Correct check for
	already inserted entries.

2000-09-10  Bruno Haible <haible@clisp.cons.org>

	* iconv/skeleton.c (FUNCTION_NAME): Handle unaligned access in
	second try as well.

2000-09-10  Bruno Haible <haible@clisp.cons.org>

	* iconv/skeleton.c (FUNCTION_NAME): Optimize an `if' if
	MAX_NEEDED_FROM > 1 && MAX_NEEDED_TO > 1.

2000-09-10  Bruno Haible <haible@clisp.cons.org>

	* iconv/skeleton.c (gconv_init): Replace all uses of RESET_STATE with
	SAVE_RESET_STATE.

2000-09-10  Bruno Haible  <haible@clisp.cons.org>

	* iconvdata/utf-7.c: New file.
	* iconvdata/gconv-modules (UTF-7): New module entries.
	* iconvdata/Makefile (modules): Add UTF-7.
	(distribute): Add utf-7.c.
	* iconvdata/testdata/UTF-7: New file.
	* iconvdata/testdata/UTF-7..UTF8: New file.
	* iconvdata/TESTS (UTF-7): New entry.
	* iconvdata/run-iconv-test.sh: Fix confusing output.
Diffstat (limited to 'iconv')
-rw-r--r--iconv/skeleton.c78
1 files changed, 53 insertions, 25 deletions
diff --git a/iconv/skeleton.c b/iconv/skeleton.c
index 76189b56a9..f459ed588f 100644
--- a/iconv/skeleton.c
+++ b/iconv/skeleton.c
@@ -57,7 +57,12 @@
 			from the current characters.
      TO_LOOP		likewise for the other direction
 
-     RESET_STATE	in case of an error we must reset the state for
+     ONE_DIRECTION	optional.  If defined to 1, only one conversion
+			direction is defined instead of two.  In this
+			case, FROM_DIRECTION should be defined to 1, and
+			FROM_LOOP and TO_LOOP should have the same value.
+
+     SAVE_RESET_STATE	in case of an error we must reset the state for
 			the rerun so this macro must be defined for
 			stateful encodings.  It takes an argument which
 			is nonzero when saving.
@@ -184,8 +189,8 @@ static int to_object;
 #endif
 
 
-/* For conversions from a fixed width character sets to another fixed width
-   character set we we can define RESET_INPUT_BUFFER is necessary.  */
+/* For conversions from a fixed width character set to another fixed width
+   character set we can define RESET_INPUT_BUFFER in a very fast way.  */
 #if !defined RESET_INPUT_BUFFER && !defined SAVE_RESET_STATE
 # if MIN_NEEDED_FROM == MAX_NEEDED_FROM && MIN_NEEDED_TO == MAX_NEEDED_TO
 /* We have to use these `if's here since the compiler cannot know that
@@ -233,7 +238,7 @@ gconv_init (struct __gconv_step *step)
   else
     return __GCONV_NOCONV;
 
-#ifdef RESET_STATE
+#ifdef SAVE_RESET_STATE
   step->__stateful = 1;
 #else
   step->__stateful = 0;
@@ -245,8 +250,8 @@ gconv_init (struct __gconv_step *step)
 
 
 /* The default destructor function does nothing in the moment and so
-   be define it at all.  But we still provide the macro just in case
-   we need it some day.  */
+   we don't define it at all.  But we still provide the macro just in
+   case we need it some day.  */
 #if DEFINE_FINI
 #endif
 
@@ -339,7 +344,8 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
       /* If the function is used to implement the mb*towc*() or wc*tomb*()
 	 functions we must test whether any bytes from the last call are
 	 stored in the `state' object.  */
-      if (((MAX_NEEDED_FROM > 1 && FROM_DIRECTION)
+      if (((MAX_NEEDED_FROM > 1 && MAX_NEEDED_TO > 1)
+	   || (MAX_NEEDED_FROM > 1 && FROM_DIRECTION)
 	   || (MAX_NEEDED_TO > 1 && !FROM_DIRECTION))
 	  && consume_incomplete && (data->__statep->__count & 7) != 0)
 	{
@@ -491,23 +497,44 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
 		      SAVE_RESET_STATE (0);
 # endif
 
-		      /* XXX Handle unaligned access here as well.  */
-		      if (FROM_DIRECTION)
-			/* Run the conversion loop.  */
-			nstatus = FROM_LOOP (step, data,
-					     (const unsigned char **) inptrp,
-					     (const unsigned char *) inend,
-					     (unsigned char **) &outbuf,
-					     (unsigned char *) outerr,
-					     lirreversiblep EXTRA_LOOP_ARGS);
+		      if (__builtin_expect (!unaligned, 1))
+			{
+			  if (FROM_DIRECTION)
+			    /* Run the conversion loop.  */
+			    nstatus = FROM_LOOP (step, data, inptrp, inend,
+						 &outbuf,
+						 (unsigned char *) outerr,
+						 lirreversiblep
+						 EXTRA_LOOP_ARGS);
+			  else
+			    /* Run the conversion loop.  */
+			    nstatus = TO_LOOP (step, data, inptrp, inend,
+					       &outbuf,
+					       (unsigned char *) outerr,
+					       lirreversiblep
+					       EXTRA_LOOP_ARGS);
+			}
+# if !defined _STRING_ARCH_unaligned \
+     && MIN_NEEDED_FROM != 1 && MAX_NEEDED_FROM % MIN_NEEDED_FROM == 0 \
+     && MIN_NEEDED_TO != 1 && MAX_NEEDED_TO % MIN_NEEDED_TO == 0
 		      else
-			/* Run the conversion loop.  */
-			nstatus = TO_LOOP (step, data,
-					   (const unsigned char **) inptrp,
-					   (const unsigned char *) inend,
-					   (unsigned char **) &outbuf,
-					   (unsigned char *) outerr,
-					   lirreversiblep EXTRA_LOOP_ARGS);
+			{
+			  if (FROM_DIRECTION)
+			    /* Run the conversion loop.  */
+			    nstatus = GEN_unaligned (FROM_LOOP) (step, data,
+								 inptrp, inend,
+								 (unsigned char *) outerr,
+								 lirreversiblep
+								 EXTRA_LOOP_ARGS);
+			  else
+			    /* Run the conversion loop.  */
+			    nstatus = GEN_unaligned (TO_LOOP) (step, data,
+							       inptrp, inend,
+							       (unsigned char *) outerr,
+							       lirreversiblep
+							       EXTRA_LOOP_ARGS);
+			}
+# endif
 
 		      /* We must run out of output buffer space in this
 			 rerun.  */
@@ -540,7 +567,8 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
       /* If we are supposed to consume all character store now all of the
 	 remaining characters in the `state' object.  */
 #if MAX_NEEDED_FROM > 1 || MAX_NEEDED_TO > 1
-      if (((MAX_NEEDED_FROM > 1 && FROM_DIRECTION)
+      if (((MAX_NEEDED_FROM > 1 && MAX_NEEDED_TO > 1)
+	   || (MAX_NEEDED_FROM > 1 && FROM_DIRECTION)
 	   || (MAX_NEEDED_TO > 1 && !FROM_DIRECTION))
 	  && __builtin_expect (consume_incomplete, 0)
 	  && status == __GCONV_INCOMPLETE_INPUT)
@@ -580,7 +608,7 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
 #undef EMIT_SHIFT_TO_INIT
 #undef FROM_LOOP
 #undef TO_LOOP
-#undef RESET_STATE
+#undef SAVE_RESET_STATE
 #undef RESET_INPUT_BUFFER
 #undef FUNCTION_NAME
 #undef PREPARE_LOOP