bool nsGBKConvUtil::UnicodeToGBKChar( PRUnichar aChar, bool aToGL, char* aOutByte1, char* aOutByte2) { bool found=false; *aOutByte1 = *aOutByte2 = 0; if(UNICHAR_IN_RANGE(0xd800, aChar, 0xdfff)) { // surrogate is not in here return false; } if(UNICHAR_IN_RANGE(0x4e00, aChar, 0x9FFF)) { uint16_t item = gUnicodeToGBKTable[aChar - 0x4e00]; if(item != 0) { *aOutByte1 = item >> 8; *aOutByte2 = item & 0x00FF; found = true; } else {
bool nsGBKConvUtil::UnicodeToGBKChar( PRUnichar aChar, bool aToGL, char* aOutByte1, char* aOutByte2) { NS_ASSERTION(gInitToGBKTable, "gGBKToUnicodeTable is not init yet. need to call InitToGBKTable first"); bool found=false; *aOutByte1 = *aOutByte2 = 0; if(UNICHAR_IN_RANGE(0xd800, aChar, 0xdfff)) { // surrogate is not in here return false; } if(UNICHAR_IN_RANGE(0x4e00, aChar, 0x9FFF)) { PRUint16 item = gUnicodeToGBKTable[aChar - 0x4e00]; if(item != 0) { *aOutByte1 = item >> 8; *aOutByte2 = item & 0x00FF; found = true; } else {