aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/global.c2
-rw-r--r--src/main.c10
-rw-r--r--src/memjournal.c4
-rw-r--r--src/os.h6
-rw-r--r--src/sqliteInt.h2
-rw-r--r--src/test2.c2
-rw-r--r--src/vdbeaux.c15
7 files changed, 29 insertions, 12 deletions
diff --git a/src/global.c b/src/global.c
index 673a274cc..d2dbe4aeb 100644
--- a/src/global.c
+++ b/src/global.c
@@ -194,7 +194,9 @@ SQLITE_WSD FuncDefHash sqlite3GlobalFunctions;
** Changing the pending byte during operating results in undefined
** and dileterious behavior.
*/
+#ifndef SQLITE_OMIT_WSD
int sqlite3PendingByte = 0x40000000;
+#endif
#include "opcodes.h"
/*
diff --git a/src/main.c b/src/main.c
index 726140152..5b715a12d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2381,9 +2381,13 @@ int sqlite3_test_control(int op, ...){
** dileterious behavior.
*/
case SQLITE_TESTCTRL_PENDING_BYTE: {
- unsigned int newVal = va_arg(ap, unsigned int);
- rc = sqlite3PendingByte;
- if( newVal ) sqlite3PendingByte = newVal;
+ rc = PENDING_BYTE;
+#ifndef SQLITE_OMIT_WSD
+ {
+ unsigned int newVal = va_arg(ap, unsigned int);
+ if( newVal ) sqlite3PendingByte = newVal;
+ }
+#endif
break;
}
diff --git a/src/memjournal.c b/src/memjournal.c
index f042475dc..048304b75 100644
--- a/src/memjournal.c
+++ b/src/memjournal.c
@@ -213,7 +213,7 @@ static int memjrnlFileSize(sqlite3_file *pJfd, sqlite_int64 *pSize){
/*
** Table of methods for MemJournal sqlite3_file object.
*/
-static struct sqlite3_io_methods MemJournalMethods = {
+static const struct sqlite3_io_methods MemJournalMethods = {
1, /* iVersion */
memjrnlClose, /* xClose */
memjrnlRead, /* xRead */
@@ -236,7 +236,7 @@ void sqlite3MemJournalOpen(sqlite3_file *pJfd){
MemJournal *p = (MemJournal *)pJfd;
assert( EIGHT_BYTE_ALIGNMENT(p) );
memset(p, 0, sqlite3MemJournalSize());
- p->pMethod = &MemJournalMethods;
+ p->pMethod = (sqlite3_io_methods*)&MemJournalMethods;
}
/*
diff --git a/src/os.h b/src/os.h
index 670ee43d3..001732798 100644
--- a/src/os.h
+++ b/src/os.h
@@ -217,7 +217,11 @@
** 1GB boundary.
**
*/
-#define PENDING_BYTE sqlite3PendingByte
+#ifdef SQLITE_OMIT_WSD
+# define PENDING_BYTE (0x40000000)
+#else
+# define PENDING_BYTE sqlite3PendingByte
+#endif
#define RESERVED_BYTE (PENDING_BYTE+1)
#define SHARED_FIRST (PENDING_BYTE+2)
#define SHARED_SIZE 510
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index eed2b10ed..851cb273e 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -2886,8 +2886,10 @@ extern const unsigned char sqlite3UpperToLower[];
extern const unsigned char sqlite3CtypeMap[];
extern SQLITE_WSD struct Sqlite3Config sqlite3Config;
extern SQLITE_WSD FuncDefHash sqlite3GlobalFunctions;
+#ifndef SQLITE_OMIT_WSD
extern int sqlite3PendingByte;
#endif
+#endif
void sqlite3RootPageMoved(Db*, int, int);
void sqlite3Reindex(Parse*, Token*, Token*);
void sqlite3AlterFunctions(void);
diff --git a/src/test2.c b/src/test2.c
index 994bc1a77..520ad7306 100644
--- a/src/test2.c
+++ b/src/test2.c
@@ -675,7 +675,9 @@ int Sqlitetest2_Init(Tcl_Interp *interp){
(char*)&sqlite3_diskfull_pending, TCL_LINK_INT);
Tcl_LinkVar(interp, "sqlite_diskfull",
(char*)&sqlite3_diskfull, TCL_LINK_INT);
+#ifndef SQLITE_OMIT_WSD
Tcl_LinkVar(interp, "sqlite_pending_byte",
(char*)&sqlite3PendingByte, TCL_LINK_INT | TCL_LINK_READ_ONLY);
+#endif
return TCL_OK;
}
diff --git a/src/vdbeaux.c b/src/vdbeaux.c
index 01d4241a9..45320af7f 100644
--- a/src/vdbeaux.c
+++ b/src/vdbeaux.c
@@ -814,9 +814,12 @@ void sqlite3VdbeNoopComment(Vdbe *p, const char *zFormat, ...){
**
** If a memory allocation error has occurred prior to the calling of this
** routine, then a pointer to a dummy VdbeOp will be returned. That opcode
-** is readable and writable, but it has no effect. The return of a dummy
-** opcode allows the call to continue functioning after a OOM fault without
-** having to check to see if the return from this routine is a valid pointer.
+** is readable but not writable, though it is cast to a writable value.
+** The return of a dummy opcode allows the call to continue functioning
+** after a OOM fault without having to check to see if the return from
+** this routine is a valid pointer. But because the dummy.opcode is 0,
+** dummy will never be written to. This is verified by code inspection and
+** by running with Valgrind.
**
** About the #ifdef SQLITE_OMIT_TRACE: Normally, this routine is never called
** unless p->nOp>0. This is because in the absense of SQLITE_OMIT_TRACE,
@@ -827,17 +830,17 @@ void sqlite3VdbeNoopComment(Vdbe *p, const char *zFormat, ...){
** check the value of p->nOp-1 before continuing.
*/
VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){
- static VdbeOp dummy;
+ static const VdbeOp dummy;
assert( p->magic==VDBE_MAGIC_INIT );
if( addr<0 ){
#ifdef SQLITE_OMIT_TRACE
- if( p->nOp==0 ) return &dummy;
+ if( p->nOp==0 ) return (VdbeOp*)&dummy;
#endif
addr = p->nOp - 1;
}
assert( (addr>=0 && addr<p->nOp) || p->db->mallocFailed );
if( p->db->mallocFailed ){
- return &dummy;
+ return (VdbeOp*)&dummy;
}else{
return &p->aOp[addr];
}