return __GCONV_ILLEGAL_INPUT;
}
- *((uint32_t *) outptr)++ = bswap_32 (*(uint32_t *) inptr);
+ *((uint32_t *) outptr)++ = inval;
}
*inptrp = inptr;
outptr[2] = inptr[2];
outptr[3] = inptr[3];
# endif
-
-# if __BYTE_ORDER == __LITTLE_ENDIAN
- outptr[3] = inptr[0];
- outptr[2] = inptr[1];
- outptr[1] = inptr[2];
- outptr[0] = inptr[3];
-# else
- outptr[0] = inptr[0];
- outptr[1] = inptr[1];
- outptr[2] = inptr[2];
- outptr[3] = inptr[3];
-# endif
}
*inptrp = inptr;
{
/* The value is too large. */
if (!(flags & __GCONV_IGNORE_ERRORS))
- return __GCONV_ILLEGAL_INPUT;
+ {
+ *inptrp -= cnt - (state->__count & 7);
+ return __GCONV_ILLEGAL_INPUT;
+ }
}
else
{
/* Sigh, we have to do some real work. */
size_t cnt;
- for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4)
+ for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4, outptr += 4)
{
outptr[0] = inptr[3];
outptr[1] = inptr[2];
return __GCONV_ILLEGAL_INPUT;
}
- *((uint32_t *) outptr)++ = bswap_32 (*(uint32_t *) inptr);
+ *((uint32_t *) outptr)++ = inval;
}
*inptrp = inptr;
#define LOOPFCT FROM_LOOP
#define BODY \
{ \
+ /* XXX unaligned. */ \
if (__builtin_expect (*((uint32_t *) inptr), 0) > 0x7f) \
{ \
if (! ignore_errors_p ()) \
} \
else \
/* It's an one byte sequence. */ \
- /* XXX unaligned. */ \
*outptr++ = *((uint32_t *) inptr)++; \
}
#include <iconv/loop.c>
cnt = 2; \
ch &= 0x1f; \
} \
- else if (__builtin_expect (ch & 0xf0, 0xf0) == 0xe0) \
+ else if (__builtin_expect (ch & 0xf0, 0xe0) == 0xe0) \
{ \
/* We expect three bytes. */ \
cnt = 3; \
ch &= 0x0f; \
} \
- else if (__builtin_expect (ch & 0xf8, 0xf8) == 0xf0) \
+ else if (__builtin_expect (ch & 0xf8, 0xf0) == 0xf0) \
{ \
/* We expect four bytes. */ \
cnt = 4; \
cnt = 3; \
ch &= 0x0f; \
} \
- else if (__builtin_expect (ch & 0xf8, 0xf8) == 0xf0) \
+ else if (__builtin_expect (ch & 0xf8, 0xf0) == 0xf0) \
{ \
/* We expect four bytes. */ \
cnt = 4; \
ch &= 0x07; \
} \
- else if (__builtin_expect (ch & 0xfc, 0xfc) == 0xf8) \
+ else if (__builtin_expect (ch & 0xfc, 0xf8) == 0xf8) \
{ \
/* We expect five bytes. */ \
cnt = 5; \