Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/sys/linux/iconv/gconv_simple.c')
-rw-r--r--newlib/libc/sys/linux/iconv/gconv_simple.c75
1 files changed, 24 insertions, 51 deletions
diff --git a/newlib/libc/sys/linux/iconv/gconv_simple.c b/newlib/libc/sys/linux/iconv/gconv_simple.c
index edc091f7c..a4a99ea81 100644
--- a/newlib/libc/sys/linux/iconv/gconv_simple.c
+++ b/newlib/libc/sys/linux/iconv/gconv_simple.c
@@ -75,10 +75,7 @@ internal_ucs4_loop (struct __gconv_step *step,
size_t cnt;
for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4)
- {
- *((uint32_t *) outptr) = bswap_32 (*(const uint32_t *) inptr);
- outptr = (unsigned char *)((uint32_t *) outptr + 1);
- }
+ *((uint32_t *) outptr)++ = bswap_32 (*(const uint32_t *) inptr);
*inptrp = inptr;
*outptrp = outptr;
@@ -183,13 +180,8 @@ internal_ucs4_loop_single (struct __gconv_step *step,
*outptrp += 4;
#elif __BYTE_ORDER == __BIG_ENDIAN
- {
- uint32_t **p = (uint32_t **)outptrp;
- uint32_t *q = *p;
- /* XXX unaligned */
- *q = state->__value.__wch;
- outptrp = (unsigned char *)(p + 1);
- }
+ /* XXX unaligned */
+ *(*((uint32_t **) outptrp)++) = state->__value.__wch;
#else
# error "This endianess is not supported."
#endif
@@ -252,7 +244,7 @@ ucs4_internal_loop (struct __gconv_step *step,
if (flags & __GCONV_IGNORE_ERRORS)
{
/* Just ignore this character. */
- *irreversible = *irreversible + 1;
+ ++*irreversible;
continue;
}
@@ -261,8 +253,7 @@ ucs4_internal_loop (struct __gconv_step *step,
return __GCONV_ILLEGAL_INPUT;
}
- *((uint32_t *) outptr) = inval;
- outptr = (unsigned char *) ((uint32_t *) outptr + 1);
+ *((uint32_t *) outptr)++ = inval;
}
*inptrp = inptr;
@@ -310,7 +301,7 @@ ucs4_internal_loop_unaligned (struct __gconv_step *step,
if (flags & __GCONV_IGNORE_ERRORS)
{
/* Just ignore this character. */
- *irreversible = *irreversible + 1;
+ ++*irreversible;
continue;
}
@@ -545,13 +536,8 @@ internal_ucs4le_loop_single (struct __gconv_step *step,
*outptrp += 4;
#else
- {
/* XXX unaligned */
- uint32_t **p = (uint32_t **)outptrp;
- uint32_t *q = *p;
- *q = state->__value.__wch;
- outptrp = (unsigned char **)(p + 1);
- }
+ *(*((uint32_t **) outptrp)++) = state->__value.__wch;
#endif
/* Clear the state buffer. */
@@ -618,8 +604,7 @@ ucs4le_internal_loop (struct __gconv_step *step,
return __GCONV_ILLEGAL_INPUT;
}
- *((uint32_t *) outptr) = inval;
- outptr = (unsigned char *)((uint32_t *) outptr + 1);
+ *((uint32_t *) outptr)++ = inval;
}
*inptrp = inptr;
@@ -796,16 +781,12 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
break; \
} \
\
- *irreversible = *irreversible + 1; \
+ ++*irreversible; \
++inptr; \
} \
else \
- { \
- /* It's an one byte sequence. */ \
- *((uint32_t *) outptr) = *inptr; \
- ++inptr; \
- outptr = (unsigned char *)((uint32_t *) outptr + 1); \
- } \
+ /* It's an one byte sequence. */ \
+ *((uint32_t *) outptr)++ = *inptr++; \
}
#define LOOP_NEED_FLAGS
#include <iconv/loop.c>
@@ -834,11 +815,8 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
STANDARD_ERR_HANDLER (4); \
} \
else \
- { \
- /* It's an one byte sequence. */ \
- *outptr++ = *((const uint32_t *) inptr); \
- inptr = ((const uint32_t *) inptr + 1); \
- } \
+ /* It's an one byte sequence. */ \
+ *outptr++ = *((const uint32_t *) inptr)++; \
}
#define LOOP_NEED_FLAGS
#include <iconv/loop.c>
@@ -1015,7 +993,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
{ \
/* Ignore it. */ \
inptr += i; \
- *irreversible = *irreversible + 1; \
+ ++*irreversible; \
continue; \
} \
\
@@ -1045,7 +1023,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
if (ignore_errors_p ()) \
{ \
inptr += i; \
- *irreversible = *irreversible + 1; \
+ ++*irreversible; \
continue; \
} \
\
@@ -1057,8 +1035,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
} \
\
/* Now adjust the pointers and store the result. */ \
- *((uint32_t *) outptr) = ch; \
- outptr = (unsigned char *)((uint32_t *) outptr + 1); \
+ *((uint32_t *) outptr)++ = ch; \
}
#define LOOP_NEED_FLAGS
@@ -1197,12 +1174,11 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
break; \
} \
inptr += 2; \
- *irreversible = *irreversible + 1; \
+ ++*irreversible; \
continue; \
} \
\
- *((uint32_t *) outptr) = u1; \
- outptr = (unsigned char *)((uint32_t *) outptr + 1); \
+ *((uint32_t *) outptr)++ = u1; \
inptr += 2; \
}
#define LOOP_NEED_FLAGS
@@ -1247,13 +1223,12 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
break; \
} \
inptr += 4; \
- *irreversible = *irreversible + 1; \
+ ++*irreversible; \
continue; \
} \
else \
{ \
- *((uint16_t *) outptr) = val; \
- outptr = (unsigned char *)((uint16_t *) outptr + 1); \
+ *((uint16_t *) outptr)++ = val; \
inptr += 4; \
} \
}
@@ -1290,12 +1265,11 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
break; \
} \
inptr += 2; \
- *irreversible = *irreversible + 1; \
+ ++*irreversible; \
continue; \
} \
\
- *((uint32_t *) outptr) = u1; \
- outptr = (unsigned char *)((uint32_t *) outptr + 1); \
+ *((uint32_t *) outptr)++ = u1; \
inptr += 2; \
}
#define LOOP_NEED_FLAGS
@@ -1339,13 +1313,12 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
break; \
} \
inptr += 4; \
- *irreversible = *irreversible + 1; \
+ ++*irreversible; \
continue; \
} \
else \
{ \
- *((uint16_t *) outptr) = bswap_16 (val); \
- outptr = (unsigned char *)((uint16_t *) outptr + 1); \
+ *((uint16_t *) outptr)++ = bswap_16 (val); \
inptr += 4; \
} \
}