Fossil SCM

Merge trunk. Update to Openssl 1.1.1b

jan.nijtmans 2019-03-01 21:46 openssl-1.1 merge
Commit b7695eeea28f9cdbfc983c1b0c752d3f4131fabbe3d3825679d9372e4457926d
--- Makefile.osx-jaguar
+++ Makefile.osx-jaguar
@@ -38,11 +38,11 @@
3838
BCCFLAGS = $(CFLAGS)
3939
4040
#### The suffix to add to final executable file. When cross-compiling
4141
# to windows, make this ".exe". Otherwise leave it blank.
4242
#
43
-E =
43
+E =
4444
4545
TCC = cc
4646
TCCFLAGS = $(CFLAGS)
4747
4848
#### Tcl shell for use in running the fossil testsuite. If you do not
@@ -59,15 +59,15 @@
5959
TCC += -DWITHOUT_ICONV
6060
TCC += -Dsocklen_t=int
6161
TCC += -DSQLITE_MAX_MMAP_SIZE=0
6262
TCC += -DFOSSIL_ENABLE_LEGACY_MV_RM=1
6363
INSTALLDIR = $(DESTDIR)/usr/local/bin
64
-USE_SYSTEM_SQLITE =
64
+USE_SYSTEM_SQLITE =
6565
USE_LINENOISE = 1
6666
# FOSSIL_ENABLE_TCL = @FOSSIL_ENABLE_TCL@
6767
FOSSIL_ENABLE_TCL = 0
6868
FOSSIL_ENABLE_MINIZ = 0
6969
7070
include $(SRCDIR)/main.mk
7171
7272
distclean: clean
7373
rm -f autoconfig.h config.log Makefile
7474
--- Makefile.osx-jaguar
+++ Makefile.osx-jaguar
@@ -38,11 +38,11 @@
38 BCCFLAGS = $(CFLAGS)
39
40 #### The suffix to add to final executable file. When cross-compiling
41 # to windows, make this ".exe". Otherwise leave it blank.
42 #
43 E =
44
45 TCC = cc
46 TCCFLAGS = $(CFLAGS)
47
48 #### Tcl shell for use in running the fossil testsuite. If you do not
@@ -59,15 +59,15 @@
59 TCC += -DWITHOUT_ICONV
60 TCC += -Dsocklen_t=int
61 TCC += -DSQLITE_MAX_MMAP_SIZE=0
62 TCC += -DFOSSIL_ENABLE_LEGACY_MV_RM=1
63 INSTALLDIR = $(DESTDIR)/usr/local/bin
64 USE_SYSTEM_SQLITE =
65 USE_LINENOISE = 1
66 # FOSSIL_ENABLE_TCL = @FOSSIL_ENABLE_TCL@
67 FOSSIL_ENABLE_TCL = 0
68 FOSSIL_ENABLE_MINIZ = 0
69
70 include $(SRCDIR)/main.mk
71
72 distclean: clean
73 rm -f autoconfig.h config.log Makefile
74
--- Makefile.osx-jaguar
+++ Makefile.osx-jaguar
@@ -38,11 +38,11 @@
38 BCCFLAGS = $(CFLAGS)
39
40 #### The suffix to add to final executable file. When cross-compiling
41 # to windows, make this ".exe". Otherwise leave it blank.
42 #
43 E =
44
45 TCC = cc
46 TCCFLAGS = $(CFLAGS)
47
48 #### Tcl shell for use in running the fossil testsuite. If you do not
@@ -59,15 +59,15 @@
59 TCC += -DWITHOUT_ICONV
60 TCC += -Dsocklen_t=int
61 TCC += -DSQLITE_MAX_MMAP_SIZE=0
62 TCC += -DFOSSIL_ENABLE_LEGACY_MV_RM=1
63 INSTALLDIR = $(DESTDIR)/usr/local/bin
64 USE_SYSTEM_SQLITE =
65 USE_LINENOISE = 1
66 # FOSSIL_ENABLE_TCL = @FOSSIL_ENABLE_TCL@
67 FOSSIL_ENABLE_TCL = 0
68 FOSSIL_ENABLE_MINIZ = 0
69
70 include $(SRCDIR)/main.mk
71
72 distclean: clean
73 rm -f autoconfig.h config.log Makefile
74
+1 -1
--- VERSION
+++ VERSION
@@ -1,1 +1,1 @@
1
-2.8
1
+2.9
22
--- VERSION
+++ VERSION
@@ -1,1 +1,1 @@
1 2.8
2
--- VERSION
+++ VERSION
@@ -1,1 +1,1 @@
1 2.9
2
+42 -4
--- src/checkout.c
+++ src/checkout.c
@@ -39,15 +39,53 @@
3939
}
4040
4141
/*
4242
** Undo the current check-out. Unlink all files from the disk.
4343
** Clear the VFILE table.
44
+**
45
+** Also delete any directory that becomes empty as a result of deleting
46
+** files due to this operation, as long as that directory is not the
47
+** current working directory and is not on the empty-dirs list.
4448
*/
4549
void uncheckout(int vid){
46
- if( vid>0 ){
47
- vfile_unlink(vid);
48
- }
50
+ char *zPwd;
51
+ if( vid<=0 ) return;
52
+ sqlite3_create_function(g.db, "dirname",1,SQLITE_UTF8,0,
53
+ file_dirname_sql_function, 0, 0);
54
+ sqlite3_create_function(g.db, "unlink",1,SQLITE_UTF8,0,
55
+ file_delete_sql_function, 0, 0);
56
+ sqlite3_create_function(g.db, "rmdir", 1, SQLITE_UTF8, 0,
57
+ file_rmdir_sql_function, 0, 0);
58
+ db_multi_exec(
59
+ "CREATE TEMP TABLE dir_to_delete(name TEXT %s PRIMARY KEY)WITHOUT ROWID",
60
+ filename_collation()
61
+ );
62
+ db_multi_exec(
63
+ "INSERT OR IGNORE INTO dir_to_delete(name)"
64
+ " SELECT dirname(pathname) FROM vfile"
65
+ " WHERE vid=%d AND mrid>0",
66
+ vid
67
+ );
68
+ do{
69
+ db_multi_exec(
70
+ "INSERT OR IGNORE INTO dir_to_delete(name)"
71
+ " SELECT dirname(name) FROM dir_to_delete;"
72
+ );
73
+ }while( db_changes() );
74
+ db_multi_exec(
75
+ "SELECT unlink(%Q||pathname) FROM vfile"
76
+ " WHERE vid=%d AND mrid>0;",
77
+ g.zLocalRoot, vid
78
+ );
79
+ ensure_empty_dirs_created(1);
80
+ zPwd = file_getcwd(0,0);
81
+ db_multi_exec(
82
+ "SELECT rmdir(%Q||name) FROM dir_to_delete"
83
+ " WHERE (%Q||name)<>%Q ORDER BY name DESC",
84
+ g.zLocalRoot, g.zLocalRoot, zPwd
85
+ );
86
+ fossil_free(zPwd);
4987
db_multi_exec("DELETE FROM vfile WHERE vid=%d", vid);
5088
}
5189
5290
5391
/*
@@ -303,11 +341,11 @@
303341
if( !keepFlag ){
304342
vfile_to_disk(vid, 0, !g.fQuiet, promptFlag);
305343
}
306344
checkout_set_all_exe(vid);
307345
manifest_to_disk(vid);
308
- ensure_empty_dirs_created();
346
+ ensure_empty_dirs_created(0);
309347
db_set_checkout(vid);
310348
undo_reset();
311349
db_multi_exec("DELETE FROM vmerge");
312350
if( !keepFlag && db_get_boolean("repo-cksum",1) ){
313351
vfile_aggregate_checksum_manifest(vid, &cksum1, &cksum1b);
314352
--- src/checkout.c
+++ src/checkout.c
@@ -39,15 +39,53 @@
39 }
40
41 /*
42 ** Undo the current check-out. Unlink all files from the disk.
43 ** Clear the VFILE table.
 
 
 
 
44 */
45 void uncheckout(int vid){
46 if( vid>0 ){
47 vfile_unlink(vid);
48 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49 db_multi_exec("DELETE FROM vfile WHERE vid=%d", vid);
50 }
51
52
53 /*
@@ -303,11 +341,11 @@
303 if( !keepFlag ){
304 vfile_to_disk(vid, 0, !g.fQuiet, promptFlag);
305 }
306 checkout_set_all_exe(vid);
307 manifest_to_disk(vid);
308 ensure_empty_dirs_created();
309 db_set_checkout(vid);
310 undo_reset();
311 db_multi_exec("DELETE FROM vmerge");
312 if( !keepFlag && db_get_boolean("repo-cksum",1) ){
313 vfile_aggregate_checksum_manifest(vid, &cksum1, &cksum1b);
314
--- src/checkout.c
+++ src/checkout.c
@@ -39,15 +39,53 @@
39 }
40
41 /*
42 ** Undo the current check-out. Unlink all files from the disk.
43 ** Clear the VFILE table.
44 **
45 ** Also delete any directory that becomes empty as a result of deleting
46 ** files due to this operation, as long as that directory is not the
47 ** current working directory and is not on the empty-dirs list.
48 */
49 void uncheckout(int vid){
50 char *zPwd;
51 if( vid<=0 ) return;
52 sqlite3_create_function(g.db, "dirname",1,SQLITE_UTF8,0,
53 file_dirname_sql_function, 0, 0);
54 sqlite3_create_function(g.db, "unlink",1,SQLITE_UTF8,0,
55 file_delete_sql_function, 0, 0);
56 sqlite3_create_function(g.db, "rmdir", 1, SQLITE_UTF8, 0,
57 file_rmdir_sql_function, 0, 0);
58 db_multi_exec(
59 "CREATE TEMP TABLE dir_to_delete(name TEXT %s PRIMARY KEY)WITHOUT ROWID",
60 filename_collation()
61 );
62 db_multi_exec(
63 "INSERT OR IGNORE INTO dir_to_delete(name)"
64 " SELECT dirname(pathname) FROM vfile"
65 " WHERE vid=%d AND mrid>0",
66 vid
67 );
68 do{
69 db_multi_exec(
70 "INSERT OR IGNORE INTO dir_to_delete(name)"
71 " SELECT dirname(name) FROM dir_to_delete;"
72 );
73 }while( db_changes() );
74 db_multi_exec(
75 "SELECT unlink(%Q||pathname) FROM vfile"
76 " WHERE vid=%d AND mrid>0;",
77 g.zLocalRoot, vid
78 );
79 ensure_empty_dirs_created(1);
80 zPwd = file_getcwd(0,0);
81 db_multi_exec(
82 "SELECT rmdir(%Q||name) FROM dir_to_delete"
83 " WHERE (%Q||name)<>%Q ORDER BY name DESC",
84 g.zLocalRoot, g.zLocalRoot, zPwd
85 );
86 fossil_free(zPwd);
87 db_multi_exec("DELETE FROM vfile WHERE vid=%d", vid);
88 }
89
90
91 /*
@@ -303,11 +341,11 @@
341 if( !keepFlag ){
342 vfile_to_disk(vid, 0, !g.fQuiet, promptFlag);
343 }
344 checkout_set_all_exe(vid);
345 manifest_to_disk(vid);
346 ensure_empty_dirs_created(0);
347 db_set_checkout(vid);
348 undo_reset();
349 db_multi_exec("DELETE FROM vmerge");
350 if( !keepFlag && db_get_boolean("repo-cksum",1) ){
351 vfile_aggregate_checksum_manifest(vid, &cksum1, &cksum1b);
352
+6
--- src/db.c
+++ src/db.c
@@ -361,10 +361,16 @@
361361
rc = db_vprepare(pStmt, DB_PREPARE_PERSISTENT, zFormat, ap);
362362
va_end(ap);
363363
}
364364
return rc;
365365
}
366
+
367
+/* Return TRUE if static Stmt object pStmt has been initialized.
368
+*/
369
+int db_static_stmt_is_init(Stmt *pStmt){
370
+ return blob_size(&pStmt->sql)>0;
371
+}
366372
367373
/* Prepare a statement using text placed inside a Blob
368374
** using blob_append_sql().
369375
*/
370376
int db_prepare_blob(Stmt *pStmt, Blob *pSql){
371377
372378
ADDED src/deltafunc.c
--- src/db.c
+++ src/db.c
@@ -361,10 +361,16 @@
361 rc = db_vprepare(pStmt, DB_PREPARE_PERSISTENT, zFormat, ap);
362 va_end(ap);
363 }
364 return rc;
365 }
 
 
 
 
 
 
366
367 /* Prepare a statement using text placed inside a Blob
368 ** using blob_append_sql().
369 */
370 int db_prepare_blob(Stmt *pStmt, Blob *pSql){
371
372 DDED src/deltafunc.c
--- src/db.c
+++ src/db.c
@@ -361,10 +361,16 @@
361 rc = db_vprepare(pStmt, DB_PREPARE_PERSISTENT, zFormat, ap);
362 va_end(ap);
363 }
364 return rc;
365 }
366
367 /* Return TRUE if static Stmt object pStmt has been initialized.
368 */
369 int db_static_stmt_is_init(Stmt *pStmt){
370 return blob_size(&pStmt->sql)>0;
371 }
372
373 /* Prepare a statement using text placed inside a Blob
374 ** using blob_append_sql().
375 */
376 int db_prepare_blob(Stmt *pStmt, Blob *pSql){
377
378 DDED src/deltafunc.c
--- a/src/deltafunc.c
+++ b/src/deltafunc.c
@@ -0,0 +1,237 @@
1
+/*
2
+** Copyright (c) 2019 D. Richard Hipp
3
+**
4
+** This program is free software; you can redistribute it and/or
5
+** modify it under the terms of the Simplified BSD License (also
6
+** known as the "2-Clause License" or "FreeBSD License".)
7
+**
8
+** This program is distributed in the hope that it will be useful,
9
+** but without any warranty; without even the implied warranty of
10
+** merchantability or fitness for a particular purpose.
11
+**
12
+** Author contact information:
13
+** [email protected]
14
+** http://www.hwaci.com/drh/
15
+**
16
+*******************************************************************************
17
+**
18
+** This module implements SQL interfaces to the delta logic. The code
19
+** here is adapted from the ext/misc/fossildelta.c extension in SQLite.
20
+*/
21
+#include "config.h"
22
+#include "deltafunc.h"
23
+
24
+/*
25
+** SQL functions: delta_create(X,Y)
26
+**
27
+** Return a delta that will transform X into Y.
28
+*/
29
+static void deltaCreateFunc(
30
+ sqlite3_context *context,
31
+ int argc,
32
+ sqlite3_value **argv
33
+){
34
+ const char *aOrig; int nOrig; /* old blob */
35
+ const char *aNew; int nNew; /* new blob */
36
+ char *aOut; int nOut; /* output delta */
37
+
38
+ assert( argc==2 );
39
+ if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
40
+ if( sqlite3_value_type(argv[1])==SQLITE_NULL ) return;
41
+ nOrig = sqlite3_value_bytes(argv[0]);
42
+ aOrig = (const char*)sqlite3_value_blob(argv[0]);
43
+ nNew = sqlite3_value_bytes(argv[1]);
44
+ aNew = (const char*)sqlite3_value_blob(argv[1]);
45
+ aOut = sqlite3_malloc64(nNew+70);
46
+ if( aOut==0 ){
47
+ sqlite3_result_error_nomem(context);
48
+ }else{
49
+ nOut = delta_create(aOrig, nOrig, aNew, nNew, aOut);
50
+ if( nOut<0 ){
51
+ sqlite3_free(aOut);
52
+ sqlite3_result_error(context, "cannot create fossil delta", -1);
53
+ }else{
54
+ sqlite3_result_blob(context, aOut, nOut, sqlite3_free);
55
+ }
56
+ }
57
+}
58
+
59
+/*
60
+** SQL functions: delta_apply(X,D)
61
+**
62
+** Return the result of applying delta D to input X.
63
+*/
64
+static void deltaApplyFunc(
65
+ sqlite3_context *context,
66
+ int argc,
67
+ sqlite3_value **argv
68
+){
69
+ const char *aOrig; int nOrig; /* The X input */
70
+ const char *aDelta; int nDelta; /* The input delta (D) */
71
+ char *aOut; int nOut, nOut2; /* The output */
72
+
73
+ assert( argc==2 );
74
+ if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
75
+ if( sqlite3_value_type(argv[1])==SQLITE_NULL ) return;
76
+ nOrig = sqlite3_value_bytes(argv[0]);
77
+ aOrig = (const char*)sqlite3_value_blob(argv[0]);
78
+ nDelta = sqlite3_value_bytes(argv[1]);
79
+ aDelta = (const char*)sqlite3_value_blob(argv[1]);
80
+
81
+ /* Figure out the size of the output */
82
+ nOut = delta_output_size(aDelta, nDelta);
83
+ if( nOut<0 ){
84
+ sqlite3_result_error(context, "corrupt fossil delta", -1);
85
+ return;
86
+ }
87
+ aOut = sqlite3_malloc64((sqlite3_int64)nOut+1);
88
+ if( aOut==0 ){
89
+ sqlite3_result_error_nomem(context);
90
+ }else{
91
+ nOut2 = delta_apply(aOrig, nOrig, aDelta, nDelta, aOut);
92
+ if( nOut2!=nOut ){
93
+ sqlite3_free(aOut);
94
+ sqlite3_result_error(context, "corrupt fossil delta", -1);
95
+ }else{
96
+ sqlite3_result_blob(context, aOut, nOut, sqlite3_free);
97
+ }
98
+ }
99
+}
100
+
101
+
102
+/*
103
+** SQL functions: delta_output_size(D)
104
+**
105
+** Return the size of the output that results from applying delta D.
106
+*/
107
+static void deltaOutputSizeFunc(
108
+ sqlite3_context *context,
109
+ int argc,
110
+ sqlite3_value **argv
111
+){
112
+ const char *aDelta; int nDelta; /* The input delta (D) */
113
+ int nOut; /* Size of output */
114
+ assert( argc==1 );
115
+ if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
116
+ nDelta = sqlite3_value_bytes(argv[0]);
117
+ aDelta = (const char*)sqlite3_value_blob(argv[0]);
118
+
119
+ /* Figure out the size of the output */
120
+ nOut = delta_output_size(aDelta, nDelta);
121
+ if( nOut<0 ){
122
+ sqlite3_result_error(context, "corrupt fossil delta", -1);
123
+ return;
124
+ }else{
125
+ sqlite3_result_int(context, nOut);
126
+ }
127
+}
128
+
129
+/*****************************************************************************
130
+** Table-valued SQL function: delta_parse(DELTA)
131
+**
132
+** Schema:
133
+**
134
+** CREATE TABLE delta_parse(
135
+** op TEXT,
136
+** a1 INT,
137
+** a2 ANY,
138
+** delta HIDDEN BLOB
139
+** );
140
+**
141
+** Given an input DELTA, this function parses the delta and returns
142
+** rows for each entry in the delta. The op column has one of the
143
+** values SIZE, COPY, INSERT, CHECKSUM, ERROR.
144
+**
145
+** Assuming no errors, the first row has op='SIZE'. a1 is the size of
146
+** the output in bytes and a2 is NULL.
147
+**
148
+** After the initial SIZE row, there are zero or more 'COPY' and/or 'INSERT'
149
+** rows. A COPY row means content is copied from the source into the
150
+** output. Column a1 is the number of bytes to copy and a2 is the offset
151
+** into source from which to begin copying. An INSERT row means to
152
+** insert text into the output stream. Column a1 is the number of bytes
153
+** to insert and column is a BLOB that contains the text to be inserted.
154
+**
155
+** The last row of a well-formed delta will have an op value of 'CHECKSUM'.
156
+** The a1 column will be the value of the checksum and a2 will be NULL.
157
+**
158
+** If the input delta is not well-formed, then a row with an op value
159
+** of 'ERROR' is returned. The a1 value of the ERROR row is the offset
160
+** into the delta where the error was encountered and a2 is NULL.
161
+*/
162
+typedef struct deltaparsevtab_vtab deltaparsevtab_vtab;
163
+typedef struct deltaparsevtab_cursor deltaparsevtab_cursor;
164
+struct deltaparsevtab_vtab {
165
+ sqlite3_vtab base; /* Base class - must be first */
166
+ /* No additional information needed */
167
+};
168
+struct deltaparsevtab_cursor {
169
+ sqlite3_vtab_cursor base; /* Base class - must be first */
170
+ char *aDelta; /* The delta being parsed */
171
+ int nDelta; /* Number of bytes in the delta */
172
+ int iCursor; /* Current cursor location */
173
+ int eOp; /* Name of current operator */
174
+ unsigned int a1, a2; /* Arguments to current operator */
175
+ int iNext; /* Next cursor value */
176
+};
177
+
178
+/* Operator names:
179
+*/
180
+static const char *
181
+** Copyright (c) 2019 D. Richard Hipp
182
+**
183
+** This program is free software; you can redistributeiaparsevtab_cursor *)pVtabCursor;
184
+ const char *a;
185
+ int i = 0;
186
+ pCur->eOp = DELTAPARSE_OP_ERROR;
187
+ if( idxNum!=1 ){
188
+ return SQLITE_OK;
189
+ }
190
+ pCur->nDelta = sqlite3_value_bytes(argv[0]);
191
+ a = (const char*)sqlite3_value_blob(argv[0]);
192
+ if( pCur->nDelta==0 || a==0 ){
193
+ return SQLITE_OK;
194
+ }
195
+ pCur->aDelta = sqlite3_malloc64( pCur->nDelta+1 );
196
+ if( pCur->aDelta==0 ){
197
+ pCur->nDelta = 0;
198
+ return SQLITE_NOMEM;
199
+ }
200
+ memcpy(pCur->aDelta, a, pCur->nDelta);
201
+ pCur->aDelta[pCur->nDelta] = 0;
202
+ a = pCur->aDelta;
203
+ pCur->eOp = DELTAPARSE_OP_SIZE;
204
+ pCur->a1 = deltaGetInt(&a, &i);
205
+ if( a[0]!='\n' ){
206
+ pCur->eOp = DELTAPARSE_OP_ERROR;
207
+ pCur->a1 = pCur->a2 = 0;
208
+ pCur->iNext = pCur->nDelta;
209
+ return SQLITE_OK;
210
+ }
211
+ a++;
212
+ pCur->iNext = (unsigned int)(a - pCur->aDelta);
213
+ return SQLITE_OK;
214
+}
215
+
216
+/*
217
+** SQLite will invoke this method one or more times while planning a query
218
+** that uses the virtual table. This routine needs to create
219
+** a query plan for each invocation and compute an estimated cost for that
220
+**t
221
+** plan.
222
+*/
223
+static int deltaparsevtabBestIndex(
224
+ sqlite3_vtab *tab,
225
+ sqlite3_index_info *pIdxInfo
226
+){
227
+ int i;
228
+ for(i=0; i<pIdxInfo->nConstraint; i++){
229
+ if( pIdxInfo->aConstraint[i].iColumn != DELTAPARSEVTAB_DELTA ) continue;
230
+ if( pIdxInfo->aConstraint[i].usable==0 ) continue;
231
+ if( pIdxInfo->aConstraint[i].op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue;
232
+ pIdxInfo->aConstraintUsage[i].argvIndex = 1;
233
+ pIdxInfo->aConstraintUsage[i].omit = 1;
234
+ pIdxInfo->estimatedCost = (double)1;
235
+ pIdxInfo->estimatedRows = 10;
236
+ pIdxInfo->idxNum = 1;
237
+
--- a/src/deltafunc.c
+++ b/src/deltafunc.c
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/src/deltafunc.c
+++ b/src/deltafunc.c
@@ -0,0 +1,237 @@
1 /*
2 ** Copyright (c) 2019 D. Richard Hipp
3 **
4 ** This program is free software; you can redistribute it and/or
5 ** modify it under the terms of the Simplified BSD License (also
6 ** known as the "2-Clause License" or "FreeBSD License".)
7 **
8 ** This program is distributed in the hope that it will be useful,
9 ** but without any warranty; without even the implied warranty of
10 ** merchantability or fitness for a particular purpose.
11 **
12 ** Author contact information:
13 ** [email protected]
14 ** http://www.hwaci.com/drh/
15 **
16 *******************************************************************************
17 **
18 ** This module implements SQL interfaces to the delta logic. The code
19 ** here is adapted from the ext/misc/fossildelta.c extension in SQLite.
20 */
21 #include "config.h"
22 #include "deltafunc.h"
23
24 /*
25 ** SQL functions: delta_create(X,Y)
26 **
27 ** Return a delta that will transform X into Y.
28 */
29 static void deltaCreateFunc(
30 sqlite3_context *context,
31 int argc,
32 sqlite3_value **argv
33 ){
34 const char *aOrig; int nOrig; /* old blob */
35 const char *aNew; int nNew; /* new blob */
36 char *aOut; int nOut; /* output delta */
37
38 assert( argc==2 );
39 if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
40 if( sqlite3_value_type(argv[1])==SQLITE_NULL ) return;
41 nOrig = sqlite3_value_bytes(argv[0]);
42 aOrig = (const char*)sqlite3_value_blob(argv[0]);
43 nNew = sqlite3_value_bytes(argv[1]);
44 aNew = (const char*)sqlite3_value_blob(argv[1]);
45 aOut = sqlite3_malloc64(nNew+70);
46 if( aOut==0 ){
47 sqlite3_result_error_nomem(context);
48 }else{
49 nOut = delta_create(aOrig, nOrig, aNew, nNew, aOut);
50 if( nOut<0 ){
51 sqlite3_free(aOut);
52 sqlite3_result_error(context, "cannot create fossil delta", -1);
53 }else{
54 sqlite3_result_blob(context, aOut, nOut, sqlite3_free);
55 }
56 }
57 }
58
59 /*
60 ** SQL functions: delta_apply(X,D)
61 **
62 ** Return the result of applying delta D to input X.
63 */
64 static void deltaApplyFunc(
65 sqlite3_context *context,
66 int argc,
67 sqlite3_value **argv
68 ){
69 const char *aOrig; int nOrig; /* The X input */
70 const char *aDelta; int nDelta; /* The input delta (D) */
71 char *aOut; int nOut, nOut2; /* The output */
72
73 assert( argc==2 );
74 if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
75 if( sqlite3_value_type(argv[1])==SQLITE_NULL ) return;
76 nOrig = sqlite3_value_bytes(argv[0]);
77 aOrig = (const char*)sqlite3_value_blob(argv[0]);
78 nDelta = sqlite3_value_bytes(argv[1]);
79 aDelta = (const char*)sqlite3_value_blob(argv[1]);
80
81 /* Figure out the size of the output */
82 nOut = delta_output_size(aDelta, nDelta);
83 if( nOut<0 ){
84 sqlite3_result_error(context, "corrupt fossil delta", -1);
85 return;
86 }
87 aOut = sqlite3_malloc64((sqlite3_int64)nOut+1);
88 if( aOut==0 ){
89 sqlite3_result_error_nomem(context);
90 }else{
91 nOut2 = delta_apply(aOrig, nOrig, aDelta, nDelta, aOut);
92 if( nOut2!=nOut ){
93 sqlite3_free(aOut);
94 sqlite3_result_error(context, "corrupt fossil delta", -1);
95 }else{
96 sqlite3_result_blob(context, aOut, nOut, sqlite3_free);
97 }
98 }
99 }
100
101
102 /*
103 ** SQL functions: delta_output_size(D)
104 **
105 ** Return the size of the output that results from applying delta D.
106 */
107 static void deltaOutputSizeFunc(
108 sqlite3_context *context,
109 int argc,
110 sqlite3_value **argv
111 ){
112 const char *aDelta; int nDelta; /* The input delta (D) */
113 int nOut; /* Size of output */
114 assert( argc==1 );
115 if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
116 nDelta = sqlite3_value_bytes(argv[0]);
117 aDelta = (const char*)sqlite3_value_blob(argv[0]);
118
119 /* Figure out the size of the output */
120 nOut = delta_output_size(aDelta, nDelta);
121 if( nOut<0 ){
122 sqlite3_result_error(context, "corrupt fossil delta", -1);
123 return;
124 }else{
125 sqlite3_result_int(context, nOut);
126 }
127 }
128
129 /*****************************************************************************
130 ** Table-valued SQL function: delta_parse(DELTA)
131 **
132 ** Schema:
133 **
134 ** CREATE TABLE delta_parse(
135 ** op TEXT,
136 ** a1 INT,
137 ** a2 ANY,
138 ** delta HIDDEN BLOB
139 ** );
140 **
141 ** Given an input DELTA, this function parses the delta and returns
142 ** rows for each entry in the delta. The op column has one of the
143 ** values SIZE, COPY, INSERT, CHECKSUM, ERROR.
144 **
145 ** Assuming no errors, the first row has op='SIZE'. a1 is the size of
146 ** the output in bytes and a2 is NULL.
147 **
148 ** After the initial SIZE row, there are zero or more 'COPY' and/or 'INSERT'
149 ** rows. A COPY row means content is copied from the source into the
150 ** output. Column a1 is the number of bytes to copy and a2 is the offset
151 ** into source from which to begin copying. An INSERT row means to
152 ** insert text into the output stream. Column a1 is the number of bytes
153 ** to insert and column is a BLOB that contains the text to be inserted.
154 **
155 ** The last row of a well-formed delta will have an op value of 'CHECKSUM'.
156 ** The a1 column will be the value of the checksum and a2 will be NULL.
157 **
158 ** If the input delta is not well-formed, then a row with an op value
159 ** of 'ERROR' is returned. The a1 value of the ERROR row is the offset
160 ** into the delta where the error was encountered and a2 is NULL.
161 */
162 typedef struct deltaparsevtab_vtab deltaparsevtab_vtab;
163 typedef struct deltaparsevtab_cursor deltaparsevtab_cursor;
164 struct deltaparsevtab_vtab {
165 sqlite3_vtab base; /* Base class - must be first */
166 /* No additional information needed */
167 };
168 struct deltaparsevtab_cursor {
169 sqlite3_vtab_cursor base; /* Base class - must be first */
170 char *aDelta; /* The delta being parsed */
171 int nDelta; /* Number of bytes in the delta */
172 int iCursor; /* Current cursor location */
173 int eOp; /* Name of current operator */
174 unsigned int a1, a2; /* Arguments to current operator */
175 int iNext; /* Next cursor value */
176 };
177
178 /* Operator names:
179 */
180 static const char *
181 ** Copyright (c) 2019 D. Richard Hipp
182 **
183 ** This program is free software; you can redistributeiaparsevtab_cursor *)pVtabCursor;
184 const char *a;
185 int i = 0;
186 pCur->eOp = DELTAPARSE_OP_ERROR;
187 if( idxNum!=1 ){
188 return SQLITE_OK;
189 }
190 pCur->nDelta = sqlite3_value_bytes(argv[0]);
191 a = (const char*)sqlite3_value_blob(argv[0]);
192 if( pCur->nDelta==0 || a==0 ){
193 return SQLITE_OK;
194 }
195 pCur->aDelta = sqlite3_malloc64( pCur->nDelta+1 );
196 if( pCur->aDelta==0 ){
197 pCur->nDelta = 0;
198 return SQLITE_NOMEM;
199 }
200 memcpy(pCur->aDelta, a, pCur->nDelta);
201 pCur->aDelta[pCur->nDelta] = 0;
202 a = pCur->aDelta;
203 pCur->eOp = DELTAPARSE_OP_SIZE;
204 pCur->a1 = deltaGetInt(&a, &i);
205 if( a[0]!='\n' ){
206 pCur->eOp = DELTAPARSE_OP_ERROR;
207 pCur->a1 = pCur->a2 = 0;
208 pCur->iNext = pCur->nDelta;
209 return SQLITE_OK;
210 }
211 a++;
212 pCur->iNext = (unsigned int)(a - pCur->aDelta);
213 return SQLITE_OK;
214 }
215
216 /*
217 ** SQLite will invoke this method one or more times while planning a query
218 ** that uses the virtual table. This routine needs to create
219 ** a query plan for each invocation and compute an estimated cost for that
220 **t
221 ** plan.
222 */
223 static int deltaparsevtabBestIndex(
224 sqlite3_vtab *tab,
225 sqlite3_index_info *pIdxInfo
226 ){
227 int i;
228 for(i=0; i<pIdxInfo->nConstraint; i++){
229 if( pIdxInfo->aConstraint[i].iColumn != DELTAPARSEVTAB_DELTA ) continue;
230 if( pIdxInfo->aConstraint[i].usable==0 ) continue;
231 if( pIdxInfo->aConstraint[i].op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue;
232 pIdxInfo->aConstraintUsage[i].argvIndex = 1;
233 pIdxInfo->aConstraintUsage[i].omit = 1;
234 pIdxInfo->estimatedCost = (double)1;
235 pIdxInfo->estimatedRows = 10;
236 pIdxInfo->idxNum = 1;
237
+69 -1
--- src/file.c
+++ src/file.c
@@ -437,10 +437,29 @@
437437
return mprintf("%.*s", (int)(zTail-z-1), z);
438438
}else{
439439
return 0;
440440
}
441441
}
442
+
443
+/* SQL Function: file_dirname(NAME)
444
+**
445
+** Return the directory for NAME
446
+*/
447
+void file_dirname_sql_function(
448
+ sqlite3_context *context,
449
+ int argc,
450
+ sqlite3_value **argv
451
+){
452
+ const char *zName = (const char*)sqlite3_value_text(argv[0]);
453
+ char *zDir;
454
+ if( zName==0 ) return;
455
+ zDir = file_dirname(zName);
456
+ if( zDir ){
457
+ sqlite3_result_text(context,zDir,-1,fossil_free);
458
+ }
459
+}
460
+
442461
443462
/*
444463
** Rename a file or directory.
445464
** Returns zero upon success.
446465
*/
@@ -594,10 +613,30 @@
594613
rc = unlink(zFilename);
595614
#endif
596615
fossil_path_free(z);
597616
return rc;
598617
}
618
+
619
+/* SQL Function: file_delete(NAME)
620
+**
621
+** Remove file NAME. Return zero on success and non-zero if anything goes
622
+** wrong.
623
+*/
624
+void file_delete_sql_function(
625
+ sqlite3_context *context,
626
+ int argc,
627
+ sqlite3_value **argv
628
+){
629
+ const char *zName = (const char*)sqlite3_value_text(argv[0]);
630
+ int rc;
631
+ if( zName==0 ){
632
+ rc = 1;
633
+ }else{
634
+ rc = file_delete(zName);
635
+ }
636
+ sqlite3_result_int(context, rc);
637
+}
599638
600639
/*
601640
** Create a directory called zName, if it does not already exist.
602641
** If forceFlag is 1, delete any prior non-directory object
603642
** with the same name.
@@ -684,10 +723,30 @@
684723
fossil_path_free(zMbcs);
685724
return rc;
686725
}
687726
return 0;
688727
}
728
+
729
+/* SQL Function: rmdir(NAME)
730
+**
731
+** Try to remove the directory NAME. Return zero on success and non-zero
732
+** for failure.
733
+*/
734
+void file_rmdir_sql_function(
735
+ sqlite3_context *context,
736
+ int argc,
737
+ sqlite3_value **argv
738
+){
739
+ const char *zName = (const char*)sqlite3_value_text(argv[0]);
740
+ int rc;
741
+ if( zName==0 ){
742
+ rc = 1;
743
+ }else{
744
+ rc = file_rmdir(zName);
745
+ }
746
+ sqlite3_result_int(context, rc);
747
+}
689748
690749
/*
691750
** Return true if the filename given is a valid filename for
692751
** a file in a repository. Valid filenames follow all of the
693752
** following rules:
@@ -890,12 +949,20 @@
890949
** Get the current working directory.
891950
**
892951
** On windows, the name is converted from unicode to UTF8 and all '\\'
893952
** characters are converted to '/'. No conversions are needed on
894953
** unix.
954
+**
955
+** Store the value of the CWD in zBuf which is nBuf bytes in size.
956
+** or if zBuf==0, allocate space to hold the result using fossil_malloc().
895957
*/
896
-void file_getcwd(char *zBuf, int nBuf){
958
+char *file_getcwd(char *zBuf, int nBuf){
959
+ char zTemp[2000];
960
+ if( zBuf==0 ){
961
+ zBuf = zTemp;
962
+ nBuf = sizeof(zTemp);
963
+ }
897964
#ifdef _WIN32
898965
win32_getcwd(zBuf, nBuf);
899966
#else
900967
if( getcwd(zBuf, nBuf-1)==0 ){
901968
if( errno==ERANGE ){
@@ -904,10 +971,11 @@
904971
fossil_panic("cannot find current working directory; %s",
905972
strerror(errno));
906973
}
907974
}
908975
#endif
976
+ return zBuf==zTemp ? fossil_strdup(zBuf) : zBuf;
909977
}
910978
911979
/*
912980
** Return true if zPath is an absolute pathname. Return false
913981
** if it is relative.
914982
--- src/file.c
+++ src/file.c
@@ -437,10 +437,29 @@
437 return mprintf("%.*s", (int)(zTail-z-1), z);
438 }else{
439 return 0;
440 }
441 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
442
443 /*
444 ** Rename a file or directory.
445 ** Returns zero upon success.
446 */
@@ -594,10 +613,30 @@
594 rc = unlink(zFilename);
595 #endif
596 fossil_path_free(z);
597 return rc;
598 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
599
600 /*
601 ** Create a directory called zName, if it does not already exist.
602 ** If forceFlag is 1, delete any prior non-directory object
603 ** with the same name.
@@ -684,10 +723,30 @@
684 fossil_path_free(zMbcs);
685 return rc;
686 }
687 return 0;
688 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689
690 /*
691 ** Return true if the filename given is a valid filename for
692 ** a file in a repository. Valid filenames follow all of the
693 ** following rules:
@@ -890,12 +949,20 @@
890 ** Get the current working directory.
891 **
892 ** On windows, the name is converted from unicode to UTF8 and all '\\'
893 ** characters are converted to '/'. No conversions are needed on
894 ** unix.
 
 
 
895 */
896 void file_getcwd(char *zBuf, int nBuf){
 
 
 
 
 
897 #ifdef _WIN32
898 win32_getcwd(zBuf, nBuf);
899 #else
900 if( getcwd(zBuf, nBuf-1)==0 ){
901 if( errno==ERANGE ){
@@ -904,10 +971,11 @@
904 fossil_panic("cannot find current working directory; %s",
905 strerror(errno));
906 }
907 }
908 #endif
 
909 }
910
911 /*
912 ** Return true if zPath is an absolute pathname. Return false
913 ** if it is relative.
914
--- src/file.c
+++ src/file.c
@@ -437,10 +437,29 @@
437 return mprintf("%.*s", (int)(zTail-z-1), z);
438 }else{
439 return 0;
440 }
441 }
442
443 /* SQL Function: file_dirname(NAME)
444 **
445 ** Return the directory for NAME
446 */
447 void file_dirname_sql_function(
448 sqlite3_context *context,
449 int argc,
450 sqlite3_value **argv
451 ){
452 const char *zName = (const char*)sqlite3_value_text(argv[0]);
453 char *zDir;
454 if( zName==0 ) return;
455 zDir = file_dirname(zName);
456 if( zDir ){
457 sqlite3_result_text(context,zDir,-1,fossil_free);
458 }
459 }
460
461
462 /*
463 ** Rename a file or directory.
464 ** Returns zero upon success.
465 */
@@ -594,10 +613,30 @@
613 rc = unlink(zFilename);
614 #endif
615 fossil_path_free(z);
616 return rc;
617 }
618
619 /* SQL Function: file_delete(NAME)
620 **
621 ** Remove file NAME. Return zero on success and non-zero if anything goes
622 ** wrong.
623 */
624 void file_delete_sql_function(
625 sqlite3_context *context,
626 int argc,
627 sqlite3_value **argv
628 ){
629 const char *zName = (const char*)sqlite3_value_text(argv[0]);
630 int rc;
631 if( zName==0 ){
632 rc = 1;
633 }else{
634 rc = file_delete(zName);
635 }
636 sqlite3_result_int(context, rc);
637 }
638
639 /*
640 ** Create a directory called zName, if it does not already exist.
641 ** If forceFlag is 1, delete any prior non-directory object
642 ** with the same name.
@@ -684,10 +723,30 @@
723 fossil_path_free(zMbcs);
724 return rc;
725 }
726 return 0;
727 }
728
729 /* SQL Function: rmdir(NAME)
730 **
731 ** Try to remove the directory NAME. Return zero on success and non-zero
732 ** for failure.
733 */
734 void file_rmdir_sql_function(
735 sqlite3_context *context,
736 int argc,
737 sqlite3_value **argv
738 ){
739 const char *zName = (const char*)sqlite3_value_text(argv[0]);
740 int rc;
741 if( zName==0 ){
742 rc = 1;
743 }else{
744 rc = file_rmdir(zName);
745 }
746 sqlite3_result_int(context, rc);
747 }
748
749 /*
750 ** Return true if the filename given is a valid filename for
751 ** a file in a repository. Valid filenames follow all of the
752 ** following rules:
@@ -890,12 +949,20 @@
949 ** Get the current working directory.
950 **
951 ** On windows, the name is converted from unicode to UTF8 and all '\\'
952 ** characters are converted to '/'. No conversions are needed on
953 ** unix.
954 **
955 ** Store the value of the CWD in zBuf which is nBuf bytes in size.
956 ** or if zBuf==0, allocate space to hold the result using fossil_malloc().
957 */
958 char *file_getcwd(char *zBuf, int nBuf){
959 char zTemp[2000];
960 if( zBuf==0 ){
961 zBuf = zTemp;
962 nBuf = sizeof(zTemp);
963 }
964 #ifdef _WIN32
965 win32_getcwd(zBuf, nBuf);
966 #else
967 if( getcwd(zBuf, nBuf-1)==0 ){
968 if( errno==ERANGE ){
@@ -904,10 +971,11 @@
971 fossil_panic("cannot find current working directory; %s",
972 strerror(errno));
973 }
974 }
975 #endif
976 return zBuf==zTemp ? fossil_strdup(zBuf) : zBuf;
977 }
978
979 /*
980 ** Return true if zPath is an absolute pathname. Return false
981 ** if it is relative.
982
+12
--- src/main.mk
+++ src/main.mk
@@ -41,10 +41,11 @@
4141
$(SRCDIR)/content.c \
4242
$(SRCDIR)/cookies.c \
4343
$(SRCDIR)/db.c \
4444
$(SRCDIR)/delta.c \
4545
$(SRCDIR)/deltacmd.c \
46
+ $(SRCDIR)/deltafunc.c \
4647
$(SRCDIR)/descendants.c \
4748
$(SRCDIR)/diff.c \
4849
$(SRCDIR)/diffcmd.c \
4950
$(SRCDIR)/dispatch.c \
5051
$(SRCDIR)/doc.c \
@@ -252,10 +253,11 @@
252253
$(OBJDIR)/content_.c \
253254
$(OBJDIR)/cookies_.c \
254255
$(OBJDIR)/db_.c \
255256
$(OBJDIR)/delta_.c \
256257
$(OBJDIR)/deltacmd_.c \
258
+ $(OBJDIR)/deltafunc_.c \
257259
$(OBJDIR)/descendants_.c \
258260
$(OBJDIR)/diff_.c \
259261
$(OBJDIR)/diffcmd_.c \
260262
$(OBJDIR)/dispatch_.c \
261263
$(OBJDIR)/doc_.c \
@@ -390,10 +392,11 @@
390392
$(OBJDIR)/content.o \
391393
$(OBJDIR)/cookies.o \
392394
$(OBJDIR)/db.o \
393395
$(OBJDIR)/delta.o \
394396
$(OBJDIR)/deltacmd.o \
397
+ $(OBJDIR)/deltafunc.o \
395398
$(OBJDIR)/descendants.o \
396399
$(OBJDIR)/diff.o \
397400
$(OBJDIR)/diffcmd.o \
398401
$(OBJDIR)/dispatch.o \
399402
$(OBJDIR)/doc.o \
@@ -724,10 +727,11 @@
724727
$(OBJDIR)/content_.c:$(OBJDIR)/content.h \
725728
$(OBJDIR)/cookies_.c:$(OBJDIR)/cookies.h \
726729
$(OBJDIR)/db_.c:$(OBJDIR)/db.h \
727730
$(OBJDIR)/delta_.c:$(OBJDIR)/delta.h \
728731
$(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h \
732
+ $(OBJDIR)/deltafunc_.c:$(OBJDIR)/deltafunc.h \
729733
$(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h \
730734
$(OBJDIR)/diff_.c:$(OBJDIR)/diff.h \
731735
$(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h \
732736
$(OBJDIR)/dispatch_.c:$(OBJDIR)/dispatch.h \
733737
$(OBJDIR)/doc_.c:$(OBJDIR)/doc.h \
@@ -1055,10 +1059,18 @@
10551059
10561060
$(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h
10571061
$(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c
10581062
10591063
$(OBJDIR)/deltacmd.h: $(OBJDIR)/headers
1064
+
1065
+$(OBJDIR)/deltafunc_.c: $(SRCDIR)/deltafunc.c $(OBJDIR)/translate
1066
+ $(OBJDIR)/translate $(SRCDIR)/deltafunc.c >$@
1067
+
1068
+$(OBJDIR)/deltafunc.o: $(OBJDIR)/deltafunc_.c $(OBJDIR)/deltafunc.h $(SRCDIR)/config.h
1069
+ $(XTCC) -o $(OBJDIR)/deltafunc.o -c $(OBJDIR)/deltafunc_.c
1070
+
1071
+$(OBJDIR)/deltafunc.h: $(OBJDIR)/headers
10601072
10611073
$(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(OBJDIR)/translate
10621074
$(OBJDIR)/translate $(SRCDIR)/descendants.c >$@
10631075
10641076
$(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h
10651077
--- src/main.mk
+++ src/main.mk
@@ -41,10 +41,11 @@
41 $(SRCDIR)/content.c \
42 $(SRCDIR)/cookies.c \
43 $(SRCDIR)/db.c \
44 $(SRCDIR)/delta.c \
45 $(SRCDIR)/deltacmd.c \
 
46 $(SRCDIR)/descendants.c \
47 $(SRCDIR)/diff.c \
48 $(SRCDIR)/diffcmd.c \
49 $(SRCDIR)/dispatch.c \
50 $(SRCDIR)/doc.c \
@@ -252,10 +253,11 @@
252 $(OBJDIR)/content_.c \
253 $(OBJDIR)/cookies_.c \
254 $(OBJDIR)/db_.c \
255 $(OBJDIR)/delta_.c \
256 $(OBJDIR)/deltacmd_.c \
 
257 $(OBJDIR)/descendants_.c \
258 $(OBJDIR)/diff_.c \
259 $(OBJDIR)/diffcmd_.c \
260 $(OBJDIR)/dispatch_.c \
261 $(OBJDIR)/doc_.c \
@@ -390,10 +392,11 @@
390 $(OBJDIR)/content.o \
391 $(OBJDIR)/cookies.o \
392 $(OBJDIR)/db.o \
393 $(OBJDIR)/delta.o \
394 $(OBJDIR)/deltacmd.o \
 
395 $(OBJDIR)/descendants.o \
396 $(OBJDIR)/diff.o \
397 $(OBJDIR)/diffcmd.o \
398 $(OBJDIR)/dispatch.o \
399 $(OBJDIR)/doc.o \
@@ -724,10 +727,11 @@
724 $(OBJDIR)/content_.c:$(OBJDIR)/content.h \
725 $(OBJDIR)/cookies_.c:$(OBJDIR)/cookies.h \
726 $(OBJDIR)/db_.c:$(OBJDIR)/db.h \
727 $(OBJDIR)/delta_.c:$(OBJDIR)/delta.h \
728 $(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h \
 
729 $(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h \
730 $(OBJDIR)/diff_.c:$(OBJDIR)/diff.h \
731 $(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h \
732 $(OBJDIR)/dispatch_.c:$(OBJDIR)/dispatch.h \
733 $(OBJDIR)/doc_.c:$(OBJDIR)/doc.h \
@@ -1055,10 +1059,18 @@
1055
1056 $(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h
1057 $(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c
1058
1059 $(OBJDIR)/deltacmd.h: $(OBJDIR)/headers
 
 
 
 
 
 
 
 
1060
1061 $(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(OBJDIR)/translate
1062 $(OBJDIR)/translate $(SRCDIR)/descendants.c >$@
1063
1064 $(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h
1065
--- src/main.mk
+++ src/main.mk
@@ -41,10 +41,11 @@
41 $(SRCDIR)/content.c \
42 $(SRCDIR)/cookies.c \
43 $(SRCDIR)/db.c \
44 $(SRCDIR)/delta.c \
45 $(SRCDIR)/deltacmd.c \
46 $(SRCDIR)/deltafunc.c \
47 $(SRCDIR)/descendants.c \
48 $(SRCDIR)/diff.c \
49 $(SRCDIR)/diffcmd.c \
50 $(SRCDIR)/dispatch.c \
51 $(SRCDIR)/doc.c \
@@ -252,10 +253,11 @@
253 $(OBJDIR)/content_.c \
254 $(OBJDIR)/cookies_.c \
255 $(OBJDIR)/db_.c \
256 $(OBJDIR)/delta_.c \
257 $(OBJDIR)/deltacmd_.c \
258 $(OBJDIR)/deltafunc_.c \
259 $(OBJDIR)/descendants_.c \
260 $(OBJDIR)/diff_.c \
261 $(OBJDIR)/diffcmd_.c \
262 $(OBJDIR)/dispatch_.c \
263 $(OBJDIR)/doc_.c \
@@ -390,10 +392,11 @@
392 $(OBJDIR)/content.o \
393 $(OBJDIR)/cookies.o \
394 $(OBJDIR)/db.o \
395 $(OBJDIR)/delta.o \
396 $(OBJDIR)/deltacmd.o \
397 $(OBJDIR)/deltafunc.o \
398 $(OBJDIR)/descendants.o \
399 $(OBJDIR)/diff.o \
400 $(OBJDIR)/diffcmd.o \
401 $(OBJDIR)/dispatch.o \
402 $(OBJDIR)/doc.o \
@@ -724,10 +727,11 @@
727 $(OBJDIR)/content_.c:$(OBJDIR)/content.h \
728 $(OBJDIR)/cookies_.c:$(OBJDIR)/cookies.h \
729 $(OBJDIR)/db_.c:$(OBJDIR)/db.h \
730 $(OBJDIR)/delta_.c:$(OBJDIR)/delta.h \
731 $(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h \
732 $(OBJDIR)/deltafunc_.c:$(OBJDIR)/deltafunc.h \
733 $(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h \
734 $(OBJDIR)/diff_.c:$(OBJDIR)/diff.h \
735 $(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h \
736 $(OBJDIR)/dispatch_.c:$(OBJDIR)/dispatch.h \
737 $(OBJDIR)/doc_.c:$(OBJDIR)/doc.h \
@@ -1055,10 +1059,18 @@
1059
1060 $(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h
1061 $(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c
1062
1063 $(OBJDIR)/deltacmd.h: $(OBJDIR)/headers
1064
1065 $(OBJDIR)/deltafunc_.c: $(SRCDIR)/deltafunc.c $(OBJDIR)/translate
1066 $(OBJDIR)/translate $(SRCDIR)/deltafunc.c >$@
1067
1068 $(OBJDIR)/deltafunc.o: $(OBJDIR)/deltafunc_.c $(OBJDIR)/deltafunc.h $(SRCDIR)/config.h
1069 $(XTCC) -o $(OBJDIR)/deltafunc.o -c $(OBJDIR)/deltafunc_.c
1070
1071 $(OBJDIR)/deltafunc.h: $(OBJDIR)/headers
1072
1073 $(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(OBJDIR)/translate
1074 $(OBJDIR)/translate $(SRCDIR)/descendants.c >$@
1075
1076 $(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h
1077
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -52,10 +52,11 @@
5252
content
5353
cookies
5454
db
5555
delta
5656
deltacmd
57
+ deltafunc
5758
descendants
5859
diff
5960
diffcmd
6061
dispatch
6162
doc
@@ -710,11 +711,11 @@
710711
#### The directories where the OpenSSL include and library files are located.
711712
# The recommended usage here is to use the Sysinternals junction tool
712713
# to create a hard link between an "openssl-1.x" sub-directory of the
713714
# Fossil source code directory and the target OpenSSL source directory.
714715
#
715
-OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1a
716
+OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1b
716717
OPENSSLINCDIR = $(OPENSSLDIR)/include
717718
OPENSSLLIBDIR = $(OPENSSLDIR)
718719
719720
#### Either the directory where the Tcl library is installed or the Tcl
720721
# source code directory resides (depending on the value of the macro
@@ -1566,11 +1567,11 @@
15661567
!ifndef USE_SEE
15671568
USE_SEE = 0
15681569
!endif
15691570
15701571
!if $(FOSSIL_ENABLE_SSL)!=0
1571
-SSLDIR = $(B)\compat\openssl-1.1.1a
1572
+SSLDIR = $(B)\compat\openssl-1.1.1b
15721573
SSLINCDIR = $(SSLDIR)\include
15731574
!if $(FOSSIL_DYNAMIC_BUILD)!=0
15741575
SSLLIBDIR = $(SSLDIR)
15751576
!else
15761577
SSLLIBDIR = $(SSLDIR)
15771578
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -52,10 +52,11 @@
52 content
53 cookies
54 db
55 delta
56 deltacmd
 
57 descendants
58 diff
59 diffcmd
60 dispatch
61 doc
@@ -710,11 +711,11 @@
710 #### The directories where the OpenSSL include and library files are located.
711 # The recommended usage here is to use the Sysinternals junction tool
712 # to create a hard link between an "openssl-1.x" sub-directory of the
713 # Fossil source code directory and the target OpenSSL source directory.
714 #
715 OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1a
716 OPENSSLINCDIR = $(OPENSSLDIR)/include
717 OPENSSLLIBDIR = $(OPENSSLDIR)
718
719 #### Either the directory where the Tcl library is installed or the Tcl
720 # source code directory resides (depending on the value of the macro
@@ -1566,11 +1567,11 @@
1566 !ifndef USE_SEE
1567 USE_SEE = 0
1568 !endif
1569
1570 !if $(FOSSIL_ENABLE_SSL)!=0
1571 SSLDIR = $(B)\compat\openssl-1.1.1a
1572 SSLINCDIR = $(SSLDIR)\include
1573 !if $(FOSSIL_DYNAMIC_BUILD)!=0
1574 SSLLIBDIR = $(SSLDIR)
1575 !else
1576 SSLLIBDIR = $(SSLDIR)
1577
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -52,10 +52,11 @@
52 content
53 cookies
54 db
55 delta
56 deltacmd
57 deltafunc
58 descendants
59 diff
60 diffcmd
61 dispatch
62 doc
@@ -710,11 +711,11 @@
711 #### The directories where the OpenSSL include and library files are located.
712 # The recommended usage here is to use the Sysinternals junction tool
713 # to create a hard link between an "openssl-1.x" sub-directory of the
714 # Fossil source code directory and the target OpenSSL source directory.
715 #
716 OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1b
717 OPENSSLINCDIR = $(OPENSSLDIR)/include
718 OPENSSLLIBDIR = $(OPENSSLDIR)
719
720 #### Either the directory where the Tcl library is installed or the Tcl
721 # source code directory resides (depending on the value of the macro
@@ -1566,11 +1567,11 @@
1567 !ifndef USE_SEE
1568 USE_SEE = 0
1569 !endif
1570
1571 !if $(FOSSIL_ENABLE_SSL)!=0
1572 SSLDIR = $(B)\compat\openssl-1.1.1b
1573 SSLINCDIR = $(SSLDIR)\include
1574 !if $(FOSSIL_DYNAMIC_BUILD)!=0
1575 SSLLIBDIR = $(SSLDIR)
1576 !else
1577 SSLLIBDIR = $(SSLDIR)
1578
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -52,10 +52,11 @@
5252
content
5353
cookies
5454
db
5555
delta
5656
deltacmd
57
+ deltafunc
5758
descendants
5859
diff
5960
diffcmd
6061
dispatch
6162
doc
@@ -710,11 +711,11 @@
710711
#### The directories where the OpenSSL include and library files are located.
711712
# The recommended usage here is to use the Sysinternals junction tool
712713
# to create a hard link between an "openssl-1.x" sub-directory of the
713714
# Fossil source code directory and the target OpenSSL source directory.
714715
#
715
-OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1a
716
+OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1b
716717
OPENSSLINCDIR = $(OPENSSLDIR)/include
717718
OPENSSLLIBDIR = $(OPENSSLDIR)
718719
719720
#### Either the directory where the Tcl library is installed or the Tcl
720721
# source code directory resides (depending on the value of the macro
@@ -1566,11 +1567,11 @@
15661567
!ifndef USE_SEE
15671568
USE_SEE = 0
15681569
!endif
15691570
15701571
!if $(FOSSIL_ENABLE_SSL)!=0
1571
-SSLDIR = $(B)\compat\openssl-1.1.1a
1572
+SSLDIR = $(B)\compat\openssl-1.1.1b
15721573
SSLINCDIR = $(SSLDIR)\include
15731574
!if $(FOSSIL_DYNAMIC_BUILD)!=0
15741575
SSLLIBDIR = $(SSLDIR)
15751576
!else
15761577
SSLLIBDIR = $(SSLDIR)
15771578
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -52,10 +52,11 @@
52 content
53 cookies
54 db
55 delta
56 deltacmd
 
57 descendants
58 diff
59 diffcmd
60 dispatch
61 doc
@@ -710,11 +711,11 @@
710 #### The directories where the OpenSSL include and library files are located.
711 # The recommended usage here is to use the Sysinternals junction tool
712 # to create a hard link between an "openssl-1.x" sub-directory of the
713 # Fossil source code directory and the target OpenSSL source directory.
714 #
715 OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1a
716 OPENSSLINCDIR = $(OPENSSLDIR)/include
717 OPENSSLLIBDIR = $(OPENSSLDIR)
718
719 #### Either the directory where the Tcl library is installed or the Tcl
720 # source code directory resides (depending on the value of the macro
@@ -1566,11 +1567,11 @@
1566 !ifndef USE_SEE
1567 USE_SEE = 0
1568 !endif
1569
1570 !if $(FOSSIL_ENABLE_SSL)!=0
1571 SSLDIR = $(B)\compat\openssl-1.1.1a
1572 SSLINCDIR = $(SSLDIR)\include
1573 !if $(FOSSIL_DYNAMIC_BUILD)!=0
1574 SSLLIBDIR = $(SSLDIR)
1575 !else
1576 SSLLIBDIR = $(SSLDIR)
1577
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -52,10 +52,11 @@
52 content
53 cookies
54 db
55 delta
56 deltacmd
57 deltafunc
58 descendants
59 diff
60 diffcmd
61 dispatch
62 doc
@@ -710,11 +711,11 @@
711 #### The directories where the OpenSSL include and library files are located.
712 # The recommended usage here is to use the Sysinternals junction tool
713 # to create a hard link between an "openssl-1.x" sub-directory of the
714 # Fossil source code directory and the target OpenSSL source directory.
715 #
716 OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1b
717 OPENSSLINCDIR = $(OPENSSLDIR)/include
718 OPENSSLLIBDIR = $(OPENSSLDIR)
719
720 #### Either the directory where the Tcl library is installed or the Tcl
721 # source code directory resides (depending on the value of the macro
@@ -1566,11 +1567,11 @@
1567 !ifndef USE_SEE
1568 USE_SEE = 0
1569 !endif
1570
1571 !if $(FOSSIL_ENABLE_SSL)!=0
1572 SSLDIR = $(B)\compat\openssl-1.1.1b
1573 SSLINCDIR = $(SSLDIR)\include
1574 !if $(FOSSIL_DYNAMIC_BUILD)!=0
1575 SSLLIBDIR = $(SSLDIR)
1576 !else
1577 SSLLIBDIR = $(SSLDIR)
1578
+17 -19
--- src/regexp.c
+++ src/regexp.c
@@ -13,11 +13,11 @@
1313
** [email protected]
1414
** http://www.hwaci.com/drh/
1515
**
1616
*******************************************************************************
1717
**
18
-** This file was adapted from the test_regexp.c file in SQLite3. That
18
+** This file was adapted from the ext/misc/regexp.c file in SQLite3. That
1919
** file is in the public domain.
2020
**
2121
** See ../www/grep.md for details of the algorithm and RE dialect.
2222
*/
2323
#include "config.h"
@@ -87,11 +87,11 @@
8787
8888
/* Add a state to the given state set if it is not already there */
8989
static void re_add_state(ReStateSet *pSet, int newState){
9090
unsigned i;
9191
for(i=0; i<pSet->nState; i++) if( pSet->aState[i]==newState ) return;
92
- pSet->aState[pSet->nState++] = newState;
92
+ pSet->aState[pSet->nState++] = (ReStateNumber)newState;
9393
}
9494
9595
/* Extract the next unicode character from *pzIn and return it. Advance
9696
** *pzIn to the first byte past the end of the character returned. To
9797
** be clear: this routine converts utf8 to unicode. This routine is
@@ -122,11 +122,11 @@
122122
}
123123
return c;
124124
}
125125
static unsigned re_next_char_nocase(ReInput *p){
126126
unsigned c = re_next_char(p);
127
- return unicode_fold(c,1);
127
+ return unicode_fold(c,2);
128128
}
129129
130130
/* Return true if c is a perl "word" character: [A-Za-z0-9_] */
131131
static int re_word_char(int c){
132132
return unicode_isalnum(c) || c=='_';
@@ -156,11 +156,11 @@
156156
int rc = 0;
157157
ReInput in;
158158
159159
in.z = zIn;
160160
in.i = 0;
161
- in.mx = nIn>=0 ? nIn : strlen((const char*)zIn);
161
+ in.mx = nIn>=0 ? nIn : (int)strlen((char const*)zIn);
162162
163163
/* Look for the initial prefix match, if there is one. */
164164
if( pRe->nInit ){
165165
unsigned char x = pRe->zInit[0];
166166
while( in.i+pRe->nInit<=in.mx
@@ -170,11 +170,11 @@
170170
in.i++;
171171
}
172172
if( in.i+pRe->nInit>in.mx ) return 0;
173173
}
174174
175
- if( pRe->nState<=count(aSpace)*2 ){
175
+ if( pRe->nState<=(sizeof(aSpace)/(sizeof(aSpace[0])*2)) ){
176176
pToFree = 0;
177177
aStateSet[0].aState = aSpace;
178178
}else{
179179
pToFree = fossil_malloc( sizeof(ReStateNumber)*2*pRe->nState );
180180
if( pToFree==0 ) return -1;
@@ -307,11 +307,11 @@
307307
for(i=p->nState; i>iBefore; i--){
308308
p->aOp[i] = p->aOp[i-1];
309309
p->aArg[i] = p->aArg[i-1];
310310
}
311311
p->nState++;
312
- p->aOp[iBefore] = op;
312
+ p->aOp[iBefore] = (char)op;
313313
p->aArg[iBefore] = arg;
314314
return iBefore;
315315
}
316316
317317
/* Append a new opcode and argument to the end of the RE under construction.
@@ -596,11 +596,11 @@
596596
}else{
597597
re_append(pRe, RE_OP_ANYSTAR, 0);
598598
}
599599
pRe->sIn.z = (unsigned char*)zIn;
600600
pRe->sIn.i = 0;
601
- pRe->sIn.mx = strlen(zIn);
601
+ pRe->sIn.mx = (int)strlen(zIn);
602602
zErr = re_subcompile_re(pRe);
603603
if( zErr ){
604604
re_free(pRe);
605605
return zErr;
606606
}
@@ -626,16 +626,16 @@
626626
** just an optimization. */
627627
if( pRe->aOp[0]==RE_OP_ANYSTAR ){
628628
for(j=0, i=1; j<sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){
629629
unsigned x = pRe->aArg[i];
630630
if( x<=127 ){
631
- pRe->zInit[j++] = x;
631
+ pRe->zInit[j++] = (unsigned char)x;
632632
}else if( x<=0xfff ){
633
- pRe->zInit[j++] = 0xc0 | (x>>6);
633
+ pRe->zInit[j++] = (unsigned char)(0xc0 | (x>>6));
634634
pRe->zInit[j++] = 0x80 | (x&0x3f);
635635
}else if( x<=0xffff ){
636
- pRe->zInit[j++] = 0xd0 | (x>>12);
636
+ pRe->zInit[j++] = (unsigned char)(0xd0 | (x>>12));
637637
pRe->zInit[j++] = 0x80 | ((x>>6)&0x3f);
638638
pRe->zInit[j++] = 0x80 | (x&0x3f);
639639
}else{
640640
break;
641641
}
@@ -662,42 +662,40 @@
662662
){
663663
ReCompiled *pRe; /* Compiled regular expression */
664664
const char *zPattern; /* The regular expression */
665665
const unsigned char *zStr;/* String being searched */
666666
const char *zErr; /* Compile error message */
667
+ int setAux = 0; /* True to invoke sqlite3_set_auxdata() */
667668
668669
pRe = sqlite3_get_auxdata(context, 0);
669670
if( pRe==0 ){
670671
zPattern = (const char*)sqlite3_value_text(argv[0]);
671672
if( zPattern==0 ) return;
672673
zErr = re_compile(&pRe, zPattern, 0);
673674
if( zErr ){
675
+ re_free(pRe);
674676
sqlite3_result_error(context, zErr, -1);
675677
return;
676678
}
677679
if( pRe==0 ){
678680
sqlite3_result_error_nomem(context);
679681
return;
680682
}
681
- sqlite3_set_auxdata(context, 0, pRe, (void(*)(void*))re_free);
683
+ setAux = 1;
682684
}
683685
zStr = (const unsigned char*)sqlite3_value_text(argv[1]);
684686
if( zStr!=0 ){
685687
sqlite3_result_int(context, re_match(pRe, zStr, -1));
686688
}
689
+ if( setAux ){
690
+ sqlite3_set_auxdata(context, 0, pRe, (void(*)(void*))re_free);
691
+ }
687692
}
688693
689694
/*
690
-** Invoke this routine in order to install the REGEXP function in an
695
+** Invoke this routine to register the regexp() function with the
691696
** SQLite database connection.
692
-**
693
-** Use:
694
-**
695
-** sqlite3_auto_extension(sqlite3_add_regexp_func);
696
-**
697
-** to cause this extension to be automatically loaded into each new
698
-** database connection.
699697
*/
700698
int re_add_sql_func(sqlite3 *db){
701699
return sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8, 0,
702700
re_sql_func, 0, 0);
703701
}
704702
--- src/regexp.c
+++ src/regexp.c
@@ -13,11 +13,11 @@
13 ** [email protected]
14 ** http://www.hwaci.com/drh/
15 **
16 *******************************************************************************
17 **
18 ** This file was adapted from the test_regexp.c file in SQLite3. That
19 ** file is in the public domain.
20 **
21 ** See ../www/grep.md for details of the algorithm and RE dialect.
22 */
23 #include "config.h"
@@ -87,11 +87,11 @@
87
88 /* Add a state to the given state set if it is not already there */
89 static void re_add_state(ReStateSet *pSet, int newState){
90 unsigned i;
91 for(i=0; i<pSet->nState; i++) if( pSet->aState[i]==newState ) return;
92 pSet->aState[pSet->nState++] = newState;
93 }
94
95 /* Extract the next unicode character from *pzIn and return it. Advance
96 ** *pzIn to the first byte past the end of the character returned. To
97 ** be clear: this routine converts utf8 to unicode. This routine is
@@ -122,11 +122,11 @@
122 }
123 return c;
124 }
125 static unsigned re_next_char_nocase(ReInput *p){
126 unsigned c = re_next_char(p);
127 return unicode_fold(c,1);
128 }
129
130 /* Return true if c is a perl "word" character: [A-Za-z0-9_] */
131 static int re_word_char(int c){
132 return unicode_isalnum(c) || c=='_';
@@ -156,11 +156,11 @@
156 int rc = 0;
157 ReInput in;
158
159 in.z = zIn;
160 in.i = 0;
161 in.mx = nIn>=0 ? nIn : strlen((const char*)zIn);
162
163 /* Look for the initial prefix match, if there is one. */
164 if( pRe->nInit ){
165 unsigned char x = pRe->zInit[0];
166 while( in.i+pRe->nInit<=in.mx
@@ -170,11 +170,11 @@
170 in.i++;
171 }
172 if( in.i+pRe->nInit>in.mx ) return 0;
173 }
174
175 if( pRe->nState<=count(aSpace)*2 ){
176 pToFree = 0;
177 aStateSet[0].aState = aSpace;
178 }else{
179 pToFree = fossil_malloc( sizeof(ReStateNumber)*2*pRe->nState );
180 if( pToFree==0 ) return -1;
@@ -307,11 +307,11 @@
307 for(i=p->nState; i>iBefore; i--){
308 p->aOp[i] = p->aOp[i-1];
309 p->aArg[i] = p->aArg[i-1];
310 }
311 p->nState++;
312 p->aOp[iBefore] = op;
313 p->aArg[iBefore] = arg;
314 return iBefore;
315 }
316
317 /* Append a new opcode and argument to the end of the RE under construction.
@@ -596,11 +596,11 @@
596 }else{
597 re_append(pRe, RE_OP_ANYSTAR, 0);
598 }
599 pRe->sIn.z = (unsigned char*)zIn;
600 pRe->sIn.i = 0;
601 pRe->sIn.mx = strlen(zIn);
602 zErr = re_subcompile_re(pRe);
603 if( zErr ){
604 re_free(pRe);
605 return zErr;
606 }
@@ -626,16 +626,16 @@
626 ** just an optimization. */
627 if( pRe->aOp[0]==RE_OP_ANYSTAR ){
628 for(j=0, i=1; j<sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){
629 unsigned x = pRe->aArg[i];
630 if( x<=127 ){
631 pRe->zInit[j++] = x;
632 }else if( x<=0xfff ){
633 pRe->zInit[j++] = 0xc0 | (x>>6);
634 pRe->zInit[j++] = 0x80 | (x&0x3f);
635 }else if( x<=0xffff ){
636 pRe->zInit[j++] = 0xd0 | (x>>12);
637 pRe->zInit[j++] = 0x80 | ((x>>6)&0x3f);
638 pRe->zInit[j++] = 0x80 | (x&0x3f);
639 }else{
640 break;
641 }
@@ -662,42 +662,40 @@
662 ){
663 ReCompiled *pRe; /* Compiled regular expression */
664 const char *zPattern; /* The regular expression */
665 const unsigned char *zStr;/* String being searched */
666 const char *zErr; /* Compile error message */
 
667
668 pRe = sqlite3_get_auxdata(context, 0);
669 if( pRe==0 ){
670 zPattern = (const char*)sqlite3_value_text(argv[0]);
671 if( zPattern==0 ) return;
672 zErr = re_compile(&pRe, zPattern, 0);
673 if( zErr ){
 
674 sqlite3_result_error(context, zErr, -1);
675 return;
676 }
677 if( pRe==0 ){
678 sqlite3_result_error_nomem(context);
679 return;
680 }
681 sqlite3_set_auxdata(context, 0, pRe, (void(*)(void*))re_free);
682 }
683 zStr = (const unsigned char*)sqlite3_value_text(argv[1]);
684 if( zStr!=0 ){
685 sqlite3_result_int(context, re_match(pRe, zStr, -1));
686 }
 
 
 
687 }
688
689 /*
690 ** Invoke this routine in order to install the REGEXP function in an
691 ** SQLite database connection.
692 **
693 ** Use:
694 **
695 ** sqlite3_auto_extension(sqlite3_add_regexp_func);
696 **
697 ** to cause this extension to be automatically loaded into each new
698 ** database connection.
699 */
700 int re_add_sql_func(sqlite3 *db){
701 return sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8, 0,
702 re_sql_func, 0, 0);
703 }
704
--- src/regexp.c
+++ src/regexp.c
@@ -13,11 +13,11 @@
13 ** [email protected]
14 ** http://www.hwaci.com/drh/
15 **
16 *******************************************************************************
17 **
18 ** This file was adapted from the ext/misc/regexp.c file in SQLite3. That
19 ** file is in the public domain.
20 **
21 ** See ../www/grep.md for details of the algorithm and RE dialect.
22 */
23 #include "config.h"
@@ -87,11 +87,11 @@
87
88 /* Add a state to the given state set if it is not already there */
89 static void re_add_state(ReStateSet *pSet, int newState){
90 unsigned i;
91 for(i=0; i<pSet->nState; i++) if( pSet->aState[i]==newState ) return;
92 pSet->aState[pSet->nState++] = (ReStateNumber)newState;
93 }
94
95 /* Extract the next unicode character from *pzIn and return it. Advance
96 ** *pzIn to the first byte past the end of the character returned. To
97 ** be clear: this routine converts utf8 to unicode. This routine is
@@ -122,11 +122,11 @@
122 }
123 return c;
124 }
125 static unsigned re_next_char_nocase(ReInput *p){
126 unsigned c = re_next_char(p);
127 return unicode_fold(c,2);
128 }
129
130 /* Return true if c is a perl "word" character: [A-Za-z0-9_] */
131 static int re_word_char(int c){
132 return unicode_isalnum(c) || c=='_';
@@ -156,11 +156,11 @@
156 int rc = 0;
157 ReInput in;
158
159 in.z = zIn;
160 in.i = 0;
161 in.mx = nIn>=0 ? nIn : (int)strlen((char const*)zIn);
162
163 /* Look for the initial prefix match, if there is one. */
164 if( pRe->nInit ){
165 unsigned char x = pRe->zInit[0];
166 while( in.i+pRe->nInit<=in.mx
@@ -170,11 +170,11 @@
170 in.i++;
171 }
172 if( in.i+pRe->nInit>in.mx ) return 0;
173 }
174
175 if( pRe->nState<=(sizeof(aSpace)/(sizeof(aSpace[0])*2)) ){
176 pToFree = 0;
177 aStateSet[0].aState = aSpace;
178 }else{
179 pToFree = fossil_malloc( sizeof(ReStateNumber)*2*pRe->nState );
180 if( pToFree==0 ) return -1;
@@ -307,11 +307,11 @@
307 for(i=p->nState; i>iBefore; i--){
308 p->aOp[i] = p->aOp[i-1];
309 p->aArg[i] = p->aArg[i-1];
310 }
311 p->nState++;
312 p->aOp[iBefore] = (char)op;
313 p->aArg[iBefore] = arg;
314 return iBefore;
315 }
316
317 /* Append a new opcode and argument to the end of the RE under construction.
@@ -596,11 +596,11 @@
596 }else{
597 re_append(pRe, RE_OP_ANYSTAR, 0);
598 }
599 pRe->sIn.z = (unsigned char*)zIn;
600 pRe->sIn.i = 0;
601 pRe->sIn.mx = (int)strlen(zIn);
602 zErr = re_subcompile_re(pRe);
603 if( zErr ){
604 re_free(pRe);
605 return zErr;
606 }
@@ -626,16 +626,16 @@
626 ** just an optimization. */
627 if( pRe->aOp[0]==RE_OP_ANYSTAR ){
628 for(j=0, i=1; j<sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){
629 unsigned x = pRe->aArg[i];
630 if( x<=127 ){
631 pRe->zInit[j++] = (unsigned char)x;
632 }else if( x<=0xfff ){
633 pRe->zInit[j++] = (unsigned char)(0xc0 | (x>>6));
634 pRe->zInit[j++] = 0x80 | (x&0x3f);
635 }else if( x<=0xffff ){
636 pRe->zInit[j++] = (unsigned char)(0xd0 | (x>>12));
637 pRe->zInit[j++] = 0x80 | ((x>>6)&0x3f);
638 pRe->zInit[j++] = 0x80 | (x&0x3f);
639 }else{
640 break;
641 }
@@ -662,42 +662,40 @@
662 ){
663 ReCompiled *pRe; /* Compiled regular expression */
664 const char *zPattern; /* The regular expression */
665 const unsigned char *zStr;/* String being searched */
666 const char *zErr; /* Compile error message */
667 int setAux = 0; /* True to invoke sqlite3_set_auxdata() */
668
669 pRe = sqlite3_get_auxdata(context, 0);
670 if( pRe==0 ){
671 zPattern = (const char*)sqlite3_value_text(argv[0]);
672 if( zPattern==0 ) return;
673 zErr = re_compile(&pRe, zPattern, 0);
674 if( zErr ){
675 re_free(pRe);
676 sqlite3_result_error(context, zErr, -1);
677 return;
678 }
679 if( pRe==0 ){
680 sqlite3_result_error_nomem(context);
681 return;
682 }
683 setAux = 1;
684 }
685 zStr = (const unsigned char*)sqlite3_value_text(argv[1]);
686 if( zStr!=0 ){
687 sqlite3_result_int(context, re_match(pRe, zStr, -1));
688 }
689 if( setAux ){
690 sqlite3_set_auxdata(context, 0, pRe, (void(*)(void*))re_free);
691 }
692 }
693
694 /*
695 ** Invoke this routine to register the regexp() function with the
696 ** SQLite database connection.
 
 
 
 
 
 
 
697 */
698 int re_add_sql_func(sqlite3 *db){
699 return sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8, 0,
700 re_sql_func, 0, 0);
701 }
702
+25 -9
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -148,10 +148,11 @@
148148
add_content_sql_commands(db);
149149
db_add_aux_functions(db);
150150
re_add_sql_func(db);
151151
search_sql_setup(db);
152152
foci_register(db);
153
+ deltafunc_init(db);
153154
g.repositoryOpen = 1;
154155
g.db = db;
155156
sqlite3_db_config(db, SQLITE_DBCONFIG_MAINDBNAME, "repository");
156157
db_maybe_set_encryption_key(db, g.zRepositoryName);
157158
if( g.zLocalDbName ){
@@ -255,32 +256,47 @@
255256
** in ways that are unrecoverable. Be sure you know what you are doing before
256257
** running any SQL commands that modify the repository database.
257258
**
258259
** The following extensions to the usual SQLite commands are provided:
259260
**
260
-** content(X) Return the content of artifact X. X can be an
261
-** artifact hash or prefix or a tag.
261
+** checkin_mtime(X,Y) Return the mtime for the file Y (a BLOB.RID)
262
+** found in check-in X (another BLOB.RID value).
262263
**
263264
** compress(X) Compress text X.
264265
**
266
+** content(X) Return the content of artifact X. X can be an
267
+** artifact hash or hash prefix or a tag. Artifacts
268
+** are stored compressed and deltaed. This function
269
+** does all necessary decompression and undeltaing.
270
+**
265271
** decompress(X) Decompress text X. Undoes the work of
266272
** compress(X).
267273
**
268
-** checkin_mtime(X,Y) Return the mtime for the file Y (a BLOB.RID)
269
-** found in check-in X (another BLOB.RID value).
274
+** delta_apply(X,D) Apply delta D to source blob X and return
275
+** the result.
276
+**
277
+** delta_create(X,Y) Create and return a delta that will convert
278
+** X into Y.
279
+**
280
+** delta_output_size(D) Return the number of bytes of output to expect
281
+** when applying delta D
282
+**
283
+** delta_parse(D) A table-valued function that deconstructs
284
+** delta D and returns rows for each element of
285
+** that delta.
270286
**
271
-** symbolic_name_to_rid(X) Return the BLOB.RID corresponding to symbolic
272
-** name X.
287
+** files_of_checkin(X) A table-valued function that returns info on
288
+** all files contained in check-in X. Example:
289
+** SELECT * FROM files_of_checkin('trunk');
273290
**
274291
** now() Return the number of seconds since 1970.
275292
**
276293
** REGEXP The REGEXP operator works, unlike in
277294
** standard SQLite.
278295
**
279
-** files_of_checkin(X) A table-valued function that returns info on
280
-** all files contained in check-in X. Example:
281
-** SELECT * FROM files_of_checkin('trunk');
296
+** symbolic_name_to_rid(X) Return the BLOB.RID corresponding to symbolic
297
+** name X.
282298
*/
283299
void cmd_sqlite3(void){
284300
int noRepository;
285301
const char *zConfigDb;
286302
extern int sqlite3_shell(int, char**);
287303
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -148,10 +148,11 @@
148 add_content_sql_commands(db);
149 db_add_aux_functions(db);
150 re_add_sql_func(db);
151 search_sql_setup(db);
152 foci_register(db);
 
153 g.repositoryOpen = 1;
154 g.db = db;
155 sqlite3_db_config(db, SQLITE_DBCONFIG_MAINDBNAME, "repository");
156 db_maybe_set_encryption_key(db, g.zRepositoryName);
157 if( g.zLocalDbName ){
@@ -255,32 +256,47 @@
255 ** in ways that are unrecoverable. Be sure you know what you are doing before
256 ** running any SQL commands that modify the repository database.
257 **
258 ** The following extensions to the usual SQLite commands are provided:
259 **
260 ** content(X) Return the content of artifact X. X can be an
261 ** artifact hash or prefix or a tag.
262 **
263 ** compress(X) Compress text X.
264 **
 
 
 
 
 
265 ** decompress(X) Decompress text X. Undoes the work of
266 ** compress(X).
267 **
268 ** checkin_mtime(X,Y) Return the mtime for the file Y (a BLOB.RID)
269 ** found in check-in X (another BLOB.RID value).
 
 
 
 
 
 
 
 
 
 
270 **
271 ** symbolic_name_to_rid(X) Return the BLOB.RID corresponding to symbolic
272 ** name X.
 
273 **
274 ** now() Return the number of seconds since 1970.
275 **
276 ** REGEXP The REGEXP operator works, unlike in
277 ** standard SQLite.
278 **
279 ** files_of_checkin(X) A table-valued function that returns info on
280 ** all files contained in check-in X. Example:
281 ** SELECT * FROM files_of_checkin('trunk');
282 */
283 void cmd_sqlite3(void){
284 int noRepository;
285 const char *zConfigDb;
286 extern int sqlite3_shell(int, char**);
287
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -148,10 +148,11 @@
148 add_content_sql_commands(db);
149 db_add_aux_functions(db);
150 re_add_sql_func(db);
151 search_sql_setup(db);
152 foci_register(db);
153 deltafunc_init(db);
154 g.repositoryOpen = 1;
155 g.db = db;
156 sqlite3_db_config(db, SQLITE_DBCONFIG_MAINDBNAME, "repository");
157 db_maybe_set_encryption_key(db, g.zRepositoryName);
158 if( g.zLocalDbName ){
@@ -255,32 +256,47 @@
256 ** in ways that are unrecoverable. Be sure you know what you are doing before
257 ** running any SQL commands that modify the repository database.
258 **
259 ** The following extensions to the usual SQLite commands are provided:
260 **
261 ** checkin_mtime(X,Y) Return the mtime for the file Y (a BLOB.RID)
262 ** found in check-in X (another BLOB.RID value).
263 **
264 ** compress(X) Compress text X.
265 **
266 ** content(X) Return the content of artifact X. X can be an
267 ** artifact hash or hash prefix or a tag. Artifacts
268 ** are stored compressed and deltaed. This function
269 ** does all necessary decompression and undeltaing.
270 **
271 ** decompress(X) Decompress text X. Undoes the work of
272 ** compress(X).
273 **
274 ** delta_apply(X,D) Apply delta D to source blob X and return
275 ** the result.
276 **
277 ** delta_create(X,Y) Create and return a delta that will convert
278 ** X into Y.
279 **
280 ** delta_output_size(D) Return the number of bytes of output to expect
281 ** when applying delta D
282 **
283 ** delta_parse(D) A table-valued function that deconstructs
284 ** delta D and returns rows for each element of
285 ** that delta.
286 **
287 ** files_of_checkin(X) A table-valued function that returns info on
288 ** all files contained in check-in X. Example:
289 ** SELECT * FROM files_of_checkin('trunk');
290 **
291 ** now() Return the number of seconds since 1970.
292 **
293 ** REGEXP The REGEXP operator works, unlike in
294 ** standard SQLite.
295 **
296 ** symbolic_name_to_rid(X) Return the BLOB.RID corresponding to symbolic
297 ** name X.
 
298 */
299 void cmd_sqlite3(void){
300 int noRepository;
301 const char *zConfigDb;
302 extern int sqlite3_shell(int, char**);
303
+477 -385
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
11
/******************************************************************************
22
** This file is an amalgamation of many separate C source files from SQLite
3
-** version 3.27.1. By combining all the individual C code files into this
3
+** version 3.28.0. By combining all the individual C code files into this
44
** single large file, the entire code can be compiled as a single translation
55
** unit. This allows many compilers to do optimizations that would not be
66
** possible if the files were compiled separately. Performance improvements
77
** of 5% or more are commonly seen when SQLite is compiled as a single
88
** translation unit.
@@ -1160,13 +1160,13 @@
11601160
**
11611161
** See also: [sqlite3_libversion()],
11621162
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
11631163
** [sqlite_version()] and [sqlite_source_id()].
11641164
*/
1165
-#define SQLITE_VERSION "3.27.1"
1166
-#define SQLITE_VERSION_NUMBER 3027001
1167
-#define SQLITE_SOURCE_ID "2019-02-08 13:17:39 0eca3dd3d38b31c92b49ca2d311128b74584714d9e7de895b1a6286ef959a1dd"
1165
+#define SQLITE_VERSION "3.28.0"
1166
+#define SQLITE_VERSION_NUMBER 3028000
1167
+#define SQLITE_SOURCE_ID "2019-02-25 14:52:43 9da4fb59b28686630d63a79988b458726332cf06cc0e6e84d7c0a7600f5fcab0"
11681168
11691169
/*
11701170
** CAPI3REF: Run-Time Library Version Numbers
11711171
** KEYWORDS: sqlite3_version sqlite3_sourceid
11721172
**
@@ -3406,11 +3406,11 @@
34063406
** ^Changes made as part of [foreign key actions] are included in the
34073407
** count, but those made as part of REPLACE constraint resolution are
34083408
** not. ^Changes to a view that are intercepted by INSTEAD OF triggers
34093409
** are not counted.
34103410
**
3411
-** This the [sqlite3_total_changes(D)] interface only reports the number
3411
+** The [sqlite3_total_changes(D)] interface only reports the number
34123412
** of rows that changed due to SQL statement run against database
34133413
** connection D. Any changes by other database connections are ignored.
34143414
** To detect changes against a database file from other database
34153415
** connections use the [PRAGMA data_version] command or the
34163416
** [SQLITE_FCNTL_DATA_VERSION] [file control].
@@ -12338,11 +12338,11 @@
1233812338
** xSetAuxdata(pFts5, pAux, xDelete)
1233912339
**
1234012340
** Save the pointer passed as the second argument as the extension functions
1234112341
** "auxiliary data". The pointer may then be retrieved by the current or any
1234212342
** future invocation of the same fts5 extension function made as part of
12343
-** of the same MATCH query using the xGetAuxdata() API.
12343
+** the same MATCH query using the xGetAuxdata() API.
1234412344
**
1234512345
** Each extension function is allocated a single auxiliary data slot for
1234612346
** each FTS query (MATCH expression). If the extension function is invoked
1234712347
** more than once for a single FTS query, then all invocations share a
1234812348
** single auxiliary data context.
@@ -12353,11 +12353,11 @@
1235312353
** point.
1235412354
**
1235512355
** The xDelete callback, if one is specified, is also invoked on the
1235612356
** auxiliary data pointer after the FTS5 query has finished.
1235712357
**
12358
-** If an error (e.g. an OOM condition) occurs within this function, an
12358
+** If an error (e.g. an OOM condition) occurs within this function,
1235912359
** the auxiliary data is set to NULL and an error code returned. If the
1236012360
** xDelete parameter was not NULL, it is invoked on the auxiliary data
1236112361
** pointer before returning.
1236212362
**
1236312363
**
@@ -14935,61 +14935,60 @@
1493514935
#define OP_ColumnsUsed 118
1493614936
#define OP_SeekHit 119 /* synopsis: seekHit=P2 */
1493714937
#define OP_Sequence 120 /* synopsis: r[P2]=cursor[P1].ctr++ */
1493814938
#define OP_NewRowid 121 /* synopsis: r[P2]=rowid */
1493914939
#define OP_Insert 122 /* synopsis: intkey=r[P3] data=r[P2] */
14940
-#define OP_InsertInt 123 /* synopsis: intkey=P3 data=r[P2] */
14941
-#define OP_Delete 124
14942
-#define OP_ResetCount 125
14943
-#define OP_SorterCompare 126 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
14944
-#define OP_SorterData 127 /* synopsis: r[P2]=data */
14945
-#define OP_RowData 128 /* synopsis: r[P2]=data */
14946
-#define OP_Rowid 129 /* synopsis: r[P2]=rowid */
14947
-#define OP_NullRow 130
14948
-#define OP_SeekEnd 131
14949
-#define OP_SorterInsert 132 /* synopsis: key=r[P2] */
14950
-#define OP_IdxInsert 133 /* synopsis: key=r[P2] */
14951
-#define OP_IdxDelete 134 /* synopsis: key=r[P2@P3] */
14952
-#define OP_DeferredSeek 135 /* synopsis: Move P3 to P1.rowid if needed */
14953
-#define OP_IdxRowid 136 /* synopsis: r[P2]=rowid */
14954
-#define OP_Destroy 137
14955
-#define OP_Clear 138
14956
-#define OP_ResetSorter 139
14957
-#define OP_CreateBtree 140 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
14940
+#define OP_Delete 123
14941
+#define OP_ResetCount 124
14942
+#define OP_SorterCompare 125 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
14943
+#define OP_SorterData 126 /* synopsis: r[P2]=data */
14944
+#define OP_RowData 127 /* synopsis: r[P2]=data */
14945
+#define OP_Rowid 128 /* synopsis: r[P2]=rowid */
14946
+#define OP_NullRow 129
14947
+#define OP_SeekEnd 130
14948
+#define OP_SorterInsert 131 /* synopsis: key=r[P2] */
14949
+#define OP_IdxInsert 132 /* synopsis: key=r[P2] */
14950
+#define OP_IdxDelete 133 /* synopsis: key=r[P2@P3] */
14951
+#define OP_DeferredSeek 134 /* synopsis: Move P3 to P1.rowid if needed */
14952
+#define OP_IdxRowid 135 /* synopsis: r[P2]=rowid */
14953
+#define OP_Destroy 136
14954
+#define OP_Clear 137
14955
+#define OP_ResetSorter 138
14956
+#define OP_CreateBtree 139 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
14957
+#define OP_SqlExec 140
1495814958
#define OP_Real 141 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
14959
-#define OP_SqlExec 142
14960
-#define OP_ParseSchema 143
14961
-#define OP_LoadAnalysis 144
14962
-#define OP_DropTable 145
14963
-#define OP_DropIndex 146
14964
-#define OP_DropTrigger 147
14965
-#define OP_IntegrityCk 148
14966
-#define OP_RowSetAdd 149 /* synopsis: rowset(P1)=r[P2] */
14967
-#define OP_Param 150
14968
-#define OP_FkCounter 151 /* synopsis: fkctr[P1]+=P2 */
14969
-#define OP_MemMax 152 /* synopsis: r[P1]=max(r[P1],r[P2]) */
14970
-#define OP_OffsetLimit 153 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
14971
-#define OP_AggInverse 154 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
14972
-#define OP_AggStep 155 /* synopsis: accum=r[P3] step(r[P2@P5]) */
14973
-#define OP_AggStep1 156 /* synopsis: accum=r[P3] step(r[P2@P5]) */
14974
-#define OP_AggValue 157 /* synopsis: r[P3]=value N=P2 */
14975
-#define OP_AggFinal 158 /* synopsis: accum=r[P1] N=P2 */
14976
-#define OP_Expire 159
14977
-#define OP_TableLock 160 /* synopsis: iDb=P1 root=P2 write=P3 */
14978
-#define OP_VBegin 161
14979
-#define OP_VCreate 162
14980
-#define OP_VDestroy 163
14981
-#define OP_VOpen 164
14982
-#define OP_VColumn 165 /* synopsis: r[P3]=vcolumn(P2) */
14983
-#define OP_VRename 166
14984
-#define OP_Pagecount 167
14985
-#define OP_MaxPgcnt 168
14986
-#define OP_Trace 169
14987
-#define OP_CursorHint 170
14988
-#define OP_Noop 171
14989
-#define OP_Explain 172
14990
-#define OP_Abortable 173
14959
+#define OP_ParseSchema 142
14960
+#define OP_LoadAnalysis 143
14961
+#define OP_DropTable 144
14962
+#define OP_DropIndex 145
14963
+#define OP_DropTrigger 146
14964
+#define OP_IntegrityCk 147
14965
+#define OP_RowSetAdd 148 /* synopsis: rowset(P1)=r[P2] */
14966
+#define OP_Param 149
14967
+#define OP_FkCounter 150 /* synopsis: fkctr[P1]+=P2 */
14968
+#define OP_MemMax 151 /* synopsis: r[P1]=max(r[P1],r[P2]) */
14969
+#define OP_OffsetLimit 152 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
14970
+#define OP_AggInverse 153 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
14971
+#define OP_AggStep 154 /* synopsis: accum=r[P3] step(r[P2@P5]) */
14972
+#define OP_AggStep1 155 /* synopsis: accum=r[P3] step(r[P2@P5]) */
14973
+#define OP_AggValue 156 /* synopsis: r[P3]=value N=P2 */
14974
+#define OP_AggFinal 157 /* synopsis: accum=r[P1] N=P2 */
14975
+#define OP_Expire 158
14976
+#define OP_TableLock 159 /* synopsis: iDb=P1 root=P2 write=P3 */
14977
+#define OP_VBegin 160
14978
+#define OP_VCreate 161
14979
+#define OP_VDestroy 162
14980
+#define OP_VOpen 163
14981
+#define OP_VColumn 164 /* synopsis: r[P3]=vcolumn(P2) */
14982
+#define OP_VRename 165
14983
+#define OP_Pagecount 166
14984
+#define OP_MaxPgcnt 167
14985
+#define OP_Trace 168
14986
+#define OP_CursorHint 169
14987
+#define OP_Noop 170
14988
+#define OP_Explain 171
14989
+#define OP_Abortable 172
1499114990
1499214991
/* Properties such as "out2" or "jump" that are specified in
1499314992
** comments following the "case" for each opcode in the vdbe.c
1499414993
** are encoded into bitvectors as follows:
1499514994
*/
@@ -15014,16 +15013,16 @@
1501415013
/* 88 */ 0x12, 0x20, 0x00, 0x00, 0x26, 0x26, 0x26, 0x26,\
1501515014
/* 96 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00, 0x12,\
1501615015
/* 104 */ 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\
1501715016
/* 112 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
1501815017
/* 120 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15019
-/* 128 */ 0x00, 0x10, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00,\
15020
-/* 136 */ 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
15021
-/* 144 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00,\
15022
-/* 152 */ 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15023
-/* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\
15024
-/* 168 */ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,}
15018
+/* 128 */ 0x10, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x10,\
15019
+/* 136 */ 0x10, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00,\
15020
+/* 144 */ 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00, 0x04,\
15021
+/* 152 */ 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15022
+/* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10,\
15023
+/* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00,}
1502515024
1502615025
/* The sqlite3P2Values() routine is able to run faster if it knows
1502715026
** the value of the largest JUMP opcode. The smaller the maximum
1502815027
** JUMP opcode the better, so the mkopcodeh.tcl script that
1502915028
** generated this include file strives to group all JUMP opcodes
@@ -16324,10 +16323,11 @@
1632416323
int (*xCommitCallback)(void*); /* Invoked at every commit. */
1632516324
void *pRollbackArg; /* Argument to xRollbackCallback() */
1632616325
void (*xRollbackCallback)(void*); /* Invoked at every commit. */
1632716326
void *pUpdateArg;
1632816327
void (*xUpdateCallback)(void*,int, const char*,const char*,sqlite_int64);
16328
+ Parse *pParse; /* Current parse */
1632916329
#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
1633016330
void *pPreUpdateArg; /* First argument to xPreUpdateCallback */
1633116331
void (*xPreUpdateCallback)( /* Registered using sqlite3_preupdate_hook() */
1633216332
void*,sqlite3*,int,char const*,char const*,sqlite3_int64,sqlite3_int64
1633316333
);
@@ -17987,10 +17987,11 @@
1798717987
TableLock *aTableLock; /* Required table locks for shared-cache mode */
1798817988
#endif
1798917989
AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */
1799017990
Parse *pToplevel; /* Parse structure for main program (or NULL) */
1799117991
Table *pTriggerTab; /* Table triggers are being coded for */
17992
+ Parse *pParentParse; /* Parent parser if this parser is nested */
1799217993
int addrCrTab; /* Address of OP_CreateBtree opcode on CREATE TABLE */
1799317994
u32 nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */
1799417995
u32 oldmask; /* Mask of old.* columns referenced */
1799517996
u32 newmask; /* Mask of new.* columns referenced */
1799617997
u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */
@@ -19172,11 +19173,11 @@
1917219173
SQLITE_PRIVATE void sqlite3AlterRenameTable(Parse*, SrcList*, Token*);
1917319174
SQLITE_PRIVATE void sqlite3AlterRenameColumn(Parse*, SrcList*, Token*, Token*);
1917419175
SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *, int *);
1917519176
SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...);
1917619177
SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*, int);
19177
-SQLITE_PRIVATE void sqlite3CodeRhsOfIN(Parse*, Expr*, int, int);
19178
+SQLITE_PRIVATE void sqlite3CodeRhsOfIN(Parse*, Expr*, int);
1917819179
SQLITE_PRIVATE int sqlite3CodeSubselect(Parse*, Expr*);
1917919180
SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*);
1918019181
SQLITE_PRIVATE void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p);
1918119182
SQLITE_PRIVATE int sqlite3MatchSpanName(const char*, const char*, const char*, const char*);
1918219183
SQLITE_PRIVATE int sqlite3ResolveExprNames(NameContext*, Expr*);
@@ -27119,10 +27120,13 @@
2711927120
db->mallocFailed = 1;
2712027121
if( db->nVdbeExec>0 ){
2712127122
db->u1.isInterrupted = 1;
2712227123
}
2712327124
db->lookaside.bDisable++;
27125
+ if( db->pParse ){
27126
+ db->pParse->rc = SQLITE_NOMEM_BKPT;
27127
+ }
2712427128
}
2712527129
}
2712627130
2712727131
/*
2712827132
** This routine reactivates the memory allocator and clears the
@@ -27312,11 +27316,11 @@
2731227316
** Set the StrAccum object to an error mode.
2731327317
*/
2731427318
static void setStrAccumError(StrAccum *p, u8 eError){
2731527319
assert( eError==SQLITE_NOMEM || eError==SQLITE_TOOBIG );
2731627320
p->accError = eError;
27317
- p->nAlloc = 0;
27321
+ if( p->mxAlloc ) sqlite3_str_reset(p);
2731827322
}
2731927323
2732027324
/*
2732127325
** Extra argument values from a PrintfArguments object
2732227326
*/
@@ -27342,10 +27346,11 @@
2734227346
** SQL from requesting large allocations using the precision or width
2734327347
** field of the printf() function.
2734427348
*/
2734527349
static char *printfTempBuf(sqlite3_str *pAccum, sqlite3_int64 n){
2734627350
char *z;
27351
+ if( pAccum->accError ) return 0;
2734727352
if( n>pAccum->nAlloc && n>pAccum->mxAlloc ){
2734827353
setStrAccumError(pAccum, SQLITE_TOOBIG);
2734927354
return 0;
2735027355
}
2735127356
z = sqlite3DbMallocRaw(pAccum->db, n);
@@ -28061,13 +28066,12 @@
2806128066
testcase(p->accError==SQLITE_TOOBIG);
2806228067
testcase(p->accError==SQLITE_NOMEM);
2806328068
return 0;
2806428069
}
2806528070
if( p->mxAlloc==0 ){
28066
- N = p->nAlloc - p->nChar - 1;
2806728071
setStrAccumError(p, SQLITE_TOOBIG);
28068
- return N;
28072
+ return p->nAlloc - p->nChar - 1;
2806928073
}else{
2807028074
char *zOld = isMalloced(p) ? p->zText : 0;
2807128075
i64 szNew = p->nChar;
2807228076
szNew += N + 1;
2807328077
if( szNew+p->nChar<=p->mxAlloc ){
@@ -28135,11 +28139,11 @@
2813528139
*/
2813628140
SQLITE_API void sqlite3_str_append(sqlite3_str *p, const char *z, int N){
2813728141
assert( z!=0 || N==0 );
2813828142
assert( p->zText!=0 || p->nChar==0 || p->accError );
2813928143
assert( N>=0 );
28140
- assert( p->accError==0 || p->nAlloc==0 );
28144
+ assert( p->accError==0 || p->nAlloc==0 || p->mxAlloc==0 );
2814128145
if( p->nChar+N >= p->nAlloc ){
2814228146
enlargeAndAppend(p,z,N);
2814328147
}else if( N ){
2814428148
assert( p->zText );
2814528149
p->nChar += N;
@@ -32137,61 +32141,60 @@
3213732141
/* 118 */ "ColumnsUsed" OpHelp(""),
3213832142
/* 119 */ "SeekHit" OpHelp("seekHit=P2"),
3213932143
/* 120 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
3214032144
/* 121 */ "NewRowid" OpHelp("r[P2]=rowid"),
3214132145
/* 122 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
32142
- /* 123 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"),
32143
- /* 124 */ "Delete" OpHelp(""),
32144
- /* 125 */ "ResetCount" OpHelp(""),
32145
- /* 126 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
32146
- /* 127 */ "SorterData" OpHelp("r[P2]=data"),
32147
- /* 128 */ "RowData" OpHelp("r[P2]=data"),
32148
- /* 129 */ "Rowid" OpHelp("r[P2]=rowid"),
32149
- /* 130 */ "NullRow" OpHelp(""),
32150
- /* 131 */ "SeekEnd" OpHelp(""),
32151
- /* 132 */ "SorterInsert" OpHelp("key=r[P2]"),
32152
- /* 133 */ "IdxInsert" OpHelp("key=r[P2]"),
32153
- /* 134 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
32154
- /* 135 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
32155
- /* 136 */ "IdxRowid" OpHelp("r[P2]=rowid"),
32156
- /* 137 */ "Destroy" OpHelp(""),
32157
- /* 138 */ "Clear" OpHelp(""),
32158
- /* 139 */ "ResetSorter" OpHelp(""),
32159
- /* 140 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
32146
+ /* 123 */ "Delete" OpHelp(""),
32147
+ /* 124 */ "ResetCount" OpHelp(""),
32148
+ /* 125 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
32149
+ /* 126 */ "SorterData" OpHelp("r[P2]=data"),
32150
+ /* 127 */ "RowData" OpHelp("r[P2]=data"),
32151
+ /* 128 */ "Rowid" OpHelp("r[P2]=rowid"),
32152
+ /* 129 */ "NullRow" OpHelp(""),
32153
+ /* 130 */ "SeekEnd" OpHelp(""),
32154
+ /* 131 */ "SorterInsert" OpHelp("key=r[P2]"),
32155
+ /* 132 */ "IdxInsert" OpHelp("key=r[P2]"),
32156
+ /* 133 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
32157
+ /* 134 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
32158
+ /* 135 */ "IdxRowid" OpHelp("r[P2]=rowid"),
32159
+ /* 136 */ "Destroy" OpHelp(""),
32160
+ /* 137 */ "Clear" OpHelp(""),
32161
+ /* 138 */ "ResetSorter" OpHelp(""),
32162
+ /* 139 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
32163
+ /* 140 */ "SqlExec" OpHelp(""),
3216032164
/* 141 */ "Real" OpHelp("r[P2]=P4"),
32161
- /* 142 */ "SqlExec" OpHelp(""),
32162
- /* 143 */ "ParseSchema" OpHelp(""),
32163
- /* 144 */ "LoadAnalysis" OpHelp(""),
32164
- /* 145 */ "DropTable" OpHelp(""),
32165
- /* 146 */ "DropIndex" OpHelp(""),
32166
- /* 147 */ "DropTrigger" OpHelp(""),
32167
- /* 148 */ "IntegrityCk" OpHelp(""),
32168
- /* 149 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
32169
- /* 150 */ "Param" OpHelp(""),
32170
- /* 151 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
32171
- /* 152 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
32172
- /* 153 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
32173
- /* 154 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
32174
- /* 155 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
32175
- /* 156 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"),
32176
- /* 157 */ "AggValue" OpHelp("r[P3]=value N=P2"),
32177
- /* 158 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
32178
- /* 159 */ "Expire" OpHelp(""),
32179
- /* 160 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
32180
- /* 161 */ "VBegin" OpHelp(""),
32181
- /* 162 */ "VCreate" OpHelp(""),
32182
- /* 163 */ "VDestroy" OpHelp(""),
32183
- /* 164 */ "VOpen" OpHelp(""),
32184
- /* 165 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
32185
- /* 166 */ "VRename" OpHelp(""),
32186
- /* 167 */ "Pagecount" OpHelp(""),
32187
- /* 168 */ "MaxPgcnt" OpHelp(""),
32188
- /* 169 */ "Trace" OpHelp(""),
32189
- /* 170 */ "CursorHint" OpHelp(""),
32190
- /* 171 */ "Noop" OpHelp(""),
32191
- /* 172 */ "Explain" OpHelp(""),
32192
- /* 173 */ "Abortable" OpHelp(""),
32165
+ /* 142 */ "ParseSchema" OpHelp(""),
32166
+ /* 143 */ "LoadAnalysis" OpHelp(""),
32167
+ /* 144 */ "DropTable" OpHelp(""),
32168
+ /* 145 */ "DropIndex" OpHelp(""),
32169
+ /* 146 */ "DropTrigger" OpHelp(""),
32170
+ /* 147 */ "IntegrityCk" OpHelp(""),
32171
+ /* 148 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
32172
+ /* 149 */ "Param" OpHelp(""),
32173
+ /* 150 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
32174
+ /* 151 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
32175
+ /* 152 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
32176
+ /* 153 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
32177
+ /* 154 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
32178
+ /* 155 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"),
32179
+ /* 156 */ "AggValue" OpHelp("r[P3]=value N=P2"),
32180
+ /* 157 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
32181
+ /* 158 */ "Expire" OpHelp(""),
32182
+ /* 159 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
32183
+ /* 160 */ "VBegin" OpHelp(""),
32184
+ /* 161 */ "VCreate" OpHelp(""),
32185
+ /* 162 */ "VDestroy" OpHelp(""),
32186
+ /* 163 */ "VOpen" OpHelp(""),
32187
+ /* 164 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
32188
+ /* 165 */ "VRename" OpHelp(""),
32189
+ /* 166 */ "Pagecount" OpHelp(""),
32190
+ /* 167 */ "MaxPgcnt" OpHelp(""),
32191
+ /* 168 */ "Trace" OpHelp(""),
32192
+ /* 169 */ "CursorHint" OpHelp(""),
32193
+ /* 170 */ "Noop" OpHelp(""),
32194
+ /* 171 */ "Explain" OpHelp(""),
32195
+ /* 172 */ "Abortable" OpHelp(""),
3219332196
};
3219432197
return azName[i];
3219532198
}
3219632199
#endif
3219732200
@@ -40217,10 +40220,13 @@
4021740220
static sqlite3_vfs aVfs[] = {
4021840221
#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)
4021940222
UNIXVFS("unix", autolockIoFinder ),
4022040223
#elif OS_VXWORKS
4022140224
UNIXVFS("unix", vxworksIoFinder ),
40225
+#elif __Fuchsia__
40226
+ /* We are told that Fuchsia only supports dot-file locking */
40227
+ UNIXVFS("unix", dotlockIoFinder ),
4022240228
#else
4022340229
UNIXVFS("unix", posixIoFinder ),
4022440230
#endif
4022540231
UNIXVFS("unix-none", nolockIoFinder ),
4022640232
UNIXVFS("unix-dotfile", dotlockIoFinder ),
@@ -58162,11 +58168,11 @@
5816258168
** Release a lock obtained by an earlier successful call to
5816358169
** sqlite3PagerSnapshotCheck().
5816458170
*/
5816558171
SQLITE_PRIVATE void sqlite3PagerSnapshotUnlock(Pager *pPager){
5816658172
assert( pPager->pWal );
58167
- return sqlite3WalSnapshotUnlock(pPager->pWal);
58173
+ sqlite3WalSnapshotUnlock(pPager->pWal);
5816858174
}
5816958175
5817058176
#endif /* SQLITE_ENABLE_SNAPSHOT */
5817158177
#endif /* !SQLITE_OMIT_WAL */
5817258178
@@ -62338,11 +62344,11 @@
6233862344
u8 max1bytePayload; /* min(maxLocal,127) */
6233962345
u8 nOverflow; /* Number of overflow cell bodies in aCell[] */
6234062346
u16 maxLocal; /* Copy of BtShared.maxLocal or BtShared.maxLeaf */
6234162347
u16 minLocal; /* Copy of BtShared.minLocal or BtShared.minLeaf */
6234262348
u16 cellOffset; /* Index in aData of first cell pointer */
62343
- u16 nFree; /* Number of free bytes on the page */
62349
+ int nFree; /* Number of free bytes on the page. -1 for unknown */
6234462350
u16 nCell; /* Number of cells on this page, local and ovfl */
6234562351
u16 maskPage; /* Mask for page offset */
6234662352
u16 aiOvfl[4]; /* Insert the i-th overflow cell before the aiOvfl-th
6234762353
** non-overflow cell */
6234862354
u8 *apOvfl[4]; /* Pointers to the body of overflow cells */
@@ -64492,12 +64498,12 @@
6449264498
** offsets to each pointer in the cell-pointer array than it is to
6449364499
** reconstruct the entire page. */
6449464500
if( (int)data[hdr+7]<=nMaxFrag ){
6449564501
int iFree = get2byte(&data[hdr+1]);
6449664502
64497
- /* If the initial freeblock offset were out of bounds, that would
64498
- ** have been detected by btreeInitPage() when it was computing the
64503
+ /* If the initial freeblock offset were out of bounds, that would have
64504
+ ** been detected by btreeComputeFreeSpace() when it was computing the
6449964505
** number of free bytes on the page. */
6450064506
assert( iFree<=usableSize-4 );
6450164507
if( iFree ){
6450264508
int iFree2 = get2byte(&data[iFree]);
6450364509
if( iFree2>usableSize-4 ) return SQLITE_CORRUPT_PAGE(pPage);
@@ -64565,10 +64571,11 @@
6456564571
memcpy(&data[cbrk], &src[pc], size);
6456664572
}
6456764573
data[hdr+7] = 0;
6456864574
6456964575
defragment_out:
64576
+ assert( pPage->nFree>=0 );
6457064577
if( data[hdr+7]+cbrk-iCellFirst!=pPage->nFree ){
6457164578
return SQLITE_CORRUPT_PAGE(pPage);
6457264579
}
6457364580
assert( cbrk>=iCellFirst );
6457464581
put2byte(&data[hdr+5], cbrk);
@@ -64592,54 +64599,61 @@
6459264599
** Slots on the free list that are between 1 and 3 bytes larger than nByte
6459364600
** will be ignored if adding the extra space to the fragmentation count
6459464601
** causes the fragmentation count to exceed 60.
6459564602
*/
6459664603
static u8 *pageFindSlot(MemPage *pPg, int nByte, int *pRc){
64597
- const int hdr = pPg->hdrOffset;
64598
- u8 * const aData = pPg->aData;
64599
- int iAddr = hdr + 1;
64600
- int pc = get2byte(&aData[iAddr]);
64601
- int x;
64602
- int usableSize = pPg->pBt->usableSize;
64603
- int size; /* Size of the free slot */
64604
+ const int hdr = pPg->hdrOffset; /* Offset to page header */
64605
+ u8 * const aData = pPg->aData; /* Page data */
64606
+ int iAddr = hdr + 1; /* Address of ptr to pc */
64607
+ int pc = get2byte(&aData[iAddr]); /* Address of a free slot */
64608
+ int x; /* Excess size of the slot */
64609
+ int maxPC = pPg->pBt->usableSize - nByte; /* Max address for a usable slot */
64610
+ int size; /* Size of the free slot */
6460464611
6460564612
assert( pc>0 );
64606
- while( pc<=usableSize-4 ){
64613
+ while( pc<=maxPC ){
6460764614
/* EVIDENCE-OF: R-22710-53328 The third and fourth bytes of each
6460864615
** freeblock form a big-endian integer which is the size of the freeblock
6460964616
** in bytes, including the 4-byte header. */
6461064617
size = get2byte(&aData[pc+2]);
6461164618
if( (x = size - nByte)>=0 ){
6461264619
testcase( x==4 );
6461364620
testcase( x==3 );
64614
- if( size+pc > usableSize ){
64615
- *pRc = SQLITE_CORRUPT_PAGE(pPg);
64616
- return 0;
64617
- }else if( x<4 ){
64621
+ if( x<4 ){
6461864622
/* EVIDENCE-OF: R-11498-58022 In a well-formed b-tree page, the total
6461964623
** number of bytes in fragments may not exceed 60. */
6462064624
if( aData[hdr+7]>57 ) return 0;
6462164625
6462264626
/* Remove the slot from the free-list. Update the number of
6462364627
** fragmented bytes within the page. */
6462464628
memcpy(&aData[iAddr], &aData[pc], 2);
6462564629
aData[hdr+7] += (u8)x;
64630
+ }else if( x+pc > maxPC ){
64631
+ /* This slot extends off the end of the usable part of the page */
64632
+ *pRc = SQLITE_CORRUPT_PAGE(pPg);
64633
+ return 0;
6462664634
}else{
6462764635
/* The slot remains on the free-list. Reduce its size to account
64628
- ** for the portion used by the new allocation. */
64636
+ ** for the portion used by the new allocation. */
6462964637
put2byte(&aData[pc+2], x);
6463064638
}
6463164639
return &aData[pc + x];
6463264640
}
6463364641
iAddr = pc;
6463464642
pc = get2byte(&aData[pc]);
64635
- if( pc<iAddr+size ) break;
64643
+ if( pc<iAddr+size ){
64644
+ if( pc ){
64645
+ /* The next slot in the chain is not past the end of the current slot */
64646
+ *pRc = SQLITE_CORRUPT_PAGE(pPg);
64647
+ }
64648
+ return 0;
64649
+ }
6463664650
}
64637
- if( pc ){
64651
+ if( pc>maxPC+nByte-4 ){
64652
+ /* The free slot chain extends off the end of the page */
6463864653
*pRc = SQLITE_CORRUPT_PAGE(pPg);
6463964654
}
64640
-
6464164655
return 0;
6464264656
}
6464364657
6464464658
/*
6464564659
** Allocate nByte bytes of space from within the B-Tree page passed
@@ -64685,13 +64699,13 @@
6468564699
}else{
6468664700
return SQLITE_CORRUPT_PAGE(pPage);
6468764701
}
6468864702
}
6468964703
64690
- /* If there is enough space between gap and top for one more cell pointer
64691
- ** array entry offset, and if the freelist is not empty, then search the
64692
- ** freelist looking for a free slot big enough to satisfy the request.
64704
+ /* If there is enough space between gap and top for one more cell pointer,
64705
+ ** and if the freelist is not empty, then search the
64706
+ ** freelist looking for a slot big enough to satisfy the request.
6469364707
*/
6469464708
testcase( gap+2==top );
6469564709
testcase( gap+1==top );
6469664710
testcase( gap==top );
6469764711
if( (data[hdr+2] || data[hdr+1]) && gap+2<=top ){
@@ -64709,19 +64723,20 @@
6470964723
** to see if defragmentation is necessary.
6471064724
*/
6471164725
testcase( gap+2+nByte==top );
6471264726
if( gap+2+nByte>top ){
6471364727
assert( pPage->nCell>0 || CORRUPT_DB );
64728
+ assert( pPage->nFree>=0 );
6471464729
rc = defragmentPage(pPage, MIN(4, pPage->nFree - (2+nByte)));
6471564730
if( rc ) return rc;
6471664731
top = get2byteNotZero(&data[hdr+5]);
6471764732
assert( gap+2+nByte<=top );
6471864733
}
6471964734
6472064735
6472164736
/* Allocate memory from the gap in between the cell pointer array
64722
- ** and the cell content area. The btreeInitPage() call has already
64737
+ ** and the cell content area. The btreeComputeFreeSpace() call has already
6472364738
** validated the freelist. Given that the freelist is valid, there
6472464739
** is no way that the allocation can extend off the end of the page.
6472564740
** The assert() below verifies the previous sentence.
6472664741
*/
6472764742
top -= nByte;
@@ -64736,11 +64751,11 @@
6473664751
** The first byte of the new free block is pPage->aData[iStart]
6473764752
** and the size of the block is iSize bytes.
6473864753
**
6473964754
** Adjacent freeblocks are coalesced.
6474064755
**
64741
-** Note that even though the freeblock list was checked by btreeInitPage(),
64756
+** Even though the freeblock list was checked by btreeComputeFreeSpace(),
6474264757
** that routine will not detect overlap between cells or freeblocks. Nor
6474364758
** does it detect cells or freeblocks that encrouch into the reserved bytes
6474464759
** at the end of the page. So do additional corruption checks inside this
6474564760
** routine and return SQLITE_CORRUPT if any problems are found.
6474664761
*/
@@ -64898,25 +64913,18 @@
6489864913
pPage->max1bytePayload = pBt->max1bytePayload;
6489964914
return SQLITE_OK;
6490064915
}
6490164916
6490264917
/*
64903
-** Initialize the auxiliary information for a disk block.
64904
-**
64905
-** Return SQLITE_OK on success. If we see that the page does
64906
-** not contain a well-formed database page, then return
64907
-** SQLITE_CORRUPT. Note that a return of SQLITE_OK does not
64908
-** guarantee that the page is well-formed. It only shows that
64909
-** we failed to detect any corruption.
64918
+** Compute the amount of freespace on the page. In other words, fill
64919
+** in the pPage->nFree field.
6491064920
*/
64911
-static int btreeInitPage(MemPage *pPage){
64921
+static int btreeComputeFreeSpace(MemPage *pPage){
6491264922
int pc; /* Address of a freeblock within pPage->aData[] */
6491364923
u8 hdr; /* Offset to beginning of page header */
6491464924
u8 *data; /* Equal to pPage->aData */
64915
- BtShared *pBt; /* The main btree structure */
6491664925
int usableSize; /* Amount of usable space on each page */
64917
- u16 cellOffset; /* Offset from start of page to first cell pointer */
6491864926
int nFree; /* Number of unused bytes on the page */
6491964927
int top; /* First byte of the cell content area */
6492064928
int iCellFirst; /* First allowable cell or freeblock offset */
6492164929
int iCellLast; /* Last possible cell or freeblock offset */
6492264930
@@ -64924,75 +64932,22 @@
6492464932
assert( pPage->pBt->db!=0 );
6492564933
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
6492664934
assert( pPage->pgno==sqlite3PagerPagenumber(pPage->pDbPage) );
6492764935
assert( pPage == sqlite3PagerGetExtra(pPage->pDbPage) );
6492864936
assert( pPage->aData == sqlite3PagerGetData(pPage->pDbPage) );
64929
- assert( pPage->isInit==0 );
64937
+ assert( pPage->isInit==1 );
64938
+ assert( pPage->nFree<0 );
6493064939
64931
- pBt = pPage->pBt;
64940
+ usableSize = pPage->pBt->usableSize;
6493264941
hdr = pPage->hdrOffset;
6493364942
data = pPage->aData;
64934
- /* EVIDENCE-OF: R-28594-02890 The one-byte flag at offset 0 indicating
64935
- ** the b-tree page type. */
64936
- if( decodeFlags(pPage, data[hdr]) ){
64937
- return SQLITE_CORRUPT_PAGE(pPage);
64938
- }
64939
- assert( pBt->pageSize>=512 && pBt->pageSize<=65536 );
64940
- pPage->maskPage = (u16)(pBt->pageSize - 1);
64941
- pPage->nOverflow = 0;
64942
- usableSize = pBt->usableSize;
64943
- pPage->cellOffset = cellOffset = hdr + 8 + pPage->childPtrSize;
64944
- pPage->aDataEnd = &data[usableSize];
64945
- pPage->aCellIdx = &data[cellOffset];
64946
- pPage->aDataOfst = &data[pPage->childPtrSize];
6494764943
/* EVIDENCE-OF: R-58015-48175 The two-byte integer at offset 5 designates
6494864944
** the start of the cell content area. A zero value for this integer is
6494964945
** interpreted as 65536. */
6495064946
top = get2byteNotZero(&data[hdr+5]);
64951
- /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the
64952
- ** number of cells on the page. */
64953
- pPage->nCell = get2byte(&data[hdr+3]);
64954
- if( pPage->nCell>MX_CELL(pBt) ){
64955
- /* To many cells for a single page. The page must be corrupt */
64956
- return SQLITE_CORRUPT_PAGE(pPage);
64957
- }
64958
- testcase( pPage->nCell==MX_CELL(pBt) );
64959
- /* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only
64960
- ** possible for a root page of a table that contains no rows) then the
64961
- ** offset to the cell content area will equal the page size minus the
64962
- ** bytes of reserved space. */
64963
- assert( pPage->nCell>0 || top==usableSize || CORRUPT_DB );
64964
-
64965
- /* A malformed database page might cause us to read past the end
64966
- ** of page when parsing a cell.
64967
- **
64968
- ** The following block of code checks early to see if a cell extends
64969
- ** past the end of a page boundary and causes SQLITE_CORRUPT to be
64970
- ** returned if it does.
64971
- */
64972
- iCellFirst = cellOffset + 2*pPage->nCell;
64947
+ iCellFirst = hdr + 8 + pPage->childPtrSize + 2*pPage->nCell;
6497364948
iCellLast = usableSize - 4;
64974
- if( pBt->db->flags & SQLITE_CellSizeCk ){
64975
- int i; /* Index into the cell pointer array */
64976
- int sz; /* Size of a cell */
64977
-
64978
- if( !pPage->leaf ) iCellLast--;
64979
- for(i=0; i<pPage->nCell; i++){
64980
- pc = get2byteAligned(&data[cellOffset+i*2]);
64981
- testcase( pc==iCellFirst );
64982
- testcase( pc==iCellLast );
64983
- if( pc<iCellFirst || pc>iCellLast ){
64984
- return SQLITE_CORRUPT_PAGE(pPage);
64985
- }
64986
- sz = pPage->xCellSize(pPage, &data[pc]);
64987
- testcase( pc+sz==usableSize );
64988
- if( pc+sz>usableSize ){
64989
- return SQLITE_CORRUPT_PAGE(pPage);
64990
- }
64991
- }
64992
- if( !pPage->leaf ) iCellLast++;
64993
- }
6499464949
6499564950
/* Compute the total free space on the page
6499664951
** EVIDENCE-OF: R-23588-34450 The two-byte integer at offset 1 gives the
6499764952
** start of the first freeblock on the page, or is zero if there are no
6499864953
** freeblocks. */
@@ -65036,11 +64991,104 @@
6503664991
*/
6503764992
if( nFree>usableSize ){
6503864993
return SQLITE_CORRUPT_PAGE(pPage);
6503964994
}
6504064995
pPage->nFree = (u16)(nFree - iCellFirst);
64996
+ return SQLITE_OK;
64997
+}
64998
+
64999
+/*
65000
+** Do additional sanity check after btreeInitPage() if
65001
+** PRAGMA cell_size_check=ON
65002
+*/
65003
+static SQLITE_NOINLINE int btreeCellSizeCheck(MemPage *pPage){
65004
+ int iCellFirst; /* First allowable cell or freeblock offset */
65005
+ int iCellLast; /* Last possible cell or freeblock offset */
65006
+ int i; /* Index into the cell pointer array */
65007
+ int sz; /* Size of a cell */
65008
+ int pc; /* Address of a freeblock within pPage->aData[] */
65009
+ u8 *data; /* Equal to pPage->aData */
65010
+ int usableSize; /* Maximum usable space on the page */
65011
+ int cellOffset; /* Start of cell content area */
65012
+
65013
+ iCellFirst = pPage->cellOffset + 2*pPage->nCell;
65014
+ usableSize = pPage->pBt->usableSize;
65015
+ iCellLast = usableSize - 4;
65016
+ data = pPage->aData;
65017
+ cellOffset = pPage->cellOffset;
65018
+ if( !pPage->leaf ) iCellLast--;
65019
+ for(i=0; i<pPage->nCell; i++){
65020
+ pc = get2byteAligned(&data[cellOffset+i*2]);
65021
+ testcase( pc==iCellFirst );
65022
+ testcase( pc==iCellLast );
65023
+ if( pc<iCellFirst || pc>iCellLast ){
65024
+ return SQLITE_CORRUPT_PAGE(pPage);
65025
+ }
65026
+ sz = pPage->xCellSize(pPage, &data[pc]);
65027
+ testcase( pc+sz==usableSize );
65028
+ if( pc+sz>usableSize ){
65029
+ return SQLITE_CORRUPT_PAGE(pPage);
65030
+ }
65031
+ }
65032
+ return SQLITE_OK;
65033
+}
65034
+
65035
+/*
65036
+** Initialize the auxiliary information for a disk block.
65037
+**
65038
+** Return SQLITE_OK on success. If we see that the page does
65039
+** not contain a well-formed database page, then return
65040
+** SQLITE_CORRUPT. Note that a return of SQLITE_OK does not
65041
+** guarantee that the page is well-formed. It only shows that
65042
+** we failed to detect any corruption.
65043
+*/
65044
+static int btreeInitPage(MemPage *pPage){
65045
+ u8 *data; /* Equal to pPage->aData */
65046
+ BtShared *pBt; /* The main btree structure */
65047
+
65048
+ assert( pPage->pBt!=0 );
65049
+ assert( pPage->pBt->db!=0 );
65050
+ assert( sqlite3_mutex_held(pPage->pBt->mutex) );
65051
+ assert( pPage->pgno==sqlite3PagerPagenumber(pPage->pDbPage) );
65052
+ assert( pPage == sqlite3PagerGetExtra(pPage->pDbPage) );
65053
+ assert( pPage->aData == sqlite3PagerGetData(pPage->pDbPage) );
65054
+ assert( pPage->isInit==0 );
65055
+
65056
+ pBt = pPage->pBt;
65057
+ data = pPage->aData + pPage->hdrOffset;
65058
+ /* EVIDENCE-OF: R-28594-02890 The one-byte flag at offset 0 indicating
65059
+ ** the b-tree page type. */
65060
+ if( decodeFlags(pPage, data[0]) ){
65061
+ return SQLITE_CORRUPT_PAGE(pPage);
65062
+ }
65063
+ assert( pBt->pageSize>=512 && pBt->pageSize<=65536 );
65064
+ pPage->maskPage = (u16)(pBt->pageSize - 1);
65065
+ pPage->nOverflow = 0;
65066
+ pPage->cellOffset = pPage->hdrOffset + 8 + pPage->childPtrSize;
65067
+ pPage->aCellIdx = data + pPage->childPtrSize + 8;
65068
+ pPage->aDataEnd = pPage->aData + pBt->usableSize;
65069
+ pPage->aDataOfst = pPage->aData + pPage->childPtrSize;
65070
+ /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the
65071
+ ** number of cells on the page. */
65072
+ pPage->nCell = get2byte(&data[3]);
65073
+ if( pPage->nCell>MX_CELL(pBt) ){
65074
+ /* To many cells for a single page. The page must be corrupt */
65075
+ return SQLITE_CORRUPT_PAGE(pPage);
65076
+ }
65077
+ testcase( pPage->nCell==MX_CELL(pBt) );
65078
+ /* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only
65079
+ ** possible for a root page of a table that contains no rows) then the
65080
+ ** offset to the cell content area will equal the page size minus the
65081
+ ** bytes of reserved space. */
65082
+ assert( pPage->nCell>0
65083
+ || get2byteNotZero(&data[5])==pBt->usableSize
65084
+ || CORRUPT_DB );
65085
+ pPage->nFree = -1; /* Indicate that this value is yet uncomputed */
6504165086
pPage->isInit = 1;
65087
+ if( pBt->db->flags & SQLITE_CellSizeCk ){
65088
+ return btreeCellSizeCheck(pPage);
65089
+ }
6504265090
return SQLITE_OK;
6504365091
}
6504465092
6504565093
/*
6504665094
** Set up a raw page so that it looks like a database page holding
@@ -65179,38 +65227,38 @@
6517965227
assert( pCur==0 || bReadOnly==pCur->curPagerFlags );
6518065228
assert( pCur==0 || pCur->iPage>0 );
6518165229
6518265230
if( pgno>btreePagecount(pBt) ){
6518365231
rc = SQLITE_CORRUPT_BKPT;
65184
- goto getAndInitPage_error;
65232
+ goto getAndInitPage_error1;
6518565233
}
6518665234
rc = sqlite3PagerGet(pBt->pPager, pgno, (DbPage**)&pDbPage, bReadOnly);
6518765235
if( rc ){
65188
- goto getAndInitPage_error;
65236
+ goto getAndInitPage_error1;
6518965237
}
6519065238
*ppPage = (MemPage*)sqlite3PagerGetExtra(pDbPage);
6519165239
if( (*ppPage)->isInit==0 ){
6519265240
btreePageFromDbPage(pDbPage, pgno, pBt);
6519365241
rc = btreeInitPage(*ppPage);
6519465242
if( rc!=SQLITE_OK ){
65195
- releasePage(*ppPage);
65196
- goto getAndInitPage_error;
65243
+ goto getAndInitPage_error2;
6519765244
}
6519865245
}
6519965246
assert( (*ppPage)->pgno==pgno );
6520065247
assert( (*ppPage)->aData==sqlite3PagerGetData(pDbPage) );
6520165248
6520265249
/* If obtaining a child page for a cursor, we must verify that the page is
6520365250
** compatible with the root page. */
6520465251
if( pCur && ((*ppPage)->nCell<1 || (*ppPage)->intKey!=pCur->curIntKey) ){
6520565252
rc = SQLITE_CORRUPT_PGNO(pgno);
65206
- releasePage(*ppPage);
65207
- goto getAndInitPage_error;
65253
+ goto getAndInitPage_error2;
6520865254
}
6520965255
return SQLITE_OK;
6521065256
65211
-getAndInitPage_error:
65257
+getAndInitPage_error2:
65258
+ releasePage(*ppPage);
65259
+getAndInitPage_error1:
6521265260
if( pCur ){
6521365261
pCur->iPage--;
6521465262
pCur->pPage = pCur->apPage[pCur->iPage];
6521565263
}
6521665264
testcase( pgno==0 );
@@ -69618,10 +69666,11 @@
6961869666
if( *pRC ) return;
6961969667
assert( idx>=0 && idx<pPage->nCell );
6962069668
assert( CORRUPT_DB || sz==cellSize(pPage, idx) );
6962169669
assert( sqlite3PagerIswriteable(pPage->pDbPage) );
6962269670
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
69671
+ assert( pPage->nFree>=0 );
6962369672
data = pPage->aData;
6962469673
ptr = &pPage->aCellIdx[2*idx];
6962569674
pc = get2byte(ptr);
6962669675
hdr = pPage->hdrOffset;
6962769676
testcase( pc==get2byte(&data[hdr+5]) );
@@ -69688,10 +69737,11 @@
6968869737
** malformed cell from a leaf page to an interior page, if the cell size
6968969738
** wanted to be less than 4 but got rounded up to 4 on the leaf, then size
6969069739
** might be less than 8 (leaf-size + pointer) on the interior node. Hence
6969169740
** the term after the || in the following assert(). */
6969269741
assert( sz==pPage->xCellSize(pPage, pCell) || (sz==8 && iChild>0) );
69742
+ assert( pPage->nFree>=0 );
6969369743
if( pPage->nOverflow || sz+2>pPage->nFree ){
6969469744
if( pTemp ){
6969569745
memcpy(pTemp, pCell, sz);
6969669746
pCell = pTemp;
6969769747
}
@@ -69745,11 +69795,11 @@
6974569795
memmove(pIns+2, pIns, 2*(pPage->nCell - i));
6974669796
put2byte(pIns, idx);
6974769797
pPage->nCell++;
6974869798
/* increment the cell count */
6974969799
if( (++data[pPage->hdrOffset+4])==0 ) data[pPage->hdrOffset+3]++;
69750
- assert( get2byte(&data[pPage->hdrOffset+3])==pPage->nCell );
69800
+ assert( get2byte(&data[pPage->hdrOffset+3])==pPage->nCell || CORRUPT_DB );
6975169801
#ifndef SQLITE_OMIT_AUTOVACUUM
6975269802
if( pPage->pBt->autoVacuum ){
6975369803
/* The cell may contain a pointer to an overflow page. If so, write
6975469804
** the entry for the overflow page into the pointer map.
6975569805
*/
@@ -69832,12 +69882,17 @@
6983269882
**
6983369883
** For a table-btree, the concept is similar, except only apEnd[0]..apEnd[2]
6983469884
** are used and they point to the leaf pages only, and the ixNx value are:
6983569885
**
6983669886
** ixNx[0] = Number of cells in Child-1.
69837
-** ixNx[1] = Number of cells in Child-1 and Child-2 + 1 for 1st divider.
69838
-** ixNx[2] = Number of cells in Child-1 and Child-2 + both divider cells
69887
+** ixNx[1] = Number of cells in Child-1 and Child-2.
69888
+** ixNx[2] = Total number of cells.
69889
+**
69890
+** Sometimes when deleting, a child page can have zero cells. In those
69891
+** cases, ixNx[] entries with higher indexes, and the corresponding apEnd[]
69892
+** entries, shift down. The end result is that each ixNx[] entry should
69893
+** be larger than the previous
6983969894
*/
6984069895
typedef struct CellArray CellArray;
6984169896
struct CellArray {
6984269897
int nCell; /* Number of cells in apCell[] */
6984369898
MemPage *pRef; /* Reference page */
@@ -70239,12 +70294,14 @@
7023970294
Pgno pgnoNew; /* Page number of pNew */
7024070295
7024170296
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
7024270297
assert( sqlite3PagerIswriteable(pParent->pDbPage) );
7024370298
assert( pPage->nOverflow==1 );
70244
-
70299
+
7024570300
if( pPage->nCell==0 ) return SQLITE_CORRUPT_BKPT; /* dbfuzz001.test */
70301
+ assert( pPage->nFree>=0 );
70302
+ assert( pParent->nFree>=0 );
7024670303
7024770304
/* Allocate a new page. This page will become the right-sibling of
7024870305
** pPage. Make the parent page writable, so that the new divider cell
7024970306
** may be inserted. If both these operations are successful, proceed.
7025070307
*/
@@ -70410,10 +70467,11 @@
7041070467
** fairly obscure circumstances, even though it is a copy of initialized
7041170468
** page pFrom.
7041270469
*/
7041370470
pTo->isInit = 0;
7041470471
rc = btreeInitPage(pTo);
70472
+ if( rc==SQLITE_OK ) rc = btreeComputeFreeSpace(pTo);
7041570473
if( rc!=SQLITE_OK ){
7041670474
*pRC = rc;
7041770475
return;
7041870476
}
7041970477
@@ -70518,10 +70576,11 @@
7051870576
assert( pParent->nOverflow==0 || pParent->aiOvfl[0]==iParentIdx );
7051970577
7052070578
if( !aOvflSpace ){
7052170579
return SQLITE_NOMEM_BKPT;
7052270580
}
70581
+ assert( pParent->nFree>=0 );
7052370582
7052470583
/* Find the sibling pages to balance. Also locate the cells in pParent
7052570584
** that divide the siblings. An attempt is made to find NN siblings on
7052670585
** either side of pPage. More siblings are taken from one side, however,
7052770586
** if there are fewer than NN siblings on the other side. If pParent
@@ -70556,10 +70615,17 @@
7055670615
while( 1 ){
7055770616
rc = getAndInitPage(pBt, pgno, &apOld[i], 0, 0);
7055870617
if( rc ){
7055970618
memset(apOld, 0, (i+1)*sizeof(MemPage*));
7056070619
goto balance_cleanup;
70620
+ }
70621
+ if( apOld[i]->nFree<0 ){
70622
+ rc = btreeComputeFreeSpace(apOld[i]);
70623
+ if( rc ){
70624
+ memset(apOld, 0, (i)*sizeof(MemPage*));
70625
+ goto balance_cleanup;
70626
+ }
7056170627
}
7056270628
nMaxCells += 1+apOld[i]->nCell+apOld[i]->nOverflow;
7056370629
if( (i--)==0 ) break;
7056470630
7056570631
if( pParent->nOverflow && i+nxDiv==pParent->aiOvfl[0] ){
@@ -70751,15 +70817,19 @@
7075170817
usableSpace = pBt->usableSize - 12 + leafCorrection;
7075270818
for(i=k=0; i<nOld; i++, k++){
7075370819
MemPage *p = apOld[i];
7075470820
b.apEnd[k] = p->aDataEnd;
7075570821
b.ixNx[k] = cntOld[i];
70822
+ if( k && b.ixNx[k]==b.ixNx[k-1] ){
70823
+ k--; /* Omit b.ixNx[] entry for child pages with no cells */
70824
+ }
7075670825
if( !leafData ){
7075770826
k++;
7075870827
b.apEnd[k] = pParent->aDataEnd;
7075970828
b.ixNx[k] = cntOld[i]+1;
7076070829
}
70830
+ assert( p->nFree>=0 );
7076170831
szNew[i] = usableSpace - p->nFree;
7076270832
for(j=0; j<p->nOverflow; j++){
7076370833
szNew[i] += 2 + p->xCellSize(p, p->apOvfl[j]);
7076470834
}
7076570835
cntNew[i] = cntOld[i];
@@ -70981,22 +71051,21 @@
7098171051
** populated, not here.
7098271052
*/
7098371053
if( ISAUTOVACUUM ){
7098471054
MemPage *pOld;
7098571055
MemPage *pNew = pOld = apNew[0];
70986
- u8 *aOld = pNew->aData;
7098771056
int cntOldNext = pNew->nCell + pNew->nOverflow;
70988
- int usableSize = pBt->usableSize;
7098971057
int iNew = 0;
7099071058
int iOld = 0;
7099171059
7099271060
for(i=0; i<b.nCell; i++){
7099371061
u8 *pCell = b.apCell[i];
70994
- if( i==cntOldNext ){
70995
- pOld = (++iOld)<nNew ? apNew[iOld] : apOld[iOld];
71062
+ while( i==cntOldNext ){
71063
+ iOld++;
71064
+ assert( iOld<nNew || iOld<nOld );
71065
+ pOld = iOld<nNew ? apNew[iOld] : apOld[iOld];
7099671066
cntOldNext += pOld->nCell + pOld->nOverflow + !leafData;
70997
- aOld = pOld->aData;
7099871067
}
7099971068
if( i==cntNew[iNew] ){
7100071069
pNew = apNew[++iNew];
7100171070
if( !leafData ) continue;
7100271071
}
@@ -71007,11 +71076,11 @@
7100771076
** if sibling page iOld had the same page number as pNew, and if
7100871077
** pCell really was a part of sibling page iOld (not a divider or
7100971078
** overflow cell), we can skip updating the pointer map entries. */
7101071079
if( iOld>=nNew
7101171080
|| pNew->pgno!=aPgno[iOld]
71012
- || !SQLITE_WITHIN(pCell,aOld,&aOld[usableSize])
71081
+ || !SQLITE_WITHIN(pCell,pOld->aData,pOld->aDataEnd)
7101371082
){
7101471083
if( !leafCorrection ){
7101571084
ptrmapPut(pBt, get4byte(pCell), PTRMAP_BTREE, pNew->pgno, &rc);
7101671085
}
7101771086
if( cachedCellSize(&b,i)>pNew->minLocal ){
@@ -71257,11 +71326,11 @@
7125771326
releasePage(pChild);
7125871327
return rc;
7125971328
}
7126071329
assert( sqlite3PagerIswriteable(pChild->pDbPage) );
7126171330
assert( sqlite3PagerIswriteable(pRoot->pDbPage) );
71262
- assert( pChild->nCell==pRoot->nCell );
71331
+ assert( pChild->nCell==pRoot->nCell || CORRUPT_DB );
7126371332
7126471333
TRACE(("BALANCE: copy root %d into %d\n", pRoot->pgno, pChild->pgno));
7126571334
7126671335
/* Copy the overflow cells from pRoot to pChild */
7126771336
memcpy(pChild->aiOvfl, pRoot->aiOvfl,
@@ -71299,10 +71368,11 @@
7129971368
7130071369
do {
7130171370
int iPage = pCur->iPage;
7130271371
MemPage *pPage = pCur->pPage;
7130371372
71373
+ if( NEVER(pPage->nFree<0) && btreeComputeFreeSpace(pPage) ) break;
7130471374
if( iPage==0 ){
7130571375
if( pPage->nOverflow ){
7130671376
/* The root page of the b-tree is overfull. In this case call the
7130771377
** balance_deeper() function to create a new child for the root-page
7130871378
** and copy the current contents of the root-page to it. The
@@ -71327,10 +71397,13 @@
7132771397
}else{
7132871398
MemPage * const pParent = pCur->apPage[iPage-1];
7132971399
int const iIdx = pCur->aiIdx[iPage-1];
7133071400
7133171401
rc = sqlite3PagerWrite(pParent->pDbPage);
71402
+ if( rc==SQLITE_OK && pParent->nFree<0 ){
71403
+ rc = btreeComputeFreeSpace(pParent);
71404
+ }
7133271405
if( rc==SQLITE_OK ){
7133371406
#ifndef SQLITE_OMIT_QUICKBALANCE
7133471407
if( pPage->intKeyLeaf
7133571408
&& pPage->nOverflow==1
7133671409
&& pPage->aiOvfl[0]==pPage->nCell
@@ -71673,10 +71746,14 @@
7167371746
assert( pCur->eState==CURSOR_VALID || (pCur->eState==CURSOR_INVALID && loc) );
7167471747
7167571748
pPage = pCur->pPage;
7167671749
assert( pPage->intKey || pX->nKey>=0 );
7167771750
assert( pPage->leaf || !pPage->intKey );
71751
+ if( pPage->nFree<0 ){
71752
+ rc = btreeComputeFreeSpace(pPage);
71753
+ if( rc ) return rc;
71754
+ }
7167871755
7167971756
TRACE(("INSERT: table=%d nkey=%lld ndata=%d page=%d %s\n",
7168071757
pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno,
7168171758
loc==0 ? "overwrite" : "new entry"));
7168271759
assert( pPage->isInit );
@@ -71823,10 +71900,11 @@
7182371900
7182471901
iCellDepth = pCur->iPage;
7182571902
iCellIdx = pCur->ix;
7182671903
pPage = pCur->pPage;
7182771904
pCell = findCell(pPage, iCellIdx);
71905
+ if( pPage->nFree<0 && btreeComputeFreeSpace(pPage) ) return SQLITE_CORRUPT;
7182871906
7182971907
/* If the bPreserve flag is set to true, then the cursor position must
7183071908
** be preserved following this delete operation. If the current delete
7183171909
** will cause a b-tree rebalance, then this is done by saving the cursor
7183271910
** key and leaving the cursor in CURSOR_REQUIRESEEK state before
@@ -71893,10 +71971,14 @@
7189371971
MemPage *pLeaf = pCur->pPage;
7189471972
int nCell;
7189571973
Pgno n;
7189671974
unsigned char *pTmp;
7189771975
71976
+ if( pLeaf->nFree<0 ){
71977
+ rc = btreeComputeFreeSpace(pLeaf);
71978
+ if( rc ) return rc;
71979
+ }
7189871980
if( iCellDepth<pCur->iPage-1 ){
7189971981
n = pCur->apPage[iCellDepth+1]->pgno;
7190071982
}else{
7190171983
n = pCur->pPage->pgno;
7190271984
}
@@ -72784,10 +72866,15 @@
7278472866
assert( rc==SQLITE_CORRUPT ); /* The only possible error from InitPage */
7278572867
checkAppendMsg(pCheck,
7278672868
"btreeInitPage() returns error code %d", rc);
7278772869
goto end_of_check;
7278872870
}
72871
+ if( (rc = btreeComputeFreeSpace(pPage))!=0 ){
72872
+ assert( rc==SQLITE_CORRUPT );
72873
+ checkAppendMsg(pCheck, "free space corruption", rc);
72874
+ goto end_of_check;
72875
+ }
7278972876
data = pPage->aData;
7279072877
hdr = pPage->hdrOffset;
7279172878
7279272879
/* Set up for cell analysis */
7279372880
pCheck->zPfx = "On tree page %d cell %d: ";
@@ -72916,23 +73003,23 @@
7291673003
** freeblocks on the page.
7291773004
*/
7291873005
i = get2byte(&data[hdr+1]);
7291973006
while( i>0 ){
7292073007
int size, j;
72921
- assert( (u32)i<=usableSize-4 ); /* Enforced by btreeInitPage() */
73008
+ assert( (u32)i<=usableSize-4 ); /* Enforced by btreeComputeFreeSpace() */
7292273009
size = get2byte(&data[i+2]);
72923
- assert( (u32)(i+size)<=usableSize ); /* Enforced by btreeInitPage() */
73010
+ assert( (u32)(i+size)<=usableSize ); /* due to btreeComputeFreeSpace() */
7292473011
btreeHeapInsert(heap, (((u32)i)<<16)|(i+size-1));
7292573012
/* EVIDENCE-OF: R-58208-19414 The first 2 bytes of a freeblock are a
7292673013
** big-endian integer which is the offset in the b-tree page of the next
7292773014
** freeblock in the chain, or zero if the freeblock is the last on the
7292873015
** chain. */
7292973016
j = get2byte(&data[i]);
7293073017
/* EVIDENCE-OF: R-06866-39125 Freeblocks are always connected in order of
7293173018
** increasing offset. */
72932
- assert( j==0 || j>i+size ); /* Enforced by btreeInitPage() */
72933
- assert( (u32)j<=usableSize-4 ); /* Enforced by btreeInitPage() */
73019
+ assert( j==0 || j>i+size ); /* Enforced by btreeComputeFreeSpace() */
73020
+ assert( (u32)j<=usableSize-4 ); /* Enforced by btreeComputeFreeSpace() */
7293473021
i = j;
7293573022
}
7293673023
/* Analyze the min-heap looking for overlap between cells and/or
7293773024
** freeblocks, and counting the number of untracked bytes in nFrag.
7293873025
**
@@ -74393,12 +74480,11 @@
7439374480
return rc;
7439474481
#endif
7439574482
}
7439674483
7439774484
/*
74398
-** Make sure pMem->z points to a writable allocation of at least
74399
-** min(n,32) bytes.
74485
+** Make sure pMem->z points to a writable allocation of at least n bytes.
7440074486
**
7440174487
** If the bPreserve argument is true, then copy of the content of
7440274488
** pMem->z into the new allocation. pMem must be either a string or
7440374489
** blob if bPreserve is true. If bPreserve is false, any prior content
7440474490
** in pMem->z is discarded.
@@ -74413,11 +74499,10 @@
7441374499
assert( bPreserve==0 || pMem->flags&(MEM_Blob|MEM_Str) );
7441474500
testcase( bPreserve && pMem->z==0 );
7441574501
7441674502
assert( pMem->szMalloc==0
7441774503
|| pMem->szMalloc==sqlite3DbMallocSize(pMem->db, pMem->zMalloc) );
74418
- if( n<32 ) n = 32;
7441974504
if( pMem->szMalloc>0 && bPreserve && pMem->z==pMem->zMalloc ){
7442074505
pMem->z = pMem->zMalloc = sqlite3DbReallocOrFree(pMem->db, pMem->z, n);
7442174506
bPreserve = 0;
7442274507
}else{
7442374508
if( pMem->szMalloc>0 ) sqlite3DbFreeNN(pMem->db, pMem->zMalloc);
@@ -75262,11 +75347,10 @@
7526275347
flags = (enc==0?MEM_Blob:MEM_Str);
7526375348
if( nByte<0 ){
7526475349
assert( enc!=0 );
7526575350
if( enc==SQLITE_UTF8 ){
7526675351
nByte = 0x7fffffff & (int)strlen(z);
75267
- if( nByte>iLimit ) nByte = iLimit+1;
7526875352
}else{
7526975353
for(nByte=0; nByte<=iLimit && (z[nByte] | z[nByte+1]); nByte+=2){}
7527075354
}
7527175355
flags |= MEM_Term;
7527275356
}
@@ -75274,33 +75358,34 @@
7527475358
/* The following block sets the new values of Mem.z and Mem.xDel. It
7527575359
** also sets a flag in local variable "flags" to indicate the memory
7527675360
** management (one of MEM_Dyn or MEM_Static).
7527775361
*/
7527875362
if( xDel==SQLITE_TRANSIENT ){
75279
- int nAlloc = nByte;
75363
+ u32 nAlloc = nByte;
7528075364
if( flags&MEM_Term ){
7528175365
nAlloc += (enc==SQLITE_UTF8?1:2);
7528275366
}
7528375367
if( nByte>iLimit ){
7528475368
return SQLITE_TOOBIG;
7528575369
}
7528675370
testcase( nAlloc==0 );
7528775371
testcase( nAlloc==31 );
7528875372
testcase( nAlloc==32 );
75289
- if( sqlite3VdbeMemClearAndResize(pMem, MAX(nAlloc,32)) ){
75373
+ if( sqlite3VdbeMemClearAndResize(pMem, (int)MAX(nAlloc,32)) ){
7529075374
return SQLITE_NOMEM_BKPT;
7529175375
}
7529275376
memcpy(pMem->z, z, nAlloc);
75293
- }else if( xDel==SQLITE_DYNAMIC ){
75294
- sqlite3VdbeMemRelease(pMem);
75295
- pMem->zMalloc = pMem->z = (char *)z;
75296
- pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->zMalloc);
7529775377
}else{
7529875378
sqlite3VdbeMemRelease(pMem);
7529975379
pMem->z = (char *)z;
75300
- pMem->xDel = xDel;
75301
- flags |= ((xDel==SQLITE_STATIC)?MEM_Static:MEM_Dyn);
75380
+ if( xDel==SQLITE_DYNAMIC ){
75381
+ pMem->zMalloc = pMem->z;
75382
+ pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->zMalloc);
75383
+ }else{
75384
+ pMem->xDel = xDel;
75385
+ flags |= ((xDel==SQLITE_STATIC)?MEM_Static:MEM_Dyn);
75386
+ }
7530275387
}
7530375388
7530475389
pMem->n = nByte;
7530575390
pMem->flags = flags;
7530675391
pMem->enc = (enc==0 ? SQLITE_UTF8 : enc);
@@ -82206,14 +82291,14 @@
8220682291
**
8220782292
** If the result is not a simple column reference (if it is an expression
8220882293
** or a constant) then useTypes 2, 3, and 4 return NULL.
8220982294
*/
8221082295
static const void *columnName(
82211
- sqlite3_stmt *pStmt,
82212
- int N,
82213
- const void *(*xFunc)(Mem*),
82214
- int useType
82296
+ sqlite3_stmt *pStmt, /* The statement */
82297
+ int N, /* Which column to get the name for */
82298
+ int useUtf16, /* True to return the name as UTF16 */
82299
+ int useType /* What type of name */
8221582300
){
8221682301
const void *ret;
8221782302
Vdbe *p;
8221882303
int n;
8221982304
sqlite3 *db;
@@ -82230,12 +82315,16 @@
8223082315
n = sqlite3_column_count(pStmt);
8223182316
if( N<n && N>=0 ){
8223282317
N += useType*n;
8223382318
sqlite3_mutex_enter(db->mutex);
8223482319
assert( db->mallocFailed==0 );
82235
- ret = xFunc(&p->aColName[N]);
82236
- /* A malloc may have failed inside of the xFunc() call. If this
82320
+ if( useUtf16 ){
82321
+ ret = sqlite3_value_text16((sqlite3_value*)&p->aColName[N]);
82322
+ }else{
82323
+ ret = sqlite3_value_text((sqlite3_value*)&p->aColName[N]);
82324
+ }
82325
+ /* A malloc may have failed inside of the _text() call. If this
8223782326
** is the case, clear the mallocFailed flag and return NULL.
8223882327
*/
8223982328
if( db->mallocFailed ){
8224082329
sqlite3OomClear(db);
8224182330
ret = 0;
@@ -82248,17 +82337,15 @@
8224882337
/*
8224982338
** Return the name of the Nth column of the result set returned by SQL
8225082339
** statement pStmt.
8225182340
*/
8225282341
SQLITE_API const char *sqlite3_column_name(sqlite3_stmt *pStmt, int N){
82253
- return columnName(
82254
- pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_NAME);
82342
+ return columnName(pStmt, N, 0, COLNAME_NAME);
8225582343
}
8225682344
#ifndef SQLITE_OMIT_UTF16
8225782345
SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt *pStmt, int N){
82258
- return columnName(
82259
- pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_NAME);
82346
+ return columnName(pStmt, N, 1, COLNAME_NAME);
8226082347
}
8226182348
#endif
8226282349
8226382350
/*
8226482351
** Constraint: If you have ENABLE_COLUMN_METADATA then you must
@@ -82273,17 +82360,15 @@
8227382360
/*
8227482361
** Return the column declaration type (if applicable) of the 'i'th column
8227582362
** of the result set of SQL statement pStmt.
8227682363
*/
8227782364
SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt *pStmt, int N){
82278
- return columnName(
82279
- pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_DECLTYPE);
82365
+ return columnName(pStmt, N, 0, COLNAME_DECLTYPE);
8228082366
}
8228182367
#ifndef SQLITE_OMIT_UTF16
8228282368
SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt *pStmt, int N){
82283
- return columnName(
82284
- pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DECLTYPE);
82369
+ return columnName(pStmt, N, 1, COLNAME_DECLTYPE);
8228582370
}
8228682371
#endif /* SQLITE_OMIT_UTF16 */
8228782372
#endif /* SQLITE_OMIT_DECLTYPE */
8228882373
8228982374
#ifdef SQLITE_ENABLE_COLUMN_METADATA
@@ -82291,49 +82376,43 @@
8229182376
** Return the name of the database from which a result column derives.
8229282377
** NULL is returned if the result column is an expression or constant or
8229382378
** anything else which is not an unambiguous reference to a database column.
8229482379
*/
8229582380
SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt *pStmt, int N){
82296
- return columnName(
82297
- pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_DATABASE);
82381
+ return columnName(pStmt, N, 0, COLNAME_DATABASE);
8229882382
}
8229982383
#ifndef SQLITE_OMIT_UTF16
8230082384
SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt *pStmt, int N){
82301
- return columnName(
82302
- pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DATABASE);
82385
+ return columnName(pStmt, N, 1, COLNAME_DATABASE);
8230382386
}
8230482387
#endif /* SQLITE_OMIT_UTF16 */
8230582388
8230682389
/*
8230782390
** Return the name of the table from which a result column derives.
8230882391
** NULL is returned if the result column is an expression or constant or
8230982392
** anything else which is not an unambiguous reference to a database column.
8231082393
*/
8231182394
SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt *pStmt, int N){
82312
- return columnName(
82313
- pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_TABLE);
82395
+ return columnName(pStmt, N, 0, COLNAME_TABLE);
8231482396
}
8231582397
#ifndef SQLITE_OMIT_UTF16
8231682398
SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt *pStmt, int N){
82317
- return columnName(
82318
- pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_TABLE);
82399
+ return columnName(pStmt, N, 1, COLNAME_TABLE);
8231982400
}
8232082401
#endif /* SQLITE_OMIT_UTF16 */
8232182402
8232282403
/*
8232382404
** Return the name of the table column from which a result column derives.
8232482405
** NULL is returned if the result column is an expression or constant or
8232582406
** anything else which is not an unambiguous reference to a database column.
8232682407
*/
8232782408
SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt *pStmt, int N){
82328
- return columnName(
82329
- pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_COLUMN);
82409
+ return columnName(pStmt, N, 0, COLNAME_COLUMN);
8233082410
}
8233182411
#ifndef SQLITE_OMIT_UTF16
8233282412
SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt *pStmt, int N){
82333
- return columnName(
82334
- pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_COLUMN);
82413
+ return columnName(pStmt, N, 1, COLNAME_COLUMN);
8233582414
}
8233682415
#endif /* SQLITE_OMIT_UTF16 */
8233782416
#endif /* SQLITE_ENABLE_COLUMN_METADATA */
8233882417
8233982418
@@ -83975,10 +84054,19 @@
8397584054
#endif
8397684055
/*** INSERT STACK UNION HERE ***/
8397784056
8397884057
assert( p->magic==VDBE_MAGIC_RUN ); /* sqlite3_step() verifies this */
8397984058
sqlite3VdbeEnter(p);
84059
+#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
84060
+ if( db->xProgress ){
84061
+ u32 iPrior = p->aCounter[SQLITE_STMTSTATUS_VM_STEP];
84062
+ assert( 0 < db->nProgressOps );
84063
+ nProgressLimit = db->nProgressOps - (iPrior % db->nProgressOps);
84064
+ }else{
84065
+ nProgressLimit = 0xffffffff;
84066
+ }
84067
+#endif
8398084068
if( p->rc==SQLITE_NOMEM ){
8398184069
/* This happens if a malloc() inside a call to sqlite3_column_text() or
8398284070
** sqlite3_column_text16() failed. */
8398384071
goto no_mem;
8398484072
}
@@ -83988,19 +84076,10 @@
8398884076
assert( p->explain==0 );
8398984077
p->pResultSet = 0;
8399084078
db->busyHandler.nBusy = 0;
8399184079
if( db->u1.isInterrupted ) goto abort_due_to_interrupt;
8399284080
sqlite3VdbeIOTraceSql(p);
83993
-#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
83994
- if( db->xProgress ){
83995
- u32 iPrior = p->aCounter[SQLITE_STMTSTATUS_VM_STEP];
83996
- assert( 0 < db->nProgressOps );
83997
- nProgressLimit = db->nProgressOps - (iPrior % db->nProgressOps);
83998
- }else{
83999
- nProgressLimit = 0xffffffff;
84000
- }
84001
-#endif
8400284081
#ifdef SQLITE_DEBUG
8400384082
sqlite3BeginBenignMalloc();
8400484083
if( p->pc==0
8400584084
&& (p->db->flags & (SQLITE_VdbeListing|SQLITE_VdbeEQP|SQLITE_VdbeTrace))!=0
8400684085
){
@@ -84172,14 +84251,15 @@
8417284251
** of VDBE ops have been executed (either since this invocation of
8417384252
** sqlite3VdbeExec() or since last time the progress callback was called).
8417484253
** If the progress callback returns non-zero, exit the virtual machine with
8417584254
** a return code SQLITE_ABORT.
8417684255
*/
84177
- if( nVmStep>=nProgressLimit && db->xProgress!=0 ){
84256
+ while( nVmStep>=nProgressLimit && db->xProgress!=0 ){
8417884257
assert( db->nProgressOps!=0 );
84179
- nProgressLimit = nVmStep + db->nProgressOps - (nVmStep%db->nProgressOps);
84258
+ nProgressLimit += db->nProgressOps;
8418084259
if( db->xProgress(db->pProgressArg) ){
84260
+ nProgressLimit = 0xffffffff;
8418184261
rc = SQLITE_INTERRUPT;
8418284262
goto abort_due_to_error;
8418384263
}
8418484264
}
8418584265
#endif
@@ -84454,10 +84534,11 @@
8445484534
8445584535
#ifndef SQLITE_OMIT_UTF16
8445684536
if( encoding!=SQLITE_UTF8 ){
8445784537
rc = sqlite3VdbeMemSetStr(pOut, pOp->p4.z, -1, SQLITE_UTF8, SQLITE_STATIC);
8445884538
assert( rc==SQLITE_OK || rc==SQLITE_TOOBIG );
84539
+ if( rc ) goto too_big;
8445984540
if( SQLITE_OK!=sqlite3VdbeChangeEncoding(pOut, encoding) ) goto no_mem;
8446084541
assert( pOut->szMalloc>0 && pOut->zMalloc==pOut->z );
8446184542
assert( VdbeMemDynamic(pOut)==0 );
8446284543
pOut->szMalloc = 0;
8446384544
pOut->flags |= MEM_Static;
@@ -84466,11 +84547,10 @@
8446684547
}
8446784548
pOp->p4type = P4_DYNAMIC;
8446884549
pOp->p4.z = pOut->z;
8446984550
pOp->p1 = pOut->n;
8447084551
}
84471
- testcase( rc==SQLITE_TOOBIG );
8447284552
#endif
8447384553
if( pOp->p1>db->aLimit[SQLITE_LIMIT_LENGTH] ){
8447484554
goto too_big;
8447584555
}
8447684556
assert( rc==SQLITE_OK );
@@ -84721,22 +84801,10 @@
8472184801
int i;
8472284802
assert( p->nResColumn==pOp->p2 );
8472384803
assert( pOp->p1>0 );
8472484804
assert( pOp->p1+pOp->p2<=(p->nMem+1 - p->nCursor)+1 );
8472584805
84726
-#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
84727
- /* Run the progress counter just before returning.
84728
- */
84729
- if( db->xProgress!=0
84730
- && nVmStep>=nProgressLimit
84731
- && db->xProgress(db->pProgressArg)!=0
84732
- ){
84733
- rc = SQLITE_INTERRUPT;
84734
- goto abort_due_to_error;
84735
- }
84736
-#endif
84737
-
8473884806
/* If this statement has violated immediate foreign key constraints, do
8473984807
** not return the number of rows modified. And do not RELEASE the statement
8474084808
** transaction. It needs to be rolled back. */
8474184809
if( SQLITE_OK!=(rc = sqlite3VdbeCheckFk(p, 0)) ){
8474284810
assert( db->flags&SQLITE_CountRows );
@@ -85959,19 +86027,19 @@
8595986027
offset64 = aOffset[i];
8596086028
zHdr = zData + pC->iHdrOffset;
8596186029
zEndHdr = zData + aOffset[0];
8596286030
testcase( zHdr>=zEndHdr );
8596386031
do{
85964
- if( (t = zHdr[0])<0x80 ){
86032
+ if( (pC->aType[i] = t = zHdr[0])<0x80 ){
8596586033
zHdr++;
8596686034
offset64 += sqlite3VdbeOneByteSerialTypeLen(t);
8596786035
}else{
8596886036
zHdr += sqlite3GetVarint32(zHdr, &t);
86037
+ pC->aType[i] = t;
8596986038
offset64 += sqlite3VdbeSerialTypeLen(t);
8597086039
}
85971
- pC->aType[i++] = t;
85972
- aOffset[i] = (u32)(offset64 & 0xffffffff);
86040
+ aOffset[++i] = (u32)(offset64 & 0xffffffff);
8597386041
}while( i<=p2 && zHdr<zEndHdr );
8597486042
8597586043
/* The record is corrupt if any of the following are true:
8597686044
** (1) the bytes of the header extend past the declared header size
8597786045
** (2) the entire header was used but not all data was used
@@ -87933,18 +88001,11 @@
8793388001
** cause any problems.)
8793488002
**
8793588003
** This instruction only works on tables. The equivalent instruction
8793688004
** for indices is OP_IdxInsert.
8793788005
*/
87938
-/* Opcode: InsertInt P1 P2 P3 P4 P5
87939
-** Synopsis: intkey=P3 data=r[P2]
87940
-**
87941
-** This works exactly like OP_Insert except that the key is the
87942
-** integer value P3, not the value of the integer stored in register P3.
87943
-*/
87944
-case OP_Insert:
87945
-case OP_InsertInt: {
88006
+case OP_Insert: {
8794688007
Mem *pData; /* MEM cell holding data for the record to be inserted */
8794788008
Mem *pKey; /* MEM cell holding key for the record */
8794888009
VdbeCursor *pC; /* Cursor to table into which insert is written */
8794988010
int seekResult; /* Result of prior seek or 0 if no USESEEKRESULT flag */
8795088011
const char *zDb; /* database name - used by the update hook */
@@ -87961,20 +88022,15 @@
8796188022
assert( (pOp->p5 & OPFLAG_ISNOOP) || pC->isTable );
8796288023
assert( pOp->p4type==P4_TABLE || pOp->p4type>=P4_STATIC );
8796388024
REGISTER_TRACE(pOp->p2, pData);
8796488025
sqlite3VdbeIncrWriteCounter(p, pC);
8796588026
87966
- if( pOp->opcode==OP_Insert ){
87967
- pKey = &aMem[pOp->p3];
87968
- assert( pKey->flags & MEM_Int );
87969
- assert( memIsValid(pKey) );
87970
- REGISTER_TRACE(pOp->p3, pKey);
87971
- x.nKey = pKey->u.i;
87972
- }else{
87973
- assert( pOp->opcode==OP_InsertInt );
87974
- x.nKey = pOp->p3;
87975
- }
88027
+ pKey = &aMem[pOp->p3];
88028
+ assert( pKey->flags & MEM_Int );
88029
+ assert( memIsValid(pKey) );
88030
+ REGISTER_TRACE(pOp->p3, pKey);
88031
+ x.nKey = pKey->u.i;
8797688032
8797788033
if( pOp->p4type==P4_TABLE && HAS_UPDATE_HOOK(db) ){
8797888034
assert( pC->iDb>=0 );
8797988035
zDb = db->aDb[pC->iDb].zDbSName;
8798088036
pTab = pOp->p4.pTab;
@@ -89538,12 +89594,11 @@
8953889594
aMem[i].flags |= MEM_Undefined; /* Cause a fault if this reg is reused */
8953989595
}
8954089596
}
8954189597
#endif
8954289598
pOp = &aOp[-1];
89543
-
89544
- break;
89599
+ goto check_for_interrupt;
8954589600
}
8954689601
8954789602
/* Opcode: Param P1 P2 * * *
8954889603
**
8954989604
** This opcode is only ever present in sub-programs called via the
@@ -90948,11 +91003,20 @@
9094891003
9094991004
/* This is the only way out of this procedure. We have to
9095091005
** release the mutexes on btrees that were acquired at the
9095191006
** top. */
9095291007
vdbe_return:
90953
- testcase( nVmStep>0 );
91008
+#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
91009
+ while( nVmStep>=nProgressLimit && db->xProgress!=0 ){
91010
+ nProgressLimit += db->nProgressOps;
91011
+ if( db->xProgress(db->pProgressArg) ){
91012
+ nProgressLimit = 0xffffffff;
91013
+ rc = SQLITE_INTERRUPT;
91014
+ goto abort_due_to_error;
91015
+ }
91016
+ }
91017
+#endif
9095491018
p->aCounter[SQLITE_STMTSTATUS_VM_STEP] += (int)nVmStep;
9095591019
sqlite3VdbeLeave(p);
9095691020
assert( rc!=SQLITE_OK || nExtraDelete==0
9095791021
|| sqlite3_strlike("DELETE%",p->zSql,0)!=0
9095891022
);
@@ -96129,10 +96193,42 @@
9612996193
}
9613096194
}
9613196195
return 0;
9613296196
}
9613396197
96198
+#ifndef SQLITE_OMIT_WINDOWFUNC
96199
+/*
96200
+** Walker callback for resolveRemoveWindows().
96201
+*/
96202
+static int resolveRemoveWindowsCb(Walker *pWalker, Expr *pExpr){
96203
+ if( ExprHasProperty(pExpr, EP_WinFunc) ){
96204
+ Window **pp;
96205
+ for(pp=&pWalker->u.pSelect->pWin; *pp; pp=&(*pp)->pNextWin){
96206
+ if( *pp==pExpr->y.pWin ){
96207
+ *pp = (*pp)->pNextWin;
96208
+ break;
96209
+ }
96210
+ }
96211
+ }
96212
+ return WRC_Continue;
96213
+}
96214
+
96215
+/*
96216
+** Remove any Window objects owned by the expression pExpr from the
96217
+** Select.pWin list of Select object pSelect.
96218
+*/
96219
+static void resolveRemoveWindows(Select *pSelect, Expr *pExpr){
96220
+ Walker sWalker;
96221
+ memset(&sWalker, 0, sizeof(Walker));
96222
+ sWalker.xExprCallback = resolveRemoveWindowsCb;
96223
+ sWalker.u.pSelect = pSelect;
96224
+ sqlite3WalkExpr(&sWalker, pExpr);
96225
+}
96226
+#else
96227
+# define resolveRemoveWindows(x,y)
96228
+#endif
96229
+
9613496230
/*
9613596231
** pOrderBy is an ORDER BY or GROUP BY clause in SELECT statement pSelect.
9613696232
** The Name context of the SELECT statement is pNC. zType is either
9613796233
** "ORDER" or "GROUP" depending on which type of clause pOrderBy is.
9613896234
**
@@ -96195,23 +96291,14 @@
9619596291
if( sqlite3ResolveExprNames(pNC, pE) ){
9619696292
return 1;
9619796293
}
9619896294
for(j=0; j<pSelect->pEList->nExpr; j++){
9619996295
if( sqlite3ExprCompare(0, pE, pSelect->pEList->a[j].pExpr, -1)==0 ){
96200
-#ifndef SQLITE_OMIT_WINDOWFUNC
96201
- if( ExprHasProperty(pE, EP_WinFunc) ){
96202
- /* Since this window function is being changed into a reference
96203
- ** to the same window function the result set, remove the instance
96204
- ** of this window function from the Select.pWin list. */
96205
- Window **pp;
96206
- for(pp=&pSelect->pWin; *pp; pp=&(*pp)->pNextWin){
96207
- if( *pp==pE->y.pWin ){
96208
- *pp = (*pp)->pNextWin;
96209
- }
96210
- }
96211
- }
96212
-#endif
96296
+ /* Since this expresion is being changed into a reference
96297
+ ** to an identical expression in the result set, remove all Window
96298
+ ** objects belonging to the expression from the Select.pWin list. */
96299
+ resolveRemoveWindows(pSelect, pE);
9621396300
pItem->u.x.iOrderByCol = j+1;
9621496301
}
9621596302
}
9621696303
}
9621796304
return sqlite3ResolveOrderGroupBy(pParse, pSelect, pOrderBy, zType);
@@ -96419,10 +96506,11 @@
9641996506
return WRC_Abort;
9642096507
}
9642196508
}
9642296509
}
9642396510
96511
+#ifndef SQLITE_OMIT_WINDOWFUNC
9642496512
if( IN_RENAME_OBJECT ){
9642596513
Window *pWin;
9642696514
for(pWin=p->pWinDefn; pWin; pWin=pWin->pNextWin){
9642796515
if( sqlite3ResolveExprListNames(&sNC, pWin->pOrderBy)
9642896516
|| sqlite3ResolveExprListNames(&sNC, pWin->pPartition)
@@ -96429,10 +96517,11 @@
9642996517
){
9643096518
return WRC_Abort;
9643196519
}
9643296520
}
9643396521
}
96522
+#endif
9643496523
9643596524
/* If this is part of a compound SELECT, check that it has the right
9643696525
** number of expressions in the select list. */
9643796526
if( p->pNext && p->pEList->nExpr!=p->pNext->pEList->nExpr ){
9643896527
sqlite3SelectWrongNumTermsError(pParse, p->pNext);
@@ -99179,18 +99268,15 @@
9917999268
u32 savedNQueryLoop = pParse->nQueryLoop;
9918099269
int rMayHaveNull = 0;
9918199270
eType = IN_INDEX_EPH;
9918299271
if( inFlags & IN_INDEX_LOOP ){
9918399272
pParse->nQueryLoop = 0;
99184
- if( pX->pLeft->iColumn<0 && !ExprHasProperty(pX, EP_xIsSelect) ){
99185
- eType = IN_INDEX_ROWID;
99186
- }
9918799273
}else if( prRhsHasNull ){
9918899274
*prRhsHasNull = rMayHaveNull = ++pParse->nMem;
9918999275
}
9919099276
assert( pX->op==TK_IN );
99191
- sqlite3CodeRhsOfIN(pParse, pX, iTab, eType==IN_INDEX_ROWID);
99277
+ sqlite3CodeRhsOfIN(pParse, pX, iTab);
9919299278
if( rMayHaveNull ){
9919399279
sqlite3SetHasNullFlag(v, iTab, rMayHaveNull);
9919499280
}
9919599281
pParse->nQueryLoop = savedNQueryLoop;
9919699282
}
@@ -99287,16 +99373,10 @@
9928799373
** constructed ephermeral table is returned. The first time the ephemeral
9928899374
** table is computed, the cursor number is also stored in pExpr->iTable,
9928999375
** however the cursor number returned might not be the same, as it might
9929099376
** have been duplicated using OP_OpenDup.
9929199377
**
99292
-** If parameter isRowid is non-zero, then LHS of the IN operator is guaranteed
99293
-** to be a non-null integer. In this case, the ephemeral table can be an
99294
-** table B-Tree that keyed by only integers. The more general cases uses
99295
-** an index B-Tree which can have arbitrary keys, but is slower to both
99296
-** read and write.
99297
-**
9929899378
** If the LHS expression ("x" in the examples) is a column value, or
9929999379
** the SELECT statement returns a column value, then the affinity of that
9930099380
** column is used to build the index keys. If both 'x' and the
9930199381
** SELECT... statement are columns, then numeric affinity is used
9930299382
** if either column has NUMERIC or INTEGER affinity. If neither
@@ -99304,12 +99384,11 @@
9930499384
** is used.
9930599385
*/
9930699386
SQLITE_PRIVATE void sqlite3CodeRhsOfIN(
9930799387
Parse *pParse, /* Parsing context */
9930899388
Expr *pExpr, /* The IN operator */
99309
- int iTab, /* Use this cursor number */
99310
- int isRowid /* If true, LHS is a rowid */
99389
+ int iTab /* Use this cursor number */
9931199390
){
9931299391
int addrOnce = 0; /* Address of the OP_Once instruction at top */
9931399392
int addr; /* Address of OP_OpenEphemeral instruction */
9931499393
Expr *pLeft; /* the LHS of the IN operator */
9931599394
KeyInfo *pKeyInfo = 0; /* Key information */
@@ -99358,26 +99437,24 @@
9935899437
}
9935999438
9936099439
/* Check to see if this is a vector IN operator */
9936199440
pLeft = pExpr->pLeft;
9936299441
nVal = sqlite3ExprVectorSize(pLeft);
99363
- assert( !isRowid || nVal==1 );
9936499442
9936599443
/* Construct the ephemeral table that will contain the content of
9936699444
** RHS of the IN operator.
9936799445
*/
9936899446
pExpr->iTable = iTab;
99369
- addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral,
99370
- pExpr->iTable, (isRowid?0:nVal));
99447
+ addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pExpr->iTable, nVal);
9937199448
#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
9937299449
if( ExprHasProperty(pExpr, EP_xIsSelect) ){
9937399450
VdbeComment((v, "Result of SELECT %u", pExpr->x.pSelect->selId));
9937499451
}else{
9937599452
VdbeComment((v, "RHS of IN operator"));
9937699453
}
9937799454
#endif
99378
- pKeyInfo = isRowid ? 0 : sqlite3KeyInfoAlloc(pParse->db, nVal, 1);
99455
+ pKeyInfo = sqlite3KeyInfoAlloc(pParse->db, nVal, 1);
9937999456
9938099457
if( ExprHasProperty(pExpr, EP_xIsSelect) ){
9938199458
/* Case 1: expr IN (SELECT ...)
9938299459
**
9938399460
** Generate code to write the results of the select into the temporary
@@ -99387,11 +99464,10 @@
9938799464
ExprList *pEList = pSelect->pEList;
9938899465
9938999466
ExplainQueryPlan((pParse, 1, "%sLIST SUBQUERY %d",
9939099467
addrOnce?"":"CORRELATED ", pSelect->selId
9939199468
));
99392
- assert( !isRowid );
9939399469
/* If the LHS and RHS of the IN operator do not match, that
9939499470
** error will have been caught long before we reach this point. */
9939599471
if( ALWAYS(pEList->nExpr==nVal) ){
9939699472
SelectDest dest;
9939799473
int i;
@@ -99440,14 +99516,12 @@
9944099516
}
9944199517
9944299518
/* Loop through each expression in <exprlist>. */
9944399519
r1 = sqlite3GetTempReg(pParse);
9944499520
r2 = sqlite3GetTempReg(pParse);
99445
- if( isRowid ) sqlite3VdbeAddOp4(v, OP_Blob, 0, r2, 0, "", P4_STATIC);
9944699521
for(i=pList->nExpr, pItem=pList->a; i>0; i--, pItem++){
9944799522
Expr *pE2 = pItem->pExpr;
99448
- int iValToIns;
9944999523
9945099524
/* If the expression is not constant then we will need to
9945199525
** disable the test that was generated above that makes sure
9945299526
** this code only executes once. Because for a non-constant
9945399527
** expression we need to rerun this code each time.
@@ -99456,24 +99530,13 @@
9945699530
sqlite3VdbeChangeToNoop(v, addrOnce);
9945799531
addrOnce = 0;
9945899532
}
9945999533
9946099534
/* Evaluate the expression and insert it into the temp table */
99461
- if( isRowid && sqlite3ExprIsInteger(pE2, &iValToIns) ){
99462
- sqlite3VdbeAddOp3(v, OP_InsertInt, iTab, r2, iValToIns);
99463
- }else{
99464
- r3 = sqlite3ExprCodeTarget(pParse, pE2, r1);
99465
- if( isRowid ){
99466
- sqlite3VdbeAddOp2(v, OP_MustBeInt, r3,
99467
- sqlite3VdbeCurrentAddr(v)+2);
99468
- VdbeCoverage(v);
99469
- sqlite3VdbeAddOp3(v, OP_Insert, iTab, r2, r3);
99470
- }else{
99471
- sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1);
99472
- sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r2, r3, 1);
99473
- }
99474
- }
99535
+ r3 = sqlite3ExprCodeTarget(pParse, pE2, r1);
99536
+ sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1);
99537
+ sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r2, r3, 1);
9947599538
}
9947699539
sqlite3ReleaseTempReg(pParse, r1);
9947799540
sqlite3ReleaseTempReg(pParse, r2);
9947899541
}
9947999542
if( pKeyInfo ){
@@ -106852,11 +106915,15 @@
106852106915
assert( pParse->nested<10 ); /* Nesting should only be of limited depth */
106853106916
va_start(ap, zFormat);
106854106917
zSql = sqlite3VMPrintf(db, zFormat, ap);
106855106918
va_end(ap);
106856106919
if( zSql==0 ){
106857
- return; /* A malloc must have failed */
106920
+ /* This can result either from an OOM or because the formatted string
106921
+ ** exceeds SQLITE_LIMIT_LENGTH. In the latter case, we need to set
106922
+ ** an error */
106923
+ if( !db->mallocFailed ) pParse->rc = SQLITE_TOOBIG;
106924
+ return;
106858106925
}
106859106926
pParse->nested++;
106860106927
memcpy(saveBuf, PARSE_TAIL(pParse), PARSE_TAIL_SZ);
106861106928
memset(PARSE_TAIL(pParse), 0, PARSE_TAIL_SZ);
106862106929
sqlite3RunParser(pParse, zSql, &zErrMsg);
@@ -108413,10 +108480,11 @@
108413108480
if( db->mallocFailed || pParse->nErr ) return;
108414108481
pPk = sqlite3PrimaryKeyIndex(pTab);
108415108482
pTab->iPKey = -1;
108416108483
}else{
108417108484
pPk = sqlite3PrimaryKeyIndex(pTab);
108485
+ assert( pPk!=0 );
108418108486
108419108487
/*
108420108488
** Remove all redundant columns from the PRIMARY KEY. For example, change
108421108489
** "PRIMARY KEY(a,b,a,b,c,b,c,d)" into just "PRIMARY KEY(a,b,c,d)". Later
108422108490
** code assumes the PRIMARY KEY contains no repeated columns.
@@ -108582,10 +108650,15 @@
108582108650
}
108583108651
p->tnum = db->init.newTnum;
108584108652
if( p->tnum==1 ) p->tabFlags |= TF_Readonly;
108585108653
}
108586108654
108655
+ assert( (p->tabFlags & TF_HasPrimaryKey)==0
108656
+ || p->iPKey>=0 || sqlite3PrimaryKeyIndex(p)!=0 );
108657
+ assert( (p->tabFlags & TF_HasPrimaryKey)!=0
108658
+ || (p->iPKey<0 && sqlite3PrimaryKeyIndex(p)==0) );
108659
+
108587108660
/* Special processing for WITHOUT ROWID Tables */
108588108661
if( tabOpts & TF_WithoutRowid ){
108589108662
if( (p->tabFlags & TF_Autoincrement) ){
108590108663
sqlite3ErrorMsg(pParse,
108591108664
"AUTOINCREMENT not allowed on WITHOUT ROWID tables");
@@ -117855,11 +117928,13 @@
117855117928
}
117856117929
}
117857117930
sqlite3VdbeAddOp3(v, OP_MakeRecord, regIdx, pIdx->nColumn, aRegIdx[ix]);
117858117931
VdbeComment((v, "for %s", pIdx->zName));
117859117932
#ifdef SQLITE_ENABLE_NULL_TRIM
117860
- if( pIdx->idxType==2 ) sqlite3SetMakeRecordP5(v, pIdx->pTable);
117933
+ if( pIdx->idxType==SQLITE_IDXTYPE_PRIMARYKEY ){
117934
+ sqlite3SetMakeRecordP5(v, pIdx->pTable);
117935
+ }
117861117936
#endif
117862117937
117863117938
/* In an UPDATE operation, if this index is the PRIMARY KEY index
117864117939
** of a WITHOUT ROWID table and there has been no change the
117865117940
** primary key, then no collision is possible. The collision detection
@@ -118105,14 +118180,17 @@
118105118180
assert( pParse->nested==0 );
118106118181
pik_flags |= OPFLAG_NCHANGE;
118107118182
pik_flags |= (update_flags & OPFLAG_SAVEPOSITION);
118108118183
#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
118109118184
if( update_flags==0 ){
118110
- sqlite3VdbeAddOp4(v, OP_InsertInt,
118111
- iIdxCur+i, aRegIdx[i], 0, (char*)pTab, P4_TABLE
118185
+ int r = sqlite3GetTempReg(pParse);
118186
+ sqlite3VdbeAddOp2(v, OP_Integer, 0, r);
118187
+ sqlite3VdbeAddOp4(v, OP_Insert,
118188
+ iIdxCur+i, aRegIdx[i], r, (char*)pTab, P4_TABLE
118112118189
);
118113118190
sqlite3VdbeChangeP5(v, OPFLAG_ISNOOP);
118191
+ sqlite3ReleaseTempReg(pParse, r);
118114118192
}
118115118193
#endif
118116118194
}
118117118195
sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i],
118118118196
aRegIdx[i]+1,
@@ -118533,11 +118611,11 @@
118533118611
addr2 = sqlite3VdbeAddOp3(v, OP_NotExists, iDest, 0, regRowid);
118534118612
VdbeCoverage(v);
118535118613
sqlite3RowidConstraint(pParse, onError, pDest);
118536118614
sqlite3VdbeJumpHere(v, addr2);
118537118615
autoIncStep(pParse, regAutoinc, regRowid);
118538
- }else if( pDest->pIndex==0 ){
118616
+ }else if( pDest->pIndex==0 && !(db->mDbFlags & DBFLAG_Vacuum) ){
118539118617
addr1 = sqlite3VdbeAddOp2(v, OP_NewRowid, iDest, regRowid);
118540118618
}else{
118541118619
addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);
118542118620
assert( (pDest->tabFlags & TF_Autoincrement)==0 );
118543118621
}
@@ -118596,11 +118674,11 @@
118596118674
if( i==pSrcIdx->nColumn ){
118597118675
idxInsFlags = OPFLAG_USESEEKRESULT;
118598118676
sqlite3VdbeAddOp1(v, OP_SeekEnd, iDest);
118599118677
}
118600118678
}
118601
- if( !HasRowid(pSrc) && pDestIdx->idxType==2 ){
118679
+ if( !HasRowid(pSrc) && pDestIdx->idxType==SQLITE_IDXTYPE_PRIMARYKEY ){
118602118680
idxInsFlags |= OPFLAG_NCHANGE;
118603118681
}
118604118682
sqlite3VdbeAddOp2(v, OP_IdxInsert, iDest, regData);
118605118683
sqlite3VdbeChangeP5(v, idxInsFlags|OPFLAG_APPEND);
118606118684
sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1+1); VdbeCoverage(v);
@@ -136425,11 +136503,10 @@
136425136503
pIn += i;
136426136504
for(i=iEq;i<pLoop->nLTerm; i++){
136427136505
if( pLoop->aLTerm[i]->pExpr==pX ){
136428136506
int iOut = iReg + i - iEq;
136429136507
if( eType==IN_INDEX_ROWID ){
136430
- testcase( nEq>1 ); /* Happens with a UNIQUE index on ROWID */
136431136508
pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iOut);
136432136509
}else{
136433136510
int iCol = aiMap ? aiMap[iMap++] : 0;
136434136511
pIn->addrInTop = sqlite3VdbeAddOp3(v,OP_Column,iTab, iCol, iOut);
136435136512
}
@@ -137187,10 +137264,13 @@
137187137264
if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg);
137188137265
addrNxt = pLevel->addrNxt;
137189137266
sqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg);
137190137267
VdbeCoverage(v);
137191137268
pLevel->op = OP_Noop;
137269
+ if( (pTerm->prereqAll & pLevel->notReady)==0 ){
137270
+ pTerm->wtFlags |= TERM_CODED;
137271
+ }
137192137272
}else if( (pLoop->wsFlags & WHERE_IPK)!=0
137193137273
&& (pLoop->wsFlags & WHERE_COLUMN_RANGE)!=0
137194137274
){
137195137275
/* Case 3: We have an inequality comparison against the ROWID field.
137196137276
*/
@@ -153009,10 +153089,11 @@
153009153089
int n = 0; /* Length of the next token token */
153010153090
int tokenType; /* type of the next token */
153011153091
int lastTokenParsed = -1; /* type of the previous token */
153012153092
sqlite3 *db = pParse->db; /* The database connection */
153013153093
int mxSqlLen; /* Max length of an SQL string */
153094
+ VVA_ONLY( u8 startedWithOom = db->mallocFailed );
153014153095
#ifdef sqlite3Parser_ENGINEALWAYSONSTACK
153015153096
yyParser sEngine; /* Space to hold the Lemon-generated Parser object */
153016153097
#endif
153017153098
153018153099
assert( zSql!=0 );
@@ -153043,10 +153124,12 @@
153043153124
#endif
153044153125
assert( pParse->pNewTable==0 );
153045153126
assert( pParse->pNewTrigger==0 );
153046153127
assert( pParse->nVar==0 );
153047153128
assert( pParse->pVList==0 );
153129
+ pParse->pParentParse = db->pParse;
153130
+ db->pParse = pParse;
153048153131
while( 1 ){
153049153132
n = sqlite3GetToken((u8*)zSql, &tokenType);
153050153133
mxSqlLen -= n;
153051153134
if( mxSqlLen<0 ){
153052153135
pParse->rc = SQLITE_TOOBIG;
@@ -153099,11 +153182,12 @@
153099153182
pParse->sLastToken.z = zSql;
153100153183
pParse->sLastToken.n = n;
153101153184
sqlite3Parser(pEngine, tokenType, pParse->sLastToken);
153102153185
lastTokenParsed = tokenType;
153103153186
zSql += n;
153104
- if( pParse->rc!=SQLITE_OK || db->mallocFailed ) break;
153187
+ assert( db->mallocFailed==0 || pParse->rc!=SQLITE_OK || startedWithOom );
153188
+ if( pParse->rc!=SQLITE_OK ) break;
153105153189
}
153106153190
assert( nErr==0 );
153107153191
#ifdef YYTRACKMAXSTACKDEPTH
153108153192
sqlite3_mutex_enter(sqlite3MallocMutex());
153109153193
sqlite3StatusHighwater(SQLITE_STATUS_PARSER_STACK,
@@ -153167,10 +153251,12 @@
153167153251
while( pParse->pZombieTab ){
153168153252
Table *p = pParse->pZombieTab;
153169153253
pParse->pZombieTab = p->pNextZombie;
153170153254
sqlite3DeleteTable(db, p);
153171153255
}
153256
+ db->pParse = pParse->pParentParse;
153257
+ pParse->pParentParse = 0;
153172153258
assert( nErr==0 || pParse->rc!=SQLITE_OK );
153173153259
return nErr;
153174153260
}
153175153261
153176153262
@@ -170805,11 +170891,13 @@
170805170891
170806170892
fts3SegReaderSetEof(pReader);
170807170893
170808170894
/* If iCurrentBlock>=iLeafEndBlock, this is an EOF condition. All leaf
170809170895
** blocks have already been traversed. */
170810
- assert( pReader->iCurrentBlock<=pReader->iLeafEndBlock );
170896
+#ifdef CORRUPT_DB
170897
+ assert( pReader->iCurrentBlock<=pReader->iLeafEndBlock || CORRUPT_DB );
170898
+#endif
170811170899
if( pReader->iCurrentBlock>=pReader->iLeafEndBlock ){
170812170900
return SQLITE_OK;
170813170901
}
170814170902
170815170903
rc = sqlite3Fts3ReadBlock(
@@ -172692,12 +172780,14 @@
172692172780
bIgnoreEmpty = (iLevel!=FTS3_SEGCURSOR_PENDING) && (iNewLevel>iMaxLevel);
172693172781
}
172694172782
if( rc!=SQLITE_OK ) goto finished;
172695172783
172696172784
assert( csr.nSegment>0 );
172697
- assert( iNewLevel>=getAbsoluteLevel(p, iLangid, iIndex, 0) );
172698
- assert( iNewLevel<getAbsoluteLevel(p, iLangid, iIndex,FTS3_SEGDIR_MAXLEVEL) );
172785
+ assert_fts3_nc( iNewLevel>=getAbsoluteLevel(p, iLangid, iIndex, 0) );
172786
+ assert_fts3_nc(
172787
+ iNewLevel<getAbsoluteLevel(p, iLangid, iIndex,FTS3_SEGDIR_MAXLEVEL)
172788
+ );
172699172789
172700172790
memset(&filter, 0, sizeof(Fts3SegFilter));
172701172791
filter.flags = FTS3_SEGMENT_REQUIRE_POS;
172702172792
filter.flags |= (bIgnoreEmpty ? FTS3_SEGMENT_IGNORE_EMPTY : 0);
172703172793
@@ -176712,11 +176802,11 @@
176712176802
UNUSED_PARAMETER(iPhrase);
176713176803
rc = sqlite3Fts3EvalPhrasePoslist(p->pCsr, pExpr, p->iCol, &pList);
176714176804
nTerm = pExpr->pPhrase->nToken;
176715176805
if( pList ){
176716176806
fts3GetDeltaPosition(&pList, &iPos);
176717
- assert( iPos>=0 );
176807
+ assert_fts3_nc( iPos>=0 );
176718176808
}
176719176809
176720176810
for(iTerm=0; iTerm<nTerm; iTerm++){
176721176811
TermOffset *pT = &p->aTerm[p->iTerm++];
176722176812
pT->iOff = nTerm-iTerm-1;
@@ -176822,11 +176912,11 @@
176822176912
176823176913
if( !pTerm ){
176824176914
/* All offsets for this column have been gathered. */
176825176915
rc = SQLITE_DONE;
176826176916
}else{
176827
- assert( iCurrent<=iMinPos );
176917
+ assert_fts3_nc( iCurrent<=iMinPos );
176828176918
if( 0==(0xFE&*pTerm->pList) ){
176829176919
pTerm->pList = 0;
176830176920
}else{
176831176921
fts3GetDeltaPosition(&pTerm->pList, &pTerm->iPos);
176832176922
}
@@ -188622,10 +188712,11 @@
188622188712
if( aOut==0 ){
188623188713
sqlite3_result_error_nomem(context);
188624188714
}else{
188625188715
nOut2 = rbuDeltaApply(aOrig, nOrig, aDelta, nDelta, aOut);
188626188716
if( nOut2!=nOut ){
188717
+ sqlite3_free(aOut);
188627188718
sqlite3_result_error(context, "corrupt fossil delta", -1);
188628188719
}else{
188629188720
sqlite3_result_blob(context, aOut, nOut, sqlite3_free);
188630188721
}
188631188722
}
@@ -199681,11 +199772,11 @@
199681199772
** xSetAuxdata(pFts5, pAux, xDelete)
199682199773
**
199683199774
** Save the pointer passed as the second argument as the extension functions
199684199775
** "auxiliary data". The pointer may then be retrieved by the current or any
199685199776
** future invocation of the same fts5 extension function made as part of
199686
-** of the same MATCH query using the xGetAuxdata() API.
199777
+** the same MATCH query using the xGetAuxdata() API.
199687199778
**
199688199779
** Each extension function is allocated a single auxiliary data slot for
199689199780
** each FTS query (MATCH expression). If the extension function is invoked
199690199781
** more than once for a single FTS query, then all invocations share a
199691199782
** single auxiliary data context.
@@ -199696,11 +199787,11 @@
199696199787
** point.
199697199788
**
199698199789
** The xDelete callback, if one is specified, is also invoked on the
199699199790
** auxiliary data pointer after the FTS5 query has finished.
199700199791
**
199701
-** If an error (e.g. an OOM condition) occurs within this function, an
199792
+** If an error (e.g. an OOM condition) occurs within this function,
199702199793
** the auxiliary data is set to NULL and an error code returned. If the
199703199794
** xDelete parameter was not NULL, it is invoked on the auxiliary data
199704199795
** pointer before returning.
199705199796
**
199706199797
**
@@ -212031,17 +212122,18 @@
212031212122
}
212032212123
212033212124
/* Set up the new page-index array */
212034212125
fts5BufferAppendVarint(&p->rc, &buf, 4);
212035212126
if( pSeg->iLeafPgno==pSeg->iTermLeafPgno
212036
- && pSeg->iEndofDoclist<pData->szLeaf
212037
- ){
212127
+ && pSeg->iEndofDoclist<pData->szLeaf
212128
+ && pSeg->iPgidxOff<=pData->nn
212129
+ ){
212038212130
int nDiff = pData->szLeaf - pSeg->iEndofDoclist;
212039212131
fts5BufferAppendVarint(&p->rc, &buf, buf.n - 1 - nDiff - 4);
212040212132
fts5BufferAppendBlob(&p->rc, &buf,
212041212133
pData->nn - pSeg->iPgidxOff, &pData->p[pSeg->iPgidxOff]
212042
- );
212134
+ );
212043212135
}
212044212136
212045212137
pSeg->pSeg->pgnoFirst = pSeg->iTermLeafPgno;
212046212138
fts5DataDelete(p, FTS5_SEGMENT_ROWID(iId, 1), iLeafRowid);
212047212139
fts5DataWrite(p, iLeafRowid, buf.p, buf.n);
@@ -217074,11 +217166,11 @@
217074217166
int nArg, /* Number of args */
217075217167
sqlite3_value **apUnused /* Function arguments */
217076217168
){
217077217169
assert( nArg==0 );
217078217170
UNUSED_PARAM2(nArg, apUnused);
217079
- sqlite3_result_text(pCtx, "fts5: 2019-02-08 13:17:39 0eca3dd3d38b31c92b49ca2d311128b74584714d9e7de895b1a6286ef959a1dd", -1, SQLITE_TRANSIENT);
217171
+ sqlite3_result_text(pCtx, "fts5: 2019-02-25 14:52:43 9da4fb59b28686630d63a79988b458726332cf06cc0e6e84d7c0a7600f5fcab0", -1, SQLITE_TRANSIENT);
217080217172
}
217081217173
217082217174
/*
217083217175
** Return true if zName is the extension on one of the shadow tables used
217084217176
** by this module.
@@ -221838,12 +221930,12 @@
221838221930
}
221839221931
#endif /* SQLITE_CORE */
221840221932
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
221841221933
221842221934
/************** End of stmt.c ************************************************/
221843
-#if __LINE__!=221843
221935
+#if __LINE__!=221935
221844221936
#undef SQLITE_SOURCE_ID
221845
-#define SQLITE_SOURCE_ID "2019-02-08 13:17:39 0eca3dd3d38b31c92b49ca2d311128b74584714d9e7de895b1a6286ef959alt2"
221937
+#define SQLITE_SOURCE_ID "2019-02-25 14:52:43 9da4fb59b28686630d63a79988b458726332cf06cc0e6e84d7c0a7600f5falt2"
221846221938
#endif
221847221939
/* Return the source-id for this library */
221848221940
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
221849221941
/************************** End of sqlite3.c ******************************/
221850221942
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.27.1. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -1160,13 +1160,13 @@
1160 **
1161 ** See also: [sqlite3_libversion()],
1162 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1163 ** [sqlite_version()] and [sqlite_source_id()].
1164 */
1165 #define SQLITE_VERSION "3.27.1"
1166 #define SQLITE_VERSION_NUMBER 3027001
1167 #define SQLITE_SOURCE_ID "2019-02-08 13:17:39 0eca3dd3d38b31c92b49ca2d311128b74584714d9e7de895b1a6286ef959a1dd"
1168
1169 /*
1170 ** CAPI3REF: Run-Time Library Version Numbers
1171 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1172 **
@@ -3406,11 +3406,11 @@
3406 ** ^Changes made as part of [foreign key actions] are included in the
3407 ** count, but those made as part of REPLACE constraint resolution are
3408 ** not. ^Changes to a view that are intercepted by INSTEAD OF triggers
3409 ** are not counted.
3410 **
3411 ** This the [sqlite3_total_changes(D)] interface only reports the number
3412 ** of rows that changed due to SQL statement run against database
3413 ** connection D. Any changes by other database connections are ignored.
3414 ** To detect changes against a database file from other database
3415 ** connections use the [PRAGMA data_version] command or the
3416 ** [SQLITE_FCNTL_DATA_VERSION] [file control].
@@ -12338,11 +12338,11 @@
12338 ** xSetAuxdata(pFts5, pAux, xDelete)
12339 **
12340 ** Save the pointer passed as the second argument as the extension functions
12341 ** "auxiliary data". The pointer may then be retrieved by the current or any
12342 ** future invocation of the same fts5 extension function made as part of
12343 ** of the same MATCH query using the xGetAuxdata() API.
12344 **
12345 ** Each extension function is allocated a single auxiliary data slot for
12346 ** each FTS query (MATCH expression). If the extension function is invoked
12347 ** more than once for a single FTS query, then all invocations share a
12348 ** single auxiliary data context.
@@ -12353,11 +12353,11 @@
12353 ** point.
12354 **
12355 ** The xDelete callback, if one is specified, is also invoked on the
12356 ** auxiliary data pointer after the FTS5 query has finished.
12357 **
12358 ** If an error (e.g. an OOM condition) occurs within this function, an
12359 ** the auxiliary data is set to NULL and an error code returned. If the
12360 ** xDelete parameter was not NULL, it is invoked on the auxiliary data
12361 ** pointer before returning.
12362 **
12363 **
@@ -14935,61 +14935,60 @@
14935 #define OP_ColumnsUsed 118
14936 #define OP_SeekHit 119 /* synopsis: seekHit=P2 */
14937 #define OP_Sequence 120 /* synopsis: r[P2]=cursor[P1].ctr++ */
14938 #define OP_NewRowid 121 /* synopsis: r[P2]=rowid */
14939 #define OP_Insert 122 /* synopsis: intkey=r[P3] data=r[P2] */
14940 #define OP_InsertInt 123 /* synopsis: intkey=P3 data=r[P2] */
14941 #define OP_Delete 124
14942 #define OP_ResetCount 125
14943 #define OP_SorterCompare 126 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
14944 #define OP_SorterData 127 /* synopsis: r[P2]=data */
14945 #define OP_RowData 128 /* synopsis: r[P2]=data */
14946 #define OP_Rowid 129 /* synopsis: r[P2]=rowid */
14947 #define OP_NullRow 130
14948 #define OP_SeekEnd 131
14949 #define OP_SorterInsert 132 /* synopsis: key=r[P2] */
14950 #define OP_IdxInsert 133 /* synopsis: key=r[P2] */
14951 #define OP_IdxDelete 134 /* synopsis: key=r[P2@P3] */
14952 #define OP_DeferredSeek 135 /* synopsis: Move P3 to P1.rowid if needed */
14953 #define OP_IdxRowid 136 /* synopsis: r[P2]=rowid */
14954 #define OP_Destroy 137
14955 #define OP_Clear 138
14956 #define OP_ResetSorter 139
14957 #define OP_CreateBtree 140 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
14958 #define OP_Real 141 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
14959 #define OP_SqlExec 142
14960 #define OP_ParseSchema 143
14961 #define OP_LoadAnalysis 144
14962 #define OP_DropTable 145
14963 #define OP_DropIndex 146
14964 #define OP_DropTrigger 147
14965 #define OP_IntegrityCk 148
14966 #define OP_RowSetAdd 149 /* synopsis: rowset(P1)=r[P2] */
14967 #define OP_Param 150
14968 #define OP_FkCounter 151 /* synopsis: fkctr[P1]+=P2 */
14969 #define OP_MemMax 152 /* synopsis: r[P1]=max(r[P1],r[P2]) */
14970 #define OP_OffsetLimit 153 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
14971 #define OP_AggInverse 154 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
14972 #define OP_AggStep 155 /* synopsis: accum=r[P3] step(r[P2@P5]) */
14973 #define OP_AggStep1 156 /* synopsis: accum=r[P3] step(r[P2@P5]) */
14974 #define OP_AggValue 157 /* synopsis: r[P3]=value N=P2 */
14975 #define OP_AggFinal 158 /* synopsis: accum=r[P1] N=P2 */
14976 #define OP_Expire 159
14977 #define OP_TableLock 160 /* synopsis: iDb=P1 root=P2 write=P3 */
14978 #define OP_VBegin 161
14979 #define OP_VCreate 162
14980 #define OP_VDestroy 163
14981 #define OP_VOpen 164
14982 #define OP_VColumn 165 /* synopsis: r[P3]=vcolumn(P2) */
14983 #define OP_VRename 166
14984 #define OP_Pagecount 167
14985 #define OP_MaxPgcnt 168
14986 #define OP_Trace 169
14987 #define OP_CursorHint 170
14988 #define OP_Noop 171
14989 #define OP_Explain 172
14990 #define OP_Abortable 173
14991
14992 /* Properties such as "out2" or "jump" that are specified in
14993 ** comments following the "case" for each opcode in the vdbe.c
14994 ** are encoded into bitvectors as follows:
14995 */
@@ -15014,16 +15013,16 @@
15014 /* 88 */ 0x12, 0x20, 0x00, 0x00, 0x26, 0x26, 0x26, 0x26,\
15015 /* 96 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00, 0x12,\
15016 /* 104 */ 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\
15017 /* 112 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15018 /* 120 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15019 /* 128 */ 0x00, 0x10, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00,\
15020 /* 136 */ 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
15021 /* 144 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00,\
15022 /* 152 */ 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15023 /* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\
15024 /* 168 */ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,}
15025
15026 /* The sqlite3P2Values() routine is able to run faster if it knows
15027 ** the value of the largest JUMP opcode. The smaller the maximum
15028 ** JUMP opcode the better, so the mkopcodeh.tcl script that
15029 ** generated this include file strives to group all JUMP opcodes
@@ -16324,10 +16323,11 @@
16324 int (*xCommitCallback)(void*); /* Invoked at every commit. */
16325 void *pRollbackArg; /* Argument to xRollbackCallback() */
16326 void (*xRollbackCallback)(void*); /* Invoked at every commit. */
16327 void *pUpdateArg;
16328 void (*xUpdateCallback)(void*,int, const char*,const char*,sqlite_int64);
 
16329 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
16330 void *pPreUpdateArg; /* First argument to xPreUpdateCallback */
16331 void (*xPreUpdateCallback)( /* Registered using sqlite3_preupdate_hook() */
16332 void*,sqlite3*,int,char const*,char const*,sqlite3_int64,sqlite3_int64
16333 );
@@ -17987,10 +17987,11 @@
17987 TableLock *aTableLock; /* Required table locks for shared-cache mode */
17988 #endif
17989 AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */
17990 Parse *pToplevel; /* Parse structure for main program (or NULL) */
17991 Table *pTriggerTab; /* Table triggers are being coded for */
 
17992 int addrCrTab; /* Address of OP_CreateBtree opcode on CREATE TABLE */
17993 u32 nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */
17994 u32 oldmask; /* Mask of old.* columns referenced */
17995 u32 newmask; /* Mask of new.* columns referenced */
17996 u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */
@@ -19172,11 +19173,11 @@
19172 SQLITE_PRIVATE void sqlite3AlterRenameTable(Parse*, SrcList*, Token*);
19173 SQLITE_PRIVATE void sqlite3AlterRenameColumn(Parse*, SrcList*, Token*, Token*);
19174 SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *, int *);
19175 SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...);
19176 SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*, int);
19177 SQLITE_PRIVATE void sqlite3CodeRhsOfIN(Parse*, Expr*, int, int);
19178 SQLITE_PRIVATE int sqlite3CodeSubselect(Parse*, Expr*);
19179 SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*);
19180 SQLITE_PRIVATE void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p);
19181 SQLITE_PRIVATE int sqlite3MatchSpanName(const char*, const char*, const char*, const char*);
19182 SQLITE_PRIVATE int sqlite3ResolveExprNames(NameContext*, Expr*);
@@ -27119,10 +27120,13 @@
27119 db->mallocFailed = 1;
27120 if( db->nVdbeExec>0 ){
27121 db->u1.isInterrupted = 1;
27122 }
27123 db->lookaside.bDisable++;
 
 
 
27124 }
27125 }
27126
27127 /*
27128 ** This routine reactivates the memory allocator and clears the
@@ -27312,11 +27316,11 @@
27312 ** Set the StrAccum object to an error mode.
27313 */
27314 static void setStrAccumError(StrAccum *p, u8 eError){
27315 assert( eError==SQLITE_NOMEM || eError==SQLITE_TOOBIG );
27316 p->accError = eError;
27317 p->nAlloc = 0;
27318 }
27319
27320 /*
27321 ** Extra argument values from a PrintfArguments object
27322 */
@@ -27342,10 +27346,11 @@
27342 ** SQL from requesting large allocations using the precision or width
27343 ** field of the printf() function.
27344 */
27345 static char *printfTempBuf(sqlite3_str *pAccum, sqlite3_int64 n){
27346 char *z;
 
27347 if( n>pAccum->nAlloc && n>pAccum->mxAlloc ){
27348 setStrAccumError(pAccum, SQLITE_TOOBIG);
27349 return 0;
27350 }
27351 z = sqlite3DbMallocRaw(pAccum->db, n);
@@ -28061,13 +28066,12 @@
28061 testcase(p->accError==SQLITE_TOOBIG);
28062 testcase(p->accError==SQLITE_NOMEM);
28063 return 0;
28064 }
28065 if( p->mxAlloc==0 ){
28066 N = p->nAlloc - p->nChar - 1;
28067 setStrAccumError(p, SQLITE_TOOBIG);
28068 return N;
28069 }else{
28070 char *zOld = isMalloced(p) ? p->zText : 0;
28071 i64 szNew = p->nChar;
28072 szNew += N + 1;
28073 if( szNew+p->nChar<=p->mxAlloc ){
@@ -28135,11 +28139,11 @@
28135 */
28136 SQLITE_API void sqlite3_str_append(sqlite3_str *p, const char *z, int N){
28137 assert( z!=0 || N==0 );
28138 assert( p->zText!=0 || p->nChar==0 || p->accError );
28139 assert( N>=0 );
28140 assert( p->accError==0 || p->nAlloc==0 );
28141 if( p->nChar+N >= p->nAlloc ){
28142 enlargeAndAppend(p,z,N);
28143 }else if( N ){
28144 assert( p->zText );
28145 p->nChar += N;
@@ -32137,61 +32141,60 @@
32137 /* 118 */ "ColumnsUsed" OpHelp(""),
32138 /* 119 */ "SeekHit" OpHelp("seekHit=P2"),
32139 /* 120 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
32140 /* 121 */ "NewRowid" OpHelp("r[P2]=rowid"),
32141 /* 122 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
32142 /* 123 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"),
32143 /* 124 */ "Delete" OpHelp(""),
32144 /* 125 */ "ResetCount" OpHelp(""),
32145 /* 126 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
32146 /* 127 */ "SorterData" OpHelp("r[P2]=data"),
32147 /* 128 */ "RowData" OpHelp("r[P2]=data"),
32148 /* 129 */ "Rowid" OpHelp("r[P2]=rowid"),
32149 /* 130 */ "NullRow" OpHelp(""),
32150 /* 131 */ "SeekEnd" OpHelp(""),
32151 /* 132 */ "SorterInsert" OpHelp("key=r[P2]"),
32152 /* 133 */ "IdxInsert" OpHelp("key=r[P2]"),
32153 /* 134 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
32154 /* 135 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
32155 /* 136 */ "IdxRowid" OpHelp("r[P2]=rowid"),
32156 /* 137 */ "Destroy" OpHelp(""),
32157 /* 138 */ "Clear" OpHelp(""),
32158 /* 139 */ "ResetSorter" OpHelp(""),
32159 /* 140 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
32160 /* 141 */ "Real" OpHelp("r[P2]=P4"),
32161 /* 142 */ "SqlExec" OpHelp(""),
32162 /* 143 */ "ParseSchema" OpHelp(""),
32163 /* 144 */ "LoadAnalysis" OpHelp(""),
32164 /* 145 */ "DropTable" OpHelp(""),
32165 /* 146 */ "DropIndex" OpHelp(""),
32166 /* 147 */ "DropTrigger" OpHelp(""),
32167 /* 148 */ "IntegrityCk" OpHelp(""),
32168 /* 149 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
32169 /* 150 */ "Param" OpHelp(""),
32170 /* 151 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
32171 /* 152 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
32172 /* 153 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
32173 /* 154 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
32174 /* 155 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
32175 /* 156 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"),
32176 /* 157 */ "AggValue" OpHelp("r[P3]=value N=P2"),
32177 /* 158 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
32178 /* 159 */ "Expire" OpHelp(""),
32179 /* 160 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
32180 /* 161 */ "VBegin" OpHelp(""),
32181 /* 162 */ "VCreate" OpHelp(""),
32182 /* 163 */ "VDestroy" OpHelp(""),
32183 /* 164 */ "VOpen" OpHelp(""),
32184 /* 165 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
32185 /* 166 */ "VRename" OpHelp(""),
32186 /* 167 */ "Pagecount" OpHelp(""),
32187 /* 168 */ "MaxPgcnt" OpHelp(""),
32188 /* 169 */ "Trace" OpHelp(""),
32189 /* 170 */ "CursorHint" OpHelp(""),
32190 /* 171 */ "Noop" OpHelp(""),
32191 /* 172 */ "Explain" OpHelp(""),
32192 /* 173 */ "Abortable" OpHelp(""),
32193 };
32194 return azName[i];
32195 }
32196 #endif
32197
@@ -40217,10 +40220,13 @@
40217 static sqlite3_vfs aVfs[] = {
40218 #if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)
40219 UNIXVFS("unix", autolockIoFinder ),
40220 #elif OS_VXWORKS
40221 UNIXVFS("unix", vxworksIoFinder ),
 
 
 
40222 #else
40223 UNIXVFS("unix", posixIoFinder ),
40224 #endif
40225 UNIXVFS("unix-none", nolockIoFinder ),
40226 UNIXVFS("unix-dotfile", dotlockIoFinder ),
@@ -58162,11 +58168,11 @@
58162 ** Release a lock obtained by an earlier successful call to
58163 ** sqlite3PagerSnapshotCheck().
58164 */
58165 SQLITE_PRIVATE void sqlite3PagerSnapshotUnlock(Pager *pPager){
58166 assert( pPager->pWal );
58167 return sqlite3WalSnapshotUnlock(pPager->pWal);
58168 }
58169
58170 #endif /* SQLITE_ENABLE_SNAPSHOT */
58171 #endif /* !SQLITE_OMIT_WAL */
58172
@@ -62338,11 +62344,11 @@
62338 u8 max1bytePayload; /* min(maxLocal,127) */
62339 u8 nOverflow; /* Number of overflow cell bodies in aCell[] */
62340 u16 maxLocal; /* Copy of BtShared.maxLocal or BtShared.maxLeaf */
62341 u16 minLocal; /* Copy of BtShared.minLocal or BtShared.minLeaf */
62342 u16 cellOffset; /* Index in aData of first cell pointer */
62343 u16 nFree; /* Number of free bytes on the page */
62344 u16 nCell; /* Number of cells on this page, local and ovfl */
62345 u16 maskPage; /* Mask for page offset */
62346 u16 aiOvfl[4]; /* Insert the i-th overflow cell before the aiOvfl-th
62347 ** non-overflow cell */
62348 u8 *apOvfl[4]; /* Pointers to the body of overflow cells */
@@ -64492,12 +64498,12 @@
64492 ** offsets to each pointer in the cell-pointer array than it is to
64493 ** reconstruct the entire page. */
64494 if( (int)data[hdr+7]<=nMaxFrag ){
64495 int iFree = get2byte(&data[hdr+1]);
64496
64497 /* If the initial freeblock offset were out of bounds, that would
64498 ** have been detected by btreeInitPage() when it was computing the
64499 ** number of free bytes on the page. */
64500 assert( iFree<=usableSize-4 );
64501 if( iFree ){
64502 int iFree2 = get2byte(&data[iFree]);
64503 if( iFree2>usableSize-4 ) return SQLITE_CORRUPT_PAGE(pPage);
@@ -64565,10 +64571,11 @@
64565 memcpy(&data[cbrk], &src[pc], size);
64566 }
64567 data[hdr+7] = 0;
64568
64569 defragment_out:
 
64570 if( data[hdr+7]+cbrk-iCellFirst!=pPage->nFree ){
64571 return SQLITE_CORRUPT_PAGE(pPage);
64572 }
64573 assert( cbrk>=iCellFirst );
64574 put2byte(&data[hdr+5], cbrk);
@@ -64592,54 +64599,61 @@
64592 ** Slots on the free list that are between 1 and 3 bytes larger than nByte
64593 ** will be ignored if adding the extra space to the fragmentation count
64594 ** causes the fragmentation count to exceed 60.
64595 */
64596 static u8 *pageFindSlot(MemPage *pPg, int nByte, int *pRc){
64597 const int hdr = pPg->hdrOffset;
64598 u8 * const aData = pPg->aData;
64599 int iAddr = hdr + 1;
64600 int pc = get2byte(&aData[iAddr]);
64601 int x;
64602 int usableSize = pPg->pBt->usableSize;
64603 int size; /* Size of the free slot */
64604
64605 assert( pc>0 );
64606 while( pc<=usableSize-4 ){
64607 /* EVIDENCE-OF: R-22710-53328 The third and fourth bytes of each
64608 ** freeblock form a big-endian integer which is the size of the freeblock
64609 ** in bytes, including the 4-byte header. */
64610 size = get2byte(&aData[pc+2]);
64611 if( (x = size - nByte)>=0 ){
64612 testcase( x==4 );
64613 testcase( x==3 );
64614 if( size+pc > usableSize ){
64615 *pRc = SQLITE_CORRUPT_PAGE(pPg);
64616 return 0;
64617 }else if( x<4 ){
64618 /* EVIDENCE-OF: R-11498-58022 In a well-formed b-tree page, the total
64619 ** number of bytes in fragments may not exceed 60. */
64620 if( aData[hdr+7]>57 ) return 0;
64621
64622 /* Remove the slot from the free-list. Update the number of
64623 ** fragmented bytes within the page. */
64624 memcpy(&aData[iAddr], &aData[pc], 2);
64625 aData[hdr+7] += (u8)x;
 
 
 
 
64626 }else{
64627 /* The slot remains on the free-list. Reduce its size to account
64628 ** for the portion used by the new allocation. */
64629 put2byte(&aData[pc+2], x);
64630 }
64631 return &aData[pc + x];
64632 }
64633 iAddr = pc;
64634 pc = get2byte(&aData[pc]);
64635 if( pc<iAddr+size ) break;
 
 
 
 
 
 
64636 }
64637 if( pc ){
 
64638 *pRc = SQLITE_CORRUPT_PAGE(pPg);
64639 }
64640
64641 return 0;
64642 }
64643
64644 /*
64645 ** Allocate nByte bytes of space from within the B-Tree page passed
@@ -64685,13 +64699,13 @@
64685 }else{
64686 return SQLITE_CORRUPT_PAGE(pPage);
64687 }
64688 }
64689
64690 /* If there is enough space between gap and top for one more cell pointer
64691 ** array entry offset, and if the freelist is not empty, then search the
64692 ** freelist looking for a free slot big enough to satisfy the request.
64693 */
64694 testcase( gap+2==top );
64695 testcase( gap+1==top );
64696 testcase( gap==top );
64697 if( (data[hdr+2] || data[hdr+1]) && gap+2<=top ){
@@ -64709,19 +64723,20 @@
64709 ** to see if defragmentation is necessary.
64710 */
64711 testcase( gap+2+nByte==top );
64712 if( gap+2+nByte>top ){
64713 assert( pPage->nCell>0 || CORRUPT_DB );
 
64714 rc = defragmentPage(pPage, MIN(4, pPage->nFree - (2+nByte)));
64715 if( rc ) return rc;
64716 top = get2byteNotZero(&data[hdr+5]);
64717 assert( gap+2+nByte<=top );
64718 }
64719
64720
64721 /* Allocate memory from the gap in between the cell pointer array
64722 ** and the cell content area. The btreeInitPage() call has already
64723 ** validated the freelist. Given that the freelist is valid, there
64724 ** is no way that the allocation can extend off the end of the page.
64725 ** The assert() below verifies the previous sentence.
64726 */
64727 top -= nByte;
@@ -64736,11 +64751,11 @@
64736 ** The first byte of the new free block is pPage->aData[iStart]
64737 ** and the size of the block is iSize bytes.
64738 **
64739 ** Adjacent freeblocks are coalesced.
64740 **
64741 ** Note that even though the freeblock list was checked by btreeInitPage(),
64742 ** that routine will not detect overlap between cells or freeblocks. Nor
64743 ** does it detect cells or freeblocks that encrouch into the reserved bytes
64744 ** at the end of the page. So do additional corruption checks inside this
64745 ** routine and return SQLITE_CORRUPT if any problems are found.
64746 */
@@ -64898,25 +64913,18 @@
64898 pPage->max1bytePayload = pBt->max1bytePayload;
64899 return SQLITE_OK;
64900 }
64901
64902 /*
64903 ** Initialize the auxiliary information for a disk block.
64904 **
64905 ** Return SQLITE_OK on success. If we see that the page does
64906 ** not contain a well-formed database page, then return
64907 ** SQLITE_CORRUPT. Note that a return of SQLITE_OK does not
64908 ** guarantee that the page is well-formed. It only shows that
64909 ** we failed to detect any corruption.
64910 */
64911 static int btreeInitPage(MemPage *pPage){
64912 int pc; /* Address of a freeblock within pPage->aData[] */
64913 u8 hdr; /* Offset to beginning of page header */
64914 u8 *data; /* Equal to pPage->aData */
64915 BtShared *pBt; /* The main btree structure */
64916 int usableSize; /* Amount of usable space on each page */
64917 u16 cellOffset; /* Offset from start of page to first cell pointer */
64918 int nFree; /* Number of unused bytes on the page */
64919 int top; /* First byte of the cell content area */
64920 int iCellFirst; /* First allowable cell or freeblock offset */
64921 int iCellLast; /* Last possible cell or freeblock offset */
64922
@@ -64924,75 +64932,22 @@
64924 assert( pPage->pBt->db!=0 );
64925 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
64926 assert( pPage->pgno==sqlite3PagerPagenumber(pPage->pDbPage) );
64927 assert( pPage == sqlite3PagerGetExtra(pPage->pDbPage) );
64928 assert( pPage->aData == sqlite3PagerGetData(pPage->pDbPage) );
64929 assert( pPage->isInit==0 );
 
64930
64931 pBt = pPage->pBt;
64932 hdr = pPage->hdrOffset;
64933 data = pPage->aData;
64934 /* EVIDENCE-OF: R-28594-02890 The one-byte flag at offset 0 indicating
64935 ** the b-tree page type. */
64936 if( decodeFlags(pPage, data[hdr]) ){
64937 return SQLITE_CORRUPT_PAGE(pPage);
64938 }
64939 assert( pBt->pageSize>=512 && pBt->pageSize<=65536 );
64940 pPage->maskPage = (u16)(pBt->pageSize - 1);
64941 pPage->nOverflow = 0;
64942 usableSize = pBt->usableSize;
64943 pPage->cellOffset = cellOffset = hdr + 8 + pPage->childPtrSize;
64944 pPage->aDataEnd = &data[usableSize];
64945 pPage->aCellIdx = &data[cellOffset];
64946 pPage->aDataOfst = &data[pPage->childPtrSize];
64947 /* EVIDENCE-OF: R-58015-48175 The two-byte integer at offset 5 designates
64948 ** the start of the cell content area. A zero value for this integer is
64949 ** interpreted as 65536. */
64950 top = get2byteNotZero(&data[hdr+5]);
64951 /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the
64952 ** number of cells on the page. */
64953 pPage->nCell = get2byte(&data[hdr+3]);
64954 if( pPage->nCell>MX_CELL(pBt) ){
64955 /* To many cells for a single page. The page must be corrupt */
64956 return SQLITE_CORRUPT_PAGE(pPage);
64957 }
64958 testcase( pPage->nCell==MX_CELL(pBt) );
64959 /* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only
64960 ** possible for a root page of a table that contains no rows) then the
64961 ** offset to the cell content area will equal the page size minus the
64962 ** bytes of reserved space. */
64963 assert( pPage->nCell>0 || top==usableSize || CORRUPT_DB );
64964
64965 /* A malformed database page might cause us to read past the end
64966 ** of page when parsing a cell.
64967 **
64968 ** The following block of code checks early to see if a cell extends
64969 ** past the end of a page boundary and causes SQLITE_CORRUPT to be
64970 ** returned if it does.
64971 */
64972 iCellFirst = cellOffset + 2*pPage->nCell;
64973 iCellLast = usableSize - 4;
64974 if( pBt->db->flags & SQLITE_CellSizeCk ){
64975 int i; /* Index into the cell pointer array */
64976 int sz; /* Size of a cell */
64977
64978 if( !pPage->leaf ) iCellLast--;
64979 for(i=0; i<pPage->nCell; i++){
64980 pc = get2byteAligned(&data[cellOffset+i*2]);
64981 testcase( pc==iCellFirst );
64982 testcase( pc==iCellLast );
64983 if( pc<iCellFirst || pc>iCellLast ){
64984 return SQLITE_CORRUPT_PAGE(pPage);
64985 }
64986 sz = pPage->xCellSize(pPage, &data[pc]);
64987 testcase( pc+sz==usableSize );
64988 if( pc+sz>usableSize ){
64989 return SQLITE_CORRUPT_PAGE(pPage);
64990 }
64991 }
64992 if( !pPage->leaf ) iCellLast++;
64993 }
64994
64995 /* Compute the total free space on the page
64996 ** EVIDENCE-OF: R-23588-34450 The two-byte integer at offset 1 gives the
64997 ** start of the first freeblock on the page, or is zero if there are no
64998 ** freeblocks. */
@@ -65036,11 +64991,104 @@
65036 */
65037 if( nFree>usableSize ){
65038 return SQLITE_CORRUPT_PAGE(pPage);
65039 }
65040 pPage->nFree = (u16)(nFree - iCellFirst);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65041 pPage->isInit = 1;
 
 
 
65042 return SQLITE_OK;
65043 }
65044
65045 /*
65046 ** Set up a raw page so that it looks like a database page holding
@@ -65179,38 +65227,38 @@
65179 assert( pCur==0 || bReadOnly==pCur->curPagerFlags );
65180 assert( pCur==0 || pCur->iPage>0 );
65181
65182 if( pgno>btreePagecount(pBt) ){
65183 rc = SQLITE_CORRUPT_BKPT;
65184 goto getAndInitPage_error;
65185 }
65186 rc = sqlite3PagerGet(pBt->pPager, pgno, (DbPage**)&pDbPage, bReadOnly);
65187 if( rc ){
65188 goto getAndInitPage_error;
65189 }
65190 *ppPage = (MemPage*)sqlite3PagerGetExtra(pDbPage);
65191 if( (*ppPage)->isInit==0 ){
65192 btreePageFromDbPage(pDbPage, pgno, pBt);
65193 rc = btreeInitPage(*ppPage);
65194 if( rc!=SQLITE_OK ){
65195 releasePage(*ppPage);
65196 goto getAndInitPage_error;
65197 }
65198 }
65199 assert( (*ppPage)->pgno==pgno );
65200 assert( (*ppPage)->aData==sqlite3PagerGetData(pDbPage) );
65201
65202 /* If obtaining a child page for a cursor, we must verify that the page is
65203 ** compatible with the root page. */
65204 if( pCur && ((*ppPage)->nCell<1 || (*ppPage)->intKey!=pCur->curIntKey) ){
65205 rc = SQLITE_CORRUPT_PGNO(pgno);
65206 releasePage(*ppPage);
65207 goto getAndInitPage_error;
65208 }
65209 return SQLITE_OK;
65210
65211 getAndInitPage_error:
 
 
65212 if( pCur ){
65213 pCur->iPage--;
65214 pCur->pPage = pCur->apPage[pCur->iPage];
65215 }
65216 testcase( pgno==0 );
@@ -69618,10 +69666,11 @@
69618 if( *pRC ) return;
69619 assert( idx>=0 && idx<pPage->nCell );
69620 assert( CORRUPT_DB || sz==cellSize(pPage, idx) );
69621 assert( sqlite3PagerIswriteable(pPage->pDbPage) );
69622 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
 
69623 data = pPage->aData;
69624 ptr = &pPage->aCellIdx[2*idx];
69625 pc = get2byte(ptr);
69626 hdr = pPage->hdrOffset;
69627 testcase( pc==get2byte(&data[hdr+5]) );
@@ -69688,10 +69737,11 @@
69688 ** malformed cell from a leaf page to an interior page, if the cell size
69689 ** wanted to be less than 4 but got rounded up to 4 on the leaf, then size
69690 ** might be less than 8 (leaf-size + pointer) on the interior node. Hence
69691 ** the term after the || in the following assert(). */
69692 assert( sz==pPage->xCellSize(pPage, pCell) || (sz==8 && iChild>0) );
 
69693 if( pPage->nOverflow || sz+2>pPage->nFree ){
69694 if( pTemp ){
69695 memcpy(pTemp, pCell, sz);
69696 pCell = pTemp;
69697 }
@@ -69745,11 +69795,11 @@
69745 memmove(pIns+2, pIns, 2*(pPage->nCell - i));
69746 put2byte(pIns, idx);
69747 pPage->nCell++;
69748 /* increment the cell count */
69749 if( (++data[pPage->hdrOffset+4])==0 ) data[pPage->hdrOffset+3]++;
69750 assert( get2byte(&data[pPage->hdrOffset+3])==pPage->nCell );
69751 #ifndef SQLITE_OMIT_AUTOVACUUM
69752 if( pPage->pBt->autoVacuum ){
69753 /* The cell may contain a pointer to an overflow page. If so, write
69754 ** the entry for the overflow page into the pointer map.
69755 */
@@ -69832,12 +69882,17 @@
69832 **
69833 ** For a table-btree, the concept is similar, except only apEnd[0]..apEnd[2]
69834 ** are used and they point to the leaf pages only, and the ixNx value are:
69835 **
69836 ** ixNx[0] = Number of cells in Child-1.
69837 ** ixNx[1] = Number of cells in Child-1 and Child-2 + 1 for 1st divider.
69838 ** ixNx[2] = Number of cells in Child-1 and Child-2 + both divider cells
 
 
 
 
 
69839 */
69840 typedef struct CellArray CellArray;
69841 struct CellArray {
69842 int nCell; /* Number of cells in apCell[] */
69843 MemPage *pRef; /* Reference page */
@@ -70239,12 +70294,14 @@
70239 Pgno pgnoNew; /* Page number of pNew */
70240
70241 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
70242 assert( sqlite3PagerIswriteable(pParent->pDbPage) );
70243 assert( pPage->nOverflow==1 );
70244
70245 if( pPage->nCell==0 ) return SQLITE_CORRUPT_BKPT; /* dbfuzz001.test */
 
 
70246
70247 /* Allocate a new page. This page will become the right-sibling of
70248 ** pPage. Make the parent page writable, so that the new divider cell
70249 ** may be inserted. If both these operations are successful, proceed.
70250 */
@@ -70410,10 +70467,11 @@
70410 ** fairly obscure circumstances, even though it is a copy of initialized
70411 ** page pFrom.
70412 */
70413 pTo->isInit = 0;
70414 rc = btreeInitPage(pTo);
 
70415 if( rc!=SQLITE_OK ){
70416 *pRC = rc;
70417 return;
70418 }
70419
@@ -70518,10 +70576,11 @@
70518 assert( pParent->nOverflow==0 || pParent->aiOvfl[0]==iParentIdx );
70519
70520 if( !aOvflSpace ){
70521 return SQLITE_NOMEM_BKPT;
70522 }
 
70523
70524 /* Find the sibling pages to balance. Also locate the cells in pParent
70525 ** that divide the siblings. An attempt is made to find NN siblings on
70526 ** either side of pPage. More siblings are taken from one side, however,
70527 ** if there are fewer than NN siblings on the other side. If pParent
@@ -70556,10 +70615,17 @@
70556 while( 1 ){
70557 rc = getAndInitPage(pBt, pgno, &apOld[i], 0, 0);
70558 if( rc ){
70559 memset(apOld, 0, (i+1)*sizeof(MemPage*));
70560 goto balance_cleanup;
 
 
 
 
 
 
 
70561 }
70562 nMaxCells += 1+apOld[i]->nCell+apOld[i]->nOverflow;
70563 if( (i--)==0 ) break;
70564
70565 if( pParent->nOverflow && i+nxDiv==pParent->aiOvfl[0] ){
@@ -70751,15 +70817,19 @@
70751 usableSpace = pBt->usableSize - 12 + leafCorrection;
70752 for(i=k=0; i<nOld; i++, k++){
70753 MemPage *p = apOld[i];
70754 b.apEnd[k] = p->aDataEnd;
70755 b.ixNx[k] = cntOld[i];
 
 
 
70756 if( !leafData ){
70757 k++;
70758 b.apEnd[k] = pParent->aDataEnd;
70759 b.ixNx[k] = cntOld[i]+1;
70760 }
 
70761 szNew[i] = usableSpace - p->nFree;
70762 for(j=0; j<p->nOverflow; j++){
70763 szNew[i] += 2 + p->xCellSize(p, p->apOvfl[j]);
70764 }
70765 cntNew[i] = cntOld[i];
@@ -70981,22 +71051,21 @@
70981 ** populated, not here.
70982 */
70983 if( ISAUTOVACUUM ){
70984 MemPage *pOld;
70985 MemPage *pNew = pOld = apNew[0];
70986 u8 *aOld = pNew->aData;
70987 int cntOldNext = pNew->nCell + pNew->nOverflow;
70988 int usableSize = pBt->usableSize;
70989 int iNew = 0;
70990 int iOld = 0;
70991
70992 for(i=0; i<b.nCell; i++){
70993 u8 *pCell = b.apCell[i];
70994 if( i==cntOldNext ){
70995 pOld = (++iOld)<nNew ? apNew[iOld] : apOld[iOld];
 
 
70996 cntOldNext += pOld->nCell + pOld->nOverflow + !leafData;
70997 aOld = pOld->aData;
70998 }
70999 if( i==cntNew[iNew] ){
71000 pNew = apNew[++iNew];
71001 if( !leafData ) continue;
71002 }
@@ -71007,11 +71076,11 @@
71007 ** if sibling page iOld had the same page number as pNew, and if
71008 ** pCell really was a part of sibling page iOld (not a divider or
71009 ** overflow cell), we can skip updating the pointer map entries. */
71010 if( iOld>=nNew
71011 || pNew->pgno!=aPgno[iOld]
71012 || !SQLITE_WITHIN(pCell,aOld,&aOld[usableSize])
71013 ){
71014 if( !leafCorrection ){
71015 ptrmapPut(pBt, get4byte(pCell), PTRMAP_BTREE, pNew->pgno, &rc);
71016 }
71017 if( cachedCellSize(&b,i)>pNew->minLocal ){
@@ -71257,11 +71326,11 @@
71257 releasePage(pChild);
71258 return rc;
71259 }
71260 assert( sqlite3PagerIswriteable(pChild->pDbPage) );
71261 assert( sqlite3PagerIswriteable(pRoot->pDbPage) );
71262 assert( pChild->nCell==pRoot->nCell );
71263
71264 TRACE(("BALANCE: copy root %d into %d\n", pRoot->pgno, pChild->pgno));
71265
71266 /* Copy the overflow cells from pRoot to pChild */
71267 memcpy(pChild->aiOvfl, pRoot->aiOvfl,
@@ -71299,10 +71368,11 @@
71299
71300 do {
71301 int iPage = pCur->iPage;
71302 MemPage *pPage = pCur->pPage;
71303
 
71304 if( iPage==0 ){
71305 if( pPage->nOverflow ){
71306 /* The root page of the b-tree is overfull. In this case call the
71307 ** balance_deeper() function to create a new child for the root-page
71308 ** and copy the current contents of the root-page to it. The
@@ -71327,10 +71397,13 @@
71327 }else{
71328 MemPage * const pParent = pCur->apPage[iPage-1];
71329 int const iIdx = pCur->aiIdx[iPage-1];
71330
71331 rc = sqlite3PagerWrite(pParent->pDbPage);
 
 
 
71332 if( rc==SQLITE_OK ){
71333 #ifndef SQLITE_OMIT_QUICKBALANCE
71334 if( pPage->intKeyLeaf
71335 && pPage->nOverflow==1
71336 && pPage->aiOvfl[0]==pPage->nCell
@@ -71673,10 +71746,14 @@
71673 assert( pCur->eState==CURSOR_VALID || (pCur->eState==CURSOR_INVALID && loc) );
71674
71675 pPage = pCur->pPage;
71676 assert( pPage->intKey || pX->nKey>=0 );
71677 assert( pPage->leaf || !pPage->intKey );
 
 
 
 
71678
71679 TRACE(("INSERT: table=%d nkey=%lld ndata=%d page=%d %s\n",
71680 pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno,
71681 loc==0 ? "overwrite" : "new entry"));
71682 assert( pPage->isInit );
@@ -71823,10 +71900,11 @@
71823
71824 iCellDepth = pCur->iPage;
71825 iCellIdx = pCur->ix;
71826 pPage = pCur->pPage;
71827 pCell = findCell(pPage, iCellIdx);
 
71828
71829 /* If the bPreserve flag is set to true, then the cursor position must
71830 ** be preserved following this delete operation. If the current delete
71831 ** will cause a b-tree rebalance, then this is done by saving the cursor
71832 ** key and leaving the cursor in CURSOR_REQUIRESEEK state before
@@ -71893,10 +71971,14 @@
71893 MemPage *pLeaf = pCur->pPage;
71894 int nCell;
71895 Pgno n;
71896 unsigned char *pTmp;
71897
 
 
 
 
71898 if( iCellDepth<pCur->iPage-1 ){
71899 n = pCur->apPage[iCellDepth+1]->pgno;
71900 }else{
71901 n = pCur->pPage->pgno;
71902 }
@@ -72784,10 +72866,15 @@
72784 assert( rc==SQLITE_CORRUPT ); /* The only possible error from InitPage */
72785 checkAppendMsg(pCheck,
72786 "btreeInitPage() returns error code %d", rc);
72787 goto end_of_check;
72788 }
 
 
 
 
 
72789 data = pPage->aData;
72790 hdr = pPage->hdrOffset;
72791
72792 /* Set up for cell analysis */
72793 pCheck->zPfx = "On tree page %d cell %d: ";
@@ -72916,23 +73003,23 @@
72916 ** freeblocks on the page.
72917 */
72918 i = get2byte(&data[hdr+1]);
72919 while( i>0 ){
72920 int size, j;
72921 assert( (u32)i<=usableSize-4 ); /* Enforced by btreeInitPage() */
72922 size = get2byte(&data[i+2]);
72923 assert( (u32)(i+size)<=usableSize ); /* Enforced by btreeInitPage() */
72924 btreeHeapInsert(heap, (((u32)i)<<16)|(i+size-1));
72925 /* EVIDENCE-OF: R-58208-19414 The first 2 bytes of a freeblock are a
72926 ** big-endian integer which is the offset in the b-tree page of the next
72927 ** freeblock in the chain, or zero if the freeblock is the last on the
72928 ** chain. */
72929 j = get2byte(&data[i]);
72930 /* EVIDENCE-OF: R-06866-39125 Freeblocks are always connected in order of
72931 ** increasing offset. */
72932 assert( j==0 || j>i+size ); /* Enforced by btreeInitPage() */
72933 assert( (u32)j<=usableSize-4 ); /* Enforced by btreeInitPage() */
72934 i = j;
72935 }
72936 /* Analyze the min-heap looking for overlap between cells and/or
72937 ** freeblocks, and counting the number of untracked bytes in nFrag.
72938 **
@@ -74393,12 +74480,11 @@
74393 return rc;
74394 #endif
74395 }
74396
74397 /*
74398 ** Make sure pMem->z points to a writable allocation of at least
74399 ** min(n,32) bytes.
74400 **
74401 ** If the bPreserve argument is true, then copy of the content of
74402 ** pMem->z into the new allocation. pMem must be either a string or
74403 ** blob if bPreserve is true. If bPreserve is false, any prior content
74404 ** in pMem->z is discarded.
@@ -74413,11 +74499,10 @@
74413 assert( bPreserve==0 || pMem->flags&(MEM_Blob|MEM_Str) );
74414 testcase( bPreserve && pMem->z==0 );
74415
74416 assert( pMem->szMalloc==0
74417 || pMem->szMalloc==sqlite3DbMallocSize(pMem->db, pMem->zMalloc) );
74418 if( n<32 ) n = 32;
74419 if( pMem->szMalloc>0 && bPreserve && pMem->z==pMem->zMalloc ){
74420 pMem->z = pMem->zMalloc = sqlite3DbReallocOrFree(pMem->db, pMem->z, n);
74421 bPreserve = 0;
74422 }else{
74423 if( pMem->szMalloc>0 ) sqlite3DbFreeNN(pMem->db, pMem->zMalloc);
@@ -75262,11 +75347,10 @@
75262 flags = (enc==0?MEM_Blob:MEM_Str);
75263 if( nByte<0 ){
75264 assert( enc!=0 );
75265 if( enc==SQLITE_UTF8 ){
75266 nByte = 0x7fffffff & (int)strlen(z);
75267 if( nByte>iLimit ) nByte = iLimit+1;
75268 }else{
75269 for(nByte=0; nByte<=iLimit && (z[nByte] | z[nByte+1]); nByte+=2){}
75270 }
75271 flags |= MEM_Term;
75272 }
@@ -75274,33 +75358,34 @@
75274 /* The following block sets the new values of Mem.z and Mem.xDel. It
75275 ** also sets a flag in local variable "flags" to indicate the memory
75276 ** management (one of MEM_Dyn or MEM_Static).
75277 */
75278 if( xDel==SQLITE_TRANSIENT ){
75279 int nAlloc = nByte;
75280 if( flags&MEM_Term ){
75281 nAlloc += (enc==SQLITE_UTF8?1:2);
75282 }
75283 if( nByte>iLimit ){
75284 return SQLITE_TOOBIG;
75285 }
75286 testcase( nAlloc==0 );
75287 testcase( nAlloc==31 );
75288 testcase( nAlloc==32 );
75289 if( sqlite3VdbeMemClearAndResize(pMem, MAX(nAlloc,32)) ){
75290 return SQLITE_NOMEM_BKPT;
75291 }
75292 memcpy(pMem->z, z, nAlloc);
75293 }else if( xDel==SQLITE_DYNAMIC ){
75294 sqlite3VdbeMemRelease(pMem);
75295 pMem->zMalloc = pMem->z = (char *)z;
75296 pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->zMalloc);
75297 }else{
75298 sqlite3VdbeMemRelease(pMem);
75299 pMem->z = (char *)z;
75300 pMem->xDel = xDel;
75301 flags |= ((xDel==SQLITE_STATIC)?MEM_Static:MEM_Dyn);
 
 
 
 
 
75302 }
75303
75304 pMem->n = nByte;
75305 pMem->flags = flags;
75306 pMem->enc = (enc==0 ? SQLITE_UTF8 : enc);
@@ -82206,14 +82291,14 @@
82206 **
82207 ** If the result is not a simple column reference (if it is an expression
82208 ** or a constant) then useTypes 2, 3, and 4 return NULL.
82209 */
82210 static const void *columnName(
82211 sqlite3_stmt *pStmt,
82212 int N,
82213 const void *(*xFunc)(Mem*),
82214 int useType
82215 ){
82216 const void *ret;
82217 Vdbe *p;
82218 int n;
82219 sqlite3 *db;
@@ -82230,12 +82315,16 @@
82230 n = sqlite3_column_count(pStmt);
82231 if( N<n && N>=0 ){
82232 N += useType*n;
82233 sqlite3_mutex_enter(db->mutex);
82234 assert( db->mallocFailed==0 );
82235 ret = xFunc(&p->aColName[N]);
82236 /* A malloc may have failed inside of the xFunc() call. If this
 
 
 
 
82237 ** is the case, clear the mallocFailed flag and return NULL.
82238 */
82239 if( db->mallocFailed ){
82240 sqlite3OomClear(db);
82241 ret = 0;
@@ -82248,17 +82337,15 @@
82248 /*
82249 ** Return the name of the Nth column of the result set returned by SQL
82250 ** statement pStmt.
82251 */
82252 SQLITE_API const char *sqlite3_column_name(sqlite3_stmt *pStmt, int N){
82253 return columnName(
82254 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_NAME);
82255 }
82256 #ifndef SQLITE_OMIT_UTF16
82257 SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt *pStmt, int N){
82258 return columnName(
82259 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_NAME);
82260 }
82261 #endif
82262
82263 /*
82264 ** Constraint: If you have ENABLE_COLUMN_METADATA then you must
@@ -82273,17 +82360,15 @@
82273 /*
82274 ** Return the column declaration type (if applicable) of the 'i'th column
82275 ** of the result set of SQL statement pStmt.
82276 */
82277 SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt *pStmt, int N){
82278 return columnName(
82279 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_DECLTYPE);
82280 }
82281 #ifndef SQLITE_OMIT_UTF16
82282 SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt *pStmt, int N){
82283 return columnName(
82284 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DECLTYPE);
82285 }
82286 #endif /* SQLITE_OMIT_UTF16 */
82287 #endif /* SQLITE_OMIT_DECLTYPE */
82288
82289 #ifdef SQLITE_ENABLE_COLUMN_METADATA
@@ -82291,49 +82376,43 @@
82291 ** Return the name of the database from which a result column derives.
82292 ** NULL is returned if the result column is an expression or constant or
82293 ** anything else which is not an unambiguous reference to a database column.
82294 */
82295 SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt *pStmt, int N){
82296 return columnName(
82297 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_DATABASE);
82298 }
82299 #ifndef SQLITE_OMIT_UTF16
82300 SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt *pStmt, int N){
82301 return columnName(
82302 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DATABASE);
82303 }
82304 #endif /* SQLITE_OMIT_UTF16 */
82305
82306 /*
82307 ** Return the name of the table from which a result column derives.
82308 ** NULL is returned if the result column is an expression or constant or
82309 ** anything else which is not an unambiguous reference to a database column.
82310 */
82311 SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt *pStmt, int N){
82312 return columnName(
82313 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_TABLE);
82314 }
82315 #ifndef SQLITE_OMIT_UTF16
82316 SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt *pStmt, int N){
82317 return columnName(
82318 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_TABLE);
82319 }
82320 #endif /* SQLITE_OMIT_UTF16 */
82321
82322 /*
82323 ** Return the name of the table column from which a result column derives.
82324 ** NULL is returned if the result column is an expression or constant or
82325 ** anything else which is not an unambiguous reference to a database column.
82326 */
82327 SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt *pStmt, int N){
82328 return columnName(
82329 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_COLUMN);
82330 }
82331 #ifndef SQLITE_OMIT_UTF16
82332 SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt *pStmt, int N){
82333 return columnName(
82334 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_COLUMN);
82335 }
82336 #endif /* SQLITE_OMIT_UTF16 */
82337 #endif /* SQLITE_ENABLE_COLUMN_METADATA */
82338
82339
@@ -83975,10 +84054,19 @@
83975 #endif
83976 /*** INSERT STACK UNION HERE ***/
83977
83978 assert( p->magic==VDBE_MAGIC_RUN ); /* sqlite3_step() verifies this */
83979 sqlite3VdbeEnter(p);
 
 
 
 
 
 
 
 
 
83980 if( p->rc==SQLITE_NOMEM ){
83981 /* This happens if a malloc() inside a call to sqlite3_column_text() or
83982 ** sqlite3_column_text16() failed. */
83983 goto no_mem;
83984 }
@@ -83988,19 +84076,10 @@
83988 assert( p->explain==0 );
83989 p->pResultSet = 0;
83990 db->busyHandler.nBusy = 0;
83991 if( db->u1.isInterrupted ) goto abort_due_to_interrupt;
83992 sqlite3VdbeIOTraceSql(p);
83993 #ifndef SQLITE_OMIT_PROGRESS_CALLBACK
83994 if( db->xProgress ){
83995 u32 iPrior = p->aCounter[SQLITE_STMTSTATUS_VM_STEP];
83996 assert( 0 < db->nProgressOps );
83997 nProgressLimit = db->nProgressOps - (iPrior % db->nProgressOps);
83998 }else{
83999 nProgressLimit = 0xffffffff;
84000 }
84001 #endif
84002 #ifdef SQLITE_DEBUG
84003 sqlite3BeginBenignMalloc();
84004 if( p->pc==0
84005 && (p->db->flags & (SQLITE_VdbeListing|SQLITE_VdbeEQP|SQLITE_VdbeTrace))!=0
84006 ){
@@ -84172,14 +84251,15 @@
84172 ** of VDBE ops have been executed (either since this invocation of
84173 ** sqlite3VdbeExec() or since last time the progress callback was called).
84174 ** If the progress callback returns non-zero, exit the virtual machine with
84175 ** a return code SQLITE_ABORT.
84176 */
84177 if( nVmStep>=nProgressLimit && db->xProgress!=0 ){
84178 assert( db->nProgressOps!=0 );
84179 nProgressLimit = nVmStep + db->nProgressOps - (nVmStep%db->nProgressOps);
84180 if( db->xProgress(db->pProgressArg) ){
 
84181 rc = SQLITE_INTERRUPT;
84182 goto abort_due_to_error;
84183 }
84184 }
84185 #endif
@@ -84454,10 +84534,11 @@
84454
84455 #ifndef SQLITE_OMIT_UTF16
84456 if( encoding!=SQLITE_UTF8 ){
84457 rc = sqlite3VdbeMemSetStr(pOut, pOp->p4.z, -1, SQLITE_UTF8, SQLITE_STATIC);
84458 assert( rc==SQLITE_OK || rc==SQLITE_TOOBIG );
 
84459 if( SQLITE_OK!=sqlite3VdbeChangeEncoding(pOut, encoding) ) goto no_mem;
84460 assert( pOut->szMalloc>0 && pOut->zMalloc==pOut->z );
84461 assert( VdbeMemDynamic(pOut)==0 );
84462 pOut->szMalloc = 0;
84463 pOut->flags |= MEM_Static;
@@ -84466,11 +84547,10 @@
84466 }
84467 pOp->p4type = P4_DYNAMIC;
84468 pOp->p4.z = pOut->z;
84469 pOp->p1 = pOut->n;
84470 }
84471 testcase( rc==SQLITE_TOOBIG );
84472 #endif
84473 if( pOp->p1>db->aLimit[SQLITE_LIMIT_LENGTH] ){
84474 goto too_big;
84475 }
84476 assert( rc==SQLITE_OK );
@@ -84721,22 +84801,10 @@
84721 int i;
84722 assert( p->nResColumn==pOp->p2 );
84723 assert( pOp->p1>0 );
84724 assert( pOp->p1+pOp->p2<=(p->nMem+1 - p->nCursor)+1 );
84725
84726 #ifndef SQLITE_OMIT_PROGRESS_CALLBACK
84727 /* Run the progress counter just before returning.
84728 */
84729 if( db->xProgress!=0
84730 && nVmStep>=nProgressLimit
84731 && db->xProgress(db->pProgressArg)!=0
84732 ){
84733 rc = SQLITE_INTERRUPT;
84734 goto abort_due_to_error;
84735 }
84736 #endif
84737
84738 /* If this statement has violated immediate foreign key constraints, do
84739 ** not return the number of rows modified. And do not RELEASE the statement
84740 ** transaction. It needs to be rolled back. */
84741 if( SQLITE_OK!=(rc = sqlite3VdbeCheckFk(p, 0)) ){
84742 assert( db->flags&SQLITE_CountRows );
@@ -85959,19 +86027,19 @@
85959 offset64 = aOffset[i];
85960 zHdr = zData + pC->iHdrOffset;
85961 zEndHdr = zData + aOffset[0];
85962 testcase( zHdr>=zEndHdr );
85963 do{
85964 if( (t = zHdr[0])<0x80 ){
85965 zHdr++;
85966 offset64 += sqlite3VdbeOneByteSerialTypeLen(t);
85967 }else{
85968 zHdr += sqlite3GetVarint32(zHdr, &t);
 
85969 offset64 += sqlite3VdbeSerialTypeLen(t);
85970 }
85971 pC->aType[i++] = t;
85972 aOffset[i] = (u32)(offset64 & 0xffffffff);
85973 }while( i<=p2 && zHdr<zEndHdr );
85974
85975 /* The record is corrupt if any of the following are true:
85976 ** (1) the bytes of the header extend past the declared header size
85977 ** (2) the entire header was used but not all data was used
@@ -87933,18 +88001,11 @@
87933 ** cause any problems.)
87934 **
87935 ** This instruction only works on tables. The equivalent instruction
87936 ** for indices is OP_IdxInsert.
87937 */
87938 /* Opcode: InsertInt P1 P2 P3 P4 P5
87939 ** Synopsis: intkey=P3 data=r[P2]
87940 **
87941 ** This works exactly like OP_Insert except that the key is the
87942 ** integer value P3, not the value of the integer stored in register P3.
87943 */
87944 case OP_Insert:
87945 case OP_InsertInt: {
87946 Mem *pData; /* MEM cell holding data for the record to be inserted */
87947 Mem *pKey; /* MEM cell holding key for the record */
87948 VdbeCursor *pC; /* Cursor to table into which insert is written */
87949 int seekResult; /* Result of prior seek or 0 if no USESEEKRESULT flag */
87950 const char *zDb; /* database name - used by the update hook */
@@ -87961,20 +88022,15 @@
87961 assert( (pOp->p5 & OPFLAG_ISNOOP) || pC->isTable );
87962 assert( pOp->p4type==P4_TABLE || pOp->p4type>=P4_STATIC );
87963 REGISTER_TRACE(pOp->p2, pData);
87964 sqlite3VdbeIncrWriteCounter(p, pC);
87965
87966 if( pOp->opcode==OP_Insert ){
87967 pKey = &aMem[pOp->p3];
87968 assert( pKey->flags & MEM_Int );
87969 assert( memIsValid(pKey) );
87970 REGISTER_TRACE(pOp->p3, pKey);
87971 x.nKey = pKey->u.i;
87972 }else{
87973 assert( pOp->opcode==OP_InsertInt );
87974 x.nKey = pOp->p3;
87975 }
87976
87977 if( pOp->p4type==P4_TABLE && HAS_UPDATE_HOOK(db) ){
87978 assert( pC->iDb>=0 );
87979 zDb = db->aDb[pC->iDb].zDbSName;
87980 pTab = pOp->p4.pTab;
@@ -89538,12 +89594,11 @@
89538 aMem[i].flags |= MEM_Undefined; /* Cause a fault if this reg is reused */
89539 }
89540 }
89541 #endif
89542 pOp = &aOp[-1];
89543
89544 break;
89545 }
89546
89547 /* Opcode: Param P1 P2 * * *
89548 **
89549 ** This opcode is only ever present in sub-programs called via the
@@ -90948,11 +91003,20 @@
90948
90949 /* This is the only way out of this procedure. We have to
90950 ** release the mutexes on btrees that were acquired at the
90951 ** top. */
90952 vdbe_return:
90953 testcase( nVmStep>0 );
 
 
 
 
 
 
 
 
 
90954 p->aCounter[SQLITE_STMTSTATUS_VM_STEP] += (int)nVmStep;
90955 sqlite3VdbeLeave(p);
90956 assert( rc!=SQLITE_OK || nExtraDelete==0
90957 || sqlite3_strlike("DELETE%",p->zSql,0)!=0
90958 );
@@ -96129,10 +96193,42 @@
96129 }
96130 }
96131 return 0;
96132 }
96133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96134 /*
96135 ** pOrderBy is an ORDER BY or GROUP BY clause in SELECT statement pSelect.
96136 ** The Name context of the SELECT statement is pNC. zType is either
96137 ** "ORDER" or "GROUP" depending on which type of clause pOrderBy is.
96138 **
@@ -96195,23 +96291,14 @@
96195 if( sqlite3ResolveExprNames(pNC, pE) ){
96196 return 1;
96197 }
96198 for(j=0; j<pSelect->pEList->nExpr; j++){
96199 if( sqlite3ExprCompare(0, pE, pSelect->pEList->a[j].pExpr, -1)==0 ){
96200 #ifndef SQLITE_OMIT_WINDOWFUNC
96201 if( ExprHasProperty(pE, EP_WinFunc) ){
96202 /* Since this window function is being changed into a reference
96203 ** to the same window function the result set, remove the instance
96204 ** of this window function from the Select.pWin list. */
96205 Window **pp;
96206 for(pp=&pSelect->pWin; *pp; pp=&(*pp)->pNextWin){
96207 if( *pp==pE->y.pWin ){
96208 *pp = (*pp)->pNextWin;
96209 }
96210 }
96211 }
96212 #endif
96213 pItem->u.x.iOrderByCol = j+1;
96214 }
96215 }
96216 }
96217 return sqlite3ResolveOrderGroupBy(pParse, pSelect, pOrderBy, zType);
@@ -96419,10 +96506,11 @@
96419 return WRC_Abort;
96420 }
96421 }
96422 }
96423
 
96424 if( IN_RENAME_OBJECT ){
96425 Window *pWin;
96426 for(pWin=p->pWinDefn; pWin; pWin=pWin->pNextWin){
96427 if( sqlite3ResolveExprListNames(&sNC, pWin->pOrderBy)
96428 || sqlite3ResolveExprListNames(&sNC, pWin->pPartition)
@@ -96429,10 +96517,11 @@
96429 ){
96430 return WRC_Abort;
96431 }
96432 }
96433 }
 
96434
96435 /* If this is part of a compound SELECT, check that it has the right
96436 ** number of expressions in the select list. */
96437 if( p->pNext && p->pEList->nExpr!=p->pNext->pEList->nExpr ){
96438 sqlite3SelectWrongNumTermsError(pParse, p->pNext);
@@ -99179,18 +99268,15 @@
99179 u32 savedNQueryLoop = pParse->nQueryLoop;
99180 int rMayHaveNull = 0;
99181 eType = IN_INDEX_EPH;
99182 if( inFlags & IN_INDEX_LOOP ){
99183 pParse->nQueryLoop = 0;
99184 if( pX->pLeft->iColumn<0 && !ExprHasProperty(pX, EP_xIsSelect) ){
99185 eType = IN_INDEX_ROWID;
99186 }
99187 }else if( prRhsHasNull ){
99188 *prRhsHasNull = rMayHaveNull = ++pParse->nMem;
99189 }
99190 assert( pX->op==TK_IN );
99191 sqlite3CodeRhsOfIN(pParse, pX, iTab, eType==IN_INDEX_ROWID);
99192 if( rMayHaveNull ){
99193 sqlite3SetHasNullFlag(v, iTab, rMayHaveNull);
99194 }
99195 pParse->nQueryLoop = savedNQueryLoop;
99196 }
@@ -99287,16 +99373,10 @@
99287 ** constructed ephermeral table is returned. The first time the ephemeral
99288 ** table is computed, the cursor number is also stored in pExpr->iTable,
99289 ** however the cursor number returned might not be the same, as it might
99290 ** have been duplicated using OP_OpenDup.
99291 **
99292 ** If parameter isRowid is non-zero, then LHS of the IN operator is guaranteed
99293 ** to be a non-null integer. In this case, the ephemeral table can be an
99294 ** table B-Tree that keyed by only integers. The more general cases uses
99295 ** an index B-Tree which can have arbitrary keys, but is slower to both
99296 ** read and write.
99297 **
99298 ** If the LHS expression ("x" in the examples) is a column value, or
99299 ** the SELECT statement returns a column value, then the affinity of that
99300 ** column is used to build the index keys. If both 'x' and the
99301 ** SELECT... statement are columns, then numeric affinity is used
99302 ** if either column has NUMERIC or INTEGER affinity. If neither
@@ -99304,12 +99384,11 @@
99304 ** is used.
99305 */
99306 SQLITE_PRIVATE void sqlite3CodeRhsOfIN(
99307 Parse *pParse, /* Parsing context */
99308 Expr *pExpr, /* The IN operator */
99309 int iTab, /* Use this cursor number */
99310 int isRowid /* If true, LHS is a rowid */
99311 ){
99312 int addrOnce = 0; /* Address of the OP_Once instruction at top */
99313 int addr; /* Address of OP_OpenEphemeral instruction */
99314 Expr *pLeft; /* the LHS of the IN operator */
99315 KeyInfo *pKeyInfo = 0; /* Key information */
@@ -99358,26 +99437,24 @@
99358 }
99359
99360 /* Check to see if this is a vector IN operator */
99361 pLeft = pExpr->pLeft;
99362 nVal = sqlite3ExprVectorSize(pLeft);
99363 assert( !isRowid || nVal==1 );
99364
99365 /* Construct the ephemeral table that will contain the content of
99366 ** RHS of the IN operator.
99367 */
99368 pExpr->iTable = iTab;
99369 addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral,
99370 pExpr->iTable, (isRowid?0:nVal));
99371 #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
99372 if( ExprHasProperty(pExpr, EP_xIsSelect) ){
99373 VdbeComment((v, "Result of SELECT %u", pExpr->x.pSelect->selId));
99374 }else{
99375 VdbeComment((v, "RHS of IN operator"));
99376 }
99377 #endif
99378 pKeyInfo = isRowid ? 0 : sqlite3KeyInfoAlloc(pParse->db, nVal, 1);
99379
99380 if( ExprHasProperty(pExpr, EP_xIsSelect) ){
99381 /* Case 1: expr IN (SELECT ...)
99382 **
99383 ** Generate code to write the results of the select into the temporary
@@ -99387,11 +99464,10 @@
99387 ExprList *pEList = pSelect->pEList;
99388
99389 ExplainQueryPlan((pParse, 1, "%sLIST SUBQUERY %d",
99390 addrOnce?"":"CORRELATED ", pSelect->selId
99391 ));
99392 assert( !isRowid );
99393 /* If the LHS and RHS of the IN operator do not match, that
99394 ** error will have been caught long before we reach this point. */
99395 if( ALWAYS(pEList->nExpr==nVal) ){
99396 SelectDest dest;
99397 int i;
@@ -99440,14 +99516,12 @@
99440 }
99441
99442 /* Loop through each expression in <exprlist>. */
99443 r1 = sqlite3GetTempReg(pParse);
99444 r2 = sqlite3GetTempReg(pParse);
99445 if( isRowid ) sqlite3VdbeAddOp4(v, OP_Blob, 0, r2, 0, "", P4_STATIC);
99446 for(i=pList->nExpr, pItem=pList->a; i>0; i--, pItem++){
99447 Expr *pE2 = pItem->pExpr;
99448 int iValToIns;
99449
99450 /* If the expression is not constant then we will need to
99451 ** disable the test that was generated above that makes sure
99452 ** this code only executes once. Because for a non-constant
99453 ** expression we need to rerun this code each time.
@@ -99456,24 +99530,13 @@
99456 sqlite3VdbeChangeToNoop(v, addrOnce);
99457 addrOnce = 0;
99458 }
99459
99460 /* Evaluate the expression and insert it into the temp table */
99461 if( isRowid && sqlite3ExprIsInteger(pE2, &iValToIns) ){
99462 sqlite3VdbeAddOp3(v, OP_InsertInt, iTab, r2, iValToIns);
99463 }else{
99464 r3 = sqlite3ExprCodeTarget(pParse, pE2, r1);
99465 if( isRowid ){
99466 sqlite3VdbeAddOp2(v, OP_MustBeInt, r3,
99467 sqlite3VdbeCurrentAddr(v)+2);
99468 VdbeCoverage(v);
99469 sqlite3VdbeAddOp3(v, OP_Insert, iTab, r2, r3);
99470 }else{
99471 sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1);
99472 sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r2, r3, 1);
99473 }
99474 }
99475 }
99476 sqlite3ReleaseTempReg(pParse, r1);
99477 sqlite3ReleaseTempReg(pParse, r2);
99478 }
99479 if( pKeyInfo ){
@@ -106852,11 +106915,15 @@
106852 assert( pParse->nested<10 ); /* Nesting should only be of limited depth */
106853 va_start(ap, zFormat);
106854 zSql = sqlite3VMPrintf(db, zFormat, ap);
106855 va_end(ap);
106856 if( zSql==0 ){
106857 return; /* A malloc must have failed */
 
 
 
 
106858 }
106859 pParse->nested++;
106860 memcpy(saveBuf, PARSE_TAIL(pParse), PARSE_TAIL_SZ);
106861 memset(PARSE_TAIL(pParse), 0, PARSE_TAIL_SZ);
106862 sqlite3RunParser(pParse, zSql, &zErrMsg);
@@ -108413,10 +108480,11 @@
108413 if( db->mallocFailed || pParse->nErr ) return;
108414 pPk = sqlite3PrimaryKeyIndex(pTab);
108415 pTab->iPKey = -1;
108416 }else{
108417 pPk = sqlite3PrimaryKeyIndex(pTab);
 
108418
108419 /*
108420 ** Remove all redundant columns from the PRIMARY KEY. For example, change
108421 ** "PRIMARY KEY(a,b,a,b,c,b,c,d)" into just "PRIMARY KEY(a,b,c,d)". Later
108422 ** code assumes the PRIMARY KEY contains no repeated columns.
@@ -108582,10 +108650,15 @@
108582 }
108583 p->tnum = db->init.newTnum;
108584 if( p->tnum==1 ) p->tabFlags |= TF_Readonly;
108585 }
108586
 
 
 
 
 
108587 /* Special processing for WITHOUT ROWID Tables */
108588 if( tabOpts & TF_WithoutRowid ){
108589 if( (p->tabFlags & TF_Autoincrement) ){
108590 sqlite3ErrorMsg(pParse,
108591 "AUTOINCREMENT not allowed on WITHOUT ROWID tables");
@@ -117855,11 +117928,13 @@
117855 }
117856 }
117857 sqlite3VdbeAddOp3(v, OP_MakeRecord, regIdx, pIdx->nColumn, aRegIdx[ix]);
117858 VdbeComment((v, "for %s", pIdx->zName));
117859 #ifdef SQLITE_ENABLE_NULL_TRIM
117860 if( pIdx->idxType==2 ) sqlite3SetMakeRecordP5(v, pIdx->pTable);
 
 
117861 #endif
117862
117863 /* In an UPDATE operation, if this index is the PRIMARY KEY index
117864 ** of a WITHOUT ROWID table and there has been no change the
117865 ** primary key, then no collision is possible. The collision detection
@@ -118105,14 +118180,17 @@
118105 assert( pParse->nested==0 );
118106 pik_flags |= OPFLAG_NCHANGE;
118107 pik_flags |= (update_flags & OPFLAG_SAVEPOSITION);
118108 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
118109 if( update_flags==0 ){
118110 sqlite3VdbeAddOp4(v, OP_InsertInt,
118111 iIdxCur+i, aRegIdx[i], 0, (char*)pTab, P4_TABLE
 
 
118112 );
118113 sqlite3VdbeChangeP5(v, OPFLAG_ISNOOP);
 
118114 }
118115 #endif
118116 }
118117 sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i],
118118 aRegIdx[i]+1,
@@ -118533,11 +118611,11 @@
118533 addr2 = sqlite3VdbeAddOp3(v, OP_NotExists, iDest, 0, regRowid);
118534 VdbeCoverage(v);
118535 sqlite3RowidConstraint(pParse, onError, pDest);
118536 sqlite3VdbeJumpHere(v, addr2);
118537 autoIncStep(pParse, regAutoinc, regRowid);
118538 }else if( pDest->pIndex==0 ){
118539 addr1 = sqlite3VdbeAddOp2(v, OP_NewRowid, iDest, regRowid);
118540 }else{
118541 addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);
118542 assert( (pDest->tabFlags & TF_Autoincrement)==0 );
118543 }
@@ -118596,11 +118674,11 @@
118596 if( i==pSrcIdx->nColumn ){
118597 idxInsFlags = OPFLAG_USESEEKRESULT;
118598 sqlite3VdbeAddOp1(v, OP_SeekEnd, iDest);
118599 }
118600 }
118601 if( !HasRowid(pSrc) && pDestIdx->idxType==2 ){
118602 idxInsFlags |= OPFLAG_NCHANGE;
118603 }
118604 sqlite3VdbeAddOp2(v, OP_IdxInsert, iDest, regData);
118605 sqlite3VdbeChangeP5(v, idxInsFlags|OPFLAG_APPEND);
118606 sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1+1); VdbeCoverage(v);
@@ -136425,11 +136503,10 @@
136425 pIn += i;
136426 for(i=iEq;i<pLoop->nLTerm; i++){
136427 if( pLoop->aLTerm[i]->pExpr==pX ){
136428 int iOut = iReg + i - iEq;
136429 if( eType==IN_INDEX_ROWID ){
136430 testcase( nEq>1 ); /* Happens with a UNIQUE index on ROWID */
136431 pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iOut);
136432 }else{
136433 int iCol = aiMap ? aiMap[iMap++] : 0;
136434 pIn->addrInTop = sqlite3VdbeAddOp3(v,OP_Column,iTab, iCol, iOut);
136435 }
@@ -137187,10 +137264,13 @@
137187 if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg);
137188 addrNxt = pLevel->addrNxt;
137189 sqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg);
137190 VdbeCoverage(v);
137191 pLevel->op = OP_Noop;
 
 
 
137192 }else if( (pLoop->wsFlags & WHERE_IPK)!=0
137193 && (pLoop->wsFlags & WHERE_COLUMN_RANGE)!=0
137194 ){
137195 /* Case 3: We have an inequality comparison against the ROWID field.
137196 */
@@ -153009,10 +153089,11 @@
153009 int n = 0; /* Length of the next token token */
153010 int tokenType; /* type of the next token */
153011 int lastTokenParsed = -1; /* type of the previous token */
153012 sqlite3 *db = pParse->db; /* The database connection */
153013 int mxSqlLen; /* Max length of an SQL string */
 
153014 #ifdef sqlite3Parser_ENGINEALWAYSONSTACK
153015 yyParser sEngine; /* Space to hold the Lemon-generated Parser object */
153016 #endif
153017
153018 assert( zSql!=0 );
@@ -153043,10 +153124,12 @@
153043 #endif
153044 assert( pParse->pNewTable==0 );
153045 assert( pParse->pNewTrigger==0 );
153046 assert( pParse->nVar==0 );
153047 assert( pParse->pVList==0 );
 
 
153048 while( 1 ){
153049 n = sqlite3GetToken((u8*)zSql, &tokenType);
153050 mxSqlLen -= n;
153051 if( mxSqlLen<0 ){
153052 pParse->rc = SQLITE_TOOBIG;
@@ -153099,11 +153182,12 @@
153099 pParse->sLastToken.z = zSql;
153100 pParse->sLastToken.n = n;
153101 sqlite3Parser(pEngine, tokenType, pParse->sLastToken);
153102 lastTokenParsed = tokenType;
153103 zSql += n;
153104 if( pParse->rc!=SQLITE_OK || db->mallocFailed ) break;
 
153105 }
153106 assert( nErr==0 );
153107 #ifdef YYTRACKMAXSTACKDEPTH
153108 sqlite3_mutex_enter(sqlite3MallocMutex());
153109 sqlite3StatusHighwater(SQLITE_STATUS_PARSER_STACK,
@@ -153167,10 +153251,12 @@
153167 while( pParse->pZombieTab ){
153168 Table *p = pParse->pZombieTab;
153169 pParse->pZombieTab = p->pNextZombie;
153170 sqlite3DeleteTable(db, p);
153171 }
 
 
153172 assert( nErr==0 || pParse->rc!=SQLITE_OK );
153173 return nErr;
153174 }
153175
153176
@@ -170805,11 +170891,13 @@
170805
170806 fts3SegReaderSetEof(pReader);
170807
170808 /* If iCurrentBlock>=iLeafEndBlock, this is an EOF condition. All leaf
170809 ** blocks have already been traversed. */
170810 assert( pReader->iCurrentBlock<=pReader->iLeafEndBlock );
 
 
170811 if( pReader->iCurrentBlock>=pReader->iLeafEndBlock ){
170812 return SQLITE_OK;
170813 }
170814
170815 rc = sqlite3Fts3ReadBlock(
@@ -172692,12 +172780,14 @@
172692 bIgnoreEmpty = (iLevel!=FTS3_SEGCURSOR_PENDING) && (iNewLevel>iMaxLevel);
172693 }
172694 if( rc!=SQLITE_OK ) goto finished;
172695
172696 assert( csr.nSegment>0 );
172697 assert( iNewLevel>=getAbsoluteLevel(p, iLangid, iIndex, 0) );
172698 assert( iNewLevel<getAbsoluteLevel(p, iLangid, iIndex,FTS3_SEGDIR_MAXLEVEL) );
 
 
172699
172700 memset(&filter, 0, sizeof(Fts3SegFilter));
172701 filter.flags = FTS3_SEGMENT_REQUIRE_POS;
172702 filter.flags |= (bIgnoreEmpty ? FTS3_SEGMENT_IGNORE_EMPTY : 0);
172703
@@ -176712,11 +176802,11 @@
176712 UNUSED_PARAMETER(iPhrase);
176713 rc = sqlite3Fts3EvalPhrasePoslist(p->pCsr, pExpr, p->iCol, &pList);
176714 nTerm = pExpr->pPhrase->nToken;
176715 if( pList ){
176716 fts3GetDeltaPosition(&pList, &iPos);
176717 assert( iPos>=0 );
176718 }
176719
176720 for(iTerm=0; iTerm<nTerm; iTerm++){
176721 TermOffset *pT = &p->aTerm[p->iTerm++];
176722 pT->iOff = nTerm-iTerm-1;
@@ -176822,11 +176912,11 @@
176822
176823 if( !pTerm ){
176824 /* All offsets for this column have been gathered. */
176825 rc = SQLITE_DONE;
176826 }else{
176827 assert( iCurrent<=iMinPos );
176828 if( 0==(0xFE&*pTerm->pList) ){
176829 pTerm->pList = 0;
176830 }else{
176831 fts3GetDeltaPosition(&pTerm->pList, &pTerm->iPos);
176832 }
@@ -188622,10 +188712,11 @@
188622 if( aOut==0 ){
188623 sqlite3_result_error_nomem(context);
188624 }else{
188625 nOut2 = rbuDeltaApply(aOrig, nOrig, aDelta, nDelta, aOut);
188626 if( nOut2!=nOut ){
 
188627 sqlite3_result_error(context, "corrupt fossil delta", -1);
188628 }else{
188629 sqlite3_result_blob(context, aOut, nOut, sqlite3_free);
188630 }
188631 }
@@ -199681,11 +199772,11 @@
199681 ** xSetAuxdata(pFts5, pAux, xDelete)
199682 **
199683 ** Save the pointer passed as the second argument as the extension functions
199684 ** "auxiliary data". The pointer may then be retrieved by the current or any
199685 ** future invocation of the same fts5 extension function made as part of
199686 ** of the same MATCH query using the xGetAuxdata() API.
199687 **
199688 ** Each extension function is allocated a single auxiliary data slot for
199689 ** each FTS query (MATCH expression). If the extension function is invoked
199690 ** more than once for a single FTS query, then all invocations share a
199691 ** single auxiliary data context.
@@ -199696,11 +199787,11 @@
199696 ** point.
199697 **
199698 ** The xDelete callback, if one is specified, is also invoked on the
199699 ** auxiliary data pointer after the FTS5 query has finished.
199700 **
199701 ** If an error (e.g. an OOM condition) occurs within this function, an
199702 ** the auxiliary data is set to NULL and an error code returned. If the
199703 ** xDelete parameter was not NULL, it is invoked on the auxiliary data
199704 ** pointer before returning.
199705 **
199706 **
@@ -212031,17 +212122,18 @@
212031 }
212032
212033 /* Set up the new page-index array */
212034 fts5BufferAppendVarint(&p->rc, &buf, 4);
212035 if( pSeg->iLeafPgno==pSeg->iTermLeafPgno
212036 && pSeg->iEndofDoclist<pData->szLeaf
212037 ){
 
212038 int nDiff = pData->szLeaf - pSeg->iEndofDoclist;
212039 fts5BufferAppendVarint(&p->rc, &buf, buf.n - 1 - nDiff - 4);
212040 fts5BufferAppendBlob(&p->rc, &buf,
212041 pData->nn - pSeg->iPgidxOff, &pData->p[pSeg->iPgidxOff]
212042 );
212043 }
212044
212045 pSeg->pSeg->pgnoFirst = pSeg->iTermLeafPgno;
212046 fts5DataDelete(p, FTS5_SEGMENT_ROWID(iId, 1), iLeafRowid);
212047 fts5DataWrite(p, iLeafRowid, buf.p, buf.n);
@@ -217074,11 +217166,11 @@
217074 int nArg, /* Number of args */
217075 sqlite3_value **apUnused /* Function arguments */
217076 ){
217077 assert( nArg==0 );
217078 UNUSED_PARAM2(nArg, apUnused);
217079 sqlite3_result_text(pCtx, "fts5: 2019-02-08 13:17:39 0eca3dd3d38b31c92b49ca2d311128b74584714d9e7de895b1a6286ef959a1dd", -1, SQLITE_TRANSIENT);
217080 }
217081
217082 /*
217083 ** Return true if zName is the extension on one of the shadow tables used
217084 ** by this module.
@@ -221838,12 +221930,12 @@
221838 }
221839 #endif /* SQLITE_CORE */
221840 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
221841
221842 /************** End of stmt.c ************************************************/
221843 #if __LINE__!=221843
221844 #undef SQLITE_SOURCE_ID
221845 #define SQLITE_SOURCE_ID "2019-02-08 13:17:39 0eca3dd3d38b31c92b49ca2d311128b74584714d9e7de895b1a6286ef959alt2"
221846 #endif
221847 /* Return the source-id for this library */
221848 SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
221849 /************************** End of sqlite3.c ******************************/
221850
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.28.0. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -1160,13 +1160,13 @@
1160 **
1161 ** See also: [sqlite3_libversion()],
1162 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1163 ** [sqlite_version()] and [sqlite_source_id()].
1164 */
1165 #define SQLITE_VERSION "3.28.0"
1166 #define SQLITE_VERSION_NUMBER 3028000
1167 #define SQLITE_SOURCE_ID "2019-02-25 14:52:43 9da4fb59b28686630d63a79988b458726332cf06cc0e6e84d7c0a7600f5fcab0"
1168
1169 /*
1170 ** CAPI3REF: Run-Time Library Version Numbers
1171 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1172 **
@@ -3406,11 +3406,11 @@
3406 ** ^Changes made as part of [foreign key actions] are included in the
3407 ** count, but those made as part of REPLACE constraint resolution are
3408 ** not. ^Changes to a view that are intercepted by INSTEAD OF triggers
3409 ** are not counted.
3410 **
3411 ** The [sqlite3_total_changes(D)] interface only reports the number
3412 ** of rows that changed due to SQL statement run against database
3413 ** connection D. Any changes by other database connections are ignored.
3414 ** To detect changes against a database file from other database
3415 ** connections use the [PRAGMA data_version] command or the
3416 ** [SQLITE_FCNTL_DATA_VERSION] [file control].
@@ -12338,11 +12338,11 @@
12338 ** xSetAuxdata(pFts5, pAux, xDelete)
12339 **
12340 ** Save the pointer passed as the second argument as the extension functions
12341 ** "auxiliary data". The pointer may then be retrieved by the current or any
12342 ** future invocation of the same fts5 extension function made as part of
12343 ** the same MATCH query using the xGetAuxdata() API.
12344 **
12345 ** Each extension function is allocated a single auxiliary data slot for
12346 ** each FTS query (MATCH expression). If the extension function is invoked
12347 ** more than once for a single FTS query, then all invocations share a
12348 ** single auxiliary data context.
@@ -12353,11 +12353,11 @@
12353 ** point.
12354 **
12355 ** The xDelete callback, if one is specified, is also invoked on the
12356 ** auxiliary data pointer after the FTS5 query has finished.
12357 **
12358 ** If an error (e.g. an OOM condition) occurs within this function,
12359 ** the auxiliary data is set to NULL and an error code returned. If the
12360 ** xDelete parameter was not NULL, it is invoked on the auxiliary data
12361 ** pointer before returning.
12362 **
12363 **
@@ -14935,61 +14935,60 @@
14935 #define OP_ColumnsUsed 118
14936 #define OP_SeekHit 119 /* synopsis: seekHit=P2 */
14937 #define OP_Sequence 120 /* synopsis: r[P2]=cursor[P1].ctr++ */
14938 #define OP_NewRowid 121 /* synopsis: r[P2]=rowid */
14939 #define OP_Insert 122 /* synopsis: intkey=r[P3] data=r[P2] */
14940 #define OP_Delete 123
14941 #define OP_ResetCount 124
14942 #define OP_SorterCompare 125 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
14943 #define OP_SorterData 126 /* synopsis: r[P2]=data */
14944 #define OP_RowData 127 /* synopsis: r[P2]=data */
14945 #define OP_Rowid 128 /* synopsis: r[P2]=rowid */
14946 #define OP_NullRow 129
14947 #define OP_SeekEnd 130
14948 #define OP_SorterInsert 131 /* synopsis: key=r[P2] */
14949 #define OP_IdxInsert 132 /* synopsis: key=r[P2] */
14950 #define OP_IdxDelete 133 /* synopsis: key=r[P2@P3] */
14951 #define OP_DeferredSeek 134 /* synopsis: Move P3 to P1.rowid if needed */
14952 #define OP_IdxRowid 135 /* synopsis: r[P2]=rowid */
14953 #define OP_Destroy 136
14954 #define OP_Clear 137
14955 #define OP_ResetSorter 138
14956 #define OP_CreateBtree 139 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
14957 #define OP_SqlExec 140
14958 #define OP_Real 141 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
14959 #define OP_ParseSchema 142
14960 #define OP_LoadAnalysis 143
14961 #define OP_DropTable 144
14962 #define OP_DropIndex 145
14963 #define OP_DropTrigger 146
14964 #define OP_IntegrityCk 147
14965 #define OP_RowSetAdd 148 /* synopsis: rowset(P1)=r[P2] */
14966 #define OP_Param 149
14967 #define OP_FkCounter 150 /* synopsis: fkctr[P1]+=P2 */
14968 #define OP_MemMax 151 /* synopsis: r[P1]=max(r[P1],r[P2]) */
14969 #define OP_OffsetLimit 152 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
14970 #define OP_AggInverse 153 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
14971 #define OP_AggStep 154 /* synopsis: accum=r[P3] step(r[P2@P5]) */
14972 #define OP_AggStep1 155 /* synopsis: accum=r[P3] step(r[P2@P5]) */
14973 #define OP_AggValue 156 /* synopsis: r[P3]=value N=P2 */
14974 #define OP_AggFinal 157 /* synopsis: accum=r[P1] N=P2 */
14975 #define OP_Expire 158
14976 #define OP_TableLock 159 /* synopsis: iDb=P1 root=P2 write=P3 */
14977 #define OP_VBegin 160
14978 #define OP_VCreate 161
14979 #define OP_VDestroy 162
14980 #define OP_VOpen 163
14981 #define OP_VColumn 164 /* synopsis: r[P3]=vcolumn(P2) */
14982 #define OP_VRename 165
14983 #define OP_Pagecount 166
14984 #define OP_MaxPgcnt 167
14985 #define OP_Trace 168
14986 #define OP_CursorHint 169
14987 #define OP_Noop 170
14988 #define OP_Explain 171
14989 #define OP_Abortable 172
 
14990
14991 /* Properties such as "out2" or "jump" that are specified in
14992 ** comments following the "case" for each opcode in the vdbe.c
14993 ** are encoded into bitvectors as follows:
14994 */
@@ -15014,16 +15013,16 @@
15013 /* 88 */ 0x12, 0x20, 0x00, 0x00, 0x26, 0x26, 0x26, 0x26,\
15014 /* 96 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00, 0x12,\
15015 /* 104 */ 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\
15016 /* 112 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15017 /* 120 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15018 /* 128 */ 0x10, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x10,\
15019 /* 136 */ 0x10, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00,\
15020 /* 144 */ 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00, 0x04,\
15021 /* 152 */ 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15022 /* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10,\
15023 /* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00,}
15024
15025 /* The sqlite3P2Values() routine is able to run faster if it knows
15026 ** the value of the largest JUMP opcode. The smaller the maximum
15027 ** JUMP opcode the better, so the mkopcodeh.tcl script that
15028 ** generated this include file strives to group all JUMP opcodes
@@ -16324,10 +16323,11 @@
16323 int (*xCommitCallback)(void*); /* Invoked at every commit. */
16324 void *pRollbackArg; /* Argument to xRollbackCallback() */
16325 void (*xRollbackCallback)(void*); /* Invoked at every commit. */
16326 void *pUpdateArg;
16327 void (*xUpdateCallback)(void*,int, const char*,const char*,sqlite_int64);
16328 Parse *pParse; /* Current parse */
16329 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
16330 void *pPreUpdateArg; /* First argument to xPreUpdateCallback */
16331 void (*xPreUpdateCallback)( /* Registered using sqlite3_preupdate_hook() */
16332 void*,sqlite3*,int,char const*,char const*,sqlite3_int64,sqlite3_int64
16333 );
@@ -17987,10 +17987,11 @@
17987 TableLock *aTableLock; /* Required table locks for shared-cache mode */
17988 #endif
17989 AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */
17990 Parse *pToplevel; /* Parse structure for main program (or NULL) */
17991 Table *pTriggerTab; /* Table triggers are being coded for */
17992 Parse *pParentParse; /* Parent parser if this parser is nested */
17993 int addrCrTab; /* Address of OP_CreateBtree opcode on CREATE TABLE */
17994 u32 nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */
17995 u32 oldmask; /* Mask of old.* columns referenced */
17996 u32 newmask; /* Mask of new.* columns referenced */
17997 u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */
@@ -19172,11 +19173,11 @@
19173 SQLITE_PRIVATE void sqlite3AlterRenameTable(Parse*, SrcList*, Token*);
19174 SQLITE_PRIVATE void sqlite3AlterRenameColumn(Parse*, SrcList*, Token*, Token*);
19175 SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *, int *);
19176 SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...);
19177 SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*, int);
19178 SQLITE_PRIVATE void sqlite3CodeRhsOfIN(Parse*, Expr*, int);
19179 SQLITE_PRIVATE int sqlite3CodeSubselect(Parse*, Expr*);
19180 SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*);
19181 SQLITE_PRIVATE void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p);
19182 SQLITE_PRIVATE int sqlite3MatchSpanName(const char*, const char*, const char*, const char*);
19183 SQLITE_PRIVATE int sqlite3ResolveExprNames(NameContext*, Expr*);
@@ -27119,10 +27120,13 @@
27120 db->mallocFailed = 1;
27121 if( db->nVdbeExec>0 ){
27122 db->u1.isInterrupted = 1;
27123 }
27124 db->lookaside.bDisable++;
27125 if( db->pParse ){
27126 db->pParse->rc = SQLITE_NOMEM_BKPT;
27127 }
27128 }
27129 }
27130
27131 /*
27132 ** This routine reactivates the memory allocator and clears the
@@ -27312,11 +27316,11 @@
27316 ** Set the StrAccum object to an error mode.
27317 */
27318 static void setStrAccumError(StrAccum *p, u8 eError){
27319 assert( eError==SQLITE_NOMEM || eError==SQLITE_TOOBIG );
27320 p->accError = eError;
27321 if( p->mxAlloc ) sqlite3_str_reset(p);
27322 }
27323
27324 /*
27325 ** Extra argument values from a PrintfArguments object
27326 */
@@ -27342,10 +27346,11 @@
27346 ** SQL from requesting large allocations using the precision or width
27347 ** field of the printf() function.
27348 */
27349 static char *printfTempBuf(sqlite3_str *pAccum, sqlite3_int64 n){
27350 char *z;
27351 if( pAccum->accError ) return 0;
27352 if( n>pAccum->nAlloc && n>pAccum->mxAlloc ){
27353 setStrAccumError(pAccum, SQLITE_TOOBIG);
27354 return 0;
27355 }
27356 z = sqlite3DbMallocRaw(pAccum->db, n);
@@ -28061,13 +28066,12 @@
28066 testcase(p->accError==SQLITE_TOOBIG);
28067 testcase(p->accError==SQLITE_NOMEM);
28068 return 0;
28069 }
28070 if( p->mxAlloc==0 ){
 
28071 setStrAccumError(p, SQLITE_TOOBIG);
28072 return p->nAlloc - p->nChar - 1;
28073 }else{
28074 char *zOld = isMalloced(p) ? p->zText : 0;
28075 i64 szNew = p->nChar;
28076 szNew += N + 1;
28077 if( szNew+p->nChar<=p->mxAlloc ){
@@ -28135,11 +28139,11 @@
28139 */
28140 SQLITE_API void sqlite3_str_append(sqlite3_str *p, const char *z, int N){
28141 assert( z!=0 || N==0 );
28142 assert( p->zText!=0 || p->nChar==0 || p->accError );
28143 assert( N>=0 );
28144 assert( p->accError==0 || p->nAlloc==0 || p->mxAlloc==0 );
28145 if( p->nChar+N >= p->nAlloc ){
28146 enlargeAndAppend(p,z,N);
28147 }else if( N ){
28148 assert( p->zText );
28149 p->nChar += N;
@@ -32137,61 +32141,60 @@
32141 /* 118 */ "ColumnsUsed" OpHelp(""),
32142 /* 119 */ "SeekHit" OpHelp("seekHit=P2"),
32143 /* 120 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
32144 /* 121 */ "NewRowid" OpHelp("r[P2]=rowid"),
32145 /* 122 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
32146 /* 123 */ "Delete" OpHelp(""),
32147 /* 124 */ "ResetCount" OpHelp(""),
32148 /* 125 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
32149 /* 126 */ "SorterData" OpHelp("r[P2]=data"),
32150 /* 127 */ "RowData" OpHelp("r[P2]=data"),
32151 /* 128 */ "Rowid" OpHelp("r[P2]=rowid"),
32152 /* 129 */ "NullRow" OpHelp(""),
32153 /* 130 */ "SeekEnd" OpHelp(""),
32154 /* 131 */ "SorterInsert" OpHelp("key=r[P2]"),
32155 /* 132 */ "IdxInsert" OpHelp("key=r[P2]"),
32156 /* 133 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
32157 /* 134 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
32158 /* 135 */ "IdxRowid" OpHelp("r[P2]=rowid"),
32159 /* 136 */ "Destroy" OpHelp(""),
32160 /* 137 */ "Clear" OpHelp(""),
32161 /* 138 */ "ResetSorter" OpHelp(""),
32162 /* 139 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
32163 /* 140 */ "SqlExec" OpHelp(""),
32164 /* 141 */ "Real" OpHelp("r[P2]=P4"),
32165 /* 142 */ "ParseSchema" OpHelp(""),
32166 /* 143 */ "LoadAnalysis" OpHelp(""),
32167 /* 144 */ "DropTable" OpHelp(""),
32168 /* 145 */ "DropIndex" OpHelp(""),
32169 /* 146 */ "DropTrigger" OpHelp(""),
32170 /* 147 */ "IntegrityCk" OpHelp(""),
32171 /* 148 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
32172 /* 149 */ "Param" OpHelp(""),
32173 /* 150 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
32174 /* 151 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
32175 /* 152 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
32176 /* 153 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
32177 /* 154 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
32178 /* 155 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"),
32179 /* 156 */ "AggValue" OpHelp("r[P3]=value N=P2"),
32180 /* 157 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
32181 /* 158 */ "Expire" OpHelp(""),
32182 /* 159 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
32183 /* 160 */ "VBegin" OpHelp(""),
32184 /* 161 */ "VCreate" OpHelp(""),
32185 /* 162 */ "VDestroy" OpHelp(""),
32186 /* 163 */ "VOpen" OpHelp(""),
32187 /* 164 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
32188 /* 165 */ "VRename" OpHelp(""),
32189 /* 166 */ "Pagecount" OpHelp(""),
32190 /* 167 */ "MaxPgcnt" OpHelp(""),
32191 /* 168 */ "Trace" OpHelp(""),
32192 /* 169 */ "CursorHint" OpHelp(""),
32193 /* 170 */ "Noop" OpHelp(""),
32194 /* 171 */ "Explain" OpHelp(""),
32195 /* 172 */ "Abortable" OpHelp(""),
 
32196 };
32197 return azName[i];
32198 }
32199 #endif
32200
@@ -40217,10 +40220,13 @@
40220 static sqlite3_vfs aVfs[] = {
40221 #if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)
40222 UNIXVFS("unix", autolockIoFinder ),
40223 #elif OS_VXWORKS
40224 UNIXVFS("unix", vxworksIoFinder ),
40225 #elif __Fuchsia__
40226 /* We are told that Fuchsia only supports dot-file locking */
40227 UNIXVFS("unix", dotlockIoFinder ),
40228 #else
40229 UNIXVFS("unix", posixIoFinder ),
40230 #endif
40231 UNIXVFS("unix-none", nolockIoFinder ),
40232 UNIXVFS("unix-dotfile", dotlockIoFinder ),
@@ -58162,11 +58168,11 @@
58168 ** Release a lock obtained by an earlier successful call to
58169 ** sqlite3PagerSnapshotCheck().
58170 */
58171 SQLITE_PRIVATE void sqlite3PagerSnapshotUnlock(Pager *pPager){
58172 assert( pPager->pWal );
58173 sqlite3WalSnapshotUnlock(pPager->pWal);
58174 }
58175
58176 #endif /* SQLITE_ENABLE_SNAPSHOT */
58177 #endif /* !SQLITE_OMIT_WAL */
58178
@@ -62338,11 +62344,11 @@
62344 u8 max1bytePayload; /* min(maxLocal,127) */
62345 u8 nOverflow; /* Number of overflow cell bodies in aCell[] */
62346 u16 maxLocal; /* Copy of BtShared.maxLocal or BtShared.maxLeaf */
62347 u16 minLocal; /* Copy of BtShared.minLocal or BtShared.minLeaf */
62348 u16 cellOffset; /* Index in aData of first cell pointer */
62349 int nFree; /* Number of free bytes on the page. -1 for unknown */
62350 u16 nCell; /* Number of cells on this page, local and ovfl */
62351 u16 maskPage; /* Mask for page offset */
62352 u16 aiOvfl[4]; /* Insert the i-th overflow cell before the aiOvfl-th
62353 ** non-overflow cell */
62354 u8 *apOvfl[4]; /* Pointers to the body of overflow cells */
@@ -64492,12 +64498,12 @@
64498 ** offsets to each pointer in the cell-pointer array than it is to
64499 ** reconstruct the entire page. */
64500 if( (int)data[hdr+7]<=nMaxFrag ){
64501 int iFree = get2byte(&data[hdr+1]);
64502
64503 /* If the initial freeblock offset were out of bounds, that would have
64504 ** been detected by btreeComputeFreeSpace() when it was computing the
64505 ** number of free bytes on the page. */
64506 assert( iFree<=usableSize-4 );
64507 if( iFree ){
64508 int iFree2 = get2byte(&data[iFree]);
64509 if( iFree2>usableSize-4 ) return SQLITE_CORRUPT_PAGE(pPage);
@@ -64565,10 +64571,11 @@
64571 memcpy(&data[cbrk], &src[pc], size);
64572 }
64573 data[hdr+7] = 0;
64574
64575 defragment_out:
64576 assert( pPage->nFree>=0 );
64577 if( data[hdr+7]+cbrk-iCellFirst!=pPage->nFree ){
64578 return SQLITE_CORRUPT_PAGE(pPage);
64579 }
64580 assert( cbrk>=iCellFirst );
64581 put2byte(&data[hdr+5], cbrk);
@@ -64592,54 +64599,61 @@
64599 ** Slots on the free list that are between 1 and 3 bytes larger than nByte
64600 ** will be ignored if adding the extra space to the fragmentation count
64601 ** causes the fragmentation count to exceed 60.
64602 */
64603 static u8 *pageFindSlot(MemPage *pPg, int nByte, int *pRc){
64604 const int hdr = pPg->hdrOffset; /* Offset to page header */
64605 u8 * const aData = pPg->aData; /* Page data */
64606 int iAddr = hdr + 1; /* Address of ptr to pc */
64607 int pc = get2byte(&aData[iAddr]); /* Address of a free slot */
64608 int x; /* Excess size of the slot */
64609 int maxPC = pPg->pBt->usableSize - nByte; /* Max address for a usable slot */
64610 int size; /* Size of the free slot */
64611
64612 assert( pc>0 );
64613 while( pc<=maxPC ){
64614 /* EVIDENCE-OF: R-22710-53328 The third and fourth bytes of each
64615 ** freeblock form a big-endian integer which is the size of the freeblock
64616 ** in bytes, including the 4-byte header. */
64617 size = get2byte(&aData[pc+2]);
64618 if( (x = size - nByte)>=0 ){
64619 testcase( x==4 );
64620 testcase( x==3 );
64621 if( x<4 ){
 
 
 
64622 /* EVIDENCE-OF: R-11498-58022 In a well-formed b-tree page, the total
64623 ** number of bytes in fragments may not exceed 60. */
64624 if( aData[hdr+7]>57 ) return 0;
64625
64626 /* Remove the slot from the free-list. Update the number of
64627 ** fragmented bytes within the page. */
64628 memcpy(&aData[iAddr], &aData[pc], 2);
64629 aData[hdr+7] += (u8)x;
64630 }else if( x+pc > maxPC ){
64631 /* This slot extends off the end of the usable part of the page */
64632 *pRc = SQLITE_CORRUPT_PAGE(pPg);
64633 return 0;
64634 }else{
64635 /* The slot remains on the free-list. Reduce its size to account
64636 ** for the portion used by the new allocation. */
64637 put2byte(&aData[pc+2], x);
64638 }
64639 return &aData[pc + x];
64640 }
64641 iAddr = pc;
64642 pc = get2byte(&aData[pc]);
64643 if( pc<iAddr+size ){
64644 if( pc ){
64645 /* The next slot in the chain is not past the end of the current slot */
64646 *pRc = SQLITE_CORRUPT_PAGE(pPg);
64647 }
64648 return 0;
64649 }
64650 }
64651 if( pc>maxPC+nByte-4 ){
64652 /* The free slot chain extends off the end of the page */
64653 *pRc = SQLITE_CORRUPT_PAGE(pPg);
64654 }
 
64655 return 0;
64656 }
64657
64658 /*
64659 ** Allocate nByte bytes of space from within the B-Tree page passed
@@ -64685,13 +64699,13 @@
64699 }else{
64700 return SQLITE_CORRUPT_PAGE(pPage);
64701 }
64702 }
64703
64704 /* If there is enough space between gap and top for one more cell pointer,
64705 ** and if the freelist is not empty, then search the
64706 ** freelist looking for a slot big enough to satisfy the request.
64707 */
64708 testcase( gap+2==top );
64709 testcase( gap+1==top );
64710 testcase( gap==top );
64711 if( (data[hdr+2] || data[hdr+1]) && gap+2<=top ){
@@ -64709,19 +64723,20 @@
64723 ** to see if defragmentation is necessary.
64724 */
64725 testcase( gap+2+nByte==top );
64726 if( gap+2+nByte>top ){
64727 assert( pPage->nCell>0 || CORRUPT_DB );
64728 assert( pPage->nFree>=0 );
64729 rc = defragmentPage(pPage, MIN(4, pPage->nFree - (2+nByte)));
64730 if( rc ) return rc;
64731 top = get2byteNotZero(&data[hdr+5]);
64732 assert( gap+2+nByte<=top );
64733 }
64734
64735
64736 /* Allocate memory from the gap in between the cell pointer array
64737 ** and the cell content area. The btreeComputeFreeSpace() call has already
64738 ** validated the freelist. Given that the freelist is valid, there
64739 ** is no way that the allocation can extend off the end of the page.
64740 ** The assert() below verifies the previous sentence.
64741 */
64742 top -= nByte;
@@ -64736,11 +64751,11 @@
64751 ** The first byte of the new free block is pPage->aData[iStart]
64752 ** and the size of the block is iSize bytes.
64753 **
64754 ** Adjacent freeblocks are coalesced.
64755 **
64756 ** Even though the freeblock list was checked by btreeComputeFreeSpace(),
64757 ** that routine will not detect overlap between cells or freeblocks. Nor
64758 ** does it detect cells or freeblocks that encrouch into the reserved bytes
64759 ** at the end of the page. So do additional corruption checks inside this
64760 ** routine and return SQLITE_CORRUPT if any problems are found.
64761 */
@@ -64898,25 +64913,18 @@
64913 pPage->max1bytePayload = pBt->max1bytePayload;
64914 return SQLITE_OK;
64915 }
64916
64917 /*
64918 ** Compute the amount of freespace on the page. In other words, fill
64919 ** in the pPage->nFree field.
 
 
 
 
 
64920 */
64921 static int btreeComputeFreeSpace(MemPage *pPage){
64922 int pc; /* Address of a freeblock within pPage->aData[] */
64923 u8 hdr; /* Offset to beginning of page header */
64924 u8 *data; /* Equal to pPage->aData */
 
64925 int usableSize; /* Amount of usable space on each page */
 
64926 int nFree; /* Number of unused bytes on the page */
64927 int top; /* First byte of the cell content area */
64928 int iCellFirst; /* First allowable cell or freeblock offset */
64929 int iCellLast; /* Last possible cell or freeblock offset */
64930
@@ -64924,75 +64932,22 @@
64932 assert( pPage->pBt->db!=0 );
64933 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
64934 assert( pPage->pgno==sqlite3PagerPagenumber(pPage->pDbPage) );
64935 assert( pPage == sqlite3PagerGetExtra(pPage->pDbPage) );
64936 assert( pPage->aData == sqlite3PagerGetData(pPage->pDbPage) );
64937 assert( pPage->isInit==1 );
64938 assert( pPage->nFree<0 );
64939
64940 usableSize = pPage->pBt->usableSize;
64941 hdr = pPage->hdrOffset;
64942 data = pPage->aData;
 
 
 
 
 
 
 
 
 
 
 
 
 
64943 /* EVIDENCE-OF: R-58015-48175 The two-byte integer at offset 5 designates
64944 ** the start of the cell content area. A zero value for this integer is
64945 ** interpreted as 65536. */
64946 top = get2byteNotZero(&data[hdr+5]);
64947 iCellFirst = hdr + 8 + pPage->childPtrSize + 2*pPage->nCell;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64948 iCellLast = usableSize - 4;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64949
64950 /* Compute the total free space on the page
64951 ** EVIDENCE-OF: R-23588-34450 The two-byte integer at offset 1 gives the
64952 ** start of the first freeblock on the page, or is zero if there are no
64953 ** freeblocks. */
@@ -65036,11 +64991,104 @@
64991 */
64992 if( nFree>usableSize ){
64993 return SQLITE_CORRUPT_PAGE(pPage);
64994 }
64995 pPage->nFree = (u16)(nFree - iCellFirst);
64996 return SQLITE_OK;
64997 }
64998
64999 /*
65000 ** Do additional sanity check after btreeInitPage() if
65001 ** PRAGMA cell_size_check=ON
65002 */
65003 static SQLITE_NOINLINE int btreeCellSizeCheck(MemPage *pPage){
65004 int iCellFirst; /* First allowable cell or freeblock offset */
65005 int iCellLast; /* Last possible cell or freeblock offset */
65006 int i; /* Index into the cell pointer array */
65007 int sz; /* Size of a cell */
65008 int pc; /* Address of a freeblock within pPage->aData[] */
65009 u8 *data; /* Equal to pPage->aData */
65010 int usableSize; /* Maximum usable space on the page */
65011 int cellOffset; /* Start of cell content area */
65012
65013 iCellFirst = pPage->cellOffset + 2*pPage->nCell;
65014 usableSize = pPage->pBt->usableSize;
65015 iCellLast = usableSize - 4;
65016 data = pPage->aData;
65017 cellOffset = pPage->cellOffset;
65018 if( !pPage->leaf ) iCellLast--;
65019 for(i=0; i<pPage->nCell; i++){
65020 pc = get2byteAligned(&data[cellOffset+i*2]);
65021 testcase( pc==iCellFirst );
65022 testcase( pc==iCellLast );
65023 if( pc<iCellFirst || pc>iCellLast ){
65024 return SQLITE_CORRUPT_PAGE(pPage);
65025 }
65026 sz = pPage->xCellSize(pPage, &data[pc]);
65027 testcase( pc+sz==usableSize );
65028 if( pc+sz>usableSize ){
65029 return SQLITE_CORRUPT_PAGE(pPage);
65030 }
65031 }
65032 return SQLITE_OK;
65033 }
65034
65035 /*
65036 ** Initialize the auxiliary information for a disk block.
65037 **
65038 ** Return SQLITE_OK on success. If we see that the page does
65039 ** not contain a well-formed database page, then return
65040 ** SQLITE_CORRUPT. Note that a return of SQLITE_OK does not
65041 ** guarantee that the page is well-formed. It only shows that
65042 ** we failed to detect any corruption.
65043 */
65044 static int btreeInitPage(MemPage *pPage){
65045 u8 *data; /* Equal to pPage->aData */
65046 BtShared *pBt; /* The main btree structure */
65047
65048 assert( pPage->pBt!=0 );
65049 assert( pPage->pBt->db!=0 );
65050 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
65051 assert( pPage->pgno==sqlite3PagerPagenumber(pPage->pDbPage) );
65052 assert( pPage == sqlite3PagerGetExtra(pPage->pDbPage) );
65053 assert( pPage->aData == sqlite3PagerGetData(pPage->pDbPage) );
65054 assert( pPage->isInit==0 );
65055
65056 pBt = pPage->pBt;
65057 data = pPage->aData + pPage->hdrOffset;
65058 /* EVIDENCE-OF: R-28594-02890 The one-byte flag at offset 0 indicating
65059 ** the b-tree page type. */
65060 if( decodeFlags(pPage, data[0]) ){
65061 return SQLITE_CORRUPT_PAGE(pPage);
65062 }
65063 assert( pBt->pageSize>=512 && pBt->pageSize<=65536 );
65064 pPage->maskPage = (u16)(pBt->pageSize - 1);
65065 pPage->nOverflow = 0;
65066 pPage->cellOffset = pPage->hdrOffset + 8 + pPage->childPtrSize;
65067 pPage->aCellIdx = data + pPage->childPtrSize + 8;
65068 pPage->aDataEnd = pPage->aData + pBt->usableSize;
65069 pPage->aDataOfst = pPage->aData + pPage->childPtrSize;
65070 /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the
65071 ** number of cells on the page. */
65072 pPage->nCell = get2byte(&data[3]);
65073 if( pPage->nCell>MX_CELL(pBt) ){
65074 /* To many cells for a single page. The page must be corrupt */
65075 return SQLITE_CORRUPT_PAGE(pPage);
65076 }
65077 testcase( pPage->nCell==MX_CELL(pBt) );
65078 /* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only
65079 ** possible for a root page of a table that contains no rows) then the
65080 ** offset to the cell content area will equal the page size minus the
65081 ** bytes of reserved space. */
65082 assert( pPage->nCell>0
65083 || get2byteNotZero(&data[5])==pBt->usableSize
65084 || CORRUPT_DB );
65085 pPage->nFree = -1; /* Indicate that this value is yet uncomputed */
65086 pPage->isInit = 1;
65087 if( pBt->db->flags & SQLITE_CellSizeCk ){
65088 return btreeCellSizeCheck(pPage);
65089 }
65090 return SQLITE_OK;
65091 }
65092
65093 /*
65094 ** Set up a raw page so that it looks like a database page holding
@@ -65179,38 +65227,38 @@
65227 assert( pCur==0 || bReadOnly==pCur->curPagerFlags );
65228 assert( pCur==0 || pCur->iPage>0 );
65229
65230 if( pgno>btreePagecount(pBt) ){
65231 rc = SQLITE_CORRUPT_BKPT;
65232 goto getAndInitPage_error1;
65233 }
65234 rc = sqlite3PagerGet(pBt->pPager, pgno, (DbPage**)&pDbPage, bReadOnly);
65235 if( rc ){
65236 goto getAndInitPage_error1;
65237 }
65238 *ppPage = (MemPage*)sqlite3PagerGetExtra(pDbPage);
65239 if( (*ppPage)->isInit==0 ){
65240 btreePageFromDbPage(pDbPage, pgno, pBt);
65241 rc = btreeInitPage(*ppPage);
65242 if( rc!=SQLITE_OK ){
65243 goto getAndInitPage_error2;
 
65244 }
65245 }
65246 assert( (*ppPage)->pgno==pgno );
65247 assert( (*ppPage)->aData==sqlite3PagerGetData(pDbPage) );
65248
65249 /* If obtaining a child page for a cursor, we must verify that the page is
65250 ** compatible with the root page. */
65251 if( pCur && ((*ppPage)->nCell<1 || (*ppPage)->intKey!=pCur->curIntKey) ){
65252 rc = SQLITE_CORRUPT_PGNO(pgno);
65253 goto getAndInitPage_error2;
 
65254 }
65255 return SQLITE_OK;
65256
65257 getAndInitPage_error2:
65258 releasePage(*ppPage);
65259 getAndInitPage_error1:
65260 if( pCur ){
65261 pCur->iPage--;
65262 pCur->pPage = pCur->apPage[pCur->iPage];
65263 }
65264 testcase( pgno==0 );
@@ -69618,10 +69666,11 @@
69666 if( *pRC ) return;
69667 assert( idx>=0 && idx<pPage->nCell );
69668 assert( CORRUPT_DB || sz==cellSize(pPage, idx) );
69669 assert( sqlite3PagerIswriteable(pPage->pDbPage) );
69670 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
69671 assert( pPage->nFree>=0 );
69672 data = pPage->aData;
69673 ptr = &pPage->aCellIdx[2*idx];
69674 pc = get2byte(ptr);
69675 hdr = pPage->hdrOffset;
69676 testcase( pc==get2byte(&data[hdr+5]) );
@@ -69688,10 +69737,11 @@
69737 ** malformed cell from a leaf page to an interior page, if the cell size
69738 ** wanted to be less than 4 but got rounded up to 4 on the leaf, then size
69739 ** might be less than 8 (leaf-size + pointer) on the interior node. Hence
69740 ** the term after the || in the following assert(). */
69741 assert( sz==pPage->xCellSize(pPage, pCell) || (sz==8 && iChild>0) );
69742 assert( pPage->nFree>=0 );
69743 if( pPage->nOverflow || sz+2>pPage->nFree ){
69744 if( pTemp ){
69745 memcpy(pTemp, pCell, sz);
69746 pCell = pTemp;
69747 }
@@ -69745,11 +69795,11 @@
69795 memmove(pIns+2, pIns, 2*(pPage->nCell - i));
69796 put2byte(pIns, idx);
69797 pPage->nCell++;
69798 /* increment the cell count */
69799 if( (++data[pPage->hdrOffset+4])==0 ) data[pPage->hdrOffset+3]++;
69800 assert( get2byte(&data[pPage->hdrOffset+3])==pPage->nCell || CORRUPT_DB );
69801 #ifndef SQLITE_OMIT_AUTOVACUUM
69802 if( pPage->pBt->autoVacuum ){
69803 /* The cell may contain a pointer to an overflow page. If so, write
69804 ** the entry for the overflow page into the pointer map.
69805 */
@@ -69832,12 +69882,17 @@
69882 **
69883 ** For a table-btree, the concept is similar, except only apEnd[0]..apEnd[2]
69884 ** are used and they point to the leaf pages only, and the ixNx value are:
69885 **
69886 ** ixNx[0] = Number of cells in Child-1.
69887 ** ixNx[1] = Number of cells in Child-1 and Child-2.
69888 ** ixNx[2] = Total number of cells.
69889 **
69890 ** Sometimes when deleting, a child page can have zero cells. In those
69891 ** cases, ixNx[] entries with higher indexes, and the corresponding apEnd[]
69892 ** entries, shift down. The end result is that each ixNx[] entry should
69893 ** be larger than the previous
69894 */
69895 typedef struct CellArray CellArray;
69896 struct CellArray {
69897 int nCell; /* Number of cells in apCell[] */
69898 MemPage *pRef; /* Reference page */
@@ -70239,12 +70294,14 @@
70294 Pgno pgnoNew; /* Page number of pNew */
70295
70296 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
70297 assert( sqlite3PagerIswriteable(pParent->pDbPage) );
70298 assert( pPage->nOverflow==1 );
70299
70300 if( pPage->nCell==0 ) return SQLITE_CORRUPT_BKPT; /* dbfuzz001.test */
70301 assert( pPage->nFree>=0 );
70302 assert( pParent->nFree>=0 );
70303
70304 /* Allocate a new page. This page will become the right-sibling of
70305 ** pPage. Make the parent page writable, so that the new divider cell
70306 ** may be inserted. If both these operations are successful, proceed.
70307 */
@@ -70410,10 +70467,11 @@
70467 ** fairly obscure circumstances, even though it is a copy of initialized
70468 ** page pFrom.
70469 */
70470 pTo->isInit = 0;
70471 rc = btreeInitPage(pTo);
70472 if( rc==SQLITE_OK ) rc = btreeComputeFreeSpace(pTo);
70473 if( rc!=SQLITE_OK ){
70474 *pRC = rc;
70475 return;
70476 }
70477
@@ -70518,10 +70576,11 @@
70576 assert( pParent->nOverflow==0 || pParent->aiOvfl[0]==iParentIdx );
70577
70578 if( !aOvflSpace ){
70579 return SQLITE_NOMEM_BKPT;
70580 }
70581 assert( pParent->nFree>=0 );
70582
70583 /* Find the sibling pages to balance. Also locate the cells in pParent
70584 ** that divide the siblings. An attempt is made to find NN siblings on
70585 ** either side of pPage. More siblings are taken from one side, however,
70586 ** if there are fewer than NN siblings on the other side. If pParent
@@ -70556,10 +70615,17 @@
70615 while( 1 ){
70616 rc = getAndInitPage(pBt, pgno, &apOld[i], 0, 0);
70617 if( rc ){
70618 memset(apOld, 0, (i+1)*sizeof(MemPage*));
70619 goto balance_cleanup;
70620 }
70621 if( apOld[i]->nFree<0 ){
70622 rc = btreeComputeFreeSpace(apOld[i]);
70623 if( rc ){
70624 memset(apOld, 0, (i)*sizeof(MemPage*));
70625 goto balance_cleanup;
70626 }
70627 }
70628 nMaxCells += 1+apOld[i]->nCell+apOld[i]->nOverflow;
70629 if( (i--)==0 ) break;
70630
70631 if( pParent->nOverflow && i+nxDiv==pParent->aiOvfl[0] ){
@@ -70751,15 +70817,19 @@
70817 usableSpace = pBt->usableSize - 12 + leafCorrection;
70818 for(i=k=0; i<nOld; i++, k++){
70819 MemPage *p = apOld[i];
70820 b.apEnd[k] = p->aDataEnd;
70821 b.ixNx[k] = cntOld[i];
70822 if( k && b.ixNx[k]==b.ixNx[k-1] ){
70823 k--; /* Omit b.ixNx[] entry for child pages with no cells */
70824 }
70825 if( !leafData ){
70826 k++;
70827 b.apEnd[k] = pParent->aDataEnd;
70828 b.ixNx[k] = cntOld[i]+1;
70829 }
70830 assert( p->nFree>=0 );
70831 szNew[i] = usableSpace - p->nFree;
70832 for(j=0; j<p->nOverflow; j++){
70833 szNew[i] += 2 + p->xCellSize(p, p->apOvfl[j]);
70834 }
70835 cntNew[i] = cntOld[i];
@@ -70981,22 +71051,21 @@
71051 ** populated, not here.
71052 */
71053 if( ISAUTOVACUUM ){
71054 MemPage *pOld;
71055 MemPage *pNew = pOld = apNew[0];
 
71056 int cntOldNext = pNew->nCell + pNew->nOverflow;
 
71057 int iNew = 0;
71058 int iOld = 0;
71059
71060 for(i=0; i<b.nCell; i++){
71061 u8 *pCell = b.apCell[i];
71062 while( i==cntOldNext ){
71063 iOld++;
71064 assert( iOld<nNew || iOld<nOld );
71065 pOld = iOld<nNew ? apNew[iOld] : apOld[iOld];
71066 cntOldNext += pOld->nCell + pOld->nOverflow + !leafData;
 
71067 }
71068 if( i==cntNew[iNew] ){
71069 pNew = apNew[++iNew];
71070 if( !leafData ) continue;
71071 }
@@ -71007,11 +71076,11 @@
71076 ** if sibling page iOld had the same page number as pNew, and if
71077 ** pCell really was a part of sibling page iOld (not a divider or
71078 ** overflow cell), we can skip updating the pointer map entries. */
71079 if( iOld>=nNew
71080 || pNew->pgno!=aPgno[iOld]
71081 || !SQLITE_WITHIN(pCell,pOld->aData,pOld->aDataEnd)
71082 ){
71083 if( !leafCorrection ){
71084 ptrmapPut(pBt, get4byte(pCell), PTRMAP_BTREE, pNew->pgno, &rc);
71085 }
71086 if( cachedCellSize(&b,i)>pNew->minLocal ){
@@ -71257,11 +71326,11 @@
71326 releasePage(pChild);
71327 return rc;
71328 }
71329 assert( sqlite3PagerIswriteable(pChild->pDbPage) );
71330 assert( sqlite3PagerIswriteable(pRoot->pDbPage) );
71331 assert( pChild->nCell==pRoot->nCell || CORRUPT_DB );
71332
71333 TRACE(("BALANCE: copy root %d into %d\n", pRoot->pgno, pChild->pgno));
71334
71335 /* Copy the overflow cells from pRoot to pChild */
71336 memcpy(pChild->aiOvfl, pRoot->aiOvfl,
@@ -71299,10 +71368,11 @@
71368
71369 do {
71370 int iPage = pCur->iPage;
71371 MemPage *pPage = pCur->pPage;
71372
71373 if( NEVER(pPage->nFree<0) && btreeComputeFreeSpace(pPage) ) break;
71374 if( iPage==0 ){
71375 if( pPage->nOverflow ){
71376 /* The root page of the b-tree is overfull. In this case call the
71377 ** balance_deeper() function to create a new child for the root-page
71378 ** and copy the current contents of the root-page to it. The
@@ -71327,10 +71397,13 @@
71397 }else{
71398 MemPage * const pParent = pCur->apPage[iPage-1];
71399 int const iIdx = pCur->aiIdx[iPage-1];
71400
71401 rc = sqlite3PagerWrite(pParent->pDbPage);
71402 if( rc==SQLITE_OK && pParent->nFree<0 ){
71403 rc = btreeComputeFreeSpace(pParent);
71404 }
71405 if( rc==SQLITE_OK ){
71406 #ifndef SQLITE_OMIT_QUICKBALANCE
71407 if( pPage->intKeyLeaf
71408 && pPage->nOverflow==1
71409 && pPage->aiOvfl[0]==pPage->nCell
@@ -71673,10 +71746,14 @@
71746 assert( pCur->eState==CURSOR_VALID || (pCur->eState==CURSOR_INVALID && loc) );
71747
71748 pPage = pCur->pPage;
71749 assert( pPage->intKey || pX->nKey>=0 );
71750 assert( pPage->leaf || !pPage->intKey );
71751 if( pPage->nFree<0 ){
71752 rc = btreeComputeFreeSpace(pPage);
71753 if( rc ) return rc;
71754 }
71755
71756 TRACE(("INSERT: table=%d nkey=%lld ndata=%d page=%d %s\n",
71757 pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno,
71758 loc==0 ? "overwrite" : "new entry"));
71759 assert( pPage->isInit );
@@ -71823,10 +71900,11 @@
71900
71901 iCellDepth = pCur->iPage;
71902 iCellIdx = pCur->ix;
71903 pPage = pCur->pPage;
71904 pCell = findCell(pPage, iCellIdx);
71905 if( pPage->nFree<0 && btreeComputeFreeSpace(pPage) ) return SQLITE_CORRUPT;
71906
71907 /* If the bPreserve flag is set to true, then the cursor position must
71908 ** be preserved following this delete operation. If the current delete
71909 ** will cause a b-tree rebalance, then this is done by saving the cursor
71910 ** key and leaving the cursor in CURSOR_REQUIRESEEK state before
@@ -71893,10 +71971,14 @@
71971 MemPage *pLeaf = pCur->pPage;
71972 int nCell;
71973 Pgno n;
71974 unsigned char *pTmp;
71975
71976 if( pLeaf->nFree<0 ){
71977 rc = btreeComputeFreeSpace(pLeaf);
71978 if( rc ) return rc;
71979 }
71980 if( iCellDepth<pCur->iPage-1 ){
71981 n = pCur->apPage[iCellDepth+1]->pgno;
71982 }else{
71983 n = pCur->pPage->pgno;
71984 }
@@ -72784,10 +72866,15 @@
72866 assert( rc==SQLITE_CORRUPT ); /* The only possible error from InitPage */
72867 checkAppendMsg(pCheck,
72868 "btreeInitPage() returns error code %d", rc);
72869 goto end_of_check;
72870 }
72871 if( (rc = btreeComputeFreeSpace(pPage))!=0 ){
72872 assert( rc==SQLITE_CORRUPT );
72873 checkAppendMsg(pCheck, "free space corruption", rc);
72874 goto end_of_check;
72875 }
72876 data = pPage->aData;
72877 hdr = pPage->hdrOffset;
72878
72879 /* Set up for cell analysis */
72880 pCheck->zPfx = "On tree page %d cell %d: ";
@@ -72916,23 +73003,23 @@
73003 ** freeblocks on the page.
73004 */
73005 i = get2byte(&data[hdr+1]);
73006 while( i>0 ){
73007 int size, j;
73008 assert( (u32)i<=usableSize-4 ); /* Enforced by btreeComputeFreeSpace() */
73009 size = get2byte(&data[i+2]);
73010 assert( (u32)(i+size)<=usableSize ); /* due to btreeComputeFreeSpace() */
73011 btreeHeapInsert(heap, (((u32)i)<<16)|(i+size-1));
73012 /* EVIDENCE-OF: R-58208-19414 The first 2 bytes of a freeblock are a
73013 ** big-endian integer which is the offset in the b-tree page of the next
73014 ** freeblock in the chain, or zero if the freeblock is the last on the
73015 ** chain. */
73016 j = get2byte(&data[i]);
73017 /* EVIDENCE-OF: R-06866-39125 Freeblocks are always connected in order of
73018 ** increasing offset. */
73019 assert( j==0 || j>i+size ); /* Enforced by btreeComputeFreeSpace() */
73020 assert( (u32)j<=usableSize-4 ); /* Enforced by btreeComputeFreeSpace() */
73021 i = j;
73022 }
73023 /* Analyze the min-heap looking for overlap between cells and/or
73024 ** freeblocks, and counting the number of untracked bytes in nFrag.
73025 **
@@ -74393,12 +74480,11 @@
74480 return rc;
74481 #endif
74482 }
74483
74484 /*
74485 ** Make sure pMem->z points to a writable allocation of at least n bytes.
 
74486 **
74487 ** If the bPreserve argument is true, then copy of the content of
74488 ** pMem->z into the new allocation. pMem must be either a string or
74489 ** blob if bPreserve is true. If bPreserve is false, any prior content
74490 ** in pMem->z is discarded.
@@ -74413,11 +74499,10 @@
74499 assert( bPreserve==0 || pMem->flags&(MEM_Blob|MEM_Str) );
74500 testcase( bPreserve && pMem->z==0 );
74501
74502 assert( pMem->szMalloc==0
74503 || pMem->szMalloc==sqlite3DbMallocSize(pMem->db, pMem->zMalloc) );
 
74504 if( pMem->szMalloc>0 && bPreserve && pMem->z==pMem->zMalloc ){
74505 pMem->z = pMem->zMalloc = sqlite3DbReallocOrFree(pMem->db, pMem->z, n);
74506 bPreserve = 0;
74507 }else{
74508 if( pMem->szMalloc>0 ) sqlite3DbFreeNN(pMem->db, pMem->zMalloc);
@@ -75262,11 +75347,10 @@
75347 flags = (enc==0?MEM_Blob:MEM_Str);
75348 if( nByte<0 ){
75349 assert( enc!=0 );
75350 if( enc==SQLITE_UTF8 ){
75351 nByte = 0x7fffffff & (int)strlen(z);
 
75352 }else{
75353 for(nByte=0; nByte<=iLimit && (z[nByte] | z[nByte+1]); nByte+=2){}
75354 }
75355 flags |= MEM_Term;
75356 }
@@ -75274,33 +75358,34 @@
75358 /* The following block sets the new values of Mem.z and Mem.xDel. It
75359 ** also sets a flag in local variable "flags" to indicate the memory
75360 ** management (one of MEM_Dyn or MEM_Static).
75361 */
75362 if( xDel==SQLITE_TRANSIENT ){
75363 u32 nAlloc = nByte;
75364 if( flags&MEM_Term ){
75365 nAlloc += (enc==SQLITE_UTF8?1:2);
75366 }
75367 if( nByte>iLimit ){
75368 return SQLITE_TOOBIG;
75369 }
75370 testcase( nAlloc==0 );
75371 testcase( nAlloc==31 );
75372 testcase( nAlloc==32 );
75373 if( sqlite3VdbeMemClearAndResize(pMem, (int)MAX(nAlloc,32)) ){
75374 return SQLITE_NOMEM_BKPT;
75375 }
75376 memcpy(pMem->z, z, nAlloc);
 
 
 
 
75377 }else{
75378 sqlite3VdbeMemRelease(pMem);
75379 pMem->z = (char *)z;
75380 if( xDel==SQLITE_DYNAMIC ){
75381 pMem->zMalloc = pMem->z;
75382 pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->zMalloc);
75383 }else{
75384 pMem->xDel = xDel;
75385 flags |= ((xDel==SQLITE_STATIC)?MEM_Static:MEM_Dyn);
75386 }
75387 }
75388
75389 pMem->n = nByte;
75390 pMem->flags = flags;
75391 pMem->enc = (enc==0 ? SQLITE_UTF8 : enc);
@@ -82206,14 +82291,14 @@
82291 **
82292 ** If the result is not a simple column reference (if it is an expression
82293 ** or a constant) then useTypes 2, 3, and 4 return NULL.
82294 */
82295 static const void *columnName(
82296 sqlite3_stmt *pStmt, /* The statement */
82297 int N, /* Which column to get the name for */
82298 int useUtf16, /* True to return the name as UTF16 */
82299 int useType /* What type of name */
82300 ){
82301 const void *ret;
82302 Vdbe *p;
82303 int n;
82304 sqlite3 *db;
@@ -82230,12 +82315,16 @@
82315 n = sqlite3_column_count(pStmt);
82316 if( N<n && N>=0 ){
82317 N += useType*n;
82318 sqlite3_mutex_enter(db->mutex);
82319 assert( db->mallocFailed==0 );
82320 if( useUtf16 ){
82321 ret = sqlite3_value_text16((sqlite3_value*)&p->aColName[N]);
82322 }else{
82323 ret = sqlite3_value_text((sqlite3_value*)&p->aColName[N]);
82324 }
82325 /* A malloc may have failed inside of the _text() call. If this
82326 ** is the case, clear the mallocFailed flag and return NULL.
82327 */
82328 if( db->mallocFailed ){
82329 sqlite3OomClear(db);
82330 ret = 0;
@@ -82248,17 +82337,15 @@
82337 /*
82338 ** Return the name of the Nth column of the result set returned by SQL
82339 ** statement pStmt.
82340 */
82341 SQLITE_API const char *sqlite3_column_name(sqlite3_stmt *pStmt, int N){
82342 return columnName(pStmt, N, 0, COLNAME_NAME);
 
82343 }
82344 #ifndef SQLITE_OMIT_UTF16
82345 SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt *pStmt, int N){
82346 return columnName(pStmt, N, 1, COLNAME_NAME);
 
82347 }
82348 #endif
82349
82350 /*
82351 ** Constraint: If you have ENABLE_COLUMN_METADATA then you must
@@ -82273,17 +82360,15 @@
82360 /*
82361 ** Return the column declaration type (if applicable) of the 'i'th column
82362 ** of the result set of SQL statement pStmt.
82363 */
82364 SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt *pStmt, int N){
82365 return columnName(pStmt, N, 0, COLNAME_DECLTYPE);
 
82366 }
82367 #ifndef SQLITE_OMIT_UTF16
82368 SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt *pStmt, int N){
82369 return columnName(pStmt, N, 1, COLNAME_DECLTYPE);
 
82370 }
82371 #endif /* SQLITE_OMIT_UTF16 */
82372 #endif /* SQLITE_OMIT_DECLTYPE */
82373
82374 #ifdef SQLITE_ENABLE_COLUMN_METADATA
@@ -82291,49 +82376,43 @@
82376 ** Return the name of the database from which a result column derives.
82377 ** NULL is returned if the result column is an expression or constant or
82378 ** anything else which is not an unambiguous reference to a database column.
82379 */
82380 SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt *pStmt, int N){
82381 return columnName(pStmt, N, 0, COLNAME_DATABASE);
 
82382 }
82383 #ifndef SQLITE_OMIT_UTF16
82384 SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt *pStmt, int N){
82385 return columnName(pStmt, N, 1, COLNAME_DATABASE);
 
82386 }
82387 #endif /* SQLITE_OMIT_UTF16 */
82388
82389 /*
82390 ** Return the name of the table from which a result column derives.
82391 ** NULL is returned if the result column is an expression or constant or
82392 ** anything else which is not an unambiguous reference to a database column.
82393 */
82394 SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt *pStmt, int N){
82395 return columnName(pStmt, N, 0, COLNAME_TABLE);
 
82396 }
82397 #ifndef SQLITE_OMIT_UTF16
82398 SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt *pStmt, int N){
82399 return columnName(pStmt, N, 1, COLNAME_TABLE);
 
82400 }
82401 #endif /* SQLITE_OMIT_UTF16 */
82402
82403 /*
82404 ** Return the name of the table column from which a result column derives.
82405 ** NULL is returned if the result column is an expression or constant or
82406 ** anything else which is not an unambiguous reference to a database column.
82407 */
82408 SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt *pStmt, int N){
82409 return columnName(pStmt, N, 0, COLNAME_COLUMN);
 
82410 }
82411 #ifndef SQLITE_OMIT_UTF16
82412 SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt *pStmt, int N){
82413 return columnName(pStmt, N, 1, COLNAME_COLUMN);
 
82414 }
82415 #endif /* SQLITE_OMIT_UTF16 */
82416 #endif /* SQLITE_ENABLE_COLUMN_METADATA */
82417
82418
@@ -83975,10 +84054,19 @@
84054 #endif
84055 /*** INSERT STACK UNION HERE ***/
84056
84057 assert( p->magic==VDBE_MAGIC_RUN ); /* sqlite3_step() verifies this */
84058 sqlite3VdbeEnter(p);
84059 #ifndef SQLITE_OMIT_PROGRESS_CALLBACK
84060 if( db->xProgress ){
84061 u32 iPrior = p->aCounter[SQLITE_STMTSTATUS_VM_STEP];
84062 assert( 0 < db->nProgressOps );
84063 nProgressLimit = db->nProgressOps - (iPrior % db->nProgressOps);
84064 }else{
84065 nProgressLimit = 0xffffffff;
84066 }
84067 #endif
84068 if( p->rc==SQLITE_NOMEM ){
84069 /* This happens if a malloc() inside a call to sqlite3_column_text() or
84070 ** sqlite3_column_text16() failed. */
84071 goto no_mem;
84072 }
@@ -83988,19 +84076,10 @@
84076 assert( p->explain==0 );
84077 p->pResultSet = 0;
84078 db->busyHandler.nBusy = 0;
84079 if( db->u1.isInterrupted ) goto abort_due_to_interrupt;
84080 sqlite3VdbeIOTraceSql(p);
 
 
 
 
 
 
 
 
 
84081 #ifdef SQLITE_DEBUG
84082 sqlite3BeginBenignMalloc();
84083 if( p->pc==0
84084 && (p->db->flags & (SQLITE_VdbeListing|SQLITE_VdbeEQP|SQLITE_VdbeTrace))!=0
84085 ){
@@ -84172,14 +84251,15 @@
84251 ** of VDBE ops have been executed (either since this invocation of
84252 ** sqlite3VdbeExec() or since last time the progress callback was called).
84253 ** If the progress callback returns non-zero, exit the virtual machine with
84254 ** a return code SQLITE_ABORT.
84255 */
84256 while( nVmStep>=nProgressLimit && db->xProgress!=0 ){
84257 assert( db->nProgressOps!=0 );
84258 nProgressLimit += db->nProgressOps;
84259 if( db->xProgress(db->pProgressArg) ){
84260 nProgressLimit = 0xffffffff;
84261 rc = SQLITE_INTERRUPT;
84262 goto abort_due_to_error;
84263 }
84264 }
84265 #endif
@@ -84454,10 +84534,11 @@
84534
84535 #ifndef SQLITE_OMIT_UTF16
84536 if( encoding!=SQLITE_UTF8 ){
84537 rc = sqlite3VdbeMemSetStr(pOut, pOp->p4.z, -1, SQLITE_UTF8, SQLITE_STATIC);
84538 assert( rc==SQLITE_OK || rc==SQLITE_TOOBIG );
84539 if( rc ) goto too_big;
84540 if( SQLITE_OK!=sqlite3VdbeChangeEncoding(pOut, encoding) ) goto no_mem;
84541 assert( pOut->szMalloc>0 && pOut->zMalloc==pOut->z );
84542 assert( VdbeMemDynamic(pOut)==0 );
84543 pOut->szMalloc = 0;
84544 pOut->flags |= MEM_Static;
@@ -84466,11 +84547,10 @@
84547 }
84548 pOp->p4type = P4_DYNAMIC;
84549 pOp->p4.z = pOut->z;
84550 pOp->p1 = pOut->n;
84551 }
 
84552 #endif
84553 if( pOp->p1>db->aLimit[SQLITE_LIMIT_LENGTH] ){
84554 goto too_big;
84555 }
84556 assert( rc==SQLITE_OK );
@@ -84721,22 +84801,10 @@
84801 int i;
84802 assert( p->nResColumn==pOp->p2 );
84803 assert( pOp->p1>0 );
84804 assert( pOp->p1+pOp->p2<=(p->nMem+1 - p->nCursor)+1 );
84805
 
 
 
 
 
 
 
 
 
 
 
 
84806 /* If this statement has violated immediate foreign key constraints, do
84807 ** not return the number of rows modified. And do not RELEASE the statement
84808 ** transaction. It needs to be rolled back. */
84809 if( SQLITE_OK!=(rc = sqlite3VdbeCheckFk(p, 0)) ){
84810 assert( db->flags&SQLITE_CountRows );
@@ -85959,19 +86027,19 @@
86027 offset64 = aOffset[i];
86028 zHdr = zData + pC->iHdrOffset;
86029 zEndHdr = zData + aOffset[0];
86030 testcase( zHdr>=zEndHdr );
86031 do{
86032 if( (pC->aType[i] = t = zHdr[0])<0x80 ){
86033 zHdr++;
86034 offset64 += sqlite3VdbeOneByteSerialTypeLen(t);
86035 }else{
86036 zHdr += sqlite3GetVarint32(zHdr, &t);
86037 pC->aType[i] = t;
86038 offset64 += sqlite3VdbeSerialTypeLen(t);
86039 }
86040 aOffset[++i] = (u32)(offset64 & 0xffffffff);
 
86041 }while( i<=p2 && zHdr<zEndHdr );
86042
86043 /* The record is corrupt if any of the following are true:
86044 ** (1) the bytes of the header extend past the declared header size
86045 ** (2) the entire header was used but not all data was used
@@ -87933,18 +88001,11 @@
88001 ** cause any problems.)
88002 **
88003 ** This instruction only works on tables. The equivalent instruction
88004 ** for indices is OP_IdxInsert.
88005 */
88006 case OP_Insert: {
 
 
 
 
 
 
 
88007 Mem *pData; /* MEM cell holding data for the record to be inserted */
88008 Mem *pKey; /* MEM cell holding key for the record */
88009 VdbeCursor *pC; /* Cursor to table into which insert is written */
88010 int seekResult; /* Result of prior seek or 0 if no USESEEKRESULT flag */
88011 const char *zDb; /* database name - used by the update hook */
@@ -87961,20 +88022,15 @@
88022 assert( (pOp->p5 & OPFLAG_ISNOOP) || pC->isTable );
88023 assert( pOp->p4type==P4_TABLE || pOp->p4type>=P4_STATIC );
88024 REGISTER_TRACE(pOp->p2, pData);
88025 sqlite3VdbeIncrWriteCounter(p, pC);
88026
88027 pKey = &aMem[pOp->p3];
88028 assert( pKey->flags & MEM_Int );
88029 assert( memIsValid(pKey) );
88030 REGISTER_TRACE(pOp->p3, pKey);
88031 x.nKey = pKey->u.i;
 
 
 
 
 
88032
88033 if( pOp->p4type==P4_TABLE && HAS_UPDATE_HOOK(db) ){
88034 assert( pC->iDb>=0 );
88035 zDb = db->aDb[pC->iDb].zDbSName;
88036 pTab = pOp->p4.pTab;
@@ -89538,12 +89594,11 @@
89594 aMem[i].flags |= MEM_Undefined; /* Cause a fault if this reg is reused */
89595 }
89596 }
89597 #endif
89598 pOp = &aOp[-1];
89599 goto check_for_interrupt;
 
89600 }
89601
89602 /* Opcode: Param P1 P2 * * *
89603 **
89604 ** This opcode is only ever present in sub-programs called via the
@@ -90948,11 +91003,20 @@
91003
91004 /* This is the only way out of this procedure. We have to
91005 ** release the mutexes on btrees that were acquired at the
91006 ** top. */
91007 vdbe_return:
91008 #ifndef SQLITE_OMIT_PROGRESS_CALLBACK
91009 while( nVmStep>=nProgressLimit && db->xProgress!=0 ){
91010 nProgressLimit += db->nProgressOps;
91011 if( db->xProgress(db->pProgressArg) ){
91012 nProgressLimit = 0xffffffff;
91013 rc = SQLITE_INTERRUPT;
91014 goto abort_due_to_error;
91015 }
91016 }
91017 #endif
91018 p->aCounter[SQLITE_STMTSTATUS_VM_STEP] += (int)nVmStep;
91019 sqlite3VdbeLeave(p);
91020 assert( rc!=SQLITE_OK || nExtraDelete==0
91021 || sqlite3_strlike("DELETE%",p->zSql,0)!=0
91022 );
@@ -96129,10 +96193,42 @@
96193 }
96194 }
96195 return 0;
96196 }
96197
96198 #ifndef SQLITE_OMIT_WINDOWFUNC
96199 /*
96200 ** Walker callback for resolveRemoveWindows().
96201 */
96202 static int resolveRemoveWindowsCb(Walker *pWalker, Expr *pExpr){
96203 if( ExprHasProperty(pExpr, EP_WinFunc) ){
96204 Window **pp;
96205 for(pp=&pWalker->u.pSelect->pWin; *pp; pp=&(*pp)->pNextWin){
96206 if( *pp==pExpr->y.pWin ){
96207 *pp = (*pp)->pNextWin;
96208 break;
96209 }
96210 }
96211 }
96212 return WRC_Continue;
96213 }
96214
96215 /*
96216 ** Remove any Window objects owned by the expression pExpr from the
96217 ** Select.pWin list of Select object pSelect.
96218 */
96219 static void resolveRemoveWindows(Select *pSelect, Expr *pExpr){
96220 Walker sWalker;
96221 memset(&sWalker, 0, sizeof(Walker));
96222 sWalker.xExprCallback = resolveRemoveWindowsCb;
96223 sWalker.u.pSelect = pSelect;
96224 sqlite3WalkExpr(&sWalker, pExpr);
96225 }
96226 #else
96227 # define resolveRemoveWindows(x,y)
96228 #endif
96229
96230 /*
96231 ** pOrderBy is an ORDER BY or GROUP BY clause in SELECT statement pSelect.
96232 ** The Name context of the SELECT statement is pNC. zType is either
96233 ** "ORDER" or "GROUP" depending on which type of clause pOrderBy is.
96234 **
@@ -96195,23 +96291,14 @@
96291 if( sqlite3ResolveExprNames(pNC, pE) ){
96292 return 1;
96293 }
96294 for(j=0; j<pSelect->pEList->nExpr; j++){
96295 if( sqlite3ExprCompare(0, pE, pSelect->pEList->a[j].pExpr, -1)==0 ){
96296 /* Since this expresion is being changed into a reference
96297 ** to an identical expression in the result set, remove all Window
96298 ** objects belonging to the expression from the Select.pWin list. */
96299 resolveRemoveWindows(pSelect, pE);
 
 
 
 
 
 
 
 
 
96300 pItem->u.x.iOrderByCol = j+1;
96301 }
96302 }
96303 }
96304 return sqlite3ResolveOrderGroupBy(pParse, pSelect, pOrderBy, zType);
@@ -96419,10 +96506,11 @@
96506 return WRC_Abort;
96507 }
96508 }
96509 }
96510
96511 #ifndef SQLITE_OMIT_WINDOWFUNC
96512 if( IN_RENAME_OBJECT ){
96513 Window *pWin;
96514 for(pWin=p->pWinDefn; pWin; pWin=pWin->pNextWin){
96515 if( sqlite3ResolveExprListNames(&sNC, pWin->pOrderBy)
96516 || sqlite3ResolveExprListNames(&sNC, pWin->pPartition)
@@ -96429,10 +96517,11 @@
96517 ){
96518 return WRC_Abort;
96519 }
96520 }
96521 }
96522 #endif
96523
96524 /* If this is part of a compound SELECT, check that it has the right
96525 ** number of expressions in the select list. */
96526 if( p->pNext && p->pEList->nExpr!=p->pNext->pEList->nExpr ){
96527 sqlite3SelectWrongNumTermsError(pParse, p->pNext);
@@ -99179,18 +99268,15 @@
99268 u32 savedNQueryLoop = pParse->nQueryLoop;
99269 int rMayHaveNull = 0;
99270 eType = IN_INDEX_EPH;
99271 if( inFlags & IN_INDEX_LOOP ){
99272 pParse->nQueryLoop = 0;
 
 
 
99273 }else if( prRhsHasNull ){
99274 *prRhsHasNull = rMayHaveNull = ++pParse->nMem;
99275 }
99276 assert( pX->op==TK_IN );
99277 sqlite3CodeRhsOfIN(pParse, pX, iTab);
99278 if( rMayHaveNull ){
99279 sqlite3SetHasNullFlag(v, iTab, rMayHaveNull);
99280 }
99281 pParse->nQueryLoop = savedNQueryLoop;
99282 }
@@ -99287,16 +99373,10 @@
99373 ** constructed ephermeral table is returned. The first time the ephemeral
99374 ** table is computed, the cursor number is also stored in pExpr->iTable,
99375 ** however the cursor number returned might not be the same, as it might
99376 ** have been duplicated using OP_OpenDup.
99377 **
 
 
 
 
 
 
99378 ** If the LHS expression ("x" in the examples) is a column value, or
99379 ** the SELECT statement returns a column value, then the affinity of that
99380 ** column is used to build the index keys. If both 'x' and the
99381 ** SELECT... statement are columns, then numeric affinity is used
99382 ** if either column has NUMERIC or INTEGER affinity. If neither
@@ -99304,12 +99384,11 @@
99384 ** is used.
99385 */
99386 SQLITE_PRIVATE void sqlite3CodeRhsOfIN(
99387 Parse *pParse, /* Parsing context */
99388 Expr *pExpr, /* The IN operator */
99389 int iTab /* Use this cursor number */
 
99390 ){
99391 int addrOnce = 0; /* Address of the OP_Once instruction at top */
99392 int addr; /* Address of OP_OpenEphemeral instruction */
99393 Expr *pLeft; /* the LHS of the IN operator */
99394 KeyInfo *pKeyInfo = 0; /* Key information */
@@ -99358,26 +99437,24 @@
99437 }
99438
99439 /* Check to see if this is a vector IN operator */
99440 pLeft = pExpr->pLeft;
99441 nVal = sqlite3ExprVectorSize(pLeft);
 
99442
99443 /* Construct the ephemeral table that will contain the content of
99444 ** RHS of the IN operator.
99445 */
99446 pExpr->iTable = iTab;
99447 addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pExpr->iTable, nVal);
 
99448 #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
99449 if( ExprHasProperty(pExpr, EP_xIsSelect) ){
99450 VdbeComment((v, "Result of SELECT %u", pExpr->x.pSelect->selId));
99451 }else{
99452 VdbeComment((v, "RHS of IN operator"));
99453 }
99454 #endif
99455 pKeyInfo = sqlite3KeyInfoAlloc(pParse->db, nVal, 1);
99456
99457 if( ExprHasProperty(pExpr, EP_xIsSelect) ){
99458 /* Case 1: expr IN (SELECT ...)
99459 **
99460 ** Generate code to write the results of the select into the temporary
@@ -99387,11 +99464,10 @@
99464 ExprList *pEList = pSelect->pEList;
99465
99466 ExplainQueryPlan((pParse, 1, "%sLIST SUBQUERY %d",
99467 addrOnce?"":"CORRELATED ", pSelect->selId
99468 ));
 
99469 /* If the LHS and RHS of the IN operator do not match, that
99470 ** error will have been caught long before we reach this point. */
99471 if( ALWAYS(pEList->nExpr==nVal) ){
99472 SelectDest dest;
99473 int i;
@@ -99440,14 +99516,12 @@
99516 }
99517
99518 /* Loop through each expression in <exprlist>. */
99519 r1 = sqlite3GetTempReg(pParse);
99520 r2 = sqlite3GetTempReg(pParse);
 
99521 for(i=pList->nExpr, pItem=pList->a; i>0; i--, pItem++){
99522 Expr *pE2 = pItem->pExpr;
 
99523
99524 /* If the expression is not constant then we will need to
99525 ** disable the test that was generated above that makes sure
99526 ** this code only executes once. Because for a non-constant
99527 ** expression we need to rerun this code each time.
@@ -99456,24 +99530,13 @@
99530 sqlite3VdbeChangeToNoop(v, addrOnce);
99531 addrOnce = 0;
99532 }
99533
99534 /* Evaluate the expression and insert it into the temp table */
99535 r3 = sqlite3ExprCodeTarget(pParse, pE2, r1);
99536 sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1);
99537 sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r2, r3, 1);
 
 
 
 
 
 
 
 
 
 
 
99538 }
99539 sqlite3ReleaseTempReg(pParse, r1);
99540 sqlite3ReleaseTempReg(pParse, r2);
99541 }
99542 if( pKeyInfo ){
@@ -106852,11 +106915,15 @@
106915 assert( pParse->nested<10 ); /* Nesting should only be of limited depth */
106916 va_start(ap, zFormat);
106917 zSql = sqlite3VMPrintf(db, zFormat, ap);
106918 va_end(ap);
106919 if( zSql==0 ){
106920 /* This can result either from an OOM or because the formatted string
106921 ** exceeds SQLITE_LIMIT_LENGTH. In the latter case, we need to set
106922 ** an error */
106923 if( !db->mallocFailed ) pParse->rc = SQLITE_TOOBIG;
106924 return;
106925 }
106926 pParse->nested++;
106927 memcpy(saveBuf, PARSE_TAIL(pParse), PARSE_TAIL_SZ);
106928 memset(PARSE_TAIL(pParse), 0, PARSE_TAIL_SZ);
106929 sqlite3RunParser(pParse, zSql, &zErrMsg);
@@ -108413,10 +108480,11 @@
108480 if( db->mallocFailed || pParse->nErr ) return;
108481 pPk = sqlite3PrimaryKeyIndex(pTab);
108482 pTab->iPKey = -1;
108483 }else{
108484 pPk = sqlite3PrimaryKeyIndex(pTab);
108485 assert( pPk!=0 );
108486
108487 /*
108488 ** Remove all redundant columns from the PRIMARY KEY. For example, change
108489 ** "PRIMARY KEY(a,b,a,b,c,b,c,d)" into just "PRIMARY KEY(a,b,c,d)". Later
108490 ** code assumes the PRIMARY KEY contains no repeated columns.
@@ -108582,10 +108650,15 @@
108650 }
108651 p->tnum = db->init.newTnum;
108652 if( p->tnum==1 ) p->tabFlags |= TF_Readonly;
108653 }
108654
108655 assert( (p->tabFlags & TF_HasPrimaryKey)==0
108656 || p->iPKey>=0 || sqlite3PrimaryKeyIndex(p)!=0 );
108657 assert( (p->tabFlags & TF_HasPrimaryKey)!=0
108658 || (p->iPKey<0 && sqlite3PrimaryKeyIndex(p)==0) );
108659
108660 /* Special processing for WITHOUT ROWID Tables */
108661 if( tabOpts & TF_WithoutRowid ){
108662 if( (p->tabFlags & TF_Autoincrement) ){
108663 sqlite3ErrorMsg(pParse,
108664 "AUTOINCREMENT not allowed on WITHOUT ROWID tables");
@@ -117855,11 +117928,13 @@
117928 }
117929 }
117930 sqlite3VdbeAddOp3(v, OP_MakeRecord, regIdx, pIdx->nColumn, aRegIdx[ix]);
117931 VdbeComment((v, "for %s", pIdx->zName));
117932 #ifdef SQLITE_ENABLE_NULL_TRIM
117933 if( pIdx->idxType==SQLITE_IDXTYPE_PRIMARYKEY ){
117934 sqlite3SetMakeRecordP5(v, pIdx->pTable);
117935 }
117936 #endif
117937
117938 /* In an UPDATE operation, if this index is the PRIMARY KEY index
117939 ** of a WITHOUT ROWID table and there has been no change the
117940 ** primary key, then no collision is possible. The collision detection
@@ -118105,14 +118180,17 @@
118180 assert( pParse->nested==0 );
118181 pik_flags |= OPFLAG_NCHANGE;
118182 pik_flags |= (update_flags & OPFLAG_SAVEPOSITION);
118183 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
118184 if( update_flags==0 ){
118185 int r = sqlite3GetTempReg(pParse);
118186 sqlite3VdbeAddOp2(v, OP_Integer, 0, r);
118187 sqlite3VdbeAddOp4(v, OP_Insert,
118188 iIdxCur+i, aRegIdx[i], r, (char*)pTab, P4_TABLE
118189 );
118190 sqlite3VdbeChangeP5(v, OPFLAG_ISNOOP);
118191 sqlite3ReleaseTempReg(pParse, r);
118192 }
118193 #endif
118194 }
118195 sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i],
118196 aRegIdx[i]+1,
@@ -118533,11 +118611,11 @@
118611 addr2 = sqlite3VdbeAddOp3(v, OP_NotExists, iDest, 0, regRowid);
118612 VdbeCoverage(v);
118613 sqlite3RowidConstraint(pParse, onError, pDest);
118614 sqlite3VdbeJumpHere(v, addr2);
118615 autoIncStep(pParse, regAutoinc, regRowid);
118616 }else if( pDest->pIndex==0 && !(db->mDbFlags & DBFLAG_Vacuum) ){
118617 addr1 = sqlite3VdbeAddOp2(v, OP_NewRowid, iDest, regRowid);
118618 }else{
118619 addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);
118620 assert( (pDest->tabFlags & TF_Autoincrement)==0 );
118621 }
@@ -118596,11 +118674,11 @@
118674 if( i==pSrcIdx->nColumn ){
118675 idxInsFlags = OPFLAG_USESEEKRESULT;
118676 sqlite3VdbeAddOp1(v, OP_SeekEnd, iDest);
118677 }
118678 }
118679 if( !HasRowid(pSrc) && pDestIdx->idxType==SQLITE_IDXTYPE_PRIMARYKEY ){
118680 idxInsFlags |= OPFLAG_NCHANGE;
118681 }
118682 sqlite3VdbeAddOp2(v, OP_IdxInsert, iDest, regData);
118683 sqlite3VdbeChangeP5(v, idxInsFlags|OPFLAG_APPEND);
118684 sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1+1); VdbeCoverage(v);
@@ -136425,11 +136503,10 @@
136503 pIn += i;
136504 for(i=iEq;i<pLoop->nLTerm; i++){
136505 if( pLoop->aLTerm[i]->pExpr==pX ){
136506 int iOut = iReg + i - iEq;
136507 if( eType==IN_INDEX_ROWID ){
 
136508 pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iOut);
136509 }else{
136510 int iCol = aiMap ? aiMap[iMap++] : 0;
136511 pIn->addrInTop = sqlite3VdbeAddOp3(v,OP_Column,iTab, iCol, iOut);
136512 }
@@ -137187,10 +137264,13 @@
137264 if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg);
137265 addrNxt = pLevel->addrNxt;
137266 sqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg);
137267 VdbeCoverage(v);
137268 pLevel->op = OP_Noop;
137269 if( (pTerm->prereqAll & pLevel->notReady)==0 ){
137270 pTerm->wtFlags |= TERM_CODED;
137271 }
137272 }else if( (pLoop->wsFlags & WHERE_IPK)!=0
137273 && (pLoop->wsFlags & WHERE_COLUMN_RANGE)!=0
137274 ){
137275 /* Case 3: We have an inequality comparison against the ROWID field.
137276 */
@@ -153009,10 +153089,11 @@
153089 int n = 0; /* Length of the next token token */
153090 int tokenType; /* type of the next token */
153091 int lastTokenParsed = -1; /* type of the previous token */
153092 sqlite3 *db = pParse->db; /* The database connection */
153093 int mxSqlLen; /* Max length of an SQL string */
153094 VVA_ONLY( u8 startedWithOom = db->mallocFailed );
153095 #ifdef sqlite3Parser_ENGINEALWAYSONSTACK
153096 yyParser sEngine; /* Space to hold the Lemon-generated Parser object */
153097 #endif
153098
153099 assert( zSql!=0 );
@@ -153043,10 +153124,12 @@
153124 #endif
153125 assert( pParse->pNewTable==0 );
153126 assert( pParse->pNewTrigger==0 );
153127 assert( pParse->nVar==0 );
153128 assert( pParse->pVList==0 );
153129 pParse->pParentParse = db->pParse;
153130 db->pParse = pParse;
153131 while( 1 ){
153132 n = sqlite3GetToken((u8*)zSql, &tokenType);
153133 mxSqlLen -= n;
153134 if( mxSqlLen<0 ){
153135 pParse->rc = SQLITE_TOOBIG;
@@ -153099,11 +153182,12 @@
153182 pParse->sLastToken.z = zSql;
153183 pParse->sLastToken.n = n;
153184 sqlite3Parser(pEngine, tokenType, pParse->sLastToken);
153185 lastTokenParsed = tokenType;
153186 zSql += n;
153187 assert( db->mallocFailed==0 || pParse->rc!=SQLITE_OK || startedWithOom );
153188 if( pParse->rc!=SQLITE_OK ) break;
153189 }
153190 assert( nErr==0 );
153191 #ifdef YYTRACKMAXSTACKDEPTH
153192 sqlite3_mutex_enter(sqlite3MallocMutex());
153193 sqlite3StatusHighwater(SQLITE_STATUS_PARSER_STACK,
@@ -153167,10 +153251,12 @@
153251 while( pParse->pZombieTab ){
153252 Table *p = pParse->pZombieTab;
153253 pParse->pZombieTab = p->pNextZombie;
153254 sqlite3DeleteTable(db, p);
153255 }
153256 db->pParse = pParse->pParentParse;
153257 pParse->pParentParse = 0;
153258 assert( nErr==0 || pParse->rc!=SQLITE_OK );
153259 return nErr;
153260 }
153261
153262
@@ -170805,11 +170891,13 @@
170891
170892 fts3SegReaderSetEof(pReader);
170893
170894 /* If iCurrentBlock>=iLeafEndBlock, this is an EOF condition. All leaf
170895 ** blocks have already been traversed. */
170896 #ifdef CORRUPT_DB
170897 assert( pReader->iCurrentBlock<=pReader->iLeafEndBlock || CORRUPT_DB );
170898 #endif
170899 if( pReader->iCurrentBlock>=pReader->iLeafEndBlock ){
170900 return SQLITE_OK;
170901 }
170902
170903 rc = sqlite3Fts3ReadBlock(
@@ -172692,12 +172780,14 @@
172780 bIgnoreEmpty = (iLevel!=FTS3_SEGCURSOR_PENDING) && (iNewLevel>iMaxLevel);
172781 }
172782 if( rc!=SQLITE_OK ) goto finished;
172783
172784 assert( csr.nSegment>0 );
172785 assert_fts3_nc( iNewLevel>=getAbsoluteLevel(p, iLangid, iIndex, 0) );
172786 assert_fts3_nc(
172787 iNewLevel<getAbsoluteLevel(p, iLangid, iIndex,FTS3_SEGDIR_MAXLEVEL)
172788 );
172789
172790 memset(&filter, 0, sizeof(Fts3SegFilter));
172791 filter.flags = FTS3_SEGMENT_REQUIRE_POS;
172792 filter.flags |= (bIgnoreEmpty ? FTS3_SEGMENT_IGNORE_EMPTY : 0);
172793
@@ -176712,11 +176802,11 @@
176802 UNUSED_PARAMETER(iPhrase);
176803 rc = sqlite3Fts3EvalPhrasePoslist(p->pCsr, pExpr, p->iCol, &pList);
176804 nTerm = pExpr->pPhrase->nToken;
176805 if( pList ){
176806 fts3GetDeltaPosition(&pList, &iPos);
176807 assert_fts3_nc( iPos>=0 );
176808 }
176809
176810 for(iTerm=0; iTerm<nTerm; iTerm++){
176811 TermOffset *pT = &p->aTerm[p->iTerm++];
176812 pT->iOff = nTerm-iTerm-1;
@@ -176822,11 +176912,11 @@
176912
176913 if( !pTerm ){
176914 /* All offsets for this column have been gathered. */
176915 rc = SQLITE_DONE;
176916 }else{
176917 assert_fts3_nc( iCurrent<=iMinPos );
176918 if( 0==(0xFE&*pTerm->pList) ){
176919 pTerm->pList = 0;
176920 }else{
176921 fts3GetDeltaPosition(&pTerm->pList, &pTerm->iPos);
176922 }
@@ -188622,10 +188712,11 @@
188712 if( aOut==0 ){
188713 sqlite3_result_error_nomem(context);
188714 }else{
188715 nOut2 = rbuDeltaApply(aOrig, nOrig, aDelta, nDelta, aOut);
188716 if( nOut2!=nOut ){
188717 sqlite3_free(aOut);
188718 sqlite3_result_error(context, "corrupt fossil delta", -1);
188719 }else{
188720 sqlite3_result_blob(context, aOut, nOut, sqlite3_free);
188721 }
188722 }
@@ -199681,11 +199772,11 @@
199772 ** xSetAuxdata(pFts5, pAux, xDelete)
199773 **
199774 ** Save the pointer passed as the second argument as the extension functions
199775 ** "auxiliary data". The pointer may then be retrieved by the current or any
199776 ** future invocation of the same fts5 extension function made as part of
199777 ** the same MATCH query using the xGetAuxdata() API.
199778 **
199779 ** Each extension function is allocated a single auxiliary data slot for
199780 ** each FTS query (MATCH expression). If the extension function is invoked
199781 ** more than once for a single FTS query, then all invocations share a
199782 ** single auxiliary data context.
@@ -199696,11 +199787,11 @@
199787 ** point.
199788 **
199789 ** The xDelete callback, if one is specified, is also invoked on the
199790 ** auxiliary data pointer after the FTS5 query has finished.
199791 **
199792 ** If an error (e.g. an OOM condition) occurs within this function,
199793 ** the auxiliary data is set to NULL and an error code returned. If the
199794 ** xDelete parameter was not NULL, it is invoked on the auxiliary data
199795 ** pointer before returning.
199796 **
199797 **
@@ -212031,17 +212122,18 @@
212122 }
212123
212124 /* Set up the new page-index array */
212125 fts5BufferAppendVarint(&p->rc, &buf, 4);
212126 if( pSeg->iLeafPgno==pSeg->iTermLeafPgno
212127 && pSeg->iEndofDoclist<pData->szLeaf
212128 && pSeg->iPgidxOff<=pData->nn
212129 ){
212130 int nDiff = pData->szLeaf - pSeg->iEndofDoclist;
212131 fts5BufferAppendVarint(&p->rc, &buf, buf.n - 1 - nDiff - 4);
212132 fts5BufferAppendBlob(&p->rc, &buf,
212133 pData->nn - pSeg->iPgidxOff, &pData->p[pSeg->iPgidxOff]
212134 );
212135 }
212136
212137 pSeg->pSeg->pgnoFirst = pSeg->iTermLeafPgno;
212138 fts5DataDelete(p, FTS5_SEGMENT_ROWID(iId, 1), iLeafRowid);
212139 fts5DataWrite(p, iLeafRowid, buf.p, buf.n);
@@ -217074,11 +217166,11 @@
217166 int nArg, /* Number of args */
217167 sqlite3_value **apUnused /* Function arguments */
217168 ){
217169 assert( nArg==0 );
217170 UNUSED_PARAM2(nArg, apUnused);
217171 sqlite3_result_text(pCtx, "fts5: 2019-02-25 14:52:43 9da4fb59b28686630d63a79988b458726332cf06cc0e6e84d7c0a7600f5fcab0", -1, SQLITE_TRANSIENT);
217172 }
217173
217174 /*
217175 ** Return true if zName is the extension on one of the shadow tables used
217176 ** by this module.
@@ -221838,12 +221930,12 @@
221930 }
221931 #endif /* SQLITE_CORE */
221932 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
221933
221934 /************** End of stmt.c ************************************************/
221935 #if __LINE__!=221935
221936 #undef SQLITE_SOURCE_ID
221937 #define SQLITE_SOURCE_ID "2019-02-25 14:52:43 9da4fb59b28686630d63a79988b458726332cf06cc0e6e84d7c0a7600f5falt2"
221938 #endif
221939 /* Return the source-id for this library */
221940 SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
221941 /************************** End of sqlite3.c ******************************/
221942
+6 -6
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,13 +121,13 @@
121121
**
122122
** See also: [sqlite3_libversion()],
123123
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124124
** [sqlite_version()] and [sqlite_source_id()].
125125
*/
126
-#define SQLITE_VERSION "3.27.1"
127
-#define SQLITE_VERSION_NUMBER 3027001
128
-#define SQLITE_SOURCE_ID "2019-02-08 13:17:39 0eca3dd3d38b31c92b49ca2d311128b74584714d9e7de895b1a6286ef959a1dd"
126
+#define SQLITE_VERSION "3.28.0"
127
+#define SQLITE_VERSION_NUMBER 3028000
128
+#define SQLITE_SOURCE_ID "2019-02-25 14:52:43 9da4fb59b28686630d63a79988b458726332cf06cc0e6e84d7c0a7600f5fcab0"
129129
130130
/*
131131
** CAPI3REF: Run-Time Library Version Numbers
132132
** KEYWORDS: sqlite3_version sqlite3_sourceid
133133
**
@@ -2367,11 +2367,11 @@
23672367
** ^Changes made as part of [foreign key actions] are included in the
23682368
** count, but those made as part of REPLACE constraint resolution are
23692369
** not. ^Changes to a view that are intercepted by INSTEAD OF triggers
23702370
** are not counted.
23712371
**
2372
-** This the [sqlite3_total_changes(D)] interface only reports the number
2372
+** The [sqlite3_total_changes(D)] interface only reports the number
23732373
** of rows that changed due to SQL statement run against database
23742374
** connection D. Any changes by other database connections are ignored.
23752375
** To detect changes against a database file from other database
23762376
** connections use the [PRAGMA data_version] command or the
23772377
** [SQLITE_FCNTL_DATA_VERSION] [file control].
@@ -11299,11 +11299,11 @@
1129911299
** xSetAuxdata(pFts5, pAux, xDelete)
1130011300
**
1130111301
** Save the pointer passed as the second argument as the extension functions
1130211302
** "auxiliary data". The pointer may then be retrieved by the current or any
1130311303
** future invocation of the same fts5 extension function made as part of
11304
-** of the same MATCH query using the xGetAuxdata() API.
11304
+** the same MATCH query using the xGetAuxdata() API.
1130511305
**
1130611306
** Each extension function is allocated a single auxiliary data slot for
1130711307
** each FTS query (MATCH expression). If the extension function is invoked
1130811308
** more than once for a single FTS query, then all invocations share a
1130911309
** single auxiliary data context.
@@ -11314,11 +11314,11 @@
1131411314
** point.
1131511315
**
1131611316
** The xDelete callback, if one is specified, is also invoked on the
1131711317
** auxiliary data pointer after the FTS5 query has finished.
1131811318
**
11319
-** If an error (e.g. an OOM condition) occurs within this function, an
11319
+** If an error (e.g. an OOM condition) occurs within this function,
1132011320
** the auxiliary data is set to NULL and an error code returned. If the
1132111321
** xDelete parameter was not NULL, it is invoked on the auxiliary data
1132211322
** pointer before returning.
1132311323
**
1132411324
**
1132511325
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,13 +121,13 @@
121 **
122 ** See also: [sqlite3_libversion()],
123 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124 ** [sqlite_version()] and [sqlite_source_id()].
125 */
126 #define SQLITE_VERSION "3.27.1"
127 #define SQLITE_VERSION_NUMBER 3027001
128 #define SQLITE_SOURCE_ID "2019-02-08 13:17:39 0eca3dd3d38b31c92b49ca2d311128b74584714d9e7de895b1a6286ef959a1dd"
129
130 /*
131 ** CAPI3REF: Run-Time Library Version Numbers
132 ** KEYWORDS: sqlite3_version sqlite3_sourceid
133 **
@@ -2367,11 +2367,11 @@
2367 ** ^Changes made as part of [foreign key actions] are included in the
2368 ** count, but those made as part of REPLACE constraint resolution are
2369 ** not. ^Changes to a view that are intercepted by INSTEAD OF triggers
2370 ** are not counted.
2371 **
2372 ** This the [sqlite3_total_changes(D)] interface only reports the number
2373 ** of rows that changed due to SQL statement run against database
2374 ** connection D. Any changes by other database connections are ignored.
2375 ** To detect changes against a database file from other database
2376 ** connections use the [PRAGMA data_version] command or the
2377 ** [SQLITE_FCNTL_DATA_VERSION] [file control].
@@ -11299,11 +11299,11 @@
11299 ** xSetAuxdata(pFts5, pAux, xDelete)
11300 **
11301 ** Save the pointer passed as the second argument as the extension functions
11302 ** "auxiliary data". The pointer may then be retrieved by the current or any
11303 ** future invocation of the same fts5 extension function made as part of
11304 ** of the same MATCH query using the xGetAuxdata() API.
11305 **
11306 ** Each extension function is allocated a single auxiliary data slot for
11307 ** each FTS query (MATCH expression). If the extension function is invoked
11308 ** more than once for a single FTS query, then all invocations share a
11309 ** single auxiliary data context.
@@ -11314,11 +11314,11 @@
11314 ** point.
11315 **
11316 ** The xDelete callback, if one is specified, is also invoked on the
11317 ** auxiliary data pointer after the FTS5 query has finished.
11318 **
11319 ** If an error (e.g. an OOM condition) occurs within this function, an
11320 ** the auxiliary data is set to NULL and an error code returned. If the
11321 ** xDelete parameter was not NULL, it is invoked on the auxiliary data
11322 ** pointer before returning.
11323 **
11324 **
11325
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,13 +121,13 @@
121 **
122 ** See also: [sqlite3_libversion()],
123 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124 ** [sqlite_version()] and [sqlite_source_id()].
125 */
126 #define SQLITE_VERSION "3.28.0"
127 #define SQLITE_VERSION_NUMBER 3028000
128 #define SQLITE_SOURCE_ID "2019-02-25 14:52:43 9da4fb59b28686630d63a79988b458726332cf06cc0e6e84d7c0a7600f5fcab0"
129
130 /*
131 ** CAPI3REF: Run-Time Library Version Numbers
132 ** KEYWORDS: sqlite3_version sqlite3_sourceid
133 **
@@ -2367,11 +2367,11 @@
2367 ** ^Changes made as part of [foreign key actions] are included in the
2368 ** count, but those made as part of REPLACE constraint resolution are
2369 ** not. ^Changes to a view that are intercepted by INSTEAD OF triggers
2370 ** are not counted.
2371 **
2372 ** The [sqlite3_total_changes(D)] interface only reports the number
2373 ** of rows that changed due to SQL statement run against database
2374 ** connection D. Any changes by other database connections are ignored.
2375 ** To detect changes against a database file from other database
2376 ** connections use the [PRAGMA data_version] command or the
2377 ** [SQLITE_FCNTL_DATA_VERSION] [file control].
@@ -11299,11 +11299,11 @@
11299 ** xSetAuxdata(pFts5, pAux, xDelete)
11300 **
11301 ** Save the pointer passed as the second argument as the extension functions
11302 ** "auxiliary data". The pointer may then be retrieved by the current or any
11303 ** future invocation of the same fts5 extension function made as part of
11304 ** the same MATCH query using the xGetAuxdata() API.
11305 **
11306 ** Each extension function is allocated a single auxiliary data slot for
11307 ** each FTS query (MATCH expression). If the extension function is invoked
11308 ** more than once for a single FTS query, then all invocations share a
11309 ** single auxiliary data context.
@@ -11314,11 +11314,11 @@
11314 ** point.
11315 **
11316 ** The xDelete callback, if one is specified, is also invoked on the
11317 ** auxiliary data pointer after the FTS5 query has finished.
11318 **
11319 ** If an error (e.g. an OOM condition) occurs within this function,
11320 ** the auxiliary data is set to NULL and an error code returned. If the
11321 ** xDelete parameter was not NULL, it is invoked on the auxiliary data
11322 ** pointer before returning.
11323 **
11324 **
11325
+1 -1
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -972,11 +972,11 @@
972972
return TH_OK;
973973
}
974974
} while( --aFileName[TCL_MINOR_OFFSET]>'3' ); /* Tcl 8.4+ */
975975
aFileName[TCL_MINOR_OFFSET] = 'x';
976976
Th_ErrorMessage(interp,
977
- "could not load any supported Tcl 8.6, 8.5, or 8.4 shared library \"",
977
+ "could not load any supported Tcl 8.x shared library \"",
978978
aFileName, -1);
979979
return TH_ERROR;
980980
#else
981981
*phLibrary = 0;
982982
*pxFindExecutable = Tcl_FindExecutable;
983983
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -972,11 +972,11 @@
972 return TH_OK;
973 }
974 } while( --aFileName[TCL_MINOR_OFFSET]>'3' ); /* Tcl 8.4+ */
975 aFileName[TCL_MINOR_OFFSET] = 'x';
976 Th_ErrorMessage(interp,
977 "could not load any supported Tcl 8.6, 8.5, or 8.4 shared library \"",
978 aFileName, -1);
979 return TH_ERROR;
980 #else
981 *phLibrary = 0;
982 *pxFindExecutable = Tcl_FindExecutable;
983
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -972,11 +972,11 @@
972 return TH_OK;
973 }
974 } while( --aFileName[TCL_MINOR_OFFSET]>'3' ); /* Tcl 8.4+ */
975 aFileName[TCL_MINOR_OFFSET] = 'x';
976 Th_ErrorMessage(interp,
977 "could not load any supported Tcl 8.x shared library \"",
978 aFileName, -1);
979 return TH_ERROR;
980 #else
981 *phLibrary = 0;
982 *pxFindExecutable = Tcl_FindExecutable;
983
+155 -130
--- src/unicode.c
+++ src/unicode.c
@@ -59,17 +59,17 @@
5959
0x002A0403, 0x002AF001, 0x002AF808, 0x002B1C03, 0x002B2C03,
6060
0x002B8802, 0x002BC002, 0x002BE806, 0x002C0403, 0x002CF001,
6161
0x002CF807, 0x002D1C02, 0x002D2C03, 0x002D5802, 0x002D8802,
6262
0x002DC001, 0x002E0801, 0x002EF805, 0x002F1803, 0x002F2804,
6363
0x002F5C01, 0x002FCC08, 0x00300005, 0x0030F807, 0x00311803,
64
- 0x00312804, 0x00315402, 0x00318802, 0x0031FC01, 0x00320404,
65
- 0x0032F001, 0x0032F807, 0x00331803, 0x00332804, 0x00335402,
66
- 0x00338802, 0x00340004, 0x0034EC02, 0x0034F807, 0x00351803,
67
- 0x00352804, 0x00353C01, 0x00355C01, 0x00358802, 0x0035E401,
68
- 0x00360802, 0x00372801, 0x00373C06, 0x00375801, 0x00376008,
69
- 0x0037C803, 0x0038C401, 0x0038D007, 0x0038FC01, 0x00391C09,
70
- 0x00396802, 0x003AC401, 0x003AD006, 0x003AEC02, 0x003B2006,
64
+ 0x00312804, 0x00315402, 0x00318802, 0x0031DC01, 0x0031FC01,
65
+ 0x00320404, 0x0032F001, 0x0032F807, 0x00331803, 0x00332804,
66
+ 0x00335402, 0x00338802, 0x00340004, 0x0034EC02, 0x0034F807,
67
+ 0x00351803, 0x00352804, 0x00353C01, 0x00355C01, 0x00358802,
68
+ 0x0035E401, 0x00360802, 0x00372801, 0x00373C06, 0x00375801,
69
+ 0x00376008, 0x0037C803, 0x0038C401, 0x0038D007, 0x0038FC01,
70
+ 0x00391C09, 0x00396802, 0x003AC401, 0x003AD009, 0x003B2006,
7171
0x003C041F, 0x003CD00C, 0x003DC417, 0x003E340B, 0x003E6424,
7272
0x003EF80F, 0x003F380D, 0x0040AC14, 0x00412806, 0x00415804,
7373
0x00417803, 0x00418803, 0x00419C07, 0x0041C404, 0x0042080C,
7474
0x00423C01, 0x00426806, 0x0043EC01, 0x004D740C, 0x004E400A,
7575
0x00500001, 0x0059B402, 0x005A0001, 0x005A6C02, 0x005BAC03,
@@ -78,71 +78,75 @@
7878
0x0064800C, 0x0064C00C, 0x00650001, 0x00651002, 0x00677822,
7979
0x00685C05, 0x00687802, 0x0069540A, 0x0069801D, 0x0069FC01,
8080
0x006A8007, 0x006AA006, 0x006AC00F, 0x006C0005, 0x006CD011,
8181
0x006D6823, 0x006E0003, 0x006E840D, 0x006F980E, 0x006FF004,
8282
0x00709014, 0x0070EC05, 0x0071F802, 0x00730008, 0x00734019,
83
- 0x0073B401, 0x0073C803, 0x0073DC03, 0x0077003A, 0x0077EC05,
83
+ 0x0073B401, 0x0073D001, 0x0073DC03, 0x0077003A, 0x0077EC05,
8484
0x007EF401, 0x007EFC03, 0x007F3403, 0x007F7403, 0x007FB403,
8585
0x007FF402, 0x00800065, 0x0081980A, 0x0081E805, 0x00822805,
8686
0x00828020, 0x00834021, 0x00840002, 0x00840C04, 0x00842002,
8787
0x00845001, 0x00845803, 0x00847806, 0x00849401, 0x00849C01,
8888
0x0084A401, 0x0084B801, 0x0084E802, 0x00850005, 0x00852804,
8989
0x00853C01, 0x00862802, 0x00864297, 0x0091000B, 0x0092704E,
90
- 0x00940276, 0x009E53E0, 0x00ADD820, 0x00AE6031, 0x00AF2835,
91
- 0x00B39406, 0x00B3BC03, 0x00B3E404, 0x00B3F802, 0x00B5C001,
92
- 0x00B5FC01, 0x00B7804F, 0x00B8C01F, 0x00BA001A, 0x00BA6C59,
93
- 0x00BC00D6, 0x00BFC00C, 0x00C00005, 0x00C02019, 0x00C0A807,
94
- 0x00C0D802, 0x00C0F403, 0x00C26404, 0x00C28001, 0x00C3EC01,
95
- 0x00C64002, 0x00C6580A, 0x00C70024, 0x00C8001F, 0x00C8A81E,
96
- 0x00C94001, 0x00C98020, 0x00CA2827, 0x00CB003F, 0x00CC0100,
97
- 0x01370040, 0x02924037, 0x0293F802, 0x02983403, 0x0299BC10,
98
- 0x029A7802, 0x029BC008, 0x029C0017, 0x029C8002, 0x029E2402,
99
- 0x02A00801, 0x02A01801, 0x02A02C01, 0x02A08C09, 0x02A0D804,
100
- 0x02A1D004, 0x02A20002, 0x02A2D012, 0x02A33802, 0x02A38012,
101
- 0x02A3E003, 0x02A3F001, 0x02A3FC01, 0x02A4980A, 0x02A51C0D,
102
- 0x02A57C01, 0x02A60004, 0x02A6CC1B, 0x02A77802, 0x02A79401,
103
- 0x02A8A40E, 0x02A90C01, 0x02A93002, 0x02A97004, 0x02A9DC03,
104
- 0x02A9EC03, 0x02AAC001, 0x02AAC803, 0x02AADC02, 0x02AAF802,
105
- 0x02AB0401, 0x02AB7802, 0x02ABAC07, 0x02ABD402, 0x02AD6C01,
106
- 0x02AF8C0B, 0x03600001, 0x036DFC02, 0x036FFC02, 0x037FFC01,
107
- 0x03EC7801, 0x03ECA401, 0x03EEC810, 0x03F4F802, 0x03F7F002,
108
- 0x03F8001A, 0x03F88033, 0x03F95013, 0x03F9A004, 0x03FBFC01,
109
- 0x03FC040F, 0x03FC6807, 0x03FCEC06, 0x03FD6C0B, 0x03FF8007,
110
- 0x03FFA007, 0x03FFE405, 0x04040003, 0x0404DC09, 0x0405E411,
111
- 0x04063003, 0x0406400C, 0x04068001, 0x0407402E, 0x040B8001,
112
- 0x040DD805, 0x040E7C01, 0x040F4001, 0x0415BC01, 0x04215C01,
113
- 0x0421DC02, 0x04247C01, 0x0424FC01, 0x04280403, 0x04281402,
114
- 0x04283004, 0x0428E003, 0x0428FC01, 0x04294009, 0x0429FC01,
115
- 0x042B2001, 0x042B9402, 0x042BC007, 0x042CE407, 0x042E6404,
116
- 0x04349004, 0x043D180B, 0x043D5405, 0x04400003, 0x0440E016,
117
- 0x0441FC04, 0x0442C012, 0x04433401, 0x04440003, 0x04449C0E,
118
- 0x04450004, 0x04451402, 0x0445CC03, 0x04460003, 0x0446CC0E,
119
- 0x04471409, 0x04476C01, 0x04477403, 0x0448B013, 0x044AA401,
120
- 0x044B7C0C, 0x044C0004, 0x044CEC02, 0x044CF807, 0x044D1C02,
121
- 0x044D2C03, 0x044D5C01, 0x044D8802, 0x044D9807, 0x044DC005,
122
- 0x0450D412, 0x04512C05, 0x04516C01, 0x04517402, 0x0452C014,
123
- 0x04531801, 0x0456BC07, 0x0456E020, 0x04577002, 0x0458C014,
124
- 0x0459800D, 0x045AAC0D, 0x045C740F, 0x045CF004, 0x0460B010,
125
- 0x0468040A, 0x0468CC07, 0x0468EC0D, 0x0469440B, 0x046A2813,
126
- 0x046A7805, 0x0470BC08, 0x0470E008, 0x04710405, 0x0471C002,
127
- 0x04724816, 0x0472A40E, 0x0474C406, 0x0474E801, 0x0474F002,
128
- 0x0474FC07, 0x04751C01, 0x04762805, 0x04764002, 0x04764C05,
129
- 0x047BCC06, 0x0491C005, 0x05A9B802, 0x05ABC006, 0x05ACC010,
130
- 0x05AD1002, 0x05BA5C04, 0x05BD442E, 0x05BE3C04, 0x06F27008,
131
- 0x074000F6, 0x07440027, 0x0744A4C0, 0x07480046, 0x074C0057,
132
- 0x075B0401, 0x075B6C01, 0x075BEC01, 0x075C5401, 0x075CD401,
133
- 0x075D3C01, 0x075DBC01, 0x075E2401, 0x075EA401, 0x075F0C01,
134
- 0x0760028C, 0x076A6C05, 0x076A840F, 0x07800007, 0x07802011,
135
- 0x07806C07, 0x07808C02, 0x07809805, 0x07A34007, 0x07A51007,
136
- 0x07A57802, 0x07B2B001, 0x07B2C001, 0x07BBC002, 0x07C0002C,
137
- 0x07C0C064, 0x07C2800F, 0x07C2C40F, 0x07C3040F, 0x07C34425,
138
- 0x07C4405C, 0x07C5C03D, 0x07C7981D, 0x07C8402C, 0x07C90009,
139
- 0x07C94002, 0x07C98006, 0x07CC03D5, 0x07DB800D, 0x07DBC00A,
140
- 0x07DC0074, 0x07DE0059, 0x07E0000C, 0x07E04038, 0x07E1400A,
141
- 0x07E18028, 0x07E2401E, 0x07E4000C, 0x07E4402F, 0x07E50031,
142
- 0x07E5CC04, 0x07E5E801, 0x07E5F027, 0x07E6C00A, 0x07E70003,
143
- 0x07E74030, 0x07E9800E, 0x38000401, 0x38008060, 0x380400F0,
90
+ 0x00940276, 0x009E53E0, 0x00ADD820, 0x00AE6068, 0x00B39406,
91
+ 0x00B3BC03, 0x00B3E404, 0x00B3F802, 0x00B5C001, 0x00B5FC01,
92
+ 0x00B7804F, 0x00B8C020, 0x00BA001A, 0x00BA6C59, 0x00BC00D6,
93
+ 0x00BFC00C, 0x00C00005, 0x00C02019, 0x00C0A807, 0x00C0D802,
94
+ 0x00C0F403, 0x00C26404, 0x00C28001, 0x00C3EC01, 0x00C64002,
95
+ 0x00C6580A, 0x00C70024, 0x00C8001F, 0x00C8A81E, 0x00C94001,
96
+ 0x00C98020, 0x00CA2827, 0x00CB003F, 0x00CC0100, 0x01370040,
97
+ 0x02924037, 0x0293F802, 0x02983403, 0x0299BC10, 0x029A7802,
98
+ 0x029BC008, 0x029C0017, 0x029C8002, 0x029E2402, 0x02A00801,
99
+ 0x02A01801, 0x02A02C01, 0x02A08C09, 0x02A0D804, 0x02A1D004,
100
+ 0x02A20002, 0x02A2D012, 0x02A33802, 0x02A38012, 0x02A3E003,
101
+ 0x02A3F001, 0x02A3FC01, 0x02A4980A, 0x02A51C0D, 0x02A57C01,
102
+ 0x02A60004, 0x02A6CC1B, 0x02A77802, 0x02A79401, 0x02A8A40E,
103
+ 0x02A90C01, 0x02A93002, 0x02A97004, 0x02A9DC03, 0x02A9EC03,
104
+ 0x02AAC001, 0x02AAC803, 0x02AADC02, 0x02AAF802, 0x02AB0401,
105
+ 0x02AB7802, 0x02ABAC07, 0x02ABD402, 0x02AD6C01, 0x02AF8C0B,
106
+ 0x03600001, 0x036DFC02, 0x036FFC02, 0x037FFC01, 0x03EC7801,
107
+ 0x03ECA401, 0x03EEC810, 0x03F4F802, 0x03F7F002, 0x03F8001A,
108
+ 0x03F88033, 0x03F95013, 0x03F9A004, 0x03FBFC01, 0x03FC040F,
109
+ 0x03FC6807, 0x03FCEC06, 0x03FD6C0B, 0x03FF8007, 0x03FFA007,
110
+ 0x03FFE405, 0x04040003, 0x0404DC09, 0x0405E411, 0x04063003,
111
+ 0x0406400C, 0x04068001, 0x0407402E, 0x040B8001, 0x040DD805,
112
+ 0x040E7C01, 0x040F4001, 0x0415BC01, 0x04215C01, 0x0421DC02,
113
+ 0x04247C01, 0x0424FC01, 0x04280403, 0x04281402, 0x04283004,
114
+ 0x0428E003, 0x0428FC01, 0x04294009, 0x0429FC01, 0x042B2001,
115
+ 0x042B9402, 0x042BC007, 0x042CE407, 0x042E6404, 0x04349004,
116
+ 0x043D180B, 0x043D5405, 0x04400003, 0x0440E016, 0x0441FC04,
117
+ 0x0442C012, 0x04433401, 0x04440003, 0x04449C0E, 0x04450004,
118
+ 0x04451402, 0x0445CC03, 0x04460003, 0x0446CC0E, 0x04471409,
119
+ 0x04476C01, 0x04477403, 0x0448B013, 0x044AA401, 0x044B7C0C,
120
+ 0x044C0004, 0x044CEC02, 0x044CF807, 0x044D1C02, 0x044D2C03,
121
+ 0x044D5C01, 0x044D8802, 0x044D9807, 0x044DC005, 0x0450D412,
122
+ 0x04512C05, 0x04516C01, 0x04517402, 0x0452C014, 0x04531801,
123
+ 0x0456BC07, 0x0456E020, 0x04577002, 0x0458C014, 0x0459800D,
124
+ 0x045AAC0D, 0x045C740F, 0x045CF004, 0x0460B010, 0x04674407,
125
+ 0x04676807, 0x04678801, 0x04679001, 0x0468040A, 0x0468CC07,
126
+ 0x0468EC0D, 0x0469440B, 0x046A2813, 0x046A7805, 0x0470BC08,
127
+ 0x0470E008, 0x04710405, 0x0471C002, 0x04724816, 0x0472A40E,
128
+ 0x0474C406, 0x0474E801, 0x0474F002, 0x0474FC07, 0x04751C01,
129
+ 0x04762805, 0x04764002, 0x04764C05, 0x047BCC06, 0x047F541D,
130
+ 0x047FFC01, 0x0491C005, 0x04D0C009, 0x05A9B802, 0x05ABC006,
131
+ 0x05ACC010, 0x05AD1002, 0x05BA5C04, 0x05BD3C01, 0x05BD4437,
132
+ 0x05BE3C04, 0x05BF8801, 0x06F27008, 0x074000F6, 0x07440027,
133
+ 0x0744A4C0, 0x07480046, 0x074C0057, 0x075B0401, 0x075B6C01,
134
+ 0x075BEC01, 0x075C5401, 0x075CD401, 0x075D3C01, 0x075DBC01,
135
+ 0x075E2401, 0x075EA401, 0x075F0C01, 0x0760028C, 0x076A6C05,
136
+ 0x076A840F, 0x07800007, 0x07802011, 0x07806C07, 0x07808C02,
137
+ 0x07809805, 0x0784C007, 0x07853C01, 0x078BB004, 0x078BFC01,
138
+ 0x07A34007, 0x07A51007, 0x07A57802, 0x07B2B001, 0x07B2C001,
139
+ 0x07B4B801, 0x07BBC002, 0x07C0002C, 0x07C0C064, 0x07C2800F,
140
+ 0x07C2C40F, 0x07C3040F, 0x07C34425, 0x07C4405D, 0x07C5C03D,
141
+ 0x07C7981D, 0x07C8402C, 0x07C90009, 0x07C94002, 0x07C98006,
142
+ 0x07CC03D6, 0x07DB800D, 0x07DBC00B, 0x07DC0074, 0x07DE0059,
143
+ 0x07DF800C, 0x07E0000C, 0x07E04038, 0x07E1400A, 0x07E18028,
144
+ 0x07E2401E, 0x07E4000C, 0x07E43465, 0x07E5CC04, 0x07E5E829,
145
+ 0x07E69406, 0x07E6B81D, 0x07E73487, 0x07E9800E, 0x07E9C004,
146
+ 0x07E9E003, 0x07EA0003, 0x07EA4006, 0x38000401, 0x38008060,
147
+ 0x380400F0,
144148
};
145149
static const unsigned int aAscii[4] = {
146150
0xFFFFFFFF, 0xFC00FFFF, 0xF8000001, 0xF8000001,
147151
};
148152
@@ -176,36 +180,52 @@
176180
** of the ASCII letter only. For example, if passed 235 - "LATIN
177181
** SMALL LETTER E WITH DIAERESIS" - return 65 ("LATIN SMALL LETTER
178182
** E"). The resuls of passing a codepoint that corresponds to an
179183
** uppercase letter are undefined.
180184
*/
181
-static int unicode_remove_diacritic(int c){
185
+static int unicode_remove_diacritic(int c, int bComplex){
182186
static const unsigned short aDia[] = {
183187
0, 1797, 1848, 1859, 1891, 1928, 1940, 1995,
184188
2024, 2040, 2060, 2110, 2168, 2206, 2264, 2286,
185189
2344, 2383, 2472, 2488, 2516, 2596, 2668, 2732,
186190
2782, 2842, 2894, 2954, 2984, 3000, 3028, 3336,
187
- 3456, 3696, 3712, 3728, 3744, 3896, 3912, 3928,
188
- 3968, 4008, 4040, 4106, 4138, 4170, 4202, 4234,
189
- 4266, 4296, 4312, 4344, 4408, 4424, 4472, 4504,
190
- 6148, 6198, 6264, 6280, 6360, 6429, 6505, 6529,
191
- 61448, 61468, 61534, 61592, 61642, 61688, 61704, 61726,
192
- 61784, 61800, 61836, 61880, 61914, 61948, 61998, 62122,
193
- 62154, 62200, 62218, 62302, 62364, 62442, 62478, 62536,
194
- 62554, 62584, 62604, 62640, 62648, 62656, 62664, 62730,
195
- 62924, 63050, 63082, 63274, 63390,
191
+ 3456, 3696, 3712, 3728, 3744, 3766, 3832, 3896,
192
+ 3912, 3928, 3944, 3968, 4008, 4040, 4056, 4106,
193
+ 4138, 4170, 4202, 4234, 4266, 4296, 4312, 4344,
194
+ 4408, 4424, 4442, 4472, 4488, 4504, 6148, 6198,
195
+ 6264, 6280, 6360, 6429, 6505, 6529, 61448, 61468,
196
+ 61512, 61534, 61592, 61610, 61642, 61672, 61688, 61704,
197
+ 61726, 61784, 61800, 61816, 61836, 61880, 61896, 61914,
198
+ 61948, 61998, 62062, 62122, 62154, 62184, 62200, 62218,
199
+ 62252, 62302, 62364, 62410, 62442, 62478, 62536, 62554,
200
+ 62584, 62604, 62640, 62648, 62656, 62664, 62730, 62766,
201
+ 62830, 62890, 62924, 62974, 63032, 63050, 63082, 63118,
202
+ 63182, 63242, 63274, 63310, 63368, 63390,
196203
};
197
- static const char aChar[] = {
198
- '\0', 'a', 'c', 'e', 'i', 'n', 'o', 'u', 'y', 'y', 'a', 'c',
199
- 'd', 'e', 'e', 'g', 'h', 'i', 'j', 'k', 'l', 'n', 'o', 'r',
200
- 's', 't', 'u', 'u', 'w', 'y', 'z', 'o', 'u', 'a', 'i', 'o',
201
- 'u', 'g', 'k', 'o', 'j', 'g', 'n', 'a', 'e', 'i', 'o', 'r',
202
- 'u', 's', 't', 'h', 'a', 'e', 'o', 'y', '\0', '\0', '\0', '\0',
203
- '\0', '\0', '\0', '\0', 'a', 'b', 'd', 'd', 'e', 'f', 'g', 'h',
204
- 'h', 'i', 'k', 'l', 'l', 'm', 'n', 'p', 'r', 'r', 's', 't',
205
- 'u', 'v', 'w', 'w', 'x', 'y', 'z', 'h', 't', 'w', 'y', 'a',
206
- 'e', 'i', 'o', 'u', 'y',
204
+#define HIBIT ((unsigned char)0x80)
205
+ static const unsigned char aChar[] = {
206
+ '\0', 'a', 'c', 'e', 'i', 'n',
207
+ 'o', 'u', 'y', 'y', 'a', 'c',
208
+ 'd', 'e', 'e', 'g', 'h', 'i',
209
+ 'j', 'k', 'l', 'n', 'o', 'r',
210
+ 's', 't', 'u', 'u', 'w', 'y',
211
+ 'z', 'o', 'u', 'a', 'i', 'o',
212
+ 'u', 'u'|HIBIT, 'a'|HIBIT, 'g', 'k', 'o',
213
+ 'o'|HIBIT, 'j', 'g', 'n', 'a'|HIBIT, 'a',
214
+ 'e', 'i', 'o', 'r', 'u', 's',
215
+ 't', 'h', 'a', 'e', 'o'|HIBIT, 'o',
216
+ 'o'|HIBIT, 'y', '\0', '\0', '\0', '\0',
217
+ '\0', '\0', '\0', '\0', 'a', 'b',
218
+ 'c'|HIBIT, 'd', 'd', 'e'|HIBIT, 'e', 'e'|HIBIT,
219
+ 'f', 'g', 'h', 'h', 'i', 'i'|HIBIT,
220
+ 'k', 'l', 'l'|HIBIT, 'l', 'm', 'n',
221
+ 'o'|HIBIT, 'p', 'r', 'r'|HIBIT, 'r', 's',
222
+ 's'|HIBIT, 't', 'u', 'u'|HIBIT, 'v', 'w',
223
+ 'w', 'x', 'y', 'z', 'h', 't',
224
+ 'w', 'y', 'a', 'a'|HIBIT, 'a'|HIBIT, 'a'|HIBIT,
225
+ 'e', 'e'|HIBIT, 'e'|HIBIT, 'i', 'o', 'o'|HIBIT,
226
+ 'o'|HIBIT, 'o'|HIBIT, 'u', 'u'|HIBIT, 'u'|HIBIT, 'y',
207227
};
208228
209229
unsigned int key = (((unsigned int)c)<<3) | 0x00000007;
210230
int iRes = 0;
211231
int iHi = sizeof(aDia)/sizeof(aDia[0]) - 1;
@@ -218,11 +238,12 @@
218238
}else{
219239
iHi = iTest-1;
220240
}
221241
}
222242
assert( key>=aDia[iRes] );
223
- return ((c > (aDia[iRes]>>3) + (aDia[iRes]&0x07)) ? c : (int)aChar[iRes]);
243
+ if( bComplex==0 && (aChar[iRes] & 0x80) ) return c;
244
+ return (c > (aDia[iRes]>>3) + (aDia[iRes]&0x07)) ? c : ((int)aChar[iRes] & 0x7F);
224245
}
225246
226247
227248
/*
228249
** Return true if the argument interpreted as a unicode codepoint
@@ -231,12 +252,12 @@
231252
int unicode_is_diacritic(int c){
232253
unsigned int mask0 = 0x08029FDF;
233254
unsigned int mask1 = 0x000361F8;
234255
if( c<768 || c>817 ) return 0;
235256
return (c < 768+32) ?
236
- (mask0 & (1 << (c-768))) :
237
- (mask1 & (1 << (c-768-32)));
257
+ (mask0 & ((unsigned int)1 << (c-768))) :
258
+ (mask1 & ((unsigned int)1 << (c-768-32)));
238259
}
239260
240261
241262
/*
242263
** Interpret the argument as a unicode codepoint. If the codepoint
@@ -245,11 +266,11 @@
245266
** Otherwise, return a copy of the argument.
246267
**
247268
** The results are undefined if the value passed to this function
248269
** is less than zero.
249270
*/
250
-int unicode_fold(int c, int bRemoveDiacritic){
271
+int unicode_fold(int c, int eRemoveDiacritic){
251272
/* Each entry in the following array defines a rule for folding a range
252273
** of codepoints to lower case. The rule applies to a range of nRange
253274
** codepoints starting at codepoint iCode.
254275
**
255276
** If the least significant bit in flags is clear, then the rule applies
@@ -270,12 +291,12 @@
270291
unsigned char flags;
271292
unsigned char nRange;
272293
} aEntry[] = {
273294
{65, 14, 26}, {181, 66, 1}, {192, 14, 23},
274295
{216, 14, 7}, {256, 1, 48}, {306, 1, 6},
275
- {313, 1, 16}, {330, 1, 46}, {376, 152, 1},
276
- {377, 1, 6}, {383, 140, 1}, {385, 52, 1},
296
+ {313, 1, 16}, {330, 1, 46}, {376, 156, 1},
297
+ {377, 1, 6}, {383, 144, 1}, {385, 52, 1},
277298
{386, 1, 4}, {390, 46, 1}, {391, 0, 1},
278299
{393, 44, 2}, {395, 0, 1}, {398, 34, 1},
279300
{399, 40, 1}, {400, 42, 1}, {401, 0, 1},
280301
{403, 44, 1}, {404, 48, 1}, {406, 54, 1},
281302
{407, 50, 1}, {408, 0, 1}, {412, 54, 1},
@@ -284,70 +305,72 @@
284305
{428, 0, 1}, {430, 62, 1}, {431, 0, 1},
285306
{433, 60, 2}, {435, 1, 4}, {439, 64, 1},
286307
{440, 0, 1}, {444, 0, 1}, {452, 2, 1},
287308
{453, 0, 1}, {455, 2, 1}, {456, 0, 1},
288309
{458, 2, 1}, {459, 1, 18}, {478, 1, 18},
289
- {497, 2, 1}, {498, 1, 4}, {502, 158, 1},
290
- {503, 170, 1}, {504, 1, 40}, {544, 146, 1},
310
+ {497, 2, 1}, {498, 1, 4}, {502, 162, 1},
311
+ {503, 174, 1}, {504, 1, 40}, {544, 150, 1},
291312
{546, 1, 18}, {570, 74, 1}, {571, 0, 1},
292
- {573, 144, 1}, {574, 72, 1}, {577, 0, 1},
293
- {579, 142, 1}, {580, 30, 1}, {581, 32, 1},
313
+ {573, 148, 1}, {574, 72, 1}, {577, 0, 1},
314
+ {579, 146, 1}, {580, 30, 1}, {581, 32, 1},
294315
{582, 1, 10}, {837, 38, 1}, {880, 1, 4},
295316
{886, 0, 1}, {895, 38, 1}, {902, 20, 1},
296317
{904, 18, 3}, {908, 28, 1}, {910, 26, 2},
297318
{913, 14, 17}, {931, 14, 9}, {962, 0, 1},
298
- {975, 4, 1}, {976, 176, 1}, {977, 178, 1},
299
- {981, 182, 1}, {982, 180, 1}, {984, 1, 24},
300
- {1008, 172, 1}, {1009, 174, 1}, {1012, 166, 1},
301
- {1013, 164, 1}, {1015, 0, 1}, {1017, 188, 1},
302
- {1018, 0, 1}, {1021, 146, 3}, {1024, 36, 16},
319
+ {975, 4, 1}, {976, 180, 1}, {977, 182, 1},
320
+ {981, 186, 1}, {982, 184, 1}, {984, 1, 24},
321
+ {1008, 176, 1}, {1009, 178, 1}, {1012, 170, 1},
322
+ {1013, 168, 1}, {1015, 0, 1}, {1017, 192, 1},
323
+ {1018, 0, 1}, {1021, 150, 3}, {1024, 36, 16},
303324
{1040, 14, 32}, {1120, 1, 34}, {1162, 1, 54},
304325
{1216, 6, 1}, {1217, 1, 14}, {1232, 1, 96},
305326
{1329, 24, 38}, {4256, 70, 38}, {4295, 70, 1},
306
- {4301, 70, 1}, {5112, 186, 6}, {7296, 122, 1},
307
- {7297, 124, 1}, {7298, 126, 1}, {7299, 130, 2},
308
- {7301, 128, 1}, {7302, 132, 1}, {7303, 134, 1},
309
- {7304, 96, 1}, {7312, 138, 43}, {7357, 138, 3},
310
- {7680, 1, 150}, {7835, 168, 1}, {7838, 116, 1},
311
- {7840, 1, 96}, {7944, 186, 8}, {7960, 186, 6},
312
- {7976, 186, 8}, {7992, 186, 8}, {8008, 186, 6},
313
- {8025, 187, 8}, {8040, 186, 8}, {8072, 186, 8},
314
- {8088, 186, 8}, {8104, 186, 8}, {8120, 186, 2},
315
- {8122, 162, 2}, {8124, 184, 1}, {8126, 120, 1},
316
- {8136, 160, 4}, {8140, 184, 1}, {8152, 186, 2},
317
- {8154, 156, 2}, {8168, 186, 2}, {8170, 154, 2},
318
- {8172, 188, 1}, {8184, 148, 2}, {8186, 150, 2},
319
- {8188, 184, 1}, {8486, 118, 1}, {8490, 112, 1},
320
- {8491, 114, 1}, {8498, 12, 1}, {8544, 8, 16},
327
+ {4301, 70, 1}, {5112, 190, 6}, {7296, 126, 1},
328
+ {7297, 128, 1}, {7298, 130, 1}, {7299, 134, 2},
329
+ {7301, 132, 1}, {7302, 136, 1}, {7303, 138, 1},
330
+ {7304, 100, 1}, {7312, 142, 43}, {7357, 142, 3},
331
+ {7680, 1, 150}, {7835, 172, 1}, {7838, 120, 1},
332
+ {7840, 1, 96}, {7944, 190, 8}, {7960, 190, 6},
333
+ {7976, 190, 8}, {7992, 190, 8}, {8008, 190, 6},
334
+ {8025, 191, 8}, {8040, 190, 8}, {8072, 190, 8},
335
+ {8088, 190, 8}, {8104, 190, 8}, {8120, 190, 2},
336
+ {8122, 166, 2}, {8124, 188, 1}, {8126, 124, 1},
337
+ {8136, 164, 4}, {8140, 188, 1}, {8152, 190, 2},
338
+ {8154, 160, 2}, {8168, 190, 2}, {8170, 158, 2},
339
+ {8172, 192, 1}, {8184, 152, 2}, {8186, 154, 2},
340
+ {8188, 188, 1}, {8486, 122, 1}, {8490, 116, 1},
341
+ {8491, 118, 1}, {8498, 12, 1}, {8544, 8, 16},
321342
{8579, 0, 1}, {9398, 10, 26}, {11264, 24, 47},
322
- {11360, 0, 1}, {11362, 108, 1}, {11363, 136, 1},
323
- {11364, 110, 1}, {11367, 1, 6}, {11373, 104, 1},
324
- {11374, 106, 1}, {11375, 100, 1}, {11376, 102, 1},
325
- {11378, 0, 1}, {11381, 0, 1}, {11390, 98, 2},
343
+ {11360, 0, 1}, {11362, 112, 1}, {11363, 140, 1},
344
+ {11364, 114, 1}, {11367, 1, 6}, {11373, 108, 1},
345
+ {11374, 110, 1}, {11375, 104, 1}, {11376, 106, 1},
346
+ {11378, 0, 1}, {11381, 0, 1}, {11390, 102, 2},
326347
{11392, 1, 100}, {11499, 1, 4}, {11506, 0, 1},
327348
{42560, 1, 46}, {42624, 1, 28}, {42786, 1, 14},
328
- {42802, 1, 62}, {42873, 1, 4}, {42877, 94, 1},
329
- {42878, 1, 10}, {42891, 0, 1}, {42893, 86, 1},
349
+ {42802, 1, 62}, {42873, 1, 4}, {42877, 98, 1},
350
+ {42878, 1, 10}, {42891, 0, 1}, {42893, 88, 1},
330351
{42896, 1, 4}, {42902, 1, 20}, {42922, 80, 1},
331
- {42923, 76, 1}, {42924, 78, 1}, {42925, 82, 1},
332
- {42926, 80, 1}, {42928, 90, 1}, {42929, 84, 1},
333
- {42930, 88, 1}, {42931, 68, 1}, {42932, 1, 6},
334
- {43888, 92, 80}, {65313, 14, 26},
352
+ {42923, 76, 1}, {42924, 78, 1}, {42925, 84, 1},
353
+ {42926, 80, 1}, {42928, 92, 1}, {42929, 86, 1},
354
+ {42930, 90, 1}, {42931, 68, 1}, {42932, 1, 12},
355
+ {42946, 0, 1}, {42948, 178, 1}, {42949, 82, 1},
356
+ {42950, 96, 1}, {43888, 94, 80}, {65313, 14, 26},
335357
};
336358
static const unsigned short aiOff[] = {
337359
1, 2, 8, 15, 16, 26, 28, 32,
338360
34, 37, 38, 40, 48, 63, 64, 69,
339361
71, 79, 80, 116, 202, 203, 205, 206,
340362
207, 209, 210, 211, 213, 214, 217, 218,
341363
219, 775, 928, 7264, 10792, 10795, 23217, 23221,
342
- 23228, 23231, 23254, 23256, 23275, 23278, 26672, 30204,
343
- 35267, 54721, 54753, 54754, 54756, 54787, 54793, 54809,
344
- 57153, 57274, 57921, 58019, 58363, 59314, 59315, 59324,
345
- 59325, 59326, 59332, 59356, 61722, 62528, 65268, 65341,
346
- 65373, 65406, 65408, 65410, 65415, 65424, 65436, 65439,
347
- 65450, 65462, 65472, 65476, 65478, 65480, 65482, 65488,
348
- 65506, 65511, 65514, 65521, 65527, 65528, 65529,
364
+ 23228, 23229, 23231, 23254, 23256, 23275, 23278, 26672,
365
+ 30152, 30204, 35267, 54721, 54753, 54754, 54756, 54787,
366
+ 54793, 54809, 57153, 57274, 57921, 58019, 58363, 59314,
367
+ 59315, 59324, 59325, 59326, 59332, 59356, 61722, 62528,
368
+ 65268, 65341, 65373, 65406, 65408, 65410, 65415, 65424,
369
+ 65436, 65439, 65450, 65462, 65472, 65476, 65478, 65480,
370
+ 65482, 65488, 65506, 65511, 65514, 65521, 65527, 65528,
371
+ 65529,
349372
};
350373
351374
int ret = c;
352375
353376
assert( sizeof(unsigned short)==2 && sizeof(unsigned char)==1 );
@@ -377,11 +400,13 @@
377400
if( c<(p->iCode + p->nRange) && 0==(0x01 & p->flags & (p->iCode ^ c)) ){
378401
ret = (c + (aiOff[p->flags>>1])) & 0x0000FFFF;
379402
assert( ret>0 );
380403
}
381404
382
- if( bRemoveDiacritic ) ret = unicode_remove_diacritic(ret);
405
+ if( eRemoveDiacritic ){
406
+ ret = unicode_remove_diacritic(ret, eRemoveDiacritic==2);
407
+ }
383408
}
384409
385410
else if( c>=66560 && c<66600 ){
386411
ret = c + 40;
387412
}
388413
--- src/unicode.c
+++ src/unicode.c
@@ -59,17 +59,17 @@
59 0x002A0403, 0x002AF001, 0x002AF808, 0x002B1C03, 0x002B2C03,
60 0x002B8802, 0x002BC002, 0x002BE806, 0x002C0403, 0x002CF001,
61 0x002CF807, 0x002D1C02, 0x002D2C03, 0x002D5802, 0x002D8802,
62 0x002DC001, 0x002E0801, 0x002EF805, 0x002F1803, 0x002F2804,
63 0x002F5C01, 0x002FCC08, 0x00300005, 0x0030F807, 0x00311803,
64 0x00312804, 0x00315402, 0x00318802, 0x0031FC01, 0x00320404,
65 0x0032F001, 0x0032F807, 0x00331803, 0x00332804, 0x00335402,
66 0x00338802, 0x00340004, 0x0034EC02, 0x0034F807, 0x00351803,
67 0x00352804, 0x00353C01, 0x00355C01, 0x00358802, 0x0035E401,
68 0x00360802, 0x00372801, 0x00373C06, 0x00375801, 0x00376008,
69 0x0037C803, 0x0038C401, 0x0038D007, 0x0038FC01, 0x00391C09,
70 0x00396802, 0x003AC401, 0x003AD006, 0x003AEC02, 0x003B2006,
71 0x003C041F, 0x003CD00C, 0x003DC417, 0x003E340B, 0x003E6424,
72 0x003EF80F, 0x003F380D, 0x0040AC14, 0x00412806, 0x00415804,
73 0x00417803, 0x00418803, 0x00419C07, 0x0041C404, 0x0042080C,
74 0x00423C01, 0x00426806, 0x0043EC01, 0x004D740C, 0x004E400A,
75 0x00500001, 0x0059B402, 0x005A0001, 0x005A6C02, 0x005BAC03,
@@ -78,71 +78,75 @@
78 0x0064800C, 0x0064C00C, 0x00650001, 0x00651002, 0x00677822,
79 0x00685C05, 0x00687802, 0x0069540A, 0x0069801D, 0x0069FC01,
80 0x006A8007, 0x006AA006, 0x006AC00F, 0x006C0005, 0x006CD011,
81 0x006D6823, 0x006E0003, 0x006E840D, 0x006F980E, 0x006FF004,
82 0x00709014, 0x0070EC05, 0x0071F802, 0x00730008, 0x00734019,
83 0x0073B401, 0x0073C803, 0x0073DC03, 0x0077003A, 0x0077EC05,
84 0x007EF401, 0x007EFC03, 0x007F3403, 0x007F7403, 0x007FB403,
85 0x007FF402, 0x00800065, 0x0081980A, 0x0081E805, 0x00822805,
86 0x00828020, 0x00834021, 0x00840002, 0x00840C04, 0x00842002,
87 0x00845001, 0x00845803, 0x00847806, 0x00849401, 0x00849C01,
88 0x0084A401, 0x0084B801, 0x0084E802, 0x00850005, 0x00852804,
89 0x00853C01, 0x00862802, 0x00864297, 0x0091000B, 0x0092704E,
90 0x00940276, 0x009E53E0, 0x00ADD820, 0x00AE6031, 0x00AF2835,
91 0x00B39406, 0x00B3BC03, 0x00B3E404, 0x00B3F802, 0x00B5C001,
92 0x00B5FC01, 0x00B7804F, 0x00B8C01F, 0x00BA001A, 0x00BA6C59,
93 0x00BC00D6, 0x00BFC00C, 0x00C00005, 0x00C02019, 0x00C0A807,
94 0x00C0D802, 0x00C0F403, 0x00C26404, 0x00C28001, 0x00C3EC01,
95 0x00C64002, 0x00C6580A, 0x00C70024, 0x00C8001F, 0x00C8A81E,
96 0x00C94001, 0x00C98020, 0x00CA2827, 0x00CB003F, 0x00CC0100,
97 0x01370040, 0x02924037, 0x0293F802, 0x02983403, 0x0299BC10,
98 0x029A7802, 0x029BC008, 0x029C0017, 0x029C8002, 0x029E2402,
99 0x02A00801, 0x02A01801, 0x02A02C01, 0x02A08C09, 0x02A0D804,
100 0x02A1D004, 0x02A20002, 0x02A2D012, 0x02A33802, 0x02A38012,
101 0x02A3E003, 0x02A3F001, 0x02A3FC01, 0x02A4980A, 0x02A51C0D,
102 0x02A57C01, 0x02A60004, 0x02A6CC1B, 0x02A77802, 0x02A79401,
103 0x02A8A40E, 0x02A90C01, 0x02A93002, 0x02A97004, 0x02A9DC03,
104 0x02A9EC03, 0x02AAC001, 0x02AAC803, 0x02AADC02, 0x02AAF802,
105 0x02AB0401, 0x02AB7802, 0x02ABAC07, 0x02ABD402, 0x02AD6C01,
106 0x02AF8C0B, 0x03600001, 0x036DFC02, 0x036FFC02, 0x037FFC01,
107 0x03EC7801, 0x03ECA401, 0x03EEC810, 0x03F4F802, 0x03F7F002,
108 0x03F8001A, 0x03F88033, 0x03F95013, 0x03F9A004, 0x03FBFC01,
109 0x03FC040F, 0x03FC6807, 0x03FCEC06, 0x03FD6C0B, 0x03FF8007,
110 0x03FFA007, 0x03FFE405, 0x04040003, 0x0404DC09, 0x0405E411,
111 0x04063003, 0x0406400C, 0x04068001, 0x0407402E, 0x040B8001,
112 0x040DD805, 0x040E7C01, 0x040F4001, 0x0415BC01, 0x04215C01,
113 0x0421DC02, 0x04247C01, 0x0424FC01, 0x04280403, 0x04281402,
114 0x04283004, 0x0428E003, 0x0428FC01, 0x04294009, 0x0429FC01,
115 0x042B2001, 0x042B9402, 0x042BC007, 0x042CE407, 0x042E6404,
116 0x04349004, 0x043D180B, 0x043D5405, 0x04400003, 0x0440E016,
117 0x0441FC04, 0x0442C012, 0x04433401, 0x04440003, 0x04449C0E,
118 0x04450004, 0x04451402, 0x0445CC03, 0x04460003, 0x0446CC0E,
119 0x04471409, 0x04476C01, 0x04477403, 0x0448B013, 0x044AA401,
120 0x044B7C0C, 0x044C0004, 0x044CEC02, 0x044CF807, 0x044D1C02,
121 0x044D2C03, 0x044D5C01, 0x044D8802, 0x044D9807, 0x044DC005,
122 0x0450D412, 0x04512C05, 0x04516C01, 0x04517402, 0x0452C014,
123 0x04531801, 0x0456BC07, 0x0456E020, 0x04577002, 0x0458C014,
124 0x0459800D, 0x045AAC0D, 0x045C740F, 0x045CF004, 0x0460B010,
125 0x0468040A, 0x0468CC07, 0x0468EC0D, 0x0469440B, 0x046A2813,
126 0x046A7805, 0x0470BC08, 0x0470E008, 0x04710405, 0x0471C002,
127 0x04724816, 0x0472A40E, 0x0474C406, 0x0474E801, 0x0474F002,
128 0x0474FC07, 0x04751C01, 0x04762805, 0x04764002, 0x04764C05,
129 0x047BCC06, 0x0491C005, 0x05A9B802, 0x05ABC006, 0x05ACC010,
130 0x05AD1002, 0x05BA5C04, 0x05BD442E, 0x05BE3C04, 0x06F27008,
131 0x074000F6, 0x07440027, 0x0744A4C0, 0x07480046, 0x074C0057,
132 0x075B0401, 0x075B6C01, 0x075BEC01, 0x075C5401, 0x075CD401,
133 0x075D3C01, 0x075DBC01, 0x075E2401, 0x075EA401, 0x075F0C01,
134 0x0760028C, 0x076A6C05, 0x076A840F, 0x07800007, 0x07802011,
135 0x07806C07, 0x07808C02, 0x07809805, 0x07A34007, 0x07A51007,
136 0x07A57802, 0x07B2B001, 0x07B2C001, 0x07BBC002, 0x07C0002C,
137 0x07C0C064, 0x07C2800F, 0x07C2C40F, 0x07C3040F, 0x07C34425,
138 0x07C4405C, 0x07C5C03D, 0x07C7981D, 0x07C8402C, 0x07C90009,
139 0x07C94002, 0x07C98006, 0x07CC03D5, 0x07DB800D, 0x07DBC00A,
140 0x07DC0074, 0x07DE0059, 0x07E0000C, 0x07E04038, 0x07E1400A,
141 0x07E18028, 0x07E2401E, 0x07E4000C, 0x07E4402F, 0x07E50031,
142 0x07E5CC04, 0x07E5E801, 0x07E5F027, 0x07E6C00A, 0x07E70003,
143 0x07E74030, 0x07E9800E, 0x38000401, 0x38008060, 0x380400F0,
 
 
 
 
144 };
145 static const unsigned int aAscii[4] = {
146 0xFFFFFFFF, 0xFC00FFFF, 0xF8000001, 0xF8000001,
147 };
148
@@ -176,36 +180,52 @@
176 ** of the ASCII letter only. For example, if passed 235 - "LATIN
177 ** SMALL LETTER E WITH DIAERESIS" - return 65 ("LATIN SMALL LETTER
178 ** E"). The resuls of passing a codepoint that corresponds to an
179 ** uppercase letter are undefined.
180 */
181 static int unicode_remove_diacritic(int c){
182 static const unsigned short aDia[] = {
183 0, 1797, 1848, 1859, 1891, 1928, 1940, 1995,
184 2024, 2040, 2060, 2110, 2168, 2206, 2264, 2286,
185 2344, 2383, 2472, 2488, 2516, 2596, 2668, 2732,
186 2782, 2842, 2894, 2954, 2984, 3000, 3028, 3336,
187 3456, 3696, 3712, 3728, 3744, 3896, 3912, 3928,
188 3968, 4008, 4040, 4106, 4138, 4170, 4202, 4234,
189 4266, 4296, 4312, 4344, 4408, 4424, 4472, 4504,
190 6148, 6198, 6264, 6280, 6360, 6429, 6505, 6529,
191 61448, 61468, 61534, 61592, 61642, 61688, 61704, 61726,
192 61784, 61800, 61836, 61880, 61914, 61948, 61998, 62122,
193 62154, 62200, 62218, 62302, 62364, 62442, 62478, 62536,
194 62554, 62584, 62604, 62640, 62648, 62656, 62664, 62730,
195 62924, 63050, 63082, 63274, 63390,
 
 
 
196 };
197 static const char aChar[] = {
198 '\0', 'a', 'c', 'e', 'i', 'n', 'o', 'u', 'y', 'y', 'a', 'c',
199 'd', 'e', 'e', 'g', 'h', 'i', 'j', 'k', 'l', 'n', 'o', 'r',
200 's', 't', 'u', 'u', 'w', 'y', 'z', 'o', 'u', 'a', 'i', 'o',
201 'u', 'g', 'k', 'o', 'j', 'g', 'n', 'a', 'e', 'i', 'o', 'r',
202 'u', 's', 't', 'h', 'a', 'e', 'o', 'y', '\0', '\0', '\0', '\0',
203 '\0', '\0', '\0', '\0', 'a', 'b', 'd', 'd', 'e', 'f', 'g', 'h',
204 'h', 'i', 'k', 'l', 'l', 'm', 'n', 'p', 'r', 'r', 's', 't',
205 'u', 'v', 'w', 'w', 'x', 'y', 'z', 'h', 't', 'w', 'y', 'a',
206 'e', 'i', 'o', 'u', 'y',
 
 
 
 
 
 
 
 
 
 
 
 
 
207 };
208
209 unsigned int key = (((unsigned int)c)<<3) | 0x00000007;
210 int iRes = 0;
211 int iHi = sizeof(aDia)/sizeof(aDia[0]) - 1;
@@ -218,11 +238,12 @@
218 }else{
219 iHi = iTest-1;
220 }
221 }
222 assert( key>=aDia[iRes] );
223 return ((c > (aDia[iRes]>>3) + (aDia[iRes]&0x07)) ? c : (int)aChar[iRes]);
 
224 }
225
226
227 /*
228 ** Return true if the argument interpreted as a unicode codepoint
@@ -231,12 +252,12 @@
231 int unicode_is_diacritic(int c){
232 unsigned int mask0 = 0x08029FDF;
233 unsigned int mask1 = 0x000361F8;
234 if( c<768 || c>817 ) return 0;
235 return (c < 768+32) ?
236 (mask0 & (1 << (c-768))) :
237 (mask1 & (1 << (c-768-32)));
238 }
239
240
241 /*
242 ** Interpret the argument as a unicode codepoint. If the codepoint
@@ -245,11 +266,11 @@
245 ** Otherwise, return a copy of the argument.
246 **
247 ** The results are undefined if the value passed to this function
248 ** is less than zero.
249 */
250 int unicode_fold(int c, int bRemoveDiacritic){
251 /* Each entry in the following array defines a rule for folding a range
252 ** of codepoints to lower case. The rule applies to a range of nRange
253 ** codepoints starting at codepoint iCode.
254 **
255 ** If the least significant bit in flags is clear, then the rule applies
@@ -270,12 +291,12 @@
270 unsigned char flags;
271 unsigned char nRange;
272 } aEntry[] = {
273 {65, 14, 26}, {181, 66, 1}, {192, 14, 23},
274 {216, 14, 7}, {256, 1, 48}, {306, 1, 6},
275 {313, 1, 16}, {330, 1, 46}, {376, 152, 1},
276 {377, 1, 6}, {383, 140, 1}, {385, 52, 1},
277 {386, 1, 4}, {390, 46, 1}, {391, 0, 1},
278 {393, 44, 2}, {395, 0, 1}, {398, 34, 1},
279 {399, 40, 1}, {400, 42, 1}, {401, 0, 1},
280 {403, 44, 1}, {404, 48, 1}, {406, 54, 1},
281 {407, 50, 1}, {408, 0, 1}, {412, 54, 1},
@@ -284,70 +305,72 @@
284 {428, 0, 1}, {430, 62, 1}, {431, 0, 1},
285 {433, 60, 2}, {435, 1, 4}, {439, 64, 1},
286 {440, 0, 1}, {444, 0, 1}, {452, 2, 1},
287 {453, 0, 1}, {455, 2, 1}, {456, 0, 1},
288 {458, 2, 1}, {459, 1, 18}, {478, 1, 18},
289 {497, 2, 1}, {498, 1, 4}, {502, 158, 1},
290 {503, 170, 1}, {504, 1, 40}, {544, 146, 1},
291 {546, 1, 18}, {570, 74, 1}, {571, 0, 1},
292 {573, 144, 1}, {574, 72, 1}, {577, 0, 1},
293 {579, 142, 1}, {580, 30, 1}, {581, 32, 1},
294 {582, 1, 10}, {837, 38, 1}, {880, 1, 4},
295 {886, 0, 1}, {895, 38, 1}, {902, 20, 1},
296 {904, 18, 3}, {908, 28, 1}, {910, 26, 2},
297 {913, 14, 17}, {931, 14, 9}, {962, 0, 1},
298 {975, 4, 1}, {976, 176, 1}, {977, 178, 1},
299 {981, 182, 1}, {982, 180, 1}, {984, 1, 24},
300 {1008, 172, 1}, {1009, 174, 1}, {1012, 166, 1},
301 {1013, 164, 1}, {1015, 0, 1}, {1017, 188, 1},
302 {1018, 0, 1}, {1021, 146, 3}, {1024, 36, 16},
303 {1040, 14, 32}, {1120, 1, 34}, {1162, 1, 54},
304 {1216, 6, 1}, {1217, 1, 14}, {1232, 1, 96},
305 {1329, 24, 38}, {4256, 70, 38}, {4295, 70, 1},
306 {4301, 70, 1}, {5112, 186, 6}, {7296, 122, 1},
307 {7297, 124, 1}, {7298, 126, 1}, {7299, 130, 2},
308 {7301, 128, 1}, {7302, 132, 1}, {7303, 134, 1},
309 {7304, 96, 1}, {7312, 138, 43}, {7357, 138, 3},
310 {7680, 1, 150}, {7835, 168, 1}, {7838, 116, 1},
311 {7840, 1, 96}, {7944, 186, 8}, {7960, 186, 6},
312 {7976, 186, 8}, {7992, 186, 8}, {8008, 186, 6},
313 {8025, 187, 8}, {8040, 186, 8}, {8072, 186, 8},
314 {8088, 186, 8}, {8104, 186, 8}, {8120, 186, 2},
315 {8122, 162, 2}, {8124, 184, 1}, {8126, 120, 1},
316 {8136, 160, 4}, {8140, 184, 1}, {8152, 186, 2},
317 {8154, 156, 2}, {8168, 186, 2}, {8170, 154, 2},
318 {8172, 188, 1}, {8184, 148, 2}, {8186, 150, 2},
319 {8188, 184, 1}, {8486, 118, 1}, {8490, 112, 1},
320 {8491, 114, 1}, {8498, 12, 1}, {8544, 8, 16},
321 {8579, 0, 1}, {9398, 10, 26}, {11264, 24, 47},
322 {11360, 0, 1}, {11362, 108, 1}, {11363, 136, 1},
323 {11364, 110, 1}, {11367, 1, 6}, {11373, 104, 1},
324 {11374, 106, 1}, {11375, 100, 1}, {11376, 102, 1},
325 {11378, 0, 1}, {11381, 0, 1}, {11390, 98, 2},
326 {11392, 1, 100}, {11499, 1, 4}, {11506, 0, 1},
327 {42560, 1, 46}, {42624, 1, 28}, {42786, 1, 14},
328 {42802, 1, 62}, {42873, 1, 4}, {42877, 94, 1},
329 {42878, 1, 10}, {42891, 0, 1}, {42893, 86, 1},
330 {42896, 1, 4}, {42902, 1, 20}, {42922, 80, 1},
331 {42923, 76, 1}, {42924, 78, 1}, {42925, 82, 1},
332 {42926, 80, 1}, {42928, 90, 1}, {42929, 84, 1},
333 {42930, 88, 1}, {42931, 68, 1}, {42932, 1, 6},
334 {43888, 92, 80}, {65313, 14, 26},
 
335 };
336 static const unsigned short aiOff[] = {
337 1, 2, 8, 15, 16, 26, 28, 32,
338 34, 37, 38, 40, 48, 63, 64, 69,
339 71, 79, 80, 116, 202, 203, 205, 206,
340 207, 209, 210, 211, 213, 214, 217, 218,
341 219, 775, 928, 7264, 10792, 10795, 23217, 23221,
342 23228, 23231, 23254, 23256, 23275, 23278, 26672, 30204,
343 35267, 54721, 54753, 54754, 54756, 54787, 54793, 54809,
344 57153, 57274, 57921, 58019, 58363, 59314, 59315, 59324,
345 59325, 59326, 59332, 59356, 61722, 62528, 65268, 65341,
346 65373, 65406, 65408, 65410, 65415, 65424, 65436, 65439,
347 65450, 65462, 65472, 65476, 65478, 65480, 65482, 65488,
348 65506, 65511, 65514, 65521, 65527, 65528, 65529,
 
349 };
350
351 int ret = c;
352
353 assert( sizeof(unsigned short)==2 && sizeof(unsigned char)==1 );
@@ -377,11 +400,13 @@
377 if( c<(p->iCode + p->nRange) && 0==(0x01 & p->flags & (p->iCode ^ c)) ){
378 ret = (c + (aiOff[p->flags>>1])) & 0x0000FFFF;
379 assert( ret>0 );
380 }
381
382 if( bRemoveDiacritic ) ret = unicode_remove_diacritic(ret);
 
 
383 }
384
385 else if( c>=66560 && c<66600 ){
386 ret = c + 40;
387 }
388
--- src/unicode.c
+++ src/unicode.c
@@ -59,17 +59,17 @@
59 0x002A0403, 0x002AF001, 0x002AF808, 0x002B1C03, 0x002B2C03,
60 0x002B8802, 0x002BC002, 0x002BE806, 0x002C0403, 0x002CF001,
61 0x002CF807, 0x002D1C02, 0x002D2C03, 0x002D5802, 0x002D8802,
62 0x002DC001, 0x002E0801, 0x002EF805, 0x002F1803, 0x002F2804,
63 0x002F5C01, 0x002FCC08, 0x00300005, 0x0030F807, 0x00311803,
64 0x00312804, 0x00315402, 0x00318802, 0x0031DC01, 0x0031FC01,
65 0x00320404, 0x0032F001, 0x0032F807, 0x00331803, 0x00332804,
66 0x00335402, 0x00338802, 0x00340004, 0x0034EC02, 0x0034F807,
67 0x00351803, 0x00352804, 0x00353C01, 0x00355C01, 0x00358802,
68 0x0035E401, 0x00360802, 0x00372801, 0x00373C06, 0x00375801,
69 0x00376008, 0x0037C803, 0x0038C401, 0x0038D007, 0x0038FC01,
70 0x00391C09, 0x00396802, 0x003AC401, 0x003AD009, 0x003B2006,
71 0x003C041F, 0x003CD00C, 0x003DC417, 0x003E340B, 0x003E6424,
72 0x003EF80F, 0x003F380D, 0x0040AC14, 0x00412806, 0x00415804,
73 0x00417803, 0x00418803, 0x00419C07, 0x0041C404, 0x0042080C,
74 0x00423C01, 0x00426806, 0x0043EC01, 0x004D740C, 0x004E400A,
75 0x00500001, 0x0059B402, 0x005A0001, 0x005A6C02, 0x005BAC03,
@@ -78,71 +78,75 @@
78 0x0064800C, 0x0064C00C, 0x00650001, 0x00651002, 0x00677822,
79 0x00685C05, 0x00687802, 0x0069540A, 0x0069801D, 0x0069FC01,
80 0x006A8007, 0x006AA006, 0x006AC00F, 0x006C0005, 0x006CD011,
81 0x006D6823, 0x006E0003, 0x006E840D, 0x006F980E, 0x006FF004,
82 0x00709014, 0x0070EC05, 0x0071F802, 0x00730008, 0x00734019,
83 0x0073B401, 0x0073D001, 0x0073DC03, 0x0077003A, 0x0077EC05,
84 0x007EF401, 0x007EFC03, 0x007F3403, 0x007F7403, 0x007FB403,
85 0x007FF402, 0x00800065, 0x0081980A, 0x0081E805, 0x00822805,
86 0x00828020, 0x00834021, 0x00840002, 0x00840C04, 0x00842002,
87 0x00845001, 0x00845803, 0x00847806, 0x00849401, 0x00849C01,
88 0x0084A401, 0x0084B801, 0x0084E802, 0x00850005, 0x00852804,
89 0x00853C01, 0x00862802, 0x00864297, 0x0091000B, 0x0092704E,
90 0x00940276, 0x009E53E0, 0x00ADD820, 0x00AE6068, 0x00B39406,
91 0x00B3BC03, 0x00B3E404, 0x00B3F802, 0x00B5C001, 0x00B5FC01,
92 0x00B7804F, 0x00B8C020, 0x00BA001A, 0x00BA6C59, 0x00BC00D6,
93 0x00BFC00C, 0x00C00005, 0x00C02019, 0x00C0A807, 0x00C0D802,
94 0x00C0F403, 0x00C26404, 0x00C28001, 0x00C3EC01, 0x00C64002,
95 0x00C6580A, 0x00C70024, 0x00C8001F, 0x00C8A81E, 0x00C94001,
96 0x00C98020, 0x00CA2827, 0x00CB003F, 0x00CC0100, 0x01370040,
97 0x02924037, 0x0293F802, 0x02983403, 0x0299BC10, 0x029A7802,
98 0x029BC008, 0x029C0017, 0x029C8002, 0x029E2402, 0x02A00801,
99 0x02A01801, 0x02A02C01, 0x02A08C09, 0x02A0D804, 0x02A1D004,
100 0x02A20002, 0x02A2D012, 0x02A33802, 0x02A38012, 0x02A3E003,
101 0x02A3F001, 0x02A3FC01, 0x02A4980A, 0x02A51C0D, 0x02A57C01,
102 0x02A60004, 0x02A6CC1B, 0x02A77802, 0x02A79401, 0x02A8A40E,
103 0x02A90C01, 0x02A93002, 0x02A97004, 0x02A9DC03, 0x02A9EC03,
104 0x02AAC001, 0x02AAC803, 0x02AADC02, 0x02AAF802, 0x02AB0401,
105 0x02AB7802, 0x02ABAC07, 0x02ABD402, 0x02AD6C01, 0x02AF8C0B,
106 0x03600001, 0x036DFC02, 0x036FFC02, 0x037FFC01, 0x03EC7801,
107 0x03ECA401, 0x03EEC810, 0x03F4F802, 0x03F7F002, 0x03F8001A,
108 0x03F88033, 0x03F95013, 0x03F9A004, 0x03FBFC01, 0x03FC040F,
109 0x03FC6807, 0x03FCEC06, 0x03FD6C0B, 0x03FF8007, 0x03FFA007,
110 0x03FFE405, 0x04040003, 0x0404DC09, 0x0405E411, 0x04063003,
111 0x0406400C, 0x04068001, 0x0407402E, 0x040B8001, 0x040DD805,
112 0x040E7C01, 0x040F4001, 0x0415BC01, 0x04215C01, 0x0421DC02,
113 0x04247C01, 0x0424FC01, 0x04280403, 0x04281402, 0x04283004,
114 0x0428E003, 0x0428FC01, 0x04294009, 0x0429FC01, 0x042B2001,
115 0x042B9402, 0x042BC007, 0x042CE407, 0x042E6404, 0x04349004,
116 0x043D180B, 0x043D5405, 0x04400003, 0x0440E016, 0x0441FC04,
117 0x0442C012, 0x04433401, 0x04440003, 0x04449C0E, 0x04450004,
118 0x04451402, 0x0445CC03, 0x04460003, 0x0446CC0E, 0x04471409,
119 0x04476C01, 0x04477403, 0x0448B013, 0x044AA401, 0x044B7C0C,
120 0x044C0004, 0x044CEC02, 0x044CF807, 0x044D1C02, 0x044D2C03,
121 0x044D5C01, 0x044D8802, 0x044D9807, 0x044DC005, 0x0450D412,
122 0x04512C05, 0x04516C01, 0x04517402, 0x0452C014, 0x04531801,
123 0x0456BC07, 0x0456E020, 0x04577002, 0x0458C014, 0x0459800D,
124 0x045AAC0D, 0x045C740F, 0x045CF004, 0x0460B010, 0x04674407,
125 0x04676807, 0x04678801, 0x04679001, 0x0468040A, 0x0468CC07,
126 0x0468EC0D, 0x0469440B, 0x046A2813, 0x046A7805, 0x0470BC08,
127 0x0470E008, 0x04710405, 0x0471C002, 0x04724816, 0x0472A40E,
128 0x0474C406, 0x0474E801, 0x0474F002, 0x0474FC07, 0x04751C01,
129 0x04762805, 0x04764002, 0x04764C05, 0x047BCC06, 0x047F541D,
130 0x047FFC01, 0x0491C005, 0x04D0C009, 0x05A9B802, 0x05ABC006,
131 0x05ACC010, 0x05AD1002, 0x05BA5C04, 0x05BD3C01, 0x05BD4437,
132 0x05BE3C04, 0x05BF8801, 0x06F27008, 0x074000F6, 0x07440027,
133 0x0744A4C0, 0x07480046, 0x074C0057, 0x075B0401, 0x075B6C01,
134 0x075BEC01, 0x075C5401, 0x075CD401, 0x075D3C01, 0x075DBC01,
135 0x075E2401, 0x075EA401, 0x075F0C01, 0x0760028C, 0x076A6C05,
136 0x076A840F, 0x07800007, 0x07802011, 0x07806C07, 0x07808C02,
137 0x07809805, 0x0784C007, 0x07853C01, 0x078BB004, 0x078BFC01,
138 0x07A34007, 0x07A51007, 0x07A57802, 0x07B2B001, 0x07B2C001,
139 0x07B4B801, 0x07BBC002, 0x07C0002C, 0x07C0C064, 0x07C2800F,
140 0x07C2C40F, 0x07C3040F, 0x07C34425, 0x07C4405D, 0x07C5C03D,
141 0x07C7981D, 0x07C8402C, 0x07C90009, 0x07C94002, 0x07C98006,
142 0x07CC03D6, 0x07DB800D, 0x07DBC00B, 0x07DC0074, 0x07DE0059,
143 0x07DF800C, 0x07E0000C, 0x07E04038, 0x07E1400A, 0x07E18028,
144 0x07E2401E, 0x07E4000C, 0x07E43465, 0x07E5CC04, 0x07E5E829,
145 0x07E69406, 0x07E6B81D, 0x07E73487, 0x07E9800E, 0x07E9C004,
146 0x07E9E003, 0x07EA0003, 0x07EA4006, 0x38000401, 0x38008060,
147 0x380400F0,
148 };
149 static const unsigned int aAscii[4] = {
150 0xFFFFFFFF, 0xFC00FFFF, 0xF8000001, 0xF8000001,
151 };
152
@@ -176,36 +180,52 @@
180 ** of the ASCII letter only. For example, if passed 235 - "LATIN
181 ** SMALL LETTER E WITH DIAERESIS" - return 65 ("LATIN SMALL LETTER
182 ** E"). The resuls of passing a codepoint that corresponds to an
183 ** uppercase letter are undefined.
184 */
185 static int unicode_remove_diacritic(int c, int bComplex){
186 static const unsigned short aDia[] = {
187 0, 1797, 1848, 1859, 1891, 1928, 1940, 1995,
188 2024, 2040, 2060, 2110, 2168, 2206, 2264, 2286,
189 2344, 2383, 2472, 2488, 2516, 2596, 2668, 2732,
190 2782, 2842, 2894, 2954, 2984, 3000, 3028, 3336,
191 3456, 3696, 3712, 3728, 3744, 3766, 3832, 3896,
192 3912, 3928, 3944, 3968, 4008, 4040, 4056, 4106,
193 4138, 4170, 4202, 4234, 4266, 4296, 4312, 4344,
194 4408, 4424, 4442, 4472, 4488, 4504, 6148, 6198,
195 6264, 6280, 6360, 6429, 6505, 6529, 61448, 61468,
196 61512, 61534, 61592, 61610, 61642, 61672, 61688, 61704,
197 61726, 61784, 61800, 61816, 61836, 61880, 61896, 61914,
198 61948, 61998, 62062, 62122, 62154, 62184, 62200, 62218,
199 62252, 62302, 62364, 62410, 62442, 62478, 62536, 62554,
200 62584, 62604, 62640, 62648, 62656, 62664, 62730, 62766,
201 62830, 62890, 62924, 62974, 63032, 63050, 63082, 63118,
202 63182, 63242, 63274, 63310, 63368, 63390,
203 };
204 #define HIBIT ((unsigned char)0x80)
205 static const unsigned char aChar[] = {
206 '\0', 'a', 'c', 'e', 'i', 'n',
207 'o', 'u', 'y', 'y', 'a', 'c',
208 'd', 'e', 'e', 'g', 'h', 'i',
209 'j', 'k', 'l', 'n', 'o', 'r',
210 's', 't', 'u', 'u', 'w', 'y',
211 'z', 'o', 'u', 'a', 'i', 'o',
212 'u', 'u'|HIBIT, 'a'|HIBIT, 'g', 'k', 'o',
213 'o'|HIBIT, 'j', 'g', 'n', 'a'|HIBIT, 'a',
214 'e', 'i', 'o', 'r', 'u', 's',
215 't', 'h', 'a', 'e', 'o'|HIBIT, 'o',
216 'o'|HIBIT, 'y', '\0', '\0', '\0', '\0',
217 '\0', '\0', '\0', '\0', 'a', 'b',
218 'c'|HIBIT, 'd', 'd', 'e'|HIBIT, 'e', 'e'|HIBIT,
219 'f', 'g', 'h', 'h', 'i', 'i'|HIBIT,
220 'k', 'l', 'l'|HIBIT, 'l', 'm', 'n',
221 'o'|HIBIT, 'p', 'r', 'r'|HIBIT, 'r', 's',
222 's'|HIBIT, 't', 'u', 'u'|HIBIT, 'v', 'w',
223 'w', 'x', 'y', 'z', 'h', 't',
224 'w', 'y', 'a', 'a'|HIBIT, 'a'|HIBIT, 'a'|HIBIT,
225 'e', 'e'|HIBIT, 'e'|HIBIT, 'i', 'o', 'o'|HIBIT,
226 'o'|HIBIT, 'o'|HIBIT, 'u', 'u'|HIBIT, 'u'|HIBIT, 'y',
227 };
228
229 unsigned int key = (((unsigned int)c)<<3) | 0x00000007;
230 int iRes = 0;
231 int iHi = sizeof(aDia)/sizeof(aDia[0]) - 1;
@@ -218,11 +238,12 @@
238 }else{
239 iHi = iTest-1;
240 }
241 }
242 assert( key>=aDia[iRes] );
243 if( bComplex==0 && (aChar[iRes] & 0x80) ) return c;
244 return (c > (aDia[iRes]>>3) + (aDia[iRes]&0x07)) ? c : ((int)aChar[iRes] & 0x7F);
245 }
246
247
248 /*
249 ** Return true if the argument interpreted as a unicode codepoint
@@ -231,12 +252,12 @@
252 int unicode_is_diacritic(int c){
253 unsigned int mask0 = 0x08029FDF;
254 unsigned int mask1 = 0x000361F8;
255 if( c<768 || c>817 ) return 0;
256 return (c < 768+32) ?
257 (mask0 & ((unsigned int)1 << (c-768))) :
258 (mask1 & ((unsigned int)1 << (c-768-32)));
259 }
260
261
262 /*
263 ** Interpret the argument as a unicode codepoint. If the codepoint
@@ -245,11 +266,11 @@
266 ** Otherwise, return a copy of the argument.
267 **
268 ** The results are undefined if the value passed to this function
269 ** is less than zero.
270 */
271 int unicode_fold(int c, int eRemoveDiacritic){
272 /* Each entry in the following array defines a rule for folding a range
273 ** of codepoints to lower case. The rule applies to a range of nRange
274 ** codepoints starting at codepoint iCode.
275 **
276 ** If the least significant bit in flags is clear, then the rule applies
@@ -270,12 +291,12 @@
291 unsigned char flags;
292 unsigned char nRange;
293 } aEntry[] = {
294 {65, 14, 26}, {181, 66, 1}, {192, 14, 23},
295 {216, 14, 7}, {256, 1, 48}, {306, 1, 6},
296 {313, 1, 16}, {330, 1, 46}, {376, 156, 1},
297 {377, 1, 6}, {383, 144, 1}, {385, 52, 1},
298 {386, 1, 4}, {390, 46, 1}, {391, 0, 1},
299 {393, 44, 2}, {395, 0, 1}, {398, 34, 1},
300 {399, 40, 1}, {400, 42, 1}, {401, 0, 1},
301 {403, 44, 1}, {404, 48, 1}, {406, 54, 1},
302 {407, 50, 1}, {408, 0, 1}, {412, 54, 1},
@@ -284,70 +305,72 @@
305 {428, 0, 1}, {430, 62, 1}, {431, 0, 1},
306 {433, 60, 2}, {435, 1, 4}, {439, 64, 1},
307 {440, 0, 1}, {444, 0, 1}, {452, 2, 1},
308 {453, 0, 1}, {455, 2, 1}, {456, 0, 1},
309 {458, 2, 1}, {459, 1, 18}, {478, 1, 18},
310 {497, 2, 1}, {498, 1, 4}, {502, 162, 1},
311 {503, 174, 1}, {504, 1, 40}, {544, 150, 1},
312 {546, 1, 18}, {570, 74, 1}, {571, 0, 1},
313 {573, 148, 1}, {574, 72, 1}, {577, 0, 1},
314 {579, 146, 1}, {580, 30, 1}, {581, 32, 1},
315 {582, 1, 10}, {837, 38, 1}, {880, 1, 4},
316 {886, 0, 1}, {895, 38, 1}, {902, 20, 1},
317 {904, 18, 3}, {908, 28, 1}, {910, 26, 2},
318 {913, 14, 17}, {931, 14, 9}, {962, 0, 1},
319 {975, 4, 1}, {976, 180, 1}, {977, 182, 1},
320 {981, 186, 1}, {982, 184, 1}, {984, 1, 24},
321 {1008, 176, 1}, {1009, 178, 1}, {1012, 170, 1},
322 {1013, 168, 1}, {1015, 0, 1}, {1017, 192, 1},
323 {1018, 0, 1}, {1021, 150, 3}, {1024, 36, 16},
324 {1040, 14, 32}, {1120, 1, 34}, {1162, 1, 54},
325 {1216, 6, 1}, {1217, 1, 14}, {1232, 1, 96},
326 {1329, 24, 38}, {4256, 70, 38}, {4295, 70, 1},
327 {4301, 70, 1}, {5112, 190, 6}, {7296, 126, 1},
328 {7297, 128, 1}, {7298, 130, 1}, {7299, 134, 2},
329 {7301, 132, 1}, {7302, 136, 1}, {7303, 138, 1},
330 {7304, 100, 1}, {7312, 142, 43}, {7357, 142, 3},
331 {7680, 1, 150}, {7835, 172, 1}, {7838, 120, 1},
332 {7840, 1, 96}, {7944, 190, 8}, {7960, 190, 6},
333 {7976, 190, 8}, {7992, 190, 8}, {8008, 190, 6},
334 {8025, 191, 8}, {8040, 190, 8}, {8072, 190, 8},
335 {8088, 190, 8}, {8104, 190, 8}, {8120, 190, 2},
336 {8122, 166, 2}, {8124, 188, 1}, {8126, 124, 1},
337 {8136, 164, 4}, {8140, 188, 1}, {8152, 190, 2},
338 {8154, 160, 2}, {8168, 190, 2}, {8170, 158, 2},
339 {8172, 192, 1}, {8184, 152, 2}, {8186, 154, 2},
340 {8188, 188, 1}, {8486, 122, 1}, {8490, 116, 1},
341 {8491, 118, 1}, {8498, 12, 1}, {8544, 8, 16},
342 {8579, 0, 1}, {9398, 10, 26}, {11264, 24, 47},
343 {11360, 0, 1}, {11362, 112, 1}, {11363, 140, 1},
344 {11364, 114, 1}, {11367, 1, 6}, {11373, 108, 1},
345 {11374, 110, 1}, {11375, 104, 1}, {11376, 106, 1},
346 {11378, 0, 1}, {11381, 0, 1}, {11390, 102, 2},
347 {11392, 1, 100}, {11499, 1, 4}, {11506, 0, 1},
348 {42560, 1, 46}, {42624, 1, 28}, {42786, 1, 14},
349 {42802, 1, 62}, {42873, 1, 4}, {42877, 98, 1},
350 {42878, 1, 10}, {42891, 0, 1}, {42893, 88, 1},
351 {42896, 1, 4}, {42902, 1, 20}, {42922, 80, 1},
352 {42923, 76, 1}, {42924, 78, 1}, {42925, 84, 1},
353 {42926, 80, 1}, {42928, 92, 1}, {42929, 86, 1},
354 {42930, 90, 1}, {42931, 68, 1}, {42932, 1, 12},
355 {42946, 0, 1}, {42948, 178, 1}, {42949, 82, 1},
356 {42950, 96, 1}, {43888, 94, 80}, {65313, 14, 26},
357 };
358 static const unsigned short aiOff[] = {
359 1, 2, 8, 15, 16, 26, 28, 32,
360 34, 37, 38, 40, 48, 63, 64, 69,
361 71, 79, 80, 116, 202, 203, 205, 206,
362 207, 209, 210, 211, 213, 214, 217, 218,
363 219, 775, 928, 7264, 10792, 10795, 23217, 23221,
364 23228, 23229, 23231, 23254, 23256, 23275, 23278, 26672,
365 30152, 30204, 35267, 54721, 54753, 54754, 54756, 54787,
366 54793, 54809, 57153, 57274, 57921, 58019, 58363, 59314,
367 59315, 59324, 59325, 59326, 59332, 59356, 61722, 62528,
368 65268, 65341, 65373, 65406, 65408, 65410, 65415, 65424,
369 65436, 65439, 65450, 65462, 65472, 65476, 65478, 65480,
370 65482, 65488, 65506, 65511, 65514, 65521, 65527, 65528,
371 65529,
372 };
373
374 int ret = c;
375
376 assert( sizeof(unsigned short)==2 && sizeof(unsigned char)==1 );
@@ -377,11 +400,13 @@
400 if( c<(p->iCode + p->nRange) && 0==(0x01 & p->flags & (p->iCode ^ c)) ){
401 ret = (c + (aiOff[p->flags>>1])) & 0x0000FFFF;
402 assert( ret>0 );
403 }
404
405 if( eRemoveDiacritic ){
406 ret = unicode_remove_diacritic(ret, eRemoveDiacritic==2);
407 }
408 }
409
410 else if( c>=66560 && c<66600 ){
411 ret = c + 40;
412 }
413
+36 -5
--- src/update.c
+++ src/update.c
@@ -160,11 +160,11 @@
160160
}
161161
}
162162
163163
/* Create any empty directories now, as well as after the update,
164164
** so changes in settings are reflected now */
165
- if( !dryRunFlag ) ensure_empty_dirs_created();
165
+ if( !dryRunFlag ) ensure_empty_dirs_created(0);
166166
167167
if( internalUpdate ){
168168
tid = internalUpdate;
169169
}else if( g.argc>=3 ){
170170
if( fossil_strcmp(g.argv[2], "current")==0 ){
@@ -227,10 +227,14 @@
227227
if( tid==0 ){
228228
return;
229229
}
230230
231231
db_begin_transaction();
232
+ db_multi_exec(
233
+ "CREATE TEMP TABLE dir_to_delete(name TEXT %s PRIMARY KEY)WITHOUT ROWID",
234
+ filename_collation()
235
+ );
232236
vfile_check_signature(vid, CKSIG_ENOTFILE);
233237
if( !dryRunFlag && !internalUpdate ) undo_begin();
234238
if( load_vfile_from_rid(tid) && !forceMissingFlag ){
235239
fossil_fatal("missing content, unable to update");
236240
};
@@ -455,11 +459,23 @@
455459
zName);
456460
nConflict++;
457461
}else{
458462
fossil_print("REMOVE %s\n", zName);
459463
if( !dryRunFlag && !internalUpdate ) undo_save(zName);
460
- if( !dryRunFlag ) file_delete(zFullPath);
464
+ if( !dryRunFlag ){
465
+ char *zDir;
466
+ file_delete(zFullPath);
467
+ zDir = file_dirname(zName);
468
+ while( zDir!=0 ){
469
+ char *zNext;
470
+ db_multi_exec("INSERT OR IGNORE INTO dir_to_delete(name)"
471
+ "VALUES(%Q)", zDir);
472
+ zNext = db_changes() ? file_dirname(zDir) : 0;
473
+ fossil_free(zDir);
474
+ zDir = zNext;
475
+ }
476
+ }
461477
}
462478
}else if( idt>0 && idv>0 && ridt!=ridv && chnged ){
463479
/* Merge the changes in the current tree into the target version */
464480
Blob r, t, v;
465481
int rc;
@@ -566,11 +582,21 @@
566582
** Clean up the mid and pid VFILE entries. Then commit the changes.
567583
*/
568584
if( dryRunFlag ){
569585
db_end_transaction(1); /* With --dry-run, rollback changes */
570586
}else{
571
- ensure_empty_dirs_created();
587
+ char *zPwd;
588
+ ensure_empty_dirs_created(1);
589
+ sqlite3_create_function(g.db, "rmdir", 1, SQLITE_UTF8, 0,
590
+ file_rmdir_sql_function, 0, 0);
591
+ zPwd = file_getcwd(0,0);
592
+ db_multi_exec(
593
+ "SELECT rmdir(%Q||name) FROM dir_to_delete"
594
+ " WHERE (%Q||name)<>%Q ORDER BY name DESC",
595
+ g.zLocalRoot, g.zLocalRoot, zPwd
596
+ );
597
+ fossil_free(zPwd);
572598
if( g.argc<=3 ){
573599
/* All files updated. Shift the current checkout to the target. */
574600
db_multi_exec("DELETE FROM vfile WHERE vid!=%d", tid);
575601
checkout_set_all_exe(tid);
576602
manifest_to_disk(tid);
@@ -587,11 +613,11 @@
587613
}
588614
589615
/*
590616
** Create empty directories specified by the empty-dirs setting.
591617
*/
592
-void ensure_empty_dirs_created(void){
618
+void ensure_empty_dirs_created(int clearDirTable){
593619
char *zEmptyDirs = db_get("empty-dirs", 0);
594620
if( zEmptyDirs!=0 ){
595621
int i;
596622
Blob dirName;
597623
Blob dirsList;
@@ -613,11 +639,16 @@
613639
"required by empty-dirs setting", zDir);
614640
}
615641
break;
616642
}
617643
case 1: { /* exists, and is a directory */
618
- /* do nothing - required directory exists already */
644
+ /* make sure this directory is not on the delete list */
645
+ if( clearDirTable ){
646
+ db_multi_exec(
647
+ "DELETE FROM dir_to_delete WHERE name=%Q", zDir
648
+ );
649
+ }
619650
break;
620651
}
621652
case 2: { /* exists, but isn't a directory */
622653
fossil_warning("file %s found, but a directory is required "
623654
"by empty-dirs setting", zDir);
624655
--- src/update.c
+++ src/update.c
@@ -160,11 +160,11 @@
160 }
161 }
162
163 /* Create any empty directories now, as well as after the update,
164 ** so changes in settings are reflected now */
165 if( !dryRunFlag ) ensure_empty_dirs_created();
166
167 if( internalUpdate ){
168 tid = internalUpdate;
169 }else if( g.argc>=3 ){
170 if( fossil_strcmp(g.argv[2], "current")==0 ){
@@ -227,10 +227,14 @@
227 if( tid==0 ){
228 return;
229 }
230
231 db_begin_transaction();
 
 
 
 
232 vfile_check_signature(vid, CKSIG_ENOTFILE);
233 if( !dryRunFlag && !internalUpdate ) undo_begin();
234 if( load_vfile_from_rid(tid) && !forceMissingFlag ){
235 fossil_fatal("missing content, unable to update");
236 };
@@ -455,11 +459,23 @@
455 zName);
456 nConflict++;
457 }else{
458 fossil_print("REMOVE %s\n", zName);
459 if( !dryRunFlag && !internalUpdate ) undo_save(zName);
460 if( !dryRunFlag ) file_delete(zFullPath);
 
 
 
 
 
 
 
 
 
 
 
 
461 }
462 }else if( idt>0 && idv>0 && ridt!=ridv && chnged ){
463 /* Merge the changes in the current tree into the target version */
464 Blob r, t, v;
465 int rc;
@@ -566,11 +582,21 @@
566 ** Clean up the mid and pid VFILE entries. Then commit the changes.
567 */
568 if( dryRunFlag ){
569 db_end_transaction(1); /* With --dry-run, rollback changes */
570 }else{
571 ensure_empty_dirs_created();
 
 
 
 
 
 
 
 
 
 
572 if( g.argc<=3 ){
573 /* All files updated. Shift the current checkout to the target. */
574 db_multi_exec("DELETE FROM vfile WHERE vid!=%d", tid);
575 checkout_set_all_exe(tid);
576 manifest_to_disk(tid);
@@ -587,11 +613,11 @@
587 }
588
589 /*
590 ** Create empty directories specified by the empty-dirs setting.
591 */
592 void ensure_empty_dirs_created(void){
593 char *zEmptyDirs = db_get("empty-dirs", 0);
594 if( zEmptyDirs!=0 ){
595 int i;
596 Blob dirName;
597 Blob dirsList;
@@ -613,11 +639,16 @@
613 "required by empty-dirs setting", zDir);
614 }
615 break;
616 }
617 case 1: { /* exists, and is a directory */
618 /* do nothing - required directory exists already */
 
 
 
 
 
619 break;
620 }
621 case 2: { /* exists, but isn't a directory */
622 fossil_warning("file %s found, but a directory is required "
623 "by empty-dirs setting", zDir);
624
--- src/update.c
+++ src/update.c
@@ -160,11 +160,11 @@
160 }
161 }
162
163 /* Create any empty directories now, as well as after the update,
164 ** so changes in settings are reflected now */
165 if( !dryRunFlag ) ensure_empty_dirs_created(0);
166
167 if( internalUpdate ){
168 tid = internalUpdate;
169 }else if( g.argc>=3 ){
170 if( fossil_strcmp(g.argv[2], "current")==0 ){
@@ -227,10 +227,14 @@
227 if( tid==0 ){
228 return;
229 }
230
231 db_begin_transaction();
232 db_multi_exec(
233 "CREATE TEMP TABLE dir_to_delete(name TEXT %s PRIMARY KEY)WITHOUT ROWID",
234 filename_collation()
235 );
236 vfile_check_signature(vid, CKSIG_ENOTFILE);
237 if( !dryRunFlag && !internalUpdate ) undo_begin();
238 if( load_vfile_from_rid(tid) && !forceMissingFlag ){
239 fossil_fatal("missing content, unable to update");
240 };
@@ -455,11 +459,23 @@
459 zName);
460 nConflict++;
461 }else{
462 fossil_print("REMOVE %s\n", zName);
463 if( !dryRunFlag && !internalUpdate ) undo_save(zName);
464 if( !dryRunFlag ){
465 char *zDir;
466 file_delete(zFullPath);
467 zDir = file_dirname(zName);
468 while( zDir!=0 ){
469 char *zNext;
470 db_multi_exec("INSERT OR IGNORE INTO dir_to_delete(name)"
471 "VALUES(%Q)", zDir);
472 zNext = db_changes() ? file_dirname(zDir) : 0;
473 fossil_free(zDir);
474 zDir = zNext;
475 }
476 }
477 }
478 }else if( idt>0 && idv>0 && ridt!=ridv && chnged ){
479 /* Merge the changes in the current tree into the target version */
480 Blob r, t, v;
481 int rc;
@@ -566,11 +582,21 @@
582 ** Clean up the mid and pid VFILE entries. Then commit the changes.
583 */
584 if( dryRunFlag ){
585 db_end_transaction(1); /* With --dry-run, rollback changes */
586 }else{
587 char *zPwd;
588 ensure_empty_dirs_created(1);
589 sqlite3_create_function(g.db, "rmdir", 1, SQLITE_UTF8, 0,
590 file_rmdir_sql_function, 0, 0);
591 zPwd = file_getcwd(0,0);
592 db_multi_exec(
593 "SELECT rmdir(%Q||name) FROM dir_to_delete"
594 " WHERE (%Q||name)<>%Q ORDER BY name DESC",
595 g.zLocalRoot, g.zLocalRoot, zPwd
596 );
597 fossil_free(zPwd);
598 if( g.argc<=3 ){
599 /* All files updated. Shift the current checkout to the target. */
600 db_multi_exec("DELETE FROM vfile WHERE vid!=%d", tid);
601 checkout_set_all_exe(tid);
602 manifest_to_disk(tid);
@@ -587,11 +613,11 @@
613 }
614
615 /*
616 ** Create empty directories specified by the empty-dirs setting.
617 */
618 void ensure_empty_dirs_created(int clearDirTable){
619 char *zEmptyDirs = db_get("empty-dirs", 0);
620 if( zEmptyDirs!=0 ){
621 int i;
622 Blob dirName;
623 Blob dirsList;
@@ -613,11 +639,16 @@
639 "required by empty-dirs setting", zDir);
640 }
641 break;
642 }
643 case 1: { /* exists, and is a directory */
644 /* make sure this directory is not on the delete list */
645 if( clearDirTable ){
646 db_multi_exec(
647 "DELETE FROM dir_to_delete WHERE name=%Q", zDir
648 );
649 }
650 break;
651 }
652 case 2: { /* exists, but isn't a directory */
653 fossil_warning("file %s found, but a directory is required "
654 "by empty-dirs setting", zDir);
655
-18
--- src/vfile.c
+++ src/vfile.c
@@ -359,28 +359,10 @@
359359
file_mtime(zName, RepoFILE), id);
360360
}
361361
db_finalize(&q);
362362
}
363363
364
-
365
-/*
366
-** Delete from the disk every file in VFILE vid.
367
-*/
368
-void vfile_unlink(int vid){
369
- Stmt q;
370
- db_prepare(&q, "SELECT %Q || pathname FROM vfile"
371
- " WHERE vid=%d AND mrid>0", g.zLocalRoot, vid);
372
- while( db_step(&q)==SQLITE_ROW ){
373
- const char *zName;
374
-
375
- zName = db_column_text(&q, 0);
376
- file_delete(zName);
377
- }
378
- db_finalize(&q);
379
- db_multi_exec("UPDATE vfile SET mtime=NULL WHERE vid=%d AND mrid>0", vid);
380
-}
381
-
382364
/*
383365
** Check to see if the directory named in zPath is the top of a checkout.
384366
** In other words, check to see if directory pPath contains a file named
385367
** "_FOSSIL_" or ".fslckout". Return true or false.
386368
*/
387369
--- src/vfile.c
+++ src/vfile.c
@@ -359,28 +359,10 @@
359 file_mtime(zName, RepoFILE), id);
360 }
361 db_finalize(&q);
362 }
363
364
365 /*
366 ** Delete from the disk every file in VFILE vid.
367 */
368 void vfile_unlink(int vid){
369 Stmt q;
370 db_prepare(&q, "SELECT %Q || pathname FROM vfile"
371 " WHERE vid=%d AND mrid>0", g.zLocalRoot, vid);
372 while( db_step(&q)==SQLITE_ROW ){
373 const char *zName;
374
375 zName = db_column_text(&q, 0);
376 file_delete(zName);
377 }
378 db_finalize(&q);
379 db_multi_exec("UPDATE vfile SET mtime=NULL WHERE vid=%d AND mrid>0", vid);
380 }
381
382 /*
383 ** Check to see if the directory named in zPath is the top of a checkout.
384 ** In other words, check to see if directory pPath contains a file named
385 ** "_FOSSIL_" or ".fslckout". Return true or false.
386 */
387
--- src/vfile.c
+++ src/vfile.c
@@ -359,28 +359,10 @@
359 file_mtime(zName, RepoFILE), id);
360 }
361 db_finalize(&q);
362 }
363
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
364 /*
365 ** Check to see if the directory named in zPath is the top of a checkout.
366 ** In other words, check to see if directory pPath contains a file named
367 ** "_FOSSIL_" or ".fslckout". Return true or false.
368 */
369
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1108,28 +1108,26 @@
11081108
static int is_ticket(
11091109
const char *zTarget, /* Ticket UUID */
11101110
int *pClosed /* True if the ticket is closed */
11111111
){
11121112
static Stmt q;
1113
- static int once = 1;
11141113
int n;
11151114
int rc;
11161115
char zLower[HNAME_MAX+1];
11171116
char zUpper[HNAME_MAX+1];
11181117
n = strlen(zTarget);
11191118
memcpy(zLower, zTarget, n+1);
11201119
canonical16(zLower, n+1);
11211120
memcpy(zUpper, zLower, n+1);
11221121
zUpper[n-1]++;
1123
- if( once ){
1122
+ if( !db_static_stmt_is_init(&q) ){
11241123
const char *zClosedExpr = db_get("ticket-closed-expr", "status='Closed'");
11251124
db_static_prepare(&q,
11261125
"SELECT %s FROM ticket "
11271126
" WHERE tkt_uuid>=:lwr AND tkt_uuid<:upr",
11281127
zClosedExpr /*safe-for-%s*/
11291128
);
1130
- once = 0;
11311129
}
11321130
db_bind_text(&q, ":lwr", zLower);
11331131
db_bind_text(&q, ":upr", zUpper);
11341132
if( db_step(&q)==SQLITE_ROW ){
11351133
rc = 1;
11361134
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1108,28 +1108,26 @@
1108 static int is_ticket(
1109 const char *zTarget, /* Ticket UUID */
1110 int *pClosed /* True if the ticket is closed */
1111 ){
1112 static Stmt q;
1113 static int once = 1;
1114 int n;
1115 int rc;
1116 char zLower[HNAME_MAX+1];
1117 char zUpper[HNAME_MAX+1];
1118 n = strlen(zTarget);
1119 memcpy(zLower, zTarget, n+1);
1120 canonical16(zLower, n+1);
1121 memcpy(zUpper, zLower, n+1);
1122 zUpper[n-1]++;
1123 if( once ){
1124 const char *zClosedExpr = db_get("ticket-closed-expr", "status='Closed'");
1125 db_static_prepare(&q,
1126 "SELECT %s FROM ticket "
1127 " WHERE tkt_uuid>=:lwr AND tkt_uuid<:upr",
1128 zClosedExpr /*safe-for-%s*/
1129 );
1130 once = 0;
1131 }
1132 db_bind_text(&q, ":lwr", zLower);
1133 db_bind_text(&q, ":upr", zUpper);
1134 if( db_step(&q)==SQLITE_ROW ){
1135 rc = 1;
1136
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1108,28 +1108,26 @@
1108 static int is_ticket(
1109 const char *zTarget, /* Ticket UUID */
1110 int *pClosed /* True if the ticket is closed */
1111 ){
1112 static Stmt q;
 
1113 int n;
1114 int rc;
1115 char zLower[HNAME_MAX+1];
1116 char zUpper[HNAME_MAX+1];
1117 n = strlen(zTarget);
1118 memcpy(zLower, zTarget, n+1);
1119 canonical16(zLower, n+1);
1120 memcpy(zUpper, zLower, n+1);
1121 zUpper[n-1]++;
1122 if( !db_static_stmt_is_init(&q) ){
1123 const char *zClosedExpr = db_get("ticket-closed-expr", "status='Closed'");
1124 db_static_prepare(&q,
1125 "SELECT %s FROM ticket "
1126 " WHERE tkt_uuid>=:lwr AND tkt_uuid<:upr",
1127 zClosedExpr /*safe-for-%s*/
1128 );
 
1129 }
1130 db_bind_text(&q, ":lwr", zLower);
1131 db_bind_text(&q, ":upr", zUpper);
1132 if( db_step(&q)==SQLITE_ROW ){
1133 rc = 1;
1134
+10 -4
--- win/Makefile.dmc
+++ win/Makefile.dmc
@@ -28,13 +28,13 @@
2828
2929
SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB
3030
3131
SHELL_OPTIONS = -DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
3232
33
-SRC = add_.c alerts_.c allrepo_.c attach_.c backoffice_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c capabilities_.c captcha_.c cgi_.c checkin_.c checkout_.c clearsign_.c clone_.c comformat_.c configure_.c content_.c cookies_.c db_.c delta_.c deltacmd_.c descendants_.c diff_.c diffcmd_.c dispatch_.c doc_.c encode_.c etag_.c event_.c export_.c file_.c finfo_.c foci_.c forum_.c fshell_.c fusefs_.c glob_.c graph_.c gzip_.c hname_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c md5_.c merge_.c merge3_.c moderate_.c name_.c path_.c piechart_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c repolist_.c report_.c rss_.c schema_.c search_.c security_audit_.c setup_.c setupuser_.c sha1_.c sha1hard_.c sha3_.c shun_.c sitemap_.c skins_.c smtp_.c sqlcmd_.c stash_.c stat_.c statrep_.c style_.c sync_.c tag_.c tar_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c unversioned_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c webmail_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c wysiwyg_.c xfer_.c xfersetup_.c zip_.c
33
+SRC = add_.c alerts_.c allrepo_.c attach_.c backoffice_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c capabilities_.c captcha_.c cgi_.c checkin_.c checkout_.c clearsign_.c clone_.c comformat_.c configure_.c content_.c cookies_.c db_.c delta_.c deltacmd_.c deltafunc_.c descendants_.c diff_.c diffcmd_.c dispatch_.c doc_.c encode_.c etag_.c event_.c export_.c file_.c finfo_.c foci_.c forum_.c fshell_.c fusefs_.c glob_.c graph_.c gzip_.c hname_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c md5_.c merge_.c merge3_.c moderate_.c name_.c path_.c piechart_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c repolist_.c report_.c rss_.c schema_.c search_.c security_audit_.c setup_.c setupuser_.c sha1_.c sha1hard_.c sha3_.c shun_.c sitemap_.c skins_.c smtp_.c sqlcmd_.c stash_.c stat_.c statrep_.c style_.c sync_.c tag_.c tar_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c unversioned_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c webmail_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c wysiwyg_.c xfer_.c xfersetup_.c zip_.c
3434
35
-OBJ = $(OBJDIR)\add$O $(OBJDIR)\alerts$O $(OBJDIR)\allrepo$O $(OBJDIR)\attach$O $(OBJDIR)\backoffice$O $(OBJDIR)\bag$O $(OBJDIR)\bisect$O $(OBJDIR)\blob$O $(OBJDIR)\branch$O $(OBJDIR)\browse$O $(OBJDIR)\builtin$O $(OBJDIR)\bundle$O $(OBJDIR)\cache$O $(OBJDIR)\capabilities$O $(OBJDIR)\captcha$O $(OBJDIR)\cgi$O $(OBJDIR)\checkin$O $(OBJDIR)\checkout$O $(OBJDIR)\clearsign$O $(OBJDIR)\clone$O $(OBJDIR)\comformat$O $(OBJDIR)\configure$O $(OBJDIR)\content$O $(OBJDIR)\cookies$O $(OBJDIR)\db$O $(OBJDIR)\delta$O $(OBJDIR)\deltacmd$O $(OBJDIR)\descendants$O $(OBJDIR)\diff$O $(OBJDIR)\diffcmd$O $(OBJDIR)\dispatch$O $(OBJDIR)\doc$O $(OBJDIR)\encode$O $(OBJDIR)\etag$O $(OBJDIR)\event$O $(OBJDIR)\export$O $(OBJDIR)\file$O $(OBJDIR)\finfo$O $(OBJDIR)\foci$O $(OBJDIR)\forum$O $(OBJDIR)\fshell$O $(OBJDIR)\fusefs$O $(OBJDIR)\glob$O $(OBJDIR)\graph$O $(OBJDIR)\gzip$O $(OBJDIR)\hname$O $(OBJDIR)\http$O $(OBJDIR)\http_socket$O $(OBJDIR)\http_ssl$O $(OBJDIR)\http_transport$O $(OBJDIR)\import$O $(OBJDIR)\info$O $(OBJDIR)\json$O $(OBJDIR)\json_artifact$O $(OBJDIR)\json_branch$O $(OBJDIR)\json_config$O $(OBJDIR)\json_diff$O $(OBJDIR)\json_dir$O $(OBJDIR)\json_finfo$O $(OBJDIR)\json_login$O $(OBJDIR)\json_query$O $(OBJDIR)\json_report$O $(OBJDIR)\json_status$O $(OBJDIR)\json_tag$O $(OBJDIR)\json_timeline$O $(OBJDIR)\json_user$O $(OBJDIR)\json_wiki$O $(OBJDIR)\leaf$O $(OBJDIR)\loadctrl$O $(OBJDIR)\login$O $(OBJDIR)\lookslike$O $(OBJDIR)\main$O $(OBJDIR)\manifest$O $(OBJDIR)\markdown$O $(OBJDIR)\markdown_html$O $(OBJDIR)\md5$O $(OBJDIR)\merge$O $(OBJDIR)\merge3$O $(OBJDIR)\moderate$O $(OBJDIR)\name$O $(OBJDIR)\path$O $(OBJDIR)\piechart$O $(OBJDIR)\pivot$O $(OBJDIR)\popen$O $(OBJDIR)\pqueue$O $(OBJDIR)\printf$O $(OBJDIR)\publish$O $(OBJDIR)\purge$O $(OBJDIR)\rebuild$O $(OBJDIR)\regexp$O $(OBJDIR)\repolist$O $(OBJDIR)\report$O $(OBJDIR)\rss$O $(OBJDIR)\schema$O $(OBJDIR)\search$O $(OBJDIR)\security_audit$O $(OBJDIR)\setup$O $(OBJDIR)\setupuser$O $(OBJDIR)\sha1$O $(OBJDIR)\sha1hard$O $(OBJDIR)\sha3$O $(OBJDIR)\shun$O $(OBJDIR)\sitemap$O $(OBJDIR)\skins$O $(OBJDIR)\smtp$O $(OBJDIR)\sqlcmd$O $(OBJDIR)\stash$O $(OBJDIR)\stat$O $(OBJDIR)\statrep$O $(OBJDIR)\style$O $(OBJDIR)\sync$O $(OBJDIR)\tag$O $(OBJDIR)\tar$O $(OBJDIR)\th_main$O $(OBJDIR)\timeline$O $(OBJDIR)\tkt$O $(OBJDIR)\tktsetup$O $(OBJDIR)\undo$O $(OBJDIR)\unicode$O $(OBJDIR)\unversioned$O $(OBJDIR)\update$O $(OBJDIR)\url$O $(OBJDIR)\user$O $(OBJDIR)\utf8$O $(OBJDIR)\util$O $(OBJDIR)\verify$O $(OBJDIR)\vfile$O $(OBJDIR)\webmail$O $(OBJDIR)\wiki$O $(OBJDIR)\wikiformat$O $(OBJDIR)\winfile$O $(OBJDIR)\winhttp$O $(OBJDIR)\wysiwyg$O $(OBJDIR)\xfer$O $(OBJDIR)\xfersetup$O $(OBJDIR)\zip$O $(OBJDIR)\shell$O $(OBJDIR)\sqlite3$O $(OBJDIR)\th$O $(OBJDIR)\th_lang$O
35
+OBJ = $(OBJDIR)\add$O $(OBJDIR)\alerts$O $(OBJDIR)\allrepo$O $(OBJDIR)\attach$O $(OBJDIR)\backoffice$O $(OBJDIR)\bag$O $(OBJDIR)\bisect$O $(OBJDIR)\blob$O $(OBJDIR)\branch$O $(OBJDIR)\browse$O $(OBJDIR)\builtin$O $(OBJDIR)\bundle$O $(OBJDIR)\cache$O $(OBJDIR)\capabilities$O $(OBJDIR)\captcha$O $(OBJDIR)\cgi$O $(OBJDIR)\checkin$O $(OBJDIR)\checkout$O $(OBJDIR)\clearsign$O $(OBJDIR)\clone$O $(OBJDIR)\comformat$O $(OBJDIR)\configure$O $(OBJDIR)\content$O $(OBJDIR)\cookies$O $(OBJDIR)\db$O $(OBJDIR)\delta$O $(OBJDIR)\deltacmd$O $(OBJDIR)\deltafunc$O $(OBJDIR)\descendants$O $(OBJDIR)\diff$O $(OBJDIR)\diffcmd$O $(OBJDIR)\dispatch$O $(OBJDIR)\doc$O $(OBJDIR)\encode$O $(OBJDIR)\etag$O $(OBJDIR)\event$O $(OBJDIR)\export$O $(OBJDIR)\file$O $(OBJDIR)\finfo$O $(OBJDIR)\foci$O $(OBJDIR)\forum$O $(OBJDIR)\fshell$O $(OBJDIR)\fusefs$O $(OBJDIR)\glob$O $(OBJDIR)\graph$O $(OBJDIR)\gzip$O $(OBJDIR)\hname$O $(OBJDIR)\http$O $(OBJDIR)\http_socket$O $(OBJDIR)\http_ssl$O $(OBJDIR)\http_transport$O $(OBJDIR)\import$O $(OBJDIR)\info$O $(OBJDIR)\json$O $(OBJDIR)\json_artifact$O $(OBJDIR)\json_branch$O $(OBJDIR)\json_config$O $(OBJDIR)\json_diff$O $(OBJDIR)\json_dir$O $(OBJDIR)\json_finfo$O $(OBJDIR)\json_login$O $(OBJDIR)\json_query$O $(OBJDIR)\json_report$O $(OBJDIR)\json_status$O $(OBJDIR)\json_tag$O $(OBJDIR)\json_timeline$O $(OBJDIR)\json_user$O $(OBJDIR)\json_wiki$O $(OBJDIR)\leaf$O $(OBJDIR)\loadctrl$O $(OBJDIR)\login$O $(OBJDIR)\lookslike$O $(OBJDIR)\main$O $(OBJDIR)\manifest$O $(OBJDIR)\markdown$O $(OBJDIR)\markdown_html$O $(OBJDIR)\md5$O $(OBJDIR)\merge$O $(OBJDIR)\merge3$O $(OBJDIR)\moderate$O $(OBJDIR)\name$O $(OBJDIR)\path$O $(OBJDIR)\piechart$O $(OBJDIR)\pivot$O $(OBJDIR)\popen$O $(OBJDIR)\pqueue$O $(OBJDIR)\printf$O $(OBJDIR)\publish$O $(OBJDIR)\purge$O $(OBJDIR)\rebuild$O $(OBJDIR)\regexp$O $(OBJDIR)\repolist$O $(OBJDIR)\report$O $(OBJDIR)\rss$O $(OBJDIR)\schema$O $(OBJDIR)\search$O $(OBJDIR)\security_audit$O $(OBJDIR)\setup$O $(OBJDIR)\setupuser$O $(OBJDIR)\sha1$O $(OBJDIR)\sha1hard$O $(OBJDIR)\sha3$O $(OBJDIR)\shun$O $(OBJDIR)\sitemap$O $(OBJDIR)\skins$O $(OBJDIR)\smtp$O $(OBJDIR)\sqlcmd$O $(OBJDIR)\stash$O $(OBJDIR)\stat$O $(OBJDIR)\statrep$O $(OBJDIR)\style$O $(OBJDIR)\sync$O $(OBJDIR)\tag$O $(OBJDIR)\tar$O $(OBJDIR)\th_main$O $(OBJDIR)\timeline$O $(OBJDIR)\tkt$O $(OBJDIR)\tktsetup$O $(OBJDIR)\undo$O $(OBJDIR)\unicode$O $(OBJDIR)\unversioned$O $(OBJDIR)\update$O $(OBJDIR)\url$O $(OBJDIR)\user$O $(OBJDIR)\utf8$O $(OBJDIR)\util$O $(OBJDIR)\verify$O $(OBJDIR)\vfile$O $(OBJDIR)\webmail$O $(OBJDIR)\wiki$O $(OBJDIR)\wikiformat$O $(OBJDIR)\winfile$O $(OBJDIR)\winhttp$O $(OBJDIR)\wysiwyg$O $(OBJDIR)\xfer$O $(OBJDIR)\xfersetup$O $(OBJDIR)\zip$O $(OBJDIR)\shell$O $(OBJDIR)\sqlite3$O $(OBJDIR)\th$O $(OBJDIR)\th_lang$O
3636
3737
3838
RC=$(DMDIR)\bin\rcc
3939
RCFLAGS=-32 -w1 -I$(SRCDIR) /D__DMC__
4040
@@ -49,11 +49,11 @@
4949
5050
$(OBJDIR)\fossil.res: $B\win\fossil.rc
5151
$(RC) $(RCFLAGS) -o$@ $**
5252
5353
$(OBJDIR)\link: $B\win\Makefile.dmc $(OBJDIR)\fossil.res
54
- +echo add alerts allrepo attach backoffice bag bisect blob branch browse builtin bundle cache capabilities captcha cgi checkin checkout clearsign clone comformat configure content cookies db delta deltacmd descendants diff diffcmd dispatch doc encode etag event export file finfo foci forum fshell fusefs glob graph gzip hname http http_socket http_ssl http_transport import info json json_artifact json_branch json_config json_diff json_dir json_finfo json_login json_query json_report json_status json_tag json_timeline json_user json_wiki leaf loadctrl login lookslike main manifest markdown markdown_html md5 merge merge3 moderate name path piechart pivot popen pqueue printf publish purge rebuild regexp repolist report rss schema search security_audit setup setupuser sha1 sha1hard sha3 shun sitemap skins smtp sqlcmd stash stat statrep style sync tag tar th_main timeline tkt tktsetup undo unicode unversioned update url user utf8 util verify vfile webmail wiki wikiformat winfile winhttp wysiwyg xfer xfersetup zip shell sqlite3 th th_lang > $@
54
+ +echo add alerts allrepo attach backoffice bag bisect blob branch browse builtin bundle cache capabilities captcha cgi checkin checkout clearsign clone comformat configure content cookies db delta deltacmd deltafunc descendants diff diffcmd dispatch doc encode etag event export file finfo foci forum fshell fusefs glob graph gzip hname http http_socket http_ssl http_transport import info json json_artifact json_branch json_config json_diff json_dir json_finfo json_login json_query json_report json_status json_tag json_timeline json_user json_wiki leaf loadctrl login lookslike main manifest markdown markdown_html md5 merge merge3 moderate name path piechart pivot popen pqueue printf publish purge rebuild regexp repolist report rss schema search security_audit setup setupuser sha1 sha1hard sha3 shun sitemap skins smtp sqlcmd stash stat statrep style sync tag tar th_main timeline tkt tktsetup undo unicode unversioned update url user utf8 util verify vfile webmail wiki wikiformat winfile winhttp wysiwyg xfer xfersetup zip shell sqlite3 th th_lang > $@
5555
+echo fossil >> $@
5656
+echo fossil >> $@
5757
+echo $(LIBS) >> $@
5858
+echo. >> $@
5959
+echo fossil >> $@
@@ -290,10 +290,16 @@
290290
$(OBJDIR)\deltacmd$O : deltacmd_.c deltacmd.h
291291
$(TCC) -o$@ -c deltacmd_.c
292292
293293
deltacmd_.c : $(SRCDIR)\deltacmd.c
294294
+translate$E $** > $@
295
+
296
+$(OBJDIR)\deltafunc$O : deltafunc_.c deltafunc.h
297
+ $(TCC) -o$@ -c deltafunc_.c
298
+
299
+deltafunc_.c : $(SRCDIR)\deltafunc.c
300
+ +translate$E $** > $@
295301
296302
$(OBJDIR)\descendants$O : descendants_.c descendants.h
297303
$(TCC) -o$@ -c descendants_.c
298304
299305
descendants_.c : $(SRCDIR)\descendants.c
@@ -946,7 +952,7 @@
946952
947953
zip_.c : $(SRCDIR)\zip.c
948954
+translate$E $** > $@
949955
950956
headers: makeheaders$E page_index.h builtin_data.h default_css.h VERSION.h
951
- +makeheaders$E add_.c:add.h alerts_.c:alerts.h allrepo_.c:allrepo.h attach_.c:attach.h backoffice_.c:backoffice.h bag_.c:bag.h bisect_.c:bisect.h blob_.c:blob.h branch_.c:branch.h browse_.c:browse.h builtin_.c:builtin.h bundle_.c:bundle.h cache_.c:cache.h capabilities_.c:capabilities.h captcha_.c:captcha.h cgi_.c:cgi.h checkin_.c:checkin.h checkout_.c:checkout.h clearsign_.c:clearsign.h clone_.c:clone.h comformat_.c:comformat.h configure_.c:configure.h content_.c:content.h cookies_.c:cookies.h db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h dispatch_.c:dispatch.h doc_.c:doc.h encode_.c:encode.h etag_.c:etag.h event_.c:event.h export_.c:export.h file_.c:file.h finfo_.c:finfo.h foci_.c:foci.h forum_.c:forum.h fshell_.c:fshell.h fusefs_.c:fusefs.h glob_.c:glob.h graph_.c:graph.h gzip_.c:gzip.h hname_.c:hname.h http_.c:http.h http_socket_.c:http_socket.h http_ssl_.c:http_ssl.h http_transport_.c:http_transport.h import_.c:import.h info_.c:info.h json_.c:json.h json_artifact_.c:json_artifact.h json_branch_.c:json_branch.h json_config_.c:json_config.h json_diff_.c:json_diff.h json_dir_.c:json_dir.h json_finfo_.c:json_finfo.h json_login_.c:json_login.h json_query_.c:json_query.h json_report_.c:json_report.h json_status_.c:json_status.h json_tag_.c:json_tag.h json_timeline_.c:json_timeline.h json_user_.c:json_user.h json_wiki_.c:json_wiki.h leaf_.c:leaf.h loadctrl_.c:loadctrl.h login_.c:login.h lookslike_.c:lookslike.h main_.c:main.h manifest_.c:manifest.h markdown_.c:markdown.h markdown_html_.c:markdown_html.h md5_.c:md5.h merge_.c:merge.h merge3_.c:merge3.h moderate_.c:moderate.h name_.c:name.h path_.c:path.h piechart_.c:piechart.h pivot_.c:pivot.h popen_.c:popen.h pqueue_.c:pqueue.h printf_.c:printf.h publish_.c:publish.h purge_.c:purge.h rebuild_.c:rebuild.h regexp_.c:regexp.h repolist_.c:repolist.h report_.c:report.h rss_.c:rss.h schema_.c:schema.h search_.c:search.h security_audit_.c:security_audit.h setup_.c:setup.h setupuser_.c:setupuser.h sha1_.c:sha1.h sha1hard_.c:sha1hard.h sha3_.c:sha3.h shun_.c:shun.h sitemap_.c:sitemap.h skins_.c:skins.h smtp_.c:smtp.h sqlcmd_.c:sqlcmd.h stash_.c:stash.h stat_.c:stat.h statrep_.c:statrep.h style_.c:style.h sync_.c:sync.h tag_.c:tag.h tar_.c:tar.h th_main_.c:th_main.h timeline_.c:timeline.h tkt_.c:tkt.h tktsetup_.c:tktsetup.h undo_.c:undo.h unicode_.c:unicode.h unversioned_.c:unversioned.h update_.c:update.h url_.c:url.h user_.c:user.h utf8_.c:utf8.h util_.c:util.h verify_.c:verify.h vfile_.c:vfile.h webmail_.c:webmail.h wiki_.c:wiki.h wikiformat_.c:wikiformat.h winfile_.c:winfile.h winhttp_.c:winhttp.h wysiwyg_.c:wysiwyg.h xfer_.c:xfer.h xfersetup_.c:xfersetup.h zip_.c:zip.h $(SRCDIR)\sqlite3.h $(SRCDIR)\th.h VERSION.h $(SRCDIR)\cson_amalgamation.h
957
+ +makeheaders$E add_.c:add.h alerts_.c:alerts.h allrepo_.c:allrepo.h attach_.c:attach.h backoffice_.c:backoffice.h bag_.c:bag.h bisect_.c:bisect.h blob_.c:blob.h branch_.c:branch.h browse_.c:browse.h builtin_.c:builtin.h bundle_.c:bundle.h cache_.c:cache.h capabilities_.c:capabilities.h captcha_.c:captcha.h cgi_.c:cgi.h checkin_.c:checkin.h checkout_.c:checkout.h clearsign_.c:clearsign.h clone_.c:clone.h comformat_.c:comformat.h configure_.c:configure.h content_.c:content.h cookies_.c:cookies.h db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h deltafunc_.c:deltafunc.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h dispatch_.c:dispatch.h doc_.c:doc.h encode_.c:encode.h etag_.c:etag.h event_.c:event.h export_.c:export.h file_.c:file.h finfo_.c:finfo.h foci_.c:foci.h forum_.c:forum.h fshell_.c:fshell.h fusefs_.c:fusefs.h glob_.c:glob.h graph_.c:graph.h gzip_.c:gzip.h hname_.c:hname.h http_.c:http.h http_socket_.c:http_socket.h http_ssl_.c:http_ssl.h http_transport_.c:http_transport.h import_.c:import.h info_.c:info.h json_.c:json.h json_artifact_.c:json_artifact.h json_branch_.c:json_branch.h json_config_.c:json_config.h json_diff_.c:json_diff.h json_dir_.c:json_dir.h json_finfo_.c:json_finfo.h json_login_.c:json_login.h json_query_.c:json_query.h json_report_.c:json_report.h json_status_.c:json_status.h json_tag_.c:json_tag.h json_timeline_.c:json_timeline.h json_user_.c:json_user.h json_wiki_.c:json_wiki.h leaf_.c:leaf.h loadctrl_.c:loadctrl.h login_.c:login.h lookslike_.c:lookslike.h main_.c:main.h manifest_.c:manifest.h markdown_.c:markdown.h markdown_html_.c:markdown_html.h md5_.c:md5.h merge_.c:merge.h merge3_.c:merge3.h moderate_.c:moderate.h name_.c:name.h path_.c:path.h piechart_.c:piechart.h pivot_.c:pivot.h popen_.c:popen.h pqueue_.c:pqueue.h printf_.c:printf.h publish_.c:publish.h purge_.c:purge.h rebuild_.c:rebuild.h regexp_.c:regexp.h repolist_.c:repolist.h report_.c:report.h rss_.c:rss.h schema_.c:schema.h search_.c:search.h security_audit_.c:security_audit.h setup_.c:setup.h setupuser_.c:setupuser.h sha1_.c:sha1.h sha1hard_.c:sha1hard.h sha3_.c:sha3.h shun_.c:shun.h sitemap_.c:sitemap.h skins_.c:skins.h smtp_.c:smtp.h sqlcmd_.c:sqlcmd.h stash_.c:stash.h stat_.c:stat.h statrep_.c:statrep.h style_.c:style.h sync_.c:sync.h tag_.c:tag.h tar_.c:tar.h th_main_.c:th_main.h timeline_.c:timeline.h tkt_.c:tkt.h tktsetup_.c:tktsetup.h undo_.c:undo.h unicode_.c:unicode.h unversioned_.c:unversioned.h update_.c:update.h url_.c:url.h user_.c:user.h utf8_.c:utf8.h util_.c:util.h verify_.c:verify.h vfile_.c:vfile.h webmail_.c:webmail.h wiki_.c:wiki.h wikiformat_.c:wikiformat.h winfile_.c:winfile.h winhttp_.c:winhttp.h wysiwyg_.c:wysiwyg.h xfer_.c:xfer.h xfersetup_.c:xfersetup.h zip_.c:zip.h $(SRCDIR)\sqlite3.h $(SRCDIR)\th.h VERSION.h $(SRCDIR)\cson_amalgamation.h
952958
@copy /Y nul: headers
953959
--- win/Makefile.dmc
+++ win/Makefile.dmc
@@ -28,13 +28,13 @@
28
29 SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB
30
31 SHELL_OPTIONS = -DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
32
33 SRC = add_.c alerts_.c allrepo_.c attach_.c backoffice_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c capabilities_.c captcha_.c cgi_.c checkin_.c checkout_.c clearsign_.c clone_.c comformat_.c configure_.c content_.c cookies_.c db_.c delta_.c deltacmd_.c descendants_.c diff_.c diffcmd_.c dispatch_.c doc_.c encode_.c etag_.c event_.c export_.c file_.c finfo_.c foci_.c forum_.c fshell_.c fusefs_.c glob_.c graph_.c gzip_.c hname_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c md5_.c merge_.c merge3_.c moderate_.c name_.c path_.c piechart_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c repolist_.c report_.c rss_.c schema_.c search_.c security_audit_.c setup_.c setupuser_.c sha1_.c sha1hard_.c sha3_.c shun_.c sitemap_.c skins_.c smtp_.c sqlcmd_.c stash_.c stat_.c statrep_.c style_.c sync_.c tag_.c tar_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c unversioned_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c webmail_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c wysiwyg_.c xfer_.c xfersetup_.c zip_.c
34
35 OBJ = $(OBJDIR)\add$O $(OBJDIR)\alerts$O $(OBJDIR)\allrepo$O $(OBJDIR)\attach$O $(OBJDIR)\backoffice$O $(OBJDIR)\bag$O $(OBJDIR)\bisect$O $(OBJDIR)\blob$O $(OBJDIR)\branch$O $(OBJDIR)\browse$O $(OBJDIR)\builtin$O $(OBJDIR)\bundle$O $(OBJDIR)\cache$O $(OBJDIR)\capabilities$O $(OBJDIR)\captcha$O $(OBJDIR)\cgi$O $(OBJDIR)\checkin$O $(OBJDIR)\checkout$O $(OBJDIR)\clearsign$O $(OBJDIR)\clone$O $(OBJDIR)\comformat$O $(OBJDIR)\configure$O $(OBJDIR)\content$O $(OBJDIR)\cookies$O $(OBJDIR)\db$O $(OBJDIR)\delta$O $(OBJDIR)\deltacmd$O $(OBJDIR)\descendants$O $(OBJDIR)\diff$O $(OBJDIR)\diffcmd$O $(OBJDIR)\dispatch$O $(OBJDIR)\doc$O $(OBJDIR)\encode$O $(OBJDIR)\etag$O $(OBJDIR)\event$O $(OBJDIR)\export$O $(OBJDIR)\file$O $(OBJDIR)\finfo$O $(OBJDIR)\foci$O $(OBJDIR)\forum$O $(OBJDIR)\fshell$O $(OBJDIR)\fusefs$O $(OBJDIR)\glob$O $(OBJDIR)\graph$O $(OBJDIR)\gzip$O $(OBJDIR)\hname$O $(OBJDIR)\http$O $(OBJDIR)\http_socket$O $(OBJDIR)\http_ssl$O $(OBJDIR)\http_transport$O $(OBJDIR)\import$O $(OBJDIR)\info$O $(OBJDIR)\json$O $(OBJDIR)\json_artifact$O $(OBJDIR)\json_branch$O $(OBJDIR)\json_config$O $(OBJDIR)\json_diff$O $(OBJDIR)\json_dir$O $(OBJDIR)\json_finfo$O $(OBJDIR)\json_login$O $(OBJDIR)\json_query$O $(OBJDIR)\json_report$O $(OBJDIR)\json_status$O $(OBJDIR)\json_tag$O $(OBJDIR)\json_timeline$O $(OBJDIR)\json_user$O $(OBJDIR)\json_wiki$O $(OBJDIR)\leaf$O $(OBJDIR)\loadctrl$O $(OBJDIR)\login$O $(OBJDIR)\lookslike$O $(OBJDIR)\main$O $(OBJDIR)\manifest$O $(OBJDIR)\markdown$O $(OBJDIR)\markdown_html$O $(OBJDIR)\md5$O $(OBJDIR)\merge$O $(OBJDIR)\merge3$O $(OBJDIR)\moderate$O $(OBJDIR)\name$O $(OBJDIR)\path$O $(OBJDIR)\piechart$O $(OBJDIR)\pivot$O $(OBJDIR)\popen$O $(OBJDIR)\pqueue$O $(OBJDIR)\printf$O $(OBJDIR)\publish$O $(OBJDIR)\purge$O $(OBJDIR)\rebuild$O $(OBJDIR)\regexp$O $(OBJDIR)\repolist$O $(OBJDIR)\report$O $(OBJDIR)\rss$O $(OBJDIR)\schema$O $(OBJDIR)\search$O $(OBJDIR)\security_audit$O $(OBJDIR)\setup$O $(OBJDIR)\setupuser$O $(OBJDIR)\sha1$O $(OBJDIR)\sha1hard$O $(OBJDIR)\sha3$O $(OBJDIR)\shun$O $(OBJDIR)\sitemap$O $(OBJDIR)\skins$O $(OBJDIR)\smtp$O $(OBJDIR)\sqlcmd$O $(OBJDIR)\stash$O $(OBJDIR)\stat$O $(OBJDIR)\statrep$O $(OBJDIR)\style$O $(OBJDIR)\sync$O $(OBJDIR)\tag$O $(OBJDIR)\tar$O $(OBJDIR)\th_main$O $(OBJDIR)\timeline$O $(OBJDIR)\tkt$O $(OBJDIR)\tktsetup$O $(OBJDIR)\undo$O $(OBJDIR)\unicode$O $(OBJDIR)\unversioned$O $(OBJDIR)\update$O $(OBJDIR)\url$O $(OBJDIR)\user$O $(OBJDIR)\utf8$O $(OBJDIR)\util$O $(OBJDIR)\verify$O $(OBJDIR)\vfile$O $(OBJDIR)\webmail$O $(OBJDIR)\wiki$O $(OBJDIR)\wikiformat$O $(OBJDIR)\winfile$O $(OBJDIR)\winhttp$O $(OBJDIR)\wysiwyg$O $(OBJDIR)\xfer$O $(OBJDIR)\xfersetup$O $(OBJDIR)\zip$O $(OBJDIR)\shell$O $(OBJDIR)\sqlite3$O $(OBJDIR)\th$O $(OBJDIR)\th_lang$O
36
37
38 RC=$(DMDIR)\bin\rcc
39 RCFLAGS=-32 -w1 -I$(SRCDIR) /D__DMC__
40
@@ -49,11 +49,11 @@
49
50 $(OBJDIR)\fossil.res: $B\win\fossil.rc
51 $(RC) $(RCFLAGS) -o$@ $**
52
53 $(OBJDIR)\link: $B\win\Makefile.dmc $(OBJDIR)\fossil.res
54 +echo add alerts allrepo attach backoffice bag bisect blob branch browse builtin bundle cache capabilities captcha cgi checkin checkout clearsign clone comformat configure content cookies db delta deltacmd descendants diff diffcmd dispatch doc encode etag event export file finfo foci forum fshell fusefs glob graph gzip hname http http_socket http_ssl http_transport import info json json_artifact json_branch json_config json_diff json_dir json_finfo json_login json_query json_report json_status json_tag json_timeline json_user json_wiki leaf loadctrl login lookslike main manifest markdown markdown_html md5 merge merge3 moderate name path piechart pivot popen pqueue printf publish purge rebuild regexp repolist report rss schema search security_audit setup setupuser sha1 sha1hard sha3 shun sitemap skins smtp sqlcmd stash stat statrep style sync tag tar th_main timeline tkt tktsetup undo unicode unversioned update url user utf8 util verify vfile webmail wiki wikiformat winfile winhttp wysiwyg xfer xfersetup zip shell sqlite3 th th_lang > $@
55 +echo fossil >> $@
56 +echo fossil >> $@
57 +echo $(LIBS) >> $@
58 +echo. >> $@
59 +echo fossil >> $@
@@ -290,10 +290,16 @@
290 $(OBJDIR)\deltacmd$O : deltacmd_.c deltacmd.h
291 $(TCC) -o$@ -c deltacmd_.c
292
293 deltacmd_.c : $(SRCDIR)\deltacmd.c
294 +translate$E $** > $@
 
 
 
 
 
 
295
296 $(OBJDIR)\descendants$O : descendants_.c descendants.h
297 $(TCC) -o$@ -c descendants_.c
298
299 descendants_.c : $(SRCDIR)\descendants.c
@@ -946,7 +952,7 @@
946
947 zip_.c : $(SRCDIR)\zip.c
948 +translate$E $** > $@
949
950 headers: makeheaders$E page_index.h builtin_data.h default_css.h VERSION.h
951 +makeheaders$E add_.c:add.h alerts_.c:alerts.h allrepo_.c:allrepo.h attach_.c:attach.h backoffice_.c:backoffice.h bag_.c:bag.h bisect_.c:bisect.h blob_.c:blob.h branch_.c:branch.h browse_.c:browse.h builtin_.c:builtin.h bundle_.c:bundle.h cache_.c:cache.h capabilities_.c:capabilities.h captcha_.c:captcha.h cgi_.c:cgi.h checkin_.c:checkin.h checkout_.c:checkout.h clearsign_.c:clearsign.h clone_.c:clone.h comformat_.c:comformat.h configure_.c:configure.h content_.c:content.h cookies_.c:cookies.h db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h dispatch_.c:dispatch.h doc_.c:doc.h encode_.c:encode.h etag_.c:etag.h event_.c:event.h export_.c:export.h file_.c:file.h finfo_.c:finfo.h foci_.c:foci.h forum_.c:forum.h fshell_.c:fshell.h fusefs_.c:fusefs.h glob_.c:glob.h graph_.c:graph.h gzip_.c:gzip.h hname_.c:hname.h http_.c:http.h http_socket_.c:http_socket.h http_ssl_.c:http_ssl.h http_transport_.c:http_transport.h import_.c:import.h info_.c:info.h json_.c:json.h json_artifact_.c:json_artifact.h json_branch_.c:json_branch.h json_config_.c:json_config.h json_diff_.c:json_diff.h json_dir_.c:json_dir.h json_finfo_.c:json_finfo.h json_login_.c:json_login.h json_query_.c:json_query.h json_report_.c:json_report.h json_status_.c:json_status.h json_tag_.c:json_tag.h json_timeline_.c:json_timeline.h json_user_.c:json_user.h json_wiki_.c:json_wiki.h leaf_.c:leaf.h loadctrl_.c:loadctrl.h login_.c:login.h lookslike_.c:lookslike.h main_.c:main.h manifest_.c:manifest.h markdown_.c:markdown.h markdown_html_.c:markdown_html.h md5_.c:md5.h merge_.c:merge.h merge3_.c:merge3.h moderate_.c:moderate.h name_.c:name.h path_.c:path.h piechart_.c:piechart.h pivot_.c:pivot.h popen_.c:popen.h pqueue_.c:pqueue.h printf_.c:printf.h publish_.c:publish.h purge_.c:purge.h rebuild_.c:rebuild.h regexp_.c:regexp.h repolist_.c:repolist.h report_.c:report.h rss_.c:rss.h schema_.c:schema.h search_.c:search.h security_audit_.c:security_audit.h setup_.c:setup.h setupuser_.c:setupuser.h sha1_.c:sha1.h sha1hard_.c:sha1hard.h sha3_.c:sha3.h shun_.c:shun.h sitemap_.c:sitemap.h skins_.c:skins.h smtp_.c:smtp.h sqlcmd_.c:sqlcmd.h stash_.c:stash.h stat_.c:stat.h statrep_.c:statrep.h style_.c:style.h sync_.c:sync.h tag_.c:tag.h tar_.c:tar.h th_main_.c:th_main.h timeline_.c:timeline.h tkt_.c:tkt.h tktsetup_.c:tktsetup.h undo_.c:undo.h unicode_.c:unicode.h unversioned_.c:unversioned.h update_.c:update.h url_.c:url.h user_.c:user.h utf8_.c:utf8.h util_.c:util.h verify_.c:verify.h vfile_.c:vfile.h webmail_.c:webmail.h wiki_.c:wiki.h wikiformat_.c:wikiformat.h winfile_.c:winfile.h winhttp_.c:winhttp.h wysiwyg_.c:wysiwyg.h xfer_.c:xfer.h xfersetup_.c:xfersetup.h zip_.c:zip.h $(SRCDIR)\sqlite3.h $(SRCDIR)\th.h VERSION.h $(SRCDIR)\cson_amalgamation.h
952 @copy /Y nul: headers
953
--- win/Makefile.dmc
+++ win/Makefile.dmc
@@ -28,13 +28,13 @@
28
29 SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB
30
31 SHELL_OPTIONS = -DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
32
33 SRC = add_.c alerts_.c allrepo_.c attach_.c backoffice_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c capabilities_.c captcha_.c cgi_.c checkin_.c checkout_.c clearsign_.c clone_.c comformat_.c configure_.c content_.c cookies_.c db_.c delta_.c deltacmd_.c deltafunc_.c descendants_.c diff_.c diffcmd_.c dispatch_.c doc_.c encode_.c etag_.c event_.c export_.c file_.c finfo_.c foci_.c forum_.c fshell_.c fusefs_.c glob_.c graph_.c gzip_.c hname_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c md5_.c merge_.c merge3_.c moderate_.c name_.c path_.c piechart_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c repolist_.c report_.c rss_.c schema_.c search_.c security_audit_.c setup_.c setupuser_.c sha1_.c sha1hard_.c sha3_.c shun_.c sitemap_.c skins_.c smtp_.c sqlcmd_.c stash_.c stat_.c statrep_.c style_.c sync_.c tag_.c tar_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c unversioned_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c webmail_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c wysiwyg_.c xfer_.c xfersetup_.c zip_.c
34
35 OBJ = $(OBJDIR)\add$O $(OBJDIR)\alerts$O $(OBJDIR)\allrepo$O $(OBJDIR)\attach$O $(OBJDIR)\backoffice$O $(OBJDIR)\bag$O $(OBJDIR)\bisect$O $(OBJDIR)\blob$O $(OBJDIR)\branch$O $(OBJDIR)\browse$O $(OBJDIR)\builtin$O $(OBJDIR)\bundle$O $(OBJDIR)\cache$O $(OBJDIR)\capabilities$O $(OBJDIR)\captcha$O $(OBJDIR)\cgi$O $(OBJDIR)\checkin$O $(OBJDIR)\checkout$O $(OBJDIR)\clearsign$O $(OBJDIR)\clone$O $(OBJDIR)\comformat$O $(OBJDIR)\configure$O $(OBJDIR)\content$O $(OBJDIR)\cookies$O $(OBJDIR)\db$O $(OBJDIR)\delta$O $(OBJDIR)\deltacmd$O $(OBJDIR)\deltafunc$O $(OBJDIR)\descendants$O $(OBJDIR)\diff$O $(OBJDIR)\diffcmd$O $(OBJDIR)\dispatch$O $(OBJDIR)\doc$O $(OBJDIR)\encode$O $(OBJDIR)\etag$O $(OBJDIR)\event$O $(OBJDIR)\export$O $(OBJDIR)\file$O $(OBJDIR)\finfo$O $(OBJDIR)\foci$O $(OBJDIR)\forum$O $(OBJDIR)\fshell$O $(OBJDIR)\fusefs$O $(OBJDIR)\glob$O $(OBJDIR)\graph$O $(OBJDIR)\gzip$O $(OBJDIR)\hname$O $(OBJDIR)\http$O $(OBJDIR)\http_socket$O $(OBJDIR)\http_ssl$O $(OBJDIR)\http_transport$O $(OBJDIR)\import$O $(OBJDIR)\info$O $(OBJDIR)\json$O $(OBJDIR)\json_artifact$O $(OBJDIR)\json_branch$O $(OBJDIR)\json_config$O $(OBJDIR)\json_diff$O $(OBJDIR)\json_dir$O $(OBJDIR)\json_finfo$O $(OBJDIR)\json_login$O $(OBJDIR)\json_query$O $(OBJDIR)\json_report$O $(OBJDIR)\json_status$O $(OBJDIR)\json_tag$O $(OBJDIR)\json_timeline$O $(OBJDIR)\json_user$O $(OBJDIR)\json_wiki$O $(OBJDIR)\leaf$O $(OBJDIR)\loadctrl$O $(OBJDIR)\login$O $(OBJDIR)\lookslike$O $(OBJDIR)\main$O $(OBJDIR)\manifest$O $(OBJDIR)\markdown$O $(OBJDIR)\markdown_html$O $(OBJDIR)\md5$O $(OBJDIR)\merge$O $(OBJDIR)\merge3$O $(OBJDIR)\moderate$O $(OBJDIR)\name$O $(OBJDIR)\path$O $(OBJDIR)\piechart$O $(OBJDIR)\pivot$O $(OBJDIR)\popen$O $(OBJDIR)\pqueue$O $(OBJDIR)\printf$O $(OBJDIR)\publish$O $(OBJDIR)\purge$O $(OBJDIR)\rebuild$O $(OBJDIR)\regexp$O $(OBJDIR)\repolist$O $(OBJDIR)\report$O $(OBJDIR)\rss$O $(OBJDIR)\schema$O $(OBJDIR)\search$O $(OBJDIR)\security_audit$O $(OBJDIR)\setup$O $(OBJDIR)\setupuser$O $(OBJDIR)\sha1$O $(OBJDIR)\sha1hard$O $(OBJDIR)\sha3$O $(OBJDIR)\shun$O $(OBJDIR)\sitemap$O $(OBJDIR)\skins$O $(OBJDIR)\smtp$O $(OBJDIR)\sqlcmd$O $(OBJDIR)\stash$O $(OBJDIR)\stat$O $(OBJDIR)\statrep$O $(OBJDIR)\style$O $(OBJDIR)\sync$O $(OBJDIR)\tag$O $(OBJDIR)\tar$O $(OBJDIR)\th_main$O $(OBJDIR)\timeline$O $(OBJDIR)\tkt$O $(OBJDIR)\tktsetup$O $(OBJDIR)\undo$O $(OBJDIR)\unicode$O $(OBJDIR)\unversioned$O $(OBJDIR)\update$O $(OBJDIR)\url$O $(OBJDIR)\user$O $(OBJDIR)\utf8$O $(OBJDIR)\util$O $(OBJDIR)\verify$O $(OBJDIR)\vfile$O $(OBJDIR)\webmail$O $(OBJDIR)\wiki$O $(OBJDIR)\wikiformat$O $(OBJDIR)\winfile$O $(OBJDIR)\winhttp$O $(OBJDIR)\wysiwyg$O $(OBJDIR)\xfer$O $(OBJDIR)\xfersetup$O $(OBJDIR)\zip$O $(OBJDIR)\shell$O $(OBJDIR)\sqlite3$O $(OBJDIR)\th$O $(OBJDIR)\th_lang$O
36
37
38 RC=$(DMDIR)\bin\rcc
39 RCFLAGS=-32 -w1 -I$(SRCDIR) /D__DMC__
40
@@ -49,11 +49,11 @@
49
50 $(OBJDIR)\fossil.res: $B\win\fossil.rc
51 $(RC) $(RCFLAGS) -o$@ $**
52
53 $(OBJDIR)\link: $B\win\Makefile.dmc $(OBJDIR)\fossil.res
54 +echo add alerts allrepo attach backoffice bag bisect blob branch browse builtin bundle cache capabilities captcha cgi checkin checkout clearsign clone comformat configure content cookies db delta deltacmd deltafunc descendants diff diffcmd dispatch doc encode etag event export file finfo foci forum fshell fusefs glob graph gzip hname http http_socket http_ssl http_transport import info json json_artifact json_branch json_config json_diff json_dir json_finfo json_login json_query json_report json_status json_tag json_timeline json_user json_wiki leaf loadctrl login lookslike main manifest markdown markdown_html md5 merge merge3 moderate name path piechart pivot popen pqueue printf publish purge rebuild regexp repolist report rss schema search security_audit setup setupuser sha1 sha1hard sha3 shun sitemap skins smtp sqlcmd stash stat statrep style sync tag tar th_main timeline tkt tktsetup undo unicode unversioned update url user utf8 util verify vfile webmail wiki wikiformat winfile winhttp wysiwyg xfer xfersetup zip shell sqlite3 th th_lang > $@
55 +echo fossil >> $@
56 +echo fossil >> $@
57 +echo $(LIBS) >> $@
58 +echo. >> $@
59 +echo fossil >> $@
@@ -290,10 +290,16 @@
290 $(OBJDIR)\deltacmd$O : deltacmd_.c deltacmd.h
291 $(TCC) -o$@ -c deltacmd_.c
292
293 deltacmd_.c : $(SRCDIR)\deltacmd.c
294 +translate$E $** > $@
295
296 $(OBJDIR)\deltafunc$O : deltafunc_.c deltafunc.h
297 $(TCC) -o$@ -c deltafunc_.c
298
299 deltafunc_.c : $(SRCDIR)\deltafunc.c
300 +translate$E $** > $@
301
302 $(OBJDIR)\descendants$O : descendants_.c descendants.h
303 $(TCC) -o$@ -c descendants_.c
304
305 descendants_.c : $(SRCDIR)\descendants.c
@@ -946,7 +952,7 @@
952
953 zip_.c : $(SRCDIR)\zip.c
954 +translate$E $** > $@
955
956 headers: makeheaders$E page_index.h builtin_data.h default_css.h VERSION.h
957 +makeheaders$E add_.c:add.h alerts_.c:alerts.h allrepo_.c:allrepo.h attach_.c:attach.h backoffice_.c:backoffice.h bag_.c:bag.h bisect_.c:bisect.h blob_.c:blob.h branch_.c:branch.h browse_.c:browse.h builtin_.c:builtin.h bundle_.c:bundle.h cache_.c:cache.h capabilities_.c:capabilities.h captcha_.c:captcha.h cgi_.c:cgi.h checkin_.c:checkin.h checkout_.c:checkout.h clearsign_.c:clearsign.h clone_.c:clone.h comformat_.c:comformat.h configure_.c:configure.h content_.c:content.h cookies_.c:cookies.h db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h deltafunc_.c:deltafunc.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h dispatch_.c:dispatch.h doc_.c:doc.h encode_.c:encode.h etag_.c:etag.h event_.c:event.h export_.c:export.h file_.c:file.h finfo_.c:finfo.h foci_.c:foci.h forum_.c:forum.h fshell_.c:fshell.h fusefs_.c:fusefs.h glob_.c:glob.h graph_.c:graph.h gzip_.c:gzip.h hname_.c:hname.h http_.c:http.h http_socket_.c:http_socket.h http_ssl_.c:http_ssl.h http_transport_.c:http_transport.h import_.c:import.h info_.c:info.h json_.c:json.h json_artifact_.c:json_artifact.h json_branch_.c:json_branch.h json_config_.c:json_config.h json_diff_.c:json_diff.h json_dir_.c:json_dir.h json_finfo_.c:json_finfo.h json_login_.c:json_login.h json_query_.c:json_query.h json_report_.c:json_report.h json_status_.c:json_status.h json_tag_.c:json_tag.h json_timeline_.c:json_timeline.h json_user_.c:json_user.h json_wiki_.c:json_wiki.h leaf_.c:leaf.h loadctrl_.c:loadctrl.h login_.c:login.h lookslike_.c:lookslike.h main_.c:main.h manifest_.c:manifest.h markdown_.c:markdown.h markdown_html_.c:markdown_html.h md5_.c:md5.h merge_.c:merge.h merge3_.c:merge3.h moderate_.c:moderate.h name_.c:name.h path_.c:path.h piechart_.c:piechart.h pivot_.c:pivot.h popen_.c:popen.h pqueue_.c:pqueue.h printf_.c:printf.h publish_.c:publish.h purge_.c:purge.h rebuild_.c:rebuild.h regexp_.c:regexp.h repolist_.c:repolist.h report_.c:report.h rss_.c:rss.h schema_.c:schema.h search_.c:search.h security_audit_.c:security_audit.h setup_.c:setup.h setupuser_.c:setupuser.h sha1_.c:sha1.h sha1hard_.c:sha1hard.h sha3_.c:sha3.h shun_.c:shun.h sitemap_.c:sitemap.h skins_.c:skins.h smtp_.c:smtp.h sqlcmd_.c:sqlcmd.h stash_.c:stash.h stat_.c:stat.h statrep_.c:statrep.h style_.c:style.h sync_.c:sync.h tag_.c:tag.h tar_.c:tar.h th_main_.c:th_main.h timeline_.c:timeline.h tkt_.c:tkt.h tktsetup_.c:tktsetup.h undo_.c:undo.h unicode_.c:unicode.h unversioned_.c:unversioned.h update_.c:update.h url_.c:url.h user_.c:user.h utf8_.c:utf8.h util_.c:util.h verify_.c:verify.h vfile_.c:vfile.h webmail_.c:webmail.h wiki_.c:wiki.h wikiformat_.c:wikiformat.h winfile_.c:winfile.h winhttp_.c:winhttp.h wysiwyg_.c:wysiwyg.h xfer_.c:xfer.h xfersetup_.c:xfersetup.h zip_.c:zip.h $(SRCDIR)\sqlite3.h $(SRCDIR)\th.h VERSION.h $(SRCDIR)\cson_amalgamation.h
958 @copy /Y nul: headers
959
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -174,11 +174,11 @@
174174
#### The directories where the OpenSSL include and library files are located.
175175
# The recommended usage here is to use the Sysinternals junction tool
176176
# to create a hard link between an "openssl-1.x" sub-directory of the
177177
# Fossil source code directory and the target OpenSSL source directory.
178178
#
179
-OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1a
179
+OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1b
180180
OPENSSLINCDIR = $(OPENSSLDIR)/include
181181
OPENSSLLIBDIR = $(OPENSSLDIR)
182182
183183
#### Either the directory where the Tcl library is installed or the Tcl
184184
# source code directory resides (depending on the value of the macro
@@ -463,10 +463,11 @@
463463
$(SRCDIR)/content.c \
464464
$(SRCDIR)/cookies.c \
465465
$(SRCDIR)/db.c \
466466
$(SRCDIR)/delta.c \
467467
$(SRCDIR)/deltacmd.c \
468
+ $(SRCDIR)/deltafunc.c \
468469
$(SRCDIR)/descendants.c \
469470
$(SRCDIR)/diff.c \
470471
$(SRCDIR)/diffcmd.c \
471472
$(SRCDIR)/dispatch.c \
472473
$(SRCDIR)/doc.c \
@@ -674,10 +675,11 @@
674675
$(OBJDIR)/content_.c \
675676
$(OBJDIR)/cookies_.c \
676677
$(OBJDIR)/db_.c \
677678
$(OBJDIR)/delta_.c \
678679
$(OBJDIR)/deltacmd_.c \
680
+ $(OBJDIR)/deltafunc_.c \
679681
$(OBJDIR)/descendants_.c \
680682
$(OBJDIR)/diff_.c \
681683
$(OBJDIR)/diffcmd_.c \
682684
$(OBJDIR)/dispatch_.c \
683685
$(OBJDIR)/doc_.c \
@@ -812,10 +814,11 @@
812814
$(OBJDIR)/content.o \
813815
$(OBJDIR)/cookies.o \
814816
$(OBJDIR)/db.o \
815817
$(OBJDIR)/delta.o \
816818
$(OBJDIR)/deltacmd.o \
819
+ $(OBJDIR)/deltafunc.o \
817820
$(OBJDIR)/descendants.o \
818821
$(OBJDIR)/diff.o \
819822
$(OBJDIR)/diffcmd.o \
820823
$(OBJDIR)/dispatch.o \
821824
$(OBJDIR)/doc.o \
@@ -1169,10 +1172,11 @@
11691172
$(OBJDIR)/content_.c:$(OBJDIR)/content.h \
11701173
$(OBJDIR)/cookies_.c:$(OBJDIR)/cookies.h \
11711174
$(OBJDIR)/db_.c:$(OBJDIR)/db.h \
11721175
$(OBJDIR)/delta_.c:$(OBJDIR)/delta.h \
11731176
$(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h \
1177
+ $(OBJDIR)/deltafunc_.c:$(OBJDIR)/deltafunc.h \
11741178
$(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h \
11751179
$(OBJDIR)/diff_.c:$(OBJDIR)/diff.h \
11761180
$(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h \
11771181
$(OBJDIR)/dispatch_.c:$(OBJDIR)/dispatch.h \
11781182
$(OBJDIR)/doc_.c:$(OBJDIR)/doc.h \
@@ -1502,10 +1506,18 @@
15021506
15031507
$(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h
15041508
$(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c
15051509
15061510
$(OBJDIR)/deltacmd.h: $(OBJDIR)/headers
1511
+
1512
+$(OBJDIR)/deltafunc_.c: $(SRCDIR)/deltafunc.c $(TRANSLATE)
1513
+ $(TRANSLATE) $(SRCDIR)/deltafunc.c >$@
1514
+
1515
+$(OBJDIR)/deltafunc.o: $(OBJDIR)/deltafunc_.c $(OBJDIR)/deltafunc.h $(SRCDIR)/config.h
1516
+ $(XTCC) -o $(OBJDIR)/deltafunc.o -c $(OBJDIR)/deltafunc_.c
1517
+
1518
+$(OBJDIR)/deltafunc.h: $(OBJDIR)/headers
15071519
15081520
$(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(TRANSLATE)
15091521
$(TRANSLATE) $(SRCDIR)/descendants.c >$@
15101522
15111523
$(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h
15121524
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -174,11 +174,11 @@
174 #### The directories where the OpenSSL include and library files are located.
175 # The recommended usage here is to use the Sysinternals junction tool
176 # to create a hard link between an "openssl-1.x" sub-directory of the
177 # Fossil source code directory and the target OpenSSL source directory.
178 #
179 OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1a
180 OPENSSLINCDIR = $(OPENSSLDIR)/include
181 OPENSSLLIBDIR = $(OPENSSLDIR)
182
183 #### Either the directory where the Tcl library is installed or the Tcl
184 # source code directory resides (depending on the value of the macro
@@ -463,10 +463,11 @@
463 $(SRCDIR)/content.c \
464 $(SRCDIR)/cookies.c \
465 $(SRCDIR)/db.c \
466 $(SRCDIR)/delta.c \
467 $(SRCDIR)/deltacmd.c \
 
468 $(SRCDIR)/descendants.c \
469 $(SRCDIR)/diff.c \
470 $(SRCDIR)/diffcmd.c \
471 $(SRCDIR)/dispatch.c \
472 $(SRCDIR)/doc.c \
@@ -674,10 +675,11 @@
674 $(OBJDIR)/content_.c \
675 $(OBJDIR)/cookies_.c \
676 $(OBJDIR)/db_.c \
677 $(OBJDIR)/delta_.c \
678 $(OBJDIR)/deltacmd_.c \
 
679 $(OBJDIR)/descendants_.c \
680 $(OBJDIR)/diff_.c \
681 $(OBJDIR)/diffcmd_.c \
682 $(OBJDIR)/dispatch_.c \
683 $(OBJDIR)/doc_.c \
@@ -812,10 +814,11 @@
812 $(OBJDIR)/content.o \
813 $(OBJDIR)/cookies.o \
814 $(OBJDIR)/db.o \
815 $(OBJDIR)/delta.o \
816 $(OBJDIR)/deltacmd.o \
 
817 $(OBJDIR)/descendants.o \
818 $(OBJDIR)/diff.o \
819 $(OBJDIR)/diffcmd.o \
820 $(OBJDIR)/dispatch.o \
821 $(OBJDIR)/doc.o \
@@ -1169,10 +1172,11 @@
1169 $(OBJDIR)/content_.c:$(OBJDIR)/content.h \
1170 $(OBJDIR)/cookies_.c:$(OBJDIR)/cookies.h \
1171 $(OBJDIR)/db_.c:$(OBJDIR)/db.h \
1172 $(OBJDIR)/delta_.c:$(OBJDIR)/delta.h \
1173 $(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h \
 
1174 $(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h \
1175 $(OBJDIR)/diff_.c:$(OBJDIR)/diff.h \
1176 $(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h \
1177 $(OBJDIR)/dispatch_.c:$(OBJDIR)/dispatch.h \
1178 $(OBJDIR)/doc_.c:$(OBJDIR)/doc.h \
@@ -1502,10 +1506,18 @@
1502
1503 $(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h
1504 $(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c
1505
1506 $(OBJDIR)/deltacmd.h: $(OBJDIR)/headers
 
 
 
 
 
 
 
 
1507
1508 $(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(TRANSLATE)
1509 $(TRANSLATE) $(SRCDIR)/descendants.c >$@
1510
1511 $(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h
1512
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -174,11 +174,11 @@
174 #### The directories where the OpenSSL include and library files are located.
175 # The recommended usage here is to use the Sysinternals junction tool
176 # to create a hard link between an "openssl-1.x" sub-directory of the
177 # Fossil source code directory and the target OpenSSL source directory.
178 #
179 OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1b
180 OPENSSLINCDIR = $(OPENSSLDIR)/include
181 OPENSSLLIBDIR = $(OPENSSLDIR)
182
183 #### Either the directory where the Tcl library is installed or the Tcl
184 # source code directory resides (depending on the value of the macro
@@ -463,10 +463,11 @@
463 $(SRCDIR)/content.c \
464 $(SRCDIR)/cookies.c \
465 $(SRCDIR)/db.c \
466 $(SRCDIR)/delta.c \
467 $(SRCDIR)/deltacmd.c \
468 $(SRCDIR)/deltafunc.c \
469 $(SRCDIR)/descendants.c \
470 $(SRCDIR)/diff.c \
471 $(SRCDIR)/diffcmd.c \
472 $(SRCDIR)/dispatch.c \
473 $(SRCDIR)/doc.c \
@@ -674,10 +675,11 @@
675 $(OBJDIR)/content_.c \
676 $(OBJDIR)/cookies_.c \
677 $(OBJDIR)/db_.c \
678 $(OBJDIR)/delta_.c \
679 $(OBJDIR)/deltacmd_.c \
680 $(OBJDIR)/deltafunc_.c \
681 $(OBJDIR)/descendants_.c \
682 $(OBJDIR)/diff_.c \
683 $(OBJDIR)/diffcmd_.c \
684 $(OBJDIR)/dispatch_.c \
685 $(OBJDIR)/doc_.c \
@@ -812,10 +814,11 @@
814 $(OBJDIR)/content.o \
815 $(OBJDIR)/cookies.o \
816 $(OBJDIR)/db.o \
817 $(OBJDIR)/delta.o \
818 $(OBJDIR)/deltacmd.o \
819 $(OBJDIR)/deltafunc.o \
820 $(OBJDIR)/descendants.o \
821 $(OBJDIR)/diff.o \
822 $(OBJDIR)/diffcmd.o \
823 $(OBJDIR)/dispatch.o \
824 $(OBJDIR)/doc.o \
@@ -1169,10 +1172,11 @@
1172 $(OBJDIR)/content_.c:$(OBJDIR)/content.h \
1173 $(OBJDIR)/cookies_.c:$(OBJDIR)/cookies.h \
1174 $(OBJDIR)/db_.c:$(OBJDIR)/db.h \
1175 $(OBJDIR)/delta_.c:$(OBJDIR)/delta.h \
1176 $(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h \
1177 $(OBJDIR)/deltafunc_.c:$(OBJDIR)/deltafunc.h \
1178 $(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h \
1179 $(OBJDIR)/diff_.c:$(OBJDIR)/diff.h \
1180 $(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h \
1181 $(OBJDIR)/dispatch_.c:$(OBJDIR)/dispatch.h \
1182 $(OBJDIR)/doc_.c:$(OBJDIR)/doc.h \
@@ -1502,10 +1506,18 @@
1506
1507 $(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h
1508 $(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c
1509
1510 $(OBJDIR)/deltacmd.h: $(OBJDIR)/headers
1511
1512 $(OBJDIR)/deltafunc_.c: $(SRCDIR)/deltafunc.c $(TRANSLATE)
1513 $(TRANSLATE) $(SRCDIR)/deltafunc.c >$@
1514
1515 $(OBJDIR)/deltafunc.o: $(OBJDIR)/deltafunc_.c $(OBJDIR)/deltafunc.h $(SRCDIR)/config.h
1516 $(XTCC) -o $(OBJDIR)/deltafunc.o -c $(OBJDIR)/deltafunc_.c
1517
1518 $(OBJDIR)/deltafunc.h: $(OBJDIR)/headers
1519
1520 $(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(TRANSLATE)
1521 $(TRANSLATE) $(SRCDIR)/descendants.c >$@
1522
1523 $(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h
1524
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -174,11 +174,11 @@
174174
#### The directories where the OpenSSL include and library files are located.
175175
# The recommended usage here is to use the Sysinternals junction tool
176176
# to create a hard link between an "openssl-1.x" sub-directory of the
177177
# Fossil source code directory and the target OpenSSL source directory.
178178
#
179
-OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1a
179
+OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1b
180180
OPENSSLINCDIR = $(OPENSSLDIR)/include
181181
OPENSSLLIBDIR = $(OPENSSLDIR)
182182
183183
#### Either the directory where the Tcl library is installed or the Tcl
184184
# source code directory resides (depending on the value of the macro
@@ -463,10 +463,11 @@
463463
$(SRCDIR)/content.c \
464464
$(SRCDIR)/cookies.c \
465465
$(SRCDIR)/db.c \
466466
$(SRCDIR)/delta.c \
467467
$(SRCDIR)/deltacmd.c \
468
+ $(SRCDIR)/deltafunc.c \
468469
$(SRCDIR)/descendants.c \
469470
$(SRCDIR)/diff.c \
470471
$(SRCDIR)/diffcmd.c \
471472
$(SRCDIR)/dispatch.c \
472473
$(SRCDIR)/doc.c \
@@ -674,10 +675,11 @@
674675
$(OBJDIR)/content_.c \
675676
$(OBJDIR)/cookies_.c \
676677
$(OBJDIR)/db_.c \
677678
$(OBJDIR)/delta_.c \
678679
$(OBJDIR)/deltacmd_.c \
680
+ $(OBJDIR)/deltafunc_.c \
679681
$(OBJDIR)/descendants_.c \
680682
$(OBJDIR)/diff_.c \
681683
$(OBJDIR)/diffcmd_.c \
682684
$(OBJDIR)/dispatch_.c \
683685
$(OBJDIR)/doc_.c \
@@ -812,10 +814,11 @@
812814
$(OBJDIR)/content.o \
813815
$(OBJDIR)/cookies.o \
814816
$(OBJDIR)/db.o \
815817
$(OBJDIR)/delta.o \
816818
$(OBJDIR)/deltacmd.o \
819
+ $(OBJDIR)/deltafunc.o \
817820
$(OBJDIR)/descendants.o \
818821
$(OBJDIR)/diff.o \
819822
$(OBJDIR)/diffcmd.o \
820823
$(OBJDIR)/dispatch.o \
821824
$(OBJDIR)/doc.o \
@@ -1169,10 +1172,11 @@
11691172
$(OBJDIR)/content_.c:$(OBJDIR)/content.h \
11701173
$(OBJDIR)/cookies_.c:$(OBJDIR)/cookies.h \
11711174
$(OBJDIR)/db_.c:$(OBJDIR)/db.h \
11721175
$(OBJDIR)/delta_.c:$(OBJDIR)/delta.h \
11731176
$(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h \
1177
+ $(OBJDIR)/deltafunc_.c:$(OBJDIR)/deltafunc.h \
11741178
$(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h \
11751179
$(OBJDIR)/diff_.c:$(OBJDIR)/diff.h \
11761180
$(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h \
11771181
$(OBJDIR)/dispatch_.c:$(OBJDIR)/dispatch.h \
11781182
$(OBJDIR)/doc_.c:$(OBJDIR)/doc.h \
@@ -1502,10 +1506,18 @@
15021506
15031507
$(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h
15041508
$(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c
15051509
15061510
$(OBJDIR)/deltacmd.h: $(OBJDIR)/headers
1511
+
1512
+$(OBJDIR)/deltafunc_.c: $(SRCDIR)/deltafunc.c $(TRANSLATE)
1513
+ $(TRANSLATE) $(SRCDIR)/deltafunc.c >$@
1514
+
1515
+$(OBJDIR)/deltafunc.o: $(OBJDIR)/deltafunc_.c $(OBJDIR)/deltafunc.h $(SRCDIR)/config.h
1516
+ $(XTCC) -o $(OBJDIR)/deltafunc.o -c $(OBJDIR)/deltafunc_.c
1517
+
1518
+$(OBJDIR)/deltafunc.h: $(OBJDIR)/headers
15071519
15081520
$(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(TRANSLATE)
15091521
$(TRANSLATE) $(SRCDIR)/descendants.c >$@
15101522
15111523
$(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h
15121524
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -174,11 +174,11 @@
174 #### The directories where the OpenSSL include and library files are located.
175 # The recommended usage here is to use the Sysinternals junction tool
176 # to create a hard link between an "openssl-1.x" sub-directory of the
177 # Fossil source code directory and the target OpenSSL source directory.
178 #
179 OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1a
180 OPENSSLINCDIR = $(OPENSSLDIR)/include
181 OPENSSLLIBDIR = $(OPENSSLDIR)
182
183 #### Either the directory where the Tcl library is installed or the Tcl
184 # source code directory resides (depending on the value of the macro
@@ -463,10 +463,11 @@
463 $(SRCDIR)/content.c \
464 $(SRCDIR)/cookies.c \
465 $(SRCDIR)/db.c \
466 $(SRCDIR)/delta.c \
467 $(SRCDIR)/deltacmd.c \
 
468 $(SRCDIR)/descendants.c \
469 $(SRCDIR)/diff.c \
470 $(SRCDIR)/diffcmd.c \
471 $(SRCDIR)/dispatch.c \
472 $(SRCDIR)/doc.c \
@@ -674,10 +675,11 @@
674 $(OBJDIR)/content_.c \
675 $(OBJDIR)/cookies_.c \
676 $(OBJDIR)/db_.c \
677 $(OBJDIR)/delta_.c \
678 $(OBJDIR)/deltacmd_.c \
 
679 $(OBJDIR)/descendants_.c \
680 $(OBJDIR)/diff_.c \
681 $(OBJDIR)/diffcmd_.c \
682 $(OBJDIR)/dispatch_.c \
683 $(OBJDIR)/doc_.c \
@@ -812,10 +814,11 @@
812 $(OBJDIR)/content.o \
813 $(OBJDIR)/cookies.o \
814 $(OBJDIR)/db.o \
815 $(OBJDIR)/delta.o \
816 $(OBJDIR)/deltacmd.o \
 
817 $(OBJDIR)/descendants.o \
818 $(OBJDIR)/diff.o \
819 $(OBJDIR)/diffcmd.o \
820 $(OBJDIR)/dispatch.o \
821 $(OBJDIR)/doc.o \
@@ -1169,10 +1172,11 @@
1169 $(OBJDIR)/content_.c:$(OBJDIR)/content.h \
1170 $(OBJDIR)/cookies_.c:$(OBJDIR)/cookies.h \
1171 $(OBJDIR)/db_.c:$(OBJDIR)/db.h \
1172 $(OBJDIR)/delta_.c:$(OBJDIR)/delta.h \
1173 $(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h \
 
1174 $(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h \
1175 $(OBJDIR)/diff_.c:$(OBJDIR)/diff.h \
1176 $(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h \
1177 $(OBJDIR)/dispatch_.c:$(OBJDIR)/dispatch.h \
1178 $(OBJDIR)/doc_.c:$(OBJDIR)/doc.h \
@@ -1502,10 +1506,18 @@
1502
1503 $(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h
1504 $(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c
1505
1506 $(OBJDIR)/deltacmd.h: $(OBJDIR)/headers
 
 
 
 
 
 
 
 
1507
1508 $(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(TRANSLATE)
1509 $(TRANSLATE) $(SRCDIR)/descendants.c >$@
1510
1511 $(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h
1512
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -174,11 +174,11 @@
174 #### The directories where the OpenSSL include and library files are located.
175 # The recommended usage here is to use the Sysinternals junction tool
176 # to create a hard link between an "openssl-1.x" sub-directory of the
177 # Fossil source code directory and the target OpenSSL source directory.
178 #
179 OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1b
180 OPENSSLINCDIR = $(OPENSSLDIR)/include
181 OPENSSLLIBDIR = $(OPENSSLDIR)
182
183 #### Either the directory where the Tcl library is installed or the Tcl
184 # source code directory resides (depending on the value of the macro
@@ -463,10 +463,11 @@
463 $(SRCDIR)/content.c \
464 $(SRCDIR)/cookies.c \
465 $(SRCDIR)/db.c \
466 $(SRCDIR)/delta.c \
467 $(SRCDIR)/deltacmd.c \
468 $(SRCDIR)/deltafunc.c \
469 $(SRCDIR)/descendants.c \
470 $(SRCDIR)/diff.c \
471 $(SRCDIR)/diffcmd.c \
472 $(SRCDIR)/dispatch.c \
473 $(SRCDIR)/doc.c \
@@ -674,10 +675,11 @@
675 $(OBJDIR)/content_.c \
676 $(OBJDIR)/cookies_.c \
677 $(OBJDIR)/db_.c \
678 $(OBJDIR)/delta_.c \
679 $(OBJDIR)/deltacmd_.c \
680 $(OBJDIR)/deltafunc_.c \
681 $(OBJDIR)/descendants_.c \
682 $(OBJDIR)/diff_.c \
683 $(OBJDIR)/diffcmd_.c \
684 $(OBJDIR)/dispatch_.c \
685 $(OBJDIR)/doc_.c \
@@ -812,10 +814,11 @@
814 $(OBJDIR)/content.o \
815 $(OBJDIR)/cookies.o \
816 $(OBJDIR)/db.o \
817 $(OBJDIR)/delta.o \
818 $(OBJDIR)/deltacmd.o \
819 $(OBJDIR)/deltafunc.o \
820 $(OBJDIR)/descendants.o \
821 $(OBJDIR)/diff.o \
822 $(OBJDIR)/diffcmd.o \
823 $(OBJDIR)/dispatch.o \
824 $(OBJDIR)/doc.o \
@@ -1169,10 +1172,11 @@
1172 $(OBJDIR)/content_.c:$(OBJDIR)/content.h \
1173 $(OBJDIR)/cookies_.c:$(OBJDIR)/cookies.h \
1174 $(OBJDIR)/db_.c:$(OBJDIR)/db.h \
1175 $(OBJDIR)/delta_.c:$(OBJDIR)/delta.h \
1176 $(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h \
1177 $(OBJDIR)/deltafunc_.c:$(OBJDIR)/deltafunc.h \
1178 $(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h \
1179 $(OBJDIR)/diff_.c:$(OBJDIR)/diff.h \
1180 $(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h \
1181 $(OBJDIR)/dispatch_.c:$(OBJDIR)/dispatch.h \
1182 $(OBJDIR)/doc_.c:$(OBJDIR)/doc.h \
@@ -1502,10 +1506,18 @@
1506
1507 $(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h
1508 $(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c
1509
1510 $(OBJDIR)/deltacmd.h: $(OBJDIR)/headers
1511
1512 $(OBJDIR)/deltafunc_.c: $(SRCDIR)/deltafunc.c $(TRANSLATE)
1513 $(TRANSLATE) $(SRCDIR)/deltafunc.c >$@
1514
1515 $(OBJDIR)/deltafunc.o: $(OBJDIR)/deltafunc_.c $(OBJDIR)/deltafunc.h $(SRCDIR)/config.h
1516 $(XTCC) -o $(OBJDIR)/deltafunc.o -c $(OBJDIR)/deltafunc_.c
1517
1518 $(OBJDIR)/deltafunc.h: $(OBJDIR)/headers
1519
1520 $(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(TRANSLATE)
1521 $(TRANSLATE) $(SRCDIR)/descendants.c >$@
1522
1523 $(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h
1524
--- win/Makefile.mingw.mistachkin
+++ win/Makefile.mingw.mistachkin
@@ -174,11 +174,11 @@
174174
#### The directories where the OpenSSL include and library files are located.
175175
# The recommended usage here is to use the Sysinternals junction tool
176176
# to create a hard link between an "openssl-1.x" sub-directory of the
177177
# Fossil source code directory and the target OpenSSL source directory.
178178
#
179
-OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1a
179
+OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1b
180180
OPENSSLINCDIR = $(OPENSSLDIR)/include
181181
OPENSSLLIBDIR = $(OPENSSLDIR)
182182
183183
#### Either the directory where the Tcl library is installed or the Tcl
184184
# source code directory resides (depending on the value of the macro
@@ -463,10 +463,11 @@
463463
$(SRCDIR)/content.c \
464464
$(SRCDIR)/cookies.c \
465465
$(SRCDIR)/db.c \
466466
$(SRCDIR)/delta.c \
467467
$(SRCDIR)/deltacmd.c \
468
+ $(SRCDIR)/deltafunc.c \
468469
$(SRCDIR)/descendants.c \
469470
$(SRCDIR)/diff.c \
470471
$(SRCDIR)/diffcmd.c \
471472
$(SRCDIR)/dispatch.c \
472473
$(SRCDIR)/doc.c \
@@ -674,10 +675,11 @@
674675
$(OBJDIR)/content_.c \
675676
$(OBJDIR)/cookies_.c \
676677
$(OBJDIR)/db_.c \
677678
$(OBJDIR)/delta_.c \
678679
$(OBJDIR)/deltacmd_.c \
680
+ $(OBJDIR)/deltafunc_.c \
679681
$(OBJDIR)/descendants_.c \
680682
$(OBJDIR)/diff_.c \
681683
$(OBJDIR)/diffcmd_.c \
682684
$(OBJDIR)/dispatch_.c \
683685
$(OBJDIR)/doc_.c \
@@ -812,10 +814,11 @@
812814
$(OBJDIR)/content.o \
813815
$(OBJDIR)/cookies.o \
814816
$(OBJDIR)/db.o \
815817
$(OBJDIR)/delta.o \
816818
$(OBJDIR)/deltacmd.o \
819
+ $(OBJDIR)/deltafunc.o \
817820
$(OBJDIR)/descendants.o \
818821
$(OBJDIR)/diff.o \
819822
$(OBJDIR)/diffcmd.o \
820823
$(OBJDIR)/dispatch.o \
821824
$(OBJDIR)/doc.o \
@@ -1169,10 +1172,11 @@
11691172
$(OBJDIR)/content_.c:$(OBJDIR)/content.h \
11701173
$(OBJDIR)/cookies_.c:$(OBJDIR)/cookies.h \
11711174
$(OBJDIR)/db_.c:$(OBJDIR)/db.h \
11721175
$(OBJDIR)/delta_.c:$(OBJDIR)/delta.h \
11731176
$(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h \
1177
+ $(OBJDIR)/deltafunc_.c:$(OBJDIR)/deltafunc.h \
11741178
$(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h \
11751179
$(OBJDIR)/diff_.c:$(OBJDIR)/diff.h \
11761180
$(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h \
11771181
$(OBJDIR)/dispatch_.c:$(OBJDIR)/dispatch.h \
11781182
$(OBJDIR)/doc_.c:$(OBJDIR)/doc.h \
@@ -1502,10 +1506,18 @@
15021506
15031507
$(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h
15041508
$(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c
15051509
15061510
$(OBJDIR)/deltacmd.h: $(OBJDIR)/headers
1511
+
1512
+$(OBJDIR)/deltafunc_.c: $(SRCDIR)/deltafunc.c $(TRANSLATE)
1513
+ $(TRANSLATE) $(SRCDIR)/deltafunc.c >$@
1514
+
1515
+$(OBJDIR)/deltafunc.o: $(OBJDIR)/deltafunc_.c $(OBJDIR)/deltafunc.h $(SRCDIR)/config.h
1516
+ $(XTCC) -o $(OBJDIR)/deltafunc.o -c $(OBJDIR)/deltafunc_.c
1517
+
1518
+$(OBJDIR)/deltafunc.h: $(OBJDIR)/headers
15071519
15081520
$(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(TRANSLATE)
15091521
$(TRANSLATE) $(SRCDIR)/descendants.c >$@
15101522
15111523
$(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h
15121524
--- win/Makefile.mingw.mistachkin
+++ win/Makefile.mingw.mistachkin
@@ -174,11 +174,11 @@
174 #### The directories where the OpenSSL include and library files are located.
175 # The recommended usage here is to use the Sysinternals junction tool
176 # to create a hard link between an "openssl-1.x" sub-directory of the
177 # Fossil source code directory and the target OpenSSL source directory.
178 #
179 OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1a
180 OPENSSLINCDIR = $(OPENSSLDIR)/include
181 OPENSSLLIBDIR = $(OPENSSLDIR)
182
183 #### Either the directory where the Tcl library is installed or the Tcl
184 # source code directory resides (depending on the value of the macro
@@ -463,10 +463,11 @@
463 $(SRCDIR)/content.c \
464 $(SRCDIR)/cookies.c \
465 $(SRCDIR)/db.c \
466 $(SRCDIR)/delta.c \
467 $(SRCDIR)/deltacmd.c \
 
468 $(SRCDIR)/descendants.c \
469 $(SRCDIR)/diff.c \
470 $(SRCDIR)/diffcmd.c \
471 $(SRCDIR)/dispatch.c \
472 $(SRCDIR)/doc.c \
@@ -674,10 +675,11 @@
674 $(OBJDIR)/content_.c \
675 $(OBJDIR)/cookies_.c \
676 $(OBJDIR)/db_.c \
677 $(OBJDIR)/delta_.c \
678 $(OBJDIR)/deltacmd_.c \
 
679 $(OBJDIR)/descendants_.c \
680 $(OBJDIR)/diff_.c \
681 $(OBJDIR)/diffcmd_.c \
682 $(OBJDIR)/dispatch_.c \
683 $(OBJDIR)/doc_.c \
@@ -812,10 +814,11 @@
812 $(OBJDIR)/content.o \
813 $(OBJDIR)/cookies.o \
814 $(OBJDIR)/db.o \
815 $(OBJDIR)/delta.o \
816 $(OBJDIR)/deltacmd.o \
 
817 $(OBJDIR)/descendants.o \
818 $(OBJDIR)/diff.o \
819 $(OBJDIR)/diffcmd.o \
820 $(OBJDIR)/dispatch.o \
821 $(OBJDIR)/doc.o \
@@ -1169,10 +1172,11 @@
1169 $(OBJDIR)/content_.c:$(OBJDIR)/content.h \
1170 $(OBJDIR)/cookies_.c:$(OBJDIR)/cookies.h \
1171 $(OBJDIR)/db_.c:$(OBJDIR)/db.h \
1172 $(OBJDIR)/delta_.c:$(OBJDIR)/delta.h \
1173 $(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h \
 
1174 $(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h \
1175 $(OBJDIR)/diff_.c:$(OBJDIR)/diff.h \
1176 $(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h \
1177 $(OBJDIR)/dispatch_.c:$(OBJDIR)/dispatch.h \
1178 $(OBJDIR)/doc_.c:$(OBJDIR)/doc.h \
@@ -1502,10 +1506,18 @@
1502
1503 $(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h
1504 $(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c
1505
1506 $(OBJDIR)/deltacmd.h: $(OBJDIR)/headers
 
 
 
 
 
 
 
 
1507
1508 $(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(TRANSLATE)
1509 $(TRANSLATE) $(SRCDIR)/descendants.c >$@
1510
1511 $(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h
1512
--- win/Makefile.mingw.mistachkin
+++ win/Makefile.mingw.mistachkin
@@ -174,11 +174,11 @@
174 #### The directories where the OpenSSL include and library files are located.
175 # The recommended usage here is to use the Sysinternals junction tool
176 # to create a hard link between an "openssl-1.x" sub-directory of the
177 # Fossil source code directory and the target OpenSSL source directory.
178 #
179 OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1b
180 OPENSSLINCDIR = $(OPENSSLDIR)/include
181 OPENSSLLIBDIR = $(OPENSSLDIR)
182
183 #### Either the directory where the Tcl library is installed or the Tcl
184 # source code directory resides (depending on the value of the macro
@@ -463,10 +463,11 @@
463 $(SRCDIR)/content.c \
464 $(SRCDIR)/cookies.c \
465 $(SRCDIR)/db.c \
466 $(SRCDIR)/delta.c \
467 $(SRCDIR)/deltacmd.c \
468 $(SRCDIR)/deltafunc.c \
469 $(SRCDIR)/descendants.c \
470 $(SRCDIR)/diff.c \
471 $(SRCDIR)/diffcmd.c \
472 $(SRCDIR)/dispatch.c \
473 $(SRCDIR)/doc.c \
@@ -674,10 +675,11 @@
675 $(OBJDIR)/content_.c \
676 $(OBJDIR)/cookies_.c \
677 $(OBJDIR)/db_.c \
678 $(OBJDIR)/delta_.c \
679 $(OBJDIR)/deltacmd_.c \
680 $(OBJDIR)/deltafunc_.c \
681 $(OBJDIR)/descendants_.c \
682 $(OBJDIR)/diff_.c \
683 $(OBJDIR)/diffcmd_.c \
684 $(OBJDIR)/dispatch_.c \
685 $(OBJDIR)/doc_.c \
@@ -812,10 +814,11 @@
814 $(OBJDIR)/content.o \
815 $(OBJDIR)/cookies.o \
816 $(OBJDIR)/db.o \
817 $(OBJDIR)/delta.o \
818 $(OBJDIR)/deltacmd.o \
819 $(OBJDIR)/deltafunc.o \
820 $(OBJDIR)/descendants.o \
821 $(OBJDIR)/diff.o \
822 $(OBJDIR)/diffcmd.o \
823 $(OBJDIR)/dispatch.o \
824 $(OBJDIR)/doc.o \
@@ -1169,10 +1172,11 @@
1172 $(OBJDIR)/content_.c:$(OBJDIR)/content.h \
1173 $(OBJDIR)/cookies_.c:$(OBJDIR)/cookies.h \
1174 $(OBJDIR)/db_.c:$(OBJDIR)/db.h \
1175 $(OBJDIR)/delta_.c:$(OBJDIR)/delta.h \
1176 $(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h \
1177 $(OBJDIR)/deltafunc_.c:$(OBJDIR)/deltafunc.h \
1178 $(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h \
1179 $(OBJDIR)/diff_.c:$(OBJDIR)/diff.h \
1180 $(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h \
1181 $(OBJDIR)/dispatch_.c:$(OBJDIR)/dispatch.h \
1182 $(OBJDIR)/doc_.c:$(OBJDIR)/doc.h \
@@ -1502,10 +1506,18 @@
1506
1507 $(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h
1508 $(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c
1509
1510 $(OBJDIR)/deltacmd.h: $(OBJDIR)/headers
1511
1512 $(OBJDIR)/deltafunc_.c: $(SRCDIR)/deltafunc.c $(TRANSLATE)
1513 $(TRANSLATE) $(SRCDIR)/deltafunc.c >$@
1514
1515 $(OBJDIR)/deltafunc.o: $(OBJDIR)/deltafunc_.c $(OBJDIR)/deltafunc.h $(SRCDIR)/config.h
1516 $(XTCC) -o $(OBJDIR)/deltafunc.o -c $(OBJDIR)/deltafunc_.c
1517
1518 $(OBJDIR)/deltafunc.h: $(OBJDIR)/headers
1519
1520 $(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(TRANSLATE)
1521 $(TRANSLATE) $(SRCDIR)/descendants.c >$@
1522
1523 $(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h
1524
--- win/Makefile.mingw.mistachkin
+++ win/Makefile.mingw.mistachkin
@@ -174,11 +174,11 @@
174174
#### The directories where the OpenSSL include and library files are located.
175175
# The recommended usage here is to use the Sysinternals junction tool
176176
# to create a hard link between an "openssl-1.x" sub-directory of the
177177
# Fossil source code directory and the target OpenSSL source directory.
178178
#
179
-OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1a
179
+OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1b
180180
OPENSSLINCDIR = $(OPENSSLDIR)/include
181181
OPENSSLLIBDIR = $(OPENSSLDIR)
182182
183183
#### Either the directory where the Tcl library is installed or the Tcl
184184
# source code directory resides (depending on the value of the macro
@@ -463,10 +463,11 @@
463463
$(SRCDIR)/content.c \
464464
$(SRCDIR)/cookies.c \
465465
$(SRCDIR)/db.c \
466466
$(SRCDIR)/delta.c \
467467
$(SRCDIR)/deltacmd.c \
468
+ $(SRCDIR)/deltafunc.c \
468469
$(SRCDIR)/descendants.c \
469470
$(SRCDIR)/diff.c \
470471
$(SRCDIR)/diffcmd.c \
471472
$(SRCDIR)/dispatch.c \
472473
$(SRCDIR)/doc.c \
@@ -674,10 +675,11 @@
674675
$(OBJDIR)/content_.c \
675676
$(OBJDIR)/cookies_.c \
676677
$(OBJDIR)/db_.c \
677678
$(OBJDIR)/delta_.c \
678679
$(OBJDIR)/deltacmd_.c \
680
+ $(OBJDIR)/deltafunc_.c \
679681
$(OBJDIR)/descendants_.c \
680682
$(OBJDIR)/diff_.c \
681683
$(OBJDIR)/diffcmd_.c \
682684
$(OBJDIR)/dispatch_.c \
683685
$(OBJDIR)/doc_.c \
@@ -812,10 +814,11 @@
812814
$(OBJDIR)/content.o \
813815
$(OBJDIR)/cookies.o \
814816
$(OBJDIR)/db.o \
815817
$(OBJDIR)/delta.o \
816818
$(OBJDIR)/deltacmd.o \
819
+ $(OBJDIR)/deltafunc.o \
817820
$(OBJDIR)/descendants.o \
818821
$(OBJDIR)/diff.o \
819822
$(OBJDIR)/diffcmd.o \
820823
$(OBJDIR)/dispatch.o \
821824
$(OBJDIR)/doc.o \
@@ -1169,10 +1172,11 @@
11691172
$(OBJDIR)/content_.c:$(OBJDIR)/content.h \
11701173
$(OBJDIR)/cookies_.c:$(OBJDIR)/cookies.h \
11711174
$(OBJDIR)/db_.c:$(OBJDIR)/db.h \
11721175
$(OBJDIR)/delta_.c:$(OBJDIR)/delta.h \
11731176
$(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h \
1177
+ $(OBJDIR)/deltafunc_.c:$(OBJDIR)/deltafunc.h \
11741178
$(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h \
11751179
$(OBJDIR)/diff_.c:$(OBJDIR)/diff.h \
11761180
$(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h \
11771181
$(OBJDIR)/dispatch_.c:$(OBJDIR)/dispatch.h \
11781182
$(OBJDIR)/doc_.c:$(OBJDIR)/doc.h \
@@ -1502,10 +1506,18 @@
15021506
15031507
$(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h
15041508
$(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c
15051509
15061510
$(OBJDIR)/deltacmd.h: $(OBJDIR)/headers
1511
+
1512
+$(OBJDIR)/deltafunc_.c: $(SRCDIR)/deltafunc.c $(TRANSLATE)
1513
+ $(TRANSLATE) $(SRCDIR)/deltafunc.c >$@
1514
+
1515
+$(OBJDIR)/deltafunc.o: $(OBJDIR)/deltafunc_.c $(OBJDIR)/deltafunc.h $(SRCDIR)/config.h
1516
+ $(XTCC) -o $(OBJDIR)/deltafunc.o -c $(OBJDIR)/deltafunc_.c
1517
+
1518
+$(OBJDIR)/deltafunc.h: $(OBJDIR)/headers
15071519
15081520
$(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(TRANSLATE)
15091521
$(TRANSLATE) $(SRCDIR)/descendants.c >$@
15101522
15111523
$(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h
15121524
--- win/Makefile.mingw.mistachkin
+++ win/Makefile.mingw.mistachkin
@@ -174,11 +174,11 @@
174 #### The directories where the OpenSSL include and library files are located.
175 # The recommended usage here is to use the Sysinternals junction tool
176 # to create a hard link between an "openssl-1.x" sub-directory of the
177 # Fossil source code directory and the target OpenSSL source directory.
178 #
179 OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1a
180 OPENSSLINCDIR = $(OPENSSLDIR)/include
181 OPENSSLLIBDIR = $(OPENSSLDIR)
182
183 #### Either the directory where the Tcl library is installed or the Tcl
184 # source code directory resides (depending on the value of the macro
@@ -463,10 +463,11 @@
463 $(SRCDIR)/content.c \
464 $(SRCDIR)/cookies.c \
465 $(SRCDIR)/db.c \
466 $(SRCDIR)/delta.c \
467 $(SRCDIR)/deltacmd.c \
 
468 $(SRCDIR)/descendants.c \
469 $(SRCDIR)/diff.c \
470 $(SRCDIR)/diffcmd.c \
471 $(SRCDIR)/dispatch.c \
472 $(SRCDIR)/doc.c \
@@ -674,10 +675,11 @@
674 $(OBJDIR)/content_.c \
675 $(OBJDIR)/cookies_.c \
676 $(OBJDIR)/db_.c \
677 $(OBJDIR)/delta_.c \
678 $(OBJDIR)/deltacmd_.c \
 
679 $(OBJDIR)/descendants_.c \
680 $(OBJDIR)/diff_.c \
681 $(OBJDIR)/diffcmd_.c \
682 $(OBJDIR)/dispatch_.c \
683 $(OBJDIR)/doc_.c \
@@ -812,10 +814,11 @@
812 $(OBJDIR)/content.o \
813 $(OBJDIR)/cookies.o \
814 $(OBJDIR)/db.o \
815 $(OBJDIR)/delta.o \
816 $(OBJDIR)/deltacmd.o \
 
817 $(OBJDIR)/descendants.o \
818 $(OBJDIR)/diff.o \
819 $(OBJDIR)/diffcmd.o \
820 $(OBJDIR)/dispatch.o \
821 $(OBJDIR)/doc.o \
@@ -1169,10 +1172,11 @@
1169 $(OBJDIR)/content_.c:$(OBJDIR)/content.h \
1170 $(OBJDIR)/cookies_.c:$(OBJDIR)/cookies.h \
1171 $(OBJDIR)/db_.c:$(OBJDIR)/db.h \
1172 $(OBJDIR)/delta_.c:$(OBJDIR)/delta.h \
1173 $(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h \
 
1174 $(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h \
1175 $(OBJDIR)/diff_.c:$(OBJDIR)/diff.h \
1176 $(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h \
1177 $(OBJDIR)/dispatch_.c:$(OBJDIR)/dispatch.h \
1178 $(OBJDIR)/doc_.c:$(OBJDIR)/doc.h \
@@ -1502,10 +1506,18 @@
1502
1503 $(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h
1504 $(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c
1505
1506 $(OBJDIR)/deltacmd.h: $(OBJDIR)/headers
 
 
 
 
 
 
 
 
1507
1508 $(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(TRANSLATE)
1509 $(TRANSLATE) $(SRCDIR)/descendants.c >$@
1510
1511 $(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h
1512
--- win/Makefile.mingw.mistachkin
+++ win/Makefile.mingw.mistachkin
@@ -174,11 +174,11 @@
174 #### The directories where the OpenSSL include and library files are located.
175 # The recommended usage here is to use the Sysinternals junction tool
176 # to create a hard link between an "openssl-1.x" sub-directory of the
177 # Fossil source code directory and the target OpenSSL source directory.
178 #
179 OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1b
180 OPENSSLINCDIR = $(OPENSSLDIR)/include
181 OPENSSLLIBDIR = $(OPENSSLDIR)
182
183 #### Either the directory where the Tcl library is installed or the Tcl
184 # source code directory resides (depending on the value of the macro
@@ -463,10 +463,11 @@
463 $(SRCDIR)/content.c \
464 $(SRCDIR)/cookies.c \
465 $(SRCDIR)/db.c \
466 $(SRCDIR)/delta.c \
467 $(SRCDIR)/deltacmd.c \
468 $(SRCDIR)/deltafunc.c \
469 $(SRCDIR)/descendants.c \
470 $(SRCDIR)/diff.c \
471 $(SRCDIR)/diffcmd.c \
472 $(SRCDIR)/dispatch.c \
473 $(SRCDIR)/doc.c \
@@ -674,10 +675,11 @@
675 $(OBJDIR)/content_.c \
676 $(OBJDIR)/cookies_.c \
677 $(OBJDIR)/db_.c \
678 $(OBJDIR)/delta_.c \
679 $(OBJDIR)/deltacmd_.c \
680 $(OBJDIR)/deltafunc_.c \
681 $(OBJDIR)/descendants_.c \
682 $(OBJDIR)/diff_.c \
683 $(OBJDIR)/diffcmd_.c \
684 $(OBJDIR)/dispatch_.c \
685 $(OBJDIR)/doc_.c \
@@ -812,10 +814,11 @@
814 $(OBJDIR)/content.o \
815 $(OBJDIR)/cookies.o \
816 $(OBJDIR)/db.o \
817 $(OBJDIR)/delta.o \
818 $(OBJDIR)/deltacmd.o \
819 $(OBJDIR)/deltafunc.o \
820 $(OBJDIR)/descendants.o \
821 $(OBJDIR)/diff.o \
822 $(OBJDIR)/diffcmd.o \
823 $(OBJDIR)/dispatch.o \
824 $(OBJDIR)/doc.o \
@@ -1169,10 +1172,11 @@
1172 $(OBJDIR)/content_.c:$(OBJDIR)/content.h \
1173 $(OBJDIR)/cookies_.c:$(OBJDIR)/cookies.h \
1174 $(OBJDIR)/db_.c:$(OBJDIR)/db.h \
1175 $(OBJDIR)/delta_.c:$(OBJDIR)/delta.h \
1176 $(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h \
1177 $(OBJDIR)/deltafunc_.c:$(OBJDIR)/deltafunc.h \
1178 $(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h \
1179 $(OBJDIR)/diff_.c:$(OBJDIR)/diff.h \
1180 $(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h \
1181 $(OBJDIR)/dispatch_.c:$(OBJDIR)/dispatch.h \
1182 $(OBJDIR)/doc_.c:$(OBJDIR)/doc.h \
@@ -1502,10 +1506,18 @@
1506
1507 $(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h
1508 $(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c
1509
1510 $(OBJDIR)/deltacmd.h: $(OBJDIR)/headers
1511
1512 $(OBJDIR)/deltafunc_.c: $(SRCDIR)/deltafunc.c $(TRANSLATE)
1513 $(TRANSLATE) $(SRCDIR)/deltafunc.c >$@
1514
1515 $(OBJDIR)/deltafunc.o: $(OBJDIR)/deltafunc_.c $(OBJDIR)/deltafunc.h $(SRCDIR)/config.h
1516 $(XTCC) -o $(OBJDIR)/deltafunc.o -c $(OBJDIR)/deltafunc_.c
1517
1518 $(OBJDIR)/deltafunc.h: $(OBJDIR)/headers
1519
1520 $(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(TRANSLATE)
1521 $(TRANSLATE) $(SRCDIR)/descendants.c >$@
1522
1523 $(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h
1524
+11 -1
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -98,11 +98,11 @@
9898
!ifndef USE_SEE
9999
USE_SEE = 0
100100
!endif
101101
102102
!if $(FOSSIL_ENABLE_SSL)!=0
103
-SSLDIR = $(B)\compat\openssl-1.1.1a
103
+SSLDIR = $(B)\compat\openssl-1.1.1b
104104
SSLINCDIR = $(SSLDIR)\include
105105
!if $(FOSSIL_DYNAMIC_BUILD)!=0
106106
SSLLIBDIR = $(SSLDIR)
107107
!else
108108
SSLLIBDIR = $(SSLDIR)
@@ -367,10 +367,11 @@
367367
content_.c \
368368
cookies_.c \
369369
db_.c \
370370
delta_.c \
371371
deltacmd_.c \
372
+ deltafunc_.c \
372373
descendants_.c \
373374
diff_.c \
374375
diffcmd_.c \
375376
dispatch_.c \
376377
doc_.c \
@@ -577,10 +578,11 @@
577578
$(OX)\cookies$O \
578579
$(OX)\cson_amalgamation$O \
579580
$(OX)\db$O \
580581
$(OX)\delta$O \
581582
$(OX)\deltacmd$O \
583
+ $(OX)\deltafunc$O \
582584
$(OX)\descendants$O \
583585
$(OX)\diff$O \
584586
$(OX)\diffcmd$O \
585587
$(OX)\dispatch$O \
586588
$(OX)\doc$O \
@@ -777,10 +779,11 @@
777779
echo $(OX)\cookies.obj >> $@
778780
echo $(OX)\cson_amalgamation.obj >> $@
779781
echo $(OX)\db.obj >> $@
780782
echo $(OX)\delta.obj >> $@
781783
echo $(OX)\deltacmd.obj >> $@
784
+ echo $(OX)\deltafunc.obj >> $@
782785
echo $(OX)\descendants.obj >> $@
783786
echo $(OX)\diff.obj >> $@
784787
echo $(OX)\diffcmd.obj >> $@
785788
echo $(OX)\dispatch.obj >> $@
786789
echo $(OX)\doc.obj >> $@
@@ -1170,10 +1173,16 @@
11701173
$(OX)\deltacmd$O : deltacmd_.c deltacmd.h
11711174
$(TCC) /Fo$@ -c deltacmd_.c
11721175
11731176
deltacmd_.c : $(SRCDIR)\deltacmd.c
11741177
translate$E $** > $@
1178
+
1179
+$(OX)\deltafunc$O : deltafunc_.c deltafunc.h
1180
+ $(TCC) /Fo$@ -c deltafunc_.c
1181
+
1182
+deltafunc_.c : $(SRCDIR)\deltafunc.c
1183
+ translate$E $** > $@
11751184
11761185
$(OX)\descendants$O : descendants_.c descendants.h
11771186
$(TCC) /Fo$@ -c descendants_.c
11781187
11791188
descendants_.c : $(SRCDIR)\descendants.c
@@ -1856,10 +1865,11 @@
18561865
content_.c:content.h \
18571866
cookies_.c:cookies.h \
18581867
db_.c:db.h \
18591868
delta_.c:delta.h \
18601869
deltacmd_.c:deltacmd.h \
1870
+ deltafunc_.c:deltafunc.h \
18611871
descendants_.c:descendants.h \
18621872
diff_.c:diff.h \
18631873
diffcmd_.c:diffcmd.h \
18641874
dispatch_.c:dispatch.h \
18651875
doc_.c:doc.h \
18661876
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -98,11 +98,11 @@
98 !ifndef USE_SEE
99 USE_SEE = 0
100 !endif
101
102 !if $(FOSSIL_ENABLE_SSL)!=0
103 SSLDIR = $(B)\compat\openssl-1.1.1a
104 SSLINCDIR = $(SSLDIR)\include
105 !if $(FOSSIL_DYNAMIC_BUILD)!=0
106 SSLLIBDIR = $(SSLDIR)
107 !else
108 SSLLIBDIR = $(SSLDIR)
@@ -367,10 +367,11 @@
367 content_.c \
368 cookies_.c \
369 db_.c \
370 delta_.c \
371 deltacmd_.c \
 
372 descendants_.c \
373 diff_.c \
374 diffcmd_.c \
375 dispatch_.c \
376 doc_.c \
@@ -577,10 +578,11 @@
577 $(OX)\cookies$O \
578 $(OX)\cson_amalgamation$O \
579 $(OX)\db$O \
580 $(OX)\delta$O \
581 $(OX)\deltacmd$O \
 
582 $(OX)\descendants$O \
583 $(OX)\diff$O \
584 $(OX)\diffcmd$O \
585 $(OX)\dispatch$O \
586 $(OX)\doc$O \
@@ -777,10 +779,11 @@
777 echo $(OX)\cookies.obj >> $@
778 echo $(OX)\cson_amalgamation.obj >> $@
779 echo $(OX)\db.obj >> $@
780 echo $(OX)\delta.obj >> $@
781 echo $(OX)\deltacmd.obj >> $@
 
782 echo $(OX)\descendants.obj >> $@
783 echo $(OX)\diff.obj >> $@
784 echo $(OX)\diffcmd.obj >> $@
785 echo $(OX)\dispatch.obj >> $@
786 echo $(OX)\doc.obj >> $@
@@ -1170,10 +1173,16 @@
1170 $(OX)\deltacmd$O : deltacmd_.c deltacmd.h
1171 $(TCC) /Fo$@ -c deltacmd_.c
1172
1173 deltacmd_.c : $(SRCDIR)\deltacmd.c
1174 translate$E $** > $@
 
 
 
 
 
 
1175
1176 $(OX)\descendants$O : descendants_.c descendants.h
1177 $(TCC) /Fo$@ -c descendants_.c
1178
1179 descendants_.c : $(SRCDIR)\descendants.c
@@ -1856,10 +1865,11 @@
1856 content_.c:content.h \
1857 cookies_.c:cookies.h \
1858 db_.c:db.h \
1859 delta_.c:delta.h \
1860 deltacmd_.c:deltacmd.h \
 
1861 descendants_.c:descendants.h \
1862 diff_.c:diff.h \
1863 diffcmd_.c:diffcmd.h \
1864 dispatch_.c:dispatch.h \
1865 doc_.c:doc.h \
1866
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -98,11 +98,11 @@
98 !ifndef USE_SEE
99 USE_SEE = 0
100 !endif
101
102 !if $(FOSSIL_ENABLE_SSL)!=0
103 SSLDIR = $(B)\compat\openssl-1.1.1b
104 SSLINCDIR = $(SSLDIR)\include
105 !if $(FOSSIL_DYNAMIC_BUILD)!=0
106 SSLLIBDIR = $(SSLDIR)
107 !else
108 SSLLIBDIR = $(SSLDIR)
@@ -367,10 +367,11 @@
367 content_.c \
368 cookies_.c \
369 db_.c \
370 delta_.c \
371 deltacmd_.c \
372 deltafunc_.c \
373 descendants_.c \
374 diff_.c \
375 diffcmd_.c \
376 dispatch_.c \
377 doc_.c \
@@ -577,10 +578,11 @@
578 $(OX)\cookies$O \
579 $(OX)\cson_amalgamation$O \
580 $(OX)\db$O \
581 $(OX)\delta$O \
582 $(OX)\deltacmd$O \
583 $(OX)\deltafunc$O \
584 $(OX)\descendants$O \
585 $(OX)\diff$O \
586 $(OX)\diffcmd$O \
587 $(OX)\dispatch$O \
588 $(OX)\doc$O \
@@ -777,10 +779,11 @@
779 echo $(OX)\cookies.obj >> $@
780 echo $(OX)\cson_amalgamation.obj >> $@
781 echo $(OX)\db.obj >> $@
782 echo $(OX)\delta.obj >> $@
783 echo $(OX)\deltacmd.obj >> $@
784 echo $(OX)\deltafunc.obj >> $@
785 echo $(OX)\descendants.obj >> $@
786 echo $(OX)\diff.obj >> $@
787 echo $(OX)\diffcmd.obj >> $@
788 echo $(OX)\dispatch.obj >> $@
789 echo $(OX)\doc.obj >> $@
@@ -1170,10 +1173,16 @@
1173 $(OX)\deltacmd$O : deltacmd_.c deltacmd.h
1174 $(TCC) /Fo$@ -c deltacmd_.c
1175
1176 deltacmd_.c : $(SRCDIR)\deltacmd.c
1177 translate$E $** > $@
1178
1179 $(OX)\deltafunc$O : deltafunc_.c deltafunc.h
1180 $(TCC) /Fo$@ -c deltafunc_.c
1181
1182 deltafunc_.c : $(SRCDIR)\deltafunc.c
1183 translate$E $** > $@
1184
1185 $(OX)\descendants$O : descendants_.c descendants.h
1186 $(TCC) /Fo$@ -c descendants_.c
1187
1188 descendants_.c : $(SRCDIR)\descendants.c
@@ -1856,10 +1865,11 @@
1865 content_.c:content.h \
1866 cookies_.c:cookies.h \
1867 db_.c:db.h \
1868 delta_.c:delta.h \
1869 deltacmd_.c:deltacmd.h \
1870 deltafunc_.c:deltafunc.h \
1871 descendants_.c:descendants.h \
1872 diff_.c:diff.h \
1873 diffcmd_.c:diffcmd.h \
1874 dispatch_.c:dispatch.h \
1875 doc_.c:doc.h \
1876
+11 -1
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -98,11 +98,11 @@
9898
!ifndef USE_SEE
9999
USE_SEE = 0
100100
!endif
101101
102102
!if $(FOSSIL_ENABLE_SSL)!=0
103
-SSLDIR = $(B)\compat\openssl-1.1.1a
103
+SSLDIR = $(B)\compat\openssl-1.1.1b
104104
SSLINCDIR = $(SSLDIR)\include
105105
!if $(FOSSIL_DYNAMIC_BUILD)!=0
106106
SSLLIBDIR = $(SSLDIR)
107107
!else
108108
SSLLIBDIR = $(SSLDIR)
@@ -367,10 +367,11 @@
367367
content_.c \
368368
cookies_.c \
369369
db_.c \
370370
delta_.c \
371371
deltacmd_.c \
372
+ deltafunc_.c \
372373
descendants_.c \
373374
diff_.c \
374375
diffcmd_.c \
375376
dispatch_.c \
376377
doc_.c \
@@ -577,10 +578,11 @@
577578
$(OX)\cookies$O \
578579
$(OX)\cson_amalgamation$O \
579580
$(OX)\db$O \
580581
$(OX)\delta$O \
581582
$(OX)\deltacmd$O \
583
+ $(OX)\deltafunc$O \
582584
$(OX)\descendants$O \
583585
$(OX)\diff$O \
584586
$(OX)\diffcmd$O \
585587
$(OX)\dispatch$O \
586588
$(OX)\doc$O \
@@ -777,10 +779,11 @@
777779
echo $(OX)\cookies.obj >> $@
778780
echo $(OX)\cson_amalgamation.obj >> $@
779781
echo $(OX)\db.obj >> $@
780782
echo $(OX)\delta.obj >> $@
781783
echo $(OX)\deltacmd.obj >> $@
784
+ echo $(OX)\deltafunc.obj >> $@
782785
echo $(OX)\descendants.obj >> $@
783786
echo $(OX)\diff.obj >> $@
784787
echo $(OX)\diffcmd.obj >> $@
785788
echo $(OX)\dispatch.obj >> $@
786789
echo $(OX)\doc.obj >> $@
@@ -1170,10 +1173,16 @@
11701173
$(OX)\deltacmd$O : deltacmd_.c deltacmd.h
11711174
$(TCC) /Fo$@ -c deltacmd_.c
11721175
11731176
deltacmd_.c : $(SRCDIR)\deltacmd.c
11741177
translate$E $** > $@
1178
+
1179
+$(OX)\deltafunc$O : deltafunc_.c deltafunc.h
1180
+ $(TCC) /Fo$@ -c deltafunc_.c
1181
+
1182
+deltafunc_.c : $(SRCDIR)\deltafunc.c
1183
+ translate$E $** > $@
11751184
11761185
$(OX)\descendants$O : descendants_.c descendants.h
11771186
$(TCC) /Fo$@ -c descendants_.c
11781187
11791188
descendants_.c : $(SRCDIR)\descendants.c
@@ -1856,10 +1865,11 @@
18561865
content_.c:content.h \
18571866
cookies_.c:cookies.h \
18581867
db_.c:db.h \
18591868
delta_.c:delta.h \
18601869
deltacmd_.c:deltacmd.h \
1870
+ deltafunc_.c:deltafunc.h \
18611871
descendants_.c:descendants.h \
18621872
diff_.c:diff.h \
18631873
diffcmd_.c:diffcmd.h \
18641874
dispatch_.c:dispatch.h \
18651875
doc_.c:doc.h \
18661876
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -98,11 +98,11 @@
98 !ifndef USE_SEE
99 USE_SEE = 0
100 !endif
101
102 !if $(FOSSIL_ENABLE_SSL)!=0
103 SSLDIR = $(B)\compat\openssl-1.1.1a
104 SSLINCDIR = $(SSLDIR)\include
105 !if $(FOSSIL_DYNAMIC_BUILD)!=0
106 SSLLIBDIR = $(SSLDIR)
107 !else
108 SSLLIBDIR = $(SSLDIR)
@@ -367,10 +367,11 @@
367 content_.c \
368 cookies_.c \
369 db_.c \
370 delta_.c \
371 deltacmd_.c \
 
372 descendants_.c \
373 diff_.c \
374 diffcmd_.c \
375 dispatch_.c \
376 doc_.c \
@@ -577,10 +578,11 @@
577 $(OX)\cookies$O \
578 $(OX)\cson_amalgamation$O \
579 $(OX)\db$O \
580 $(OX)\delta$O \
581 $(OX)\deltacmd$O \
 
582 $(OX)\descendants$O \
583 $(OX)\diff$O \
584 $(OX)\diffcmd$O \
585 $(OX)\dispatch$O \
586 $(OX)\doc$O \
@@ -777,10 +779,11 @@
777 echo $(OX)\cookies.obj >> $@
778 echo $(OX)\cson_amalgamation.obj >> $@
779 echo $(OX)\db.obj >> $@
780 echo $(OX)\delta.obj >> $@
781 echo $(OX)\deltacmd.obj >> $@
 
782 echo $(OX)\descendants.obj >> $@
783 echo $(OX)\diff.obj >> $@
784 echo $(OX)\diffcmd.obj >> $@
785 echo $(OX)\dispatch.obj >> $@
786 echo $(OX)\doc.obj >> $@
@@ -1170,10 +1173,16 @@
1170 $(OX)\deltacmd$O : deltacmd_.c deltacmd.h
1171 $(TCC) /Fo$@ -c deltacmd_.c
1172
1173 deltacmd_.c : $(SRCDIR)\deltacmd.c
1174 translate$E $** > $@
 
 
 
 
 
 
1175
1176 $(OX)\descendants$O : descendants_.c descendants.h
1177 $(TCC) /Fo$@ -c descendants_.c
1178
1179 descendants_.c : $(SRCDIR)\descendants.c
@@ -1856,10 +1865,11 @@
1856 content_.c:content.h \
1857 cookies_.c:cookies.h \
1858 db_.c:db.h \
1859 delta_.c:delta.h \
1860 deltacmd_.c:deltacmd.h \
 
1861 descendants_.c:descendants.h \
1862 diff_.c:diff.h \
1863 diffcmd_.c:diffcmd.h \
1864 dispatch_.c:dispatch.h \
1865 doc_.c:doc.h \
1866
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -98,11 +98,11 @@
98 !ifndef USE_SEE
99 USE_SEE = 0
100 !endif
101
102 !if $(FOSSIL_ENABLE_SSL)!=0
103 SSLDIR = $(B)\compat\openssl-1.1.1b
104 SSLINCDIR = $(SSLDIR)\include
105 !if $(FOSSIL_DYNAMIC_BUILD)!=0
106 SSLLIBDIR = $(SSLDIR)
107 !else
108 SSLLIBDIR = $(SSLDIR)
@@ -367,10 +367,11 @@
367 content_.c \
368 cookies_.c \
369 db_.c \
370 delta_.c \
371 deltacmd_.c \
372 deltafunc_.c \
373 descendants_.c \
374 diff_.c \
375 diffcmd_.c \
376 dispatch_.c \
377 doc_.c \
@@ -577,10 +578,11 @@
578 $(OX)\cookies$O \
579 $(OX)\cson_amalgamation$O \
580 $(OX)\db$O \
581 $(OX)\delta$O \
582 $(OX)\deltacmd$O \
583 $(OX)\deltafunc$O \
584 $(OX)\descendants$O \
585 $(OX)\diff$O \
586 $(OX)\diffcmd$O \
587 $(OX)\dispatch$O \
588 $(OX)\doc$O \
@@ -777,10 +779,11 @@
779 echo $(OX)\cookies.obj >> $@
780 echo $(OX)\cson_amalgamation.obj >> $@
781 echo $(OX)\db.obj >> $@
782 echo $(OX)\delta.obj >> $@
783 echo $(OX)\deltacmd.obj >> $@
784 echo $(OX)\deltafunc.obj >> $@
785 echo $(OX)\descendants.obj >> $@
786 echo $(OX)\diff.obj >> $@
787 echo $(OX)\diffcmd.obj >> $@
788 echo $(OX)\dispatch.obj >> $@
789 echo $(OX)\doc.obj >> $@
@@ -1170,10 +1173,16 @@
1173 $(OX)\deltacmd$O : deltacmd_.c deltacmd.h
1174 $(TCC) /Fo$@ -c deltacmd_.c
1175
1176 deltacmd_.c : $(SRCDIR)\deltacmd.c
1177 translate$E $** > $@
1178
1179 $(OX)\deltafunc$O : deltafunc_.c deltafunc.h
1180 $(TCC) /Fo$@ -c deltafunc_.c
1181
1182 deltafunc_.c : $(SRCDIR)\deltafunc.c
1183 translate$E $** > $@
1184
1185 $(OX)\descendants$O : descendants_.c descendants.h
1186 $(TCC) /Fo$@ -c descendants_.c
1187
1188 descendants_.c : $(SRCDIR)\descendants.c
@@ -1856,10 +1865,11 @@
1865 content_.c:content.h \
1866 cookies_.c:cookies.h \
1867 db_.c:db.h \
1868 delta_.c:delta.h \
1869 deltacmd_.c:deltacmd.h \
1870 deltafunc_.c:deltafunc.h \
1871 descendants_.c:descendants.h \
1872 diff_.c:diff.h \
1873 diffcmd_.c:diffcmd.h \
1874 dispatch_.c:dispatch.h \
1875 doc_.c:doc.h \
1876
--- www/admin-v-setup.md
+++ www/admin-v-setup.md
@@ -2,11 +2,11 @@
22
33
Several of the Fossil user capabilities form a clear power hierarchy.
44
Mathematically speaking:
55
66
> *Setup > Admin > Moderator > User > Subscriber > Anonymous > Nobody*
7
-
7
+
88
This document explains the distinction between the first two. For the
99
others, see:
1010
1111
* [How Moderation Works](./forum.wiki#moderation)
1212
@@ -285,11 +285,11 @@
285285
286286
* <p><b>Risky</b>: The <tt>https-login</tt> setting falls under
287287
the "Security" section above, but it should probably never be
288288
adjusted by Admin-only users. Sites that want it on will never
289289
want it to be disabled without a very good reason.</p>
290
-
290
+
291291
<p>There is also an inverse risk: if the site has a front-end
292292
HTTPS proxy that uses HTTP to communicate over localhost to
293293
Fossil, enabling this setting will create an infinite redirect
294294
loop! (Ask me how I know.)</p>
295295
296296
--- www/admin-v-setup.md
+++ www/admin-v-setup.md
@@ -2,11 +2,11 @@
2
3 Several of the Fossil user capabilities form a clear power hierarchy.
4 Mathematically speaking:
5
6 > *Setup > Admin > Moderator > User > Subscriber > Anonymous > Nobody*
7
8 This document explains the distinction between the first two. For the
9 others, see:
10
11 * [How Moderation Works](./forum.wiki#moderation)
12
@@ -285,11 +285,11 @@
285
286 * <p><b>Risky</b>: The <tt>https-login</tt> setting falls under
287 the "Security" section above, but it should probably never be
288 adjusted by Admin-only users. Sites that want it on will never
289 want it to be disabled without a very good reason.</p>
290
291 <p>There is also an inverse risk: if the site has a front-end
292 HTTPS proxy that uses HTTP to communicate over localhost to
293 Fossil, enabling this setting will create an infinite redirect
294 loop! (Ask me how I know.)</p>
295
296
--- www/admin-v-setup.md
+++ www/admin-v-setup.md
@@ -2,11 +2,11 @@
2
3 Several of the Fossil user capabilities form a clear power hierarchy.
4 Mathematically speaking:
5
6 > *Setup > Admin > Moderator > User > Subscriber > Anonymous > Nobody*
7
8 This document explains the distinction between the first two. For the
9 others, see:
10
11 * [How Moderation Works](./forum.wiki#moderation)
12
@@ -285,11 +285,11 @@
285
286 * <p><b>Risky</b>: The <tt>https-login</tt> setting falls under
287 the "Security" section above, but it should probably never be
288 adjusted by Admin-only users. Sites that want it on will never
289 want it to be disabled without a very good reason.</p>
290
291 <p>There is also an inverse risk: if the site has a front-end
292 HTTPS proxy that uses HTTP to communicate over localhost to
293 Fossil, enabling this setting will create an infinite redirect
294 loop! (Ask me how I know.)</p>
295
296
--- www/backoffice.md
+++ www/backoffice.md
@@ -2,17 +2,17 @@
22
==========
33
44
This is technical documentation about the internal workings of Fossil.
55
Ordinary Fossil users do not need to know about anything covered by this
66
document. The information here is intended for people who want to enhance
7
-or extend the Fossil code, or who just want a deeper understanding of
7
+or extend the Fossil code, or who just want a deeper understanding of
88
the internal workings of Fossil.
99
1010
What Is The Backoffice
1111
----------------------
1212
13
-The backoffice is a mechanism used by a
13
+The backoffice is a mechanism used by a
1414
[Fossil server](/doc/trunk/www/server.wiki) to do low-priority
1515
background work that is not directly related to the user interface. Here
1616
are some examples of the kinds of work that backoffice performs:
1717
1818
1. Sending email alerts and notifications
@@ -49,20 +49,20 @@
4949
The backoffice is not a daemon. Each backoffice process runs for a short
5050
while and then exits. This helps keep Fossil easy to manage, since there
5151
are no daemons to start and stop. To upgrade Fossil to a new version,
5252
you simply replace the older "fossil" executable with the newer one, and
5353
the backoffice processes will (within a minute or so) start using the new
54
-one. (Upgrading the executable on Windows is more complicated, since on
55
-Windows it is not possible to replace an executable file that is in active
54
+one. (Upgrading the executable on Windows is more complicated, since on
55
+Windows it is not possible to replace an executable file that is in active
5656
use. But Windows users probably already know this.)
5757
5858
The backoffice is serialized and rate limited. No more than a single
5959
backoffice process will be running at once, and backoffice runs will not
6060
occur more frequently than once every 60 seconds.
6161
6262
If a Fossil server is idle, then no backoffice processes will be running.
63
-That means there are no extra processes sitting around taking up memory
63
+That means there are no extra processes sitting around taking up memory
6464
and process table slots for seldom accessed repositories.
6565
The backoffice is an on-demand system.
6666
A busy repository will usually have a backoffice
6767
running at all times. But an infrequently accessed repository will only have
6868
backoffice processes running for a minute or two following the most recent
@@ -118,13 +118,13 @@
118118
If a system has been idle for a long time, then there will be no
119119
backoffice processes. (Either the process id entries in the lease
120120
will be zero, or there will exist no process associated with the
121121
process id.) When a new web request comes in, the system
122122
sees that no backoffice process is active and so it kicks off a separate
123
-process to run backoffice.
123
+process to run backoffice.
124124
125
-The new backoffice process becomes the "current" process. It sets a
125
+The new backoffice process becomes the "current" process. It sets a
126126
lease expiration time for itself to be 60 seconds in the future.
127127
Then it does the backoffice processing and exits. Note that usually
128128
the backoffice process will exit long before its lease expires. That
129129
is ok. The lease is there to limit the rate at which backoffice processes
130130
run.
@@ -180,10 +180,10 @@
180180
process actually starts to do the backoffice work. This log file can
181181
be used to verify that backoffice really is running, if there is any
182182
doubt. The "backoffice-disable" setting prevents automatic backoffice
183183
processing, if true. Use this to completely disable backoffice processing
184184
that occurs automatically after each HTTP request. The "backoffice-disable"
185
-setting does not affect the operation of the manual
185
+setting does not affect the operation of the manual
186186
"fossil backoffice" command.
187187
Most installations should leave "backoffice-nodelay" and "backoffice-disable"
188188
set to their default values of off and
189189
leave "backoffice-logfile" unset or set to an empty string.
190190
--- www/backoffice.md
+++ www/backoffice.md
@@ -2,17 +2,17 @@
2 ==========
3
4 This is technical documentation about the internal workings of Fossil.
5 Ordinary Fossil users do not need to know about anything covered by this
6 document. The information here is intended for people who want to enhance
7 or extend the Fossil code, or who just want a deeper understanding of
8 the internal workings of Fossil.
9
10 What Is The Backoffice
11 ----------------------
12
13 The backoffice is a mechanism used by a
14 [Fossil server](/doc/trunk/www/server.wiki) to do low-priority
15 background work that is not directly related to the user interface. Here
16 are some examples of the kinds of work that backoffice performs:
17
18 1. Sending email alerts and notifications
@@ -49,20 +49,20 @@
49 The backoffice is not a daemon. Each backoffice process runs for a short
50 while and then exits. This helps keep Fossil easy to manage, since there
51 are no daemons to start and stop. To upgrade Fossil to a new version,
52 you simply replace the older "fossil" executable with the newer one, and
53 the backoffice processes will (within a minute or so) start using the new
54 one. (Upgrading the executable on Windows is more complicated, since on
55 Windows it is not possible to replace an executable file that is in active
56 use. But Windows users probably already know this.)
57
58 The backoffice is serialized and rate limited. No more than a single
59 backoffice process will be running at once, and backoffice runs will not
60 occur more frequently than once every 60 seconds.
61
62 If a Fossil server is idle, then no backoffice processes will be running.
63 That means there are no extra processes sitting around taking up memory
64 and process table slots for seldom accessed repositories.
65 The backoffice is an on-demand system.
66 A busy repository will usually have a backoffice
67 running at all times. But an infrequently accessed repository will only have
68 backoffice processes running for a minute or two following the most recent
@@ -118,13 +118,13 @@
118 If a system has been idle for a long time, then there will be no
119 backoffice processes. (Either the process id entries in the lease
120 will be zero, or there will exist no process associated with the
121 process id.) When a new web request comes in, the system
122 sees that no backoffice process is active and so it kicks off a separate
123 process to run backoffice.
124
125 The new backoffice process becomes the "current" process. It sets a
126 lease expiration time for itself to be 60 seconds in the future.
127 Then it does the backoffice processing and exits. Note that usually
128 the backoffice process will exit long before its lease expires. That
129 is ok. The lease is there to limit the rate at which backoffice processes
130 run.
@@ -180,10 +180,10 @@
180 process actually starts to do the backoffice work. This log file can
181 be used to verify that backoffice really is running, if there is any
182 doubt. The "backoffice-disable" setting prevents automatic backoffice
183 processing, if true. Use this to completely disable backoffice processing
184 that occurs automatically after each HTTP request. The "backoffice-disable"
185 setting does not affect the operation of the manual
186 "fossil backoffice" command.
187 Most installations should leave "backoffice-nodelay" and "backoffice-disable"
188 set to their default values of off and
189 leave "backoffice-logfile" unset or set to an empty string.
190
--- www/backoffice.md
+++ www/backoffice.md
@@ -2,17 +2,17 @@
2 ==========
3
4 This is technical documentation about the internal workings of Fossil.
5 Ordinary Fossil users do not need to know about anything covered by this
6 document. The information here is intended for people who want to enhance
7 or extend the Fossil code, or who just want a deeper understanding of
8 the internal workings of Fossil.
9
10 What Is The Backoffice
11 ----------------------
12
13 The backoffice is a mechanism used by a
14 [Fossil server](/doc/trunk/www/server.wiki) to do low-priority
15 background work that is not directly related to the user interface. Here
16 are some examples of the kinds of work that backoffice performs:
17
18 1. Sending email alerts and notifications
@@ -49,20 +49,20 @@
49 The backoffice is not a daemon. Each backoffice process runs for a short
50 while and then exits. This helps keep Fossil easy to manage, since there
51 are no daemons to start and stop. To upgrade Fossil to a new version,
52 you simply replace the older "fossil" executable with the newer one, and
53 the backoffice processes will (within a minute or so) start using the new
54 one. (Upgrading the executable on Windows is more complicated, since on
55 Windows it is not possible to replace an executable file that is in active
56 use. But Windows users probably already know this.)
57
58 The backoffice is serialized and rate limited. No more than a single
59 backoffice process will be running at once, and backoffice runs will not
60 occur more frequently than once every 60 seconds.
61
62 If a Fossil server is idle, then no backoffice processes will be running.
63 That means there are no extra processes sitting around taking up memory
64 and process table slots for seldom accessed repositories.
65 The backoffice is an on-demand system.
66 A busy repository will usually have a backoffice
67 running at all times. But an infrequently accessed repository will only have
68 backoffice processes running for a minute or two following the most recent
@@ -118,13 +118,13 @@
118 If a system has been idle for a long time, then there will be no
119 backoffice processes. (Either the process id entries in the lease
120 will be zero, or there will exist no process associated with the
121 process id.) When a new web request comes in, the system
122 sees that no backoffice process is active and so it kicks off a separate
123 process to run backoffice.
124
125 The new backoffice process becomes the "current" process. It sets a
126 lease expiration time for itself to be 60 seconds in the future.
127 Then it does the backoffice processing and exits. Note that usually
128 the backoffice process will exit long before its lease expires. That
129 is ok. The lease is there to limit the rate at which backoffice processes
130 run.
@@ -180,10 +180,10 @@
180 process actually starts to do the backoffice work. This log file can
181 be used to verify that backoffice really is running, if there is any
182 doubt. The "backoffice-disable" setting prevents automatic backoffice
183 processing, if true. Use this to completely disable backoffice processing
184 that occurs automatically after each HTTP request. The "backoffice-disable"
185 setting does not affect the operation of the manual
186 "fossil backoffice" command.
187 Most installations should leave "backoffice-nodelay" and "backoffice-disable"
188 set to their default values of off and
189 leave "backoffice-logfile" unset or set to an empty string.
190
--- www/blockchain.md
+++ www/blockchain.md
@@ -20,11 +20,11 @@
2020
and since Fossil has nothing to do with cryptocurrency, the claim that
2121
Fossil is build around blockchain is met with skepticism. The key thing
2222
to note here is that cryptocurrency implementations like BitCoin are
2323
built around blockchain, but they are not synonymous with blockchain.
2424
Blockchain is a much broader concept. Blockchain is a mechanism for
25
-constructed a distributed ledger of transactions.
25
+constructed a distributed ledger of transactions.
2626
Yes, you can use a distributed
2727
ledger to implement a cryptocurrency, but you can also use a distributed
2828
ledger to implement a version control system, and probably many other kinds
2929
of applications as well. Blockchain is a much broader idea than
3030
cryptocurrency.
3131
--- www/blockchain.md
+++ www/blockchain.md
@@ -20,11 +20,11 @@
20 and since Fossil has nothing to do with cryptocurrency, the claim that
21 Fossil is build around blockchain is met with skepticism. The key thing
22 to note here is that cryptocurrency implementations like BitCoin are
23 built around blockchain, but they are not synonymous with blockchain.
24 Blockchain is a much broader concept. Blockchain is a mechanism for
25 constructed a distributed ledger of transactions.
26 Yes, you can use a distributed
27 ledger to implement a cryptocurrency, but you can also use a distributed
28 ledger to implement a version control system, and probably many other kinds
29 of applications as well. Blockchain is a much broader idea than
30 cryptocurrency.
31
--- www/blockchain.md
+++ www/blockchain.md
@@ -20,11 +20,11 @@
20 and since Fossil has nothing to do with cryptocurrency, the claim that
21 Fossil is build around blockchain is met with skepticism. The key thing
22 to note here is that cryptocurrency implementations like BitCoin are
23 built around blockchain, but they are not synonymous with blockchain.
24 Blockchain is a much broader concept. Blockchain is a mechanism for
25 constructed a distributed ledger of transactions.
26 Yes, you can use a distributed
27 ledger to implement a cryptocurrency, but you can also use a distributed
28 ledger to implement a version control system, and probably many other kinds
29 of applications as well. Blockchain is a much broader idea than
30 cryptocurrency.
31
+1 -1
--- www/build.wiki
+++ www/build.wiki
@@ -157,11 +157,11 @@
157157
the optional <a href="https://www.openssl.org/">OpenSSL</a> support,
158158
first <a href="https://www.openssl.org/source/">download the official
159159
source code for OpenSSL</a> and extract it to an appropriately named
160160
"<b>openssl-X.Y.ZA</b>" subdirectory within the local
161161
[/tree?ci=trunk&name=compat | compat] directory (e.g.
162
-"<b>compat/openssl-1.1.1a</b>"), then make sure that some recent
162
+"<b>compat/openssl-1.1.1b</b>"), then make sure that some recent
163163
<a href="http://www.perl.org/">Perl</a> binaries are installed locally,
164164
and finally run one of the following commands:
165165
<blockquote><pre>
166166
nmake /f Makefile.msc FOSSIL_ENABLE_SSL=1 FOSSIL_BUILD_SSL=1 PERLDIR=C:\full\path\to\Perl\bin
167167
</pre></blockquote>
168168
--- www/build.wiki
+++ www/build.wiki
@@ -157,11 +157,11 @@
157 the optional <a href="https://www.openssl.org/">OpenSSL</a> support,
158 first <a href="https://www.openssl.org/source/">download the official
159 source code for OpenSSL</a> and extract it to an appropriately named
160 "<b>openssl-X.Y.ZA</b>" subdirectory within the local
161 [/tree?ci=trunk&name=compat | compat] directory (e.g.
162 "<b>compat/openssl-1.1.1a</b>"), then make sure that some recent
163 <a href="http://www.perl.org/">Perl</a> binaries are installed locally,
164 and finally run one of the following commands:
165 <blockquote><pre>
166 nmake /f Makefile.msc FOSSIL_ENABLE_SSL=1 FOSSIL_BUILD_SSL=1 PERLDIR=C:\full\path\to\Perl\bin
167 </pre></blockquote>
168
--- www/build.wiki
+++ www/build.wiki
@@ -157,11 +157,11 @@
157 the optional <a href="https://www.openssl.org/">OpenSSL</a> support,
158 first <a href="https://www.openssl.org/source/">download the official
159 source code for OpenSSL</a> and extract it to an appropriately named
160 "<b>openssl-X.Y.ZA</b>" subdirectory within the local
161 [/tree?ci=trunk&name=compat | compat] directory (e.g.
162 "<b>compat/openssl-1.1.1b</b>"), then make sure that some recent
163 <a href="http://www.perl.org/">Perl</a> binaries are installed locally,
164 and finally run one of the following commands:
165 <blockquote><pre>
166 nmake /f Makefile.msc FOSSIL_ENABLE_SSL=1 FOSSIL_BUILD_SSL=1 PERLDIR=C:\full\path\to\Perl\bin
167 </pre></blockquote>
168
+1 -1
--- www/build.wiki
+++ www/build.wiki
@@ -157,11 +157,11 @@
157157
the optional <a href="https://www.openssl.org/">OpenSSL</a> support,
158158
first <a href="https://www.openssl.org/source/">download the official
159159
source code for OpenSSL</a> and extract it to an appropriately named
160160
"<b>openssl-X.Y.ZA</b>" subdirectory within the local
161161
[/tree?ci=trunk&name=compat | compat] directory (e.g.
162
-"<b>compat/openssl-1.1.1a</b>"), then make sure that some recent
162
+"<b>compat/openssl-1.1.1b</b>"), then make sure that some recent
163163
<a href="http://www.perl.org/">Perl</a> binaries are installed locally,
164164
and finally run one of the following commands:
165165
<blockquote><pre>
166166
nmake /f Makefile.msc FOSSIL_ENABLE_SSL=1 FOSSIL_BUILD_SSL=1 PERLDIR=C:\full\path\to\Perl\bin
167167
</pre></blockquote>
168168
--- www/build.wiki
+++ www/build.wiki
@@ -157,11 +157,11 @@
157 the optional <a href="https://www.openssl.org/">OpenSSL</a> support,
158 first <a href="https://www.openssl.org/source/">download the official
159 source code for OpenSSL</a> and extract it to an appropriately named
160 "<b>openssl-X.Y.ZA</b>" subdirectory within the local
161 [/tree?ci=trunk&name=compat | compat] directory (e.g.
162 "<b>compat/openssl-1.1.1a</b>"), then make sure that some recent
163 <a href="http://www.perl.org/">Perl</a> binaries are installed locally,
164 and finally run one of the following commands:
165 <blockquote><pre>
166 nmake /f Makefile.msc FOSSIL_ENABLE_SSL=1 FOSSIL_BUILD_SSL=1 PERLDIR=C:\full\path\to\Perl\bin
167 </pre></blockquote>
168
--- www/build.wiki
+++ www/build.wiki
@@ -157,11 +157,11 @@
157 the optional <a href="https://www.openssl.org/">OpenSSL</a> support,
158 first <a href="https://www.openssl.org/source/">download the official
159 source code for OpenSSL</a> and extract it to an appropriately named
160 "<b>openssl-X.Y.ZA</b>" subdirectory within the local
161 [/tree?ci=trunk&name=compat | compat] directory (e.g.
162 "<b>compat/openssl-1.1.1b</b>"), then make sure that some recent
163 <a href="http://www.perl.org/">Perl</a> binaries are installed locally,
164 and finally run one of the following commands:
165 <blockquote><pre>
166 nmake /f Makefile.msc FOSSIL_ENABLE_SSL=1 FOSSIL_BUILD_SSL=1 PERLDIR=C:\full\path\to\Perl\bin
167 </pre></blockquote>
168
+22 -5
--- www/changes.wiki
+++ www/changes.wiki
@@ -1,25 +1,42 @@
11
<title>Change Log</title>
22
33
<a name='v2_9'></a>
44
<h2>Changes for Version 2.9 (pending)</h2>
55
6
- * Improved handling of relative hyperlinks on the /artifact page
6
+ * Improved handling of relative hyperlinks on the
7
+ [/help?cmd=/artifact|/artifact] pages for wiki. For example,
8
+ hyperlinks and the lizard &lt;img&gt; now work correctly
9
+ for both [/artifact/2ff24ab0887cf522] and
10
+ [/doc/0d7ac90d575004c2415/www/index.wiki].
11
+ * For the "[/help?cmd=update|fossil update]" and
12
+ "[/help?cmd=checkout|fossil checkout]" commands, if a
13
+ managed file is removed because it is no longer part of the target
14
+ check-in and the directory containing the file is empty after the
15
+ file is removed and the directory is not the current working
16
+ directory and is not on the [/help?cmd=empty-dirs|empty-dirs]
17
+ list, then also remove the directory.
18
+ * Update internal Unicode character tables, used in regular expression
19
+ handling, from version 11.0 to 12.0.
20
+ * In "[/help?cmd=regexp|fossil regexp]", "[/help?cmd=grep|fossil grep]"
21
+ and the TH1 "regexp" command, the -nocase option now removes multiple
22
+ diacritics from the same character (derived from SQLite's
23
+ remove_diacritics=2)
724
825
<a name='v2_8'></a>
926
<h2>Changes for Version 2.8 (2019-02-20)</h2>
1027
1128
* Show cherry-pick merges as dotted lines on the timeline graph.
1229
&rarr; The "fossil rebuild" command must be run to create and
13
- populate the new "cherrypick" table in the repository in order
30
+ populate the new "cherrypick" table in the repository in order
1431
for this feature to operate.
1532
* Add the ability to associate branches, check-ins, and tags with
1633
specially-named Wiki pages. This gives the ability to better
1734
document branches and tags, and provide more documentation on
1835
check-ins beyond the check-in comment. The associated Wiki is
1936
automatically displayed on /info pages for check-ins, and on
20
- /timeline?r=BRANCH and /timeline?t=TAG pages for branches and
37
+ /timeline?r=BRANCH and /timeline?t=TAG pages for branches and
2138
tags. This feature is on by default, but can be disabled in on
2239
the Admin/Wiki page.
2340
* Enhance the repository list page (shown for example by
2441
"fossil all ui") so that it shows the name and last check-in
2542
time for each project. The implementation of the repository
@@ -51,11 +68,11 @@
5168
* Enhancements to the "amend", "tag", and "reparent" commands, including
5269
adding options --override-date, --override-user, and --dry-run.
5370
* Add the global --comment-format command-line option and the
5471
comment-format setting to control the display of the command-line
5572
timeline.
56
- * Change the "fossil reparent" command so that it only works from
73
+ * Change the "fossil reparent" command so that it only works from
5774
within an active checkout.
5875
* On the /setup_ucap_list, show administrators how many users have
5976
each capability. The counts are a hyperlink to the /setup_ulist
6077
page showing the subset of users that have that capability.
6178
* Provide the ability to redirect all HTTP pages to HTTPS. Formerly
@@ -86,11 +103,11 @@
86103
User capabilities are now letters in &#91;a-zA-Z0-9&#93;.
87104
* The built-in skins are now responsive, providing better layout on
88105
small screens, including mobile devices.
89106
* The default skin now includes a hamburger menu that is generated
90107
by the [/sitemap] page.
91
- * All of the built-in skins now use a
108
+ * All of the built-in skins now use a
92109
[https://en.wikipedia.org/wiki/Content_Security_Policy|Content Security Policy (CSP)]
93110
to help prevent cross-site injection and forgery attacks. There are no known
94111
vulnerabilities in Fossil. The added CSP does not fix anything; it merely adds
95112
another layer of defense.
96113
* The [/sitemap] and other list pages show as multiple columns if
97114
--- www/changes.wiki
+++ www/changes.wiki
@@ -1,25 +1,42 @@
1 <title>Change Log</title>
2
3 <a name='v2_9'></a>
4 <h2>Changes for Version 2.9 (pending)</h2>
5
6 * Improved handling of relative hyperlinks on the /artifact page
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
8 <a name='v2_8'></a>
9 <h2>Changes for Version 2.8 (2019-02-20)</h2>
10
11 * Show cherry-pick merges as dotted lines on the timeline graph.
12 &rarr; The "fossil rebuild" command must be run to create and
13 populate the new "cherrypick" table in the repository in order
14 for this feature to operate.
15 * Add the ability to associate branches, check-ins, and tags with
16 specially-named Wiki pages. This gives the ability to better
17 document branches and tags, and provide more documentation on
18 check-ins beyond the check-in comment. The associated Wiki is
19 automatically displayed on /info pages for check-ins, and on
20 /timeline?r=BRANCH and /timeline?t=TAG pages for branches and
21 tags. This feature is on by default, but can be disabled in on
22 the Admin/Wiki page.
23 * Enhance the repository list page (shown for example by
24 "fossil all ui") so that it shows the name and last check-in
25 time for each project. The implementation of the repository
@@ -51,11 +68,11 @@
51 * Enhancements to the "amend", "tag", and "reparent" commands, including
52 adding options --override-date, --override-user, and --dry-run.
53 * Add the global --comment-format command-line option and the
54 comment-format setting to control the display of the command-line
55 timeline.
56 * Change the "fossil reparent" command so that it only works from
57 within an active checkout.
58 * On the /setup_ucap_list, show administrators how many users have
59 each capability. The counts are a hyperlink to the /setup_ulist
60 page showing the subset of users that have that capability.
61 * Provide the ability to redirect all HTTP pages to HTTPS. Formerly
@@ -86,11 +103,11 @@
86 User capabilities are now letters in &#91;a-zA-Z0-9&#93;.
87 * The built-in skins are now responsive, providing better layout on
88 small screens, including mobile devices.
89 * The default skin now includes a hamburger menu that is generated
90 by the [/sitemap] page.
91 * All of the built-in skins now use a
92 [https://en.wikipedia.org/wiki/Content_Security_Policy|Content Security Policy (CSP)]
93 to help prevent cross-site injection and forgery attacks. There are no known
94 vulnerabilities in Fossil. The added CSP does not fix anything; it merely adds
95 another layer of defense.
96 * The [/sitemap] and other list pages show as multiple columns if
97
--- www/changes.wiki
+++ www/changes.wiki
@@ -1,25 +1,42 @@
1 <title>Change Log</title>
2
3 <a name='v2_9'></a>
4 <h2>Changes for Version 2.9 (pending)</h2>
5
6 * Improved handling of relative hyperlinks on the
7 [/help?cmd=/artifact|/artifact] pages for wiki. For example,
8 hyperlinks and the lizard &lt;img&gt; now work correctly
9 for both [/artifact/2ff24ab0887cf522] and
10 [/doc/0d7ac90d575004c2415/www/index.wiki].
11 * For the "[/help?cmd=update|fossil update]" and
12 "[/help?cmd=checkout|fossil checkout]" commands, if a
13 managed file is removed because it is no longer part of the target
14 check-in and the directory containing the file is empty after the
15 file is removed and the directory is not the current working
16 directory and is not on the [/help?cmd=empty-dirs|empty-dirs]
17 list, then also remove the directory.
18 * Update internal Unicode character tables, used in regular expression
19 handling, from version 11.0 to 12.0.
20 * In "[/help?cmd=regexp|fossil regexp]", "[/help?cmd=grep|fossil grep]"
21 and the TH1 "regexp" command, the -nocase option now removes multiple
22 diacritics from the same character (derived from SQLite's
23 remove_diacritics=2)
24
25 <a name='v2_8'></a>
26 <h2>Changes for Version 2.8 (2019-02-20)</h2>
27
28 * Show cherry-pick merges as dotted lines on the timeline graph.
29 &rarr; The "fossil rebuild" command must be run to create and
30 populate the new "cherrypick" table in the repository in order
31 for this feature to operate.
32 * Add the ability to associate branches, check-ins, and tags with
33 specially-named Wiki pages. This gives the ability to better
34 document branches and tags, and provide more documentation on
35 check-ins beyond the check-in comment. The associated Wiki is
36 automatically displayed on /info pages for check-ins, and on
37 /timeline?r=BRANCH and /timeline?t=TAG pages for branches and
38 tags. This feature is on by default, but can be disabled in on
39 the Admin/Wiki page.
40 * Enhance the repository list page (shown for example by
41 "fossil all ui") so that it shows the name and last check-in
42 time for each project. The implementation of the repository
@@ -51,11 +68,11 @@
68 * Enhancements to the "amend", "tag", and "reparent" commands, including
69 adding options --override-date, --override-user, and --dry-run.
70 * Add the global --comment-format command-line option and the
71 comment-format setting to control the display of the command-line
72 timeline.
73 * Change the "fossil reparent" command so that it only works from
74 within an active checkout.
75 * On the /setup_ucap_list, show administrators how many users have
76 each capability. The counts are a hyperlink to the /setup_ulist
77 page showing the subset of users that have that capability.
78 * Provide the ability to redirect all HTTP pages to HTTPS. Formerly
@@ -86,11 +103,11 @@
103 User capabilities are now letters in &#91;a-zA-Z0-9&#93;.
104 * The built-in skins are now responsive, providing better layout on
105 small screens, including mobile devices.
106 * The default skin now includes a hamburger menu that is generated
107 by the [/sitemap] page.
108 * All of the built-in skins now use a
109 [https://en.wikipedia.org/wiki/Content_Security_Policy|Content Security Policy (CSP)]
110 to help prevent cross-site injection and forgery attacks. There are no known
111 vulnerabilities in Fossil. The added CSP does not fix anything; it merely adds
112 another layer of defense.
113 * The [/sitemap] and other list pages show as multiple columns if
114
+1 -1
--- www/env-opts.md
+++ www/env-opts.md
@@ -31,11 +31,11 @@
3131
3232
`--chdir DIRECTORY`: Change to the named directory before processing
3333
any commands.
3434
3535
36
-`--comfmtflags NUMBER`
36
+`--comfmtflags NUMBER`
3737
`--comment-format NUMBER`: Specify flags that control how check-in comments
3838
and certain other text outputs are formatted for display. The flags are
3939
individual bits in `NUMBER`, which must be specified in base 10:
4040
4141
* _0_ &mdash; Uses the revised algorithm with no special handling.
4242
--- www/env-opts.md
+++ www/env-opts.md
@@ -31,11 +31,11 @@
31
32 `--chdir DIRECTORY`: Change to the named directory before processing
33 any commands.
34
35
36 `--comfmtflags NUMBER`
37 `--comment-format NUMBER`: Specify flags that control how check-in comments
38 and certain other text outputs are formatted for display. The flags are
39 individual bits in `NUMBER`, which must be specified in base 10:
40
41 * _0_ &mdash; Uses the revised algorithm with no special handling.
42
--- www/env-opts.md
+++ www/env-opts.md
@@ -31,11 +31,11 @@
31
32 `--chdir DIRECTORY`: Change to the named directory before processing
33 any commands.
34
35
36 `--comfmtflags NUMBER`
37 `--comment-format NUMBER`: Specify flags that control how check-in comments
38 and certain other text outputs are formatted for display. The flags are
39 individual bits in `NUMBER`, which must be specified in base 10:
40
41 * _0_ &mdash; Uses the revised algorithm with no special handling.
42
--- www/fileformat.wiki
+++ www/fileformat.wiki
@@ -529,11 +529,11 @@
529529
The <b>Z</b> card is the required checksum over the rest of the artifact.
530530
531531
<a name="forum"></a>
532532
<h3>2.8 Forum Posts</h3>
533533
534
-Forum posts are intended as a mechanism for users and developers to
534
+Forum posts are intended as a mechanism for users and developers to
535535
discuss a project. Forum posts are like messages on a mailing list.
536536
537537
The following cards are allowed on an forum post artifact:
538538
539539
<blockquote>
@@ -547,11 +547,11 @@
547547
<b>W</b> <i>size</i> <b>\n</b> <i>text</i> <b>\n</b><br />
548548
<b>Z</b> <i>checksum</i>
549549
</blockquote>
550550
551551
Every forum post must have either one <b>I</b> card and one <b>G</b> card
552
-or one <b>H</b> card.
552
+or one <b>H</b> card.
553553
Forum posts are organized into topic threads. The initial
554554
post for a thread (the root post) has an <b>H</b> card giving the title or
555555
subject for that thread. The argument to the <b>H</b> card is a string
556556
in the same format as a comment string in a <b>C</b> card.
557557
All follow-up posts have an <b>I</b> card that
558558
--- www/fileformat.wiki
+++ www/fileformat.wiki
@@ -529,11 +529,11 @@
529 The <b>Z</b> card is the required checksum over the rest of the artifact.
530
531 <a name="forum"></a>
532 <h3>2.8 Forum Posts</h3>
533
534 Forum posts are intended as a mechanism for users and developers to
535 discuss a project. Forum posts are like messages on a mailing list.
536
537 The following cards are allowed on an forum post artifact:
538
539 <blockquote>
@@ -547,11 +547,11 @@
547 <b>W</b> <i>size</i> <b>\n</b> <i>text</i> <b>\n</b><br />
548 <b>Z</b> <i>checksum</i>
549 </blockquote>
550
551 Every forum post must have either one <b>I</b> card and one <b>G</b> card
552 or one <b>H</b> card.
553 Forum posts are organized into topic threads. The initial
554 post for a thread (the root post) has an <b>H</b> card giving the title or
555 subject for that thread. The argument to the <b>H</b> card is a string
556 in the same format as a comment string in a <b>C</b> card.
557 All follow-up posts have an <b>I</b> card that
558
--- www/fileformat.wiki
+++ www/fileformat.wiki
@@ -529,11 +529,11 @@
529 The <b>Z</b> card is the required checksum over the rest of the artifact.
530
531 <a name="forum"></a>
532 <h3>2.8 Forum Posts</h3>
533
534 Forum posts are intended as a mechanism for users and developers to
535 discuss a project. Forum posts are like messages on a mailing list.
536
537 The following cards are allowed on an forum post artifact:
538
539 <blockquote>
@@ -547,11 +547,11 @@
547 <b>W</b> <i>size</i> <b>\n</b> <i>text</i> <b>\n</b><br />
548 <b>Z</b> <i>checksum</i>
549 </blockquote>
550
551 Every forum post must have either one <b>I</b> card and one <b>G</b> card
552 or one <b>H</b> card.
553 Forum posts are organized into topic threads. The initial
554 post for a thread (the root post) has an <b>H</b> card giving the title or
555 subject for that thread. The argument to the <b>H</b> card is a string
556 in the same format as a comment string in a <b>C</b> card.
557 All follow-up posts have an <b>I</b> card that
558
+1 -1
--- www/forum.wiki
+++ www/forum.wiki
@@ -66,11 +66,11 @@
6666
* <b>Interlink with Other Fossil-Managed Artifacts:</b> Because forum
6767
posts are normal Fossil artifacts, you can interlink them with
6868
other Fossil artifacts using short internal links: link to forum
6969
threads from a [./tickets.wiki | ticket], link to a wiki document
7070
from a forum post, etc.
71
-
71
+
7272
* <b>Durable Links:</b> Once you create a valid internal artifact
7373
link in Fossil, it <em>remains</em> valid, durably. With
7474
third-party forum software and mailing list search engines, your
7575
links are only valid until the third-party component changes its
7676
URL scheme or disappears from the web.
7777
--- www/forum.wiki
+++ www/forum.wiki
@@ -66,11 +66,11 @@
66 * <b>Interlink with Other Fossil-Managed Artifacts:</b> Because forum
67 posts are normal Fossil artifacts, you can interlink them with
68 other Fossil artifacts using short internal links: link to forum
69 threads from a [./tickets.wiki | ticket], link to a wiki document
70 from a forum post, etc.
71
72 * <b>Durable Links:</b> Once you create a valid internal artifact
73 link in Fossil, it <em>remains</em> valid, durably. With
74 third-party forum software and mailing list search engines, your
75 links are only valid until the third-party component changes its
76 URL scheme or disappears from the web.
77
--- www/forum.wiki
+++ www/forum.wiki
@@ -66,11 +66,11 @@
66 * <b>Interlink with Other Fossil-Managed Artifacts:</b> Because forum
67 posts are normal Fossil artifacts, you can interlink them with
68 other Fossil artifacts using short internal links: link to forum
69 threads from a [./tickets.wiki | ticket], link to a wiki document
70 from a forum post, etc.
71
72 * <b>Durable Links:</b> Once you create a valid internal artifact
73 link in Fossil, it <em>remains</em> valid, durably. With
74 third-party forum software and mailing list search engines, your
75 links are only valid until the third-party component changes its
76 URL scheme or disappears from the web.
77
--- www/makefile.wiki
+++ www/makefile.wiki
@@ -99,13 +99,13 @@
9999
There is an option code verification step implemented using
100100
101101
15. [/file/src/codecheck1.c | codecheck1.c]
102102
103103
This file implements a small utility program ("codecheck1")
104
-that scans other Fossil source files looking for errors in printf-style
104
+that scans other Fossil source files looking for errors in printf-style
105105
format strings.
106
-The codecheck1 utility detects missing or surplus arguments on
106
+The codecheck1 utility detects missing or surplus arguments on
107107
printf-like functions and dangerous uses of "%s" that might
108108
permit SQL injection or cross-site scripting attacks. This code
109109
check step is run automatically on each build of Fossil, and can
110110
also be run separately by typing "make codecheck". Note that the
111111
built-in printf format checking of GCC does not function for Fossil
112112
--- www/makefile.wiki
+++ www/makefile.wiki
@@ -99,13 +99,13 @@
99 There is an option code verification step implemented using
100
101 15. [/file/src/codecheck1.c | codecheck1.c]
102
103 This file implements a small utility program ("codecheck1")
104 that scans other Fossil source files looking for errors in printf-style
105 format strings.
106 The codecheck1 utility detects missing or surplus arguments on
107 printf-like functions and dangerous uses of "%s" that might
108 permit SQL injection or cross-site scripting attacks. This code
109 check step is run automatically on each build of Fossil, and can
110 also be run separately by typing "make codecheck". Note that the
111 built-in printf format checking of GCC does not function for Fossil
112
--- www/makefile.wiki
+++ www/makefile.wiki
@@ -99,13 +99,13 @@
99 There is an option code verification step implemented using
100
101 15. [/file/src/codecheck1.c | codecheck1.c]
102
103 This file implements a small utility program ("codecheck1")
104 that scans other Fossil source files looking for errors in printf-style
105 format strings.
106 The codecheck1 utility detects missing or surplus arguments on
107 printf-like functions and dangerous uses of "%s" that might
108 permit SQL injection or cross-site scripting attacks. This code
109 check step is run automatically on each build of Fossil, and can
110 also be run separately by typing "make codecheck". Note that the
111 built-in printf format checking of GCC does not function for Fossil
112
+10 -10
--- www/tls-nginx.md
+++ www/tls-nginx.md
@@ -59,11 +59,11 @@
5959
choose in this guide not to make nginx reinterpret Fossil’s
6060
implementation of HTTP.
6161
6262
* **CGI** — This method is simple but inefficient, because it launches
6363
a separate Fossil instance on every HTTP hit.
64
-
64
+
6565
Since Fossil is a relatively small self-contained program, and it’s
6666
designed to start up quickly, this method can work well in a
6767
surprisingly large number of cases.
6868
6969
Nevertheless, we will avoid this option in this document because
@@ -233,29 +233,29 @@
233233
234234
Here’s an example configuration:
235235
236236
server {
237237
server_name .foo.net;
238
-
238
+
239239
include local/tls-common;
240
-
240
+
241241
charset utf-8;
242
-
242
+
243243
access_log /var/log/nginx/foo.net-https-access.log;
244244
error_log /var/log/nginx/foo.net-https-error.log;
245
-
245
+
246246
# Bypass Fossil for the static Doxygen docs
247247
location /doc/html {
248248
root /var/www/foo.net;
249
-
249
+
250250
location ~* \.(html|ico|css|js|gif|jpg|png)$ {
251251
expires 7d;
252252
add_header Vary Accept-Encoding;
253253
access_log off;
254254
}
255255
}
256
-
256
+
257257
# Redirect everything else to the Fossil instance
258258
location / {
259259
include scgi_params;
260260
scgi_pass 127.0.0.1:12345;
261261
scgi_param HTTPS "on";
@@ -301,11 +301,11 @@
301301
the standard HTTPS port. It is the same as `listen 443; ssl on;` in
302302
older versions of nginx.
303303
304304
Since all of those domains share a single TLS certificate, we reference
305305
the same `example.com/*.pem` files written out by Certbot with the
306
-`ssl_certificate*` lines.
306
+`ssl_certificate*` lines.
307307
308308
The `ssl_dhparam` directive isn’t strictly required, but without it, the
309309
server becomes vulnerable to the [Logjam attack][lja] because some of
310310
the cryptography steps are precomputed, making the attacker’s job much
311311
easier. The parameter file this directive references should be
@@ -375,15 +375,15 @@
375375
So, from the second `service { }` block, we include this file to set up
376376
the minimal HTTP service we reqiure, `local/http-certbot-only`:
377377
378378
listen 80;
379379
listen [::]:80;
380
-
380
+
381381
# This is expressed as a rewrite rule instead of an "if" because
382382
# http://wiki.nginx.org/IfIsEvil
383383
#rewrite ^(/.well-known/acme-challenge/.*) $1 break;
384
-
384
+
385385
# Force everything else to HTTPS with a permanent redirect.
386386
#return 301 https://$host$request_uri;
387387
388388
As written above, this configuration does nothing other than to tell
389389
nginx that it’s allowed to serve content via HTTP on port 80 as well.
390390
--- www/tls-nginx.md
+++ www/tls-nginx.md
@@ -59,11 +59,11 @@
59 choose in this guide not to make nginx reinterpret Fossil’s
60 implementation of HTTP.
61
62 * **CGI** — This method is simple but inefficient, because it launches
63 a separate Fossil instance on every HTTP hit.
64
65 Since Fossil is a relatively small self-contained program, and it’s
66 designed to start up quickly, this method can work well in a
67 surprisingly large number of cases.
68
69 Nevertheless, we will avoid this option in this document because
@@ -233,29 +233,29 @@
233
234 Here’s an example configuration:
235
236 server {
237 server_name .foo.net;
238
239 include local/tls-common;
240
241 charset utf-8;
242
243 access_log /var/log/nginx/foo.net-https-access.log;
244 error_log /var/log/nginx/foo.net-https-error.log;
245
246 # Bypass Fossil for the static Doxygen docs
247 location /doc/html {
248 root /var/www/foo.net;
249
250 location ~* \.(html|ico|css|js|gif|jpg|png)$ {
251 expires 7d;
252 add_header Vary Accept-Encoding;
253 access_log off;
254 }
255 }
256
257 # Redirect everything else to the Fossil instance
258 location / {
259 include scgi_params;
260 scgi_pass 127.0.0.1:12345;
261 scgi_param HTTPS "on";
@@ -301,11 +301,11 @@
301 the standard HTTPS port. It is the same as `listen 443; ssl on;` in
302 older versions of nginx.
303
304 Since all of those domains share a single TLS certificate, we reference
305 the same `example.com/*.pem` files written out by Certbot with the
306 `ssl_certificate*` lines.
307
308 The `ssl_dhparam` directive isn’t strictly required, but without it, the
309 server becomes vulnerable to the [Logjam attack][lja] because some of
310 the cryptography steps are precomputed, making the attacker’s job much
311 easier. The parameter file this directive references should be
@@ -375,15 +375,15 @@
375 So, from the second `service { }` block, we include this file to set up
376 the minimal HTTP service we reqiure, `local/http-certbot-only`:
377
378 listen 80;
379 listen [::]:80;
380
381 # This is expressed as a rewrite rule instead of an "if" because
382 # http://wiki.nginx.org/IfIsEvil
383 #rewrite ^(/.well-known/acme-challenge/.*) $1 break;
384
385 # Force everything else to HTTPS with a permanent redirect.
386 #return 301 https://$host$request_uri;
387
388 As written above, this configuration does nothing other than to tell
389 nginx that it’s allowed to serve content via HTTP on port 80 as well.
390
--- www/tls-nginx.md
+++ www/tls-nginx.md
@@ -59,11 +59,11 @@
59 choose in this guide not to make nginx reinterpret Fossil’s
60 implementation of HTTP.
61
62 * **CGI** — This method is simple but inefficient, because it launches
63 a separate Fossil instance on every HTTP hit.
64
65 Since Fossil is a relatively small self-contained program, and it’s
66 designed to start up quickly, this method can work well in a
67 surprisingly large number of cases.
68
69 Nevertheless, we will avoid this option in this document because
@@ -233,29 +233,29 @@
233
234 Here’s an example configuration:
235
236 server {
237 server_name .foo.net;
238
239 include local/tls-common;
240
241 charset utf-8;
242
243 access_log /var/log/nginx/foo.net-https-access.log;
244 error_log /var/log/nginx/foo.net-https-error.log;
245
246 # Bypass Fossil for the static Doxygen docs
247 location /doc/html {
248 root /var/www/foo.net;
249
250 location ~* \.(html|ico|css|js|gif|jpg|png)$ {
251 expires 7d;
252 add_header Vary Accept-Encoding;
253 access_log off;
254 }
255 }
256
257 # Redirect everything else to the Fossil instance
258 location / {
259 include scgi_params;
260 scgi_pass 127.0.0.1:12345;
261 scgi_param HTTPS "on";
@@ -301,11 +301,11 @@
301 the standard HTTPS port. It is the same as `listen 443; ssl on;` in
302 older versions of nginx.
303
304 Since all of those domains share a single TLS certificate, we reference
305 the same `example.com/*.pem` files written out by Certbot with the
306 `ssl_certificate*` lines.
307
308 The `ssl_dhparam` directive isn’t strictly required, but without it, the
309 server becomes vulnerable to the [Logjam attack][lja] because some of
310 the cryptography steps are precomputed, making the attacker’s job much
311 easier. The parameter file this directive references should be
@@ -375,15 +375,15 @@
375 So, from the second `service { }` block, we include this file to set up
376 the minimal HTTP service we reqiure, `local/http-certbot-only`:
377
378 listen 80;
379 listen [::]:80;
380
381 # This is expressed as a rewrite rule instead of an "if" because
382 # http://wiki.nginx.org/IfIsEvil
383 #rewrite ^(/.well-known/acme-challenge/.*) $1 break;
384
385 # Force everything else to HTTPS with a permanent redirect.
386 #return 301 https://$host$request_uri;
387
388 As written above, this configuration does nothing other than to tell
389 nginx that it’s allowed to serve content via HTTP on port 80 as well.
390

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button