1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-10-25 20:58:26 +03:00

Fix handling of utf-16 encoding of code point 0xE000. (CVS 4017)

FossilOrigin-Name: bfc35ce8673ce51f726535b90c1d86be272848bb
This commit is contained in:
danielk1977
2007-05-16 18:11:41 +00:00
parent 2be2be92c4
commit a9c16b0a38
4 changed files with 16 additions and 14 deletions

View File

@@ -12,7 +12,7 @@
** This file contains routines used to translate between UTF-8,
** UTF-16, UTF-16BE, and UTF-16LE.
**
** $Id: utf.c,v 1.48 2007/05/15 14:40:11 drh Exp $
** $Id: utf.c,v 1.49 2007/05/16 18:11:41 danielk1977 Exp $
**
** Notes on UTF-8:
**
@@ -107,7 +107,7 @@ const unsigned char sqlite3UtfTrans1[] = {
#define READ_UTF16LE(zIn, c){ \
c = (*zIn++); \
c += ((*zIn++)<<8); \
if( c>=0xD800 && c<=0xE000 ){ \
if( c>=0xD800 && c<0xE000 ){ \
int c2 = (*zIn++); \
c2 += ((*zIn++)<<8); \
c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10); \
@@ -118,7 +118,7 @@ const unsigned char sqlite3UtfTrans1[] = {
#define READ_UTF16BE(zIn, c){ \
c = ((*zIn++)<<8); \
c += (*zIn++); \
if( c>=0xD800 && c<=0xE000 ){ \
if( c>=0xD800 && c<0xE000 ){ \
int c2 = ((*zIn++)<<8); \
c2 += (*zIn++); \
c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10); \
@@ -488,7 +488,7 @@ void sqlite3UtfSelfTest(){
assert( (z-zBuf)==n );
}
for(i=0; i<0x00110000; i++){
if( i>=0xD800 && i<=0xE000 ) continue;
if( i>=0xD800 && i<0xE000 ) continue;
z = zBuf;
WRITE_UTF16LE(z, i);
n = z-zBuf;
@@ -499,7 +499,7 @@ void sqlite3UtfSelfTest(){
assert( (z-zBuf)==n );
}
for(i=0; i<0x00110000; i++){
if( i>=0xD800 && i<=0xE000 ) continue;
if( i>=0xD800 && i<0xE000 ) continue;
z = zBuf;
WRITE_UTF16BE(z, i);
n = z-zBuf;