Fossil SCM

Fix lines over 80 characters long, excluding external source files and @-lines.

danield 2024-02-02 16:26 trunk
Commit 942f691b3954056fd37c1536c0c40349794efae44e46236c9a980779261c0c07
+2 -1
--- src/attach.c
+++ src/attach.c
@@ -750,11 +750,12 @@
750750
}
751751
if( zBody==0 ){
752752
fossil_fatal("technote [%s] not found",zETime);
753753
}
754754
zTarget = db_text(0,
755
- "SELECT substr(tagname,7) FROM tag WHERE tagid=(SELECT tagid FROM event WHERE objid='%d')",
755
+ "SELECT substr(tagname,7) FROM tag "
756
+ " WHERE tagid=(SELECT tagid FROM event WHERE objid='%d')",
756757
rid
757758
);
758759
zFile = g.argv[3];
759760
}
760761
blob_read_from_file(&content, zFile, ExtFILE);
761762
--- src/attach.c
+++ src/attach.c
@@ -750,11 +750,12 @@
750 }
751 if( zBody==0 ){
752 fossil_fatal("technote [%s] not found",zETime);
753 }
754 zTarget = db_text(0,
755 "SELECT substr(tagname,7) FROM tag WHERE tagid=(SELECT tagid FROM event WHERE objid='%d')",
 
756 rid
757 );
758 zFile = g.argv[3];
759 }
760 blob_read_from_file(&content, zFile, ExtFILE);
761
--- src/attach.c
+++ src/attach.c
@@ -750,11 +750,12 @@
750 }
751 if( zBody==0 ){
752 fossil_fatal("technote [%s] not found",zETime);
753 }
754 zTarget = db_text(0,
755 "SELECT substr(tagname,7) FROM tag "
756 " WHERE tagid=(SELECT tagid FROM event WHERE objid='%d')",
757 rid
758 );
759 zFile = g.argv[3];
760 }
761 blob_read_from_file(&content, zFile, ExtFILE);
762
+2 -1
--- src/branch.c
+++ src/branch.c
@@ -340,11 +340,12 @@
340340
);
341341
break;
342342
}
343343
case BRL_OPEN_ONLY: {
344344
blob_append_sql(&sql,
345
- "SELECT name, isprivate, mtime, mergeto FROM tmp_brlist WHERE NOT isclosed"
345
+ "SELECT name, isprivate, mtime, mergeto FROM tmp_brlist "
346
+ " WHERE NOT isclosed"
346347
);
347348
break;
348349
}
349350
}
350351
if( brFlags & BRL_PRIVATE ) blob_append_sql(&sql, " AND isprivate");
351352
--- src/branch.c
+++ src/branch.c
@@ -340,11 +340,12 @@
340 );
341 break;
342 }
343 case BRL_OPEN_ONLY: {
344 blob_append_sql(&sql,
345 "SELECT name, isprivate, mtime, mergeto FROM tmp_brlist WHERE NOT isclosed"
 
346 );
347 break;
348 }
349 }
350 if( brFlags & BRL_PRIVATE ) blob_append_sql(&sql, " AND isprivate");
351
--- src/branch.c
+++ src/branch.c
@@ -340,11 +340,12 @@
340 );
341 break;
342 }
343 case BRL_OPEN_ONLY: {
344 blob_append_sql(&sql,
345 "SELECT name, isprivate, mtime, mergeto FROM tmp_brlist "
346 " WHERE NOT isclosed"
347 );
348 break;
349 }
350 }
351 if( brFlags & BRL_PRIVATE ) blob_append_sql(&sql, " AND isprivate");
352
+2 -1
--- src/browse.c
+++ src/browse.c
@@ -471,11 +471,12 @@
471471
FileTreeNode *pLastChild; /* Last child on the pChild list */
472472
char *zName; /* Name of this entry. The "tail" */
473473
char *zFullName; /* Full pathname of this entry */
474474
char *zUuid; /* Artifact hash of this file. May be NULL. */
475475
double mtime; /* Modification time for this entry */
476
- double sortBy; /* Either mtime or size, depending on desired sort order */
476
+ double sortBy; /* Either mtime or size, depending on desired
477
+ sort order */
477478
int iSize; /* Size for this entry */
478479
unsigned nFullName; /* Length of zFullName */
479480
unsigned iLevel; /* Levels of parent directories */
480481
};
481482
482483
--- src/browse.c
+++ src/browse.c
@@ -471,11 +471,12 @@
471 FileTreeNode *pLastChild; /* Last child on the pChild list */
472 char *zName; /* Name of this entry. The "tail" */
473 char *zFullName; /* Full pathname of this entry */
474 char *zUuid; /* Artifact hash of this file. May be NULL. */
475 double mtime; /* Modification time for this entry */
476 double sortBy; /* Either mtime or size, depending on desired sort order */
 
