Fossil SCM
Fix lines over 80 characters long, excluding external source files and @-lines.
Commit
942f691b3954056fd37c1536c0c40349794efae44e46236c9a980779261c0c07
Parent
9db696ea7879b81…
38 files changed
+2
-1
+2
-1
+2
-1
+3
-2
+2
-1
+2
-2
+2
-1
+1
-1
+1
-1
+48
-29
+9
-6
+2
-1
+2
-2
+15
-10
+4
-2
+2
-1
+20
-11
+2
-1
+11
-8
+1
-1
+2
-1
+3
-2
+2
-1
+9
-7
+2
-1
+2
-2
+2
-2
+2
-1
+2
-1
+6
-3
+11
-7
+2
-1
+2
-1
+3
-2
+2
-1
+1
-1
+4
-2
+4
-2
~
src/attach.c
~
src/branch.c
~
src/browse.c
~
src/db.c
~
src/diff.c
~
src/diffcmd.c
~
src/dispatch.c
~
src/file.c
~
src/fileedit.c
~
src/json.c
~
src/json_artifact.c
~
src/json_branch.c
~
src/json_config.c
~
src/json_finfo.c
~
src/json_login.c
~
src/json_tag.c
~
src/json_timeline.c
~
src/json_user.c
~
src/json_wiki.c
~
src/lookslike.c
~
src/markdown.c
~
src/rebuild.c
~
src/report.c
~
src/rss.c
~
src/sha1.c
~
src/smtp.c
~
src/style.c
~
src/tar.c
~
src/th_main.c
~
src/th_tcl.c
~
src/timeline.c
~
src/unicode.c
~
src/user.c
~
src/vfile.c
~
src/wiki.c
~
src/xfer.c
~
tools/makeheaders.c
~
tools/sqlcompattest.c
+2
-1
| --- src/attach.c | ||
| +++ src/attach.c | ||
| @@ -750,11 +750,12 @@ | ||
| 750 | 750 | } |
| 751 | 751 | if( zBody==0 ){ |
| 752 | 752 | fossil_fatal("technote [%s] not found",zETime); |
| 753 | 753 | } |
| 754 | 754 | 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')", | |
| 756 | 757 | rid |
| 757 | 758 | ); |
| 758 | 759 | zFile = g.argv[3]; |
| 759 | 760 | } |
| 760 | 761 | blob_read_from_file(&content, zFile, ExtFILE); |
| 761 | 762 |
| --- 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 @@ | ||
| 340 | 340 | ); |
| 341 | 341 | break; |
| 342 | 342 | } |
| 343 | 343 | case BRL_OPEN_ONLY: { |
| 344 | 344 | 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" | |
| 346 | 347 | ); |
| 347 | 348 | break; |
| 348 | 349 | } |
| 349 | 350 | } |
| 350 | 351 | if( brFlags & BRL_PRIVATE ) blob_append_sql(&sql, " AND isprivate"); |
| 351 | 352 |
| --- 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 @@ | ||
| 471 | 471 | FileTreeNode *pLastChild; /* Last child on the pChild list */ |
| 472 | 472 | char *zName; /* Name of this entry. The "tail" */ |
| 473 | 473 | char *zFullName; /* Full pathname of this entry */ |
| 474 | 474 | char *zUuid; /* Artifact hash of this file. May be NULL. */ |
| 475 | 475 | 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 */ | |
| 477 | 478 | int iSize; /* Size for this entry */ |
| 478 | 479 | unsigned nFullName; /* Length of zFullName */ |
| 479 | 480 | unsigned iLevel; /* Levels of parent directories */ |
| 480 | 481 | }; |
| 481 | 482 | |
| 482 | 483 |
| --- 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 |
M
src/db.c
+3
-2
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -2489,11 +2489,11 @@ | ||
| 2489 | 2489 | if( db_local_table_exists_but_lacks_column("undo_vfile", "islink") ){ |
| 2490 | 2490 | db_multi_exec("ALTER TABLE undo_vfile ADD COLUMN islink BOOL DEFAULT 0"); |
| 2491 | 2491 | } |
| 2492 | 2492 | } |
| 2493 | 2493 | |
| 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 | |
| 2495 | 2495 | ** column to vfile and vmerge and changing the UNIQUE index on vmerge into |
| 2496 | 2496 | ** a PRIMARY KEY that includes the new mhash column. However, we must have |
| 2497 | 2497 | ** the repository database at hand in order to do the migration, so that |
| 2498 | 2498 | ** step is deferred. */ |
| 2499 | 2499 | return 1; |
| @@ -3716,11 +3716,12 @@ | ||
| 3716 | 3716 | z = fossil_strdup(zDefault); |
| 3717 | 3717 | } |
| 3718 | 3718 | } |
| 3719 | 3719 | return z; |
| 3720 | 3720 | } |
| 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){ | |
| 3722 | 3723 | char *z = 0; |
| 3723 | 3724 | if( g.repositoryOpen ){ |
| 3724 | 3725 | z = db_text(0, "SELECT mtime FROM config WHERE name=%Q", zName); |
| 3725 | 3726 | } |
| 3726 | 3727 | if( z==0 ){ |
| 3727 | 3728 |
| --- 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 @@ | ||
| 3493 | 3493 | cnt++; |
| 3494 | 3494 | } |
| 3495 | 3495 | |
| 3496 | 3496 | if( p->nVers==0 ){ |
| 3497 | 3497 | 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); | |
| 3499 | 3500 | }else{ |
| 3500 | 3501 | fossil_fatal("no history for file: %s", zFilename); |
| 3501 | 3502 | } |
| 3502 | 3503 | } |
| 3503 | 3504 | |
| 3504 | 3505 |
| --- 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 @@ | ||
| 1250 | 1250 | ** --brief Show filenames only |
| 1251 | 1251 | ** -b|--browser Show the diff output in a web-browser |
| 1252 | 1252 | ** --by Shorthand for "--browser -y" |
| 1253 | 1253 | ** -ci|--checkin VERSION Show diff of all changes in VERSION |
| 1254 | 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 | |
| 1255 | +** -c|--context N Show N lines of context around each change, | |
| 1256 | +** with negative N meaning show all content | |
| 1257 | 1257 | ** --dark Use dark mode for the Tcl/Tk-based GUI and HTML |
| 1258 | 1258 | ** --diff-binary BOOL Include binary files with external commands |
| 1259 | 1259 | ** --exec-abs-paths Force absolute path names on external commands |
| 1260 | 1260 | ** --exec-rel-paths Force relative path names on external commands |
| 1261 | 1261 | ** -r|--from VERSION Select VERSION as source for the diff |
| 1262 | 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, 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 @@ | ||
| 897 | 897 | if( occHelp[aCommand[i].iHelp] > 1 ){ |
| 898 | 898 | int j; |
| 899 | 899 | int aliases[MX_HELP_DUP], nAliases=0; |
| 900 | 900 | for(j=0; j<occHelp[aCommand[i].iHelp]; j++){ |
| 901 | 901 | 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 ){ | |
| 903 | 904 | aliases[nAliases++] = bktHelp[aCommand[i].iHelp][j]; |
| 904 | 905 | } |
| 905 | 906 | } |
| 906 | 907 | } |
| 907 | 908 | if( nAliases>0 ){ |
| 908 | 909 |
| --- 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 @@ | ||
| 2245 | 2245 | ** Return non-NULL if zFilename contains pathname elements that |
| 2246 | 2246 | ** are reserved on Windows. The returned string is the disallowed |
| 2247 | 2247 | ** path element. |
| 2248 | 2248 | */ |
| 2249 | 2249 | 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" }; | |
| 2251 | 2251 | static char zReturn[5]; |
| 2252 | 2252 | int i; |
| 2253 | 2253 | while( zPath[0] ){ |
| 2254 | 2254 | for(i=0; i<count(azRes); i++){ |
| 2255 | 2255 | if( sqlite3_strnicmp(zPath, azRes[i], 3)==0 |
| 2256 | 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 |
| --- 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 @@ | ||
| 573 | 573 | /* Convert to the requested EOL style. Note that this inherently |
| 574 | 574 | ** runs a risk of breaking content, e.g. string literals which |
| 575 | 575 | ** contain embedded newlines. Note that HTML5 specifies that |
| 576 | 576 | ** form-submitted TEXTAREA content gets normalized to CRLF-style: |
| 577 | 577 | ** |
| 578 | - ** https://html.spec.whatwg.org/multipage/form-elements.html#the-textarea-element | |
| 578 | + ** https://html.spec.whatwg.org/#the-textarea-element | |
| 579 | 579 | */ |
| 580 | 580 | const int pseudoBinary = LOOK_LONG | LOOK_NUL; |
| 581 | 581 | const int lookFlags = LOOK_CRLF | LOOK_LONE_LF | pseudoBinary; |
| 582 | 582 | const int lookNew = looks_like_utf8( &pCI->fileContent, lookFlags ); |
| 583 | 583 | if(!(pseudoBinary & lookNew)){ |
| 584 | 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/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 @@ | ||
| 23 | 23 | ** https://fossil-scm.org/fossil/doc/trunk/www/json-api/index.md |
| 24 | 24 | ** |
| 25 | 25 | ** Notes for hackers... |
| 26 | 26 | ** |
| 27 | 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(). | |
| 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(). | |
| 30 | 31 | ** See the API docs for that typedef (below) for the semantics of the callbacks. |
| 31 | 32 | ** |
| 32 | 33 | ** |
| 33 | 34 | */ |
| 34 | 35 | #include "VERSION.h" |
| @@ -36,11 +37,12 @@ | ||
| 36 | 37 | #include "json.h" |
| 37 | 38 | #include <assert.h> |
| 38 | 39 | #include <time.h> |
| 39 | 40 | |
| 40 | 41 | #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 */ | |
| 42 | 44 | #endif |
| 43 | 45 | |
| 44 | 46 | const FossilJsonKeys_ FossilJsonKeys = { |
| 45 | 47 | "anonymousSeed" /*anonymousSeed*/, |
| 46 | 48 | "authToken" /*authToken*/, |
| @@ -176,11 +178,12 @@ | ||
| 176 | 178 | |
| 177 | 179 | /* |
| 178 | 180 | ** Convenience wrapper around cson_output() which appends the output |
| 179 | 181 | ** to pDest. pOpt may be NULL, in which case g.json.outOpt will be used. |
| 180 | 182 | */ |
| 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 ){ | |
| 182 | 185 | return cson_output( pVal, cson_data_dest_Blob, |
| 183 | 186 | pDest, pOpt ? pOpt : &g.json.outOpt ); |
| 184 | 187 | } |
| 185 | 188 | |
| 186 | 189 | /* |
| @@ -707,11 +710,12 @@ | ||
| 707 | 710 | the form: login_cookie_name()=... |
| 708 | 711 | |
| 709 | 712 | Then again, the hardened cookie value helps ensure that |
| 710 | 713 | only a proper key/value match is valid. |
| 711 | 714 | */ |
| 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) ); | |
| 713 | 717 | }else if( g.isHTTP ){ |
| 714 | 718 | /* try fossil's conventional cookie. */ |
| 715 | 719 | /* Reminder: chicken/egg scenario regarding db access in CLI |
| 716 | 720 | mode because login_cookie_name() needs the db. CLI |
| 717 | 721 | mode does not use any authentication, so we don't need |
| @@ -904,11 +908,12 @@ | ||
| 904 | 908 | memcpy(zPart, head, len); |
| 905 | 909 | zPart[len] = 0; |
| 906 | 910 | if(doDeHttp){ |
| 907 | 911 | dehttpize(zPart); |
| 908 | 912 | } |
| 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 */ | |
| 910 | 915 | part = cson_value_new_string(zPart, strlen(zPart)); |
| 911 | 916 | if( 0 != cson_array_append( target, part ) ){ |
| 912 | 917 | cson_value_free(part); |
| 913 | 918 | rc = -rc; |
| 914 | 919 | break; |
| @@ -1086,11 +1091,11 @@ | ||
| 1086 | 1091 | |
| 1087 | 1092 | /* g.json.reqPayload exists only to simplify some of our access to |
| 1088 | 1093 | the request payload. We currently only use this in the context of |
| 1089 | 1094 | Object payloads, not Arrays, strings, etc. |
| 1090 | 1095 | */ |
| 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 ); | |
| 1092 | 1097 | if( g.json.reqPayload.v ){ |
| 1093 | 1098 | g.json.reqPayload.o = cson_value_get_object( g.json.reqPayload.v ) |
| 1094 | 1099 | /* g.json.reqPayload.o may legally be NULL, which means only that |
| 1095 | 1100 | g.json.reqPayload.v is-not-a Object. |
| 1096 | 1101 | */; |
| @@ -1115,11 +1120,11 @@ | ||
| 1115 | 1120 | |
| 1116 | 1121 | if(!g.json.jsonp){ |
| 1117 | 1122 | g.json.jsonp = json_find_option_cstr("jsonp",NULL,NULL); |
| 1118 | 1123 | } |
| 1119 | 1124 | 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*/ | |
| 1121 | 1126 | } |
| 1122 | 1127 | |
| 1123 | 1128 | {/* set up JSON output formatting options. */ |
| 1124 | 1129 | int indent = -1; |
| 1125 | 1130 | indent = json_find_option_int("indent",NULL,"I",-1); |
| @@ -1166,11 +1171,11 @@ | ||
| 1166 | 1171 | ** |
| 1167 | 1172 | */ |
| 1168 | 1173 | char const * json_command_arg(unsigned short ndx){ |
| 1169 | 1174 | cson_array * ar = g.json.cmd.a; |
| 1170 | 1175 | 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."); | |
| 1172 | 1177 | if( g.json.cmd.offset < 0 ){ |
| 1173 | 1178 | /* first-time setup. */ |
| 1174 | 1179 | short i = 0; |
| 1175 | 1180 | #define NEXT cson_string_cstr( \ |
| 1176 | 1181 | cson_value_get_string( \ |
| @@ -1192,11 +1197,12 @@ | ||
| 1192 | 1197 | #undef NEXT |
| 1193 | 1198 | if(g.json.cmd.offset < 0){ |
| 1194 | 1199 | return NULL; |
| 1195 | 1200 | }else{ |
| 1196 | 1201 | 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 ))); | |
| 1198 | 1204 | } |
| 1199 | 1205 | } |
| 1200 | 1206 | |
| 1201 | 1207 | /* Returns the C-string form of json_auth_token(), or NULL |
| 1202 | 1208 | ** if json_auth_token() returns NULL. |
| @@ -1210,11 +1216,12 @@ | ||
| 1210 | 1216 | ** found. |
| 1211 | 1217 | ** |
| 1212 | 1218 | ** head must be a pointer to an array of JsonPageDefs in which the |
| 1213 | 1219 | ** last entry has a NULL name. |
| 1214 | 1220 | */ |
| 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 ){ | |
| 1216 | 1223 | JsonPageDef const * pageDef = head; |
| 1217 | 1224 | assert( head != NULL ); |
| 1218 | 1225 | if(name && *name) for( ; pageDef->name; ++pageDef ){ |
| 1219 | 1226 | if( 0 == strcmp(name, pageDef->name) ){ |
| 1220 | 1227 | return pageDef; |
| @@ -1292,14 +1299,16 @@ | ||
| 1292 | 1299 | if(!g.json.cmd.a){ |
| 1293 | 1300 | return NULL; |
| 1294 | 1301 | }else{ |
| 1295 | 1302 | cson_value * rc = NULL; |
| 1296 | 1303 | 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);*/ | |
| 1298 | 1306 | unsigned int i = 1; |
| 1299 | 1307 | 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))); | |
| 1301 | 1310 | if(!part){ |
| 1302 | 1311 | #if 1 |
| 1303 | 1312 | fossil_warning("Iterating further than expected in %s.", |
| 1304 | 1313 | __FILE__); |
| 1305 | 1314 | #endif |
| @@ -1329,11 +1338,12 @@ | ||
| 1329 | 1338 | cson_object * o = NULL; |
| 1330 | 1339 | cson_object * pay = NULL; |
| 1331 | 1340 | pay = o = cson_new_object(); |
| 1332 | 1341 | |
| 1333 | 1342 | #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()) | |
| 1335 | 1345 | #define VAL(K,V) cson_object_set(o, #K, (V) ? (V) : cson_value_null()) |
| 1336 | 1346 | VAL(capabilities, json_cap_value()); |
| 1337 | 1347 | INT(g, argc); |
| 1338 | 1348 | INT(g, isConst); |
| 1339 | 1349 | CSTR(g, zConfigDbName); |
| @@ -1813,14 +1823,15 @@ | ||
| 1813 | 1823 | kRC = cson_new_string("resultCode",10); |
| 1814 | 1824 | kSymbol = cson_new_string("cSymbol",7); |
| 1815 | 1825 | kNumber = cson_new_string("number",6); |
| 1816 | 1826 | kDesc = cson_new_string("description",11); |
| 1817 | 1827 | #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))); \ | |
| 1822 | 1833 | cson_array_append( list, cson_object_value(obj) ); obj = NULL; |
| 1823 | 1834 | |
| 1824 | 1835 | C(GENERIC); |
| 1825 | 1836 | C(INVALID_REQUEST); |
| 1826 | 1837 | C(UNKNOWN_COMMAND); |
| @@ -2006,11 +2017,12 @@ | ||
| 2006 | 2017 | "Requires 'o' permissions."); |
| 2007 | 2018 | return NULL; |
| 2008 | 2019 | } |
| 2009 | 2020 | full = json_find_option_bool("full",NULL,"f", |
| 2010 | 2021 | 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))); | |
| 2012 | 2024 | |
| 2013 | 2025 | jv = cson_value_new_object(); |
| 2014 | 2026 | jo = cson_value_get_object(jv); |
| 2015 | 2027 | |
| 2016 | 2028 | zTmp = db_get("project-name",NULL); |
| @@ -2068,25 +2080,31 @@ | ||
| 2068 | 2080 | " + 0.99"); |
| 2069 | 2081 | cson_object_set(jo, "ageDays", cson_value_new_integer((cson_int_t)n)); |
| 2070 | 2082 | cson_object_set(jo, "ageYears", cson_value_new_double(n/365.2425)); |
| 2071 | 2083 | sqlite3_snprintf(BufLen, zBuf, db_get("project-code","")); |
| 2072 | 2084 | 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))); | |
| 2074 | 2087 | |
| 2075 | 2088 | jv2 = cson_value_new_object(); |
| 2076 | 2089 | jo2 = cson_value_get_object(jv2); |
| 2077 | 2090 | 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()); | |
| 2080 | 2093 | 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")); | |
| 2085 | 2101 | 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()); | |
| 2088 | 2106 | return jv; |
| 2089 | 2107 | #undef SETBUF |
| 2090 | 2108 | } |
| 2091 | 2109 | |
| 2092 | 2110 | |
| @@ -2237,11 +2255,12 @@ | ||
| 2237 | 2255 | /* |
| 2238 | 2256 | ** Mapping of names to JSON pages/commands. Each name is a subpath of |
| 2239 | 2257 | ** /json (in CGI mode) or a subcommand of the json command in CLI mode |
| 2240 | 2258 | */ |
| 2241 | 2259 | 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. */ | |
| 2243 | 2262 | {"anonymousPassword", json_page_anon_password, 0}, |
| 2244 | 2263 | {"artifact", json_page_artifact, 0}, |
| 2245 | 2264 | {"branch", json_page_branch,0}, |
| 2246 | 2265 | {"cap", json_page_cap, 0}, |
| 2247 | 2266 | {"config", json_page_config, 0 }, |
| 2248 | 2267 |
| --- 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 |
+9
-6
| --- src/json_artifact.c | ||
| +++ src/json_artifact.c | ||
| @@ -211,11 +211,12 @@ | ||
| 211 | 211 | /* |
| 212 | 212 | ** Sub-impl of /json/artifact for check-ins. |
| 213 | 213 | */ |
| 214 | 214 | static cson_value * json_artifact_ci( cson_object * zParent, int rid ){ |
| 215 | 215 | 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." ); | |
| 217 | 218 | return NULL; |
| 218 | 219 | }else{ |
| 219 | 220 | cson_value * artV = json_artifact_for_ci(rid, 1); |
| 220 | 221 | cson_object * art = cson_value_get_object(artV); |
| 221 | 222 | if(art){ |
| @@ -250,16 +251,17 @@ | ||
| 250 | 251 | */ |
| 251 | 252 | static int json_artifact_get_content_format_flag(void){ |
| 252 | 253 | enum { MagicValue = -9 }; |
| 253 | 254 | int contentFormat = json_wiki_get_content_format_flag(MagicValue); |
| 254 | 255 | 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; | |
| 256 | 258 | } |
| 257 | 259 | return contentFormat; |
| 258 | 260 | } |
| 259 | 261 | |
| 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*/; | |
| 261 | 263 | |
| 262 | 264 | cson_value * json_artifact_wiki(cson_object * zParent, int rid){ |
| 263 | 265 | if( ! g.perm.RdWiki ){ |
| 264 | 266 | json_set_err(FSL_JSON_E_DENIED, |
| 265 | 267 | "Requires 'j' privileges."); |
| @@ -380,18 +382,19 @@ | ||
| 380 | 382 | e.g. "modified", "new", "deleted". |
| 381 | 383 | */ |
| 382 | 384 | checkin_arr = cson_new_array(); |
| 383 | 385 | cson_object_set(pay, "checkins", cson_array_value(checkin_arr)); |
| 384 | 386 | 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)); | |
| 386 | 389 | /* FIXME: move this isNew/isDel stuff into an SQL CASE statement. */ |
| 387 | 390 | char const isNew = cson_value_get_bool(cson_object_get(row,"isNew")); |
| 388 | 391 | char const isDel = cson_value_get_bool(cson_object_get(row,"isDel")); |
| 389 | 392 | cson_object_set(row, "isNew", NULL); |
| 390 | 393 | 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))); | |
| 393 | 396 | cson_array_append( checkin_arr, cson_object_value(row) ); |
| 394 | 397 | } |
| 395 | 398 | db_finalize(&q); |
| 396 | 399 | return cson_object_value(pay); |
| 397 | 400 | } |
| 398 | 401 |
| --- 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 |
+2
-1
| --- src/json_branch.c | ||
| +++ src/json_branch.c | ||
| @@ -335,11 +335,12 @@ | ||
| 335 | 335 | if(!opt.zName){ |
| 336 | 336 | opt.zName = json_command_arg(g.json.dispatchDepth+1); |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | 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." ); | |
| 341 | 342 | return NULL; |
| 342 | 343 | } |
| 343 | 344 | |
| 344 | 345 | opt.zColor = json_find_option_cstr("bgColor","bgcolor",NULL); |
| 345 | 346 | opt.zBasis = json_find_option_cstr("basis",NULL,NULL); |
| 346 | 347 |
| --- 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 |
+2
-2
| --- src/json_config.c | ||
| +++ src/json_config.c | ||
| @@ -257,11 +257,11 @@ | ||
| 257 | 257 | const Setting *pSet = &aSetting[i]; |
| 258 | 258 | cson_object * jSet; |
| 259 | 259 | cson_value * pVal = 0, * pSrc = 0; |
| 260 | 260 | jSet = cson_new_object(); |
| 261 | 261 | 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)); | |
| 263 | 263 | cson_object_set(jSet, "sensitive", cson_value_new_bool(pSet->sensitive)); |
| 264 | 264 | cson_object_set(jSet, "defaultValue", (pSet->def && pSet->def[0]) |
| 265 | 265 | ? json_new_string(pSet->def) |
| 266 | 266 | : cson_value_null()); |
| 267 | 267 | if( 0==pSet->sensitive || 0!=g.perm.Setup ){ |
| @@ -292,11 +292,11 @@ | ||
| 292 | 292 | blob_appendf(&versionedPathname, "%s.fossil-settings/%s", |
| 293 | 293 | g.zLocalRoot, pSet->name); |
| 294 | 294 | if( file_size(blob_str(&versionedPathname), ExtFILE)>=0 ){ |
| 295 | 295 | Blob content; |
| 296 | 296 | blob_zero(&content); |
| 297 | - blob_read_from_file(&content, blob_str(&versionedPathname), ExtFILE); | |
| 297 | + blob_read_from_file(&content, blob_str(&versionedPathname),ExtFILE); | |
| 298 | 298 | pSrc = json_new_string("versioned"); |
| 299 | 299 | pVal = json_new_string(blob_str(&content)); |
| 300 | 300 | blob_reset(&content); |
| 301 | 301 | } |
| 302 | 302 | blob_reset(&versionedPathname); |
| 303 | 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 |
| --- 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 @@ | ||
| 41 | 41 | signed char sort = -1; |
| 42 | 42 | if(!g.perm.Read){ |
| 43 | 43 | json_set_err(FSL_JSON_E_DENIED,"Requires 'o' privileges."); |
| 44 | 44 | return NULL; |
| 45 | 45 | } |
| 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."); | |
| 47 | 48 | |
| 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. | |
| 50 | 51 | */ |
| 51 | 52 | zFilename = json_find_option_cstr2("name",NULL,NULL, g.json.dispatchDepth+1); |
| 52 | 53 | if(!zFilename || !*zFilename){ |
| 53 | 54 | json_set_err(FSL_JSON_E_MISSING_ARGS, "Missing 'name' parameter."); |
| 54 | 55 | return NULL; |
| @@ -65,11 +66,11 @@ | ||
| 65 | 66 | zCheckin = json_find_option_cstr("checkin",NULL,"ci"); |
| 66 | 67 | |
| 67 | 68 | blob_append_sql(&sql, |
| 68 | 69 | /*0*/ "SELECT b.uuid," |
| 69 | 70 | /*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 */ | |
| 71 | 72 | /*3*/ " cast(strftime('%%s',event.mtime) AS INTEGER)," |
| 72 | 73 | /*4*/ " coalesce(event.euser, event.user)," |
| 73 | 74 | /*5*/ " coalesce(event.ecomment, event.comment)," |
| 74 | 75 | /*6*/ " (SELECT uuid FROM blob WHERE rid=mlink.pid)," /* Parent file uuid */ |
| 75 | 76 | /*7*/ " event.bgcolor," |
| @@ -88,11 +89,12 @@ | ||
| 88 | 89 | if( zCheckin && *zCheckin ){ |
| 89 | 90 | char * zU = NULL; |
| 90 | 91 | int rc = name_to_uuid2( zCheckin, "ci", &zU ); |
| 91 | 92 | /*printf("zCheckin=[%s], zU=[%s]", zCheckin, zU);*/ |
| 92 | 93 | 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, | |
| 94 | 96 | "Check-in hash %s.", (rc<0) ? "is ambiguous" : "not found"); |
| 95 | 97 | blob_reset(&sql); |
| 96 | 98 | return NULL; |
| 97 | 99 | } |
| 98 | 100 | blob_append_sql(&sql, " AND ci.uuid='%q'", zU); |
| @@ -104,11 +106,12 @@ | ||
| 104 | 106 | }else if( zBefore && *zBefore ){ |
| 105 | 107 | blob_append_sql(&sql, " AND event.mtime<=julianday('%q')", zBefore); |
| 106 | 108 | } |
| 107 | 109 | } |
| 108 | 110 | |
| 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")); | |
| 110 | 113 | /*printf("SQL=\n%s\n",blob_str(&sql));*/ |
| 111 | 114 | db_prepare(&q, "%s", blob_sql_text(&sql)); |
| 112 | 115 | blob_reset(&sql); |
| 113 | 116 | |
| 114 | 117 | pay = cson_new_object(); |
| @@ -123,18 +126,20 @@ | ||
| 123 | 126 | int const isNew = db_column_int(&q,9); |
| 124 | 127 | int const isDel = db_column_int(&q,10); |
| 125 | 128 | cson_array_append( checkins, cson_object_value(row) ); |
| 126 | 129 | cson_object_set(row, "checkin", json_new_string( db_column_text(&q,1) )); |
| 127 | 130 | 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) ));*/ | |
| 129 | 133 | cson_object_set(row, "timestamp", json_new_int( db_column_int64(&q,3) )); |
| 130 | 134 | cson_object_set(row, "user", json_new_string( db_column_text(&q,4) )); |
| 131 | 135 | 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) ));*/ | |
| 133 | 138 | 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))); | |
| 136 | 141 | if( (0 < limit) && (++currentRow >= limit) ){ |
| 137 | 142 | break; |
| 138 | 143 | } |
| 139 | 144 | } |
| 140 | 145 | db_finalize(&q); |
| 141 | 146 |
| --- 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 |
+4
-2
| --- src/json_login.c | ||
| +++ src/json_login.c | ||
| @@ -155,13 +155,15 @@ | ||
| 155 | 155 | po = cson_value_get_object(payload); |
| 156 | 156 | cson_object_set(po, "authToken", json_new_string(cookie)); |
| 157 | 157 | free(cookie); |
| 158 | 158 | cson_object_set(po, "name", json_new_string(name)); |
| 159 | 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() ); | |
| 160 | + cson_object_set(po, "capabilities", | |
| 161 | + cap ? json_new_string(cap) : cson_value_null() ); | |
| 161 | 162 | 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() ) ); | |
| 163 | 165 | /* TODO: add loginExpiryTime to the payload. To do this properly |
| 164 | 166 | we "should" add an ([unsigned] int *) to |
| 165 | 167 | login_set_user_cookie() and login_set_anon_cookie(), to which |
| 166 | 168 | the expiry time is assigned. (Remember that JSON doesn't do |
| 167 | 169 | unsigned int.) |
| 168 | 170 |
| --- 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 @@ | ||
| 117 | 117 | Blob uu = empty_blob; |
| 118 | 118 | int rc; |
| 119 | 119 | blob_append(&uu, zName, -1); |
| 120 | 120 | rc = name_to_uuid(&uu, 9, "*"); |
| 121 | 121 | 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!"); | |
| 123 | 124 | blob_reset(&uu); |
| 124 | 125 | goto error; |
| 125 | 126 | } |
| 126 | 127 | cson_object_set(pay, "appliedTo", json_new_string(blob_buffer(&uu))); |
| 127 | 128 | blob_reset(&uu); |
| 128 | 129 |
| --- 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 |
+20
-11
| --- src/json_timeline.c | ||
| +++ src/json_timeline.c | ||
| @@ -169,20 +169,22 @@ | ||
| 169 | 169 | zTag); |
| 170 | 170 | if(tagid<=0){ |
| 171 | 171 | return -1; |
| 172 | 172 | } |
| 173 | 173 | 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) ); | |
| 175 | 176 | } |
| 176 | 177 | blob_appendf(pSql, |
| 177 | 178 | " AND (" |
| 178 | 179 | " EXISTS(SELECT 1 FROM tagxref" |
| 179 | 180 | " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)", |
| 180 | 181 | tagid); |
| 181 | 182 | if(!zUnhide){ |
| 182 | 183 | 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" | |
| 184 | 186 | " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)", |
| 185 | 187 | TAG_HIDDEN); |
| 186 | 188 | } |
| 187 | 189 | if(zBranch){ |
| 188 | 190 | /* from "r" flag code in page_timeline().*/ |
| @@ -352,13 +354,14 @@ | ||
| 352 | 354 | cson_object_set(row, "parent", json_new_string(db_column_text(&q,4))); |
| 353 | 355 | } |
| 354 | 356 | cson_object_set(row, "size", json_new_int(db_column_int(&q,5))); |
| 355 | 357 | |
| 356 | 358 | 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))); | |
| 358 | 360 | 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. */ | |
| 360 | 363 | db_column_text(&q,2), |
| 361 | 364 | db_column_text(&q,3)); |
| 362 | 365 | cson_object_set(row, "downloadPath", json_new_string(zDownload)); |
| 363 | 366 | free(zDownload); |
| 364 | 367 | } |
| @@ -505,11 +508,11 @@ | ||
| 505 | 508 | cson_object * row = cson_value_get_object(rowV); |
| 506 | 509 | if(!row){ |
| 507 | 510 | if( !warnRowToJsonFailed ){ |
| 508 | 511 | warnRowToJsonFailed = 1; |
| 509 | 512 | 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." ); | |
| 511 | 514 | } |
| 512 | 515 | continue; |
| 513 | 516 | } |
| 514 | 517 | cson_array_append(list, rowV); |
| 515 | 518 | } |
| @@ -548,19 +551,22 @@ | ||
| 548 | 551 | goto error; |
| 549 | 552 | } |
| 550 | 553 | |
| 551 | 554 | #if 0 |
| 552 | 555 | /* 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)))); | |
| 554 | 558 | #endif |
| 555 | 559 | db_multi_exec("%s", blob_buffer(&sql) /*safe-for-%s*/); |
| 556 | 560 | blob_reset(&sql); |
| 557 | 561 | db_prepare(&q, "SELECT" |
| 558 | 562 | /* For events, the name is generally more useful than |
| 559 | 563 | the uuid, but the uuid is unambiguous and can be used |
| 560 | 564 | 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," | |
| 562 | 568 | " uuid as uuid," |
| 563 | 569 | " mtime AS timestamp," |
| 564 | 570 | " comment AS comment, " |
| 565 | 571 | " user AS user," |
| 566 | 572 | " eventType AS eventType" |
| @@ -591,11 +597,12 @@ | ||
| 591 | 597 | cson_array * list = NULL; |
| 592 | 598 | int check = 0; |
| 593 | 599 | Stmt q = empty_Stmt; |
| 594 | 600 | Blob sql = empty_blob; |
| 595 | 601 | 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."); | |
| 597 | 604 | return NULL; |
| 598 | 605 | } |
| 599 | 606 | payV = cson_value_new_object(); |
| 600 | 607 | pay = cson_value_get_object(payV); |
| 601 | 608 | check = json_timeline_setup_sql( "w", &sql, pay ); |
| @@ -604,11 +611,12 @@ | ||
| 604 | 611 | goto error; |
| 605 | 612 | } |
| 606 | 613 | |
| 607 | 614 | #if 0 |
| 608 | 615 | /* 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)))); | |
| 610 | 618 | #endif |
| 611 | 619 | db_multi_exec("%s", blob_buffer(&sql) /*safe-for-%s*/); |
| 612 | 620 | blob_reset(&sql); |
| 613 | 621 | db_prepare(&q, "SELECT" |
| 614 | 622 | " uuid AS uuid," |
| @@ -654,11 +662,12 @@ | ||
| 654 | 662 | cson_array * list = NULL; |
| 655 | 663 | int check = 0; |
| 656 | 664 | Stmt q = empty_Stmt; |
| 657 | 665 | Blob sql = empty_blob; |
| 658 | 666 | 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."); | |
| 660 | 669 | return NULL; |
| 661 | 670 | } |
| 662 | 671 | payV = cson_value_new_object(); |
| 663 | 672 | pay = cson_value_get_object(payV); |
| 664 | 673 | check = json_timeline_setup_sql( "t", &sql, pay ); |
| @@ -726,11 +735,11 @@ | ||
| 726 | 735 | rowV = cson_sqlite3_row_to_object(q.pStmt); |
| 727 | 736 | row = cson_value_get_object(rowV); |
| 728 | 737 | if(!row){ |
| 729 | 738 | manifest_destroy(pMan); |
| 730 | 739 | 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." ); | |
| 732 | 741 | continue; |
| 733 | 742 | } |
| 734 | 743 | /* FIXME: certainly there's a more efficient way for use to get |
| 735 | 744 | the ticket UUIDs? |
| 736 | 745 | */ |
| 737 | 746 |
| --- 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 @@ | ||
| 170 | 170 | ** not modify the 's' permission. Admin users without setup |
| 171 | 171 | ** permissions may not edit any other user who has the 's' permission. |
| 172 | 172 | ** |
| 173 | 173 | */ |
| 174 | 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 ) )) | |
| 175 | +#define CSTR(X) cson_string_cstr(cson_value_get_string( cson_object_get(pUser, \ | |
| 176 | + X ) )) | |
| 176 | 177 | char const * zName = CSTR("name"); |
| 177 | 178 | char const * zNameNew = zName; |
| 178 | 179 | char * zNameFree = NULL; |
| 179 | 180 | char const * zInfo = CSTR("info"); |
| 180 | 181 | char const * zCap = CSTR("capabilities"); |
| 181 | 182 |
| --- 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 @@ | ||
| 163 | 163 | /* |
| 164 | 164 | ** Searches for the latest version of a wiki page with the given |
| 165 | 165 | ** name. If found it behaves like json_get_wiki_page_by_rid(theRid, |
| 166 | 166 | ** contentFormat), else it returns NULL. |
| 167 | 167 | */ |
| 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){ | |
| 169 | 170 | int rid; |
| 170 | 171 | rid = db_int(0, |
| 171 | 172 | "SELECT x.rid FROM tag t, tagxref x, blob b" |
| 172 | 173 | " WHERE x.tagid=t.tagid AND t.tagname='wiki-%q' " |
| 173 | 174 | " AND b.rid=x.rid" |
| @@ -259,11 +260,11 @@ | ||
| 259 | 260 | |
| 260 | 261 | zSymName = json_find_option_cstr("uuid",NULL,"u"); |
| 261 | 262 | |
| 262 | 263 | if((!zPageName||!*zPageName) && (!zSymName || !*zSymName)){ |
| 263 | 264 | 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."); | |
| 265 | 266 | return NULL; |
| 266 | 267 | } |
| 267 | 268 | |
| 268 | 269 | /* TODO: see if we have a page named zPageName. If not, try to resolve |
| 269 | 270 | zPageName as a UUID. |
| @@ -297,17 +298,17 @@ | ||
| 297 | 298 | }else{ |
| 298 | 299 | sContent = cson_value_get_string(g.json.reqPayload.v); |
| 299 | 300 | } |
| 300 | 301 | if(!sContent) { |
| 301 | 302 | 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."); | |
| 305 | 306 | return NULL; |
| 306 | 307 | } |
| 307 | 308 | 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)); | |
| 309 | 310 | zMime = wiki_filter_mimetypes(zMime); |
| 310 | 311 | if( 0==fossil_strcmp(zMime, "text/x-markdown") ){ |
| 311 | 312 | markdown_to_html(&contentOrig, 0, &contentHtml); |
| 312 | 313 | }else if( 0==fossil_strcmp(zMime, "text/plain") ){ |
| 313 | 314 | blob_append(&contentHtml, "<pre class='textPlain'>", -1); |
| @@ -315,11 +316,12 @@ | ||
| 315 | 316 | blob_append(&contentHtml, "</pre>", -1); |
| 316 | 317 | }else{ |
| 317 | 318 | wiki_convert( &contentOrig, &contentHtml, 0 ); |
| 318 | 319 | } |
| 319 | 320 | 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)); | |
| 321 | 323 | blob_reset( &contentHtml ); |
| 322 | 324 | return pay; |
| 323 | 325 | } |
| 324 | 326 | |
| 325 | 327 | |
| @@ -346,11 +348,12 @@ | ||
| 346 | 348 | cson_value * nameV; /* wiki page name */ |
| 347 | 349 | char const * zPageName; /* cstr form of page name */ |
| 348 | 350 | cson_value * contentV; /* passed-in content */ |
| 349 | 351 | cson_value * emptyContent = NULL; /* placeholder for empty content. */ |
| 350 | 352 | 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. */ | |
| 352 | 355 | char const * zMimeType = 0; |
| 353 | 356 | unsigned int contentLen = 0; |
| 354 | 357 | int rid; |
| 355 | 358 | if( (createMode && !g.perm.NewWiki) |
| 356 | 359 | || (!createMode && !g.perm.WrWiki)){ |
| 357 | 360 |
| --- 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 @@ | ||
| 270 | 270 | int j, c, flags = LOOK_NONE; /* Assume UTF-16 text, prove otherwise */ |
| 271 | 271 | |
| 272 | 272 | if( n%sizeof(WCHAR_T) ){ |
| 273 | 273 | flags |= LOOK_ODD; /* Odd number of bytes -> binary (UTF-8?) */ |
| 274 | 274 | } |
| 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?) */ | |
| 276 | 276 | c = *z; |
| 277 | 277 | if( bReverse ){ |
| 278 | 278 | c = UTF16_SWAP(c); |
| 279 | 279 | } |
| 280 | 280 | if( c==0 ){ |
| 281 | 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 |
| --- 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 @@ | ||
| 382 | 382 | /* release the given working buffer back to the cache */ |
| 383 | 383 | static void release_work_buffer(struct render *rndr, struct Blob *buf){ |
| 384 | 384 | if( !buf ) return; |
| 385 | 385 | rndr->iDepth--; |
| 386 | 386 | 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])) ){ | |
| 388 | 389 | rndr->aBlobCache[rndr->nBlobCache++] = buf; |
| 389 | 390 | }else{ |
| 390 | 391 | fossil_free(buf); |
| 391 | 392 | } |
| 392 | 393 | } |
| 393 | 394 |
| --- 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 @@ | ||
| 661 | 661 | ** --force Force the rebuild to complete even if errors are seen |
| 662 | 662 | ** --ifneeded Only do the rebuild if it would change the schema version |
| 663 | 663 | ** --index Always add in the full-text search index |
| 664 | 664 | ** --noverify Skip the verification of changes to the BLOB table |
| 665 | 665 | ** --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) | |
| 667 | 667 | ** --quiet Only show output if there are errors |
| 668 | 668 | ** --stats Show artifact statistics after rebuilding |
| 669 | 669 | ** --vacuum Run VACUUM on the database after rebuilding |
| 670 | 670 | ** --wal Set Write-Ahead-Log journalling mode on the database |
| 671 | 671 | */ |
| @@ -1395,11 +1395,12 @@ | ||
| 1395 | 1395 | |
| 1396 | 1396 | db_end_transaction(0); |
| 1397 | 1397 | fossil_print("project-id: %s\n", db_get("project-code", 0)); |
| 1398 | 1398 | fossil_print("server-id: %s\n", db_get("server-code", 0)); |
| 1399 | 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); | |
| 1400 | + fossil_print("admin-user: %s (initial password is \"%s\")\n", g.zLogin, | |
| 1401 | + zPassword); | |
| 1401 | 1402 | hash_user_password(g.zLogin); |
| 1402 | 1403 | } |
| 1403 | 1404 | |
| 1404 | 1405 | /* |
| 1405 | 1406 | ** COMMAND: deconstruct* |
| 1406 | 1407 |
| --- 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 @@ | ||
| 1368 | 1368 | char *zErr1 = 0; |
| 1369 | 1369 | char *zErr2 = 0; |
| 1370 | 1370 | int count = 0; |
| 1371 | 1371 | int rn; |
| 1372 | 1372 | |
| 1373 | - if( !zRep || !strcmp(zRep,zFullTicketRptRn) || !strcmp(zRep,zFullTicketRptTitle) ){ | |
| 1373 | + if( !zRep || !strcmp(zRep,zFullTicketRptRn) | |
| 1374 | + || !strcmp(zRep,zFullTicketRptTitle) ){ | |
| 1374 | 1375 | zSql = "SELECT * FROM ticket"; |
| 1375 | 1376 | }else{ |
| 1376 | 1377 | rn = atoi(zRep); |
| 1377 | 1378 | if( rn ){ |
| 1378 | 1379 | db_prepare(&q, |
| 1379 | 1380 |
| --- 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 @@ | ||
| 143 | 143 | |
| 144 | 144 | cgi_set_content_type("application/rss+xml"); |
| 145 | 145 | |
| 146 | 146 | zProjectName = db_get("project-name", 0); |
| 147 | 147 | 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); | |
| 150 | 150 | } |
| 151 | 151 | zProjectDescr = db_get("project-description", 0); |
| 152 | 152 | if( zProjectDescr==0 ){ |
| 153 | 153 | zProjectDescr = zProjectName; |
| 154 | 154 | } |
| @@ -258,11 +258,11 @@ | ||
| 258 | 258 | void cmd_timeline_rss(void){ |
| 259 | 259 | Stmt q; |
| 260 | 260 | int nLine=0; |
| 261 | 261 | char *zPubDate, *zProjectName, *zProjectDescr, *zFreeProjectName=0; |
| 262 | 262 | 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*/ | |
| 264 | 264 | const char *zTicketUuid = find_option("tkt",NULL,1); |
| 265 | 265 | const char *zTag = find_option("tag",NULL,1); |
| 266 | 266 | const char *zFilename = find_option("name",NULL,1); |
| 267 | 267 | const char *zWiki = find_option("wiki",NULL,1); |
| 268 | 268 | const char *zLimit = find_option("limit", "n",1); |
| @@ -332,31 +332,33 @@ | ||
| 332 | 332 | " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid))", nTagId); |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | if( zFilename ){ |
| 336 | 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)", | |
| 337 | + " AND (SELECT mlink.fnid FROM mlink WHERE event.objid=mlink.mid) " | |
| 338 | + " IN (SELECT fnid FROM filename WHERE name=%Q %s)", | |
| 338 | 339 | zFilename, filename_collation() |
| 339 | 340 | ); |
| 340 | 341 | } |
| 341 | 342 | |
| 342 | 343 | blob_append( &bSQL, " ORDER BY event.mtime DESC", -1 ); |
| 343 | 344 | |
| 344 | 345 | zProjectName = db_get("project-name", 0); |
| 345 | 346 | 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); | |
| 348 | 349 | } |
| 349 | 350 | zProjectDescr = db_get("project-description", 0); |
| 350 | 351 | if( zProjectDescr==0 ){ |
| 351 | 352 | zProjectDescr = zProjectName; |
| 352 | 353 | } |
| 353 | 354 | |
| 354 | 355 | zPubDate = cgi_rfc822_datestamp(time(NULL)); |
| 355 | 356 | |
| 356 | 357 | 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\">"); | |
| 358 | 360 | fossil_print("<channel>\n"); |
| 359 | 361 | fossil_print("<title>%h</title>\n", zProjectName); |
| 360 | 362 | fossil_print("<link>%s</link>\n", zBaseURL); |
| 361 | 363 | fossil_print("<description>%h</description>\n", zProjectDescr); |
| 362 | 364 | fossil_print("<pubDate>%s</pubDate>\n", zPubDate); |
| 363 | 365 |
| --- 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 @@ | ||
| 32 | 32 | ** and makeheaders. |
| 33 | 33 | */ |
| 34 | 34 | #if FOSSIL_HARDENED_SHA1 |
| 35 | 35 | |
| 36 | 36 | #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*); | |
| 38 | 39 | struct SHA1_CTX { |
| 39 | 40 | uint64_t total; |
| 40 | 41 | uint32_t ihv[5]; |
| 41 | 42 | unsigned char buffer[64]; |
| 42 | 43 | int bigendian; |
| 43 | 44 |
| --- 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 @@ | ||
| 19 | 19 | ** to RFC 5321. |
| 20 | 20 | */ |
| 21 | 21 | #include "config.h" |
| 22 | 22 | #include "smtp.h" |
| 23 | 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) | |
| 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 | 26 | # include <sys/types.h> |
| 27 | 27 | # include <netinet/in.h> |
| 28 | 28 | # if defined(HAVE_BIND_RESOLV_H) |
| 29 | 29 | # include <bind/resolv.h> |
| 30 | 30 | # include <bind/arpa/nameser_compat.h> |
| 31 | 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 |
| --- 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 @@ | ||
| 795 | 795 | } |
| 796 | 796 | Th_MaybeStore("current_feature", feature_from_page_path(local_zCurrentPage) ); |
| 797 | 797 | if( g.ftntsIssues[0] || g.ftntsIssues[1] || |
| 798 | 798 | g.ftntsIssues[2] || g.ftntsIssues[3] ){ |
| 799 | 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]); | |
| 800 | + sqlite3_snprintf(sizeof(buf), buf, "%i %i %i %i", g.ftntsIssues[0], | |
| 801 | + g.ftntsIssues[1], g.ftntsIssues[2], g.ftntsIssues[3]); | |
| 802 | 802 | Th_Store("footnotes_issues_counters", buf); |
| 803 | 803 | } |
| 804 | 804 | } |
| 805 | 805 | |
| 806 | 806 | /* |
| 807 | 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],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 @@ | ||
| 244 | 244 | /* adding the length extended the length field? */ |
| 245 | 245 | if(blen > next10){ |
| 246 | 246 | blen++; |
| 247 | 247 | } |
| 248 | 248 | /* 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); | |
| 250 | 251 | /* this _must_ be right */ |
| 251 | 252 | if((int)blob_size(&tball.pax) != blen){ |
| 252 | 253 | fossil_panic("internal error: PAX tar header has bad length"); |
| 253 | 254 | } |
| 254 | 255 | } |
| 255 | 256 |
| --- 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 @@ | ||
| 31 | 31 | #define TH_INIT_NEED_CONFIG ((u32)0x00000001) /* Open configuration first? */ |
| 32 | 32 | #define TH_INIT_FORCE_TCL ((u32)0x00000002) /* Force Tcl to be enabled? */ |
| 33 | 33 | #define TH_INIT_FORCE_RESET ((u32)0x00000004) /* Force TH1 commands re-added? */ |
| 34 | 34 | #define TH_INIT_FORCE_SETUP ((u32)0x00000008) /* Force eval of setup script? */ |
| 35 | 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. */ | |
| 36 | +#define TH_INIT_NO_ENCODE ((u32)0x00000020) /* Do not html-encode sendText()*/ | |
| 37 | + /* output. */ | |
| 37 | 38 | #define TH_INIT_MASK ((u32)0x0000003F) /* All possible init flags. */ |
| 38 | 39 | |
| 39 | 40 | /* |
| 40 | 41 | ** Useful and/or "well-known" combinations of flag values. |
| 41 | 42 | */ |
| 42 | 43 |
| --- 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 @@ | ||
| 1164 | 1164 | return TH_ERROR; |
| 1165 | 1165 | } |
| 1166 | 1166 | tclContext->interp = tclInterp; |
| 1167 | 1167 | if( Tcl_Init(tclInterp)!=TCL_OK ){ |
| 1168 | 1168 | Th_ErrorMessage(interp, |
| 1169 | - "Tcl initialization error:", Tcl_GetString(Tcl_GetObjResult(tclInterp)), -1); | |
| 1169 | + "Tcl initialization error:", | |
| 1170 | + Tcl_GetString(Tcl_GetObjResult(tclInterp)), -1); | |
| 1170 | 1171 | Tcl_DeleteInterp(tclInterp); |
| 1171 | 1172 | tclContext->interp = tclInterp = 0; |
| 1172 | 1173 | return TH_ERROR; |
| 1173 | 1174 | } |
| 1174 | 1175 | if( setTclArguments(tclInterp, argc, argv)!=TCL_OK ){ |
| 1175 | 1176 | 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); | |
| 1177 | 1179 | Tcl_DeleteInterp(tclInterp); |
| 1178 | 1180 | tclContext->interp = tclInterp = 0; |
| 1179 | 1181 | return TH_ERROR; |
| 1180 | 1182 | } |
| 1181 | 1183 | /* |
| @@ -1194,11 +1196,12 @@ | ||
| 1194 | 1196 | Tcl_CreateObjCommand(tclInterp, "th1Expr", Th1ExprObjCmd, interp, NULL); |
| 1195 | 1197 | /* If necessary, evaluate the custom Tcl setup script. */ |
| 1196 | 1198 | setup = tclContext->setup; |
| 1197 | 1199 | if( setup && Tcl_EvalEx(tclInterp, setup, -1, 0)!=TCL_OK ){ |
| 1198 | 1200 | 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); | |
| 1200 | 1203 | Tcl_DeleteInterp(tclInterp); |
| 1201 | 1204 | tclContext->interp = tclInterp = 0; |
| 1202 | 1205 | return TH_ERROR; |
| 1203 | 1206 | } |
| 1204 | 1207 | return TH_OK; |
| 1205 | 1208 |
| --- 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 @@ | ||
| 3017 | 3017 | ** 8. event-type: 'ci', 'w', 't', 'f', and so forth. |
| 3018 | 3018 | ** 9. comment |
| 3019 | 3019 | ** 10. user |
| 3020 | 3020 | ** 11. tags |
| 3021 | 3021 | */ |
| 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){ | |
| 3023 | 3024 | int nAbsLimit = (nLimit >= 0) ? nLimit : -nLimit; |
| 3024 | 3025 | int nLine = 0; |
| 3025 | 3026 | int nEntry = 0; |
| 3026 | 3027 | char zPrevDate[20]; |
| 3027 | 3028 | const char *zCurrentUuid = 0; |
| 3028 | 3029 | int fchngQueryInit = 0; /* True if fchngQuery is initialized */ |
| 3029 | 3030 | Stmt fchngQuery; /* Query for file changes on check-ins */ |
| 3030 | 3031 | int rc; |
| 3031 | 3032 | /* 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)); | |
| 3033 | 3035 | /* 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)); | |
| 3036 | 3039 | |
| 3037 | 3040 | zPrevDate[0] = 0; |
| 3038 | 3041 | if( g.localOpen ){ |
| 3039 | 3042 | int rid = db_lget_int("checkout", 0); |
| 3040 | 3043 | zCurrentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| @@ -3122,12 +3125,13 @@ | ||
| 3122 | 3125 | char *zEntry; |
| 3123 | 3126 | int nEntryLine = 0; |
| 3124 | 3127 | if( nChild==0 ){ |
| 3125 | 3128 | sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*LEAF* "); |
| 3126 | 3129 | } |
| 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); | |
| 3129 | 3133 | nLine += nEntryLine; |
| 3130 | 3134 | fossil_print("%s\n", zEntry); |
| 3131 | 3135 | fossil_free(zEntry); |
| 3132 | 3136 | } |
| 3133 | 3137 | else{ |
| @@ -3280,11 +3284,11 @@ | ||
| 3280 | 3284 | ** %% a raw % |
| 3281 | 3285 | ** %H commit hash |
| 3282 | 3286 | ** %h abbreviated commit hash |
| 3283 | 3287 | ** %a author name |
| 3284 | 3288 | ** %d date |
| 3285 | -** %c comment (NL, TAB replaced by space, LF deleted) | |
| 3289 | +** %c comment (NL, TAB replaced by space, LF erased) | |
| 3286 | 3290 | ** %b branch |
| 3287 | 3291 | ** %t tags |
| 3288 | 3292 | ** %p phase: zero or more of *CURRENT*, *MERGE*, |
| 3289 | 3293 | ** *FORK*, *UNPUBLISHED*, *LEAF*, *BRANCH* |
| 3290 | 3294 | ** --oneline Show only short hash and comment for each entry |
| 3291 | 3295 |
| --- 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 @@ | ||
| 240 | 240 | iHi = iTest-1; |
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | assert( key>=aDia[iRes] ); |
| 244 | 244 | 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); | |
| 246 | 247 | } |
| 247 | 248 | |
| 248 | 249 | |
| 249 | 250 | /* |
| 250 | 251 | ** Return true if the argument interpreted as a unicode codepoint |
| 251 | 252 |
| --- 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 @@ | ||
| 399 | 399 | db_lset("default-user", g.argv[3]); |
| 400 | 400 | }else{ |
| 401 | 401 | db_set("default-user", g.argv[3], 0); |
| 402 | 402 | } |
| 403 | 403 | } |
| 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 )){ | |
| 405 | 406 | Stmt q; |
| 406 | 407 | db_prepare(&q, "SELECT login, info FROM user ORDER BY login"); |
| 407 | 408 | while( db_step(&q)==SQLITE_ROW ){ |
| 408 | 409 | fossil_print("%-12s %s\n", db_column_text(&q, 0), db_column_text(&q, 1)); |
| 409 | 410 | } |
| 410 | 411 |
| --- 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 @@ | ||
| 410 | 410 | }; |
| 411 | 411 | int i, j, n; |
| 412 | 412 | |
| 413 | 413 | if( sqlite3_strglob("ci-comment-????????????.txt", zName)==0 ) return 1; |
| 414 | 414 | 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 ){ | |
| 416 | 417 | return 1; |
| 417 | 418 | } |
| 418 | 419 | if( zName[0]!='-' ) continue; |
| 419 | 420 | for(i=0; i<count(azTemp); i++){ |
| 420 | 421 | n = (int)strlen(azTemp[i]); |
| @@ -754,11 +755,11 @@ | ||
| 754 | 755 | } |
| 755 | 756 | fseek(in, 0L, SEEK_END); |
| 756 | 757 | sqlite3_snprintf(sizeof(zBuf), zBuf, " %ld\n", ftell(in)); |
| 757 | 758 | fseek(in, 0L, SEEK_SET); |
| 758 | 759 | 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);*/ | |
| 760 | 761 | for(;;){ |
| 761 | 762 | int n; |
| 762 | 763 | n = fread(zBuf, 1, sizeof(zBuf), in); |
| 763 | 764 | if( n<=0 ) break; |
| 764 | 765 | md5sum_step_text(zBuf, n); |
| 765 | 766 |
| --- 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 @@ | ||
| 469 | 469 | zPageName += 8; |
| 470 | 470 | if( zExtra[0]==0 && !P("p") ){ |
| 471 | 471 | cgi_redirectf("%R/info/%s",zPageName); |
| 472 | 472 | }else{ |
| 473 | 473 | 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); | |
| 475 | 476 | style_submenu_element("Check-in Info","%R/info/%s", zPageName); |
| 476 | 477 | } |
| 477 | 478 | break; |
| 478 | 479 | } |
| 479 | 480 | case WIKITYPE_BRANCH: { |
| 480 | 481 |
| --- 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 @@ | ||
| 355 | 355 | nullContent = 1; |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | /* The isWriter flag must be true in order to land the new file */ |
| 359 | 359 | if( !isWriter ){ |
| 360 | - blob_appendf(&pXfer->err, "Write permissions for unversioned files missing"); | |
| 360 | + blob_appendf(&pXfer->err,"Write permissions for unversioned files missing"); | |
| 361 | 361 | goto end_accept_unversioned_file; |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | /* Make sure we have a valid g.rcvid marker */ |
| 365 | 365 | content_rcvid_init(0); |
| 366 | 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 |
| --- 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 |
+4
-2
| --- tools/makeheaders.c | ||
| +++ tools/makeheaders.c | ||
| @@ -38,11 +38,12 @@ | ||
| 38 | 38 | #include <memory.h> |
| 39 | 39 | #include <sys/stat.h> |
| 40 | 40 | #include <assert.h> |
| 41 | 41 | #include <string.h> |
| 42 | 42 | |
| 43 | -#if defined( __MINGW32__) || defined(__DMC__) || defined(_MSC_VER) || defined(__POCC__) | |
| 43 | +#if defined( __MINGW32__) || defined(__DMC__) || \ | |
| 44 | + defined(_MSC_VER) || defined(__POCC__) | |
| 44 | 45 | # ifndef WIN32 |
| 45 | 46 | # define WIN32 |
| 46 | 47 | # endif |
| 47 | 48 | #else |
| 48 | 49 | # include <unistd.h> |
| @@ -2226,11 +2227,12 @@ | ||
| 2226 | 2227 | PushIfMacro(0,0,0,pToken->nLine,PS_Interface); |
| 2227 | 2228 | }else if( nArg==16 && strncmp(zArg,"EXPORT_INTERFACE",16)==0 ){ |
| 2228 | 2229 | PushIfMacro(0,0,0,pToken->nLine,PS_Export); |
| 2229 | 2230 | }else if( nArg==15 && strncmp(zArg,"LOCAL_INTERFACE",15)==0 ){ |
| 2230 | 2231 | 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 ){ | |
| 2232 | 2234 | PushIfMacro(0,0,0,pToken->nLine,PS_Local); |
| 2233 | 2235 | }else{ |
| 2234 | 2236 | PushIfMacro(0,zArg,nArg,pToken->nLine,0); |
| 2235 | 2237 | } |
| 2236 | 2238 | }else if( nCmd==5 && strncmp(zCmd,"ifdef",5)==0 ){ |
| 2237 | 2239 |
| --- 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 |
+4
-2
| --- tools/sqlcompattest.c | ||
| +++ tools/sqlcompattest.c | ||
| @@ -53,11 +53,12 @@ | ||
| 53 | 53 | |
| 54 | 54 | #define QUOTE(VAL) #VAL |
| 55 | 55 | #define STR(MACRO_VAL) QUOTE(MACRO_VAL) |
| 56 | 56 | |
| 57 | 57 | 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)); | |
| 59 | 60 | |
| 60 | 61 | long major, minor, release, version; |
| 61 | 62 | sscanf(zMinimumVersionNumber, "%li.%li.%li", &major, &minor, &release); |
| 62 | 63 | version=(major*1000000)+(minor*1000)+release; |
| 63 | 64 | |
| @@ -67,11 +68,12 @@ | ||
| 67 | 68 | "ENABLE_DBSTAT_VTAB", /* Required by /repo-tabsize page */ |
| 68 | 69 | }; |
| 69 | 70 | |
| 70 | 71 | /* Check minimum SQLite version number */ |
| 71 | 72 | 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", | |
| 73 | 75 | sqlite3_libversion(),STR(MINIMUM_SQLITE_VERSION)); |
| 74 | 76 | return 1; |
| 75 | 77 | } |
| 76 | 78 | |
| 77 | 79 | for(i=0; i<sizeof(zRequiredOpts)/sizeof(zRequiredOpts[0]); i++){ |
| 78 | 80 |
| --- 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 |