version 1.6.4.6, 2009/10/27 18:38:08
|
version 1.7.2.1, 2010/08/10 13:28:59
|
|
|
}; | }; |
| |
// If _isSpecialChar7[ch] is true, then ch is a special character, which must | // If _isSpecialChar7[ch] is true, then ch is a special character, which must |
// have a special encoding in XML. But only use 7-bit ASCII characters to |
// have a special encoding in XML. |
// index this array. |
// Remaining 128 values are automatically initialised to 0 by compiler. |
static const int _isSpecialChar7[] = |
static const int _isSpecialChar7[256] = |
{ | { |
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,0, | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,0, |
0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0, | 0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0, |
|
|
}; | }; |
| |
// If _isSpecialChar7[ch] is true, then ch is a special character, which must | // If _isSpecialChar7[ch] is true, then ch is a special character, which must |
// have a special encoding in XML. But only use 7-biat ASCII characters to |
// have a special encoding in XML. |
// index this array. |
|
static const int _isNormalChar7[] = | static const int _isNormalChar7[] = |
{ | { |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1, | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1, |
1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1, | 1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1, |
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, |
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0, | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0, |
|
// remaining 128 values are used on multi-byte UTF-8 and should not be escaped |
|
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, |
|
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, |
|
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, |
|
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 |
}; | }; |
| |
| |
|
|
const Uint8* p= (const Uint8*) str; | const Uint8* p= (const Uint8*) str; |
| |
while (size >= 4 && | while (size >= 4 && |
(_isNormalChar7[p[0]] | |
(_isNormalChar7[p[0]] & |
_isNormalChar7[p[1]] | |
_isNormalChar7[p[1]] & |
_isNormalChar7[p[2]] | |
_isNormalChar7[p[2]] & |
_isNormalChar7[p[3]])) | _isNormalChar7[p[3]])) |
{ | { |
size -= 4; | size -= 4; |