forked from mirrors/gecko-dev
Bug 544512 - Misaligned accesses in uconv causes Bus Error on sparc and word wrapping on arm. r=smontagu
This commit is contained in:
parent
aaa650ff17
commit
b4f5845246
2 changed files with 6 additions and 2 deletions
|
|
@ -112,7 +112,11 @@ UTF16ConvertToUnicode(PRUint8& aState, PRUint8& aOddByte,
|
||||||
if (dest == destEnd)
|
if (dest == destEnd)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
#if !defined(__sparc__) && !defined(__arm__)
|
||||||
u = *(const PRUnichar*)src;
|
u = *(const PRUnichar*)src;
|
||||||
|
#else
|
||||||
|
memcpy(&u, src, 2);
|
||||||
|
#endif
|
||||||
src += 2;
|
src += 2;
|
||||||
|
|
||||||
have_codepoint:
|
have_codepoint:
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// static functions and macro definition common to nsUTF32(BE|LE)ToUnicode
|
// static functions and macro definition common to nsUTF32(BE|LE)ToUnicode
|
||||||
|
|
||||||
#ifdef IS_BIG_ENDIAN
|
#if defined(IS_BIG_ENDIAN) || defined(__arm__)
|
||||||
#define LE_STRING_TO_UCS4(s) \
|
#define LE_STRING_TO_UCS4(s) \
|
||||||
(PRUint8(*(s)) | (PRUint8(*((s) + 1)) << 8) | \
|
(PRUint8(*(s)) | (PRUint8(*((s) + 1)) << 8) | \
|
||||||
(PRUint8(*((s) + 2)) << 16) | (PRUint8(*((s) + 3)) << 24))
|
(PRUint8(*((s) + 2)) << 16) | (PRUint8(*((s) + 3)) << 24))
|
||||||
|
|
@ -54,7 +54,7 @@
|
||||||
#define LE_STRING_TO_UCS4(s) (*(PRUint32*) (s))
|
#define LE_STRING_TO_UCS4(s) (*(PRUint32*) (s))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef IS_BIG_ENDIAN
|
#if defined(IS_BIG_ENDIAN) && !defined(__sparc__)
|
||||||
#define BE_STRING_TO_UCS4(s) (*(PRUint32*) (s))
|
#define BE_STRING_TO_UCS4(s) (*(PRUint32*) (s))
|
||||||
#else
|
#else
|
||||||
#define BE_STRING_TO_UCS4(s) \
|
#define BE_STRING_TO_UCS4(s) \
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue