about summary refs log tree commit diff
path: root/iconv/gconv_simple.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-04-29 07:48:04 +0000
committerUlrich Drepper <drepper@redhat.com>1998-04-29 07:48:04 +0000
commitfdf19bf72dd4e6b7c48048f2f93938f484599c5d (patch)
tree8ca2667e7562cadc12088da8edc27b6ca47f804e /iconv/gconv_simple.c
parent8be1539f4da9e8df496d49e4b6f4650465ae3d36 (diff)
downloadglibc-fdf19bf72dd4e6b7c48048f2f93938f484599c5d.tar.gz
glibc-fdf19bf72dd4e6b7c48048f2f93938f484599c5d.tar.xz
glibc-fdf19bf72dd4e6b7c48048f2f93938f484599c5d.zip
Update.
1998-04-29  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* iconv/gconv_simple.c: Fix endian bug.  Don't put side effects in
	argument of bswap_XX macro.

1998-04-28  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* iconvdata/Makefile (EBCDIC-DK-NO-A-routines): Fix typo in
	variable name.
Diffstat (limited to 'iconv/gconv_simple.c')
-rw-r--r--iconv/gconv_simple.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/iconv/gconv_simple.c b/iconv/gconv_simple.c
index c491c97ccd..c71c5ed0a4 100644
--- a/iconv/gconv_simple.c
+++ b/iconv/gconv_simple.c
@@ -107,8 +107,8 @@ internal_ucs4_loop (const unsigned char **inptrp, const unsigned char *inend,
   /* Sigh, we have to do some real work.  */
   size_t cnt;
 
-  for (cnt = 0; cnt < n_convert; ++cnt)
-    *((uint32_t *) outptr)++ = bswap_32 (*((uint32_t *) inptr)++);
+  for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4)
+    *((uint32_t *) outptr)++ = bswap_32 (*(uint32_t *) inptr);
 
   *inptrp = inptr;
   *outptrp = outptr;
@@ -370,7 +370,8 @@ internal_ucs4_loop (const unsigned char **inptrp, const unsigned char *inend,
 #define LOOPFCT			FROM_LOOP
 #if __BYTE_ORDER == __LITTLE_ENDIAN
 # define BODY \
-  *((uint32_t *) outptr)++ = bswap_16 (*((uint16_t *) inptr)++);
+  *((uint32_t *) outptr)++ = bswap_16 (*(uint16_t *) inptr);		      \
+  inptr += 2;
 #else
 # define BODY \
   *((uint32_t *) outptr)++ = *((uint16_t *) inptr)++;
@@ -438,7 +439,8 @@ internal_ucs4_loop (const unsigned char **inptrp, const unsigned char *inend,
   *((uint32_t *) outptr)++ = *((uint16_t *) inptr)++;
 #else
 # define BODY \
-  *((uint32_t *) outptr)++ = bswap_16 (*((uint16_t *) inptr)++);
+  *((uint32_t *) outptr)++ = bswap_16 (*(uint16_t *) inptr);		      \
+  inptr += 2;
 #endif
 #include <iconv/loop.c>
 #include <iconv/skeleton.c>
@@ -475,9 +477,7 @@ internal_ucs4_loop (const unsigned char **inptrp, const unsigned char *inend,
 	result = GCONV_ILLEGAL_INPUT;					      \
 	break;								      \
       }									      \
-    /* Please note that we use the `uint32_t' from-pointer as an `uint16_t'   \
-       pointer which works since we are on a little endian machine.  */	      \
-    *((uint16_t *) outptr)++ = bswap_16 (*((uint16_t *) inptr));	      \
+    *((uint16_t *) outptr)++ = bswap_16 (((uint16_t *) inptr)[1]);	      \
     inptr += 4;								      \
   }
 #endif