477 int iSize; /* Size for this entry */
478 unsigned nFullName; /* Length of zFullName */
479 unsigned iLevel; /* Levels of parent directories */
480 };
481
482
--- src/browse.c
+++ src/browse.c
@@ -471,11 +471,12 @@
471 FileTreeNode *pLastChild; /* Last child on the pChild list */
472 char *zName; /* Name of this entry. The "tail" */
473 char *zFullName; /* Full pathname of this entry */
474 char *zUuid; /* Artifact hash of this file. May be NULL. */
475 double mtime; /* Modification time for this entry */
476 double sortBy; /* Either mtime or size, depending on desired
477 sort order */
478 int iSize; /* Size for this entry */
479 unsigned nFullName; /* Length of zFullName */
480 unsigned iLevel; /* Levels of parent directories */
481 };
482
483
+3 -2
--- src/db.c
+++ src/db.c
@@ -2489,11 +2489,11 @@
24892489
if( db_local_table_exists_but_lacks_column("undo_vfile", "islink") ){
24902490
db_multi_exec("ALTER TABLE undo_vfile ADD COLUMN islink BOOL DEFAULT 0");
24912491
}
24922492
}
24932493
2494
- /* The design of the check-out database changed on 2019-01-19, adding the mhash
2494
+ /* The design of the check-out database changed on 2019-01-19 adding the mhash
24952495
** column to vfile and vmerge and changing the UNIQUE index on vmerge into
24962496
** a PRIMARY KEY that includes the new mhash column. However, we must have
24972497
** the repository database at hand in order to do the migration, so that
24982498
** step is deferred. */
24992499
return 1;
@@ -3716,11 +3716,12 @@
37163716
z = fossil_strdup(zDefault);
37173717
}
37183718
}
37193719
return z;
37203720
}
3721
-char *db_get_mtime(const char *zName, const char *zFormat, const char *zDefault){
3721
+char *db_get_mtime(const char *zName, const char *zFormat,
3722
+ const char *zDefault){
37223723
char *z = 0;
37233724
if( g.repositoryOpen ){
37243725
z = db_text(0, "SELECT mtime FROM config WHERE name=%Q", zName);
37253726
}
37263727
if( z==0 ){
37273728
--- src/db.c
+++ src/db.c
@@ -2489,11 +2489,11 @@
2489 if( db_local_table_exists_but_lacks_column("undo_vfile", "islink") ){
2490 db_multi_exec("ALTER TABLE undo_vfile ADD COLUMN islink BOOL DEFAULT 0");
2491 }
2492 }
2493
2494 /* The design of the check-out database changed on 2019-01-19, adding the mhash
2495 ** column to vfile and vmerge and changing the UNIQUE index on vmerge into
2496 ** a PRIMARY KEY that includes the new mhash column. However, we must have
2497 ** the repository database at hand in order to do the migration, so that
2498 ** step is deferred. */
2499 return 1;
@@ -3716,11 +3716,12 @@
3716 z = fossil_strdup(zDefault);
3717 }
3718 }
3719 return z;
3720 }
3721 char *db_get_mtime(const char *zName, const char *zFormat, const char *zDefault){
 
3722 char *z = 0;
3723 if( g.repositoryOpen ){
3724 z = db_text(0, "SELECT mtime FROM config WHERE name=%Q", zName);
3725 }
3726 if( z==0 ){
3727
--- src/db.c
+++ src/db.c
@@ -2489,11 +2489,11 @@
2489 if( db_local_table_exists_but_lacks_column("undo_vfile", "islink") ){
2490 db_multi_exec("ALTER TABLE undo_vfile ADD COLUMN islink BOOL DEFAULT 0");
2491 }
2492 }
2493
2494 /* The design of the check-out database changed on 2019-01-19 adding the mhash
2495 ** column to vfile and vmerge and changing the UNIQUE index on vmerge into
2496 ** a PRIMARY KEY that includes the new mhash column. However, we must have
2497 ** the repository database at hand in order to do the migration, so that
2498 ** step is deferred. */
2499 return 1;
@@ -3716,11 +3716,12 @@
3716 z = fossil_strdup(zDefault);
3717 }
3718 }
3719 return z;
3720 }
3721 char *db_get_mtime(const char *zName, const char *zFormat,
3722 const char *zDefault){
3723 char *z = 0;
3724 if( g.repositoryOpen ){
3725 z = db_text(0, "SELECT mtime FROM config WHERE name=%Q", zName);
3726 }
3727 if( z==0 ){
3728
+2 -1
--- src/diff.c
+++ src/diff.c
@@ -3493,11 +3493,12 @@
34933493
cnt++;
34943494
}
34953495
34963496
if( p->nVers==0 ){
34973497
if( zRevision ){
3498
- fossil_fatal("file %s does not exist in check-in %s", zFilename, zRevision);
3498
+ fossil_fatal("file %s does not exist in check-in %s",
3499
+ zFilename, zRevision);
34993500
}else{
35003501
fossil_fatal("no history for file: %s", zFilename);
35013502
}
35023503
}
35033504
35043505
--- src/diff.c
+++ src/diff.c
@@ -3493,11 +3493,12 @@
3493 cnt++;
3494 }
3495
3496 if( p->nVers==0 ){
3497 if( zRevision ){
3498 fossil_fatal("file %s does not exist in check-in %s", zFilename, zRevision);
 
3499 }else{
3500 fossil_fatal("no history for file: %s", zFilename);
3501 }
3502 }
3503
3504
--- src/diff.c
+++ src/diff.c
@@ -3493,11 +3493,12 @@
3493 cnt++;
3494 }
3495
3496 if( p->nVers==0 ){
3497 if( zRevision ){
3498 fossil_fatal("file %s does not exist in check-in %s",
3499 zFilename, zRevision);
3500 }else{
3501 fossil_fatal("no history for file: %s", zFilename);
3502 }
3503 }
3504
3505
+2 -2
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -1250,12 +1250,12 @@
12501250
** --brief Show filenames only
12511251
** -b|--browser Show the diff output in a web-browser
12521252
** --by Shorthand for "--browser -y"
12531253
** -ci|--checkin VERSION Show diff of all changes in VERSION
12541254
** --command PROG External diff program. Overrides "diff-command"
1255
-** -c|--context N Show N lines of context around each change, with
1256
-** negative N meaning show all content
1255
+** -c|--context N Show N lines of context around each change,
1256
+** with negative N meaning show all content
12571257
** --dark Use dark mode for the Tcl/Tk-based GUI and HTML
12581258
** --diff-binary BOOL Include binary files with external commands
12591259
** --exec-abs-paths Force absolute path names on external commands
12601260
** --exec-rel-paths Force relative path names on external commands
12611261
** -r|--from VERSION Select VERSION as source for the diff
12621262
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -1250,12 +1250,12 @@
1250 ** --brief Show filenames only
1251 ** -b|--browser Show the diff output in a web-browser
1252 ** --by Shorthand for "--browser -y"
1253 ** -ci|--checkin VERSION Show diff of all changes in VERSION
1254 ** --command PROG External diff program. Overrides "diff-command"
1255 ** -c|--context N Show N lines of context around each change, with
1256 ** negative N meaning show all content
1257 ** --dark Use dark mode for the Tcl/Tk-based GUI and HTML
1258 ** --diff-binary BOOL Include binary files with external commands
1259 ** --exec-abs-paths Force absolute path names on external commands
1260 ** --exec-rel-paths Force relative path names on external commands
1261 ** -r|--from VERSION Select VERSION as source for the diff
1262
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -1250,12 +1250,12 @@
1250 ** --brief Show filenames only
1251 ** -b|--browser Show the diff output in a web-browser
1252 ** --by Shorthand for "--browser -y"
1253 ** -ci|--checkin VERSION Show diff of all changes in VERSION
1254 ** --command PROG External diff program. Overrides "diff-command"
1255 ** -c|--context N Show N lines of context around each change,
1256 ** with negative N meaning show all content
1257 ** --dark Use dark mode for the Tcl/Tk-based GUI and HTML
1258 ** --diff-binary BOOL Include binary files with external commands
1259 ** --exec-abs-paths Force absolute path names on external commands
1260 ** --exec-rel-paths Force relative path names on external commands
1261 ** -r|--from VERSION Select VERSION as source for the diff
1262
+2 -1
--- src/dispatch.c
+++ src/dispatch.c
@@ -897,11 +897,12 @@
897897
if( occHelp[aCommand[i].iHelp] > 1 ){
898898
int j;
899899
int aliases[MX_HELP_DUP], nAliases=0;
900900
for(j=0; j<occHelp[aCommand[i].iHelp]; j++){
901901
if( bktHelp[aCommand[i].iHelp][j] != i ){
902
- if( aCommand[bktHelp[aCommand[i].iHelp][j]].eCmdFlags & CMDFLAG_ALIAS ){
902
+ if( aCommand[bktHelp[aCommand[i].iHelp][j]].eCmdFlags
903
+ & CMDFLAG_ALIAS ){
903904
aliases[nAliases++] = bktHelp[aCommand[i].iHelp][j];
904905
}
905906
}
906907
}
907908
if( nAliases>0 ){
908909
--- src/dispatch.c
+++ src/dispatch.c
@@ -897,11 +897,12 @@
897 if( occHelp[aCommand[i].iHelp] > 1 ){
898 int j;
899 int aliases[MX_HELP_DUP], nAliases=0;
900 for(j=0; j<occHelp[aCommand[i].iHelp]; j++){
901 if( bktHelp[aCommand[i].iHelp][j] != i ){
902 if( aCommand[bktHelp[aCommand[i].iHelp][j]].eCmdFlags & CMDFLAG_ALIAS ){
 
903 aliases[nAliases++] = bktHelp[aCommand[i].iHelp][j];
904 }
905 }
906 }
907 if( nAliases>0 ){
908
--- src/dispatch.c
+++ src/dispatch.c
@@ -897,11 +897,12 @@
897 if( occHelp[aCommand[i].iHelp] > 1 ){
898 int j;
899 int aliases[MX_HELP_DUP], nAliases=0;
900 for(j=0; j<occHelp[aCommand[i].iHelp]; j++){
901 if( bktHelp[aCommand[i].iHelp][j] != i ){
902 if( aCommand[bktHelp[aCommand[i].iHelp][j]].eCmdFlags
903 & CMDFLAG_ALIAS ){
904 aliases[nAliases++] = bktHelp[aCommand[i].iHelp][j];
905 }
906 }
907 }
908 if( nAliases>0 ){
909
+1 -1
--- src/file.c
+++ src/file.c
@@ -2245,11 +2245,11 @@
22452245
** Return non-NULL if zFilename contains pathname elements that
22462246
** are reserved on Windows. The returned string is the disallowed
22472247
** path element.
22482248
*/
22492249
const char *file_is_win_reserved(const char *zPath){
2250
- static const char *const azRes[] = { "CON", "PRN", "AUX", "NUL", "COM", "LPT" };
2250
+ static const char *const azRes[] = { "CON","PRN","AUX","NUL","COM","LPT" };
22512251
static char zReturn[5];
22522252
int i;
22532253
while( zPath[0] ){
22542254
for(i=0; i<count(azRes); i++){
22552255
if( sqlite3_strnicmp(zPath, azRes[i], 3)==0
22562256
--- src/file.c
+++ src/file.c
@@ -2245,11 +2245,11 @@
2245 ** Return non-NULL if zFilename contains pathname elements that
2246 ** are reserved on Windows. The returned string is the disallowed
2247 ** path element.
2248 */
2249 const char *file_is_win_reserved(const char *zPath){
2250 static const char *const azRes[] = { "CON", "PRN", "AUX", "NUL", "COM", "LPT" };
2251 static char zReturn[5];
2252 int i;
2253 while( zPath[0] ){
2254 for(i=0; i<count(azRes); i++){
2255 if( sqlite3_strnicmp(zPath, azRes[i], 3)==0
2256
--- src/file.c
+++ src/file.c
@@ -2245,11 +2245,11 @@
2245 ** Return non-NULL if zFilename contains pathname elements that
2246 ** are reserved on Windows. The returned string is the disallowed
2247 ** path element.
2248 */
2249 const char *file_is_win_reserved(const char *zPath){
2250 static const char *const azRes[] = { "CON","PRN","AUX","NUL","COM","LPT" };
2251 static char zReturn[5];
2252 int i;
2253 while( zPath[0] ){
2254 for(i=0; i<count(azRes); i++){
2255 if( sqlite3_strnicmp(zPath, azRes[i], 3)==0
2256
+1 -1
--- src/fileedit.c
+++ src/fileedit.c
@@ -573,11 +573,11 @@
573573
/* Convert to the requested EOL style. Note that this inherently
574574
** runs a risk of breaking content, e.g. string literals which
575575
** contain embedded newlines. Note that HTML5 specifies that
576576
** form-submitted TEXTAREA content gets normalized to CRLF-style:
577577
**
578
- ** https://html.spec.whatwg.org/multipage/form-elements.html#the-textarea-element
578
+ ** https://html.spec.whatwg.org/#the-textarea-element
579579
*/
580580
const int pseudoBinary = LOOK_LONG | LOOK_NUL;
581581
const int lookFlags = LOOK_CRLF | LOOK_LONE_LF | pseudoBinary;
582582
const int lookNew = looks_like_utf8( &pCI->fileContent, lookFlags );
583583
if(!(pseudoBinary & lookNew)){
584584
--- src/fileedit.c
+++ src/fileedit.c
@@ -573,11 +573,11 @@
573 /* Convert to the requested EOL style. Note that this inherently
574 ** runs a risk of breaking content, e.g. string literals which
575 ** contain embedded newlines. Note that HTML5 specifies that
576 ** form-submitted TEXTAREA content gets normalized to CRLF-style:
577 **
578 ** https://html.spec.whatwg.org/multipage/form-elements.html#the-textarea-element
579 */
580 const int pseudoBinary = LOOK_LONG | LOOK_NUL;
581 const int lookFlags = LOOK_CRLF | LOOK_LONE_LF | pseudoBinary;
582 const int lookNew = looks_like_utf8( &pCI->fileContent, lookFlags );
583 if(!(pseudoBinary & lookNew)){
584
--- src/fileedit.c
+++ src/fileedit.c
@@ -573,11 +573,11 @@
573 /* Convert to the requested EOL style. Note that this inherently
574 ** runs a risk of breaking content, e.g. string literals which
575 ** contain embedded newlines. Note that HTML5 specifies that
576 ** form-submitted TEXTAREA content gets normalized to CRLF-style:
577 **
578 ** https://html.spec.whatwg.org/#the-textarea-element
579 */
580 const int pseudoBinary = LOOK_LONG | LOOK_NUL;
581 const int lookFlags = LOOK_CRLF | LOOK_LONE_LF | pseudoBinary;
582 const int lookNew = looks_like_utf8( &pCI->fileContent, lookFlags );
583 if(!(pseudoBinary & lookNew)){
584
+48 -29
--- src/json.c
+++ src/json.c
@@ -23,12 +23,13 @@
2323
** https://fossil-scm.org/fossil/doc/trunk/www/json-api/index.md
2424
**
2525
** Notes for hackers...
2626
**
2727
** Here's how command/page dispatching works: json_page_top() (in HTTP mode) or
28
-** json_cmd_top() (in CLI mode) catch the "json" path/command. Those functions then
29
-** dispatch to a JSON-mode-specific command/page handler with the type fossil_json_f().
28
+** json_cmd_top() (in CLI mode) catch the "json" path/command. Those functions
29
+** then dispatch to a JSON-mode-specific command/page handler with the type
30
+** fossil_json_f().
3031
** See the API docs for that typedef (below) for the semantics of the callbacks.
3132
**
3233
**
3334
*/
3435
#include "VERSION.h"
@@ -36,11 +37,12 @@
3637
#include "json.h"
3738
#include <assert.h>
3839
#include <time.h>
3940
4041
#if INTERFACE
41
-#include "json_detail.h" /* workaround for apparent enum limitation in makeheaders */
42
+#include "json_detail.h" /* workaround for apparent enum limitation
43
+ in makeheaders */
4244
#endif
4345
4446
const FossilJsonKeys_ FossilJsonKeys = {
4547
"anonymousSeed" /*anonymousSeed*/,
4648
"authToken" /*authToken*/,
@@ -176,11 +178,12 @@
176178
177179
/*
178180
** Convenience wrapper around cson_output() which appends the output
179181
** to pDest. pOpt may be NULL, in which case g.json.outOpt will be used.
180182
*/
181
-int cson_output_Blob( cson_value const * pVal, Blob * pDest, cson_output_opt const * pOpt ){
183
+int cson_output_Blob( cson_value const * pVal, Blob * pDest,
184
+ cson_output_opt const * pOpt ){
182185
return cson_output( pVal, cson_data_dest_Blob,
183186
pDest, pOpt ? pOpt : &g.json.outOpt );
184187
}
185188
186189
/*
@@ -707,11 +710,12 @@
707710
the form: login_cookie_name()=...
708711
709712
Then again, the hardened cookie value helps ensure that
710713
only a proper key/value match is valid.
711714
*/
712
- cgi_replace_parameter( login_cookie_name(), cson_value_get_cstr(g.json.authToken) );
715
+ cgi_replace_parameter( login_cookie_name(),
716
+ cson_value_get_cstr(g.json.authToken) );
713717
}else if( g.isHTTP ){
714718
/* try fossil's conventional cookie. */
715719
/* Reminder: chicken/egg scenario regarding db access in CLI
716720
mode because login_cookie_name() needs the db. CLI
717721
mode does not use any authentication, so we don't need
@@ -904,11 +908,12 @@
904908
memcpy(zPart, head, len);
905909
zPart[len] = 0;
906910
if(doDeHttp){
907911
dehttpize(zPart);
908912
}
909
- if( *zPart ){ /* should only fail if someone manages to url-encoded a NUL byte */
913
+ if( *zPart ){
914
+ /* should only fail if someone manages to url-encoded a NUL byte */
910915
part = cson_value_new_string(zPart, strlen(zPart));
911916
if( 0 != cson_array_append( target, part ) ){
912917
cson_value_free(part);
913918
rc = -rc;
914919
break;
@@ -1086,11 +1091,11 @@
10861091
10871092
/* g.json.reqPayload exists only to simplify some of our access to
10881093
the request payload. We currently only use this in the context of
10891094
Object payloads, not Arrays, strings, etc.
10901095
*/
1091
- g.json.reqPayload.v = cson_object_get( g.json.post.o, FossilJsonKeys.payload );
1096
+ g.json.reqPayload.v = cson_object_get( g.json.post.o,FossilJsonKeys.payload );
10921097
if( g.json.reqPayload.v ){
10931098
g.json.reqPayload.o = cson_value_get_object( g.json.reqPayload.v )
10941099
/* g.json.reqPayload.o may legally be NULL, which means only that
10951100
g.json.reqPayload.v is-not-a Object.
10961101
*/;
@@ -1115,11 +1120,11 @@
11151120
11161121
if(!g.json.jsonp){
11171122
g.json.jsonp = json_find_option_cstr("jsonp",NULL,NULL);
11181123
}
11191124
if(!g.isHTTP){
1120
- g.json.errorDetailParanoia = 0 /*disable error code dumb-down for CLI mode*/;
1125
+ g.json.errorDetailParanoia = 0;/*disable error code dumb-down for CLI mode*/
11211126
}
11221127
11231128
{/* set up JSON output formatting options. */
11241129
int indent = -1;
11251130
indent = json_find_option_int("indent",NULL,"I",-1);
@@ -1166,11 +1171,11 @@
11661171
**
11671172
*/
11681173
char const * json_command_arg(unsigned short ndx){
11691174
cson_array * ar = g.json.cmd.a;
11701175
assert((NULL!=ar) && "Internal error. Was json_bootstrap_late() called?");
1171
- assert((g.argc>1) && "Internal error - we never should have gotten this far.");
1176
+ assert((g.argc>1) &&"Internal error - we never should have gotten this far.");
11721177
if( g.json.cmd.offset < 0 ){
11731178
/* first-time setup. */
11741179
short i = 0;
11751180
#define NEXT cson_string_cstr( \
11761181
cson_value_get_string( \
@@ -1192,11 +1197,12 @@
11921197
#undef NEXT
11931198
if(g.json.cmd.offset < 0){
11941199
return NULL;
11951200
}else{
11961201
ndx = g.json.cmd.offset + ndx;
1197
- return cson_string_cstr(cson_value_get_string(cson_array_get( ar, g.json.cmd.offset + ndx )));
1202
+ return cson_string_cstr(cson_value_get_string(
1203
+ cson_array_get( ar, g.json.cmd.offset + ndx )));
11981204
}
11991205
}
12001206
12011207
/* Returns the C-string form of json_auth_token(), or NULL
12021208
** if json_auth_token() returns NULL.
@@ -1210,11 +1216,12 @@
12101216
** found.
12111217
**
12121218
** head must be a pointer to an array of JsonPageDefs in which the
12131219
** last entry has a NULL name.
12141220
*/
1215
-JsonPageDef const * json_handler_for_name( char const * name, JsonPageDef const * head ){
1221
+JsonPageDef const * json_handler_for_name( char const * name,
1222
+ JsonPageDef const * head ){
12161223
JsonPageDef const * pageDef = head;
12171224
assert( head != NULL );
12181225
if(name && *name) for( ; pageDef->name; ++pageDef ){
12191226
if( 0 == strcmp(name, pageDef->name) ){
12201227
return pageDef;
@@ -1292,14 +1299,16 @@
12921299
if(!g.json.cmd.a){
12931300
return NULL;
12941301
}else{
12951302
cson_value * rc = NULL;
12961303
Blob path = empty_blob;
1297
- unsigned int aLen = g.json.dispatchDepth+1; /*cson_array_length_get(g.json.cmd.a);*/
1304
+ unsigned int aLen = g.json.dispatchDepth+1;
1305
+ /*cson_array_length_get(g.json.cmd.a);*/
12981306
unsigned int i = 1;
12991307
for( ; i < aLen; ++i ){
1300
- char const * part = cson_string_cstr(cson_value_get_string(cson_array_get(g.json.cmd.a, i)));
1308
+ char const * part = cson_string_cstr(cson_value_get_string(
1309
+ cson_array_get(g.json.cmd.a, i)));
13011310
if(!part){
13021311
#if 1
13031312
fossil_warning("Iterating further than expected in %s.",
13041313
__FILE__);
13051314
#endif
@@ -1329,11 +1338,12 @@
13291338
cson_object * o = NULL;
13301339
cson_object * pay = NULL;
13311340
pay = o = cson_new_object();
13321341
13331342
#define INT(OBJ,K) cson_object_set(o, #K, json_new_int(OBJ.K))
1334
-#define CSTR(OBJ,K) cson_object_set(o, #K, OBJ.K ? json_new_string(OBJ.K) : cson_value_null())
1343
+#define CSTR(OBJ,K) cson_object_set(o, #K, OBJ.K ? json_new_string(OBJ.K) \
1344
+ : cson_value_null())
13351345
#define VAL(K,V) cson_object_set(o, #K, (V) ? (V) : cson_value_null())
13361346
VAL(capabilities, json_cap_value());
13371347
INT(g, argc);
13381348
INT(g, isConst);
13391349
CSTR(g, zConfigDbName);
@@ -1813,14 +1823,15 @@
18131823
kRC = cson_new_string("resultCode",10);
18141824
kSymbol = cson_new_string("cSymbol",7);
18151825
kNumber = cson_new_string("number",6);
18161826
kDesc = cson_new_string("description",11);
18171827
#define C(K) obj = cson_new_object(); \
1818
- cson_object_set_s(obj, kRC, json_new_string(json_rc_cstr(FSL_JSON_E_##K)) ); \
1819
- cson_object_set_s(obj, kSymbol, json_new_string("FSL_JSON_E_"#K) ); \
1820
- cson_object_set_s(obj, kNumber, cson_value_new_integer(FSL_JSON_E_##K) ); \
1821
- cson_object_set_s(obj, kDesc, json_new_string(json_err_cstr(FSL_JSON_E_##K))); \
1828
+ cson_object_set_s(obj, kRC,json_new_string(json_rc_cstr(FSL_JSON_E_##K))); \
1829
+ cson_object_set_s(obj, kSymbol, json_new_string("FSL_JSON_E_"#K) ); \
1830
+ cson_object_set_s(obj, kNumber, cson_value_new_integer(FSL_JSON_E_##K) ); \
1831
+ cson_object_set_s(obj, kDesc, \
1832
+ json_new_string(json_err_cstr(FSL_JSON_E_##K))); \
18221833
cson_array_append( list, cson_object_value(obj) ); obj = NULL;
18231834
18241835
C(GENERIC);
18251836
C(INVALID_REQUEST);
18261837
C(UNKNOWN_COMMAND);
@@ -2006,11 +2017,12 @@
20062017
"Requires 'o' permissions.");
20072018
return NULL;
20082019
}
20092020
full = json_find_option_bool("full",NULL,"f",
20102021
json_find_option_bool("verbose",NULL,"v",0));
2011
-#define SETBUF(O,K) cson_object_set(O, K, cson_value_new_string(zBuf, strlen(zBuf)));
2022
+#define SETBUF(O,K) cson_object_set(O, K, \
2023
+ cson_value_new_string(zBuf, strlen(zBuf)));
20122024
20132025
jv = cson_value_new_object();
20142026
jo = cson_value_get_object(jv);
20152027
20162028
zTmp = db_get("project-name",NULL);
@@ -2068,25 +2080,31 @@
20682080
" + 0.99");
20692081
cson_object_set(jo, "ageDays", cson_value_new_integer((cson_int_t)n));
20702082
cson_object_set(jo, "ageYears", cson_value_new_double(n/365.2425));
20712083
sqlite3_snprintf(BufLen, zBuf, db_get("project-code",""));
20722084
SETBUF(jo, "projectCode");
2073
- cson_object_set(jo, "compiler", cson_value_new_string(COMPILER_NAME, strlen(COMPILER_NAME)));
2085
+ cson_object_set(jo, "compiler",
2086
+ cson_value_new_string(COMPILER_NAME, strlen(COMPILER_NAME)));
20742087
20752088
jv2 = cson_value_new_object();
20762089
jo2 = cson_value_get_object(jv2);
20772090
cson_object_set(jo, "sqlite", jv2);
2078
- sqlite3_snprintf(BufLen, zBuf, "%.19s [%.10s] (%s)",
2079
- sqlite3_sourceid(), &sqlite3_sourceid()[20], sqlite3_libversion());
2091
+ sqlite3_snprintf(BufLen, zBuf, "%.19s [%.10s] (%s)", sqlite3_sourceid(),
2092
+ &sqlite3_sourceid()[20], sqlite3_libversion());
20802093
SETBUF(jo2, "version");
2081
- cson_object_set(jo2, "pageCount", cson_value_new_integer((cson_int_t)db_int(0, "PRAGMA repository.page_count")));
2082
- cson_object_set(jo2, "pageSize", cson_value_new_integer((cson_int_t)db_int(0, "PRAGMA repository.page_size")));
2083
- cson_object_set(jo2, "freeList", cson_value_new_integer((cson_int_t)db_int(0, "PRAGMA repository.freelist_count")));
2084
- sqlite3_snprintf(BufLen, zBuf, "%s", db_text(0, "PRAGMA repository.encoding"));
2094
+ cson_object_set(jo2, "pageCount", cson_value_new_integer(
2095
+ (cson_int_t)db_int(0, "PRAGMA repository.page_count")));
2096
+ cson_object_set(jo2, "pageSize", cson_value_new_integer(
2097
+ (cson_int_t)db_int(0, "PRAGMA repository.page_size")));
2098
+ cson_object_set(jo2, "freeList", cson_value_new_integer(
2099
+ (cson_int_t)db_int(0, "PRAGMA repository.freelist_count")));
2100
+ sqlite3_snprintf(BufLen, zBuf, "%s", db_text(0,"PRAGMA repository.encoding"));
20852101
SETBUF(jo2, "encoding");
2086
- sqlite3_snprintf(BufLen, zBuf, "%s", db_text(0, "PRAGMA repository.journal_mode"));
2087
- cson_object_set(jo2, "journalMode", *zBuf ? cson_value_new_string(zBuf, strlen(zBuf)) : cson_value_null());
2102
+ sqlite3_snprintf(BufLen, zBuf, "%s",
2103
+ db_text(0, "PRAGMA repository.journal_mode"));
2104
+ cson_object_set(jo2, "journalMode", *zBuf ?
2105
+ cson_value_new_string(zBuf, strlen(zBuf)) : cson_value_null());
20882106
return jv;
20892107
#undef SETBUF
20902108
}
20912109
20922110
@@ -2237,11 +2255,12 @@
22372255
/*
22382256
** Mapping of names to JSON pages/commands. Each name is a subpath of
22392257
** /json (in CGI mode) or a subcommand of the json command in CLI mode
22402258
*/
22412259
static const JsonPageDef JsonPageDefs[] = {
2242
-/* please keep alphabetically sorted (case-insensitive) for maintenance reasons. */
2260
+/* please keep alphabetically sorted (case-insensitive)
2261
+ for maintenance reasons. */
22432262
{"anonymousPassword", json_page_anon_password, 0},
22442263
{"artifact", json_page_artifact, 0},
22452264
{"branch", json_page_branch,0},
22462265
{"cap", json_page_cap, 0},
22472266
{"config", json_page_config, 0 },
22482267
--- src/json.c
+++ src/json.c
@@ -23,12 +23,13 @@
23 ** https://fossil-scm.org/fossil/doc/trunk/www/json-api/index.md
24 **
25 ** Notes for hackers...
26 **
27 ** Here's how command/page dispatching works: json_page_top() (in HTTP mode) or
28 ** json_cmd_top() (in CLI mode) catch the "json" path/command. Those functions then
29 ** dispatch to a JSON-mode-specific command/page handler with the type fossil_json_f().
 
30 ** See the API docs for that typedef (below) for the semantics of the callbacks.
31 **
32 **
33 */
34 #include "VERSION.h"
@@ -36,11 +37,12 @@
36 #include "json.h"
37 #include <assert.h>
38 #include <time.h>
39
40 #if INTERFACE
41 #include "json_detail.h" /* workaround for apparent enum limitation in makeheaders */
 
42 #endif
43
44 const FossilJsonKeys_ FossilJsonKeys = {
45 "anonymousSeed" /*anonymousSeed*/,
46 "authToken" /*authToken*/,
@@ -176,11 +178,12 @@
176
177 /*
178 ** Convenience wrapper around cson_output() which appends the output
179 ** to pDest. pOpt may be NULL, in which case g.json.outOpt will be used.
180 */
181 int cson_output_Blob( cson_value const * pVal, Blob * pDest, cson_output_opt const * pOpt ){
 
182 return cson_output( pVal, cson_data_dest_Blob,
183 pDest, pOpt ? pOpt : &g.json.outOpt );
184 }
185
186 /*
@@ -707,11 +710,12 @@
707 the form: login_cookie_name()=...
708
709 Then again, the hardened cookie value helps ensure that
710 only a proper key/value match is valid.
711 */
712 cgi_replace_parameter( login_cookie_name(), cson_value_get_cstr(g.json.authToken) );
 
713 }else if( g.isHTTP ){
714 /* try fossil's conventional cookie. */
715 /* Reminder: chicken/egg scenario regarding db access in CLI
716 mode because login_cookie_name() needs the db. CLI
717 mode does not use any authentication, so we don't need
@@ -904,11 +908,12 @@
904 memcpy(zPart, head, len);
905 zPart[len] = 0;
906 if(doDeHttp){
907 dehttpize(zPart);
908 }
909 if( *zPart ){ /* should only fail if someone manages to url-encoded a NUL byte */
 
910 part = cson_value_new_string(zPart, strlen(zPart));
911 if( 0 != cson_array_append( target, part ) ){
912 cson_value_free(part);
913 rc = -rc;
914 break;
@@ -1086,11 +1091,11 @@
1086
1087 /* g.json.reqPayload exists only to simplify some of our access to
1088 the request payload. We currently only use this in the context of
1089 Object payloads, not Arrays, strings, etc.
1090 */
1091 g.json.reqPayload.v = cson_object_get( g.json.post.o, FossilJsonKeys.payload );
1092 if( g.json.reqPayload.v ){
1093 g.json.reqPayload.o = cson_value_get_object( g.json.reqPayload.v )
1094 /* g.json.reqPayload.o may legally be NULL, which means only that
1095 g.json.reqPayload.v is-not-a Object.
1096 */;
@@ -1115,11 +1120,11 @@
1115
1116 if(!g.json.jsonp){
1117 g.json.jsonp = json_find_option_cstr("jsonp",NULL,NULL);
1118 }
1119 if(!g.isHTTP){
1120 g.json.errorDetailParanoia = 0 /*disable error code dumb-down for CLI mode*/;
1121 }
1122
1123 {/* set up JSON output formatting options. */
1124 int indent = -1;
1125 indent = json_find_option_int("indent",NULL,"I",-1);
@@ -1166,11 +1171,11 @@
1166 **
1167 */
1168 char const * json_command_arg(unsigned short ndx){
1169 cson_array * ar = g.json.cmd.a;
1170 assert((NULL!=ar) && "Internal error. Was json_bootstrap_late() called?");
1171 assert((g.argc>1) && "Internal error - we never should have gotten this far.");
1172 if( g.json.cmd.offset < 0 ){
1173 /* first-time setup. */
1174 short i = 0;
1175 #define NEXT cson_string_cstr( \
1176 cson_value_get_string( \
@@ -1192,11 +1197,12 @@
1192 #undef NEXT
1193 if(g.json.cmd.offset < 0){
1194 return NULL;
1195 }else{
1196 ndx = g.json.cmd.offset + ndx;
1197 return cson_string_cstr(cson_value_get_string(cson_array_get( ar, g.json.cmd.offset + ndx )));
 
1198 }
1199 }
1200
1201 /* Returns the C-string form of json_auth_token(), or NULL
1202 ** if json_auth_token() returns NULL.
@@ -1210,11 +1216,12 @@
1210 ** found.
1211 **
1212 ** head must be a pointer to an array of JsonPageDefs in which the
1213 ** last entry has a NULL name.
1214 */
1215 JsonPageDef const * json_handler_for_name( char const * name, JsonPageDef const * head ){
 
1216 JsonPageDef const * pageDef = head;
1217 assert( head != NULL );
1218 if(name && *name) for( ; pageDef->name; ++pageDef ){
1219 if( 0 == strcmp(name, pageDef->name) ){
1220 return pageDef;
@@ -1292,14 +1299,16 @@
1292 if(!g.json.cmd.a){
1293 return NULL;
1294 }else{
1295 cson_value * rc = NULL;
1296 Blob path = empty_blob;
1297 unsigned int aLen = g.json.dispatchDepth+1; /*cson_array_length_get(g.json.cmd.a);*/
 
1298 unsigned int i = 1;
1299 for( ; i < aLen; ++i ){
1300 char const * part = cson_string_cstr(cson_value_get_string(cson_array_get(g.json.cmd.a, i)));
 
1301 if(!part){
1302 #if 1
1303 fossil_warning("Iterating further than expected in %s.",
1304 __FILE__);
1305 #endif
@@ -1329,11 +1338,12 @@
1329 cson_object * o = NULL;
1330 cson_object * pay = NULL;
1331 pay = o = cson_new_object();
1332
1333 #define INT(OBJ,K) cson_object_set(o, #K, json_new_int(OBJ.K))
1334 #define CSTR(OBJ,K) cson_object_set(o, #K, OBJ.K ? json_new_string(OBJ.K) : cson_value_null())
 
1335 #define VAL(K,V) cson_object_set(o, #K, (V) ? (V) : cson_value_null())
1336 VAL(capabilities, json_cap_value());
1337 INT(g, argc);
1338 INT(g, isConst);
1339 CSTR(g, zConfigDbName);
@@ -1813,14 +1823,15 @@
1813 kRC = cson_new_string("resultCode",10);
1814 kSymbol = cson_new_string("cSymbol",7);
1815 kNumber = cson_new_string("number",6);
1816 kDesc = cson_new_string("description",11);
1817 #define C(K) obj = cson_new_object(); \
1818 cson_object_set_s(obj, kRC, json_new_string(json_rc_cstr(FSL_JSON_E_##K)) ); \
1819 cson_object_set_s(obj, kSymbol, json_new_string("FSL_JSON_E_"#K) ); \
1820 cson_object_set_s(obj, kNumber, cson_value_new_integer(FSL_JSON_E_##K) ); \
1821 cson_object_set_s(obj, kDesc, json_new_string(json_err_cstr(FSL_JSON_E_##K))); \
 
1822 cson_array_append( list, cson_object_value(obj) ); obj = NULL;
1823
1824 C(GENERIC);
1825 C(INVALID_REQUEST);
1826 C(UNKNOWN_COMMAND);
@@ -2006,11 +2017,12 @@
2006 "Requires 'o' permissions.");
2007 return NULL;
2008 }
2009 full = json_find_option_bool("full",NULL,"f",
2010 json_find_option_bool("verbose",NULL,"v",0));
2011 #define SETBUF(O,K) cson_object_set(O, K, cson_value_new_string(zBuf, strlen(zBuf)));
 
2012
2013 jv = cson_value_new_object();
2014 jo = cson_value_get_object(jv);
2015
2016 zTmp = db_get("project-name",NULL);
@@ -2068,25 +2080,31 @@
2068 " + 0.99");
2069 cson_object_set(jo, "ageDays", cson_value_new_integer((cson_int_t)n));
2070 cson_object_set(jo, "ageYears", cson_value_new_double(n/365.2425));
2071 sqlite3_snprintf(BufLen, zBuf, db_get("project-code",""));
2072 SETBUF(jo, "projectCode");
2073 cson_object_set(jo, "compiler", cson_value_new_string(COMPILER_NAME, strlen(COMPILER_NAME)));
 
2074
2075 jv2 = cson_value_new_object();
2076 jo2 = cson_value_get_object(jv2);
2077 cson_object_set(jo, "sqlite", jv2);
2078 sqlite3_snprintf(BufLen, zBuf, "%.19s [%.10s] (%s)",
2079 sqlite3_sourceid(), &sqlite3_sourceid()[20], sqlite3_libversion());
2080 SETBUF(jo2, "version");
2081 cson_object_set(jo2, "pageCount", cson_value_new_integer((cson_int_t)db_int(0, "PRAGMA repository.page_count")));
2082 cson_object_set(jo2, "pageSize", cson_value_new_integer((cson_int_t)db_int(0, "PRAGMA repository.page_size")));
2083 cson_object_set(jo2, "freeList", cson_value_new_integer((cson_int_t)db_int(0, "PRAGMA repository.freelist_count")));
2084 sqlite3_snprintf(BufLen, zBuf, "%s", db_text(0, "PRAGMA repository.encoding"));
 
 
 
2085 SETBUF(jo2, "encoding");
2086 sqlite3_snprintf(BufLen, zBuf, "%s", db_text(0, "PRAGMA repository.journal_mode"));
2087 cson_object_set(jo2, "journalMode", *zBuf ? cson_value_new_string(zBuf, strlen(zBuf)) : cson_value_null());
 
 
2088 return jv;
2089 #undef SETBUF
2090 }
2091
2092
@@ -2237,11 +2255,12 @@
2237 /*
2238 ** Mapping of names to JSON pages/commands. Each name is a subpath of
2239 ** /json (in CGI mode) or a subcommand of the json command in CLI mode
2240 */
2241 static const JsonPageDef JsonPageDefs[] = {
2242 /* please keep alphabetically sorted (case-insensitive) for maintenance reasons. */
 
2243 {"anonymousPassword", json_page_anon_password, 0},
2244 {"artifact", json_page_artifact, 0},
2245 {"branch", json_page_branch,0},
2246 {"cap", json_page_cap, 0},
2247 {"config", json_page_config, 0 },
2248
--- src/json.c
+++ src/json.c
@@ -23,12 +23,13 @@
23 ** https://fossil-scm.org/fossil/doc/trunk/www/json-api/index.md
24 **
25 ** Notes for hackers...
26 **
27 ** Here's how command/page dispatching works: json_page_top() (in HTTP mode) or
28 ** json_cmd_top() (in CLI mode) catch the "json" path/command. Those functions
29 ** then dispatch to a JSON-mode-specific command/page handler with the type
30 ** fossil_json_f().
31 ** See the API docs for that typedef (below) for the semantics of the callbacks.
32 **
33 **
34 */
35 #include "VERSION.h"
@@ -36,11 +37,12 @@
37 #include "json.h"
38 #include <assert.h>
39 #include <time.h>
40
41 #if INTERFACE
42 #include "json_detail.h" /* workaround for apparent enum limitation
43 in makeheaders */
44 #endif
45
46 const FossilJsonKeys_ FossilJsonKeys = {
47 "anonymousSeed" /*anonymousSeed*/,
48 "authToken" /*authToken*/,
@@ -176,11 +178,12 @@
178
179 /*
180 ** Convenience wrapper around cson_output() which appends the output
181 ** to pDest. pOpt may be NULL, in which case g.json.outOpt will be used.
182 */
183 int cson_output_Blob( cson_value const * pVal, Blob * pDest,
184 cson_output_opt const * pOpt ){
185 return cson_output( pVal, cson_data_dest_Blob,
186 pDest, pOpt ? pOpt : &g.json.outOpt );
187 }
188
189 /*
@@ -707,11 +710,12 @@
710 the form: login_cookie_name()=...
711
712 Then again, the hardened cookie value helps ensure that
713 only a proper key/value match is valid.
714 */
715 cgi_replace_parameter( login_cookie_name(),
716 cson_value_get_cstr(g.json.authToken) );
717 }else if( g.isHTTP ){
718 /* try fossil's conventional cookie. */
719 /* Reminder: chicken/egg scenario regarding db access in CLI
720 mode because login_cookie_name() needs the db. CLI
721 mode does not use any authentication, so we don't need
@@ -904,11 +908,12 @@
908 memcpy(zPart, head, len);
909 zPart[len] = 0;
910 if(doDeHttp){
911 dehttpize(zPart);
912 }
913 if( *zPart ){
914 /* should only fail if someone manages to url-encoded a NUL byte */
915 part = cson_value_new_string(zPart, strlen(zPart));
916 if( 0 != cson_array_append( target, part ) ){
917 cson_value_free(part);
918 rc = -rc;
919 break;
@@ -1086,11 +1091,11 @@
1091
1092 /* g.json.reqPayload exists only to simplify some of our access to
1093 the request payload. We currently only use this in the context of
1094 Object payloads, not Arrays, strings, etc.
1095 */
1096 g.json.reqPayload.v = cson_object_get( g.json.post.o,FossilJsonKeys.payload );
1097 if( g.json.reqPayload.v ){
1098 g.json.reqPayload.o = cson_value_get_object( g.json.reqPayload.v )
1099 /* g.json.reqPayload.o may legally be NULL, which means only that
1100 g.json.reqPayload.v is-not-a Object.
1101 */;
@@ -1115,11 +1120,11 @@
1120
1121 if(!g.json.jsonp){
1122 g.json.jsonp = json_find_option_cstr("jsonp",NULL,NULL);
1123 }
1124 if(!g.isHTTP){
1125 g.json.errorDetailParanoia = 0;/*disable error code dumb-down for CLI mode*/
1126 }
1127
1128 {/* set up JSON output formatting options. */
1129 int indent = -1;
1130 indent = json_find_option_int("indent",NULL,"I",-1);
@@ -1166,11 +1171,11 @@
1171 **
1172 */
1173 char const * json_command_arg(unsigned short ndx){
1174 cson_array * ar = g.json.cmd.a;
1175 assert((NULL!=ar) && "Internal error. Was json_bootstrap_late() called?");
1176 assert((g.argc>1) &&"Internal error - we never should have gotten this far.");
1177 if( g.json.cmd.offset < 0 ){
1178 /* first-time setup. */
1179 short i = 0;
1180 #define NEXT cson_string_cstr( \
1181 cson_value_get_string( \
@@ -1192,11 +1197,12 @@
1197 #undef NEXT
1198 if(g.json.cmd.offset < 0){
1199 return NULL;
1200 }else{
1201 ndx = g.json.cmd.offset + ndx;
1202 return cson_string_cstr(cson_value_get_string(
1203 cson_array_get( ar, g.json.cmd.offset + ndx )));
1204 }
1205 }
1206
1207 /* Returns the C-string form of json_auth_token(), or NULL
1208 ** if json_auth_token() returns NULL.
@@ -1210,11 +1216,12 @@
1216 ** found.
1217 **
1218 ** head must be a pointer to an array of JsonPageDefs in which the
1219 ** last entry has a NULL name.
1220 */
1221 JsonPageDef const * json_handler_for_name( char const * name,
1222 JsonPageDef const * head ){
1223 JsonPageDef const * pageDef = head;
1224 assert( head != NULL );
1225 if(name && *name) for( ; pageDef->name; ++pageDef ){
1226 if( 0 == strcmp(name, pageDef->name) ){
1227 return pageDef;
@@ -1292,14 +1299,16 @@
1299 if(!g.json.cmd.a){
1300 return NULL;
1301 }else{
1302 cson_value * rc = NULL;
1303 Blob path = empty_blob;
1304 unsigned int aLen = g.json.dispatchDepth+1;
1305 /*cson_array_length_get(g.json.cmd.a);*/
1306 unsigned int i = 1;
1307 for( ; i < aLen; ++i ){
1308 char const * part = cson_string_cstr(cson_value_get_string(
1309 cson_array_get(g.json.cmd.a, i)));
1310 if(!part){
1311 #if 1
1312 fossil_warning("Iterating further than expected in %s.",
1313 __FILE__);
1314 #endif
@@ -1329,11 +1338,12 @@
1338 cson_object * o = NULL;
1339 cson_object * pay = NULL;
1340 pay = o = cson_new_object();
1341
1342 #define INT(OBJ,K) cson_object_set(o, #K, json_new_int(OBJ.K))
1343 #define CSTR(OBJ,K) cson_object_set(o, #K, OBJ.K ? json_new_string(OBJ.K) \
1344 : cson_value_null())
1345 #define VAL(K,V) cson_object_set(o, #K, (V) ? (V) : cson_value_null())
1346 VAL(capabilities, json_cap_value());
1347 INT(g, argc);
1348 INT(g, isConst);
1349 CSTR(g, zConfigDbName);
@@ -1813,14 +1823,15 @@
1823 kRC = cson_new_string("resultCode",10);
1824 kSymbol = cson_new_string("cSymbol",7);
1825 kNumber = cson_new_string("number",6);
1826 kDesc = cson_new_string("description",11);
1827 #define C(K) obj = cson_new_object(); \
1828 cson_object_set_s(obj, kRC,json_new_string(json_rc_cstr(FSL_JSON_E_##K))); \
1829 cson_object_set_s(obj, kSymbol, json_new_string("FSL_JSON_E_"#K) ); \
1830 cson_object_set_s(obj, kNumber, cson_value_new_integer(FSL_JSON_E_##K) ); \
1831 cson_object_set_s(obj, kDesc, \
1832 json_new_string(json_err_cstr(FSL_JSON_E_##K))); \
1833 cson_array_append( list, cson_object_value(obj) ); obj = NULL;
1834
1835 C(GENERIC);
1836 C(INVALID_REQUEST);
1837 C(UNKNOWN_COMMAND);
@@ -2006,11 +2017,12 @@
2017 "Requires 'o' permissions.");
2018 return NULL;
2019 }
2020 full = json_find_option_bool("full",NULL,"f",
2021 json_find_option_bool("verbose",NULL,"v",0));
2022 #define SETBUF(O,K) cson_object_set(O, K, \
2023 cson_value_new_string(zBuf, strlen(zBuf)));
2024
2025 jv = cson_value_new_object();
2026 jo = cson_value_get_object(jv);
2027
2028 zTmp = db_get("project-name",NULL);
@@ -2068,25 +2080,31 @@
2080 " + 0.99");
2081 cson_object_set(jo, "ageDays", cson_value_new_integer((cson_int_t)n));
2082 cson_object_set(jo, "ageYears", cson_value_new_double(n/365.2425));
2083 sqlite3_snprintf(BufLen, zBuf, db_get("project-code",""));
2084 SETBUF(jo, "projectCode");
2085 cson_object_set(jo, "compiler",
2086 cson_value_new_string(COMPILER_NAME, strlen(COMPILER_NAME)));
2087
2088 jv2 = cson_value_new_object();
2089 jo2 = cson_value_get_object(jv2);
2090 cson_object_set(jo, "sqlite", jv2);
2091 sqlite3_snprintf(BufLen, zBuf, "%.19s [%.10s] (%s)", sqlite3_sourceid(),
2092 &sqlite3_sourceid()[20], sqlite3_libversion());
2093 SETBUF(jo2, "version");
2094 cson_object_set(jo2, "pageCount", cson_value_new_integer(
2095 (cson_int_t)db_int(0, "PRAGMA repository.page_count")));
2096 cson_object_set(jo2, "pageSize", cson_value_new_integer(
2097 (cson_int_t)db_int(0, "PRAGMA repository.page_size")));
2098 cson_object_set(jo2, "freeList", cson_value_new_integer(
2099 (cson_int_t)db_int(0, "PRAGMA repository.freelist_count")));
2100 sqlite3_snprintf(BufLen, zBuf, "%s", db_text(0,"PRAGMA repository.encoding"));
2101 SETBUF(jo2, "encoding");
2102 sqlite3_snprintf(BufLen, zBuf, "%s",
2103 db_text(0, "PRAGMA repository.journal_mode"));
2104 cson_object_set(jo2, "journalMode", *zBuf ?
2105 cson_value_new_string(zBuf, strlen(zBuf)) : cson_value_null());
2106 return jv;
2107 #undef SETBUF
2108 }
2109
2110
@@ -2237,11 +2255,12 @@
2255 /*
2256 ** Mapping of names to JSON pages/commands. Each name is a subpath of
2257 ** /json (in CGI mode) or a subcommand of the json command in CLI mode
2258 */
2259 static const JsonPageDef JsonPageDefs[] = {
2260 /* please keep alphabetically sorted (case-insensitive)
2261 for maintenance reasons. */
2262 {"anonymousPassword", json_page_anon_password, 0},
2263 {"artifact", json_page_artifact, 0},
2264 {"branch", json_page_branch,0},
2265 {"cap", json_page_cap, 0},
2266 {"config", json_page_config, 0 },
2267
--- src/json_artifact.c
+++ src/json_artifact.c
@@ -211,11 +211,12 @@
211211
/*
212212
** Sub-impl of /json/artifact for check-ins.
213213
*/
214214
static cson_value * json_artifact_ci( cson_object * zParent, int rid ){
215215
if(!g.perm.Read){
216
- json_set_err( FSL_JSON_E_DENIED, "Viewing check-ins requires 'o' privileges." );
216
+ json_set_err( FSL_JSON_E_DENIED,
217
+ "Viewing check-ins requires 'o' privileges." );
217218
return NULL;
218219
}else{
219220
cson_value * artV = json_artifact_for_ci(rid, 1);
220221
cson_object * art = cson_value_get_object(artV);
221222
if(art){
@@ -250,16 +251,17 @@
250251
*/
251252
static int json_artifact_get_content_format_flag(void){
252253
enum { MagicValue = -9 };
253254
int contentFormat = json_wiki_get_content_format_flag(MagicValue);
254255
if(MagicValue == contentFormat){
255
- contentFormat = json_find_option_bool("includeContent","content","c",0) /* deprecated */ ? -1 : 0;
256
+ contentFormat = json_find_option_bool("includeContent",
257
+ "content","c",0) /* deprecated */ ? -1 : 0;
256258
}
257259
return contentFormat;
258260
}
259261
260
-extern int json_wiki_get_content_format_flag( int defaultValue ) /* json_wiki.c */;
262
+extern int json_wiki_get_content_format_flag(int defaultValue) /* json_wiki.c*/;
261263
262264
cson_value * json_artifact_wiki(cson_object * zParent, int rid){
263265
if( ! g.perm.RdWiki ){
264266
json_set_err(FSL_JSON_E_DENIED,
265267
"Requires 'j' privileges.");
@@ -380,18 +382,19 @@
380382
e.g. "modified", "new", "deleted".
381383
*/
382384
checkin_arr = cson_new_array();
383385
cson_object_set(pay, "checkins", cson_array_value(checkin_arr));
384386
while( (SQLITE_ROW==db_step(&q) ) ){
385
- cson_object * row = cson_value_get_object(cson_sqlite3_row_to_object(q.pStmt));
387
+ cson_object * row = cson_value_get_object(
388
+ cson_sqlite3_row_to_object(q.pStmt));
386389
/* FIXME: move this isNew/isDel stuff into an SQL CASE statement. */
387390
char const isNew = cson_value_get_bool(cson_object_get(row,"isNew"));
388391
char const isDel = cson_value_get_bool(cson_object_get(row,"isDel"));
389392
cson_object_set(row, "isNew", NULL);
390393
cson_object_set(row, "isDel", NULL);
391
- cson_object_set(row, "state",
392
- json_new_string(json_artifact_status_to_string(isNew, isDel)));
394
+ cson_object_set(row, "state", json_new_string(
395
+ json_artifact_status_to_string(isNew, isDel)));
393396
cson_array_append( checkin_arr, cson_object_value(row) );
394397
}
395398
db_finalize(&q);
396399
return cson_object_value(pay);
397400
}
398401
--- src/json_artifact.c
+++ src/json_artifact.c
@@ -211,11 +211,12 @@
211 /*
212 ** Sub-impl of /json/artifact for check-ins.
213 */
214 static cson_value * json_artifact_ci( cson_object * zParent, int rid ){
215 if(!g.perm.Read){
216 json_set_err( FSL_JSON_E_DENIED, "Viewing check-ins requires 'o' privileges." );
 
217 return NULL;
218 }else{
219 cson_value * artV = json_artifact_for_ci(rid, 1);
220 cson_object * art = cson_value_get_object(artV);
221 if(art){
@@ -250,16 +251,17 @@
250 */
251 static int json_artifact_get_content_format_flag(void){
252 enum { MagicValue = -9 };
253 int contentFormat = json_wiki_get_content_format_flag(MagicValue);
254 if(MagicValue == contentFormat){
255 contentFormat = json_find_option_bool("includeContent","content","c",0) /* deprecated */ ? -1 : 0;
 
256 }
257 return contentFormat;
258 }
259
260 extern int json_wiki_get_content_format_flag( int defaultValue ) /* json_wiki.c */;
261
262 cson_value * json_artifact_wiki(cson_object * zParent, int rid){
263 if( ! g.perm.RdWiki ){
264 json_set_err(FSL_JSON_E_DENIED,
265 "Requires 'j' privileges.");
@@ -380,18 +382,19 @@
380 e.g. "modified", "new", "deleted".
381 */
382 checkin_arr = cson_new_array();
383 cson_object_set(pay, "checkins", cson_array_value(checkin_arr));
384 while( (SQLITE_ROW==db_step(&q) ) ){
385 cson_object * row = cson_value_get_object(cson_sqlite3_row_to_object(q.pStmt));
 
386 /* FIXME: move this isNew/isDel stuff into an SQL CASE statement. */
387 char const isNew = cson_value_get_bool(cson_object_get(row,"isNew"));
388 char const isDel = cson_value_get_bool(cson_object_get(row,"isDel"));
389 cson_object_set(row, "isNew", NULL);
390 cson_object_set(row, "isDel", NULL);
391 cson_object_set(row, "state",
392 json_new_string(json_artifact_status_to_string(isNew, isDel)));
393 cson_array_append( checkin_arr, cson_object_value(row) );
394 }
395 db_finalize(&q);
396 return cson_object_value(pay);
397 }
398
--- src/json_artifact.c
+++ src/json_artifact.c
@@ -211,11 +211,12 @@
211 /*
212 ** Sub-impl of /json/artifact for check-ins.
213 */
214 static cson_value * json_artifact_ci( cson_object * zParent, int rid ){
215 if(!g.perm.Read){
216 json_set_err( FSL_JSON_E_DENIED,
217 "Viewing check-ins requires 'o' privileges." );
218 return NULL;
219 }else{
220 cson_value * artV = json_artifact_for_ci(rid, 1);
221 cson_object * art = cson_value_get_object(artV);
222 if(art){
@@ -250,16 +251,17 @@
251 */
252 static int json_artifact_get_content_format_flag(void){
253 enum { MagicValue = -9 };
254 int contentFormat = json_wiki_get_content_format_flag(MagicValue);
255 if(MagicValue == contentFormat){
256 contentFormat = json_find_option_bool("includeContent",
257 "content","c",0) /* deprecated */ ? -1 : 0;
258 }
259 return contentFormat;
260 }
261
262 extern int json_wiki_get_content_format_flag(int defaultValue) /* json_wiki.c*/;
263
264 cson_value * json_artifact_wiki(cson_object * zParent, int rid){
265 if( ! g.perm.RdWiki ){
266 json_set_err(FSL_JSON_E_DENIED,
267 "Requires 'j' privileges.");
@@ -380,18 +382,19 @@
382 e.g. "modified", "new", "deleted".
383 */
384 checkin_arr = cson_new_array();
385 cson_object_set(pay, "checkins", cson_array_value(checkin_arr));
386 while( (SQLITE_ROW==db_step(&q) ) ){
387 cson_object * row = cson_value_get_object(
388 cson_sqlite3_row_to_object(q.pStmt));
389 /* FIXME: move this isNew/isDel stuff into an SQL CASE statement. */
390 char const isNew = cson_value_get_bool(cson_object_get(row,"isNew"));
391 char const isDel = cson_value_get_bool(cson_object_get(row,"isDel"));
392 cson_object_set(row, "isNew", NULL);
393 cson_object_set(row, "isDel", NULL);
394 cson_object_set(row, "state", json_new_string(
395 json_artifact_status_to_string(isNew, isDel)));
396 cson_array_append( checkin_arr, cson_object_value(row) );
397 }
398 db_finalize(&q);
399 return cson_object_value(pay);
400 }
401
--- src/json_branch.c
+++ src/json_branch.c
@@ -335,11 +335,12 @@
335335
if(!opt.zName){
336336
opt.zName = json_command_arg(g.json.dispatchDepth+1);
337337
}
338338
339339
if(!opt.zName){
340
- json_set_err(FSL_JSON_E_MISSING_ARGS, "'name' parameter was not specified." );
340
+ json_set_err(FSL_JSON_E_MISSING_ARGS,
341
+ "'name' parameter was not specified." );
341342
return NULL;
342343
}
343344
344345
opt.zColor = json_find_option_cstr("bgColor","bgcolor",NULL);
345346
opt.zBasis = json_find_option_cstr("basis",NULL,NULL);
346347
--- src/json_branch.c
+++ src/json_branch.c
@@ -335,11 +335,12 @@
335 if(!opt.zName){
336 opt.zName = json_command_arg(g.json.dispatchDepth+1);
337 }
338
339 if(!opt.zName){
340 json_set_err(FSL_JSON_E_MISSING_ARGS, "'name' parameter was not specified." );
 
341 return NULL;
342 }
343
344 opt.zColor = json_find_option_cstr("bgColor","bgcolor",NULL);
345 opt.zBasis = json_find_option_cstr("basis",NULL,NULL);
346
--- src/json_branch.c
+++ src/json_branch.c
@@ -335,11 +335,12 @@
335 if(!opt.zName){
336 opt.zName = json_command_arg(g.json.dispatchDepth+1);
337 }
338
339 if(!opt.zName){
340 json_set_err(FSL_JSON_E_MISSING_ARGS,
341 "'name' parameter was not specified." );
342 return NULL;
343 }
344
345 opt.zColor = json_find_option_cstr("bgColor","bgcolor",NULL);
346 opt.zBasis = json_find_option_cstr("basis",NULL,NULL);
347
--- src/json_config.c
+++ src/json_config.c
@@ -257,11 +257,11 @@
257257
const Setting *pSet = &aSetting[i];
258258
cson_object * jSet;
259259
cson_value * pVal = 0, * pSrc = 0;
260260
jSet = cson_new_object();
261261
cson_object_set(pay, pSet->name, cson_object_value(jSet));
262
- cson_object_set(jSet, "versionable", cson_value_new_bool(pSet->versionable));
262
+ cson_object_set(jSet, "versionable",cson_value_new_bool(pSet->versionable));
263263
cson_object_set(jSet, "sensitive", cson_value_new_bool(pSet->sensitive));
264264
cson_object_set(jSet, "defaultValue", (pSet->def && pSet->def[0])
265265
? json_new_string(pSet->def)
266266
: cson_value_null());
267267
if( 0==pSet->sensitive || 0!=g.perm.Setup ){
@@ -292,11 +292,11 @@
292292
blob_appendf(&versionedPathname, "%s.fossil-settings/%s",
293293
g.zLocalRoot, pSet->name);
294294
if( file_size(blob_str(&versionedPathname), ExtFILE)>=0 ){
295295
Blob content;
296296
blob_zero(&content);
297
- blob_read_from_file(&content, blob_str(&versionedPathname), ExtFILE);
297
+ blob_read_from_file(&content, blob_str(&versionedPathname),ExtFILE);
298298
pSrc = json_new_string("versioned");
299299
pVal = json_new_string(blob_str(&content));
300300
blob_reset(&content);
301301
}
302302
blob_reset(&versionedPathname);
303303
--- src/json_config.c
+++ src/json_config.c
@@ -257,11 +257,11 @@
257 const Setting *pSet = &aSetting[i];
258 cson_object * jSet;
259 cson_value * pVal = 0, * pSrc = 0;
260 jSet = cson_new_object();
261 cson_object_set(pay, pSet->name, cson_object_value(jSet));
262 cson_object_set(jSet, "versionable", cson_value_new_bool(pSet->versionable));
263 cson_object_set(jSet, "sensitive", cson_value_new_bool(pSet->sensitive));
264 cson_object_set(jSet, "defaultValue", (pSet->def && pSet->def[0])
265 ? json_new_string(pSet->def)
266 : cson_value_null());
267 if( 0==pSet->sensitive || 0!=g.perm.Setup ){
@@ -292,11 +292,11 @@
292 blob_appendf(&versionedPathname, "%s.fossil-settings/%s",
293 g.zLocalRoot, pSet->name);
294 if( file_size(blob_str(&versionedPathname), ExtFILE)>=0 ){
295 Blob content;
296 blob_zero(&content);
297 blob_read_from_file(&content, blob_str(&versionedPathname), ExtFILE);
298 pSrc = json_new_string("versioned");
299 pVal = json_new_string(blob_str(&content));
300 blob_reset(&content);
301 }
302 blob_reset(&versionedPathname);
303
--- src/json_config.c
+++ src/json_config.c
@@ -257,11 +257,11 @@
257 const Setting *pSet = &aSetting[i];
258 cson_object * jSet;
259 cson_value * pVal = 0, * pSrc = 0;
260 jSet = cson_new_object();
261 cson_object_set(pay, pSet->name, cson_object_value(jSet));
262 cson_object_set(jSet, "versionable",cson_value_new_bool(pSet->versionable));
263 cson_object_set(jSet, "sensitive", cson_value_new_bool(pSet->sensitive));
264 cson_object_set(jSet, "defaultValue", (pSet->def && pSet->def[0])
265 ? json_new_string(pSet->def)
266 : cson_value_null());
267 if( 0==pSet->sensitive || 0!=g.perm.Setup ){
@@ -292,11 +292,11 @@
292 blob_appendf(&versionedPathname, "%s.fossil-settings/%s",
293 g.zLocalRoot, pSet->name);
294 if( file_size(blob_str(&versionedPathname), ExtFILE)>=0 ){
295 Blob content;
296 blob_zero(&content);
297 blob_read_from_file(&content, blob_str(&versionedPathname),ExtFILE);
298 pSrc = json_new_string("versioned");
299 pVal = json_new_string(blob_str(&content));
300 blob_reset(&content);
301 }
302 blob_reset(&versionedPathname);
303
+15 -10
--- src/json_finfo.c
+++ src/json_finfo.c
@@ -41,14 +41,15 @@
4141
signed char sort = -1;
4242
if(!g.perm.Read){
4343
json_set_err(FSL_JSON_E_DENIED,"Requires 'o' privileges.");
4444
return NULL;
4545
}
46
- json_warn( FSL_JSON_W_UNKNOWN, "Achtung: the output of the finfo command is up for change.");
46
+ json_warn( FSL_JSON_W_UNKNOWN,
47
+ "Achtung: the output of the finfo command is up for change.");
4748
48
- /* For the "name" argument we have to jump through some hoops to make sure that we don't
49
- get the fossil-internally-assigned "name" option.
49
+ /* For the "name" argument we have to jump through some hoops to make sure
50
+ that we don't get the fossil-internally-assigned "name" option.
5051
*/
5152
zFilename = json_find_option_cstr2("name",NULL,NULL, g.json.dispatchDepth+1);
5253
if(!zFilename || !*zFilename){
5354
json_set_err(FSL_JSON_E_MISSING_ARGS, "Missing 'name' parameter.");
5455
return NULL;
@@ -65,11 +66,11 @@
6566
zCheckin = json_find_option_cstr("checkin",NULL,"ci");
6667
6768
blob_append_sql(&sql,
6869
/*0*/ "SELECT b.uuid,"
6970
/*1*/ " ci.uuid,"
70
-/*2*/ " (SELECT uuid FROM blob WHERE rid=mlink.fid)," /* Current file uuid */
71
+/*2*/ " (SELECT uuid FROM blob WHERE rid=mlink.fid),"/* Current file uuid */
7172
/*3*/ " cast(strftime('%%s',event.mtime) AS INTEGER),"
7273
/*4*/ " coalesce(event.euser, event.user),"
7374
/*5*/ " coalesce(event.ecomment, event.comment),"
7475
/*6*/ " (SELECT uuid FROM blob WHERE rid=mlink.pid)," /* Parent file uuid */
7576
/*7*/ " event.bgcolor,"
@@ -88,11 +89,12 @@
8889
if( zCheckin && *zCheckin ){
8990
char * zU = NULL;
9091
int rc = name_to_uuid2( zCheckin, "ci", &zU );
9192
/*printf("zCheckin=[%s], zU=[%s]", zCheckin, zU);*/
9293
if(rc<=0){
93
- json_set_err((rc<0) ? FSL_JSON_E_AMBIGUOUS_UUID : FSL_JSON_E_RESOURCE_NOT_FOUND,
94
+ json_set_err((rc<0) ? FSL_JSON_E_AMBIGUOUS_UUID :
95
+ FSL_JSON_E_RESOURCE_NOT_FOUND,
9496
"Check-in hash %s.", (rc<0) ? "is ambiguous" : "not found");
9597
blob_reset(&sql);
9698
return NULL;
9799
}
98100
blob_append_sql(&sql, " AND ci.uuid='%q'", zU);
@@ -104,11 +106,12 @@
104106
}else if( zBefore && *zBefore ){
105107
blob_append_sql(&sql, " AND event.mtime<=julianday('%q')", zBefore);
106108
}
107109
}
108110
109
- blob_append_sql(&sql," ORDER BY event.mtime %s /*sort*/", (sort>0?"ASC":"DESC"));
111
+ blob_append_sql(&sql," ORDER BY event.mtime %s /*sort*/",
112
+ (sort>0 ? "ASC" : "DESC"));
110113
/*printf("SQL=\n%s\n",blob_str(&sql));*/
111114
db_prepare(&q, "%s", blob_sql_text(&sql));
112115
blob_reset(&sql);
113116
114117
pay = cson_new_object();
@@ -123,18 +126,20 @@
123126
int const isNew = db_column_int(&q,9);
124127
int const isDel = db_column_int(&q,10);
125128
cson_array_append( checkins, cson_object_value(row) );
126129
cson_object_set(row, "checkin", json_new_string( db_column_text(&q,1) ));
127130
cson_object_set(row, "uuid", json_new_string( db_column_text(&q,2) ));
128
- /*cson_object_set(row, "parentArtifact", json_new_string( db_column_text(&q,6) ));*/
131
+ /*cson_object_set(row, "parentArtifact",
132
+ json_new_string( db_column_text(&q,6) ));*/
129133
cson_object_set(row, "timestamp", json_new_int( db_column_int64(&q,3) ));
130134
cson_object_set(row, "user", json_new_string( db_column_text(&q,4) ));
131135
cson_object_set(row, "comment", json_new_string( db_column_text(&q,5) ));
132
- /*cson_object_set(row, "bgColor", json_new_string( db_column_text(&q,7) ));*/
136
+ /*cson_object_set(row, "bgColor",
137
+ json_new_string( db_column_text(&q,7) ));*/
133138
cson_object_set(row, "size", json_new_int( db_column_int64(&q,8) ));
134
- cson_object_set(row, "state",
135
- json_new_string(json_artifact_status_to_string(isNew,isDel)));
139
+ cson_object_set(row, "state", json_new_string(
140
+ json_artifact_status_to_string(isNew, isDel)));
136141
if( (0 < limit) && (++currentRow >= limit) ){
137142
break;
138143
}
139144
}
140145
db_finalize(&q);
141146
--- src/json_finfo.c
+++ src/json_finfo.c
@@ -41,14 +41,15 @@
41 signed char sort = -1;
42 if(!g.perm.Read){
43 json_set_err(FSL_JSON_E_DENIED,"Requires 'o' privileges.");
44 return NULL;
45 }
46 json_warn( FSL_JSON_W_UNKNOWN, "Achtung: the output of the finfo command is up for change.");
 
47
48 /* For the "name" argument we have to jump through some hoops to make sure that we don't
49 get the fossil-internally-assigned "name" option.
50 */
51 zFilename = json_find_option_cstr2("name",NULL,NULL, g.json.dispatchDepth+1);
52 if(!zFilename || !*zFilename){
53 json_set_err(FSL_JSON_E_MISSING_ARGS, "Missing 'name' parameter.");
54 return NULL;
@@ -65,11 +66,11 @@
65 zCheckin = json_find_option_cstr("checkin",NULL,"ci");
66
67 blob_append_sql(&sql,
68 /*0*/ "SELECT b.uuid,"
69 /*1*/ " ci.uuid,"
70 /*2*/ " (SELECT uuid FROM blob WHERE rid=mlink.fid)," /* Current file uuid */
71 /*3*/ " cast(strftime('%%s',event.mtime) AS INTEGER),"
72 /*4*/ " coalesce(event.euser, event.user),"
73 /*5*/ " coalesce(event.ecomment, event.comment),"
74 /*6*/ " (SELECT uuid FROM blob WHERE rid=mlink.pid)," /* Parent file uuid */
75 /*7*/ " event.bgcolor,"
@@ -88,11 +89,12 @@
88 if( zCheckin && *zCheckin ){
89 char * zU = NULL;
90 int rc = name_to_uuid2( zCheckin, "ci", &zU );
91 /*printf("zCheckin=[%s], zU=[%s]", zCheckin, zU);*/
92 if(rc<=0){
93 json_set_err((rc<0) ? FSL_JSON_E_AMBIGUOUS_UUID : FSL_JSON_E_RESOURCE_NOT_FOUND,
 
94 "Check-in hash %s.", (rc<0) ? "is ambiguous" : "not found");
95 blob_reset(&sql);
96 return NULL;
97 }
98 blob_append_sql(&sql, " AND ci.uuid='%q'", zU);
@@ -104,11 +106,12 @@
104 }else if( zBefore && *zBefore ){
105 blob_append_sql(&sql, " AND event.mtime<=julianday('%q')", zBefore);
106 }
107 }
108
109 blob_append_sql(&sql," ORDER BY event.mtime %s /*sort*/", (sort>0?"ASC":"DESC"));
 
110 /*printf("SQL=\n%s\n",blob_str(&sql));*/
111 db_prepare(&q, "%s", blob_sql_text(&sql));
112 blob_reset(&sql);
113
114 pay = cson_new_object();
@@ -123,18 +126,20 @@
123 int const isNew = db_column_int(&q,9);
124 int const isDel = db_column_int(&q,10);
125 cson_array_append( checkins, cson_object_value(row) );
126 cson_object_set(row, "checkin", json_new_string( db_column_text(&q,1) ));
127 cson_object_set(row, "uuid", json_new_string( db_column_text(&q,2) ));
128 /*cson_object_set(row, "parentArtifact", json_new_string( db_column_text(&q,6) ));*/
 
129 cson_object_set(row, "timestamp", json_new_int( db_column_int64(&q,3) ));
130 cson_object_set(row, "user", json_new_string( db_column_text(&q,4) ));
131 cson_object_set(row, "comment", json_new_string( db_column_text(&q,5) ));
132 /*cson_object_set(row, "bgColor", json_new_string( db_column_text(&q,7) ));*/
 
133 cson_object_set(row, "size", json_new_int( db_column_int64(&q,8) ));
134 cson_object_set(row, "state",
135 json_new_string(json_artifact_status_to_string(isNew,isDel)));
136 if( (0 < limit) && (++currentRow >= limit) ){
137 break;
138 }
139 }
140 db_finalize(&q);
141
--- src/json_finfo.c
+++ src/json_finfo.c
@@ -41,14 +41,15 @@
41 signed char sort = -1;
42 if(!g.perm.Read){
43 json_set_err(FSL_JSON_E_DENIED,"Requires 'o' privileges.");
44 return NULL;
45 }
46 json_warn( FSL_JSON_W_UNKNOWN,
47 "Achtung: the output of the finfo command is up for change.");
48
49 /* For the "name" argument we have to jump through some hoops to make sure
50 that we don't get the fossil-internally-assigned "name" option.
51 */
52 zFilename = json_find_option_cstr2("name",NULL,NULL, g.json.dispatchDepth+1);
53 if(!zFilename || !*zFilename){
54 json_set_err(FSL_JSON_E_MISSING_ARGS, "Missing 'name' parameter.");
55 return NULL;
@@ -65,11 +66,11 @@
66 zCheckin = json_find_option_cstr("checkin",NULL,"ci");
67
68 blob_append_sql(&sql,
69 /*0*/ "SELECT b.uuid,"
70 /*1*/ " ci.uuid,"
71 /*2*/ " (SELECT uuid FROM blob WHERE rid=mlink.fid),"/* Current file uuid */
72 /*3*/ " cast(strftime('%%s',event.mtime) AS INTEGER),"
73 /*4*/ " coalesce(event.euser, event.user),"
74 /*5*/ " coalesce(event.ecomment, event.comment),"
75 /*6*/ " (SELECT uuid FROM blob WHERE rid=mlink.pid)," /* Parent file uuid */
76 /*7*/ " event.bgcolor,"
@@ -88,11 +89,12 @@
89 if( zCheckin && *zCheckin ){
90 char * zU = NULL;
91 int rc = name_to_uuid2( zCheckin, "ci", &zU );
92 /*printf("zCheckin=[%s], zU=[%s]", zCheckin, zU);*/
93 if(rc<=0){
94 json_set_err((rc<0) ? FSL_JSON_E_AMBIGUOUS_UUID :
95 FSL_JSON_E_RESOURCE_NOT_FOUND,
96 "Check-in hash %s.", (rc<0) ? "is ambiguous" : "not found");
97 blob_reset(&sql);
98 return NULL;
99 }
100 blob_append_sql(&sql, " AND ci.uuid='%q'", zU);
@@ -104,11 +106,12 @@
106 }else if( zBefore && *zBefore ){
107 blob_append_sql(&sql, " AND event.mtime<=julianday('%q')", zBefore);
108 }
109 }
110
111 blob_append_sql(&sql," ORDER BY event.mtime %s /*sort*/",
112 (sort>0 ? "ASC" : "DESC"));
113 /*printf("SQL=\n%s\n",blob_str(&sql));*/
114 db_prepare(&q, "%s", blob_sql_text(&sql));
115 blob_reset(&sql);
116
117 pay = cson_new_object();
@@ -123,18 +126,20 @@
126 int const isNew = db_column_int(&q,9);
127 int const isDel = db_column_int(&q,10);
128 cson_array_append( checkins, cson_object_value(row) );
129 cson_object_set(row, "checkin", json_new_string( db_column_text(&q,1) ));
130 cson_object_set(row, "uuid", json_new_string( db_column_text(&q,2) ));
131 /*cson_object_set(row, "parentArtifact",
132 json_new_string( db_column_text(&q,6) ));*/
133 cson_object_set(row, "timestamp", json_new_int( db_column_int64(&q,3) ));
134 cson_object_set(row, "user", json_new_string( db_column_text(&q,4) ));
135 cson_object_set(row, "comment", json_new_string( db_column_text(&q,5) ));
136 /*cson_object_set(row, "bgColor",
137 json_new_string( db_column_text(&q,7) ));*/
138 cson_object_set(row, "size", json_new_int( db_column_int64(&q,8) ));
139 cson_object_set(row, "state", json_new_string(
140 json_artifact_status_to_string(isNew, isDel)));
141 if( (0 < limit) && (++currentRow >= limit) ){
142 break;
143 }
144 }
145 db_finalize(&q);
146
--- src/json_login.c
+++ src/json_login.c
@@ -155,13 +155,15 @@
155155
po = cson_value_get_object(payload);
156156
cson_object_set(po, "authToken", json_new_string(cookie));
157157
free(cookie);
158158
cson_object_set(po, "name", json_new_string(name));
159159
cap = db_text(NULL, "SELECT cap FROM user WHERE login=%Q", name);
160
- cson_object_set(po, "capabilities", cap ? json_new_string(cap) : cson_value_null() );
160
+ cson_object_set(po, "capabilities",
161
+ cap ? json_new_string(cap) : cson_value_null() );
161162
free(cap);
162
- cson_object_set(po, "loginCookieName", json_new_string( login_cookie_name() ) );
163
+ cson_object_set(po, "loginCookieName",
164
+ json_new_string( login_cookie_name() ) );
163165
/* TODO: add loginExpiryTime to the payload. To do this properly
164166
we "should" add an ([unsigned] int *) to
165167
login_set_user_cookie() and login_set_anon_cookie(), to which
166168
the expiry time is assigned. (Remember that JSON doesn't do
167169
unsigned int.)
168170
--- src/json_login.c
+++ src/json_login.c
@@ -155,13 +155,15 @@
155 po = cson_value_get_object(payload);
156 cson_object_set(po, "authToken", json_new_string(cookie));
157 free(cookie);
158 cson_object_set(po, "name", json_new_string(name));
159 cap = db_text(NULL, "SELECT cap FROM user WHERE login=%Q", name);
160 cson_object_set(po, "capabilities", cap ? json_new_string(cap) : cson_value_null() );
 
161 free(cap);
162 cson_object_set(po, "loginCookieName", json_new_string( login_cookie_name() ) );
 
163 /* TODO: add loginExpiryTime to the payload. To do this properly
164 we "should" add an ([unsigned] int *) to
165 login_set_user_cookie() and login_set_anon_cookie(), to which
166 the expiry time is assigned. (Remember that JSON doesn't do
167 unsigned int.)
168
--- src/json_login.c
+++ src/json_login.c
@@ -155,13 +155,15 @@
155 po = cson_value_get_object(payload);
156 cson_object_set(po, "authToken", json_new_string(cookie));
157 free(cookie);
158 cson_object_set(po, "name", json_new_string(name));
159 cap = db_text(NULL, "SELECT cap FROM user WHERE login=%Q", name);
160 cson_object_set(po, "capabilities",
161 cap ? json_new_string(cap) : cson_value_null() );
162 free(cap);
163 cson_object_set(po, "loginCookieName",
164 json_new_string( login_cookie_name() ) );
165 /* TODO: add loginExpiryTime to the payload. To do this properly
166 we "should" add an ([unsigned] int *) to
167 login_set_user_cookie() and login_set_anon_cookie(), to which
168 the expiry time is assigned. (Remember that JSON doesn't do
169 unsigned int.)
170
+2 -1
--- src/json_tag.c
+++ src/json_tag.c
@@ -117,11 +117,12 @@
117117
Blob uu = empty_blob;
118118
int rc;
119119
blob_append(&uu, zName, -1);
120120
rc = name_to_uuid(&uu, 9, "*");
121121
if(0!=rc){
122
- json_set_err(FSL_JSON_E_UNKNOWN,"Could not convert name back to artifact hash!");
122
+ json_set_err(FSL_JSON_E_UNKNOWN,
123
+ "Could not convert name back to artifact hash!");
123124
blob_reset(&uu);
124125
goto error;
125126
}
126127
cson_object_set(pay, "appliedTo", json_new_string(blob_buffer(&uu)));
127128
blob_reset(&uu);
128129
--- src/json_tag.c
+++ src/json_tag.c
@@ -117,11 +117,12 @@
117 Blob uu = empty_blob;
118 int rc;
119 blob_append(&uu, zName, -1);
120 rc = name_to_uuid(&uu, 9, "*");
121 if(0!=rc){
122 json_set_err(FSL_JSON_E_UNKNOWN,"Could not convert name back to artifact hash!");
 
123 blob_reset(&uu);
124 goto error;
125 }
126 cson_object_set(pay, "appliedTo", json_new_string(blob_buffer(&uu)));
127 blob_reset(&uu);
128
--- src/json_tag.c
+++ src/json_tag.c
@@ -117,11 +117,12 @@
117 Blob uu = empty_blob;
118 int rc;
119 blob_append(&uu, zName, -1);
120 rc = name_to_uuid(&uu, 9, "*");
121 if(0!=rc){
122 json_set_err(FSL_JSON_E_UNKNOWN,
123 "Could not convert name back to artifact hash!");
124 blob_reset(&uu);
125 goto error;
126 }
127 cson_object_set(pay, "appliedTo", json_new_string(blob_buffer(&uu)));
128 blob_reset(&uu);
129
--- src/json_timeline.c
+++ src/json_timeline.c
@@ -169,20 +169,22 @@
169169
zTag);
170170
if(tagid<=0){
171171
return -1;
172172
}
173173
if(pPayload){
174
- cson_object_set( pPayload, zBranch ? "branch" : "tag", json_new_string(zTag) );
174
+ cson_object_set( pPayload, zBranch ? "branch" : "tag",
175
+ json_new_string(zTag) );
175176
}
176177
blob_appendf(pSql,
177178
" AND ("
178179
" EXISTS(SELECT 1 FROM tagxref"
179180
" WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)",
180181
tagid);
181182
if(!zUnhide){
182183
blob_appendf(pSql,
183
- " AND NOT EXISTS(SELECT 1 FROM plink JOIN tagxref ON rid=blob.rid"
184
+ " AND NOT EXISTS(SELECT 1 FROM plink "
185
+ " JOIN tagxref ON rid=blob.rid"
184186
" WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)",
185187
TAG_HIDDEN);
186188
}
187189
if(zBranch){
188190
/* from "r" flag code in page_timeline().*/
@@ -352,13 +354,14 @@
352354
cson_object_set(row, "parent", json_new_string(db_column_text(&q,4)));
353355
}
354356
cson_object_set(row, "size", json_new_int(db_column_int(&q,5)));
355357
356358
cson_object_set(row, "state",
357
- json_new_string(json_artifact_status_to_string(isNew,isDel)));
359
+ json_new_string(json_artifact_status_to_string(isNew,isDel)));
358360
zDownload = mprintf("/raw/%s?name=%s",
359
- /* reminder: g.zBaseURL is of course not set for CLI mode. */
361
+ /* reminder: g.zBaseURL is of course not set
362
+ for CLI mode. */
360363
db_column_text(&q,2),
361364
db_column_text(&q,3));
362365
cson_object_set(row, "downloadPath", json_new_string(zDownload));
363366
free(zDownload);
364367
}
@@ -505,11 +508,11 @@
505508
cson_object * row = cson_value_get_object(rowV);
506509
if(!row){
507510
if( !warnRowToJsonFailed ){
508511
warnRowToJsonFailed = 1;
509512
json_warn( FSL_JSON_W_ROW_TO_JSON_FAILED,
510
- "Could not convert at least one timeline result row to JSON." );
513
+ "Could not convert at least one timeline result row to JSON." );
511514
}
512515
continue;
513516
}
514517
cson_array_append(list, rowV);
515518
}
@@ -548,19 +551,22 @@
548551
goto error;
549552
}
550553
551554
#if 0
552555
/* only for testing! */
553
- cson_object_set(pay, "timelineSql", cson_value_new_string(blob_buffer(&sql),strlen(blob_buffer(&sql))));
556
+ cson_object_set(pay, "timelineSql", cson_value_new_string(blob_buffer(&sql),
557
+ strlen(blob_buffer(&sql))));
554558
#endif
555559
db_multi_exec("%s", blob_buffer(&sql) /*safe-for-%s*/);
556560
blob_reset(&sql);
557561
db_prepare(&q, "SELECT"
558562
/* For events, the name is generally more useful than
559563
the uuid, but the uuid is unambiguous and can be used
560564
with commands like 'artifact'. */
561
- " substr((SELECT tagname FROM tag AS tn WHERE tn.tagid=json_timeline.tagId AND tagname LIKE 'event-%%'),7) AS name,"
565
+ " substr((SELECT tagname FROM tag AS tn "
566
+ " WHERE tn.tagid=json_timeline.tagId "
567
+ " AND tagname LIKE 'event-%%'),7) AS name,"
562568
" uuid as uuid,"
563569
" mtime AS timestamp,"
564570
" comment AS comment, "
565571
" user AS user,"
566572
" eventType AS eventType"
@@ -591,11 +597,12 @@
591597
cson_array * list = NULL;
592598
int check = 0;
593599
Stmt q = empty_Stmt;
594600
Blob sql = empty_blob;
595601
if( !g.perm.RdWiki && !g.perm.Read ){
596
- json_set_err( FSL_JSON_E_DENIED, "Wiki timeline requires 'o' or 'j' access.");
602
+ json_set_err( FSL_JSON_E_DENIED,
603
+ "Wiki timeline requires 'o' or 'j' access.");
597604
return NULL;
598605
}
599606
payV = cson_value_new_object();
600607
pay = cson_value_get_object(payV);
601608
check = json_timeline_setup_sql( "w", &sql, pay );
@@ -604,11 +611,12 @@
604611
goto error;
605612
}
606613
607614
#if 0
608615
/* only for testing! */
609
- cson_object_set(pay, "timelineSql", cson_value_new_string(blob_buffer(&sql),strlen(blob_buffer(&sql))));
616
+ cson_object_set(pay, "timelineSql", cson_value_new_string(blob_buffer(&sql),
617
+ strlen(blob_buffer(&sql))));
610618
#endif
611619
db_multi_exec("%s", blob_buffer(&sql) /*safe-for-%s*/);
612620
blob_reset(&sql);
613621
db_prepare(&q, "SELECT"
614622
" uuid AS uuid,"
@@ -654,11 +662,12 @@
654662
cson_array * list = NULL;
655663
int check = 0;
656664
Stmt q = empty_Stmt;
657665
Blob sql = empty_blob;
658666
if( !g.perm.RdTkt && !g.perm.Read ){
659
- json_set_err(FSL_JSON_E_DENIED, "Ticket timeline requires 'o' or 'r' access.");
667
+ json_set_err(FSL_JSON_E_DENIED,
668
+ "Ticket timeline requires 'o' or 'r' access.");
660669
return NULL;
661670
}
662671
payV = cson_value_new_object();
663672
pay = cson_value_get_object(payV);
664673
check = json_timeline_setup_sql( "t", &sql, pay );
@@ -726,11 +735,11 @@
726735
rowV = cson_sqlite3_row_to_object(q.pStmt);
727736
row = cson_value_get_object(rowV);
728737
if(!row){
729738
manifest_destroy(pMan);
730739
json_warn( FSL_JSON_W_ROW_TO_JSON_FAILED,
731
- "Could not convert at least one timeline result row to JSON." );
740
+ "Could not convert at least one timeline result row to JSON." );
732741
continue;
733742
}
734743
/* FIXME: certainly there's a more efficient way for use to get
735744
the ticket UUIDs?
736745
*/
737746
--- src/json_timeline.c
+++ src/json_timeline.c
@@ -169,20 +169,22 @@
169 zTag);
170 if(tagid<=0){
171 return -1;
172 }
173 if(pPayload){
174 cson_object_set( pPayload, zBranch ? "branch" : "tag", json_new_string(zTag) );
 
175 }
176 blob_appendf(pSql,
177 " AND ("
178 " EXISTS(SELECT 1 FROM tagxref"
179 " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)",
180 tagid);
181 if(!zUnhide){
182 blob_appendf(pSql,
183 " AND NOT EXISTS(SELECT 1 FROM plink JOIN tagxref ON rid=blob.rid"
 
184 " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)",
185 TAG_HIDDEN);
186 }
187 if(zBranch){
188 /* from "r" flag code in page_timeline().*/
@@ -352,13 +354,14 @@
352 cson_object_set(row, "parent", json_new_string(db_column_text(&q,4)));
353 }
354 cson_object_set(row, "size", json_new_int(db_column_int(&q,5)));
355
356 cson_object_set(row, "state",
357 json_new_string(json_artifact_status_to_string(isNew,isDel)));
358 zDownload = mprintf("/raw/%s?name=%s",
359 /* reminder: g.zBaseURL is of course not set for CLI mode. */
 
360 db_column_text(&q,2),
361 db_column_text(&q,3));
362 cson_object_set(row, "downloadPath", json_new_string(zDownload));
363 free(zDownload);
364 }
@@ -505,11 +508,11 @@
505 cson_object * row = cson_value_get_object(rowV);
506 if(!row){
507 if( !warnRowToJsonFailed ){
508 warnRowToJsonFailed = 1;
509 json_warn( FSL_JSON_W_ROW_TO_JSON_FAILED,
510 "Could not convert at least one timeline result row to JSON." );
511 }
512 continue;
513 }
514 cson_array_append(list, rowV);
515 }
@@ -548,19 +551,22 @@
548 goto error;
549 }
550
551 #if 0
552 /* only for testing! */
553 cson_object_set(pay, "timelineSql", cson_value_new_string(blob_buffer(&sql),strlen(blob_buffer(&sql))));
 
554 #endif
555 db_multi_exec("%s", blob_buffer(&sql) /*safe-for-%s*/);
556 blob_reset(&sql);
557 db_prepare(&q, "SELECT"
558 /* For events, the name is generally more useful than
559 the uuid, but the uuid is unambiguous and can be used
560 with commands like 'artifact'. */
561 " substr((SELECT tagname FROM tag AS tn WHERE tn.tagid=json_timeline.tagId AND tagname LIKE 'event-%%'),7) AS name,"
 
 
562 " uuid as uuid,"
563 " mtime AS timestamp,"
564 " comment AS comment, "
565 " user AS user,"
566 " eventType AS eventType"
@@ -591,11 +597,12 @@
591 cson_array * list = NULL;
592 int check = 0;
593 Stmt q = empty_Stmt;
594 Blob sql = empty_blob;
595 if( !g.perm.RdWiki && !g.perm.Read ){
596 json_set_err( FSL_JSON_E_DENIED, "Wiki timeline requires 'o' or 'j' access.");
 
597 return NULL;
598 }
599 payV = cson_value_new_object();
600 pay = cson_value_get_object(payV);
601 check = json_timeline_setup_sql( "w", &sql, pay );
@@ -604,11 +611,12 @@
604 goto error;
605 }
606
607 #if 0
608 /* only for testing! */
609 cson_object_set(pay, "timelineSql", cson_value_new_string(blob_buffer(&sql),strlen(blob_buffer(&sql))));
 
610 #endif
611 db_multi_exec("%s", blob_buffer(&sql) /*safe-for-%s*/);
612 blob_reset(&sql);
613 db_prepare(&q, "SELECT"
614 " uuid AS uuid,"
@@ -654,11 +662,12 @@
654 cson_array * list = NULL;
655 int check = 0;
656 Stmt q = empty_Stmt;
657 Blob sql = empty_blob;
658 if( !g.perm.RdTkt && !g.perm.Read ){
659 json_set_err(FSL_JSON_E_DENIED, "Ticket timeline requires 'o' or 'r' access.");
 
660 return NULL;
661 }
662 payV = cson_value_new_object();
663 pay = cson_value_get_object(payV);
664 check = json_timeline_setup_sql( "t", &sql, pay );
@@ -726,11 +735,11 @@
726 rowV = cson_sqlite3_row_to_object(q.pStmt);
727 row = cson_value_get_object(rowV);
728 if(!row){
729 manifest_destroy(pMan);
730 json_warn( FSL_JSON_W_ROW_TO_JSON_FAILED,
731 "Could not convert at least one timeline result row to JSON." );
732 continue;
733 }
734 /* FIXME: certainly there's a more efficient way for use to get
735 the ticket UUIDs?
736 */
737
--- src/json_timeline.c
+++ src/json_timeline.c
@@ -169,20 +169,22 @@
169 zTag);
170 if(tagid<=0){
171 return -1;
172 }
173 if(pPayload){
174 cson_object_set( pPayload, zBranch ? "branch" : "tag",
175 json_new_string(zTag) );
176 }
177 blob_appendf(pSql,
178 " AND ("
179 " EXISTS(SELECT 1 FROM tagxref"
180 " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)",
181 tagid);
182 if(!zUnhide){
183 blob_appendf(pSql,
184 " AND NOT EXISTS(SELECT 1 FROM plink "
185 " JOIN tagxref ON rid=blob.rid"
186 " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)",
187 TAG_HIDDEN);
188 }
189 if(zBranch){
190 /* from "r" flag code in page_timeline().*/
@@ -352,13 +354,14 @@
354 cson_object_set(row, "parent", json_new_string(db_column_text(&q,4)));
355 }
356 cson_object_set(row, "size", json_new_int(db_column_int(&q,5)));
357
358 cson_object_set(row, "state",
359 json_new_string(json_artifact_status_to_string(isNew,isDel)));
360 zDownload = mprintf("/raw/%s?name=%s",
361 /* reminder: g.zBaseURL is of course not set
362 for CLI mode. */
363 db_column_text(&q,2),
364 db_column_text(&q,3));
365 cson_object_set(row, "downloadPath", json_new_string(zDownload));
366 free(zDownload);
367 }
@@ -505,11 +508,11 @@
508 cson_object * row = cson_value_get_object(rowV);
509 if(!row){
510 if( !warnRowToJsonFailed ){
511 warnRowToJsonFailed = 1;
512 json_warn( FSL_JSON_W_ROW_TO_JSON_FAILED,
513 "Could not convert at least one timeline result row to JSON." );
514 }
515 continue;
516 }
517 cson_array_append(list, rowV);
518 }
@@ -548,19 +551,22 @@
551 goto error;
552 }
553
554 #if 0
555 /* only for testing! */
556 cson_object_set(pay, "timelineSql", cson_value_new_string(blob_buffer(&sql),
557 strlen(blob_buffer(&sql))));
558 #endif
559 db_multi_exec("%s", blob_buffer(&sql) /*safe-for-%s*/);
560 blob_reset(&sql);
561 db_prepare(&q, "SELECT"
562 /* For events, the name is generally more useful than
563 the uuid, but the uuid is unambiguous and can be used
564 with commands like 'artifact'. */
565 " substr((SELECT tagname FROM tag AS tn "
566 " WHERE tn.tagid=json_timeline.tagId "
567 " AND tagname LIKE 'event-%%'),7) AS name,"
568 " uuid as uuid,"
569 " mtime AS timestamp,"
570 " comment AS comment, "
571 " user AS user,"
572 " eventType AS eventType"
@@ -591,11 +597,12 @@
597 cson_array * list = NULL;
598 int check = 0;
599 Stmt q = empty_Stmt;
600 Blob sql = empty_blob;
601 if( !g.perm.RdWiki && !g.perm.Read ){
602 json_set_err( FSL_JSON_E_DENIED,
603 "Wiki timeline requires 'o' or 'j' access.");
604 return NULL;
605 }
606 payV = cson_value_new_object();
607 pay = cson_value_get_object(payV);
608 check = json_timeline_setup_sql( "w", &sql, pay );
@@ -604,11 +611,12 @@
611 goto error;
612 }
613
614 #if 0
615 /* only for testing! */
616 cson_object_set(pay, "timelineSql", cson_value_new_string(blob_buffer(&sql),
617 strlen(blob_buffer(&sql))));
618 #endif
619 db_multi_exec("%s", blob_buffer(&sql) /*safe-for-%s*/);
620 blob_reset(&sql);
621 db_prepare(&q, "SELECT"
622 " uuid AS uuid,"
@@ -654,11 +662,12 @@
662 cson_array * list = NULL;
663 int check = 0;
664 Stmt q = empty_Stmt;
665 Blob sql = empty_blob;
666 if( !g.perm.RdTkt && !g.perm.Read ){
667 json_set_err(FSL_JSON_E_DENIED,
668 "Ticket timeline requires 'o' or 'r' access.");
669 return NULL;
670 }
671 payV = cson_value_new_object();
672 pay = cson_value_get_object(payV);
673 check = json_timeline_setup_sql( "t", &sql, pay );
@@ -726,11 +735,11 @@
735 rowV = cson_sqlite3_row_to_object(q.pStmt);
736 row = cson_value_get_object(rowV);
737 if(!row){
738 manifest_destroy(pMan);
739 json_warn( FSL_JSON_W_ROW_TO_JSON_FAILED,
740 "Could not convert at least one timeline result row to JSON." );
741 continue;
742 }
743 /* FIXME: certainly there's a more efficient way for use to get
744 the ticket UUIDs?
745 */
746
+2 -1
--- src/json_user.c
+++ src/json_user.c
@@ -170,11 +170,12 @@
170170
** not modify the 's' permission. Admin users without setup
171171
** permissions may not edit any other user who has the 's' permission.
172172
**
173173
*/
174174
int json_user_update_from_json( cson_object * pUser ){
175
-#define CSTR(X) cson_string_cstr(cson_value_get_string( cson_object_get(pUser, X ) ))
175
+#define CSTR(X) cson_string_cstr(cson_value_get_string( cson_object_get(pUser, \
176
+ X ) ))
176177
char const * zName = CSTR("name");
177178
char const * zNameNew = zName;
178179
char * zNameFree = NULL;
179180
char const * zInfo = CSTR("info");
180181
char const * zCap = CSTR("capabilities");
181182
--- src/json_user.c
+++ src/json_user.c
@@ -170,11 +170,12 @@
170 ** not modify the 's' permission. Admin users without setup
171 ** permissions may not edit any other user who has the 's' permission.
172 **
173 */
174 int json_user_update_from_json( cson_object * pUser ){
175 #define CSTR(X) cson_string_cstr(cson_value_get_string( cson_object_get(pUser, X ) ))
 
176 char const * zName = CSTR("name");
177 char const * zNameNew = zName;
178 char * zNameFree = NULL;
179 char const * zInfo = CSTR("info");
180 char const * zCap = CSTR("capabilities");
181
--- src/json_user.c
+++ src/json_user.c
@@ -170,11 +170,12 @@
170 ** not modify the 's' permission. Admin users without setup
171 ** permissions may not edit any other user who has the 's' permission.
172 **
173 */
174 int json_user_update_from_json( cson_object * pUser ){
175 #define CSTR(X) cson_string_cstr(cson_value_get_string( cson_object_get(pUser, \
176 X ) ))
177 char const * zName = CSTR("name");
178 char const * zNameNew = zName;
179 char * zNameFree = NULL;
180 char const * zInfo = CSTR("info");
181 char const * zCap = CSTR("capabilities");
182
+11 -8
--- src/json_wiki.c
+++ src/json_wiki.c
@@ -163,11 +163,12 @@
163163
/*
164164
** Searches for the latest version of a wiki page with the given
165165
** name. If found it behaves like json_get_wiki_page_by_rid(theRid,
166166
** contentFormat), else it returns NULL.
167167
*/
168
-cson_value * json_get_wiki_page_by_name(char const * zPageName, int contentFormat){
168
+cson_value * json_get_wiki_page_by_name(char const * zPageName,
169
+ int contentFormat){
169170
int rid;
170171
rid = db_int(0,
171172
"SELECT x.rid FROM tag t, tagxref x, blob b"
172173
" WHERE x.tagid=t.tagid AND t.tagname='wiki-%q' "
173174
" AND b.rid=x.rid"
@@ -259,11 +260,11 @@
259260
260261
zSymName = json_find_option_cstr("uuid",NULL,"u");
261262
262263
if((!zPageName||!*zPageName) && (!zSymName || !*zSymName)){
263264
json_set_err(FSL_JSON_E_MISSING_ARGS,
264
- "At least one of the 'name' or 'uuid' arguments must be provided.");
265
+ "At least one of the 'name' or 'uuid' arguments must be provided.");
265266
return NULL;
266267
}
267268
268269
/* TODO: see if we have a page named zPageName. If not, try to resolve
269270
zPageName as a UUID.
@@ -297,17 +298,17 @@
297298
}else{
298299
sContent = cson_value_get_string(g.json.reqPayload.v);
299300
}
300301
if(!sContent) {
301302
json_set_err(FSL_JSON_E_MISSING_ARGS,
302
- "The 'payload' property must be either a string containing the "
303
- "Fossil wiki code to preview or an object with body + mimetype "
304
- "properties.");
303
+ "The 'payload' property must be either a string containing the "
304
+ "Fossil wiki code to preview or an object with body + mimetype "
305
+ "properties.");
305306
return NULL;
306307
}
307308
zContent = cson_string_cstr(sContent);
308
- blob_append( &contentOrig, zContent, (int)cson_string_length_bytes(sContent) );
309
+ blob_append( &contentOrig, zContent, (int)cson_string_length_bytes(sContent));
309310
zMime = wiki_filter_mimetypes(zMime);
310311
if( 0==fossil_strcmp(zMime, "text/x-markdown") ){
311312
markdown_to_html(&contentOrig, 0, &contentHtml);
312313
}else if( 0==fossil_strcmp(zMime, "text/plain") ){
313314
blob_append(&contentHtml, "<pre class='textPlain'>", -1);
@@ -315,11 +316,12 @@
315316
blob_append(&contentHtml, "</pre>", -1);
316317
}else{
317318
wiki_convert( &contentOrig, &contentHtml, 0 );
318319
}
319320
blob_reset( &contentOrig );
320
- pay = cson_value_new_string( blob_str(&contentHtml), (unsigned int)blob_size(&contentHtml));
321
+ pay = cson_value_new_string( blob_str(&contentHtml),
322
+ (unsigned int)blob_size(&contentHtml));
321323
blob_reset( &contentHtml );
322324
return pay;
323325
}
324326
325327
@@ -346,11 +348,12 @@
346348
cson_value * nameV; /* wiki page name */
347349
char const * zPageName; /* cstr form of page name */
348350
cson_value * contentV; /* passed-in content */
349351
cson_value * emptyContent = NULL; /* placeholder for empty content. */
350352
cson_value * payV = NULL; /* payload/return value */
351
- cson_string const * jstr = NULL; /* temp for cson_value-to-cson_string conversions. */
353
+ cson_string const * jstr = NULL; /* temp for cson_value-to-cson_string
354
+ conversions. */
352355
char const * zMimeType = 0;
353356
unsigned int contentLen = 0;
354357
int rid;
355358
if( (createMode && !g.perm.NewWiki)
356359
|| (!createMode && !g.perm.WrWiki)){
357360
--- src/json_wiki.c
+++ src/json_wiki.c
@@ -163,11 +163,12 @@
163 /*
164 ** Searches for the latest version of a wiki page with the given
165 ** name. If found it behaves like json_get_wiki_page_by_rid(theRid,
166 ** contentFormat), else it returns NULL.
167 */
168 cson_value * json_get_wiki_page_by_name(char const * zPageName, int contentFormat){
 
169 int rid;
170 rid = db_int(0,
171 "SELECT x.rid FROM tag t, tagxref x, blob b"
172 " WHERE x.tagid=t.tagid AND t.tagname='wiki-%q' "
173 " AND b.rid=x.rid"
@@ -259,11 +260,11 @@
259
260 zSymName = json_find_option_cstr("uuid",NULL,"u");
261
262 if((!zPageName||!*zPageName) && (!zSymName || !*zSymName)){
263 json_set_err(FSL_JSON_E_MISSING_ARGS,
264 "At least one of the 'name' or 'uuid' arguments must be provided.");
265 return NULL;
266 }
267
268 /* TODO: see if we have a page named zPageName. If not, try to resolve
269 zPageName as a UUID.
@@ -297,17 +298,17 @@
297 }else{
298 sContent = cson_value_get_string(g.json.reqPayload.v);
299 }
300 if(!sContent) {
301 json_set_err(FSL_JSON_E_MISSING_ARGS,
302 "The 'payload' property must be either a string containing the "
303 "Fossil wiki code to preview or an object with body + mimetype "
304 "properties.");
305 return NULL;
306 }
307 zContent = cson_string_cstr(sContent);
308 blob_append( &contentOrig, zContent, (int)cson_string_length_bytes(sContent) );
309 zMime = wiki_filter_mimetypes(zMime);
310 if( 0==fossil_strcmp(zMime, "text/x-markdown") ){
311 markdown_to_html(&contentOrig, 0, &contentHtml);
312 }else if( 0==fossil_strcmp(zMime, "text/plain") ){
313 blob_append(&contentHtml, "<pre class='textPlain'>", -1);
@@ -315,11 +316,12 @@
315 blob_append(&contentHtml, "</pre>", -1);
316 }else{
317 wiki_convert( &contentOrig, &contentHtml, 0 );
318 }
319 blob_reset( &contentOrig );
320 pay = cson_value_new_string( blob_str(&contentHtml), (unsigned int)blob_size(&contentHtml));
 
321 blob_reset( &contentHtml );
322 return pay;
323 }
324
325
@@ -346,11 +348,12 @@
346 cson_value * nameV; /* wiki page name */
347 char const * zPageName; /* cstr form of page name */
348 cson_value * contentV; /* passed-in content */
349 cson_value * emptyContent = NULL; /* placeholder for empty content. */
350 cson_value * payV = NULL; /* payload/return value */
351 cson_string const * jstr = NULL; /* temp for cson_value-to-cson_string conversions. */
 
352 char const * zMimeType = 0;
353 unsigned int contentLen = 0;
354 int rid;
355 if( (createMode && !g.perm.NewWiki)
356 || (!createMode && !g.perm.WrWiki)){
357
--- src/json_wiki.c
+++ src/json_wiki.c
@@ -163,11 +163,12 @@
163 /*
164 ** Searches for the latest version of a wiki page with the given
165 ** name. If found it behaves like json_get_wiki_page_by_rid(theRid,
166 ** contentFormat), else it returns NULL.
167 */
168 cson_value * json_get_wiki_page_by_name(char const * zPageName,
169 int contentFormat){
170 int rid;
171 rid = db_int(0,
172 "SELECT x.rid FROM tag t, tagxref x, blob b"
173 " WHERE x.tagid=t.tagid AND t.tagname='wiki-%q' "
174 " AND b.rid=x.rid"
@@ -259,11 +260,11 @@
260
261 zSymName = json_find_option_cstr("uuid",NULL,"u");
262
263 if((!zPageName||!*zPageName) && (!zSymName || !*zSymName)){
264 json_set_err(FSL_JSON_E_MISSING_ARGS,
265 "At least one of the 'name' or 'uuid' arguments must be provided.");
266 return NULL;
267 }
268
269 /* TODO: see if we have a page named zPageName. If not, try to resolve
270 zPageName as a UUID.
@@ -297,17 +298,17 @@
298 }else{
299 sContent = cson_value_get_string(g.json.reqPayload.v);
300 }
301 if(!sContent) {
302 json_set_err(FSL_JSON_E_MISSING_ARGS,
303 "The 'payload' property must be either a string containing the "
304 "Fossil wiki code to preview or an object with body + mimetype "
305 "properties.");
306 return NULL;
307 }
308 zContent = cson_string_cstr(sContent);
309 blob_append( &contentOrig, zContent, (int)cson_string_length_bytes(sContent));
310 zMime = wiki_filter_mimetypes(zMime);
311 if( 0==fossil_strcmp(zMime, "text/x-markdown") ){
312 markdown_to_html(&contentOrig, 0, &contentHtml);
313 }else if( 0==fossil_strcmp(zMime, "text/plain") ){
314 blob_append(&contentHtml, "<pre class='textPlain'>", -1);
@@ -315,11 +316,12 @@
316 blob_append(&contentHtml, "</pre>", -1);
317 }else{
318 wiki_convert( &contentOrig, &contentHtml, 0 );
319 }
320 blob_reset( &contentOrig );
321 pay = cson_value_new_string( blob_str(&contentHtml),
322 (unsigned int)blob_size(&contentHtml));
323 blob_reset( &contentHtml );
324 return pay;
325 }
326
327
@@ -346,11 +348,12 @@
348 cson_value * nameV; /* wiki page name */
349 char const * zPageName; /* cstr form of page name */
350 cson_value * contentV; /* passed-in content */
351 cson_value * emptyContent = NULL; /* placeholder for empty content. */
352 cson_value * payV = NULL; /* payload/return value */
353 cson_string const * jstr = NULL; /* temp for cson_value-to-cson_string
354 conversions. */
355 char const * zMimeType = 0;
356 unsigned int contentLen = 0;
357 int rid;
358 if( (createMode && !g.perm.NewWiki)
359 || (!createMode && !g.perm.WrWiki)){
360
+1 -1
--- src/lookslike.c
+++ src/lookslike.c
@@ -270,11 +270,11 @@
270270
int j, c, flags = LOOK_NONE; /* Assume UTF-16 text, prove otherwise */
271271
272272
if( n%sizeof(WCHAR_T) ){
273273
flags |= LOOK_ODD; /* Odd number of bytes -> binary (UTF-8?) */
274274
}
275
- if( n<sizeof(WCHAR_T) ) return flags; /* Zero or One byte -> binary (UTF-8?) */
275
+ if( n<sizeof(WCHAR_T) ) return flags;/* Zero or One byte -> binary (UTF-8?) */
276276
c = *z;
277277
if( bReverse ){
278278
c = UTF16_SWAP(c);
279279
}
280280
if( c==0 ){
281281
--- src/lookslike.c
+++ src/lookslike.c
@@ -270,11 +270,11 @@
270 int j, c, flags = LOOK_NONE; /* Assume UTF-16 text, prove otherwise */
271
272 if( n%sizeof(WCHAR_T) ){
273 flags |= LOOK_ODD; /* Odd number of bytes -> binary (UTF-8?) */
274 }
275 if( n<sizeof(WCHAR_T) ) return flags; /* Zero or One byte -> binary (UTF-8?) */
276 c = *z;
277 if( bReverse ){
278 c = UTF16_SWAP(c);
279 }
280 if( c==0 ){
281
--- src/lookslike.c
+++ src/lookslike.c
@@ -270,11 +270,11 @@
270 int j, c, flags = LOOK_NONE; /* Assume UTF-16 text, prove otherwise */
271
272 if( n%sizeof(WCHAR_T) ){
273 flags |= LOOK_ODD; /* Odd number of bytes -> binary (UTF-8?) */
274 }
275 if( n<sizeof(WCHAR_T) ) return flags;/* Zero or One byte -> binary (UTF-8?) */
276 c = *z;
277 if( bReverse ){
278 c = UTF16_SWAP(c);
279 }
280 if( c==0 ){
281
+2 -1
--- src/markdown.c
+++ src/markdown.c
@@ -382,11 +382,12 @@
382382
/* release the given working buffer back to the cache */
383383
static void release_work_buffer(struct render *rndr, struct Blob *buf){
384384
if( !buf ) return;
385385
rndr->iDepth--;
386386
blob_reset(buf);
387
- if( rndr->nBlobCache < (int)(sizeof(rndr->aBlobCache)/sizeof(rndr->aBlobCache[0])) ){
387
+ if( rndr->nBlobCache <
388
+ (int)(sizeof(rndr->aBlobCache)/sizeof(rndr->aBlobCache[0])) ){
388389
rndr->aBlobCache[rndr->nBlobCache++] = buf;
389390
}else{
390391
fossil_free(buf);
391392
}
392393
}
393394
--- src/markdown.c
+++ src/markdown.c
@@ -382,11 +382,12 @@
382 /* release the given working buffer back to the cache */
383 static void release_work_buffer(struct render *rndr, struct Blob *buf){
384 if( !buf ) return;
385 rndr->iDepth--;
386 blob_reset(buf);
387 if( rndr->nBlobCache < (int)(sizeof(rndr->aBlobCache)/sizeof(rndr->aBlobCache[0])) ){
 
388 rndr->aBlobCache[rndr->nBlobCache++] = buf;
389 }else{
390 fossil_free(buf);
391 }
392 }
393
--- src/markdown.c
+++ src/markdown.c
@@ -382,11 +382,12 @@
382 /* release the given working buffer back to the cache */
383 static void release_work_buffer(struct render *rndr, struct Blob *buf){
384 if( !buf ) return;
385 rndr->iDepth--;
386 blob_reset(buf);
387 if( rndr->nBlobCache <
388 (int)(sizeof(rndr->aBlobCache)/sizeof(rndr->aBlobCache[0])) ){
389 rndr->aBlobCache[rndr->nBlobCache++] = buf;
390 }else{
391 fossil_free(buf);
392 }
393 }
394
+3 -2
--- src/rebuild.c
+++ src/rebuild.c
@@ -661,11 +661,11 @@
661661
** --force Force the rebuild to complete even if errors are seen
662662
** --ifneeded Only do the rebuild if it would change the schema version
663663
** --index Always add in the full-text search index
664664
** --noverify Skip the verification of changes to the BLOB table
665665
** --noindex Always omit the full-text search index
666
-** --pagesize N Set the database pagesize to N. (512..65536 and power of 2)
666
+** --pagesize N Set the database pagesize to N (512..65536, power of 2)
667667
** --quiet Only show output if there are errors
668668
** --stats Show artifact statistics after rebuilding
669669
** --vacuum Run VACUUM on the database after rebuilding
670670
** --wal Set Write-Ahead-Log journalling mode on the database
671671
*/
@@ -1395,11 +1395,12 @@
13951395
13961396
db_end_transaction(0);
13971397
fossil_print("project-id: %s\n", db_get("project-code", 0));
13981398
fossil_print("server-id: %s\n", db_get("server-code", 0));
13991399
zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
1400
- fossil_print("admin-user: %s (initial password is \"%s\")\n", g.zLogin, zPassword);
1400
+ fossil_print("admin-user: %s (initial password is \"%s\")\n", g.zLogin,
1401
+ zPassword);
14011402
hash_user_password(g.zLogin);
14021403
}
14031404
14041405
/*
14051406
** COMMAND: deconstruct*
14061407
--- src/rebuild.c
+++ src/rebuild.c
@@ -661,11 +661,11 @@
661 ** --force Force the rebuild to complete even if errors are seen
662 ** --ifneeded Only do the rebuild if it would change the schema version
663 ** --index Always add in the full-text search index
664 ** --noverify Skip the verification of changes to the BLOB table
665 ** --noindex Always omit the full-text search index
666 ** --pagesize N Set the database pagesize to N. (512..65536 and power of 2)
667 ** --quiet Only show output if there are errors
668 ** --stats Show artifact statistics after rebuilding
669 ** --vacuum Run VACUUM on the database after rebuilding
670 ** --wal Set Write-Ahead-Log journalling mode on the database
671 */
@@ -1395,11 +1395,12 @@
1395
1396 db_end_transaction(0);
1397 fossil_print("project-id: %s\n", db_get("project-code", 0));
1398 fossil_print("server-id: %s\n", db_get("server-code", 0));
1399 zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
1400 fossil_print("admin-user: %s (initial password is \"%s\")\n", g.zLogin, zPassword);
 
1401 hash_user_password(g.zLogin);
1402 }
1403
1404 /*
1405 ** COMMAND: deconstruct*
1406
--- src/rebuild.c
+++ src/rebuild.c
@@ -661,11 +661,11 @@
661 ** --force Force the rebuild to complete even if errors are seen
662 ** --ifneeded Only do the rebuild if it would change the schema version
663 ** --index Always add in the full-text search index
664 ** --noverify Skip the verification of changes to the BLOB table
665 ** --noindex Always omit the full-text search index
666 ** --pagesize N Set the database pagesize to N (512..65536, power of 2)
667 ** --quiet Only show output if there are errors
668 ** --stats Show artifact statistics after rebuilding
669 ** --vacuum Run VACUUM on the database after rebuilding
670 ** --wal Set Write-Ahead-Log journalling mode on the database
671 */
@@ -1395,11 +1395,12 @@
1395
1396 db_end_transaction(0);
1397 fossil_print("project-id: %s\n", db_get("project-code", 0));
1398 fossil_print("server-id: %s\n", db_get("server-code", 0));
1399 zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
1400 fossil_print("admin-user: %s (initial password is \"%s\")\n", g.zLogin,
1401 zPassword);
1402 hash_user_password(g.zLogin);
1403 }
1404
1405 /*
1406 ** COMMAND: deconstruct*
1407
+2 -1
--- src/report.c
+++ src/report.c
@@ -1368,11 +1368,12 @@
13681368
char *zErr1 = 0;
13691369
char *zErr2 = 0;
13701370
int count = 0;
13711371
int rn;
13721372
1373
- if( !zRep || !strcmp(zRep,zFullTicketRptRn) || !strcmp(zRep,zFullTicketRptTitle) ){
1373
+ if( !zRep || !strcmp(zRep,zFullTicketRptRn)
1374
+ || !strcmp(zRep,zFullTicketRptTitle) ){
13741375
zSql = "SELECT * FROM ticket";
13751376
}else{
13761377
rn = atoi(zRep);
13771378
if( rn ){
13781379
db_prepare(&q,
13791380
--- src/report.c
+++ src/report.c
@@ -1368,11 +1368,12 @@
1368 char *zErr1 = 0;
1369 char *zErr2 = 0;
1370 int count = 0;
1371 int rn;
1372
1373 if( !zRep || !strcmp(zRep,zFullTicketRptRn) || !strcmp(zRep,zFullTicketRptTitle) ){
 
1374 zSql = "SELECT * FROM ticket";
1375 }else{
1376 rn = atoi(zRep);
1377 if( rn ){
1378 db_prepare(&q,
1379
--- src/report.c
+++ src/report.c
@@ -1368,11 +1368,12 @@
1368 char *zErr1 = 0;
1369 char *zErr2 = 0;
1370 int count = 0;
1371 int rn;
1372
1373 if( !zRep || !strcmp(zRep,zFullTicketRptRn)
1374 || !strcmp(zRep,zFullTicketRptTitle) ){
1375 zSql = "SELECT * FROM ticket";
1376 }else{
1377 rn = atoi(zRep);
1378 if( rn ){
1379 db_prepare(&q,
1380
+9 -7
--- src/rss.c
+++ src/rss.c
@@ -143,12 +143,12 @@
143143
144144
cgi_set_content_type("application/rss+xml");
145145
146146
zProjectName = db_get("project-name", 0);
147147
if( zProjectName==0 ){
148
- zFreeProjectName = zProjectName = mprintf("Fossil source repository for: %s",
149
- g.zBaseURL);
148
+ zFreeProjectName = zProjectName =
149
+ mprintf("Fossil source repository for: %s", g.zBaseURL);
150150
}
151151
zProjectDescr = db_get("project-description", 0);
152152
if( zProjectDescr==0 ){
153153
zProjectDescr = zProjectName;
154154
}
@@ -258,11 +258,11 @@
258258
void cmd_timeline_rss(void){
259259
Stmt q;
260260
int nLine=0;
261261
char *zPubDate, *zProjectName, *zProjectDescr, *zFreeProjectName=0;
262262
Blob bSQL;
263
- const char *zType = find_option("type","y",1); /* Type of events. All if NULL */
263
+ const char *zType = find_option("type","y",1); /* Type of events;All if NULL*/
264264
const char *zTicketUuid = find_option("tkt",NULL,1);
265265
const char *zTag = find_option("tag",NULL,1);
266266
const char *zFilename = find_option("name",NULL,1);
267267
const char *zWiki = find_option("wiki",NULL,1);
268268
const char *zLimit = find_option("limit", "n",1);
@@ -332,31 +332,33 @@
332332
" WHERE tagid=%d AND tagtype>0 AND rid=blob.rid))", nTagId);
333333
}
334334
335335
if( zFilename ){
336336
blob_append_sql(&bSQL,
337
- " AND (SELECT mlink.fnid FROM mlink WHERE event.objid=mlink.mid) IN (SELECT fnid FROM filename WHERE name=%Q %s)",
337
+ " AND (SELECT mlink.fnid FROM mlink WHERE event.objid=mlink.mid) "
338
+ " IN (SELECT fnid FROM filename WHERE name=%Q %s)",
338339
zFilename, filename_collation()
339340
);
340341
}
341342
342343
blob_append( &bSQL, " ORDER BY event.mtime DESC", -1 );
343344
344345
zProjectName = db_get("project-name", 0);
345346
if( zProjectName==0 ){
346
- zFreeProjectName = zProjectName = mprintf("Fossil source repository for: %s",
347
- zBaseURL);
347
+ zFreeProjectName = zProjectName =
348
+ mprintf("Fossil source repository for: %s", zBaseURL);
348349
}
349350
zProjectDescr = db_get("project-description", 0);
350351
if( zProjectDescr==0 ){
351352
zProjectDescr = zProjectName;
352353
}
353354
354355
zPubDate = cgi_rfc822_datestamp(time(NULL));
355356
356357
fossil_print("<?xml version=\"1.0\"?>");
357
- fossil_print("<rss xmlns:dc=\"http://purl.org/dc/elements/1.1/\" version=\"2.0\">");
358
+ fossil_print("<rss xmlns:dc=\"http://purl.org/dc/elements/1.1/\" "
359
+ " version=\"2.0\">");
358360
fossil_print("<channel>\n");
359361
fossil_print("<title>%h</title>\n", zProjectName);
360362
fossil_print("<link>%s</link>\n", zBaseURL);
361363
fossil_print("<description>%h</description>\n", zProjectDescr);
362364
fossil_print("<pubDate>%s</pubDate>\n", zPubDate);
363365
--- src/rss.c
+++ src/rss.c
@@ -143,12 +143,12 @@
143
144 cgi_set_content_type("application/rss+xml");
145
146 zProjectName = db_get("project-name", 0);
147 if( zProjectName==0 ){
148 zFreeProjectName = zProjectName = mprintf("Fossil source repository for: %s",
149 g.zBaseURL);
150 }
151 zProjectDescr = db_get("project-description", 0);
152 if( zProjectDescr==0 ){
153 zProjectDescr = zProjectName;
154 }
@@ -258,11 +258,11 @@
258 void cmd_timeline_rss(void){
259 Stmt q;
260 int nLine=0;
261 char *zPubDate, *zProjectName, *zProjectDescr, *zFreeProjectName=0;
262 Blob bSQL;
263 const char *zType = find_option("type","y",1); /* Type of events. All if NULL */
264 const char *zTicketUuid = find_option("tkt",NULL,1);
265 const char *zTag = find_option("tag",NULL,1);
266 const char *zFilename = find_option("name",NULL,1);
267 const char *zWiki = find_option("wiki",NULL,1);
268 const char *zLimit = find_option("limit", "n",1);
@@ -332,31 +332,33 @@
332 " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid))", nTagId);
333 }
334
335 if( zFilename ){
336 blob_append_sql(&bSQL,
337 " AND (SELECT mlink.fnid FROM mlink WHERE event.objid=mlink.mid) IN (SELECT fnid FROM filename WHERE name=%Q %s)",
 
338 zFilename, filename_collation()
339 );
340 }
341
342 blob_append( &bSQL, " ORDER BY event.mtime DESC", -1 );
343
344 zProjectName = db_get("project-name", 0);
345 if( zProjectName==0 ){
346 zFreeProjectName = zProjectName = mprintf("Fossil source repository for: %s",
347 zBaseURL);
348 }
349 zProjectDescr = db_get("project-description", 0);
350 if( zProjectDescr==0 ){
351 zProjectDescr = zProjectName;
352 }
353
354 zPubDate = cgi_rfc822_datestamp(time(NULL));
355
356 fossil_print("<?xml version=\"1.0\"?>");
357 fossil_print("<rss xmlns:dc=\"http://purl.org/dc/elements/1.1/\" version=\"2.0\">");
 
358 fossil_print("<channel>\n");
359 fossil_print("<title>%h</title>\n", zProjectName);
360 fossil_print("<link>%s</link>\n", zBaseURL);
361 fossil_print("<description>%h</description>\n", zProjectDescr);
362 fossil_print("<pubDate>%s</pubDate>\n", zPubDate);
363
--- src/rss.c
+++ src/rss.c
@@ -143,12 +143,12 @@
143
144 cgi_set_content_type("application/rss+xml");
145
146 zProjectName = db_get("project-name", 0);
147 if( zProjectName==0 ){
148 zFreeProjectName = zProjectName =
149 mprintf("Fossil source repository for: %s", g.zBaseURL);
150 }
151 zProjectDescr = db_get("project-description", 0);
152 if( zProjectDescr==0 ){
153 zProjectDescr = zProjectName;
154 }
@@ -258,11 +258,11 @@
258 void cmd_timeline_rss(void){
259 Stmt q;
260 int nLine=0;
261 char *zPubDate, *zProjectName, *zProjectDescr, *zFreeProjectName=0;
262 Blob bSQL;
263 const char *zType = find_option("type","y",1); /* Type of events;All if NULL*/
264 const char *zTicketUuid = find_option("tkt",NULL,1);
265 const char *zTag = find_option("tag",NULL,1);
266 const char *zFilename = find_option("name",NULL,1);
267 const char *zWiki = find_option("wiki",NULL,1);
268 const char *zLimit = find_option("limit", "n",1);
@@ -332,31 +332,33 @@
332 " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid))", nTagId);
333 }
334
335 if( zFilename ){
336 blob_append_sql(&bSQL,
337 " AND (SELECT mlink.fnid FROM mlink WHERE event.objid=mlink.mid) "
338 " IN (SELECT fnid FROM filename WHERE name=%Q %s)",
339 zFilename, filename_collation()
340 );
341 }
342
343 blob_append( &bSQL, " ORDER BY event.mtime DESC", -1 );
344
345 zProjectName = db_get("project-name", 0);
346 if( zProjectName==0 ){
347 zFreeProjectName = zProjectName =
348 mprintf("Fossil source repository for: %s", zBaseURL);
349 }
350 zProjectDescr = db_get("project-description", 0);
351 if( zProjectDescr==0 ){
352 zProjectDescr = zProjectName;
353 }
354
355 zPubDate = cgi_rfc822_datestamp(time(NULL));
356
357 fossil_print("<?xml version=\"1.0\"?>");
358 fossil_print("<rss xmlns:dc=\"http://purl.org/dc/elements/1.1/\" "
359 " version=\"2.0\">");
360 fossil_print("<channel>\n");
361 fossil_print("<title>%h</title>\n", zProjectName);
362 fossil_print("<link>%s</link>\n", zBaseURL);
363 fossil_print("<description>%h</description>\n", zProjectDescr);
364 fossil_print("<pubDate>%s</pubDate>\n", zPubDate);
365
+2 -1
--- src/sha1.c
+++ src/sha1.c
@@ -32,11 +32,12 @@
3232
** and makeheaders.
3333
*/
3434
#if FOSSIL_HARDENED_SHA1
3535
3636
#if INTERFACE
37
-typedef void(*collision_block_callback)(uint64_t, const uint32_t*, const uint32_t*, const uint32_t*, const uint32_t*);
37
+typedef void(*collision_block_callback)(uint64_t, const uint32_t*,
38
+ const uint32_t*, const uint32_t*, const uint32_t*);
3839
struct SHA1_CTX {
3940
uint64_t total;
4041
uint32_t ihv[5];
4142
unsigned char buffer[64];
4243
int bigendian;
4344
--- src/sha1.c
+++ src/sha1.c
@@ -32,11 +32,12 @@
32 ** and makeheaders.
33 */
34 #if FOSSIL_HARDENED_SHA1
35
36 #if INTERFACE
37 typedef void(*collision_block_callback)(uint64_t, const uint32_t*, const uint32_t*, const uint32_t*, const uint32_t*);
 
38 struct SHA1_CTX {
39 uint64_t total;
40 uint32_t ihv[5];
41 unsigned char buffer[64];
42 int bigendian;
43
--- src/sha1.c
+++ src/sha1.c
@@ -32,11 +32,12 @@
32 ** and makeheaders.
33 */
34 #if FOSSIL_HARDENED_SHA1
35
36 #if INTERFACE
37 typedef void(*collision_block_callback)(uint64_t, const uint32_t*,
38 const uint32_t*, const uint32_t*, const uint32_t*);
39 struct SHA1_CTX {
40 uint64_t total;
41 uint32_t ihv[5];
42 unsigned char buffer[64];
43 int bigendian;
44
+2 -2
--- src/smtp.c
+++ src/smtp.c
@@ -19,12 +19,12 @@
1919
** to RFC 5321.
2020
*/
2121
#include "config.h"
2222
#include "smtp.h"
2323
#include <assert.h>
24
-#if (HAVE_DN_EXPAND || HAVE___NS_NAME_UNCOMPRESS || HAVE_NS_NAME_UNCOMPRESS) && \
25
- (HAVE_NS_PARSERR || HAVE___NS_PARSERR) && !defined(FOSSIL_OMIT_DNS)
24
+#if (HAVE_DN_EXPAND || HAVE___NS_NAME_UNCOMPRESS || HAVE_NS_NAME_UNCOMPRESS) \
25
+ && (HAVE_NS_PARSERR || HAVE___NS_PARSERR) && !defined(FOSSIL_OMIT_DNS)
2626
# include <sys/types.h>
2727
# include <netinet/in.h>
2828
# if defined(HAVE_BIND_RESOLV_H)
2929
# include <bind/resolv.h>
3030
# include <bind/arpa/nameser_compat.h>
3131
--- src/smtp.c
+++ src/smtp.c
@@ -19,12 +19,12 @@
19 ** to RFC 5321.
20 */
21 #include "config.h"
22 #include "smtp.h"
23 #include <assert.h>
24 #if (HAVE_DN_EXPAND || HAVE___NS_NAME_UNCOMPRESS || HAVE_NS_NAME_UNCOMPRESS) && \
25 (HAVE_NS_PARSERR || HAVE___NS_PARSERR) && !defined(FOSSIL_OMIT_DNS)
26 # include <sys/types.h>
27 # include <netinet/in.h>
28 # if defined(HAVE_BIND_RESOLV_H)
29 # include <bind/resolv.h>
30 # include <bind/arpa/nameser_compat.h>
31
--- src/smtp.c
+++ src/smtp.c
@@ -19,12 +19,12 @@
19 ** to RFC 5321.
20 */
21 #include "config.h"
22 #include "smtp.h"
23 #include <assert.h>
24 #if (HAVE_DN_EXPAND || HAVE___NS_NAME_UNCOMPRESS || HAVE_NS_NAME_UNCOMPRESS) \
25 && (HAVE_NS_PARSERR || HAVE___NS_PARSERR) && !defined(FOSSIL_OMIT_DNS)
26 # include <sys/types.h>
27 # include <netinet/in.h>
28 # if defined(HAVE_BIND_RESOLV_H)
29 # include <bind/resolv.h>
30 # include <bind/arpa/nameser_compat.h>
31
+2 -2
--- src/style.c
+++ src/style.c
@@ -795,12 +795,12 @@
795795
}
796796
Th_MaybeStore("current_feature", feature_from_page_path(local_zCurrentPage) );
797797
if( g.ftntsIssues[0] || g.ftntsIssues[1] ||
798798
g.ftntsIssues[2] || g.ftntsIssues[3] ){
799799
char buf[80];
800
- sqlite3_snprintf(sizeof(buf),buf,"%i %i %i %i",g.ftntsIssues[0],g.ftntsIssues[1],
801
- g.ftntsIssues[2],g.ftntsIssues[3]);
800
+ sqlite3_snprintf(sizeof(buf), buf, "%i %i %i %i", g.ftntsIssues[0],
801
+ g.ftntsIssues[1], g.ftntsIssues[2], g.ftntsIssues[3]);
802802
Th_Store("footnotes_issues_counters", buf);
803803
}
804804
}
805805
806806
/*
807807
--- src/style.c
+++ src/style.c
@@ -795,12 +795,12 @@
795 }
796 Th_MaybeStore("current_feature", feature_from_page_path(local_zCurrentPage) );
797 if( g.ftntsIssues[0] || g.ftntsIssues[1] ||
798 g.ftntsIssues[2] || g.ftntsIssues[3] ){
799 char buf[80];
800 sqlite3_snprintf(sizeof(buf),buf,"%i %i %i %i",g.ftntsIssues[0],g.ftntsIssues[1],
801 g.ftntsIssues[2],g.ftntsIssues[3]);
802 Th_Store("footnotes_issues_counters", buf);
803 }
804 }
805
806 /*
807
--- src/style.c
+++ src/style.c
@@ -795,12 +795,12 @@
795 }
796 Th_MaybeStore("current_feature", feature_from_page_path(local_zCurrentPage) );
797 if( g.ftntsIssues[0] || g.ftntsIssues[1] ||
798 g.ftntsIssues[2] || g.ftntsIssues[3] ){
799 char buf[80];
800 sqlite3_snprintf(sizeof(buf), buf, "%i %i %i %i", g.ftntsIssues[0],
801 g.ftntsIssues[1], g.ftntsIssues[2], g.ftntsIssues[3]);
802 Th_Store("footnotes_issues_counters", buf);
803 }
804 }
805
806 /*
807
+2 -1
--- src/tar.c
+++ src/tar.c
@@ -244,11 +244,12 @@
244244
/* adding the length extended the length field? */
245245
if(blen > next10){
246246
blen++;
247247
}
248248
/* build the string */
249
- blob_appendf(&tball.pax, "%d %s=%*.*s\n", blen, zField, nValue, nValue, zValue);
249
+ blob_appendf(&tball.pax, "%d %s=%*.*s\n",
250
+ blen, zField, nValue, nValue, zValue);
250251
/* this _must_ be right */
251252
if((int)blob_size(&tball.pax) != blen){
252253
fossil_panic("internal error: PAX tar header has bad length");
253254
}
254255
}
255256
--- src/tar.c
+++ src/tar.c
@@ -244,11 +244,12 @@
244 /* adding the length extended the length field? */
245 if(blen > next10){
246 blen++;
247 }
248 /* build the string */
249 blob_appendf(&tball.pax, "%d %s=%*.*s\n", blen, zField, nValue, nValue, zValue);
 
250 /* this _must_ be right */
251 if((int)blob_size(&tball.pax) != blen){
252 fossil_panic("internal error: PAX tar header has bad length");
253 }
254 }
255
--- src/tar.c
+++ src/tar.c
@@ -244,11 +244,12 @@
244 /* adding the length extended the length field? */
245 if(blen > next10){
246 blen++;
247 }
248 /* build the string */
249 blob_appendf(&tball.pax, "%d %s=%*.*s\n",
250 blen, zField, nValue, nValue, zValue);
251 /* this _must_ be right */
252 if((int)blob_size(&tball.pax) != blen){
253 fossil_panic("internal error: PAX tar header has bad length");
254 }
255 }
256
+2 -1
--- src/th_main.c
+++ src/th_main.c
@@ -31,11 +31,12 @@
3131
#define TH_INIT_NEED_CONFIG ((u32)0x00000001) /* Open configuration first? */
3232
#define TH_INIT_FORCE_TCL ((u32)0x00000002) /* Force Tcl to be enabled? */
3333
#define TH_INIT_FORCE_RESET ((u32)0x00000004) /* Force TH1 commands re-added? */
3434
#define TH_INIT_FORCE_SETUP ((u32)0x00000008) /* Force eval of setup script? */
3535
#define TH_INIT_NO_REPO ((u32)0x00000010) /* Skip opening repository. */
36
-#define TH_INIT_NO_ENCODE ((u32)0x00000020) /* Do not html-encode sendText() output. */
36
+#define TH_INIT_NO_ENCODE ((u32)0x00000020) /* Do not html-encode sendText()*/
37
+ /* output. */
3738
#define TH_INIT_MASK ((u32)0x0000003F) /* All possible init flags. */
3839
3940
/*
4041
** Useful and/or "well-known" combinations of flag values.
4142
*/
4243
--- src/th_main.c
+++ src/th_main.c
@@ -31,11 +31,12 @@
31 #define TH_INIT_NEED_CONFIG ((u32)0x00000001) /* Open configuration first? */
32 #define TH_INIT_FORCE_TCL ((u32)0x00000002) /* Force Tcl to be enabled? */
33 #define TH_INIT_FORCE_RESET ((u32)0x00000004) /* Force TH1 commands re-added? */
34 #define TH_INIT_FORCE_SETUP ((u32)0x00000008) /* Force eval of setup script? */
35 #define TH_INIT_NO_REPO ((u32)0x00000010) /* Skip opening repository. */
36 #define TH_INIT_NO_ENCODE ((u32)0x00000020) /* Do not html-encode sendText() output. */
 
37 #define TH_INIT_MASK ((u32)0x0000003F) /* All possible init flags. */
38
39 /*
40 ** Useful and/or "well-known" combinations of flag values.
41 */
42
--- src/th_main.c
+++ src/th_main.c
@@ -31,11 +31,12 @@
31 #define TH_INIT_NEED_CONFIG ((u32)0x00000001) /* Open configuration first? */
32 #define TH_INIT_FORCE_TCL ((u32)0x00000002) /* Force Tcl to be enabled? */
33 #define TH_INIT_FORCE_RESET ((u32)0x00000004) /* Force TH1 commands re-added? */
34 #define TH_INIT_FORCE_SETUP ((u32)0x00000008) /* Force eval of setup script? */
35 #define TH_INIT_NO_REPO ((u32)0x00000010) /* Skip opening repository. */
36 #define TH_INIT_NO_ENCODE ((u32)0x00000020) /* Do not html-encode sendText()*/
37 /* output. */
38 #define TH_INIT_MASK ((u32)0x0000003F) /* All possible init flags. */
39
40 /*
41 ** Useful and/or "well-known" combinations of flag values.
42 */
43
+6 -3
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -1164,18 +1164,20 @@
11641164
return TH_ERROR;
11651165
}
11661166
tclContext->interp = tclInterp;
11671167
if( Tcl_Init(tclInterp)!=TCL_OK ){
11681168
Th_ErrorMessage(interp,
1169
- "Tcl initialization error:", Tcl_GetString(Tcl_GetObjResult(tclInterp)), -1);
1169
+ "Tcl initialization error:",
1170
+ Tcl_GetString(Tcl_GetObjResult(tclInterp)), -1);
11701171
Tcl_DeleteInterp(tclInterp);
11711172
tclContext->interp = tclInterp = 0;
11721173
return TH_ERROR;
11731174
}
11741175
if( setTclArguments(tclInterp, argc, argv)!=TCL_OK ){
11751176
Th_ErrorMessage(interp,
1176
- "Tcl error setting arguments:", Tcl_GetString(Tcl_GetObjResult(tclInterp)), -1);
1177
+ "Tcl error setting arguments:",
1178
+ Tcl_GetString(Tcl_GetObjResult(tclInterp)), -1);
11771179
Tcl_DeleteInterp(tclInterp);
11781180
tclContext->interp = tclInterp = 0;
11791181
return TH_ERROR;
11801182
}
11811183
/*
@@ -1194,11 +1196,12 @@
11941196
Tcl_CreateObjCommand(tclInterp, "th1Expr", Th1ExprObjCmd, interp, NULL);
11951197
/* If necessary, evaluate the custom Tcl setup script. */
11961198
setup = tclContext->setup;
11971199
if( setup && Tcl_EvalEx(tclInterp, setup, -1, 0)!=TCL_OK ){
11981200
Th_ErrorMessage(interp,
1199
- "Tcl setup script error:", Tcl_GetString(Tcl_GetObjResult(tclInterp)), -1);
1201
+ "Tcl setup script error:",
1202
+ Tcl_GetString(Tcl_GetObjResult(tclInterp)), -1);
12001203
Tcl_DeleteInterp(tclInterp);
12011204
tclContext->interp = tclInterp = 0;
12021205
return TH_ERROR;
12031206
}
12041207
return TH_OK;
12051208
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -1164,18 +1164,20 @@
1164 return TH_ERROR;
1165 }
1166 tclContext->interp = tclInterp;
1167 if( Tcl_Init(tclInterp)!=TCL_OK ){
1168 Th_ErrorMessage(interp,
1169 "Tcl initialization error:", Tcl_GetString(Tcl_GetObjResult(tclInterp)), -1);
 
1170 Tcl_DeleteInterp(tclInterp);
1171 tclContext->interp = tclInterp = 0;
1172 return TH_ERROR;
1173 }
1174 if( setTclArguments(tclInterp, argc, argv)!=TCL_OK ){
1175 Th_ErrorMessage(interp,
1176 "Tcl error setting arguments:", Tcl_GetString(Tcl_GetObjResult(tclInterp)), -1);
 
1177 Tcl_DeleteInterp(tclInterp);
1178 tclContext->interp = tclInterp = 0;
1179 return TH_ERROR;
1180 }
1181 /*
@@ -1194,11 +1196,12 @@
1194 Tcl_CreateObjCommand(tclInterp, "th1Expr", Th1ExprObjCmd, interp, NULL);
1195 /* If necessary, evaluate the custom Tcl setup script. */
1196 setup = tclContext->setup;
1197 if( setup && Tcl_EvalEx(tclInterp, setup, -1, 0)!=TCL_OK ){
1198 Th_ErrorMessage(interp,
1199 "Tcl setup script error:", Tcl_GetString(Tcl_GetObjResult(tclInterp)), -1);
 
1200 Tcl_DeleteInterp(tclInterp);
1201 tclContext->interp = tclInterp = 0;
1202 return TH_ERROR;
1203 }
1204 return TH_OK;
1205
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -1164,18 +1164,20 @@
1164 return TH_ERROR;
1165 }
1166 tclContext->interp = tclInterp;
1167 if( Tcl_Init(tclInterp)!=TCL_OK ){
1168 Th_ErrorMessage(interp,
1169 "Tcl initialization error:",
1170 Tcl_GetString(Tcl_GetObjResult(tclInterp)), -1);
1171 Tcl_DeleteInterp(tclInterp);
1172 tclContext->interp = tclInterp = 0;
1173 return TH_ERROR;
1174 }
1175 if( setTclArguments(tclInterp, argc, argv)!=TCL_OK ){
1176 Th_ErrorMessage(interp,
1177 "Tcl error setting arguments:",
1178 Tcl_GetString(Tcl_GetObjResult(tclInterp)), -1);
1179 Tcl_DeleteInterp(tclInterp);
1180 tclContext->interp = tclInterp = 0;
1181 return TH_ERROR;
1182 }
1183 /*
@@ -1194,11 +1196,12 @@
1196 Tcl_CreateObjCommand(tclInterp, "th1Expr", Th1ExprObjCmd, interp, NULL);
1197 /* If necessary, evaluate the custom Tcl setup script. */
1198 setup = tclContext->setup;
1199 if( setup && Tcl_EvalEx(tclInterp, setup, -1, 0)!=TCL_OK ){
1200 Th_ErrorMessage(interp,
1201 "Tcl setup script error:",
1202 Tcl_GetString(Tcl_GetObjResult(tclInterp)), -1);
1203 Tcl_DeleteInterp(tclInterp);
1204 tclContext->interp = tclInterp = 0;
1205 return TH_ERROR;
1206 }
1207 return TH_OK;
1208
+11 -7
--- src/timeline.c
+++ src/timeline.c
@@ -3017,24 +3017,27 @@
30173017
** 8. event-type: 'ci', 'w', 't', 'f', and so forth.
30183018
** 9. comment
30193019
** 10. user
30203020
** 11. tags
30213021
*/
3022
-void print_timeline(Stmt *q, int nLimit, int width, const char *zFormat, int verboseFlag){
3022
+void print_timeline(Stmt *q, int nLimit, int width, const char *zFormat,
3023
+ int verboseFlag){
30233024
int nAbsLimit = (nLimit >= 0) ? nLimit : -nLimit;
30243025
int nLine = 0;
30253026
int nEntry = 0;
30263027
char zPrevDate[20];
30273028
const char *zCurrentUuid = 0;
30283029
int fchngQueryInit = 0; /* True if fchngQuery is initialized */
30293030
Stmt fchngQuery; /* Query for file changes on check-ins */
30303031
int rc;
30313032
/* True: separate entries with a newline after file listing */
3032
- int bVerboseNL = (zFormat && (fossil_strcmp(zFormat, TIMELINE_FMT_ONELINE)!=0));
3033
+ int bVerboseNL = (zFormat &&
3034
+ (fossil_strcmp(zFormat, TIMELINE_FMT_ONELINE)!=0));
30333035
/* True: separate entries with a newline even with no file listing */
3034
- int bNoVerboseNL = (zFormat && (fossil_strcmp(zFormat, TIMELINE_FMT_MEDIUM)==0 ||
3035
- fossil_strcmp(zFormat, TIMELINE_FMT_FULL)==0));
3036
+ int bNoVerboseNL = (zFormat &&
3037
+ (fossil_strcmp(zFormat, TIMELINE_FMT_MEDIUM)==0 ||
3038
+ fossil_strcmp(zFormat, TIMELINE_FMT_FULL)==0));
30363039
30373040
zPrevDate[0] = 0;
30383041
if( g.localOpen ){
30393042
int rid = db_lget_int("checkout", 0);
30403043
zCurrentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
@@ -3122,12 +3125,13 @@
31223125
char *zEntry;
31233126
int nEntryLine = 0;
31243127
if( nChild==0 ){
31253128
sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*LEAF* ");
31263129
}
3127
- zEntry = timeline_entry_subst(zFormat, &nEntryLine, zId, zDate, zUserShort,
3128
- zComShort, zBranch, zTags, zPrefix);
3130
+ zEntry = timeline_entry_subst(zFormat, &nEntryLine, zId, zDate,
3131
+ zUserShort, zComShort, zBranch, zTags,
3132
+ zPrefix);
31293133
nLine += nEntryLine;
31303134
fossil_print("%s\n", zEntry);
31313135
fossil_free(zEntry);
31323136
}
31333137
else{
@@ -3280,11 +3284,11 @@
32803284
** %% a raw %
32813285
** %H commit hash
32823286
** %h abbreviated commit hash
32833287
** %a author name
32843288
** %d date
3285
-** %c comment (NL, TAB replaced by space, LF deleted)
3289
+** %c comment (NL, TAB replaced by space, LF erased)
32863290
** %b branch
32873291
** %t tags
32883292
** %p phase: zero or more of *CURRENT*, *MERGE*,
32893293
** *FORK*, *UNPUBLISHED*, *LEAF*, *BRANCH*
32903294
** --oneline Show only short hash and comment for each entry
32913295
--- src/timeline.c
+++ src/timeline.c
@@ -3017,24 +3017,27 @@
3017 ** 8. event-type: 'ci', 'w', 't', 'f', and so forth.
3018 ** 9. comment
3019 ** 10. user
3020 ** 11. tags
3021 */
3022 void print_timeline(Stmt *q, int nLimit, int width, const char *zFormat, int verboseFlag){
 
3023 int nAbsLimit = (nLimit >= 0) ? nLimit : -nLimit;
3024 int nLine = 0;
3025 int nEntry = 0;
3026 char zPrevDate[20];
3027 const char *zCurrentUuid = 0;
3028 int fchngQueryInit = 0; /* True if fchngQuery is initialized */
3029 Stmt fchngQuery; /* Query for file changes on check-ins */
3030 int rc;
3031 /* True: separate entries with a newline after file listing */
3032 int bVerboseNL = (zFormat && (fossil_strcmp(zFormat, TIMELINE_FMT_ONELINE)!=0));
 
3033 /* True: separate entries with a newline even with no file listing */
3034 int bNoVerboseNL = (zFormat && (fossil_strcmp(zFormat, TIMELINE_FMT_MEDIUM)==0 ||
3035 fossil_strcmp(zFormat, TIMELINE_FMT_FULL)==0));
 
3036
3037 zPrevDate[0] = 0;
3038 if( g.localOpen ){
3039 int rid = db_lget_int("checkout", 0);
3040 zCurrentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
@@ -3122,12 +3125,13 @@
3122 char *zEntry;
3123 int nEntryLine = 0;
3124 if( nChild==0 ){
3125 sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*LEAF* ");
3126 }
3127 zEntry = timeline_entry_subst(zFormat, &nEntryLine, zId, zDate, zUserShort,
3128 zComShort, zBranch, zTags, zPrefix);
 
3129 nLine += nEntryLine;
3130 fossil_print("%s\n", zEntry);
3131 fossil_free(zEntry);
3132 }
3133 else{
@@ -3280,11 +3284,11 @@
3280 ** %% a raw %
3281 ** %H commit hash
3282 ** %h abbreviated commit hash
3283 ** %a author name
3284 ** %d date
3285 ** %c comment (NL, TAB replaced by space, LF deleted)
3286 ** %b branch
3287 ** %t tags
3288 ** %p phase: zero or more of *CURRENT*, *MERGE*,
3289 ** *FORK*, *UNPUBLISHED*, *LEAF*, *BRANCH*
3290 ** --oneline Show only short hash and comment for each entry
3291
--- src/timeline.c
+++ src/timeline.c
@@ -3017,24 +3017,27 @@
3017 ** 8. event-type: 'ci', 'w', 't', 'f', and so forth.
3018 ** 9. comment
3019 ** 10. user
3020 ** 11. tags
3021 */
3022 void print_timeline(Stmt *q, int nLimit, int width, const char *zFormat,
3023 int verboseFlag){
3024 int nAbsLimit = (nLimit >= 0) ? nLimit : -nLimit;
3025 int nLine = 0;
3026 int nEntry = 0;
3027 char zPrevDate[20];
3028 const char *zCurrentUuid = 0;
3029 int fchngQueryInit = 0; /* True if fchngQuery is initialized */
3030 Stmt fchngQuery; /* Query for file changes on check-ins */
3031 int rc;
3032 /* True: separate entries with a newline after file listing */
3033 int bVerboseNL = (zFormat &&
3034 (fossil_strcmp(zFormat, TIMELINE_FMT_ONELINE)!=0));
3035 /* True: separate entries with a newline even with no file listing */
3036 int bNoVerboseNL = (zFormat &&
3037 (fossil_strcmp(zFormat, TIMELINE_FMT_MEDIUM)==0 ||
3038 fossil_strcmp(zFormat, TIMELINE_FMT_FULL)==0));
3039
3040 zPrevDate[0] = 0;
3041 if( g.localOpen ){
3042 int rid = db_lget_int("checkout", 0);
3043 zCurrentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
@@ -3122,12 +3125,13 @@
3125 char *zEntry;
3126 int nEntryLine = 0;
3127 if( nChild==0 ){
3128 sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*LEAF* ");
3129 }
3130 zEntry = timeline_entry_subst(zFormat, &nEntryLine, zId, zDate,
3131 zUserShort, zComShort, zBranch, zTags,
3132 zPrefix);
3133 nLine += nEntryLine;
3134 fossil_print("%s\n", zEntry);
3135 fossil_free(zEntry);
3136 }
3137 else{
@@ -3280,11 +3284,11 @@
3284 ** %% a raw %
3285 ** %H commit hash
3286 ** %h abbreviated commit hash
3287 ** %a author name
3288 ** %d date
3289 ** %c comment (NL, TAB replaced by space, LF erased)
3290 ** %b branch
3291 ** %t tags
3292 ** %p phase: zero or more of *CURRENT*, *MERGE*,
3293 ** *FORK*, *UNPUBLISHED*, *LEAF*, *BRANCH*
3294 ** --oneline Show only short hash and comment for each entry
3295
+2 -1
--- src/unicode.c
+++ src/unicode.c
@@ -240,11 +240,12 @@
240240
iHi = iTest-1;
241241
}
242242
}
243243
assert( key>=aDia[iRes] );
244244
if( bComplex==0 && (aChar[iRes] & 0x80) ) return c;
245
- return (c > (aDia[iRes]>>3) + (aDia[iRes]&0x07)) ? c : ((int)aChar[iRes] & 0x7F);
245
+ return (c > (aDia[iRes]>>3) + (aDia[iRes]&0x07)) ? c :
246
+ ((int)aChar[iRes] & 0x7F);
246247
}
247248
248249
249250
/*
250251
** Return true if the argument interpreted as a unicode codepoint
251252
--- src/unicode.c
+++ src/unicode.c
@@ -240,11 +240,12 @@
240 iHi = iTest-1;
241 }
242 }
243 assert( key>=aDia[iRes] );
244 if( bComplex==0 && (aChar[iRes] & 0x80) ) return c;
245 return (c > (aDia[iRes]>>3) + (aDia[iRes]&0x07)) ? c : ((int)aChar[iRes] & 0x7F);
 
246 }
247
248
249 /*
250 ** Return true if the argument interpreted as a unicode codepoint
251
--- src/unicode.c
+++ src/unicode.c
@@ -240,11 +240,12 @@
240 iHi = iTest-1;
241 }
242 }
243 assert( key>=aDia[iRes] );
244 if( bComplex==0 && (aChar[iRes] & 0x80) ) return c;
245 return (c > (aDia[iRes]>>3) + (aDia[iRes]&0x07)) ? c :
246 ((int)aChar[iRes] & 0x7F);
247 }
248
249
250 /*
251 ** Return true if the argument interpreted as a unicode codepoint
252
+2 -1
--- src/user.c
+++ src/user.c
@@ -399,11 +399,12 @@
399399
db_lset("default-user", g.argv[3]);
400400
}else{
401401
db_set("default-user", g.argv[3], 0);
402402
}
403403
}
404
- }else if(( n>=2 && strncmp(g.argv[2],"list",n)==0 ) || ( n>=2 && strncmp(g.argv[2],"ls",n)==0 )){
404
+ }else if(( n>=2 && strncmp(g.argv[2],"list",n)==0 ) ||
405
+ ( n>=2 && strncmp(g.argv[2],"ls",n)==0 )){
405406
Stmt q;
406407
db_prepare(&q, "SELECT login, info FROM user ORDER BY login");
407408
while( db_step(&q)==SQLITE_ROW ){
408409
fossil_print("%-12s %s\n", db_column_text(&q, 0), db_column_text(&q, 1));
409410
}
410411
--- src/user.c
+++ src/user.c
@@ -399,11 +399,12 @@
399 db_lset("default-user", g.argv[3]);
400 }else{
401 db_set("default-user", g.argv[3], 0);
402 }
403 }
404 }else if(( n>=2 && strncmp(g.argv[2],"list",n)==0 ) || ( n>=2 && strncmp(g.argv[2],"ls",n)==0 )){
 
405 Stmt q;
406 db_prepare(&q, "SELECT login, info FROM user ORDER BY login");
407 while( db_step(&q)==SQLITE_ROW ){
408 fossil_print("%-12s %s\n", db_column_text(&q, 0), db_column_text(&q, 1));
409 }
410
--- src/user.c
+++ src/user.c
@@ -399,11 +399,12 @@
399 db_lset("default-user", g.argv[3]);
400 }else{
401 db_set("default-user", g.argv[3], 0);
402 }
403 }
404 }else if(( n>=2 && strncmp(g.argv[2],"list",n)==0 ) ||
405 ( n>=2 && strncmp(g.argv[2],"ls",n)==0 )){
406 Stmt q;
407 db_prepare(&q, "SELECT login, info FROM user ORDER BY login");
408 while( db_step(&q)==SQLITE_ROW ){
409 fossil_print("%-12s %s\n", db_column_text(&q, 0), db_column_text(&q, 1));
410 }
411
+3 -2
--- src/vfile.c
+++ src/vfile.c
@@ -410,11 +410,12 @@
410410
};
411411
int i, j, n;
412412
413413
if( sqlite3_strglob("ci-comment-????????????.txt", zName)==0 ) return 1;
414414
for(; zName[0]!=0; zName++){
415
- if( zName[0]=='/' && sqlite3_strglob("/ci-comment-????????????.txt", zName)==0 ){
415
+ if( zName[0]=='/'
416
+ && sqlite3_strglob("/ci-comment-????????????.txt", zName)==0 ){
416417
return 1;
417418
}
418419
if( zName[0]!='-' ) continue;
419420
for(i=0; i<count(azTemp); i++){
420421
n = (int)strlen(azTemp[i]);
@@ -754,11 +755,11 @@
754755
}
755756
fseek(in, 0L, SEEK_END);
756757
sqlite3_snprintf(sizeof(zBuf), zBuf, " %ld\n", ftell(in));
757758
fseek(in, 0L, SEEK_SET);
758759
md5sum_step_text(zBuf, -1);
759
- /*printf("%s %s %s",md5sum_current_state(),zName,zBuf); fflush(stdout);*/
760
+ /*printf("%s %s %s",md5sum_current_state(),zName,zBuf);fflush(stdout);*/
760761
for(;;){
761762
int n;
762763
n = fread(zBuf, 1, sizeof(zBuf), in);
763764
if( n<=0 ) break;
764765
md5sum_step_text(zBuf, n);
765766
--- src/vfile.c
+++ src/vfile.c
@@ -410,11 +410,12 @@
410 };
411 int i, j, n;
412
413 if( sqlite3_strglob("ci-comment-????????????.txt", zName)==0 ) return 1;
414 for(; zName[0]!=0; zName++){
415 if( zName[0]=='/' && sqlite3_strglob("/ci-comment-????????????.txt", zName)==0 ){
 
416 return 1;
417 }
418 if( zName[0]!='-' ) continue;
419 for(i=0; i<count(azTemp); i++){
420 n = (int)strlen(azTemp[i]);
@@ -754,11 +755,11 @@
754 }
755 fseek(in, 0L, SEEK_END);
756 sqlite3_snprintf(sizeof(zBuf), zBuf, " %ld\n", ftell(in));
757 fseek(in, 0L, SEEK_SET);
758 md5sum_step_text(zBuf, -1);
759 /*printf("%s %s %s",md5sum_current_state(),zName,zBuf); fflush(stdout);*/
760 for(;;){
761 int n;
762 n = fread(zBuf, 1, sizeof(zBuf), in);
763 if( n<=0 ) break;
764 md5sum_step_text(zBuf, n);
765
--- src/vfile.c
+++ src/vfile.c
@@ -410,11 +410,12 @@
410 };
411 int i, j, n;
412
413 if( sqlite3_strglob("ci-comment-????????????.txt", zName)==0 ) return 1;
414 for(; zName[0]!=0; zName++){
415 if( zName[0]=='/'
416 && sqlite3_strglob("/ci-comment-????????????.txt", zName)==0 ){
417 return 1;
418 }
419 if( zName[0]!='-' ) continue;
420 for(i=0; i<count(azTemp); i++){
421 n = (int)strlen(azTemp[i]);
@@ -754,11 +755,11 @@
755 }
756 fseek(in, 0L, SEEK_END);
757 sqlite3_snprintf(sizeof(zBuf), zBuf, " %ld\n", ftell(in));
758 fseek(in, 0L, SEEK_SET);
759 md5sum_step_text(zBuf, -1);
760 /*printf("%s %s %s",md5sum_current_state(),zName,zBuf);fflush(stdout);*/
761 for(;;){
762 int n;
763 n = fread(zBuf, 1, sizeof(zBuf), in);
764 if( n<=0 ) break;
765 md5sum_step_text(zBuf, n);
766
+2 -1
--- src/wiki.c
+++ src/wiki.c
@@ -469,11 +469,12 @@
469469
zPageName += 8;
470470
if( zExtra[0]==0 && !P("p") ){
471471
cgi_redirectf("%R/info/%s",zPageName);
472472
}else{
473473
style_header("Notes About Check-in %S", zPageName);
474
- style_submenu_element("Check-in Timeline","%R/timeline?f=%s", zPageName);
474
+ style_submenu_element("Check-in Timeline","%R/timeline?f=%s",
475
+ zPageName);
475476
style_submenu_element("Check-in Info","%R/info/%s", zPageName);
476477
}
477478
break;
478479
}
479480
case WIKITYPE_BRANCH: {
480481
--- src/wiki.c
+++ src/wiki.c
@@ -469,11 +469,12 @@
469 zPageName += 8;
470 if( zExtra[0]==0 && !P("p") ){
471 cgi_redirectf("%R/info/%s",zPageName);
472 }else{
473 style_header("Notes About Check-in %S", zPageName);
474 style_submenu_element("Check-in Timeline","%R/timeline?f=%s", zPageName);
 
475 style_submenu_element("Check-in Info","%R/info/%s", zPageName);
476 }
477 break;
478 }
479 case WIKITYPE_BRANCH: {
480
--- src/wiki.c
+++ src/wiki.c
@@ -469,11 +469,12 @@
469 zPageName += 8;
470 if( zExtra[0]==0 && !P("p") ){
471 cgi_redirectf("%R/info/%s",zPageName);
472 }else{
473 style_header("Notes About Check-in %S", zPageName);
474 style_submenu_element("Check-in Timeline","%R/timeline?f=%s",
475 zPageName);
476 style_submenu_element("Check-in Info","%R/info/%s", zPageName);
477 }
478 break;
479 }
480 case WIKITYPE_BRANCH: {
481
+1 -1
--- src/xfer.c
+++ src/xfer.c
@@ -355,11 +355,11 @@
355355
nullContent = 1;
356356
}
357357
358358
/* The isWriter flag must be true in order to land the new file */
359359
if( !isWriter ){
360
- blob_appendf(&pXfer->err, "Write permissions for unversioned files missing");
360
+ blob_appendf(&pXfer->err,"Write permissions for unversioned files missing");
361361
goto end_accept_unversioned_file;
362362
}
363363
364364
/* Make sure we have a valid g.rcvid marker */
365365
content_rcvid_init(0);
366366
--- src/xfer.c
+++ src/xfer.c
@@ -355,11 +355,11 @@
355 nullContent = 1;
356 }
357
358 /* The isWriter flag must be true in order to land the new file */
359 if( !isWriter ){
360 blob_appendf(&pXfer->err, "Write permissions for unversioned files missing");
361 goto end_accept_unversioned_file;
362 }
363
364 /* Make sure we have a valid g.rcvid marker */
365 content_rcvid_init(0);
366
--- src/xfer.c
+++ src/xfer.c
@@ -355,11 +355,11 @@
355 nullContent = 1;
356 }
357
358 /* The isWriter flag must be true in order to land the new file */
359 if( !isWriter ){
360 blob_appendf(&pXfer->err,"Write permissions for unversioned files missing");
361 goto end_accept_unversioned_file;
362 }
363
364 /* Make sure we have a valid g.rcvid marker */
365 content_rcvid_init(0);
366
--- tools/makeheaders.c
+++ tools/makeheaders.c
@@ -38,11 +38,12 @@
3838
#include <memory.h>
3939
#include <sys/stat.h>
4040
#include <assert.h>
4141
#include <string.h>
4242
43
-#if defined( __MINGW32__) || defined(__DMC__) || defined(_MSC_VER) || defined(__POCC__)
43
+#if defined( __MINGW32__) || defined(__DMC__) || \
44
+ defined(_MSC_VER) || defined(__POCC__)
4445
# ifndef WIN32
4546
# define WIN32
4647
# endif
4748
#else
4849
# include <unistd.h>
@@ -2226,11 +2227,12 @@
22262227
PushIfMacro(0,0,0,pToken->nLine,PS_Interface);
22272228
}else if( nArg==16 && strncmp(zArg,"EXPORT_INTERFACE",16)==0 ){
22282229
PushIfMacro(0,0,0,pToken->nLine,PS_Export);
22292230
}else if( nArg==15 && strncmp(zArg,"LOCAL_INTERFACE",15)==0 ){
22302231
PushIfMacro(0,0,0,pToken->nLine,PS_Local);
2231
- }else if( nArg==15 && strncmp(zArg,"MAKEHEADERS_STOPLOCAL_INTERFACE",15)==0 ){
2232
+ }else if( nArg==15 &&
2233
+ strncmp(zArg,"MAKEHEADERS_STOPLOCAL_INTERFACE",15)==0 ){
22322234
PushIfMacro(0,0,0,pToken->nLine,PS_Local);
22332235
}else{
22342236
PushIfMacro(0,zArg,nArg,pToken->nLine,0);
22352237
}
22362238
}else if( nCmd==5 && strncmp(zCmd,"ifdef",5)==0 ){
22372239
--- tools/makeheaders.c
+++ tools/makeheaders.c
@@ -38,11 +38,12 @@
38 #include <memory.h>
39 #include <sys/stat.h>
40 #include <assert.h>
41 #include <string.h>
42
43 #if defined( __MINGW32__) || defined(__DMC__) || defined(_MSC_VER) || defined(__POCC__)
 
44 # ifndef WIN32
45 # define WIN32
46 # endif
47 #else
48 # include <unistd.h>
@@ -2226,11 +2227,12 @@
2226 PushIfMacro(0,0,0,pToken->nLine,PS_Interface);
2227 }else if( nArg==16 && strncmp(zArg,"EXPORT_INTERFACE",16)==0 ){
2228 PushIfMacro(0,0,0,pToken->nLine,PS_Export);
2229 }else if( nArg==15 && strncmp(zArg,"LOCAL_INTERFACE",15)==0 ){
2230 PushIfMacro(0,0,0,pToken->nLine,PS_Local);
2231 }else if( nArg==15 && strncmp(zArg,"MAKEHEADERS_STOPLOCAL_INTERFACE",15)==0 ){
 
2232 PushIfMacro(0,0,0,pToken->nLine,PS_Local);
2233 }else{
2234 PushIfMacro(0,zArg,nArg,pToken->nLine,0);
2235 }
2236 }else if( nCmd==5 && strncmp(zCmd,"ifdef",5)==0 ){
2237
--- tools/makeheaders.c
+++ tools/makeheaders.c
@@ -38,11 +38,12 @@
38 #include <memory.h>
39 #include <sys/stat.h>
40 #include <assert.h>
41 #include <string.h>
42
43 #if defined( __MINGW32__) || defined(__DMC__) || \
44 defined(_MSC_VER) || defined(__POCC__)
45 # ifndef WIN32
46 # define WIN32
47 # endif
48 #else
49 # include <unistd.h>
@@ -2226,11 +2227,12 @@
2227 PushIfMacro(0,0,0,pToken->nLine,PS_Interface);
2228 }else if( nArg==16 && strncmp(zArg,"EXPORT_INTERFACE",16)==0 ){
2229 PushIfMacro(0,0,0,pToken->nLine,PS_Export);
2230 }else if( nArg==15 && strncmp(zArg,"LOCAL_INTERFACE",15)==0 ){
2231 PushIfMacro(0,0,0,pToken->nLine,PS_Local);
2232 }else if( nArg==15 &&
2233 strncmp(zArg,"MAKEHEADERS_STOPLOCAL_INTERFACE",15)==0 ){
2234 PushIfMacro(0,0,0,pToken->nLine,PS_Local);
2235 }else{
2236 PushIfMacro(0,zArg,nArg,pToken->nLine,0);
2237 }
2238 }else if( nCmd==5 && strncmp(zCmd,"ifdef",5)==0 ){
2239
--- tools/sqlcompattest.c
+++ tools/sqlcompattest.c
@@ -53,11 +53,12 @@
5353
5454
#define QUOTE(VAL) #VAL
5555
#define STR(MACRO_VAL) QUOTE(MACRO_VAL)
5656
5757
char zMinimumVersionNumber[8]="nn.nn.nn";
58
- strncpy((char *)&zMinimumVersionNumber,STR(MINIMUM_SQLITE_VERSION),sizeof(zMinimumVersionNumber));
58
+ strncpy((char *)&zMinimumVersionNumber,STR(MINIMUM_SQLITE_VERSION),
59
+ sizeof(zMinimumVersionNumber));
5960
6061
long major, minor, release, version;
6162
sscanf(zMinimumVersionNumber, "%li.%li.%li", &major, &minor, &release);
6263
version=(major*1000000)+(minor*1000)+release;
6364
@@ -67,11 +68,12 @@
6768
"ENABLE_DBSTAT_VTAB", /* Required by /repo-tabsize page */
6869
};
6970
7071
/* Check minimum SQLite version number */
7172
if( sqlite3_libversion_number()<version ){
72
- printf("found system SQLite version %s but need %s or later, consider removing --disable-internal-sqlite\n",
73
+ printf("found system SQLite version %s but need %s or later, "
74
+ "consider removing --disable-internal-sqlite\n",
7375
sqlite3_libversion(),STR(MINIMUM_SQLITE_VERSION));
7476
return 1;
7577
}
7678
7779
for(i=0; i<sizeof(zRequiredOpts)/sizeof(zRequiredOpts[0]); i++){
7880
--- tools/sqlcompattest.c
+++ tools/sqlcompattest.c
@@ -53,11 +53,12 @@
53
54 #define QUOTE(VAL) #VAL
55 #define STR(MACRO_VAL) QUOTE(MACRO_VAL)
56
57 char zMinimumVersionNumber[8]="nn.nn.nn";
58 strncpy((char *)&zMinimumVersionNumber,STR(MINIMUM_SQLITE_VERSION),sizeof(zMinimumVersionNumber));
 
59
60 long major, minor, release, version;
61 sscanf(zMinimumVersionNumber, "%li.%li.%li", &major, &minor, &release);
62 version=(major*1000000)+(minor*1000)+release;
63
@@ -67,11 +68,12 @@
67 "ENABLE_DBSTAT_VTAB", /* Required by /repo-tabsize page */
68 };
69
70 /* Check minimum SQLite version number */
71 if( sqlite3_libversion_number()<version ){
72 printf("found system SQLite version %s but need %s or later, consider removing --disable-internal-sqlite\n",
 
73 sqlite3_libversion(),STR(MINIMUM_SQLITE_VERSION));
74 return 1;
75 }
76
77 for(i=0; i<sizeof(zRequiredOpts)/sizeof(zRequiredOpts[0]); i++){
78
--- tools/sqlcompattest.c
+++ tools/sqlcompattest.c
@@ -53,11 +53,12 @@
53
54 #define QUOTE(VAL) #VAL
55 #define STR(MACRO_VAL) QUOTE(MACRO_VAL)
56
57 char zMinimumVersionNumber[8]="nn.nn.nn";
58 strncpy((char *)&zMinimumVersionNumber,STR(MINIMUM_SQLITE_VERSION),
59 sizeof(zMinimumVersionNumber));
60
61 long major, minor, release, version;
62 sscanf(zMinimumVersionNumber, "%li.%li.%li", &major, &minor, &release);
63 version=(major*1000000)+(minor*1000)+release;
64
@@ -67,11 +68,12 @@
68 "ENABLE_DBSTAT_VTAB", /* Required by /repo-tabsize page */
69 };
70
71 /* Check minimum SQLite version number */
72 if( sqlite3_libversion_number()<version ){
73 printf("found system SQLite version %s but need %s or later, "
74 "consider removing --disable-internal-sqlite\n",
75 sqlite3_libversion(),STR(MINIMUM_SQLITE_VERSION));
76 return 1;
77 }
78
79 for(i=0; i<sizeof(zRequiredOpts)/sizeof(zRequiredOpts[0]); i++){
80

Keyboard Shortcuts

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