/*================================================================================= =================================================================================*/ PRIVATE PRBool uCheckAndScan2ByteGRPrefix8F( uShiftTable *shift, PRInt32* state, unsigned char *in, PRUint16 *out, PRUint32 inbuflen, PRUint32* inscanlen ) { if((inbuflen < 3) ||(in[0] != 0x8F)) return PR_FALSE; else if (! CHK_GR94(in[1])) /* 2nd byte range check */ { *inscanlen = 2; *out = 0xFF; /* for 2-byte table, uMap() is guaranteed to fail for 0xFF. */ return PR_TRUE; } else if (! CHK_GR94(in[2])) /* 3rd byte range check */ { *inscanlen = 3; *out = 0xFF; /* for 2-byte table, uMap() is guaranteed to fail for 0xFF. */ return PR_TRUE; } else { *inscanlen = 3; *out = (((in[1] << 8) | ( in[2])) & 0x7F7F); return PR_TRUE; } }
/*================================================================================= =================================================================================*/ int uCheckAndScan2ByteGRPrefix8F( int32_t* state, unsigned char *in, uint16_t *out, uint32_t inbuflen, uint32_t* inscanlen ) { if((inbuflen < 3) ||(in[0] != 0x8F)) return 0; else if (! CHK_GR94(in[1])) /* 2nd byte range check */ { *inscanlen = 2; *out = 0xFF; /* for 2-byte table, uMap() is guaranteed to fail for 0xFF. */ return 1; } else if (! CHK_GR94(in[2])) /* 3rd byte range check */ { *inscanlen = 3; *out = 0xFF; /* for 2-byte table, uMap() is guaranteed to fail for 0xFF. */ return 1; } else { *inscanlen = 3; *out = (((in[1] << 8) | ( in[2])) & 0x7F7F); return 1; } }
/*================================================================================= =================================================================================*/ PRIVATE PRBool uCheckAndScanAlways2ByteShiftGR( uShiftTable *shift, PRInt32* state, unsigned char *in, PRUint16 *out, PRUint32 inbuflen, PRUint32* inscanlen ) { /* * Both bytes should be in the range of [0xa1,0xfe] for 94x94 character sets * invoked on GR. No encoding implemented in Mozilla uses 96x96 char. sets. * Only 2nd byte range needs to be checked because * 1st byte is checked before calling this in nsUnicodeDecoerHelper.cpp */ if(inbuflen < 2) /* will lead to NS_OK_UDEC_MOREINPUT */ return PR_FALSE; else if (! CHK_GR94(in[1])) { *inscanlen = 2; *out = 0xFF; /* for 2-byte table, uMap() is guaranteed to fail for 0xFF. */ return PR_TRUE; } else { *inscanlen = 2; *out = (((in[0] << 8) | ( in[1])) & 0x7F7F); return PR_TRUE; } }