mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-11 10:28:58 +00:00
Bug 956995 - Stop using prtypes in unicpriv.h. r=smontagu
This commit is contained in:
parent
1db04c8244
commit
1231f90835
@ -1,14 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#ifndef ubase_h__
|
||||
#define ubase_h__
|
||||
|
||||
#include "prtypes.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define PRIVATE
|
||||
#define MODULE_PRIVATE
|
||||
|
||||
#endif
|
@ -6,12 +6,12 @@
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
typedef PRBool (*uSubGeneratorFunc) (uint16_t in, unsigned char* out);
|
||||
typedef int (*uSubGeneratorFunc) (uint16_t in, unsigned char* out);
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
|
||||
typedef PRBool (*uGeneratorFunc) (
|
||||
typedef int (*uGeneratorFunc) (
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
@ -19,7 +19,7 @@ typedef PRBool (*uGeneratorFunc) (
|
||||
uint32_t* outlen
|
||||
);
|
||||
|
||||
MODULE_PRIVATE PRBool uGenerate(
|
||||
int uGenerate(
|
||||
uScanClassID scanClass,
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
@ -30,28 +30,28 @@ MODULE_PRIVATE PRBool uGenerate(
|
||||
|
||||
#define uSubGenerator(sub,in,out) (* m_subgenerator[sub])((in),(out))
|
||||
|
||||
PRIVATE PRBool uCheckAndGenAlways1Byte(
|
||||
int uCheckAndGenAlways1Byte(
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
uint32_t outbuflen,
|
||||
uint32_t* outlen
|
||||
);
|
||||
PRIVATE PRBool uCheckAndGenAlways2Byte(
|
||||
int uCheckAndGenAlways2Byte(
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
uint32_t outbuflen,
|
||||
uint32_t* outlen
|
||||
);
|
||||
PRIVATE PRBool uCheckAndGenAlways2ByteShiftGR(
|
||||
int uCheckAndGenAlways2ByteShiftGR(
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
uint32_t outbuflen,
|
||||
uint32_t* outlen
|
||||
);
|
||||
MODULE_PRIVATE PRBool uGenerateShift(
|
||||
int uGenerateShift(
|
||||
uShiftOutTable *shift,
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
@ -59,14 +59,14 @@ MODULE_PRIVATE PRBool uGenerateShift(
|
||||
uint32_t outbuflen,
|
||||
uint32_t* outlen
|
||||
);
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8F(
|
||||
int uCheckAndGen2ByteGRPrefix8F(
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
uint32_t outbuflen,
|
||||
uint32_t* outlen
|
||||
);
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA2(
|
||||
int uCheckAndGen2ByteGRPrefix8EA2(
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
@ -74,7 +74,7 @@ PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA2(
|
||||
uint32_t* outlen
|
||||
);
|
||||
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA3(
|
||||
int uCheckAndGen2ByteGRPrefix8EA3(
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
@ -82,7 +82,7 @@ PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA3(
|
||||
uint32_t* outlen
|
||||
);
|
||||
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA4(
|
||||
int uCheckAndGen2ByteGRPrefix8EA4(
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
@ -90,7 +90,7 @@ PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA4(
|
||||
uint32_t* outlen
|
||||
);
|
||||
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA5(
|
||||
int uCheckAndGen2ByteGRPrefix8EA5(
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
@ -98,7 +98,7 @@ PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA5(
|
||||
uint32_t* outlen
|
||||
);
|
||||
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA6(
|
||||
int uCheckAndGen2ByteGRPrefix8EA6(
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
@ -106,14 +106,14 @@ PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA6(
|
||||
uint32_t* outlen
|
||||
);
|
||||
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA7(
|
||||
int uCheckAndGen2ByteGRPrefix8EA7(
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
uint32_t outbuflen,
|
||||
uint32_t* outlen
|
||||
);
|
||||
PRIVATE PRBool uCnGAlways8BytesDecomposedHangul(
|
||||
int uCnGAlways8BytesDecomposedHangul(
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
@ -121,7 +121,7 @@ PRIVATE PRBool uCnGAlways8BytesDecomposedHangul(
|
||||
uint32_t* outlen
|
||||
);
|
||||
|
||||
PRIVATE PRBool uCheckAndGenJohabHangul(
|
||||
int uCheckAndGenJohabHangul(
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
@ -129,7 +129,7 @@ PRIVATE PRBool uCheckAndGenJohabHangul(
|
||||
uint32_t* outlen
|
||||
);
|
||||
|
||||
PRIVATE PRBool uCheckAndGenJohabSymbol(
|
||||
int uCheckAndGenJohabSymbol(
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
@ -138,7 +138,7 @@ PRIVATE PRBool uCheckAndGenJohabSymbol(
|
||||
);
|
||||
|
||||
|
||||
PRIVATE PRBool uCheckAndGen4BytesGB18030(
|
||||
int uCheckAndGen4BytesGB18030(
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
@ -146,26 +146,26 @@ PRIVATE PRBool uCheckAndGen4BytesGB18030(
|
||||
uint32_t* outlen
|
||||
);
|
||||
|
||||
PRIVATE PRBool uGenAlways2Byte(
|
||||
int uGenAlways2Byte(
|
||||
uint16_t in,
|
||||
unsigned char* out
|
||||
);
|
||||
PRIVATE PRBool uGenAlways2ByteShiftGR(
|
||||
int uGenAlways2ByteShiftGR(
|
||||
uint16_t in,
|
||||
unsigned char* out
|
||||
);
|
||||
PRIVATE PRBool uGenAlways1Byte(
|
||||
int uGenAlways1Byte(
|
||||
uint16_t in,
|
||||
unsigned char* out
|
||||
);
|
||||
PRIVATE PRBool uGenAlways1BytePrefix8E(
|
||||
int uGenAlways1BytePrefix8E(
|
||||
uint16_t in,
|
||||
unsigned char* out
|
||||
);
|
||||
/*=================================================================================
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE const uGeneratorFunc m_generator[uNumOfCharsetType] =
|
||||
const uGeneratorFunc m_generator[uNumOfCharsetType] =
|
||||
{
|
||||
uCheckAndGenAlways1Byte,
|
||||
uCheckAndGenAlways2Byte,
|
||||
@ -188,18 +188,17 @@ PRIVATE const uGeneratorFunc m_generator[uNumOfCharsetType] =
|
||||
|
||||
=================================================================================*/
|
||||
|
||||
PRIVATE const uSubGeneratorFunc m_subgenerator[uNumOfCharType] =
|
||||
const uSubGeneratorFunc m_subgenerator[uNumOfCharType] =
|
||||
{
|
||||
uGenAlways1Byte,
|
||||
uGenAlways2Byte,
|
||||
uGenAlways2ByteShiftGR,
|
||||
uGenAlways1BytePrefix8E
|
||||
|
||||
};
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
MODULE_PRIVATE PRBool uGenerate(
|
||||
int uGenerate(
|
||||
uScanClassID scanClass,
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
@ -213,55 +212,55 @@ MODULE_PRIVATE PRBool uGenerate(
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uGenAlways1Byte(
|
||||
int uGenAlways1Byte(
|
||||
uint16_t in,
|
||||
unsigned char* out
|
||||
)
|
||||
{
|
||||
out[0] = (unsigned char)in;
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uGenAlways2Byte(
|
||||
int uGenAlways2Byte(
|
||||
uint16_t in,
|
||||
unsigned char* out
|
||||
)
|
||||
{
|
||||
out[0] = (unsigned char)((in >> 8) & 0xff);
|
||||
out[1] = (unsigned char)(in & 0xff);
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uGenAlways2ByteShiftGR(
|
||||
int uGenAlways2ByteShiftGR(
|
||||
uint16_t in,
|
||||
unsigned char* out
|
||||
)
|
||||
{
|
||||
out[0] = (unsigned char)(((in >> 8) & 0xff) | 0x80);
|
||||
out[1] = (unsigned char)((in & 0xff) | 0x80);
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uGenAlways1BytePrefix8E(
|
||||
int uGenAlways1BytePrefix8E(
|
||||
uint16_t in,
|
||||
unsigned char* out
|
||||
)
|
||||
{
|
||||
out[0] = 0x8E;
|
||||
out[1] = (unsigned char)(in & 0xff);
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndGenAlways1Byte(
|
||||
int uCheckAndGenAlways1Byte(
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
@ -272,19 +271,19 @@ PRIVATE PRBool uCheckAndGenAlways1Byte(
|
||||
/* Don't check inlen. The caller should ensure it is larger than 0 */
|
||||
/* Oops, I don't agree. Code changed to check every time. [CATA] */
|
||||
if(outbuflen < 1)
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
*outlen = 1;
|
||||
out[0] = in & 0xff;
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndGenAlways2Byte(
|
||||
int uCheckAndGenAlways2Byte(
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
@ -293,19 +292,19 @@ PRIVATE PRBool uCheckAndGenAlways2Byte(
|
||||
)
|
||||
{
|
||||
if(outbuflen < 2)
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
*outlen = 2;
|
||||
out[0] = ((in >> 8 ) & 0xff);
|
||||
out[1] = in & 0xff;
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndGenAlways2ByteShiftGR(
|
||||
int uCheckAndGenAlways2ByteShiftGR(
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
@ -314,19 +313,19 @@ PRIVATE PRBool uCheckAndGenAlways2ByteShiftGR(
|
||||
)
|
||||
{
|
||||
if(outbuflen < 2)
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
*outlen = 2;
|
||||
out[0] = ((in >> 8 ) & 0xff) | 0x80;
|
||||
out[1] = (in & 0xff) | 0x80;
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
MODULE_PRIVATE PRBool uGenerateShift(
|
||||
int uGenerateShift(
|
||||
uShiftOutTable *shift,
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
@ -350,7 +349,7 @@ MODULE_PRIVATE PRBool uGenerateShift(
|
||||
{
|
||||
if(outbuflen < cell[i].reserveLen)
|
||||
{
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -359,12 +358,12 @@ MODULE_PRIVATE PRBool uGenerateShift(
|
||||
}
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8F( int32_t* state,
|
||||
int uCheckAndGen2ByteGRPrefix8F(int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
uint32_t outbuflen,
|
||||
@ -372,20 +371,20 @@ PRIVATE PRBool uCheckAndGen2ByteGRPrefix8F( int32_t* state,
|
||||
)
|
||||
{
|
||||
if(outbuflen < 3)
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
*outlen = 3;
|
||||
out[0] = 0x8F;
|
||||
out[1] = ((in >> 8 ) & 0xff) | 0x80;
|
||||
out[2] = (in & 0xff) | 0x80;
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA2( int32_t* state,
|
||||
int uCheckAndGen2ByteGRPrefix8EA2(int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
uint32_t outbuflen,
|
||||
@ -393,7 +392,7 @@ PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA2( int32_t* state,
|
||||
)
|
||||
{
|
||||
if(outbuflen < 4)
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
*outlen = 4;
|
||||
@ -401,7 +400,7 @@ PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA2( int32_t* state,
|
||||
out[1] = 0xA2;
|
||||
out[2] = ((in >> 8 ) & 0xff) | 0x80;
|
||||
out[3] = (in & 0xff) | 0x80;
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -409,7 +408,7 @@ PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA2( int32_t* state,
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA3( int32_t* state,
|
||||
int uCheckAndGen2ByteGRPrefix8EA3(int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
uint32_t outbuflen,
|
||||
@ -417,7 +416,7 @@ PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA3( int32_t* state,
|
||||
)
|
||||
{
|
||||
if(outbuflen < 4)
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
*outlen = 4;
|
||||
@ -425,13 +424,13 @@ PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA3( int32_t* state,
|
||||
out[1] = 0xA3;
|
||||
out[2] = ((in >> 8 ) & 0xff) | 0x80;
|
||||
out[3] = (in & 0xff) | 0x80;
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA4( int32_t* state,
|
||||
int uCheckAndGen2ByteGRPrefix8EA4(int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
uint32_t outbuflen,
|
||||
@ -439,7 +438,7 @@ PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA4( int32_t* state,
|
||||
)
|
||||
{
|
||||
if(outbuflen < 4)
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
*outlen = 4;
|
||||
@ -447,13 +446,13 @@ PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA4( int32_t* state,
|
||||
out[1] = 0xA4;
|
||||
out[2] = ((in >> 8 ) & 0xff) | 0x80;
|
||||
out[3] = (in & 0xff) | 0x80;
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA5( int32_t* state,
|
||||
int uCheckAndGen2ByteGRPrefix8EA5(int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
uint32_t outbuflen,
|
||||
@ -461,7 +460,7 @@ PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA5( int32_t* state,
|
||||
)
|
||||
{
|
||||
if(outbuflen < 4)
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
*outlen = 4;
|
||||
@ -469,13 +468,13 @@ PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA5( int32_t* state,
|
||||
out[1] = 0xA5;
|
||||
out[2] = ((in >> 8 ) & 0xff) | 0x80;
|
||||
out[3] = (in & 0xff) | 0x80;
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA6( int32_t* state,
|
||||
int uCheckAndGen2ByteGRPrefix8EA6(int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
uint32_t outbuflen,
|
||||
@ -483,7 +482,7 @@ PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA6( int32_t* state,
|
||||
)
|
||||
{
|
||||
if(outbuflen < 4)
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
*outlen = 4;
|
||||
@ -491,13 +490,13 @@ PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA6( int32_t* state,
|
||||
out[1] = 0xA6;
|
||||
out[2] = ((in >> 8 ) & 0xff) | 0x80;
|
||||
out[3] = (in & 0xff) | 0x80;
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA7( int32_t* state,
|
||||
int uCheckAndGen2ByteGRPrefix8EA7(int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
uint32_t outbuflen,
|
||||
@ -505,7 +504,7 @@ PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA7( int32_t* state,
|
||||
)
|
||||
{
|
||||
if(outbuflen < 4)
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
*outlen = 4;
|
||||
@ -513,7 +512,7 @@ PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA7( int32_t* state,
|
||||
out[1] = 0xA7;
|
||||
out[2] = ((in >> 8 ) & 0xff) | 0x80;
|
||||
out[3] = (in & 0xff) | 0x80;
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
@ -527,7 +526,7 @@ PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA7( int32_t* state,
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCnGAlways8BytesDecomposedHangul(
|
||||
int uCnGAlways8BytesDecomposedHangul(
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
@ -549,7 +548,7 @@ PRIVATE PRBool uCnGAlways8BytesDecomposedHangul(
|
||||
uint16_t SIndex, LIndex, VIndex, TIndex;
|
||||
|
||||
if(outbuflen < 8)
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
|
||||
/* the following line are copy from Unicode 2.0 page 3-13 */
|
||||
/* item 1 of Hangul Syllabel Decomposition */
|
||||
@ -575,10 +574,10 @@ PRIVATE PRBool uCnGAlways8BytesDecomposedHangul(
|
||||
out[5] = (VIndex + 0xbf);
|
||||
out[7] = tMap[TIndex];
|
||||
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
PRIVATE PRBool uCheckAndGenJohabHangul(
|
||||
int uCheckAndGenJohabHangul(
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
@ -587,7 +586,7 @@ PRIVATE PRBool uCheckAndGenJohabHangul(
|
||||
)
|
||||
{
|
||||
if(outbuflen < 2)
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
/*
|
||||
@ -633,10 +632,10 @@ PRIVATE PRBool uCheckAndGenJohabHangul(
|
||||
#if 0
|
||||
printf("Johab Hangul %x %x in=%x L=%d V=%d T=%d\n", out[0], out[1], in, LIndex, VIndex, TIndex);
|
||||
#endif
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
PRIVATE PRBool uCheckAndGenJohabSymbol(
|
||||
int uCheckAndGenJohabSymbol(
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
@ -645,7 +644,7 @@ PRIVATE PRBool uCheckAndGenJohabSymbol(
|
||||
)
|
||||
{
|
||||
if(outbuflen < 2)
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
/* The following code are based on the Perl code listed under
|
||||
@ -689,10 +688,10 @@ PRIVATE PRBool uCheckAndGenJohabSymbol(
|
||||
#if 0
|
||||
printf("Johab Symbol %x %x in=%x\n", out[0], out[1], in);
|
||||
#endif
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
PRIVATE PRBool uCheckAndGen4BytesGB18030(
|
||||
int uCheckAndGen4BytesGB18030(
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
@ -701,7 +700,7 @@ PRIVATE PRBool uCheckAndGen4BytesGB18030(
|
||||
)
|
||||
{
|
||||
if(outbuflen < 4)
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
out[0] = (in / (10*126*10)) + 0x81;
|
||||
in %= (10*126*10);
|
||||
out[1] = (in / (10*126)) + 0x30;
|
||||
@ -709,5 +708,5 @@ PRIVATE PRBool uCheckAndGen4BytesGB18030(
|
||||
out[2] = (in / (10)) + 0x81;
|
||||
out[3] = (in % 10) + 0x30;
|
||||
*outlen = 4;
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
|
@ -7,28 +7,28 @@
|
||||
|
||||
|
||||
typedef uint16_t (* MapFormatFunc)(uint16_t in,const uTable *uT,const uMapCell *cell);
|
||||
typedef PRBool (* HitFormateFunc)(uint16_t in,const uMapCell *cell);
|
||||
typedef int (* HitFormateFunc)(uint16_t in,const uMapCell *cell);
|
||||
typedef void (* FillInfoFormateFunc)(const uTable *uT, const uMapCell *cell, uint32_t* info);
|
||||
|
||||
|
||||
PRIVATE PRBool uHitFormate0(uint16_t in,const uMapCell *cell);
|
||||
PRIVATE PRBool uHitFormate2(uint16_t in,const uMapCell *cell);
|
||||
PRIVATE uint16_t uMapFormate0(uint16_t in,const uTable *uT,const uMapCell *cell);
|
||||
PRIVATE uint16_t uMapFormate1(uint16_t in,const uTable *uT,const uMapCell *cell);
|
||||
PRIVATE uint16_t uMapFormate2(uint16_t in,const uTable *uT,const uMapCell *cell);
|
||||
PRIVATE void uFillInfoFormate0(const uTable *uT,const uMapCell *cell,uint32_t* aInfo);
|
||||
PRIVATE void uFillInfoFormate1(const uTable *uT,const uMapCell *cell,uint32_t* aInfo);
|
||||
PRIVATE void uFillInfoFormate2(const uTable *uT,const uMapCell *cell,uint32_t* aInfo);
|
||||
int uHitFormate0(uint16_t in,const uMapCell *cell);
|
||||
int uHitFormate2(uint16_t in,const uMapCell *cell);
|
||||
uint16_t uMapFormate0(uint16_t in,const uTable *uT,const uMapCell *cell);
|
||||
uint16_t uMapFormate1(uint16_t in,const uTable *uT,const uMapCell *cell);
|
||||
uint16_t uMapFormate2(uint16_t in,const uTable *uT,const uMapCell *cell);
|
||||
void uFillInfoFormate0(const uTable *uT,const uMapCell *cell,uint32_t* aInfo);
|
||||
void uFillInfoFormate1(const uTable *uT,const uMapCell *cell,uint32_t* aInfo);
|
||||
void uFillInfoFormate2(const uTable *uT,const uMapCell *cell,uint32_t* aInfo);
|
||||
|
||||
|
||||
PRIVATE const uMapCell *uGetMapCell(const uTable *uT, int16_t item);
|
||||
PRIVATE char uGetFormat(const uTable *uT, int16_t item);
|
||||
const uMapCell *uGetMapCell(const uTable *uT, int16_t item);
|
||||
char uGetFormat(const uTable *uT, int16_t item);
|
||||
|
||||
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE const MapFormatFunc m_map[uNumFormatTag] =
|
||||
const MapFormatFunc m_map[uNumFormatTag] =
|
||||
{
|
||||
uMapFormate0,
|
||||
uMapFormate1,
|
||||
@ -38,7 +38,7 @@ PRIVATE const MapFormatFunc m_map[uNumFormatTag] =
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE const FillInfoFormateFunc m_fillinfo[uNumFormatTag] =
|
||||
const FillInfoFormateFunc m_fillinfo[uNumFormatTag] =
|
||||
{
|
||||
uFillInfoFormate0,
|
||||
uFillInfoFormate1,
|
||||
@ -48,7 +48,7 @@ PRIVATE const FillInfoFormateFunc m_fillinfo[uNumFormatTag] =
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE const HitFormateFunc m_hit[uNumFormatTag] =
|
||||
const HitFormateFunc m_hit[uNumFormatTag] =
|
||||
{
|
||||
uHitFormate0,
|
||||
uHitFormate0,
|
||||
@ -63,9 +63,9 @@ PRIVATE const HitFormateFunc m_hit[uNumFormatTag] =
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
MODULE_PRIVATE PRBool uMapCode(const uTable *uT, uint16_t in, uint16_t* out)
|
||||
int uMapCode(const uTable *uT, uint16_t in, uint16_t* out)
|
||||
{
|
||||
PRBool done = PR_FALSE;
|
||||
int done = 0;
|
||||
uint16_t itemOfList = uT->itemOfList;
|
||||
uint16_t i;
|
||||
*out = NOMAPPING;
|
||||
@ -77,7 +77,7 @@ MODULE_PRIVATE PRBool uMapCode(const uTable *uT, uint16_t in, uint16_t* out)
|
||||
if(uHit(format, in, uCell))
|
||||
{
|
||||
*out = uMap(format, in, uT,uCell);
|
||||
done = PR_TRUE;
|
||||
done = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -91,7 +91,7 @@ member function
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uHitFormate0(uint16_t in,const uMapCell *cell)
|
||||
int uHitFormate0(uint16_t in,const uMapCell *cell)
|
||||
{
|
||||
return ( (in >= cell->fmt.format0.srcBegin) &&
|
||||
(in <= cell->fmt.format0.srcEnd) ) ;
|
||||
@ -99,21 +99,21 @@ PRIVATE PRBool uHitFormate0(uint16_t in,const uMapCell *cell)
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uHitFormate2(uint16_t in,const uMapCell *cell)
|
||||
int uHitFormate2(uint16_t in,const uMapCell *cell)
|
||||
{
|
||||
return (in == cell->fmt.format2.srcBegin);
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE uint16_t uMapFormate0(uint16_t in,const uTable *uT,const uMapCell *cell)
|
||||
uint16_t uMapFormate0(uint16_t in,const uTable *uT,const uMapCell *cell)
|
||||
{
|
||||
return ((in - cell->fmt.format0.srcBegin) + cell->fmt.format0.destBegin);
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE uint16_t uMapFormate1(uint16_t in,const uTable *uT,const uMapCell *cell)
|
||||
uint16_t uMapFormate1(uint16_t in,const uTable *uT,const uMapCell *cell)
|
||||
{
|
||||
return (*(((uint16_t *)uT) + uT->offsetToMappingTable
|
||||
+ cell->fmt.format1.mappingOffset + in - cell->fmt.format1.srcBegin));
|
||||
@ -121,7 +121,7 @@ PRIVATE uint16_t uMapFormate1(uint16_t in,const uTable *uT,const uMapCell *cell)
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE uint16_t uMapFormate2(uint16_t in,const uTable *uT,const uMapCell *cell)
|
||||
uint16_t uMapFormate2(uint16_t in,const uTable *uT,const uMapCell *cell)
|
||||
{
|
||||
return (cell->fmt.format2.destBegin);
|
||||
}
|
||||
@ -130,7 +130,7 @@ PRIVATE uint16_t uMapFormate2(uint16_t in,const uTable *uT,const uMapCell *cell)
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE void uFillInfoFormate0(const uTable *uT,const uMapCell *cell,uint32_t* info)
|
||||
void uFillInfoFormate0(const uTable *uT,const uMapCell *cell,uint32_t* info)
|
||||
{
|
||||
uint16_t begin, end, i;
|
||||
begin = cell->fmt.format0.srcBegin;
|
||||
@ -152,7 +152,7 @@ PRIVATE void uFillInfoFormate0(const uTable *uT,const uMapCell *cell,uint32_t* i
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE void uFillInfoFormate1(const uTable *uT,const uMapCell *cell,uint32_t* info)
|
||||
void uFillInfoFormate1(const uTable *uT,const uMapCell *cell,uint32_t* info)
|
||||
{
|
||||
uint16_t begin, end, i;
|
||||
uint16_t *base;
|
||||
@ -168,7 +168,7 @@ PRIVATE void uFillInfoFormate1(const uTable *uT,const uMapCell *cell,uint32_t* i
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE void uFillInfoFormate2(const uTable *uT,const uMapCell *cell,uint32_t* info)
|
||||
void uFillInfoFormate2(const uTable *uT,const uMapCell *cell,uint32_t* info)
|
||||
{
|
||||
SET_REPRESENTABLE(info, cell->fmt.format2.srcBegin);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
#ifndef __UNIPRIV__
|
||||
#define __UNIPRIV__
|
||||
|
||||
#include "ubase.h"
|
||||
#include <stdint.h>
|
||||
#include "umap.h"
|
||||
#include "uconvutil.h"
|
||||
|
||||
@ -13,32 +13,32 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
PRBool uMapCode(const uTable *uT,
|
||||
int uMapCode(const uTable *uT,
|
||||
uint16_t in,
|
||||
uint16_t* out);
|
||||
|
||||
PRBool uGenerate(uScanClassID scanClass,
|
||||
int uGenerate(uScanClassID scanClass,
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
uint32_t outbuflen,
|
||||
uint32_t* outlen);
|
||||
|
||||
PRBool uScan(uScanClassID scanClass,
|
||||
int uScan(uScanClassID scanClass,
|
||||
int32_t *state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
uint32_t inbuflen,
|
||||
uint32_t* inscanlen);
|
||||
|
||||
PRBool uGenerateShift(uShiftOutTable *shift,
|
||||
int uGenerateShift(uShiftOutTable *shift,
|
||||
int32_t* state,
|
||||
uint16_t in,
|
||||
unsigned char* out,
|
||||
uint32_t outbuflen,
|
||||
uint32_t* outlen);
|
||||
|
||||
PRBool uScanShift(uShiftInTable *shift,
|
||||
int uScanShift(uShiftInTable *shift,
|
||||
int32_t *state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
|
@ -8,12 +8,12 @@
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
typedef PRBool (*uSubScannerFunc) (unsigned char* in, uint16_t* out);
|
||||
typedef int (*uSubScannerFunc) (unsigned char* in, uint16_t* out);
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
|
||||
typedef PRBool (*uScannerFunc) (
|
||||
typedef int (*uScannerFunc) (
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
@ -21,7 +21,7 @@ typedef PRBool (*uScannerFunc) (
|
||||
uint32_t* inscanlen
|
||||
);
|
||||
|
||||
MODULE_PRIVATE PRBool uScan(
|
||||
int uScan(
|
||||
uScanClassID scanClass,
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
@ -32,35 +32,35 @@ MODULE_PRIVATE PRBool uScan(
|
||||
|
||||
#define uSubScanner(sub,in,out) (* m_subscanner[sub])((in),(out))
|
||||
|
||||
PRIVATE PRBool uCheckAndScanAlways1Byte(
|
||||
int uCheckAndScanAlways1Byte(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
uint32_t inbuflen,
|
||||
uint32_t* inscanlen
|
||||
);
|
||||
PRIVATE PRBool uCheckAndScanAlways2Byte(
|
||||
int uCheckAndScanAlways2Byte(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
uint32_t inbuflen,
|
||||
uint32_t* inscanlen
|
||||
);
|
||||
PRIVATE PRBool uCheckAndScanAlways2ByteShiftGR(
|
||||
int uCheckAndScanAlways2ByteShiftGR(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
uint32_t inbuflen,
|
||||
uint32_t* inscanlen
|
||||
);
|
||||
PRIVATE PRBool uCheckAndScanAlways2ByteGR128(
|
||||
int uCheckAndScanAlways2ByteGR128(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
uint32_t inbuflen,
|
||||
uint32_t* inscanlen
|
||||
);
|
||||
MODULE_PRIVATE PRBool uScanShift(
|
||||
int uScanShift(
|
||||
uShiftInTable *shift,
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
@ -69,70 +69,70 @@ MODULE_PRIVATE PRBool uScanShift(
|
||||
uint32_t* inscanlen
|
||||
);
|
||||
|
||||
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8F(
|
||||
int uCheckAndScan2ByteGRPrefix8F(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
uint32_t inbuflen,
|
||||
uint32_t* inscanlen
|
||||
);
|
||||
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA2(
|
||||
int uCheckAndScan2ByteGRPrefix8EA2(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
uint32_t inbuflen,
|
||||
uint32_t* inscanlen
|
||||
);
|
||||
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA3(
|
||||
int uCheckAndScan2ByteGRPrefix8EA3(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
uint32_t inbuflen,
|
||||
uint32_t* inscanlen
|
||||
);
|
||||
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA4(
|
||||
int uCheckAndScan2ByteGRPrefix8EA4(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
uint32_t inbuflen,
|
||||
uint32_t* inscanlen
|
||||
);
|
||||
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA5(
|
||||
int uCheckAndScan2ByteGRPrefix8EA5(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
uint32_t inbuflen,
|
||||
uint32_t* inscanlen
|
||||
);
|
||||
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA6(
|
||||
int uCheckAndScan2ByteGRPrefix8EA6(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
uint32_t inbuflen,
|
||||
uint32_t* inscanlen
|
||||
);
|
||||
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA7(
|
||||
int uCheckAndScan2ByteGRPrefix8EA7(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
uint32_t inbuflen,
|
||||
uint32_t* inscanlen
|
||||
);
|
||||
PRIVATE PRBool uCnSAlways8BytesDecomposedHangul(
|
||||
int uCnSAlways8BytesDecomposedHangul(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
uint32_t inbuflen,
|
||||
uint32_t* inscanlen
|
||||
);
|
||||
PRIVATE PRBool uCheckAndScanJohabHangul(
|
||||
int uCheckAndScanJohabHangul(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
uint32_t inbuflen,
|
||||
uint32_t* inscanlen
|
||||
);
|
||||
PRIVATE PRBool uCheckAndScanJohabSymbol(
|
||||
int uCheckAndScanJohabSymbol(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
@ -140,7 +140,7 @@ PRIVATE PRBool uCheckAndScanJohabSymbol(
|
||||
uint32_t* inscanlen
|
||||
);
|
||||
|
||||
PRIVATE PRBool uCheckAndScan4BytesGB18030(
|
||||
int uCheckAndScan4BytesGB18030(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
@ -148,26 +148,26 @@ PRIVATE PRBool uCheckAndScan4BytesGB18030(
|
||||
uint32_t* inscanlen
|
||||
);
|
||||
|
||||
PRIVATE PRBool uScanAlways2Byte(
|
||||
int uScanAlways2Byte(
|
||||
unsigned char* in,
|
||||
uint16_t* out
|
||||
);
|
||||
PRIVATE PRBool uScanAlways2ByteShiftGR(
|
||||
int uScanAlways2ByteShiftGR(
|
||||
unsigned char* in,
|
||||
uint16_t* out
|
||||
);
|
||||
PRIVATE PRBool uScanAlways1Byte(
|
||||
int uScanAlways1Byte(
|
||||
unsigned char* in,
|
||||
uint16_t* out
|
||||
);
|
||||
PRIVATE PRBool uScanAlways1BytePrefix8E(
|
||||
int uScanAlways1BytePrefix8E(
|
||||
unsigned char* in,
|
||||
uint16_t* out
|
||||
);
|
||||
/*=================================================================================
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE const uScannerFunc m_scanner[uNumOfCharsetType] =
|
||||
const uScannerFunc m_scanner[uNumOfCharsetType] =
|
||||
{
|
||||
uCheckAndScanAlways1Byte,
|
||||
uCheckAndScanAlways2Byte,
|
||||
@ -190,7 +190,7 @@ PRIVATE const uScannerFunc m_scanner[uNumOfCharsetType] =
|
||||
|
||||
=================================================================================*/
|
||||
|
||||
PRIVATE const uSubScannerFunc m_subscanner[uNumOfCharType] =
|
||||
const uSubScannerFunc m_subscanner[uNumOfCharType] =
|
||||
{
|
||||
uScanAlways1Byte,
|
||||
uScanAlways2Byte,
|
||||
@ -200,7 +200,7 @@ PRIVATE const uSubScannerFunc m_subscanner[uNumOfCharType] =
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
MODULE_PRIVATE PRBool uScan(
|
||||
int uScan(
|
||||
uScanClassID scanClass,
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
@ -214,53 +214,53 @@ MODULE_PRIVATE PRBool uScan(
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uScanAlways1Byte(
|
||||
int uScanAlways1Byte(
|
||||
unsigned char* in,
|
||||
uint16_t* out
|
||||
)
|
||||
{
|
||||
*out = (uint16_t) in[0];
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uScanAlways2Byte(
|
||||
int uScanAlways2Byte(
|
||||
unsigned char* in,
|
||||
uint16_t* out
|
||||
)
|
||||
{
|
||||
*out = (uint16_t) (( in[0] << 8) | (in[1]));
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uScanAlways2ByteShiftGR(
|
||||
int uScanAlways2ByteShiftGR(
|
||||
unsigned char* in,
|
||||
uint16_t* out
|
||||
)
|
||||
{
|
||||
*out = (uint16_t) ((( in[0] << 8) | (in[1])) & 0x7F7F);
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uScanAlways1BytePrefix8E(
|
||||
int uScanAlways1BytePrefix8E(
|
||||
unsigned char* in,
|
||||
uint16_t* out
|
||||
)
|
||||
{
|
||||
*out = (uint16_t) in[1];
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndScanAlways1Byte(
|
||||
int uCheckAndScanAlways1Byte(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
@ -272,13 +272,13 @@ PRIVATE PRBool uCheckAndScanAlways1Byte(
|
||||
*inscanlen = 1;
|
||||
*out = (uint16_t) in[0];
|
||||
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndScanAlways2Byte(
|
||||
int uCheckAndScanAlways2Byte(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
@ -287,18 +287,18 @@ PRIVATE PRBool uCheckAndScanAlways2Byte(
|
||||
)
|
||||
{
|
||||
if(inbuflen < 2)
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
*inscanlen = 2;
|
||||
*out = ((in[0] << 8) | ( in[1])) ;
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndScanAlways2ByteShiftGR(
|
||||
int uCheckAndScanAlways2ByteShiftGR(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
@ -313,24 +313,24 @@ PRIVATE PRBool uCheckAndScanAlways2ByteShiftGR(
|
||||
* 1st byte is checked before calling this in nsUnicodeDecoerHelper.cpp
|
||||
*/
|
||||
if(inbuflen < 2) /* will lead to NS_OK_UDEC_MOREINPUT */
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
else if (! CHK_GR94(in[1]))
|
||||
{
|
||||
*inscanlen = 2;
|
||||
*out = 0xFF; /* for 2-byte table, uMap() is guaranteed to fail for 0xFF. */
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*inscanlen = 2;
|
||||
*out = (((in[0] << 8) | ( in[1])) & 0x7F7F);
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndScanAlways2ByteGR128(
|
||||
int uCheckAndScanAlways2ByteGR128(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
@ -346,24 +346,24 @@ PRIVATE PRBool uCheckAndScanAlways2ByteGR128(
|
||||
* 1st byte is checked before calling this in nsUnicodeDecoderHelper.cpp
|
||||
*/
|
||||
if(inbuflen < 2) /* will lead to NS_OK_UDEC_MOREINPUT */
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
else if (in[1] < 0x41) /* 2nd byte range check */
|
||||
{
|
||||
*inscanlen = 2;
|
||||
*out = 0xFF; /* for 2-byte table, uMap() is guaranteed to fail for 0xFF. */
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*inscanlen = 2;
|
||||
*out = (in[0] << 8) | in[1];
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uScanShift(
|
||||
int uScanShift(
|
||||
uShiftInTable *shift,
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
@ -381,7 +381,7 @@ PRIVATE PRBool uScanShift(
|
||||
( in[0] <= cell[i].shiftin_Max))
|
||||
{
|
||||
if(inbuflen < cell[i].reserveLen)
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
*inscanlen = cell[i].reserveLen;
|
||||
@ -389,12 +389,12 @@ PRIVATE PRBool uScanShift(
|
||||
}
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8F(
|
||||
int uCheckAndScan2ByteGRPrefix8F(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
@ -403,24 +403,24 @@ PRIVATE PRBool uCheckAndScan2ByteGRPrefix8F(
|
||||
)
|
||||
{
|
||||
if((inbuflen < 3) ||(in[0] != 0x8F))
|
||||
return PR_FALSE;
|
||||
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 PR_TRUE;
|
||||
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 PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*inscanlen = 3;
|
||||
*out = (((in[1] << 8) | ( in[2])) & 0x7F7F);
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/*=================================================================================
|
||||
@ -432,33 +432,33 @@ PRIVATE PRBool uCheckAndScan2ByteGRPrefix8F(
|
||||
*/
|
||||
#define CNS_8EAX_4BYTE(PREFIX) \
|
||||
if((inbuflen < 4) || (in[0] != 0x8E)) \
|
||||
return PR_FALSE; \
|
||||
return 0; \
|
||||
else if((in[1] != (PREFIX))) \
|
||||
{ \
|
||||
*inscanlen = 2; \
|
||||
*out = 0xFF; \
|
||||
return PR_TRUE; \
|
||||
return 1; \
|
||||
} \
|
||||
else if(! CHK_GR94(in[2])) \
|
||||
{ \
|
||||
*inscanlen = 3; \
|
||||
*out = 0xFF; \
|
||||
return PR_TRUE; \
|
||||
return 1; \
|
||||
} \
|
||||
else if(! CHK_GR94(in[3])) \
|
||||
{ \
|
||||
*inscanlen = 4; \
|
||||
*out = 0xFF; \
|
||||
return PR_TRUE; \
|
||||
return 1; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
*inscanlen = 4; \
|
||||
*out = (((in[2] << 8) | ( in[3])) & 0x7F7F); \
|
||||
return PR_TRUE; \
|
||||
return 1; \
|
||||
}
|
||||
|
||||
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA2(
|
||||
int uCheckAndScan2ByteGRPrefix8EA2(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
@ -472,7 +472,7 @@ PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA2(
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA3(
|
||||
int uCheckAndScan2ByteGRPrefix8EA3(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
@ -485,7 +485,7 @@ PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA3(
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA4(
|
||||
int uCheckAndScan2ByteGRPrefix8EA4(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
@ -498,7 +498,7 @@ PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA4(
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA5(
|
||||
int uCheckAndScan2ByteGRPrefix8EA5(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
@ -511,7 +511,7 @@ PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA5(
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA6(
|
||||
int uCheckAndScan2ByteGRPrefix8EA6(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
@ -524,7 +524,7 @@ PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA6(
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA7(
|
||||
int uCheckAndScan2ByteGRPrefix8EA7(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
@ -544,7 +544,7 @@ PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA7(
|
||||
#define TCount 28
|
||||
#define NCount (VCount * TCount)
|
||||
|
||||
PRIVATE PRBool uCnSAlways8BytesDecomposedHangul(
|
||||
int uCnSAlways8BytesDecomposedHangul(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
@ -557,11 +557,11 @@ PRIVATE PRBool uCnSAlways8BytesDecomposedHangul(
|
||||
/* no 8 bytes, not in a4 range, or the first 2 byte are not a4d4 */
|
||||
if((inbuflen < 8) || (0xa4 != in[0]) || (0xd4 != in[1]) ||
|
||||
(0xa4 != in[2] ) || (0xa4 != in[4]) || (0xa4 != in[6]))
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
|
||||
/* Compute LIndex */
|
||||
if((in[3] < 0xa1) || (in[3] > 0xbe)) { /* illegal leading consonant */
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
static const uint8_t lMap[] = {
|
||||
@ -577,12 +577,12 @@ PRIVATE PRBool uCnSAlways8BytesDecomposedHangul(
|
||||
|
||||
LIndex = lMap[in[3] - 0xa1];
|
||||
if(0xff == (0xff & LIndex))
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Compute VIndex */
|
||||
if((in[5] < 0xbf) || (in[5] > 0xd3)) { /* illegal medial vowel */
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
VIndex = in[5] - 0xbf;
|
||||
@ -594,7 +594,7 @@ PRIVATE PRBool uCnSAlways8BytesDecomposedHangul(
|
||||
TIndex = 0;
|
||||
}
|
||||
else if((in[7] < 0xa1) || (in[7] > 0xbe)) {/* illegal trailing consonant */
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
static const uint8_t tMap[] = {
|
||||
@ -609,20 +609,20 @@ PRIVATE PRBool uCnSAlways8BytesDecomposedHangul(
|
||||
};
|
||||
TIndex = tMap[in[7] - 0xa1];
|
||||
if(0xff == (0xff & TIndex))
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
*inscanlen = 8;
|
||||
/* the following line is from Unicode 2.0 page 3-13 item 5 */
|
||||
*out = ( LIndex * VCount + VIndex) * TCount + TIndex + SBase;
|
||||
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
|
||||
PRIVATE PRBool uCheckAndScanJohabHangul(
|
||||
int uCheckAndScanJohabHangul(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
@ -633,7 +633,7 @@ PRIVATE PRBool uCheckAndScanJohabHangul(
|
||||
/* since we don't have code to convert Johab to Unicode right now *
|
||||
* make this part of code #if 0 to save space until we fully test it */
|
||||
if(inbuflen < 2)
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
else {
|
||||
/*
|
||||
* See Table 4-45 Johab Encoding's Five-Bit Binary Patterns in page 183
|
||||
@ -660,21 +660,21 @@ PRIVATE PRBool uCheckAndScanJohabHangul(
|
||||
uint16_t ch = (in[0] << 8) | in[1];
|
||||
uint16_t LIndex, VIndex, TIndex;
|
||||
if(0 == (0x8000 & ch))
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
LIndex=lMap[(ch>>10)& 0x1F];
|
||||
VIndex=vMap[(ch>>5) & 0x1F];
|
||||
TIndex=tMap[(ch>>0) & 0x1F];
|
||||
if((0xff==(LIndex)) ||
|
||||
(0xff==(VIndex)) ||
|
||||
(0xff==(TIndex)))
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
/* the following line is from Unicode 2.0 page 3-13 item 5 */
|
||||
*out = ( LIndex * VCount + VIndex) * TCount + TIndex + SBase;
|
||||
*inscanlen = 2;
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
PRIVATE PRBool uCheckAndScanJohabSymbol(
|
||||
int uCheckAndScanJohabSymbol(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
@ -683,7 +683,7 @@ PRIVATE PRBool uCheckAndScanJohabSymbol(
|
||||
)
|
||||
{
|
||||
if(inbuflen < 2)
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
else {
|
||||
/*
|
||||
* The following code are based on the Perl code lised under
|
||||
@ -726,10 +726,10 @@ PRIVATE PRBool uCheckAndScanJohabSymbol(
|
||||
(lo - ((lo < 161) ? ((lo > 126) ? 34 : 16) :
|
||||
128));
|
||||
*inscanlen = 2;
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
PRIVATE PRBool uCheckAndScan4BytesGB18030(
|
||||
int uCheckAndScan4BytesGB18030(
|
||||
int32_t* state,
|
||||
unsigned char *in,
|
||||
uint16_t *out,
|
||||
@ -739,21 +739,21 @@ PRIVATE PRBool uCheckAndScan4BytesGB18030(
|
||||
{
|
||||
uint32_t data;
|
||||
if(inbuflen < 4)
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
|
||||
if((in[0] < 0x81 ) || (0xfe < in[0]))
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
if((in[1] < 0x30 ) || (0x39 < in[1]))
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
if((in[2] < 0x81 ) || (0xfe < in[2]))
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
if((in[3] < 0x30 ) || (0x39 < in[3]))
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
|
||||
data = (((((in[0] - 0x81) * 10 + (in[1] - 0x30)) * 126) +
|
||||
(in[2] - 0x81)) * 10 ) + (in[3] - 0x30);
|
||||
|
||||
*inscanlen = 4;
|
||||
*out = (data < 0x00010000) ? data : 0xFFFD;
|
||||
return PR_TRUE;
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user