$OpenBSD: patch-src_test2_c,v 1.1 2005/12/21 07:58:32 jolan Exp $ --- src/test2.c.orig Sat Apr 23 17:43:22 2005 +++ src/test2.c Wed Dec 21 01:47:37 2005 @@ -19,6 +19,7 @@ #include "sqliteInt.h" #include "pager.h" #include "tcl.h" +#include "test-util.h" #include #include @@ -104,7 +105,7 @@ static int pager_close( " ID\"", 0); return TCL_ERROR; } - if( Tcl_GetInt(interp, argv[1], (int*)&pPager) ) return TCL_ERROR; + pPager = sqliteTextToPtr(argv[1]); rc = sqlitepager_close(pPager); if( rc!=SQLITE_OK ){ Tcl_AppendResult(interp, errorName(rc), 0); @@ -131,7 +132,7 @@ static int pager_rollback( " ID\"", 0); return TCL_ERROR; } - if( Tcl_GetInt(interp, argv[1], (int*)&pPager) ) return TCL_ERROR; + pPager = sqliteTextToPtr(argv[1]); rc = sqlitepager_rollback(pPager); if( rc!=SQLITE_OK ){ Tcl_AppendResult(interp, errorName(rc), 0); @@ -158,7 +159,7 @@ static int pager_commit( " ID\"", 0); return TCL_ERROR; } - if( Tcl_GetInt(interp, argv[1], (int*)&pPager) ) return TCL_ERROR; + pPager = sqliteTextToPtr(argv[1]); rc = sqlitepager_commit(pPager); if( rc!=SQLITE_OK ){ Tcl_AppendResult(interp, errorName(rc), 0); @@ -185,7 +186,7 @@ static int pager_ckpt_begin( " ID\"", 0); return TCL_ERROR; } - if( Tcl_GetInt(interp, argv[1], (int*)&pPager) ) return TCL_ERROR; + pPager = sqliteTextToPtr(argv[1]); rc = sqlitepager_ckpt_begin(pPager); if( rc!=SQLITE_OK ){ Tcl_AppendResult(interp, errorName(rc), 0); @@ -212,7 +213,7 @@ static int pager_ckpt_rollback( " ID\"", 0); return TCL_ERROR; } - if( Tcl_GetInt(interp, argv[1], (int*)&pPager) ) return TCL_ERROR; + pPager = sqliteTextToPtr(argv[1]); rc = sqlitepager_ckpt_rollback(pPager); if( rc!=SQLITE_OK ){ Tcl_AppendResult(interp, errorName(rc), 0); @@ -239,7 +240,7 @@ static int pager_ckpt_commit( " ID\"", 0); return TCL_ERROR; } - if( Tcl_GetInt(interp, argv[1], (int*)&pPager) ) return TCL_ERROR; + pPager = sqliteTextToPtr(argv[1]); rc = sqlitepager_ckpt_commit(pPager); if( rc!=SQLITE_OK ){ Tcl_AppendResult(interp, errorName(rc), 0); @@ -266,7 +267,7 @@ static int pager_stats( " ID\"", 0); return TCL_ERROR; } - if( Tcl_GetInt(interp, argv[1], (int*)&pPager) ) return TCL_ERROR; + pPager = sqliteTextToPtr(argv[1]); a = sqlitepager_stats(pPager); for(i=0; i<9; i++){ static char *zName[] = { @@ -299,7 +300,7 @@ static int pager_pagecount( " ID\"", 0); return TCL_ERROR; } - if( Tcl_GetInt(interp, argv[1], (int*)&pPager) ) return TCL_ERROR; + pPager = sqliteTextToPtr(argv[1]); sprintf(zBuf,"%d",sqlitepager_pagecount(pPager)); Tcl_AppendResult(interp, zBuf, 0); return TCL_OK; @@ -326,7 +327,7 @@ static int page_get( " ID PGNO\"", 0); return TCL_ERROR; } - if( Tcl_GetInt(interp, argv[1], (int*)&pPager) ) return TCL_ERROR; + pPager = sqliteTextToPtr(argv[1]); if( Tcl_GetInt(interp, argv[2], &pgno) ) return TCL_ERROR; rc = sqlitepager_get(pPager, pgno, &pPage); if( rc!=SQLITE_OK ){ @@ -359,7 +360,7 @@ static int page_lookup( " ID PGNO\"", 0); return TCL_ERROR; } - if( Tcl_GetInt(interp, argv[1], (int*)&pPager) ) return TCL_ERROR; + pPager = sqliteTextToPtr(argv[1]); if( Tcl_GetInt(interp, argv[2], &pgno) ) return TCL_ERROR; pPage = sqlitepager_lookup(pPager, pgno); if( pPage ){ @@ -387,7 +388,7 @@ static int page_unref( " PAGE\"", 0); return TCL_ERROR; } - if( Tcl_GetInt(interp, argv[1], (int*)&pPage) ) return TCL_ERROR; + pPage = sqliteTextToPtr(argv[1]); rc = sqlitepager_unref(pPage); if( rc!=SQLITE_OK ){ Tcl_AppendResult(interp, errorName(rc), 0); @@ -414,7 +415,7 @@ static int page_read( " PAGE\"", 0); return TCL_ERROR; } - if( Tcl_GetInt(interp, argv[1], (int*)&pPage) ) return TCL_ERROR; + pPage = sqliteTextToPtr(argv[1]); memcpy(zBuf, pPage, sizeof(zBuf)); Tcl_AppendResult(interp, zBuf, 0); return TCL_OK; @@ -438,7 +439,7 @@ static int page_number( " PAGE\"", 0); return TCL_ERROR; } - if( Tcl_GetInt(interp, argv[1], (int*)&pPage) ) return TCL_ERROR; + pPage = sqliteTextToPtr(argv[1]); sprintf(zBuf, "%d", sqlitepager_pagenumber(pPage)); Tcl_AppendResult(interp, zBuf, 0); return TCL_OK; @@ -462,7 +463,7 @@ static int page_write( " PAGE DATA\"", 0); return TCL_ERROR; } - if( Tcl_GetInt(interp, argv[1], (int*)&pPage) ) return TCL_ERROR; + pPage = sqliteTextToPtr(argv[1]); rc = sqlitepager_write(pPage); if( rc!=SQLITE_OK ){ Tcl_AppendResult(interp, errorName(rc), 0);