diff --git a/ChangeLog b/ChangeLog index 55f09dd63..7cce9c8c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,8 @@ * Source/GSString.m: Make sure inline strings have 'free' flag set and add comments to say we use it to indicate ownership of buffer rather than whether to free the data. Maybe we should change the flag name? + * Source/Additions/Unicode.m: Fix missing brackets in byte order + handling for UTF-16. Problem pointed out by David Ayers 2006-05-20 Richard Frith-Macdonald diff --git a/Source/Additions/Unicode.m b/Source/Additions/Unicode.m index 225442625..9f9154ae7 100644 --- a/Source/Additions/Unicode.m +++ b/Source/Additions/Unicode.m @@ -1901,7 +1901,7 @@ GSFromUnicode(unsigned char **dst, unsigned int *size, const unichar *src, u1 = src[spos++]; if (swapped == YES) { - u1 = ((u1 & 0xff00 >> 8) + ((u1 & 0x00ff) << 8)); + u1 = (((u1 & 0xff00) >> 8) + ((u1 & 0x00ff) << 8)); } if (u1 == 0xfffe || u1 == 0xffff // unexpcted BOM || (u1 >= 0xfdd0 && u1 <= 0xfdef) // invalid character @@ -1932,7 +1932,7 @@ GSFromUnicode(unsigned char **dst, unsigned int *size, const unichar *src, u2 = src[spos++]; if (swapped == YES) { - u2 = ((u2 & 0xff00 >> 8) + ((u2 & 0x00ff) << 8)); + u2 = (((u2 & 0xff00) >> 8) + ((u2 & 0x00ff) << 8)); } if ((u2 < 0xdc00) && (u2 > 0xdfff)) @@ -2033,7 +2033,7 @@ bases: if (swapped == YES) { - u = ((u & 0xff00 >> 8) + ((u & 0x00ff) << 8)); + u = (((u & 0xff00) >> 8) + ((u & 0x00ff) << 8)); } if (dpos >= bsize) @@ -2058,7 +2058,7 @@ bases: if (swapped == YES) { - u = ((u & 0xff00 >> 8) + ((u & 0x00ff) << 8)); + u = (((u & 0xff00) >> 8) + ((u & 0x00ff) << 8)); } if (dpos >= bsize) { @@ -2138,7 +2138,7 @@ tables: /* Swap byte order if necessary */ if (swapped == YES) { - u = ((u & 0xff00 >> 8) + ((u & 0x00ff) << 8)); + u = (((u & 0xff00) >> 8) + ((u & 0x00ff) << 8)); } /* Grow output buffer to make room if necessary */