]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Another attempt at getting the pTail pointer computations correct for
authordrh <drh@noemail.net>
Sat, 24 Oct 2009 03:04:10 +0000 (03:04 +0000)
committerdrh <drh@noemail.net>
Sat, 24 Oct 2009 03:04:10 +0000 (03:04 +0000)
sqlite3_prepare16().  Ticket [3fe897352e].

FossilOrigin-Name: a96b4e8c01d167d35b9ec08ee6603e52ead601b6

manifest
manifest.uuid
src/utf.c

index bfced0e968c6edf1dcbf1dd447003a5b1cc2788d..7136f23187f06f7d256799f5c9ba299b4e7b63ee 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,8 @@
-C In\sshell,\smodified\sto\snot\sprint\sinformational\smessages\sduring\sstartup\swhile\sin\s"batch\smode".\nTicket\s[2cb66577f6].
-D 2009-10-24T02:06:15
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+C Another\sattempt\sat\sgetting\sthe\spTail\spointer\scomputations\scorrect\sfor\nsqlite3_prepare16().\s\sTicket\s[3fe897352e].
+D 2009-10-24T03:04:10
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in a77dfde96ad86aafd3f71651a4333a104debe86a
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -202,7 +205,7 @@ F src/test_wsd.c 3ae5101de6cbfda2720152ab659ea84079719241
 F src/tokenize.c af8a56e6a50c5042fc305bfa796275e9bf26ff2b
 F src/trigger.c 2053afa9952f69cf451bc0e6ea88072701f2925e
 F src/update.c 8e8535f66c32d946199cb1caad19646a97ead3a7
-F src/utf.c 2395dfcd72e0da4dbc75ff7e113bd415562750aa
+F src/utf.c 3586a6a2457c5c88b6816f6cda58a54e291883f8
 F src/util.c 59d4e9456bf1fe581f415a783fa0cee6115c8f35
 F src/vacuum.c 48e1282bbd5eac4b461587c51658378658c00770
 F src/vdbe.c f0d6e7dbd4515758c188c9dd7025eb9dfcf021e0
@@ -761,7 +764,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 7201244e67c197f16d6752cc0fa7232a9664381e
-R 60ab33709c976a2fa35fbf9d45e0d905
-U shane
-Z c3ee7cc5ac51065bd4726a67a8531686
+P e3898e25cf0ea870612eeaca6af2396f0eab0e07
+R 812e08bbbda7f3c1c20cc13eab0908b5
+U drh
+Z a77b23ae4660d0446d23e96276a09fed
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.6 (GNU/Linux)
+
+iD8DBQFK4m6toxKgR168RlERArtJAJ9QVy9jQaoZqiU28dnOR4bS/6L/8ACfWKTS
+yTokoUWQvjoZJq2ypxGLloM=
+=2RLp
+-----END PGP SIGNATURE-----
index 1cc4e288b68bd9d106bc229e67894d26de14369c..0b425e84202ef29dc5e257c19e7ffc7f65a2cceb 100644 (file)
@@ -1 +1 @@
-e3898e25cf0ea870612eeaca6af2396f0eab0e07
\ No newline at end of file
+a96b4e8c01d167d35b9ec08ee6603e52ead601b6
\ No newline at end of file
index d5ca6a1db29c30014f9e71b9baadf92cbcb660e3..30db9a905e665aee09fb4e79da82b1b78729384c 100644 (file)
--- a/src/utf.c
+++ b/src/utf.c
@@ -107,20 +107,20 @@ static const unsigned char sqlite3Utf8Trans1[] = {
   }                                                                 \
 }
 
-#define READ_UTF16LE(zIn, zTerm, c){                                  \
+#define READ_UTF16LE(zIn, TERM, c){                                   \
   c = (*zIn++);                                                       \
   c += ((*zIn++)<<8);                                                 \
-  if( c>=0xD800 && c<0xE000 && zIn<zTerm ){                           \
+  if( c>=0xD800 && c<0xE000 && TERM ){                                \
     int c2 = (*zIn++);                                                \
     c2 += ((*zIn++)<<8);                                              \
     c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10);   \
   }                                                                   \
 }
 
