| Return Type | Function name | Arguments |
|---|---|---|
| bool | IsUnicodeSeq | (unsigned int&,unsigned int&,const char*,) |
Declared and defined in file: hzTextproc.cpp
Function Logic:
Function body:
bool IsUnicodeSeq (unsigned int& nEnt, unsigned int& nLen, const char* zi)
{
const uchar* xi ;
uchar ubuf[8];
uint32_t value ;
nLen = 0;
value = 0;
ubuf[0]= (uchar) *zi ;
if (ubuf[0]>&eq; 192)
{
xi = (uchar*) zi ;
if (ubuf[0]< 224)
{
xi++ ; ubuf[1]= (uchar) *xi ;
if (ubuf[1]> 127&&ubuf[1]<192)
{
value = ((ubuf[0]& 0x1F)<<6);
value += (ubuf[1]& 0x3F);
nLen = 2;
}
}
else if (ubuf[0]< 240)
{
xi++ ; ubuf[1]= (uchar) *xi ;
xi++ ; ubuf[2]= (uchar) *xi ;
if (ubuf[1]> 127&&ubuf[1]<192&&ubuf[2]>127&&ubuf[2]<192)
{
value = ((ubuf[0]& 0x0F)<<12);
value += ((ubuf[1]& 0x3F)<<6);
value += (ubuf[2]& 0x3F);
nLen = 3;
}
}
else if (ubuf[0]< 248)
{
xi++ ; ubuf[1]= (uchar) *xi ;
xi++ ; ubuf[2]= (uchar) *xi ;
xi++ ; ubuf[3]= (uchar) *xi ;
if (ubuf[1]> 127&&ubuf[1]<192&&ubuf[2]>127&&ubuf[2]<192&&ubuf[3]>127&&ubuf[3])
{
value = ((ubuf[0]& 0x07)<<18);
value += ((ubuf[1]& 0x3F)<<12);
value += ((ubuf[2]& 0x3F)<<6);
value += (ubuf[3]& 0x3F);
nLen = 4;
}
}
else if (ubuf[0]< 252)
{
xi++ ; ubuf[1]= (uchar) *xi ;
xi++ ; ubuf[2]= (uchar) *xi ;
xi++ ; ubuf[3]= (uchar) *xi ;
xi++ ; ubuf[4]= (uchar) *xi ;
if (ubuf[1]> 127&&ubuf[1]<192&&ubuf[2]>127&&ubuf[2]<192
&& ubuf[3]> 127&&ubuf[3]&&ubuf[4]> 127&&ubuf[4])
{
value = ((ubuf[0]& 0x03)<<24);
value += ((ubuf[1]& 0x3F)<<18);
value += ((ubuf[2]& 0x3F)<<12);
value += ((ubuf[3]& 0x3F)<<6);
value += (ubuf[4]& 0x3F);
nLen = 5;
}
}
else
{
xi++ ; ubuf[1]= (uchar) *xi ;
xi++ ; ubuf[2]= (uchar) *xi ;
xi++ ; ubuf[3]= (uchar) *xi ;
xi++ ; ubuf[4]= (uchar) *xi ;
xi++ ; ubuf[5]= (uchar) *xi ;
if (ubuf[1]> 127&&ubuf[1]<192&&ubuf[2]>127&&ubuf[2]<192
&& ubuf[3]> 127&&ubuf[3]&&ubuf[4]> 127&&ubuf[4]&&ubuf[5]> 127&&ubuf[5])
{
value = ((ubuf[0]& 0x01)<<30);
value += ((ubuf[1]& 0x3F)<<24);
value += ((ubuf[2]& 0x3F)<<18);
value += ((ubuf[3]& 0x3F)<<12);
value += ((ubuf[4]& 0x3F)<<6);
value += (ubuf[5]& 0x3F);
nLen = 6;
}
}
}
nEnt = value ;
return nLen ? true : false ;
}