summaryrefslogtreecommitdiff
path: root/src/test3.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/test3.c')
-rw-r--r--src/test3.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/test3.c b/src/test3.c
index 4eabdcc..e460c42 100644
--- a/src/test3.c
+++ b/src/test3.c
@@ -66,6 +66,8 @@ static int btree_open(
Btree *pBt;
int rc, nCache;
char zBuf[100];
+ int n;
+ char *zFilename;
if( argc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
" FILENAME NCACHE FLAGS\"", 0);
@@ -78,8 +80,14 @@ static int btree_open(
sDb.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_RECURSIVE);
sqlite3_mutex_enter(sDb.mutex);
}
- rc = sqlite3BtreeOpen(sDb.pVfs, argv[1], &sDb, &pBt, 0,
+ n = (int)strlen(argv[1]);
+ zFilename = sqlite3_malloc( n+2 );
+ if( zFilename==0 ) return TCL_ERROR;
+ memcpy(zFilename, argv[1], n+1);
+ zFilename[n+1] = 0;
+ rc = sqlite3BtreeOpen(sDb.pVfs, zFilename, &sDb, &pBt, 0,
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_MAIN_DB);
+ sqlite3_free(zFilename);
if( rc!=SQLITE_OK ){
Tcl_AppendResult(interp, errorName(rc), 0);
return TCL_ERROR;
@@ -457,7 +465,7 @@ static int btree_varint_test(
if( Tcl_GetInt(interp, argv[4], (int*)&incr) ) return TCL_ERROR;
in = start;
in *= mult;
- for(i=0; i<count; i++){
+ for(i=0; i<(int)count; i++){
char zErr[200];
n1 = putVarint(zBuf, in);
if( n1>9 || n1<1 ){