Bugfix byte swapping

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22970 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2006-05-22 13:01:00 +00:00
parent 599ebcbe16
commit a1c4536b99
2 changed files with 7 additions and 5 deletions

View file

@ -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 */