SQLite

Check-in [c6c5e07b65]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Test functions tolerate an "0x" before a pointer value. Ticket #452. (CVS 1145)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c6c5e07b65ae1c30117f0276a1002d5036697cf1
User & Date: drh 2003-12-23 03:06:23.000
Context
2003-12-23
16:22
Add localtime<-->UTC conversions to the date functions. (CVS 1146) (check-in: 8482b8c447 user: drh tags: trunk)
03:06
Test functions tolerate an "0x" before a pointer value. Ticket #452. (CVS 1145) (check-in: c6c5e07b65 user: drh tags: trunk)
02:17
Use a built-in atof() function instead of the one from the library to avoid problems with locale. Ticket #305. (CVS 1144) (check-in: 4d9edbc50f user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/test1.c.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34


35
36
37
38
39
40
41
42
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Code for testing the printf() interface to SQLite.  This code
** 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 $
*/
#include "sqliteInt.h"
#include "tcl.h"
#include "os.h"
#include <stdlib.h>
#include <string.h>

#if OS_WIN
# define PTR_FMT "%x"
#else
# define PTR_FMT "%p"
#endif

/*
** 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);
    return TCL_ERROR;
  }
  return TCL_OK;
}

/*
** Decode a pointer to an sqlite_vm object.







|
















|
|
>
>
|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Code for testing the printf() interface to SQLite.  This code
** is not included in the SQLite library.  It is used for automated
** testing of the SQLite library.
**
** $Id: test1.c,v 1.30 2003/12/23 03:06:23 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
#include "os.h"
#include <stdlib.h>
#include <string.h>

#if OS_WIN
# define PTR_FMT "%x"
#else
# define PTR_FMT "%p"
#endif

/*
** Decode a pointer to an sqlite object.
*/
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;
}

/*
** Decode a pointer to an sqlite_vm object.