-#define READ_UTF16BE(zIn, zTerm, c){                                  \
+#define READ_UTF16BE(zIn, TERM, c){                                   \
   c = ((*zIn++)<<8);                                                  \
   c += (*zIn++);                                                      \
-  if( c>=0xD800 && c<0xE000 && zIn<zTerm ){                           \
+  if( c>=0xD800 && c<0xE000 && TERM ){                                \
     int c2 = ((*zIn++)<<8);                                           \
     c2 += (*zIn++);                                                   \
     c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10);   \
@@ -305,13 +305,13 @@ int sqlite3VdbeMemTranslate(Mem *pMem, u8 desiredEnc){
     if( pMem->enc==SQLITE_UTF16LE ){
       /* UTF-16 Little-endian -> UTF-8 */
       while( zIn<zTerm ){
-        READ_UTF16LE(zIn, zTerm, c); 
+        READ_UTF16LE(zIn, zIn<zTerm, c); 
         WRITE_UTF8(z, c);
       }
     }else{
       /* UTF-16 Big-endian -> UTF-8 */
       while( zIn<zTerm ){
-        READ_UTF16BE(zIn, zTerm, c); 
+        READ_UTF16BE(zIn, zIn<zTerm, c); 
         WRITE_UTF8(z, c);
       }
     }
@@ -481,38 +481,23 @@ char *sqlite3Utf8to16(sqlite3 *db, u8 enc, char *z, int n, int *pnOut){
 #endif
 
 /*
-** pZ is a UTF-16 encoded unicode string at least nChar characters long.
+** zIn is a UTF-16 encoded unicode string at least nChar characters long.
 ** Return the number of bytes in the first nChar unicode characters
 ** in pZ.  nChar must be non-negative.
 */
 int sqlite3Utf16ByteLen(const void *zIn, int nChar){
   int c;
   unsigned char const *z = zIn;
-  unsigned char const *zTerm;
   int n = 0;
-
-  /* Some of the characters might be surrogates.  Be careful not to terminate
-  ** the string too early because of them.   In the worst case, all characters
-  ** or surrogates so make the terminator 2*nChar from the beginning. */
-  zTerm = &z[nChar*2];
   
   if( SQLITE_UTF16NATIVE==SQLITE_UTF16BE ){
-    /* Using an "if (SQLITE_UTF16NATIVE==SQLITE_UTF16BE)" construct here
-    ** and in other parts of this file means that at one branch will
-    ** not be covered by coverage testing on any single host. But coverage
-    ** will be complete if the tests are run on both a little-endian and 
-    ** big-endian host. Because both the UTF16NATIVE and SQLITE_UTF16BE
-    ** macros are constant at compile time the compiler can determine
-    ** which branch will be followed. It is therefore assumed that no runtime
-    ** penalty is paid for this "if" statement.
-    */
     while( n<nChar ){
-      READ_UTF16BE(z, zTerm, c);
+      READ_UTF16BE(z, 1, c);
       n++;
     }
   }else{
     while( n<nChar ){
-      READ_UTF16LE(z, zTerm, c);
+      READ_UTF16LE(z, 1, c);
       n++;
     }
   }
@@ -554,7 +539,7 @@ void sqlite3UtfSelfTest(void){
     assert( n>0 && n<=4 );
     z[0] = 0;
     z = zBuf;
-    READ_UTF16LE(z, &zBuf[n], c);
+    READ_UTF16LE(z, 1, c);
     assert( c==i );
     assert( (z-zBuf)==n );
   }
@@ -566,7 +551,7 @@ void sqlite3UtfSelfTest(void){
     assert( n>0 && n<=4 );
     z[0] = 0;
     z = zBuf;
-    READ_UTF16BE(z, &zBuf[n], c);
+    READ_UTF16BE(z, 1, c);
     assert( c==i );
     assert( (z-zBuf)==n );
   }