about summary refs log tree commit diff
path: root/iconv/gconv_simple.c
diff options
context:
space:
mode:
authorAndreas Jaeger <aj@suse.de>2004-02-07 15:56:44 +0000
committerAndreas Jaeger <aj@suse.de>2004-02-07 15:56:44 +0000
commitcdda3d7dea4a3772dbe61b74aa49f83d98082689 (patch)
tree682ebd3aed2469ab732d9ff5d60fe54af0e0bc9a /iconv/gconv_simple.c
parentacd262e611f704a7ae47101bec76c22d89a2401a (diff)
downloadglibc-cdda3d7dea4a3772dbe61b74aa49f83d98082689.tar.gz
glibc-cdda3d7dea4a3772dbe61b74aa49f83d98082689.tar.xz
glibc-cdda3d7dea4a3772dbe61b74aa49f83d98082689.zip
* iconv/gconv_simple.c (ucs4le_internal_loop): Remove cast used as
lvalue. 
(internal_ucs4le_loop_single): Likewise. 
(ucs4_internal_loop): Likewise. 
(BODY): Likewise. 
(internal_ucs4_loop_single): Likewise.
Diffstat (limited to 'iconv/gconv_simple.c')
-rw-r--r--iconv/gconv_simple.c47
1 files changed, 33 insertions, 14 deletions
diff --git a/iconv/gconv_simple.c b/iconv/gconv_simple.c
index 4bb7a911cd..b8cc017d96 100644
--- a/iconv/gconv_simple.c
+++ b/iconv/gconv_simple.c
@@ -1,5 +1,5 @@
 /* Simple transformations functions.
-   Copyright (C) 1997-2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997-2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -87,9 +87,11 @@ internal_ucs4_loop (struct __gconv_step *step,
 #if __BYTE_ORDER == __LITTLE_ENDIAN
   /* Sigh, we have to do some real work.  */
   size_t cnt;
+  uint32_t *outptr32 = (uint32_t *) outptr;
 
   for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4)
-    *((uint32_t *) outptr)++ = bswap_32 (*(const uint32_t *) inptr);
+    *outptr32++ = bswap_32 (*(const uint32_t *) inptr);
+  outptr = (unsigned char *) outptr32;
 
   *inptrp = inptr;
   *outptrp = outptr;
@@ -192,13 +194,16 @@ internal_ucs4_loop_single (struct __gconv_step *step,
   (*outptrp)[2] = state->__value.__wchb[1];
   (*outptrp)[3] = state->__value.__wchb[0];
 
-  *outptrp += 4;
 #elif __BYTE_ORDER == __BIG_ENDIAN
   /* XXX unaligned */
-  *(*((uint32_t **) outptrp)++) = state->__value.__wch;
+  (*outptrp)[0] = state->__value.__wchb[0];
+  (*outptrp)[1] = state->__value.__wchb[1];
+  (*outptrp)[2] = state->__value.__wchb[2];
+  (*outptrp)[3] = state->__value.__wchb[3];
 #else
 # error "This endianess is not supported."
 #endif
+  *outptrp += 4;
 
   /* Clear the state buffer.  */
   state->__count &= ~7;
@@ -268,7 +273,8 @@ ucs4_internal_loop (struct __gconv_step *step,
 	  return __GCONV_ILLEGAL_INPUT;
 	}
 
-      *((uint32_t *) outptr)++ = inval;
+      *((uint32_t *) outptr) = inval;
+      outptr += sizeof (uint32_t);
     }
 
   *inptrp = inptr;
@@ -558,8 +564,13 @@ internal_ucs4le_loop_single (struct __gconv_step *step,
   *outptrp += 4;
 #else
   /* XXX unaligned */
-  *(*((uint32_t **) outptrp)++) = state->__value.__wch;
+  (*outptrp)[0] = state->__value.__wchb[0];
+  (*outptrp)[1] = state->__value.__wchb[1];
+  (*outptrp)[2] = state->__value.__wchb[2];
+  (*outptrp)[3] = state->__value.__wchb[3];
+
 #endif
+  *outptrp += 4;
 
   /* Clear the state buffer.  */
   state->__count &= ~7;
@@ -626,7 +637,8 @@ ucs4le_internal_loop (struct __gconv_step *step,
 	  return __GCONV_ILLEGAL_INPUT;
 	}
 
-      *((uint32_t *) outptr)++ = inval;
+      *((uint32_t *) outptr) = inval;
+      outptr += sizeof (uint32_t);
     }
 
   *inptrp = inptr;
@@ -808,7 +820,8 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
       }									      \
     else								      \
       /* It's an one byte sequence.  */					      \
-      *((uint32_t *) outptr)++ = *inptr++;				      \
+      *((uint32_t *) outptr) = *inptr++;				      \
+      outptr += sizeof (uint32_t);					      \
   }
 #define LOOP_NEED_FLAGS
 #include <iconv/loop.c>
@@ -838,7 +851,8 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
       }									      \
     else								      \
       /* It's an one byte sequence.  */					      \
-      *outptr++ = *((const uint32_t *) inptr)++;			      \
+      *outptr++ = *((const uint32_t *) inptr);				      \
+      inptr += sizeof (uint32_t);					      \
   }
 #define LOOP_NEED_FLAGS
 #include <iconv/loop.c>
@@ -1032,7 +1046,8 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
       }									      \
 									      \
     /* Now adjust the pointers and store the result.  */		      \
-    *((uint32_t *) outptr)++ = ch;					      \
+    *((uint32_t *) outptr) = ch;					      \
+    outptr += sizeof (uint32_t);					      \
   }
 #define LOOP_NEED_FLAGS
 
@@ -1153,7 +1168,8 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
 	STANDARD_FROM_LOOP_ERR_HANDLER (2);				      \
       }									      \
 									      \
-    *((uint32_t *) outptr)++ = u1;					      \
+    *((uint32_t *) outptr) = u1;					      \
+    outptr += sizeof (uint32_t);					      \
     inptr += 2;								      \
   }
 #define LOOP_NEED_FLAGS
@@ -1201,7 +1217,8 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
       }									      \
     else								      \
       {									      \
-	*((uint16_t *) outptr)++ = val;					      \
+	*((uint16_t *) outptr) = val;					      \
+        outptr += sizeof (uint16_t);					      \
 	inptr += 4;							      \
       }									      \
   }
@@ -1242,7 +1259,8 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
 	continue;							      \
       }									      \
 									      \
-    *((uint32_t *) outptr)++ = u1;					      \
+    *((uint32_t *) outptr) = u1;					      \
+    outptr += sizeof (uint32_t);					      \
     inptr += 2;								      \
   }
 #define LOOP_NEED_FLAGS
@@ -1291,7 +1309,8 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
       }									      \
     else								      \
       {									      \
-	*((uint16_t *) outptr)++ = bswap_16 (val);			      \
+	*((uint16_t *) outptr) = bswap_16 (val);			      \
+	outptr += sizeof (uint16_t);					      \
 	inptr += 4;							      \
       }									      \
   }