Index: src/loadext.c ================================================================== --- src/loadext.c +++ src/loadext.c @@ -674,11 +674,11 @@ /* ** Register a statically linked extension that is automatically ** loaded by every new database connection. */ int sqlite3_auto_extension( - int (*xInit)(sqlite3 *, char **, const sqlite3_api_routines *) + void (*xInit)(void) ){ int rc = SQLITE_OK; #ifndef SQLITE_OMIT_AUTOINIT rc = sqlite3_initialize(); if( rc ){ @@ -721,11 +721,11 @@ ** ** Return 1 if xInit was found on the list and removed. Return 0 if xInit ** was not on the list. */ int sqlite3_cancel_auto_extension( - int (*xInit)(sqlite3 *, char **, const sqlite3_api_routines *) + void (*xInit)(void) ){ #if SQLITE_THREADSAFE sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); #endif int i; Index: src/sqlite.h.in ================================================================== --- src/sqlite.h.in +++ src/sqlite.h.in @@ -1043,10 +1043,20 @@ ** ** Mutexes are created using [sqlite3_mutex_alloc()]. */ typedef struct sqlite3_mutex sqlite3_mutex; +/* +** CAPI3REF: Loadable Extension Thunk +** +** A pointer to the opaque sqlite3_api_routines structure is passed as +** the third parameter to entry points of [loadable extensions]. This +** structure must be typedefed in order to work around compiler warnings +** on some platforms. +*/ +typedef struct sqlite3_api_routines sqlite3_api_routines; + /* ** CAPI3REF: OS Interface Object ** ** An instance of the sqlite3_vfs object defines the interface between ** the SQLite core and the underlying operating system. The "vfs" @@ -2240,11 +2250,11 @@ ** result in undefined behavior. ** ** A busy handler must not close the database connection ** or [prepared statement] that invoked the busy handler. */ -int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*); +int sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*); /* ** CAPI3REF: Set A Busy Timeout ** METHOD: sqlite3 ** @@ -5679,11 +5689,11 @@ ** xEntryPoint() is the entry point for a statically linked [SQLite extension] ** that is to be automatically loaded into all new database connections. ** ** ^(Even though the function prototype shows that xEntryPoint() takes ** no arguments and returns void, SQLite invokes xEntryPoint() with three -** arguments and expects and integer result as if the signature of the +** arguments and expects an integer result as if the signature of the ** entry point where as follows: ** **
** int xEntryPoint( ** sqlite3 *db, @@ -5705,14 +5715,11 @@ ** will be called more than once for each database connection that is opened. ** ** See also: [sqlite3_reset_auto_extension()] ** and [sqlite3_cancel_auto_extension()] */ -typedef struct sqlite3_api_routines sqlite3_api_routines; -int sqlite3_auto_extension( - int (*xEntryPoint)(sqlite3 *, char **, const sqlite3_api_routines *) -); +int sqlite3_auto_extension(void(*xEntryPoint)(void)); /* ** CAPI3REF: Cancel Automatic Extension Loading ** ** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the @@ -5720,13 +5727,11 @@ ** [sqlite3_auto_extension(X)]. ^The [sqlite3_cancel_auto_extension(X)] ** routine returns 1 if initialization routine X was successfully ** unregistered and it returns 0 if X was not on the list of initialization ** routines. */ -int sqlite3_cancel_auto_extension( - int (*xEntryPoint)(sqlite3 *, char **, const sqlite3_api_routines *) -); +int sqlite3_cancel_auto_extension(void(*xEntryPoint)(void)); /* ** CAPI3REF: Reset Automatic Extension Loading ** ** ^This interface disables all automatic extensions previously Index: src/sqlite3ext.h ================================================================== --- src/sqlite3ext.h +++ src/sqlite3ext.h @@ -17,12 +17,10 @@ */ #ifndef SQLITE3EXT_H #define SQLITE3EXT_H #include "sqlite3.h" -typedef struct sqlite3_api_routines sqlite3_api_routines; - /* ** The following structure holds pointers to all of the SQLite API ** routines. ** ** WARNING: In order to maintain backwards compatibility, add new @@ -249,17 +247,16 @@ sqlite3_int64 (*uri_int64)(const char*,const char*,sqlite3_int64); const char *(*uri_parameter)(const char*,const char*); char *(*vsnprintf)(int,char*,const char*,va_list); int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*); /* Version 3.8.7 and later */ - int (*auto_extension)(int(*)(sqlite3*,char**,const sqlite3_api_routines*)); + int (*auto_extension)(void(*)(void)); int (*bind_blob64)(sqlite3_stmt*,int,const void*,sqlite3_uint64, void(*)(void*)); int (*bind_text64)(sqlite3_stmt*,int,const char*,sqlite3_uint64, void(*)(void*),unsigned char); - int (*cancel_auto_extension)(int(*)(sqlite3*,char**, - const sqlite3_api_routines*)); + int (*cancel_auto_extension)(void(*)(void)); int (*load_extension)(sqlite3*,const char*,const char*,char**); void *(*malloc64)(sqlite3_uint64); sqlite3_uint64 (*msize)(void*); void *(*realloc64)(void*,sqlite3_uint64); void (*reset_auto_extension)(void); Index: src/test1.c ================================================================== --- src/test1.c +++ src/test1.c @@ -6740,11 +6740,10 @@ } sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS, db, mask); return TCL_OK; } -typedef struct sqlite3_api_routines sqlite3_api_routines; /* ** load_static_extension DB NAME ... ** ** Load one or more statically linked extensions. */ Index: src/test_autoext.c ================================================================== --- src/test_autoext.c +++ src/test_autoext.c @@ -98,11 +98,11 @@ void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ - int rc = sqlite3_auto_extension(sqr_init); + int rc = sqlite3_auto_extension((void(*)(void))sqr_init); Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return SQLITE_OK; } /* @@ -114,11 +114,11 @@ void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ - int rc = sqlite3_cancel_auto_extension(sqr_init); + int rc = sqlite3_cancel_auto_extension((void(*)(void))sqr_init); Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return SQLITE_OK; } /* @@ -130,11 +130,11 @@ void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ - int rc = sqlite3_auto_extension(cube_init); + int rc = sqlite3_auto_extension((void(*)(void))cube_init); Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return SQLITE_OK; } /* @@ -146,11 +146,11 @@ void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ - int rc = sqlite3_cancel_auto_extension(cube_init); + int rc = sqlite3_cancel_auto_extension((void(*)(void))cube_init); Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return SQLITE_OK; } /* @@ -162,11 +162,11 @@ void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ - int rc = sqlite3_auto_extension(broken_init); + int rc = sqlite3_auto_extension((void(*)(void))broken_init); Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return SQLITE_OK; } /* @@ -178,11 +178,11 @@ void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ - int rc = sqlite3_cancel_auto_extension(broken_init); + int rc = sqlite3_cancel_auto_extension((void(*)(void))broken_init); Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return SQLITE_OK; } #endif /* SQLITE_OMIT_LOAD_EXTENSION */ Index: src/test_func.c ================================================================== --- src/test_func.c +++ src/test_func.c @@ -23,11 +23,10 @@ #include#include "sqliteInt.h" #include "vdbeInt.h" - /* ** Allocate nByte bytes of space using sqlite3_malloc(). If the ** allocation fails, call sqlite3_result_error_nomem() to notify ** the database handle that malloc() has failed. */ @@ -702,13 +701,13 @@ Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ extern int Md5_Register(sqlite3 *, char **, const sqlite3_api_routines *); - int rc = sqlite3_auto_extension(registerTestFunctions); + int rc = sqlite3_auto_extension((void(*)(void))registerTestFunctions); if( rc==SQLITE_OK ){ - rc = sqlite3_auto_extension(Md5_Register); + rc = sqlite3_auto_extension((void(*)(void))Md5_Register); } Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return TCL_OK; } @@ -788,10 +787,11 @@ abuse_err: Tcl_AppendResult(interp, "sqlite3_create_function abused test failed", (char*)0); return TCL_ERROR; } + /* ** Register commands with the TCL interpreter. */ int Sqlitetest_func_Init(Tcl_Interp *interp){ @@ -807,9 +807,9 @@ for(i=0; i