diff --git a/manifest b/manifest index d1bc89aed6..034d13a9a0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\ssure\sthe\s*pzErrMsg\sreturn\sfrom\ssqlite3_get_table()\sis\saways\szeroed.\nTicket\s#3598.\s(CVS\s6195) -D 2009-01-19T20:49:10 +C When\snot\scompiling\sfor\san\sEBCDIC\ssystem,\suse\sbuilt-in\salternatives\sto\sthe\stolowe\nr(),\stoupper()\sand\sother\sctype.h\slibrary\sfunctions.\sTicket\s#3597.\s(CVS\s6196) +D 2009-01-20T16:53:40 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 6619a1b72de7ada2bb7be97862913e27c6f5e339 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -97,7 +97,7 @@ F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc F sqlite3.def a1be7b9a4b8b51ac41c6ff6e8e44a14ef66b338b F sqlite3.pc.in ae6f59a76e862f5c561eb32a380228a02afc3cad -F src/alter.c 7eee66a6de2605a4aa6a85be6b4688b89e0f48ff +F src/alter.c 0ec29744c36c6e976596ce38c16289ebc5dc94db F src/analyze.c c86fd6a1425b22b3a46ce72ad403e4280026364f F src/attach.c 1c35f95da3c62d19de75b44cfefd12c81c1791b3 F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627 @@ -106,24 +106,24 @@ F src/btmutex.c 63c5cc4ad5715690767ffcb741e185d7bc35ec1a F src/btree.c e183a4357e8f5081fd04c757e006ef6fdaaa79a1 F src/btree.h 4f141cf748d2ee7c6d7fc175f64f87a45cd44113 F src/btreeInt.h 790482376263bbc5862ae7124354a26c70695369 -F src/build.c 6eb9d20e99db8da8c7c6e7316096a6ff3d9acab9 +F src/build.c c8bf5dcef4d5889bc57eecdb8b3dba178e5e06a8 F src/callback.c bee8949d619b1b7b1e4dfac8a19c5116ae1dd12a F src/complete.c cb14e06dbe79dee031031f0d9e686ff306afe07c -F src/date.c e010095d85c895761627bb1d0d61d021aea930a9 +F src/date.c 6fd7a113e88b229d08956c8bef7cafcc664cd01d F src/delete.c 6249005bdd8f85db6ec5f31ddb5c07de023693cc -F src/expr.c 8d19c0597bc2b7bdd88cd1975b49429e001f4838 +F src/expr.c 76dc3dc83b56ab8db50a772714fac49def8bbf12 F src/fault.c dc88c821842157460750d2d61a8a8b4197d047ff -F src/func.c b0e1c61301f33d67b72ab15d85c80ed76e7c98ac -F src/global.c 91723e45a2ad03ae5bb97a0a0d2dbb1a0e69527b +F src/func.c 74ee4010aa2282edd679f7258a5881c03c8b21be +F src/global.c 9dd8b611d5f1668164eb27d924e0f7f7b9ed786f F src/hash.c 5824e6ff7ba78cd34c8d6cd724367713583e5b55 F src/hash.h 28f38ebb1006a5beedcb013bcdfe31befe7437ae F src/hwtime.h 4a1d45f4cae1f402ea19686acf24acf4f0cb53cb F src/insert.c f6db1e6f43aae337e64a755208abb6ff124edc19 F src/journal.c cffd2cd214e58c0e99c3ff632b3bee6c7cbb260e -F src/legacy.c 4f7410b29598d991628ca40b150aa089649f17d8 -F src/loadext.c 2f53996c693a347edc2d773e9217dde49d96ae64 -F src/main.c e7cc4e3223f7dd40ceccb71d32cbb493f3e5632b -F src/malloc.c e2b4e6d7033372bd43adb0192bf5f64c0aa03c91 +F src/legacy.c 8b3b95d48d202614946d7ce7256e7ba898905c3b +F src/loadext.c 3f96631089fc4f3871a67f02f2e4fc7ea4d51edc +F src/main.c da5ff4dfbb59896af5f7b4afaef48d2fb7d08a7d +F src/malloc.c bc408056b126db37b6fba00e170d578cc67be6b3 F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c F src/mem1.c 3bfb39e4f60b0179713a7c087b2d4f0dc205735f F src/mem2.c 4c53c0071d3c68b8f252fe85d1667bad59421396 @@ -148,8 +148,8 @@ F src/parse.y b214295a91e985c42adb6bfd3ad1c56c47828e8d F src/pcache.c a3c729f4bb3464fab27617ab7411916e0cded2bf F src/pcache.h 00adba50e5b90414a40f2c63e5272c152c523373 F src/pcache1.c c0aa84ff69ea759fa944dbee9167a2463ab7c322 -F src/pragma.c 5b7ac60366b731b11cbc59352082aa5922439a98 -F src/prepare.c 2a11736383d0af2ea80aa62270f15ad80dd8b5cd +F src/pragma.c 04c13c79fd559d769f5bcb3aa661b32d484b1e7b +F src/prepare.c 9ec504ddd4a8e34e5fb502033312da6a78f5f76a F src/printf.c 9866a9a9c4a90f6d4147407f373df3fd5d5f9b6f F src/random.c 676b9d7ac820fe81e6fb2394ac8c10cff7f38628 F src/resolve.c 18dc9f0df1d60048e012ce6632251063e0dd356a @@ -158,13 +158,13 @@ F src/select.c ae72b604e47092521c4d9ae54e1b1cbeb872a747 F src/shell.c 0d801ef653fd73d17161afebaab898a58ec3524b F src/sqlite.h.in 6cd2489e40fe97ba58c60044a4ced377e08b6d09 F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17 -F src/sqliteInt.h 65b7b15aac8579b7c889416735637f10a8463002 +F src/sqliteInt.h 8ddded6a804d2055ae860e8f514c545a49840006 F src/sqliteLimit.h ffe93f5a0c4e7bd13e70cd7bf84cfb5c3465f45d F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76 F src/table.c 332ab0ea691e63862e2a8bdfe2c0617ee61062a3 F src/tclsqlite.c 7d77c3899d0244804d2773c9157e783788627762 F src/test1.c 58c0026d8764635efe8e7e7cea61e41faecef597 -F src/test2.c 87d2ee3aa13321f1bba55dc9c675b56d97dbc6b4 +F src/test2.c b0e977810ea3df8adaa2a2898ef4f6813875e840 F src/test3.c 88a246b56b824275300e6c899634fbac1dc94b14 F src/test4.c f79ab52d27ff49b784b631a42e2ccd52cfd5c84c F src/test5.c 162a1cea2105a2c460a3f39fa6919617b562a288 @@ -192,19 +192,19 @@ F src/test_server.c f0a403b5f699c09bd2b1236b6f69830fd6221f6b F src/test_tclvar.c 9e42fa59d3d2f064b7ab8628e7ab2dc8a9fe93d4 F src/test_thread.c 2575a163700ea442b15c009e2e4b0138ddf4f869 F src/test_wsd.c c297d7d6b8a990239e1bd25935e81d612d8ae31d -F src/tokenize.c aaa5fa6a4536a9dd7c855a3f66f32508f1612138 +F src/tokenize.c 6987fb7f0d6a87ac53499aee568cabb05eb4bea8 F src/trigger.c ca6d78f7c1314053800386ca64361e487774fda3 F src/update.c 8c4925f9ca664effc8a1faaad67449d2074567b1 F src/utf.c 1da9c832dba0fa8f865b5b902d93f420a1ee4245 -F src/util.c 7b1e3987e1ae6b3aa773b0eb1b7391b1f72569d2 +F src/util.c f1ac1bcd3ec5e3300982031504659b6f9435de33 F src/vacuum.c 383d6297bddc011ab04a9eed110db6eaf523e8e9 -F src/vdbe.c b917020da4c14c3ea6032cc288462f4ba525ade7 +F src/vdbe.c e14b330e7b9b27dd9eb1595f47aedea30acfd521 F src/vdbe.h 03516f28bf5aca00a53c4dccd6c313f96adb94f6 F src/vdbeInt.h 5530e45fc64c1572f123aca384096e1b84cf834b F src/vdbeapi.c 85c33cfbfa56249cbe627831610afafba754477d -F src/vdbeaux.c a593c4ceaecc2508c443c6447738f74419225f0e +F src/vdbeaux.c a5db2fe6da4a49848f123af681888ba4cee6e7b4 F src/vdbeblob.c b0dcebfafedcf9c0addc7901ad98f6f986c08935 -F src/vdbemem.c 19f94b504d3da44b31aef200fa6c8e07862de2e8 +F src/vdbemem.c 06311d5c46fd703fe95ff81bd0a1b72ba0341311 F src/vtab.c e39e011d7443a8d574b1b9cde207a35522e6df43 F src/walker.c 488c2660e13224ff70c0c82761118efb547f8f0d F src/where.c e9a37defa7c0cf413a096991d6ff4ea3fc25381a @@ -697,7 +697,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P c2eabb99fe852142e54f35f423f766411d7ba6c0 -R 1ba61171a3a984cb84660491522fd174 -U drh -Z 586cbadb7bfc023f291cf235f4552059 +P 7035c35dbef72b7b4d00201a65734a6d93dd0d3e +R 290a11e6c2265b9e59ca104eb003d6fa +U danielk1977 +Z 3b48670f3dab91065d2f211cd03723d9 diff --git a/manifest.uuid b/manifest.uuid index 966f690171..f3a35aa040 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7035c35dbef72b7b4d00201a65734a6d93dd0d3e \ No newline at end of file +1041abd6784d283bebf646c54e93599522f7889d \ No newline at end of file diff --git a/src/alter.c b/src/alter.c index 9733c56cdc..f7c60266d5 100644 --- a/src/alter.c +++ b/src/alter.c @@ -12,10 +12,9 @@ ** This file contains C code routines that used to generate VDBE code ** that implements the ALTER TABLE command. ** -** $Id: alter.c,v 1.51 2008/12/10 19:26:22 drh Exp $ +** $Id: alter.c,v 1.52 2009/01/20 16:53:40 danielk1977 Exp $ */ #include "sqliteInt.h" -#include /* ** The code in this file only exists if we are not omitting the @@ -513,7 +512,7 @@ void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){ zCol = sqlite3DbStrNDup(db, (char*)pColDef->z, pColDef->n); if( zCol ){ char *zEnd = &zCol[pColDef->n-1]; - while( (zEnd>zCol && *zEnd==';') || isspace(*(unsigned char *)zEnd) ){ + while( (zEnd>zCol && *zEnd==';') || sqlite3Isspace(*zEnd) ){ *zEnd-- = '\0'; } sqlite3NestedParse(pParse, diff --git a/src/build.c b/src/build.c index c61fbb340d..27ded7ebb0 100644 --- a/src/build.c +++ b/src/build.c @@ -22,10 +22,9 @@ ** COMMIT ** ROLLBACK ** -** $Id: build.c,v 1.511 2008/12/30 06:24:58 danielk1977 Exp $ +** $Id: build.c,v 1.512 2009/01/20 16:53:40 danielk1977 Exp $ */ #include "sqliteInt.h" -#include /* ** This routine is called when a new SQL statement is beginning to @@ -1339,9 +1338,9 @@ static void identPut(char *z, int *pIdx, char *zSignedIdent){ int i, j, needQuote; i = *pIdx; for(j=0; zIdent[j]; j++){ - if( !isalnum(zIdent[j]) && zIdent[j]!='_' ) break; + if( !sqlite3Isalnum(zIdent[j]) && zIdent[j]!='_' ) break; } - needQuote = zIdent[j]!=0 || isdigit(zIdent[0]) + needQuote = zIdent[j]!=0 || sqlite3Isdigit(zIdent[0]) || sqlite3KeywordCode(zIdent, j)!=TK_ID; if( needQuote ) z[i++] = '"'; for(j=0; zIdent[j]; j++){ @@ -1712,7 +1711,7 @@ void sqlite3CreateView( sEnd.n = 0; n = (int)(sEnd.z - pBegin->z); z = (const unsigned char*)pBegin->z; - while( n>0 && (z[n-1]==';' || isspace(z[n-1])) ){ n--; } + while( n>0 && (z[n-1]==';' || sqlite3Isspace(z[n-1])) ){ n--; } sEnd.z = &z[n-1]; sEnd.n = 1; diff --git a/src/date.c b/src/date.c index ae991255e7..ea487a9709 100644 --- a/src/date.c +++ b/src/date.c @@ -16,7 +16,7 @@ ** sqlite3RegisterDateTimeFunctions() found at the bottom of the file. ** All other code has file scope. ** -** $Id: date.c,v 1.99 2008/12/20 13:18:50 drh Exp $ +** $Id: date.c,v 1.100 2009/01/20 16:53:40 danielk1977 Exp $ ** ** SQLite processes all times and dates as Julian Day numbers. The ** dates and times are stored as the number of days since noon @@ -46,7 +46,6 @@ ** Richmond, Virginia (USA) */ #include "sqliteInt.h" -#include #include #include #include @@ -118,7 +117,7 @@ static int getDigits(const char *zDate, ...){ pVal = va_arg(ap, int*); val = 0; while( N-- ){ - if( !isdigit(*(u8*)zDate) ){ + if( !sqlite3Isdigit(*zDate) ){ goto end_getDigits; } val = val*10 + *zDate - '0'; @@ -162,7 +161,7 @@ static int parseTimezone(const char *zDate, DateTime *p){ int sgn = 0; int nHr, nMn; int c; - while( isspace(*(u8*)zDate) ){ zDate++; } + while( sqlite3Isspace(*zDate) ){ zDate++; } p->tz = 0; c = *zDate; if( c=='-' ){ @@ -182,7 +181,7 @@ static int parseTimezone(const char *zDate, DateTime *p){ zDate += 5; p->tz = sgn*(nMn + nHr*60); zulu_time: - while( isspace(*(u8*)zDate) ){ zDate++; } + while( sqlite3Isspace(*zDate) ){ zDate++; } return *zDate!=0; } @@ -206,10 +205,10 @@ static int parseHhMmSs(const char *zDate, DateTime *p){ return 1; } zDate += 2; - if( *zDate=='.' && isdigit((u8)zDate[1]) ){ + if( *zDate=='.' && sqlite3Isdigit(zDate[1]) ){ double rScale = 1.0; zDate++; - while( isdigit(*(u8*)zDate) ){ + while( sqlite3Isdigit(*zDate) ){ ms = ms*10.0 + *zDate - '0'; rScale *= 10.0; zDate++; @@ -294,7 +293,7 @@ static int parseYyyyMmDd(const char *zDate, DateTime *p){ return 1; } zDate += 10; - while( isspace(*(u8*)zDate) || 'T'==*(u8*)zDate ){ zDate++; } + while( sqlite3Isspace(*zDate) || 'T'==*(u8*)zDate ){ zDate++; } if( parseHhMmSs(zDate, p)==0 ){ /* We got the time */ }else if( *zDate==0 ){ @@ -641,7 +640,7 @@ static int parseModifier(const char *zMod, DateTime *p){ const char *z2 = z; DateTime tx; sqlite3_int64 day; - if( !isdigit(*(u8*)z2) ) z2++; + if( !sqlite3Isdigit(*z2) ) z2++; memset(&tx, 0, sizeof(tx)); if( parseHhMmSs(z2, &tx) ) break; computeJD(&tx); @@ -656,7 +655,7 @@ static int parseModifier(const char *zMod, DateTime *p){ break; } z += n; - while( isspace(*(u8*)z) ) z++; + while( sqlite3Isspace(*z) ) z++; n = sqlite3Strlen30(z); if( n>10 || n<3 ) break; if( z[n-1]=='s' ){ z[n-1] = 0; n--; } diff --git a/src/expr.c b/src/expr.c index 6e114719d2..746b598a8c 100644 --- a/src/expr.c +++ b/src/expr.c @@ -12,10 +12,9 @@ ** This file contains routines used for analyzing expressions and ** for generating VDBE code that evaluates expressions in SQLite. ** -** $Id: expr.c,v 1.409 2009/01/10 13:24:51 drh Exp $ +** $Id: expr.c,v 1.410 2009/01/20 16:53:40 danielk1977 Exp $ */ #include "sqliteInt.h" -#include /* ** Return the 'affinity' of the expression pExpr if any. @@ -1452,7 +1451,7 @@ static char *dup8bytes(Vdbe *v, const char *in){ */ static void codeReal(Vdbe *v, const char *z, int n, int negateFlag, int iMem){ assert( z || v==0 || sqlite3VdbeDb(v)->mallocFailed ); - assert( !z || !isdigit(z[n]) ); + assert( !z || !sqlite3Isdigit(z[n]) ); UNUSED_PARAMETER(n); if( z ){ double value; @@ -1486,7 +1485,7 @@ static void codeInteger(Vdbe *v, Expr *pExpr, int negFlag, int iMem){ }else if( (z = (char*)pExpr->token.z)!=0 ){ int i; int n = pExpr->token.n; - assert( !isdigit(z[n]) ); + assert( !sqlite3Isdigit(z[n]) ); if( sqlite3GetInt32(z, &i) ){ if( negFlag ) i = -i; sqlite3VdbeAddOp2(v, OP_Integer, i, iMem); diff --git a/src/func.c b/src/func.c index 611f1e78e2..7a7ce8dc04 100644 --- a/src/func.c +++ b/src/func.c @@ -16,10 +16,9 @@ ** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** All other code has file scope. ** -** $Id: func.c,v 1.209 2008/12/10 23:04:13 drh Exp $ +** $Id: func.c,v 1.210 2009/01/20 16:53:40 danielk1977 Exp $ */ #include "sqliteInt.h" -#include #include #include #include "vdbeInt.h" @@ -276,14 +275,14 @@ static void upperFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ if( z1 ){ memcpy(z1, z2, n+1); for(i=0; z1[i]; i++){ - z1[i] = (char)toupper(z1[i]); + z1[i] = (char)sqlite3Toupper(z1[i]); } sqlite3_result_text(context, z1, -1, sqlite3_free); } } } static void lowerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ - char *z1; + u8 *z1; const char *z2; int i, n; if( argc<1 || SQLITE_NULL==sqlite3_value_type(argv[0]) ) return; @@ -296,9 +295,9 @@ static void lowerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ if( z1 ){ memcpy(z1, z2, n+1); for(i=0; z1[i]; i++){ - z1[i] = (char)tolower(z1[i]); + z1[i] = sqlite3Tolower(z1[i]); } - sqlite3_result_text(context, z1, -1, sqlite3_free); + sqlite3_result_text(context, (char *)z1, -1, sqlite3_free); } } } @@ -980,7 +979,7 @@ static void soundexFunc( for(i=0; zIn[i] && !isalpha(zIn[i]); i++){} if( zIn[i] ){ u8 prevcode = iCode[zIn[i]&0x7f]; - zResult[0] = toupper(zIn[i]); + zResult[0] = sqlite3Toupper(zIn[i]); for(j=1; j<4 && zIn[i]; i++){ int code = iCode[zIn[i]&0x7f]; if( code>0 ){ diff --git a/src/global.c b/src/global.c index 757b75a5c8..2b2f096a75 100644 --- a/src/global.c +++ b/src/global.c @@ -12,7 +12,7 @@ ** ** This file contains definitions of global variables and contants. ** -** $Id: global.c,v 1.9 2008/12/08 18:19:18 drh Exp $ +** $Id: global.c,v 1.10 2009/01/20 16:53:40 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -62,6 +62,71 @@ const unsigned char sqlite3UpperToLower[] = { #endif }; +/* +** The following 256 byte lookup table is used to support SQLites built-in +** equivalents to the following standard library functions: +** +** isspace() 0x01 +** isalnum() 0x02 +** isdigit() 0x04 +** isxdigit() 0x08 +** toupper() 0x20 +** +** Bit 0x20 is set if the mapped character requires translation to upper +** case. i.e. if the character is a lower-case ASCII character.character. +** If x is a lower-case ASCII character, then its upper-case equivalent +** is (x - 0x20). Therefore toupper() can be implemented as: +** +** (x & ~(map[x]&0x20)) +** +** Standard function tolower() is implemented using the sqlite3UpperToLower[] +** array. tolower() is used more often than toupper() by SQLite. +** +** SQLite's versions are identical to the standard versions assuming a +** locale of "C". They are implemented as macros in sqliteInt.h. +*/ +#ifdef SQLITE_ASCII +const unsigned char sqlite3CtypeMap[256] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00..07 ........ */ + 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, /* 08..0f ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 10..17 ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 18..1f ........ */ + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 20..27 !"#$%&' */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 28..2f ()*+,-./ */ + 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, /* 30..37 01234567 */ + 0x0e, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 38..3f 89:;<=>? */ + + 0x00, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x02, /* 40..47 @ABCDEFG */ + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, /* 48..4f HIJKLMNO */ + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, /* 50..57 PQRSTUVW */ + 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, /* 58..5f XYZ[\]^_ */ + 0x00, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x22, /* 60..67 `abcdefg */ + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, /* 68..6f hijklmno */ + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, /* 70..77 pqrstuvw */ + 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, /* 78..7f xyz{|}~. */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 80..87 ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 88..8f ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 90..97 ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 98..9f ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* a0..a7 ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* a8..af ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* b0..b7 ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* b8..bf ........ */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* c0..c7 ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* c8..cf ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* d0..d7 ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* d8..df ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* e0..e7 ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* e8..ef ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* f0..f7 ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* f8..ff ........ */ +}; +#endif + + + /* ** The following singleton contains the global configuration for ** the SQLite library. diff --git a/src/legacy.c b/src/legacy.c index 5b037f0675..e83817da75 100644 --- a/src/legacy.c +++ b/src/legacy.c @@ -14,11 +14,10 @@ ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** -** $Id: legacy.c,v 1.30 2008/12/10 19:26:24 drh Exp $ +** $Id: legacy.c,v 1.31 2009/01/20 16:53:40 danielk1977 Exp $ */ #include "sqliteInt.h" -#include /* ** Execute SQL code. Return one of the SQLITE_ success/failure @@ -115,7 +114,7 @@ int sqlite3_exec( if( rc!=SQLITE_SCHEMA ){ nRetry = 0; zSql = zLeftover; - while( isspace((unsigned char)zSql[0]) ) zSql++; + while( sqlite3Isspace(zSql[0]) ) zSql++; } break; } diff --git a/src/loadext.c b/src/loadext.c index c59cd9c1fd..0a1d1550ca 100644 --- a/src/loadext.c +++ b/src/loadext.c @@ -12,7 +12,7 @@ ** This file contains code used to dynamically load extensions into ** the SQLite library. ** -** $Id: loadext.c,v 1.57 2008/12/08 18:19:18 drh Exp $ +** $Id: loadext.c,v 1.58 2009/01/20 16:53:40 danielk1977 Exp $ */ #ifndef SQLITE_CORE @@ -21,7 +21,6 @@ #include "sqlite3ext.h" #include "sqliteInt.h" #include -#include #ifndef SQLITE_OMIT_LOAD_EXTENSION diff --git a/src/main.c b/src/main.c index 35f36661be..35272048af 100644 --- a/src/main.c +++ b/src/main.c @@ -14,10 +14,9 @@ ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** -** $Id: main.c,v 1.521 2009/01/10 16:15:22 drh Exp $ +** $Id: main.c,v 1.522 2009/01/20 16:53:41 danielk1977 Exp $ */ #include "sqliteInt.h" -#include #ifdef SQLITE_ENABLE_FTS3 # include "fts3.h" diff --git a/src/malloc.c b/src/malloc.c index f4fc0d325d..a92fae06b6 100644 --- a/src/malloc.c +++ b/src/malloc.c @@ -12,11 +12,10 @@ ** ** Memory allocation functions used throughout sqlite. ** -** $Id: malloc.c,v 1.53 2008/12/16 17:20:38 shane Exp $ +** $Id: malloc.c,v 1.54 2009/01/20 16:53:41 danielk1977 Exp $ */ #include "sqliteInt.h" #include -#include /* ** This routine runs when the memory allocator sees that the diff --git a/src/pragma.c b/src/pragma.c index 4d30fa4949..ad35d5420c 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -11,10 +11,9 @@ ************************************************************************* ** This file contains code used to implement the PRAGMA command. ** -** $Id: pragma.c,v 1.201 2009/01/13 20:14:16 drh Exp $ +** $Id: pragma.c,v 1.202 2009/01/20 16:53:41 danielk1977 Exp $ */ #include "sqliteInt.h" -#include /* Ignore this whole file if pragmas are disabled */ @@ -37,7 +36,7 @@ static u8 getSafetyLevel(const char *z){ static const u8 iLength[] = {2, 2, 3, 5, 3, 4, 4}; static const u8 iValue[] = {1, 0, 0, 0, 1, 1, 2}; int i, n; - if( isdigit(*z) ){ + if( sqlite3Isdigit(*z) ){ return (u8)atoi(z); } n = sqlite3Strlen30(z); diff --git a/src/prepare.c b/src/prepare.c index 38faaf78e0..a4448d9ad0 100644 --- a/src/prepare.c +++ b/src/prepare.c @@ -13,10 +13,9 @@ ** interface, and routines that contribute to loading the database schema ** from disk. ** -** $Id: prepare.c,v 1.104 2009/01/09 02:49:32 drh Exp $ +** $Id: prepare.c,v 1.105 2009/01/20 16:53:41 danielk1977 Exp $ */ #include "sqliteInt.h" -#include /* ** Fill the InitData structure with an error message that indicates diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 3e860feb66..63529f67ec 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.827 2009/01/16 16:23:38 danielk1977 Exp $ +** @(#) $Id: sqliteInt.h,v 1.828 2009/01/20 16:53:41 danielk1977 Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ @@ -2147,6 +2147,28 @@ int sqlite3WalkSelectFrom(Walker*, Select*); # define SQLITE_CORRUPT_BKPT SQLITE_CORRUPT #endif +/* +** The following macros mimic the standard library functions toupper(), +** isspace(), isalnum(), isdigit() and isxdigit(), respectively. The +** sqlite versions only work for ASCII characters, regardless of locale. +*/ +#ifdef SQLITE_ASCII +# define sqlite3Toupper(x) ((x)&~(sqlite3CtypeMap[(unsigned char)(x)]&0x20)) +# define sqlite3Isspace(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x01) +# define sqlite3Isalnum(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x02) +# define sqlite3Isdigit(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x04) +# define sqlite3Isxdigit(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x08) +# define sqlite3Tolower(x) (sqlite3UpperToLower[(unsigned char)(x)]) +#else +# include +# define sqlite3Toupper(x) toupper((unsigned char)(x)) +# define sqlite3Isspace(x) isspace((unsigned char)(x)) +# define sqlite3Isalnum(x) isalnum((unsigned char)(x)) +# define sqlite3Isdigit(x) isdigit((unsigned char)(x)) +# define sqlite3Isxdigit(x) isxdigit((unsigned char)(x)) +# define sqlite3Tolower(x) tolower((unsigned char)(x)) +#endif + /* ** Internal function prototypes */ @@ -2503,6 +2525,7 @@ int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **); void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8); #ifndef SQLITE_AMALGAMATION extern const unsigned char sqlite3UpperToLower[]; +extern const unsigned char sqlite3CtypeMap[]; extern SQLITE_WSD struct Sqlite3Config sqlite3Config; extern SQLITE_WSD FuncDefHash sqlite3GlobalFunctions; #endif diff --git a/src/test2.c b/src/test2.c index f8665ba7fc..8ac75a50e8 100644 --- a/src/test2.c +++ b/src/test2.c @@ -13,7 +13,7 @@ ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** -** $Id: test2.c,v 1.67 2009/01/16 16:23:38 danielk1977 Exp $ +** $Id: test2.c,v 1.68 2009/01/20 16:53:41 danielk1977 Exp $ */ #include "sqliteInt.h" #include "tcl.h" @@ -584,10 +584,10 @@ static int testBitvecBuiltinTest( if( Tcl_GetInt(interp, argv[1], &sz) ) return TCL_ERROR; z = argv[2]; while( nProg<99 && *z ){ - while( *z && !isdigit(*z) ){ z++; } + while( *z && !sqlite3Isdigit(*z) ){ z++; } if( *z==0 ) break; aProg[nProg++] = atoi(z); - while( isdigit(*z) ){ z++; } + while( sqlite3Isdigit(*z) ){ z++; } } aProg[nProg] = 0; rc = sqlite3_test_control(SQLITE_TESTCTRL_BITVEC_TEST, sz, aProg); diff --git a/src/tokenize.c b/src/tokenize.c index 9682cc2065..afc3dd639a 100644 --- a/src/tokenize.c +++ b/src/tokenize.c @@ -15,10 +15,9 @@ ** individual tokens and sends those tokens one-by-one over to the ** parser for analysis. ** -** $Id: tokenize.c,v 1.152 2008/09/01 15:52:11 drh Exp $ +** $Id: tokenize.c,v 1.153 2009/01/20 16:53:41 danielk1977 Exp $ */ #include "sqliteInt.h" -#include #include /* @@ -124,7 +123,7 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){ int i, c; switch( *z ){ case ' ': case '\t': case '\n': case '\f': case '\r': { - for(i=1; isspace(z[i]); i++){} + for(i=1; sqlite3Isspace(z[i]); i++){} *tokenType = TK_SPACE; return i; } @@ -258,7 +257,7 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){ } case '.': { #ifndef SQLITE_OMIT_FLOATING_POINT - if( !isdigit(z[1]) ) + if( !sqlite3Isdigit(z[1]) ) #endif { *tokenType = TK_DOT; @@ -270,20 +269,20 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){ case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { *tokenType = TK_INTEGER; - for(i=0; isdigit(z[i]); i++){} + for(i=0; sqlite3Isdigit(z[i]); i++){} #ifndef SQLITE_OMIT_FLOATING_POINT if( z[i]=='.' ){ i++; - while( isdigit(z[i]) ){ i++; } + while( sqlite3Isdigit(z[i]) ){ i++; } *tokenType = TK_FLOAT; } if( (z[i]=='e' || z[i]=='E') && - ( isdigit(z[i+1]) - || ((z[i+1]=='+' || z[i+1]=='-') && isdigit(z[i+2])) + ( sqlite3Isdigit(z[i+1]) + || ((z[i+1]=='+' || z[i+1]=='-') && sqlite3Isdigit(z[i+2])) ) ){ i += 2; - while( isdigit(z[i]) ){ i++; } + while( sqlite3Isdigit(z[i]) ){ i++; } *tokenType = TK_FLOAT; } #endif @@ -300,11 +299,11 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){ } case '?': { *tokenType = TK_VARIABLE; - for(i=1; isdigit(z[i]); i++){} + for(i=1; sqlite3Isdigit(z[i]); i++){} return i; } case '#': { - for(i=1; isdigit(z[i]); i++){} + for(i=1; sqlite3Isdigit(z[i]); i++){} if( i>1 ){ /* Parameters of the form #NNN (where NNN is a number) are used ** internally by sqlite3NestedParse. */ @@ -328,7 +327,7 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){ }else if( c=='(' && n>0 ){ do{ i++; - }while( (c=z[i])!=0 && !isspace(c) && c!=')' ); + }while( (c=z[i])!=0 && !sqlite3Isspace(c) && c!=')' ); if( c==')' ){ i++; }else{ @@ -350,7 +349,7 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){ if( z[1]=='\'' ){ *tokenType = TK_BLOB; for(i=2; (c=z[i])!=0 && c!='\''; i++){ - if( !isxdigit(c) ){ + if( !sqlite3Isxdigit(c) ){ *tokenType = TK_ILLEGAL; } } diff --git a/src/util.c b/src/util.c index 2846c39429..4eb01b0da1 100644 --- a/src/util.c +++ b/src/util.c @@ -14,11 +14,10 @@ ** This file contains functions for allocating memory, comparing ** strings, and stuff like that. ** -** $Id: util.c,v 1.246 2009/01/10 16:15:22 drh Exp $ +** $Id: util.c,v 1.247 2009/01/20 16:53:41 danielk1977 Exp $ */ #include "sqliteInt.h" #include -#include /* @@ -256,23 +255,23 @@ int sqlite3IsNumber(const char *z, int *realnum, u8 enc){ int incr = (enc==SQLITE_UTF8?1:2); if( enc==SQLITE_UTF16BE ) z++; if( *z=='-' || *z=='+' ) z += incr; - if( !isdigit(*(u8*)z) ){ + if( !sqlite3Isdigit(*z) ){ return 0; } z += incr; if( realnum ) *realnum = 0; - while( isdigit(*(u8*)z) ){ z += incr; } + while( sqlite3Isdigit(*z) ){ z += incr; } if( *z=='.' ){ z += incr; - if( !isdigit(*(u8*)z) ) return 0; - while( isdigit(*(u8*)z) ){ z += incr; } + if( !sqlite3Isdigit(*z) ) return 0; + while( sqlite3Isdigit(*z) ){ z += incr; } if( realnum ) *realnum = 1; } if( *z=='e' || *z=='E' ){ z += incr; if( *z=='+' || *z=='-' ) z += incr; - if( !isdigit(*(u8*)z) ) return 0; - while( isdigit(*(u8*)z) ){ z += incr; } + if( !sqlite3Isdigit(*z) ) return 0; + while( sqlite3Isdigit(*z) ){ z += incr; } if( realnum ) *realnum = 1; } return *z==0; @@ -296,7 +295,7 @@ int sqlite3AtoF(const char *z, double *pResult){ const char *zBegin = z; LONGDOUBLE_TYPE v1 = 0.0; int nSignificant = 0; - while( isspace(*(u8*)z) ) z++; + while( sqlite3Isspace(*z) ) z++; if( *z=='-' ){ sign = -1; z++; @@ -306,7 +305,7 @@ int sqlite3AtoF(const char *z, double *pResult){ while( z[0]=='0' ){ z++; } - while( isdigit(*(u8*)z) ){ + while( sqlite3Isdigit(*z) ){ v1 = v1*10.0 + (*z - '0'); z++; nSignificant++; @@ -320,7 +319,7 @@ int sqlite3AtoF(const char *z, double *pResult){ z++; } } - while( isdigit(*(u8*)z) ){ + while( sqlite3Isdigit(*z) ){ if( nSignificant<18 ){ v1 = v1*10.0 + (*z - '0'); divisor *= 10.0; @@ -341,7 +340,7 @@ int sqlite3AtoF(const char *z, double *pResult){ }else if( *z=='+' ){ z++; } - while( isdigit(*(u8*)z) ){ + while( sqlite3Isdigit(*z) ){ eval = eval*10 + *z - '0'; z++; } @@ -400,7 +399,7 @@ int sqlite3Atoi64(const char *zNum, i64 *pNum){ int neg; int i, c; const char *zStart; - while( isspace(*(u8*)zNum) ) zNum++; + while( sqlite3Isspace(*zNum) ) zNum++; if( *zNum=='-' ){ neg = 1; zNum++; diff --git a/src/vdbe.c b/src/vdbe.c index 60ce2d0945..9fe0e823c1 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -43,10 +43,9 @@ ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** -** $Id: vdbe.c,v 1.811 2009/01/14 00:55:10 drh Exp $ +** $Id: vdbe.c,v 1.812 2009/01/20 16:53:41 danielk1977 Exp $ */ #include "sqliteInt.h" -#include #include "vdbeInt.h" /* diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 059958c0e8..488d53c4bf 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -14,10 +14,9 @@ ** to version 2.8.7, all this code was combined into the vdbe.c source file. ** But that file was getting too big so this subroutines were split out. ** -** $Id: vdbeaux.c,v 1.432 2009/01/16 16:23:38 danielk1977 Exp $ +** $Id: vdbeaux.c,v 1.433 2009/01/20 16:53:41 danielk1977 Exp $ */ #include "sqliteInt.h" -#include #include "vdbeInt.h" @@ -963,7 +962,7 @@ void sqlite3VdbePrintSql(Vdbe *p){ pOp = &p->aOp[0]; if( pOp->opcode==OP_Trace && pOp->p4.z!=0 ){ const char *z = pOp->p4.z; - while( isspace(*(u8*)z) ) z++; + while( sqlite3Isspace(*z) ) z++; printf("SQL: [%s]\n", z); } } @@ -983,9 +982,9 @@ void sqlite3VdbeIOTraceSql(Vdbe *p){ int i, j; char z[1000]; sqlite3_snprintf(sizeof(z), z, "%s", pOp->p4.z); - for(i=0; isspace((unsigned char)z[i]); i++){} + for(i=0; sqlite3Isspace(z[i]); i++){} for(j=0; z[i]; i++){ - if( isspace((unsigned char)z[i]) ){ + if( sqlite3Isspace(z[i]) ){ if( z[i-1]!=' ' ){ z[j++] = ' '; } diff --git a/src/vdbemem.c b/src/vdbemem.c index f97d4a9507..8c4af32fda 100644 --- a/src/vdbemem.c +++ b/src/vdbemem.c @@ -15,10 +15,9 @@ ** only within the VDBE. Interface routines refer to a Mem using the ** name sqlite_value ** -** $Id: vdbemem.c,v 1.134 2009/01/05 22:30:39 drh Exp $ +** $Id: vdbemem.c,v 1.135 2009/01/20 16:53:41 danielk1977 Exp $ */ #include "sqliteInt.h" -#include #include "vdbeInt.h" /*