aboutsummaryrefslogtreecommitdiff
path: root/src/tclsqlite.c
diff options
context:
space:
mode:
authordrh <>2023-06-17 15:42:44 +0000
committerdrh <>2023-06-17 15:42:44 +0000
commit8e5cef7bcaf4b64eecfdd92ebd3aeff780bb8d4f (patch)
tree74e7abf820bb1c2f1e6abc21ed7a3c71cc4a7778 /src/tclsqlite.c
parent0587a1a8bbc87b86e623f4020af114871e789ab6 (diff)
downloadsqlite-8e5cef7bcaf4b64eecfdd92ebd3aeff780bb8d4f.tar.gz
sqlite-8e5cef7bcaf4b64eecfdd92ebd3aeff780bb8d4f.zip
Fix harmless compiler warnings that show up on 32-bit RaspberryPI builds.
FossilOrigin-Name: bc4d20f362925e4ce5c79f0d7a27a8e9bbac92525bd4cea2ae983798e3f8c37d
Diffstat (limited to 'src/tclsqlite.c')
-rw-r--r--src/tclsqlite.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/tclsqlite.c b/src/tclsqlite.c
index f7a04b699..d91b2fa3f 100644
--- a/src/tclsqlite.c
+++ b/src/tclsqlite.c
@@ -55,6 +55,25 @@
# include <string.h>
# include <assert.h>
typedef unsigned char u8;
+# ifndef SQLITE_PTRSIZE
+# if defined(__SIZEOF_POINTER__)
+# define SQLITE_PTRSIZE __SIZEOF_POINTER__
+# elif defined(i386) || defined(__i386__) || defined(_M_IX86) || \
+ defined(_M_ARM) || defined(__arm__) || defined(__x86) || \
+ (defined(__APPLE__) && defined(__POWERPC__)) || \
+ (defined(__TOS_AIX__) && !defined(__64BIT__))
+# define SQLITE_PTRSIZE 4
+# else
+# define SQLITE_PTRSIZE 8
+# endif
+# endif /* SQLITE_PTRSIZE */
+# if defined(HAVE_STDINT_H)
+ typedef uintptr_t uptr;
+# elif SQLITE_PTRSIZE==4
+ typedef unsigned int uptr;
+# else
+ typedef sqlite3_uint64 uptr;
+# endif
#endif
#include <ctype.h>
@@ -675,7 +694,7 @@ static int DbTraceV2Handler(
pCmd = Tcl_NewStringObj(pDb->zTraceV2, -1);
Tcl_IncrRefCount(pCmd);
Tcl_ListObjAppendElement(pDb->interp, pCmd,
- Tcl_NewWideIntObj((Tcl_WideInt)pStmt));
+ Tcl_NewWideIntObj((Tcl_WideInt)(uptr)pStmt));
Tcl_ListObjAppendElement(pDb->interp, pCmd,
Tcl_NewStringObj(zSql, -1));
Tcl_EvalObjEx(pDb->interp, pCmd, TCL_EVAL_DIRECT);
@@ -690,7 +709,7 @@ static int DbTraceV2Handler(
pCmd = Tcl_NewStringObj(pDb->zTraceV2, -1);
Tcl_IncrRefCount(pCmd);
Tcl_ListObjAppendElement(pDb->interp, pCmd,
- Tcl_NewWideIntObj((Tcl_WideInt)pStmt));
+ Tcl_NewWideIntObj((Tcl_WideInt)(uptr)pStmt));
Tcl_ListObjAppendElement(pDb->interp, pCmd,
Tcl_NewWideIntObj((Tcl_WideInt)ns));
Tcl_EvalObjEx(pDb->interp, pCmd, TCL_EVAL_DIRECT);
@@ -704,7 +723,7 @@ static int DbTraceV2Handler(
pCmd = Tcl_NewStringObj(pDb->zTraceV2, -1);
Tcl_IncrRefCount(pCmd);
Tcl_ListObjAppendElement(pDb->interp, pCmd,
- Tcl_NewWideIntObj((Tcl_WideInt)pStmt));
+ Tcl_NewWideIntObj((Tcl_WideInt)(uptr)pStmt));
Tcl_EvalObjEx(pDb->interp, pCmd, TCL_EVAL_DIRECT);
Tcl_DecrRefCount(pCmd);
Tcl_ResetResult(pDb->interp);
@@ -716,7 +735,7 @@ static int DbTraceV2Handler(
pCmd = Tcl_NewStringObj(pDb->zTraceV2, -1);
Tcl_IncrRefCount(pCmd);
Tcl_ListObjAppendElement(pDb->interp, pCmd,
- Tcl_NewWideIntObj((Tcl_WideInt)db));
+ Tcl_NewWideIntObj((Tcl_WideInt)(uptr)db));
Tcl_EvalObjEx(pDb->interp, pCmd, TCL_EVAL_DIRECT);
Tcl_DecrRefCount(pCmd);
Tcl_ResetResult(pDb->interp);