aboutsummaryrefslogtreecommitdiff
path: root/src/tclsqlite.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2008-12-10 22:15:00 +0000
committerdrh <drh@noemail.net>2008-12-10 22:15:00 +0000
commit4f21c4af30e57d39c5d7873dcab80cb35ee8ab39 (patch)
treee5e1c7fc51ec575fb5f15af56391ddcc7a7742b0 /src/tclsqlite.c
parent1bd10f8a0063bcbcb75b99f48e70ae312e145aae (diff)
downloadsqlite-4f21c4af30e57d39c5d7873dcab80cb35ee8ab39.tar.gz
sqlite-4f21c4af30e57d39c5d7873dcab80cb35ee8ab39.zip
Fix an issue with the new sqlite3Strlen30() introduced by
check-in (6007). Additional casts for compiler warnings. (CVS 6011) FossilOrigin-Name: 258722b6178f60eaccef1675aab3edc456d413a5
Diffstat (limited to 'src/tclsqlite.c')
-rw-r--r--src/tclsqlite.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/tclsqlite.c b/src/tclsqlite.c
index db31af6d0..b9b349107 100644
--- a/src/tclsqlite.c
+++ b/src/tclsqlite.c
@@ -12,7 +12,7 @@
** A TCL Interface to SQLite. Append this file to sqlite3.c and
** compile the whole thing to build a TCL-enabled version of SQLite.
**
-** $Id: tclsqlite.c,v 1.229 2008/12/10 19:26:24 drh Exp $
+** $Id: tclsqlite.c,v 1.230 2008/12/10 22:15:00 drh Exp $
*/
#include "tcl.h"
#include <errno.h>
@@ -134,7 +134,7 @@ struct IncrblobChannel {
** Compute a string length that is limited to what can be stored in
** lower 30 bits of a 32-bit signed integer.
*/
-int sqlite3Strlen30(const char *z){
+static int strlen30(const char *z){
const char *z2 = z;
while( *z2 ){ z2++; }
return 0x3fffffff & (int)(z2 - z);
@@ -397,7 +397,7 @@ static int safeToUseEvalObjv(Tcl_Interp *interp, Tcl_Obj *pCmd){
static SqlFunc *findSqlFunc(SqliteDb *pDb, const char *zName){
SqlFunc *p, *pNew;
int i;
- pNew = (SqlFunc*)Tcl_Alloc( sizeof(*pNew) + sqlite3Strlen30(zName) + 1 );
+ pNew = (SqlFunc*)Tcl_Alloc( sizeof(*pNew) + strlen30(zName) + 1 );
pNew->zName = (char*)&pNew[1];
for(i=0; zName[i]; i++){ pNew->zName[i] = tolower(zName[i]); }
pNew->zName[i] = 0;
@@ -1352,8 +1352,8 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
zConflict = Tcl_GetStringFromObj(objv[2], 0);
zTable = Tcl_GetStringFromObj(objv[3], 0);
zFile = Tcl_GetStringFromObj(objv[4], 0);
- nSep = sqlite3Strlen30(zSep);
- nNull = sqlite3Strlen30(zNull);
+ nSep = strlen30(zSep);
+ nNull = strlen30(zNull);
if( nSep==0 ){
Tcl_AppendResult(interp,"Error: non-null separator required for copy",0);
return TCL_ERROR;
@@ -1373,7 +1373,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
Tcl_AppendResult(interp, "Error: no such table: ", zTable, 0);
return TCL_ERROR;
}
- nByte = sqlite3Strlen30(zSql);
+ nByte = strlen30(zSql);
rc = sqlite3_prepare(pDb->db, zSql, -1, &pStmt, 0);
sqlite3_free(zSql);
if( rc ){
@@ -1393,7 +1393,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
}
sqlite3_snprintf(nByte+50, zSql, "INSERT OR %q INTO '%q' VALUES(?",
zConflict, zTable);
- j = sqlite3Strlen30(zSql);
+ j = strlen30(zSql);
for(i=1; i<nCol; i++){
zSql[j++] = ',';
zSql[j++] = '?';
@@ -1438,7 +1438,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
}
if( i+1!=nCol ){
char *zErr;
- int nErr = sqlite3Strlen30(zFile) + 200;
+ int nErr = strlen30(zFile) + 200;
zErr = malloc(nErr);
if( zErr ){
sqlite3_snprintf(nErr, zErr,
@@ -1453,7 +1453,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
for(i=0; i<nCol; i++){
/* check for null data, if so, bind as null */
if( (nNull>0 && strcmp(azCol[i], zNull)==0)
- || sqlite3Strlen30(azCol[i])==0
+ || strlen30(azCol[i])==0
){
sqlite3_bind_null(pStmt, i+1);
}else{
@@ -1595,7 +1595,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
** which matches the next sequence of SQL.
*/
pStmt = 0;
- len = sqlite3Strlen30(zSql);
+ len = strlen30(zSql);
for(pPreStmt = pDb->stmtList; pPreStmt; pPreStmt=pPreStmt->pNext){
int n = pPreStmt->nSql;
if( len>=n
@@ -1848,7 +1848,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
pPreStmt->pStmt = pStmt;
pPreStmt->nSql = len;
pPreStmt->zSql = sqlite3_sql(pStmt);
- assert( sqlite3Strlen30(pPreStmt->zSql)==len );
+ assert( strlen30(pPreStmt->zSql)==len );
assert( 0==memcmp(pPreStmt->zSql, zSql, len) );
}
@@ -1909,7 +1909,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
int nArg = -1;
if( objc==6 ){
const char *z = Tcl_GetString(objv[3]);
- int n = sqlite3Strlen30(z);
+ int n = strlen30(z);
if( n>2 && strncmp(z, "-argcount",n)==0 ){
if( Tcl_GetIntFromObj(interp, objv[4], &nArg) ) return TCL_ERROR;
if( nArg<0 ){