1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-10-24 09:53:10 +03:00

Test functions tolerate an "0x" before a pointer value. Ticket #452. (CVS 1145)

FossilOrigin-Name: c6c5e07b65ae1c30117f0276a1002d5036697cf1
This commit is contained in:
drh
2003-12-23 03:06:23 +00:00
parent 93a5c6bdf4
commit 90f405e3ba
3 changed files with 13 additions and 11 deletions

View File

@@ -13,7 +13,7 @@
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
** $Id: test1.c,v 1.29 2003/12/23 02:17:35 drh Exp $
** $Id: test1.c,v 1.30 2003/12/23 03:06:23 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
@@ -30,9 +30,11 @@
/*
** Decode a pointer to an sqlite object.
*/
static int getDbPointer(Tcl_Interp *interp, const char *zArg, sqlite **ppDb){
if( sscanf(zArg, PTR_FMT, (void**)ppDb)!=1 ){
Tcl_AppendResult(interp, "\"", zArg, "\" is not a valid pointer value", 0);
static int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite **ppDb){
if( sscanf(zA, PTR_FMT, (void**)ppDb)!=1 &&
(zA[0]!='0' || zA[1]!='x' || sscanf(&zA[2], PTR_FMT, (void**)ppDb)!=1)
){
Tcl_AppendResult(interp, "\"", zA, "\" is not a valid pointer value", 0);
return TCL_ERROR;
}
return TCL_OK;