Fossil SCM
"char const" -> "const char" and various other coding style improvements. No functional change.
Commit
4e18dba698479a222076a070d6f443ed10051ae9
Parent
ffa67c1b9b61264…
12 files changed
+17
-17
+2
-2
+8
-8
+14
-14
+20
-20
+2
-2
+2
-2
+8
-8
+22
-22
+1
-1
+2
-2
+8
-8
+17
-17
| --- src/add.c | ||
| +++ src/add.c | ||
| @@ -44,11 +44,11 @@ | ||
| 44 | 44 | ".fslckout", |
| 45 | 45 | ".fslckout-journal", |
| 46 | 46 | ".fslckout-wal", |
| 47 | 47 | ".fslckout-shm", |
| 48 | 48 | |
| 49 | - /* The use of ".fos" as the name of the checkout database is | |
| 49 | + /* The use of ".fos" as the name of the checkout database is | |
| 50 | 50 | ** deprecated. Use ".fslckout" instead. At some point, the following |
| 51 | 51 | ** entries should be removed. 2012-02-04 */ |
| 52 | 52 | ".fos", |
| 53 | 53 | ".fos-journal", |
| 54 | 54 | ".fos-wal", |
| @@ -123,11 +123,11 @@ | ||
| 123 | 123 | */ |
| 124 | 124 | void test_reserved_names(void){ |
| 125 | 125 | int i; |
| 126 | 126 | const char *z; |
| 127 | 127 | int omitRepo = find_option("omitrepo",0,0)!=0; |
| 128 | - | |
| 128 | + | |
| 129 | 129 | /* We should be done with options.. */ |
| 130 | 130 | verify_all_options(); |
| 131 | 131 | |
| 132 | 132 | db_must_be_within_tree(); |
| 133 | 133 | for(i=0; (z = fossil_reserved_name(i, omitRepo))!=0; i++){ |
| @@ -181,11 +181,11 @@ | ||
| 181 | 181 | int i; /* Loop counter */ |
| 182 | 182 | const char *zReserved; /* Name of a reserved file */ |
| 183 | 183 | Blob repoName; /* Treename of the repository */ |
| 184 | 184 | Stmt loop; /* SQL to loop over all files to add */ |
| 185 | 185 | int (*xCmp)(const char*,const char*); |
| 186 | - | |
| 186 | + | |
| 187 | 187 | if( !file_tree_name(g.zRepositoryName, &repoName, 0) ){ |
| 188 | 188 | blob_zero(&repoName); |
| 189 | 189 | zRepo = ""; |
| 190 | 190 | }else{ |
| 191 | 191 | zRepo = blob_str(&repoName); |
| @@ -237,17 +237,17 @@ | ||
| 237 | 237 | ** depends on the global setting, or the operating system default, if not set. |
| 238 | 238 | ** |
| 239 | 239 | ** Options: |
| 240 | 240 | ** |
| 241 | 241 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 242 | -** --dotfiles include files beginning with a dot (".") | |
| 242 | +** --dotfiles include files beginning with a dot (".") | |
| 243 | 243 | ** -f|--force Add files without prompting |
| 244 | -** --ignore <CSG> ignore files matching patterns from the | |
| 244 | +** --ignore <CSG> ignore files matching patterns from the | |
| 245 | 245 | ** comma separated list of glob patterns. |
| 246 | 246 | ** --clean <CSG> also ignore files matching patterns from |
| 247 | 247 | ** the comma separated list of glob patterns. |
| 248 | -** | |
| 248 | +** | |
| 249 | 249 | ** See also: addremove, rm |
| 250 | 250 | */ |
| 251 | 251 | void add_cmd(void){ |
| 252 | 252 | int i; /* Loop counter */ |
| 253 | 253 | int vid; /* Currently checked out version */ |
| @@ -279,11 +279,11 @@ | ||
| 279 | 279 | db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)", |
| 280 | 280 | filename_collation()); |
| 281 | 281 | pClean = glob_create(zCleanFlag); |
| 282 | 282 | pIgnore = glob_create(zIgnoreFlag); |
| 283 | 283 | nRoot = strlen(g.zLocalRoot); |
| 284 | - | |
| 284 | + | |
| 285 | 285 | /* Load the names of all files that are to be added into sfile temp table */ |
| 286 | 286 | for(i=2; i<g.argc; i++){ |
| 287 | 287 | char *zName; |
| 288 | 288 | int isDir; |
| 289 | 289 | Blob fullName; |
| @@ -354,11 +354,11 @@ | ||
| 354 | 354 | void delete_cmd(void){ |
| 355 | 355 | int i; |
| 356 | 356 | Stmt loop; |
| 357 | 357 | |
| 358 | 358 | capture_case_sensitive_option(); |
| 359 | - | |
| 359 | + | |
| 360 | 360 | /* We should be done with options.. */ |
| 361 | 361 | verify_all_options(); |
| 362 | 362 | |
| 363 | 363 | db_must_be_within_tree(); |
| 364 | 364 | db_begin_transaction(); |
| @@ -379,11 +379,11 @@ | ||
| 379 | 379 | zTreeName, filename_collation(), zTreeName, |
| 380 | 380 | filename_collation(), zTreeName, filename_collation() |
| 381 | 381 | ); |
| 382 | 382 | blob_reset(&treeName); |
| 383 | 383 | } |
| 384 | - | |
| 384 | + | |
| 385 | 385 | db_prepare(&loop, "SELECT x FROM sfile"); |
| 386 | 386 | while( db_step(&loop)==SQLITE_ROW ){ |
| 387 | 387 | fossil_print("DELETED %s\n", db_column_text(&loop, 0)); |
| 388 | 388 | } |
| 389 | 389 | db_finalize(&loop); |
| @@ -494,12 +494,12 @@ | ||
| 494 | 494 | ** on the "settings" command for further information. |
| 495 | 495 | ** |
| 496 | 496 | ** The -n|--dry-run option shows what would happen without actually doing anything. |
| 497 | 497 | ** |
| 498 | 498 | ** This command can be used to track third party software. |
| 499 | -** | |
| 500 | -** Options: | |
| 499 | +** | |
| 500 | +** Options: | |
| 501 | 501 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 502 | 502 | ** --dotfiles include files beginning with a dot (".") |
| 503 | 503 | ** --ignore <CSG> ignore files matching patterns from the |
| 504 | 504 | ** comma separated list of glob patterns. |
| 505 | 505 | ** --clean <CSG> also ignore files matching patterns from |
| @@ -523,11 +523,11 @@ | ||
| 523 | 523 | |
| 524 | 524 | if( !dryRunFlag ){ |
| 525 | 525 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 526 | 526 | } |
| 527 | 527 | capture_case_sensitive_option(); |
| 528 | - | |
| 528 | + | |
| 529 | 529 | /* We should be done with options.. */ |
| 530 | 530 | verify_all_options(); |
| 531 | 531 | |
| 532 | 532 | db_must_be_within_tree(); |
| 533 | 533 | if( zCleanFlag==0 ){ |
| @@ -537,11 +537,11 @@ | ||
| 537 | 537 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 538 | 538 | } |
| 539 | 539 | vid = db_lget_int("checkout",0); |
| 540 | 540 | db_begin_transaction(); |
| 541 | 541 | |
| 542 | - /* step 1: | |
| 542 | + /* step 1: | |
| 543 | 543 | ** Populate the temp table "sfile" with the names of all unmanaged |
| 544 | 544 | ** files currently in the check-out, except for files that match the |
| 545 | 545 | ** --ignore or ignore-glob patterns and dot-files. Then add all of |
| 546 | 546 | ** the files in the sfile temp table to the set of managed files. |
| 547 | 547 | */ |
| @@ -563,12 +563,12 @@ | ||
| 563 | 563 | " WHERE NOT deleted" |
| 564 | 564 | " ORDER BY 1", |
| 565 | 565 | g.zLocalRoot |
| 566 | 566 | ); |
| 567 | 567 | while( db_step(&q)==SQLITE_ROW ){ |
| 568 | - const char * zFile; | |
| 569 | - const char * zPath; | |
| 568 | + const char *zFile; | |
| 569 | + const char *zPath; | |
| 570 | 570 | |
| 571 | 571 | zFile = db_column_text(&q, 0); |
| 572 | 572 | zPath = db_column_text(&q, 1); |
| 573 | 573 | if( !file_wd_isfile_or_link(zPath) ){ |
| 574 | 574 | if( !dryRunFlag ){ |
| @@ -595,11 +595,11 @@ | ||
| 595 | 595 | int x = db_int(-1, "SELECT deleted FROM vfile WHERE pathname=%Q %s", |
| 596 | 596 | zNew, filename_collation()); |
| 597 | 597 | if( x>=0 ){ |
| 598 | 598 | if( x==0 ){ |
| 599 | 599 | fossil_fatal("cannot rename '%s' to '%s' since another file named '%s'" |
| 600 | - " is currently under management", zOrig, zNew, zNew); | |
| 600 | + " is currently under management", zOrig, zNew, zNew); | |
| 601 | 601 | }else{ |
| 602 | 602 | fossil_fatal("cannot rename '%s' to '%s' since the delete of '%s' has " |
| 603 | 603 | "not yet been committed", zOrig, zNew, zNew); |
| 604 | 604 | } |
| 605 | 605 | } |
| @@ -636,11 +636,11 @@ | ||
| 636 | 636 | Blob dest; |
| 637 | 637 | Stmt q; |
| 638 | 638 | |
| 639 | 639 | capture_case_sensitive_option(); |
| 640 | 640 | db_must_be_within_tree(); |
| 641 | - | |
| 641 | + | |
| 642 | 642 | /* We should be done with options.. */ |
| 643 | 643 | verify_all_options(); |
| 644 | 644 | |
| 645 | 645 | vid = db_lget_int("checkout", 0); |
| 646 | 646 | if( vid==0 ){ |
| 647 | 647 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -44,11 +44,11 @@ | |
| 44 | ".fslckout", |
| 45 | ".fslckout-journal", |
| 46 | ".fslckout-wal", |
| 47 | ".fslckout-shm", |
| 48 | |
| 49 | /* The use of ".fos" as the name of the checkout database is |
| 50 | ** deprecated. Use ".fslckout" instead. At some point, the following |
| 51 | ** entries should be removed. 2012-02-04 */ |
| 52 | ".fos", |
| 53 | ".fos-journal", |
| 54 | ".fos-wal", |
| @@ -123,11 +123,11 @@ | |
| 123 | */ |
| 124 | void test_reserved_names(void){ |
| 125 | int i; |
| 126 | const char *z; |
| 127 | int omitRepo = find_option("omitrepo",0,0)!=0; |
| 128 | |
| 129 | /* We should be done with options.. */ |
| 130 | verify_all_options(); |
| 131 | |
| 132 | db_must_be_within_tree(); |
| 133 | for(i=0; (z = fossil_reserved_name(i, omitRepo))!=0; i++){ |
| @@ -181,11 +181,11 @@ | |
| 181 | int i; /* Loop counter */ |
| 182 | const char *zReserved; /* Name of a reserved file */ |
| 183 | Blob repoName; /* Treename of the repository */ |
| 184 | Stmt loop; /* SQL to loop over all files to add */ |
| 185 | int (*xCmp)(const char*,const char*); |
| 186 | |
| 187 | if( !file_tree_name(g.zRepositoryName, &repoName, 0) ){ |
| 188 | blob_zero(&repoName); |
| 189 | zRepo = ""; |
| 190 | }else{ |
| 191 | zRepo = blob_str(&repoName); |
| @@ -237,17 +237,17 @@ | |
| 237 | ** depends on the global setting, or the operating system default, if not set. |
| 238 | ** |
| 239 | ** Options: |
| 240 | ** |
| 241 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 242 | ** --dotfiles include files beginning with a dot (".") |
| 243 | ** -f|--force Add files without prompting |
| 244 | ** --ignore <CSG> ignore files matching patterns from the |
| 245 | ** comma separated list of glob patterns. |
| 246 | ** --clean <CSG> also ignore files matching patterns from |
| 247 | ** the comma separated list of glob patterns. |
| 248 | ** |
| 249 | ** See also: addremove, rm |
| 250 | */ |
| 251 | void add_cmd(void){ |
| 252 | int i; /* Loop counter */ |
| 253 | int vid; /* Currently checked out version */ |
| @@ -279,11 +279,11 @@ | |
| 279 | db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)", |
| 280 | filename_collation()); |
| 281 | pClean = glob_create(zCleanFlag); |
| 282 | pIgnore = glob_create(zIgnoreFlag); |
| 283 | nRoot = strlen(g.zLocalRoot); |
| 284 | |
| 285 | /* Load the names of all files that are to be added into sfile temp table */ |
| 286 | for(i=2; i<g.argc; i++){ |
| 287 | char *zName; |
| 288 | int isDir; |
| 289 | Blob fullName; |
| @@ -354,11 +354,11 @@ | |
| 354 | void delete_cmd(void){ |
| 355 | int i; |
| 356 | Stmt loop; |
| 357 | |
| 358 | capture_case_sensitive_option(); |
| 359 | |
| 360 | /* We should be done with options.. */ |
| 361 | verify_all_options(); |
| 362 | |
| 363 | db_must_be_within_tree(); |
| 364 | db_begin_transaction(); |
| @@ -379,11 +379,11 @@ | |
| 379 | zTreeName, filename_collation(), zTreeName, |
| 380 | filename_collation(), zTreeName, filename_collation() |
| 381 | ); |
| 382 | blob_reset(&treeName); |
| 383 | } |
| 384 | |
| 385 | db_prepare(&loop, "SELECT x FROM sfile"); |
| 386 | while( db_step(&loop)==SQLITE_ROW ){ |
| 387 | fossil_print("DELETED %s\n", db_column_text(&loop, 0)); |
| 388 | } |
| 389 | db_finalize(&loop); |
| @@ -494,12 +494,12 @@ | |
| 494 | ** on the "settings" command for further information. |
| 495 | ** |
| 496 | ** The -n|--dry-run option shows what would happen without actually doing anything. |
| 497 | ** |
| 498 | ** This command can be used to track third party software. |
| 499 | ** |
| 500 | ** Options: |
| 501 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 502 | ** --dotfiles include files beginning with a dot (".") |
| 503 | ** --ignore <CSG> ignore files matching patterns from the |
| 504 | ** comma separated list of glob patterns. |
| 505 | ** --clean <CSG> also ignore files matching patterns from |
| @@ -523,11 +523,11 @@ | |
| 523 | |
| 524 | if( !dryRunFlag ){ |
| 525 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 526 | } |
| 527 | capture_case_sensitive_option(); |
| 528 | |
| 529 | /* We should be done with options.. */ |
| 530 | verify_all_options(); |
| 531 | |
| 532 | db_must_be_within_tree(); |
| 533 | if( zCleanFlag==0 ){ |
| @@ -537,11 +537,11 @@ | |
| 537 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 538 | } |
| 539 | vid = db_lget_int("checkout",0); |
| 540 | db_begin_transaction(); |
| 541 | |
| 542 | /* step 1: |
| 543 | ** Populate the temp table "sfile" with the names of all unmanaged |
| 544 | ** files currently in the check-out, except for files that match the |
| 545 | ** --ignore or ignore-glob patterns and dot-files. Then add all of |
| 546 | ** the files in the sfile temp table to the set of managed files. |
| 547 | */ |
| @@ -563,12 +563,12 @@ | |
| 563 | " WHERE NOT deleted" |
| 564 | " ORDER BY 1", |
| 565 | g.zLocalRoot |
| 566 | ); |
| 567 | while( db_step(&q)==SQLITE_ROW ){ |
| 568 | const char * zFile; |
| 569 | const char * zPath; |
| 570 | |
| 571 | zFile = db_column_text(&q, 0); |
| 572 | zPath = db_column_text(&q, 1); |
| 573 | if( !file_wd_isfile_or_link(zPath) ){ |
| 574 | if( !dryRunFlag ){ |
| @@ -595,11 +595,11 @@ | |
| 595 | int x = db_int(-1, "SELECT deleted FROM vfile WHERE pathname=%Q %s", |
| 596 | zNew, filename_collation()); |
| 597 | if( x>=0 ){ |
| 598 | if( x==0 ){ |
| 599 | fossil_fatal("cannot rename '%s' to '%s' since another file named '%s'" |
| 600 | " is currently under management", zOrig, zNew, zNew); |
| 601 | }else{ |
| 602 | fossil_fatal("cannot rename '%s' to '%s' since the delete of '%s' has " |
| 603 | "not yet been committed", zOrig, zNew, zNew); |
| 604 | } |
| 605 | } |
| @@ -636,11 +636,11 @@ | |
| 636 | Blob dest; |
| 637 | Stmt q; |
| 638 | |
| 639 | capture_case_sensitive_option(); |
| 640 | db_must_be_within_tree(); |
| 641 | |
| 642 | /* We should be done with options.. */ |
| 643 | verify_all_options(); |
| 644 | |
| 645 | vid = db_lget_int("checkout", 0); |
| 646 | if( vid==0 ){ |
| 647 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -44,11 +44,11 @@ | |
| 44 | ".fslckout", |
| 45 | ".fslckout-journal", |
| 46 | ".fslckout-wal", |
| 47 | ".fslckout-shm", |
| 48 | |
| 49 | /* The use of ".fos" as the name of the checkout database is |
| 50 | ** deprecated. Use ".fslckout" instead. At some point, the following |
| 51 | ** entries should be removed. 2012-02-04 */ |
| 52 | ".fos", |
| 53 | ".fos-journal", |
| 54 | ".fos-wal", |
| @@ -123,11 +123,11 @@ | |
| 123 | */ |
| 124 | void test_reserved_names(void){ |
| 125 | int i; |
| 126 | const char *z; |
| 127 | int omitRepo = find_option("omitrepo",0,0)!=0; |
| 128 | |
| 129 | /* We should be done with options.. */ |
| 130 | verify_all_options(); |
| 131 | |
| 132 | db_must_be_within_tree(); |
| 133 | for(i=0; (z = fossil_reserved_name(i, omitRepo))!=0; i++){ |
| @@ -181,11 +181,11 @@ | |
| 181 | int i; /* Loop counter */ |
| 182 | const char *zReserved; /* Name of a reserved file */ |
| 183 | Blob repoName; /* Treename of the repository */ |
| 184 | Stmt loop; /* SQL to loop over all files to add */ |
| 185 | int (*xCmp)(const char*,const char*); |
| 186 | |
| 187 | if( !file_tree_name(g.zRepositoryName, &repoName, 0) ){ |
| 188 | blob_zero(&repoName); |
| 189 | zRepo = ""; |
| 190 | }else{ |
| 191 | zRepo = blob_str(&repoName); |
| @@ -237,17 +237,17 @@ | |
| 237 | ** depends on the global setting, or the operating system default, if not set. |
| 238 | ** |
| 239 | ** Options: |
| 240 | ** |
| 241 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 242 | ** --dotfiles include files beginning with a dot (".") |
| 243 | ** -f|--force Add files without prompting |
| 244 | ** --ignore <CSG> ignore files matching patterns from the |
| 245 | ** comma separated list of glob patterns. |
| 246 | ** --clean <CSG> also ignore files matching patterns from |
| 247 | ** the comma separated list of glob patterns. |
| 248 | ** |
| 249 | ** See also: addremove, rm |
| 250 | */ |
| 251 | void add_cmd(void){ |
| 252 | int i; /* Loop counter */ |
| 253 | int vid; /* Currently checked out version */ |
| @@ -279,11 +279,11 @@ | |
| 279 | db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)", |
| 280 | filename_collation()); |
| 281 | pClean = glob_create(zCleanFlag); |
| 282 | pIgnore = glob_create(zIgnoreFlag); |
| 283 | nRoot = strlen(g.zLocalRoot); |
| 284 | |
| 285 | /* Load the names of all files that are to be added into sfile temp table */ |
| 286 | for(i=2; i<g.argc; i++){ |
| 287 | char *zName; |
| 288 | int isDir; |
| 289 | Blob fullName; |
| @@ -354,11 +354,11 @@ | |
| 354 | void delete_cmd(void){ |
| 355 | int i; |
| 356 | Stmt loop; |
| 357 | |
| 358 | capture_case_sensitive_option(); |
| 359 | |
| 360 | /* We should be done with options.. */ |
| 361 | verify_all_options(); |
| 362 | |
| 363 | db_must_be_within_tree(); |
| 364 | db_begin_transaction(); |
| @@ -379,11 +379,11 @@ | |
| 379 | zTreeName, filename_collation(), zTreeName, |
| 380 | filename_collation(), zTreeName, filename_collation() |
| 381 | ); |
| 382 | blob_reset(&treeName); |
| 383 | } |
| 384 | |
| 385 | db_prepare(&loop, "SELECT x FROM sfile"); |
| 386 | while( db_step(&loop)==SQLITE_ROW ){ |
| 387 | fossil_print("DELETED %s\n", db_column_text(&loop, 0)); |
| 388 | } |
| 389 | db_finalize(&loop); |
| @@ -494,12 +494,12 @@ | |
| 494 | ** on the "settings" command for further information. |
| 495 | ** |
| 496 | ** The -n|--dry-run option shows what would happen without actually doing anything. |
| 497 | ** |
| 498 | ** This command can be used to track third party software. |
| 499 | ** |
| 500 | ** Options: |
| 501 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 502 | ** --dotfiles include files beginning with a dot (".") |
| 503 | ** --ignore <CSG> ignore files matching patterns from the |
| 504 | ** comma separated list of glob patterns. |
| 505 | ** --clean <CSG> also ignore files matching patterns from |
| @@ -523,11 +523,11 @@ | |
| 523 | |
| 524 | if( !dryRunFlag ){ |
| 525 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 526 | } |
| 527 | capture_case_sensitive_option(); |
| 528 | |
| 529 | /* We should be done with options.. */ |
| 530 | verify_all_options(); |
| 531 | |
| 532 | db_must_be_within_tree(); |
| 533 | if( zCleanFlag==0 ){ |
| @@ -537,11 +537,11 @@ | |
| 537 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 538 | } |
| 539 | vid = db_lget_int("checkout",0); |
| 540 | db_begin_transaction(); |
| 541 | |
| 542 | /* step 1: |
| 543 | ** Populate the temp table "sfile" with the names of all unmanaged |
| 544 | ** files currently in the check-out, except for files that match the |
| 545 | ** --ignore or ignore-glob patterns and dot-files. Then add all of |
| 546 | ** the files in the sfile temp table to the set of managed files. |
| 547 | */ |
| @@ -563,12 +563,12 @@ | |
| 563 | " WHERE NOT deleted" |
| 564 | " ORDER BY 1", |
| 565 | g.zLocalRoot |
| 566 | ); |
| 567 | while( db_step(&q)==SQLITE_ROW ){ |
| 568 | const char *zFile; |
| 569 | const char *zPath; |
| 570 | |
| 571 | zFile = db_column_text(&q, 0); |
| 572 | zPath = db_column_text(&q, 1); |
| 573 | if( !file_wd_isfile_or_link(zPath) ){ |
| 574 | if( !dryRunFlag ){ |
| @@ -595,11 +595,11 @@ | |
| 595 | int x = db_int(-1, "SELECT deleted FROM vfile WHERE pathname=%Q %s", |
| 596 | zNew, filename_collation()); |
| 597 | if( x>=0 ){ |
| 598 | if( x==0 ){ |
| 599 | fossil_fatal("cannot rename '%s' to '%s' since another file named '%s'" |
| 600 | " is currently under management", zOrig, zNew, zNew); |
| 601 | }else{ |
| 602 | fossil_fatal("cannot rename '%s' to '%s' since the delete of '%s' has " |
| 603 | "not yet been committed", zOrig, zNew, zNew); |
| 604 | } |
| 605 | } |
| @@ -636,11 +636,11 @@ | |
| 636 | Blob dest; |
| 637 | Stmt q; |
| 638 | |
| 639 | capture_case_sensitive_option(); |
| 640 | db_must_be_within_tree(); |
| 641 | |
| 642 | /* We should be done with options.. */ |
| 643 | verify_all_options(); |
| 644 | |
| 645 | vid = db_lget_int("checkout", 0); |
| 646 | if( vid==0 ){ |
| 647 |
+2
-2
| --- src/checkout.c | ||
| +++ src/checkout.c | ||
| @@ -296,11 +296,11 @@ | ||
| 296 | 296 | ** See also: open |
| 297 | 297 | */ |
| 298 | 298 | void close_cmd(void){ |
| 299 | 299 | int forceFlag = find_option("force","f",0)!=0; |
| 300 | 300 | db_must_be_within_tree(); |
| 301 | - | |
| 301 | + | |
| 302 | 302 | /* We should be done with options.. */ |
| 303 | 303 | verify_all_options(); |
| 304 | 304 | |
| 305 | 305 | if( !forceFlag && unsaved_changes(0) ){ |
| 306 | 306 | fossil_fatal("there are unsaved changes in the current checkout"); |
| @@ -311,13 +311,13 @@ | ||
| 311 | 311 | && db_exists("SELECT 1 FROM %s.stash", db_name("localdb")) |
| 312 | 312 | ){ |
| 313 | 313 | fossil_fatal("closing the checkout will delete your stash"); |
| 314 | 314 | } |
| 315 | 315 | if( db_is_writeable("repository") ){ |
| 316 | - char * zUnset = mprintf("ckout:%q", g.zLocalRoot); | |
| 316 | + char *zUnset = mprintf("ckout:%q", g.zLocalRoot); | |
| 317 | 317 | db_unset(zUnset, 1); |
| 318 | 318 | fossil_free(zUnset); |
| 319 | 319 | } |
| 320 | 320 | unlink_local_database(1); |
| 321 | 321 | db_close(1); |
| 322 | 322 | unlink_local_database(0); |
| 323 | 323 | } |
| 324 | 324 |
| --- src/checkout.c | |
| +++ src/checkout.c | |
| @@ -296,11 +296,11 @@ | |
| 296 | ** See also: open |
| 297 | */ |
| 298 | void close_cmd(void){ |
| 299 | int forceFlag = find_option("force","f",0)!=0; |
| 300 | db_must_be_within_tree(); |
| 301 | |
| 302 | /* We should be done with options.. */ |
| 303 | verify_all_options(); |
| 304 | |
| 305 | if( !forceFlag && unsaved_changes(0) ){ |
| 306 | fossil_fatal("there are unsaved changes in the current checkout"); |
| @@ -311,13 +311,13 @@ | |
| 311 | && db_exists("SELECT 1 FROM %s.stash", db_name("localdb")) |
| 312 | ){ |
| 313 | fossil_fatal("closing the checkout will delete your stash"); |
| 314 | } |
| 315 | if( db_is_writeable("repository") ){ |
| 316 | char * zUnset = mprintf("ckout:%q", g.zLocalRoot); |
| 317 | db_unset(zUnset, 1); |
| 318 | fossil_free(zUnset); |
| 319 | } |
| 320 | unlink_local_database(1); |
| 321 | db_close(1); |
| 322 | unlink_local_database(0); |
| 323 | } |
| 324 |
| --- src/checkout.c | |
| +++ src/checkout.c | |
| @@ -296,11 +296,11 @@ | |
| 296 | ** See also: open |
| 297 | */ |
| 298 | void close_cmd(void){ |
| 299 | int forceFlag = find_option("force","f",0)!=0; |
| 300 | db_must_be_within_tree(); |
| 301 | |
| 302 | /* We should be done with options.. */ |
| 303 | verify_all_options(); |
| 304 | |
| 305 | if( !forceFlag && unsaved_changes(0) ){ |
| 306 | fossil_fatal("there are unsaved changes in the current checkout"); |
| @@ -311,13 +311,13 @@ | |
| 311 | && db_exists("SELECT 1 FROM %s.stash", db_name("localdb")) |
| 312 | ){ |
| 313 | fossil_fatal("closing the checkout will delete your stash"); |
| 314 | } |
| 315 | if( db_is_writeable("repository") ){ |
| 316 | char *zUnset = mprintf("ckout:%q", g.zLocalRoot); |
| 317 | db_unset(zUnset, 1); |
| 318 | fossil_free(zUnset); |
| 319 | } |
| 320 | unlink_local_database(1); |
| 321 | db_close(1); |
| 322 | unlink_local_database(0); |
| 323 | } |
| 324 |
M
src/db.c
+8
-8
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -628,11 +628,11 @@ | ||
| 628 | 628 | ** Execute a query. Return the first column of the first row |
| 629 | 629 | ** of the result set as a string. Space to hold the string is |
| 630 | 630 | ** obtained from malloc(). If the result set is empty, return |
| 631 | 631 | ** zDefault instead. |
| 632 | 632 | */ |
| 633 | -char *db_text(char const *zDefault, const char *zSql, ...){ | |
| 633 | +char *db_text(const char *zDefault, const char *zSql, ...){ | |
| 634 | 634 | va_list ap; |
| 635 | 635 | Stmt s; |
| 636 | 636 | char *z; |
| 637 | 637 | va_start(ap, zSql); |
| 638 | 638 | db_vprepare(&s, 0, zSql, ap); |
| @@ -1482,11 +1482,11 @@ | ||
| 1482 | 1482 | |
| 1483 | 1483 | zTemplate = find_option("template",0,1); |
| 1484 | 1484 | zDate = find_option("date-override",0,1); |
| 1485 | 1485 | zDefaultUser = find_option("admin-user","A",1); |
| 1486 | 1486 | find_option("empty", 0, 0); /* deprecated */ |
| 1487 | - | |
| 1487 | + | |
| 1488 | 1488 | /* We should be done with options.. */ |
| 1489 | 1489 | verify_all_options(); |
| 1490 | 1490 | |
| 1491 | 1491 | if( g.argc!=3 ){ |
| 1492 | 1492 | usage("REPOSITORY-NAME"); |
| @@ -1939,17 +1939,17 @@ | ||
| 1939 | 1939 | /* |
| 1940 | 1940 | ** Returns non-0 if the database (which must be open) table identified |
| 1941 | 1941 | ** by zTableName has a column named zColName (case-sensitive), else |
| 1942 | 1942 | ** returns 0. |
| 1943 | 1943 | */ |
| 1944 | -int db_table_has_column( char const *zTableName, char const *zColName ){ | |
| 1944 | +int db_table_has_column(const char *zTableName, const char *zColName){ | |
| 1945 | 1945 | Stmt q = empty_Stmt; |
| 1946 | 1946 | int rc = 0; |
| 1947 | 1947 | db_prepare( &q, "PRAGMA table_info(%Q)", zTableName ); |
| 1948 | 1948 | while(SQLITE_ROW == db_step(&q)){ |
| 1949 | 1949 | /* Columns: (cid, name, type, notnull, dflt_value, pk) */ |
| 1950 | - char const * zCol = db_column_text(&q, 1); | |
| 1950 | + const char *zCol = db_column_text(&q, 1); | |
| 1951 | 1951 | if( 0==fossil_strcmp(zColName, zCol) ){ |
| 1952 | 1952 | rc = 1; |
| 1953 | 1953 | break; |
| 1954 | 1954 | } |
| 1955 | 1955 | } |
| @@ -2040,11 +2040,11 @@ | ||
| 2040 | 2040 | url_proxy_options(); |
| 2041 | 2041 | emptyFlag = find_option("empty",0,0)!=0; |
| 2042 | 2042 | keepFlag = find_option("keep",0,0)!=0; |
| 2043 | 2043 | forceMissingFlag = find_option("force-missing",0,0)!=0; |
| 2044 | 2044 | allowNested = find_option("nested",0,0)!=0; |
| 2045 | - | |
| 2045 | + | |
| 2046 | 2046 | /* We should be done with options.. */ |
| 2047 | 2047 | verify_all_options(); |
| 2048 | 2048 | |
| 2049 | 2049 | if( g.argc!=3 && g.argc!=4 ){ |
| 2050 | 2050 | usage("REPOSITORY-FILENAME ?VERSION?"); |
| @@ -2144,16 +2144,16 @@ | ||
| 2144 | 2144 | ** The behaviour page doesn't use a special layout. It lists all |
| 2145 | 2145 | ** set-commands and displays the 'set'-help as info. |
| 2146 | 2146 | */ |
| 2147 | 2147 | #if INTERFACE |
| 2148 | 2148 | struct stControlSettings { |
| 2149 | - char const *name; /* Name of the setting */ | |
| 2150 | - char const *var; /* Internal variable name used by db_set() */ | |
| 2149 | + const char *name; /* Name of the setting */ | |
| 2150 | + const char *var; /* Internal variable name used by db_set() */ | |
| 2151 | 2151 | int width; /* Width of display. 0 for boolean values. */ |
| 2152 | 2152 | int versionable; /* Is this setting versionable? */ |
| 2153 | 2153 | int forceTextArea; /* Force using a text area for display? */ |
| 2154 | - char const *def; /* Default value */ | |
| 2154 | + const char *def; /* Default value */ | |
| 2155 | 2155 | }; |
| 2156 | 2156 | #endif /* INTERFACE */ |
| 2157 | 2157 | struct stControlSettings const ctrlSettings[] = { |
| 2158 | 2158 | { "access-log", 0, 0, 0, 0, "off" }, |
| 2159 | 2159 | { "allow-symlinks", 0, 0, 1, 0, "off" }, |
| 2160 | 2160 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -628,11 +628,11 @@ | |
| 628 | ** Execute a query. Return the first column of the first row |
| 629 | ** of the result set as a string. Space to hold the string is |
| 630 | ** obtained from malloc(). If the result set is empty, return |
| 631 | ** zDefault instead. |
| 632 | */ |
| 633 | char *db_text(char const *zDefault, const char *zSql, ...){ |
| 634 | va_list ap; |
| 635 | Stmt s; |
| 636 | char *z; |
| 637 | va_start(ap, zSql); |
| 638 | db_vprepare(&s, 0, zSql, ap); |
| @@ -1482,11 +1482,11 @@ | |
| 1482 | |
| 1483 | zTemplate = find_option("template",0,1); |
| 1484 | zDate = find_option("date-override",0,1); |
| 1485 | zDefaultUser = find_option("admin-user","A",1); |
| 1486 | find_option("empty", 0, 0); /* deprecated */ |
| 1487 | |
| 1488 | /* We should be done with options.. */ |
| 1489 | verify_all_options(); |
| 1490 | |
| 1491 | if( g.argc!=3 ){ |
| 1492 | usage("REPOSITORY-NAME"); |
| @@ -1939,17 +1939,17 @@ | |
| 1939 | /* |
| 1940 | ** Returns non-0 if the database (which must be open) table identified |
| 1941 | ** by zTableName has a column named zColName (case-sensitive), else |
| 1942 | ** returns 0. |
| 1943 | */ |
| 1944 | int db_table_has_column( char const *zTableName, char const *zColName ){ |
| 1945 | Stmt q = empty_Stmt; |
| 1946 | int rc = 0; |
| 1947 | db_prepare( &q, "PRAGMA table_info(%Q)", zTableName ); |
| 1948 | while(SQLITE_ROW == db_step(&q)){ |
| 1949 | /* Columns: (cid, name, type, notnull, dflt_value, pk) */ |
| 1950 | char const * zCol = db_column_text(&q, 1); |
| 1951 | if( 0==fossil_strcmp(zColName, zCol) ){ |
| 1952 | rc = 1; |
| 1953 | break; |
| 1954 | } |
| 1955 | } |
| @@ -2040,11 +2040,11 @@ | |
| 2040 | url_proxy_options(); |
| 2041 | emptyFlag = find_option("empty",0,0)!=0; |
| 2042 | keepFlag = find_option("keep",0,0)!=0; |
| 2043 | forceMissingFlag = find_option("force-missing",0,0)!=0; |
| 2044 | allowNested = find_option("nested",0,0)!=0; |
| 2045 | |
| 2046 | /* We should be done with options.. */ |
| 2047 | verify_all_options(); |
| 2048 | |
| 2049 | if( g.argc!=3 && g.argc!=4 ){ |
| 2050 | usage("REPOSITORY-FILENAME ?VERSION?"); |
| @@ -2144,16 +2144,16 @@ | |
| 2144 | ** The behaviour page doesn't use a special layout. It lists all |
| 2145 | ** set-commands and displays the 'set'-help as info. |
| 2146 | */ |
| 2147 | #if INTERFACE |
| 2148 | struct stControlSettings { |
| 2149 | char const *name; /* Name of the setting */ |
| 2150 | char const *var; /* Internal variable name used by db_set() */ |
| 2151 | int width; /* Width of display. 0 for boolean values. */ |
| 2152 | int versionable; /* Is this setting versionable? */ |
| 2153 | int forceTextArea; /* Force using a text area for display? */ |
| 2154 | char const *def; /* Default value */ |
| 2155 | }; |
| 2156 | #endif /* INTERFACE */ |
| 2157 | struct stControlSettings const ctrlSettings[] = { |
| 2158 | { "access-log", 0, 0, 0, 0, "off" }, |
| 2159 | { "allow-symlinks", 0, 0, 1, 0, "off" }, |
| 2160 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -628,11 +628,11 @@ | |
| 628 | ** Execute a query. Return the first column of the first row |
| 629 | ** of the result set as a string. Space to hold the string is |
| 630 | ** obtained from malloc(). If the result set is empty, return |
| 631 | ** zDefault instead. |
| 632 | */ |
| 633 | char *db_text(const char *zDefault, const char *zSql, ...){ |
| 634 | va_list ap; |
| 635 | Stmt s; |
| 636 | char *z; |
| 637 | va_start(ap, zSql); |
| 638 | db_vprepare(&s, 0, zSql, ap); |
| @@ -1482,11 +1482,11 @@ | |
| 1482 | |
| 1483 | zTemplate = find_option("template",0,1); |
| 1484 | zDate = find_option("date-override",0,1); |
| 1485 | zDefaultUser = find_option("admin-user","A",1); |
| 1486 | find_option("empty", 0, 0); /* deprecated */ |
| 1487 | |
| 1488 | /* We should be done with options.. */ |
| 1489 | verify_all_options(); |
| 1490 | |
| 1491 | if( g.argc!=3 ){ |
| 1492 | usage("REPOSITORY-NAME"); |
| @@ -1939,17 +1939,17 @@ | |
| 1939 | /* |
| 1940 | ** Returns non-0 if the database (which must be open) table identified |
| 1941 | ** by zTableName has a column named zColName (case-sensitive), else |
| 1942 | ** returns 0. |
| 1943 | */ |
| 1944 | int db_table_has_column(const char *zTableName, const char *zColName){ |
| 1945 | Stmt q = empty_Stmt; |
| 1946 | int rc = 0; |
| 1947 | db_prepare( &q, "PRAGMA table_info(%Q)", zTableName ); |
| 1948 | while(SQLITE_ROW == db_step(&q)){ |
| 1949 | /* Columns: (cid, name, type, notnull, dflt_value, pk) */ |
| 1950 | const char *zCol = db_column_text(&q, 1); |
| 1951 | if( 0==fossil_strcmp(zColName, zCol) ){ |
| 1952 | rc = 1; |
| 1953 | break; |
| 1954 | } |
| 1955 | } |
| @@ -2040,11 +2040,11 @@ | |
| 2040 | url_proxy_options(); |
| 2041 | emptyFlag = find_option("empty",0,0)!=0; |
| 2042 | keepFlag = find_option("keep",0,0)!=0; |
| 2043 | forceMissingFlag = find_option("force-missing",0,0)!=0; |
| 2044 | allowNested = find_option("nested",0,0)!=0; |
| 2045 | |
| 2046 | /* We should be done with options.. */ |
| 2047 | verify_all_options(); |
| 2048 | |
| 2049 | if( g.argc!=3 && g.argc!=4 ){ |
| 2050 | usage("REPOSITORY-FILENAME ?VERSION?"); |
| @@ -2144,16 +2144,16 @@ | |
| 2144 | ** The behaviour page doesn't use a special layout. It lists all |
| 2145 | ** set-commands and displays the 'set'-help as info. |
| 2146 | */ |
| 2147 | #if INTERFACE |
| 2148 | struct stControlSettings { |
| 2149 | const char *name; /* Name of the setting */ |
| 2150 | const char *var; /* Internal variable name used by db_set() */ |
| 2151 | int width; /* Width of display. 0 for boolean values. */ |
| 2152 | int versionable; /* Is this setting versionable? */ |
| 2153 | int forceTextArea; /* Force using a text area for display? */ |
| 2154 | const char *def; /* Default value */ |
| 2155 | }; |
| 2156 | #endif /* INTERFACE */ |
| 2157 | struct stControlSettings const ctrlSettings[] = { |
| 2158 | { "access-log", 0, 0, 0, 0, "off" }, |
| 2159 | { "allow-symlinks", 0, 0, 1, 0, "off" }, |
| 2160 |
+14
-14
| --- src/login.c | ||
| +++ src/login.c | ||
| @@ -208,12 +208,12 @@ | ||
| 208 | 208 | ** On serious (DB-level) error it will probably exit. |
| 209 | 209 | ** |
| 210 | 210 | ** zPassword may be either the plain-text form or the encrypted |
| 211 | 211 | ** form of the user's password. |
| 212 | 212 | */ |
| 213 | -int login_search_uid(char const *zUsername, char const *zPasswd){ | |
| 214 | - char * zSha1Pw = sha1_shared_secret(zPasswd, zUsername, 0); | |
| 213 | +int login_search_uid(const char *zUsername, const char *zPasswd){ | |
| 214 | + char *zSha1Pw = sha1_shared_secret(zPasswd, zUsername, 0); | |
| 215 | 215 | int const uid = |
| 216 | 216 | db_int(0, |
| 217 | 217 | "SELECT uid FROM user" |
| 218 | 218 | " WHERE login=%Q" |
| 219 | 219 | " AND length(cap)>0 AND length(pw)>0" |
| @@ -231,12 +231,12 @@ | ||
| 231 | 231 | ** The zHash parameter must be a random value which must be |
| 232 | 232 | ** subsequently stored in user.cookie for later validation. |
| 233 | 233 | ** |
| 234 | 234 | ** The returned memory should be free()d after use. |
| 235 | 235 | */ |
| 236 | -char * login_gen_user_cookie_value(char const *zUsername, char const * zHash){ | |
| 237 | - char * zProjCode = db_get("project-code",NULL); | |
| 236 | +char *login_gen_user_cookie_value(const char *zUsername, const char *zHash){ | |
| 237 | + char *zProjCode = db_get("project-code",NULL); | |
| 238 | 238 | char *zCode = abbreviated_project_code(zProjCode); |
| 239 | 239 | free(zProjCode); |
| 240 | 240 | assert((zUsername && *zUsername) && "Invalid user data."); |
| 241 | 241 | return mprintf("%s/%z/%s", zHash, zCode, zUsername); |
| 242 | 242 | } |
| @@ -252,20 +252,20 @@ | ||
| 252 | 252 | ** If zDest is not NULL then the generated cookie is copied to |
| 253 | 253 | ** *zDdest and ownership is transfered to the caller (who should |
| 254 | 254 | ** eventually pass it to free()). |
| 255 | 255 | */ |
| 256 | 256 | void login_set_user_cookie( |
| 257 | - char const * zUsername, /* User's name */ | |
| 257 | + const char *zUsername, /* User's name */ | |
| 258 | 258 | int uid, /* User's ID */ |
| 259 | - char ** zDest /* Optional: store generated cookie value. */ | |
| 259 | + char **zDest /* Optional: store generated cookie value. */ | |
| 260 | 260 | ){ |
| 261 | 261 | const char *zCookieName = login_cookie_name(); |
| 262 | 262 | const char *zExpire = db_get("cookie-expire","8766"); |
| 263 | 263 | int expires = atoi(zExpire)*3600; |
| 264 | 264 | char *zHash; |
| 265 | 265 | char *zCookie; |
| 266 | - char const *zIpAddr = PD("REMOTE_ADDR","nil"); /* IP address of user */ | |
| 266 | + const char *zIpAddr = PD("REMOTE_ADDR","nil"); /* IP address of user */ | |
| 267 | 267 | char *zRemoteAddr = ipPrefix(zIpAddr); /* Abbreviated IP address */ |
| 268 | 268 | |
| 269 | 269 | assert((zUsername && *zUsername) && (uid > 0) && "Invalid user data."); |
| 270 | 270 | zHash = db_text(0, |
| 271 | 271 | "SELECT cookie FROM user" |
| @@ -303,16 +303,16 @@ | ||
| 303 | 303 | ** is used. |
| 304 | 304 | ** |
| 305 | 305 | ** If zCookieDest is not NULL then the generated cookie is assigned to |
| 306 | 306 | ** *zCookieDest and the caller must eventually free() it. |
| 307 | 307 | */ |
| 308 | -void login_set_anon_cookie(char const * zIpAddr, char ** zCookieDest ){ | |
| 309 | - char const *zNow; /* Current time (julian day number) */ | |
| 308 | +void login_set_anon_cookie(const char *zIpAddr, char **zCookieDest ){ | |
| 309 | + const char *zNow; /* Current time (julian day number) */ | |
| 310 | 310 | char *zCookie; /* The login cookie */ |
| 311 | - char const *zCookieName; /* Name of the login cookie */ | |
| 311 | + const char *zCookieName; /* Name of the login cookie */ | |
| 312 | 312 | Blob b; /* Blob used during cookie construction */ |
| 313 | - char * zRemoteAddr; /* Abbreviated IP address */ | |
| 313 | + char *zRemoteAddr; /* Abbreviated IP address */ | |
| 314 | 314 | if(!zIpAddr){ |
| 315 | 315 | zIpAddr = PD("REMOTE_ADDR","nil"); |
| 316 | 316 | } |
| 317 | 317 | zRemoteAddr = ipPrefix(zIpAddr); |
| 318 | 318 | zCookieName = login_cookie_name(); |
| @@ -344,11 +344,11 @@ | ||
| 344 | 344 | */ |
| 345 | 345 | void login_clear_login_data(){ |
| 346 | 346 | if(!g.userUid){ |
| 347 | 347 | return; |
| 348 | 348 | }else{ |
| 349 | - char const * cookie = login_cookie_name(); | |
| 349 | + const char *cookie = login_cookie_name(); | |
| 350 | 350 | /* To logout, change the cookie value to an empty string */ |
| 351 | 351 | cgi_set_cookie(cookie, "", |
| 352 | 352 | login_cookie_path(), -86400); |
| 353 | 353 | db_multi_exec("UPDATE user SET cookie=NULL, ipaddr=NULL, " |
| 354 | 354 | " cexpire=0 WHERE uid=%d" |
| @@ -629,11 +629,11 @@ | ||
| 629 | 629 | @ <p>If you do not have an account, you can |
| 630 | 630 | @ <a href="%s(g.zTop)/register?g=%T(P("G"))">create one</a>. |
| 631 | 631 | } |
| 632 | 632 | if( zAnonPw ){ |
| 633 | 633 | unsigned int uSeed = captcha_seed(); |
| 634 | - char const *zDecoded = captcha_decode(uSeed); | |
| 634 | + const char *zDecoded = captcha_decode(uSeed); | |
| 635 | 635 | int bAutoCaptcha = db_get_boolean("auto-captcha", 0); |
| 636 | 636 | char *zCaptcha = captcha_render(zDecoded); |
| 637 | 637 | |
| 638 | 638 | @ <p><input type="hidden" name="cs" value="%u(uSeed)" /> |
| 639 | 639 | @ Visitors may enter <b>anonymous</b> as the user-ID with |
| @@ -1236,11 +1236,11 @@ | ||
| 1236 | 1236 | ** |
| 1237 | 1237 | */ |
| 1238 | 1238 | void register_page(void){ |
| 1239 | 1239 | const char *zUsername, *zPasswd, *zConfirm, *zContact, *zCS, *zPw, *zCap; |
| 1240 | 1240 | unsigned int uSeed; |
| 1241 | - char const *zDecoded; | |
| 1241 | + const char *zDecoded; | |
| 1242 | 1242 | char *zCaptcha; |
| 1243 | 1243 | if( !db_get_boolean("self-register", 0) ){ |
| 1244 | 1244 | style_header("Registration not possible"); |
| 1245 | 1245 | @ <p>This project does not allow user self-registration. Please contact the |
| 1246 | 1246 | @ project administrator to obtain an account.</p> |
| 1247 | 1247 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -208,12 +208,12 @@ | |
| 208 | ** On serious (DB-level) error it will probably exit. |
| 209 | ** |
| 210 | ** zPassword may be either the plain-text form or the encrypted |
| 211 | ** form of the user's password. |
| 212 | */ |
| 213 | int login_search_uid(char const *zUsername, char const *zPasswd){ |
| 214 | char * zSha1Pw = sha1_shared_secret(zPasswd, zUsername, 0); |
| 215 | int const uid = |
| 216 | db_int(0, |
| 217 | "SELECT uid FROM user" |
| 218 | " WHERE login=%Q" |
| 219 | " AND length(cap)>0 AND length(pw)>0" |
| @@ -231,12 +231,12 @@ | |
| 231 | ** The zHash parameter must be a random value which must be |
| 232 | ** subsequently stored in user.cookie for later validation. |
| 233 | ** |
| 234 | ** The returned memory should be free()d after use. |
| 235 | */ |
| 236 | char * login_gen_user_cookie_value(char const *zUsername, char const * zHash){ |
| 237 | char * zProjCode = db_get("project-code",NULL); |
| 238 | char *zCode = abbreviated_project_code(zProjCode); |
| 239 | free(zProjCode); |
| 240 | assert((zUsername && *zUsername) && "Invalid user data."); |
| 241 | return mprintf("%s/%z/%s", zHash, zCode, zUsername); |
| 242 | } |
| @@ -252,20 +252,20 @@ | |
| 252 | ** If zDest is not NULL then the generated cookie is copied to |
| 253 | ** *zDdest and ownership is transfered to the caller (who should |
| 254 | ** eventually pass it to free()). |
| 255 | */ |
| 256 | void login_set_user_cookie( |
| 257 | char const * zUsername, /* User's name */ |
| 258 | int uid, /* User's ID */ |
| 259 | char ** zDest /* Optional: store generated cookie value. */ |
| 260 | ){ |
| 261 | const char *zCookieName = login_cookie_name(); |
| 262 | const char *zExpire = db_get("cookie-expire","8766"); |
| 263 | int expires = atoi(zExpire)*3600; |
| 264 | char *zHash; |
| 265 | char *zCookie; |
| 266 | char const *zIpAddr = PD("REMOTE_ADDR","nil"); /* IP address of user */ |
| 267 | char *zRemoteAddr = ipPrefix(zIpAddr); /* Abbreviated IP address */ |
| 268 | |
| 269 | assert((zUsername && *zUsername) && (uid > 0) && "Invalid user data."); |
| 270 | zHash = db_text(0, |
| 271 | "SELECT cookie FROM user" |
| @@ -303,16 +303,16 @@ | |
| 303 | ** is used. |
| 304 | ** |
| 305 | ** If zCookieDest is not NULL then the generated cookie is assigned to |
| 306 | ** *zCookieDest and the caller must eventually free() it. |
| 307 | */ |
| 308 | void login_set_anon_cookie(char const * zIpAddr, char ** zCookieDest ){ |
| 309 | char const *zNow; /* Current time (julian day number) */ |
| 310 | char *zCookie; /* The login cookie */ |
| 311 | char const *zCookieName; /* Name of the login cookie */ |
| 312 | Blob b; /* Blob used during cookie construction */ |
| 313 | char * zRemoteAddr; /* Abbreviated IP address */ |
| 314 | if(!zIpAddr){ |
| 315 | zIpAddr = PD("REMOTE_ADDR","nil"); |
| 316 | } |
| 317 | zRemoteAddr = ipPrefix(zIpAddr); |
| 318 | zCookieName = login_cookie_name(); |
| @@ -344,11 +344,11 @@ | |
| 344 | */ |
| 345 | void login_clear_login_data(){ |
| 346 | if(!g.userUid){ |
| 347 | return; |
| 348 | }else{ |
| 349 | char const * cookie = login_cookie_name(); |
| 350 | /* To logout, change the cookie value to an empty string */ |
| 351 | cgi_set_cookie(cookie, "", |
| 352 | login_cookie_path(), -86400); |
| 353 | db_multi_exec("UPDATE user SET cookie=NULL, ipaddr=NULL, " |
| 354 | " cexpire=0 WHERE uid=%d" |
| @@ -629,11 +629,11 @@ | |
| 629 | @ <p>If you do not have an account, you can |
| 630 | @ <a href="%s(g.zTop)/register?g=%T(P("G"))">create one</a>. |
| 631 | } |
| 632 | if( zAnonPw ){ |
| 633 | unsigned int uSeed = captcha_seed(); |
| 634 | char const *zDecoded = captcha_decode(uSeed); |
| 635 | int bAutoCaptcha = db_get_boolean("auto-captcha", 0); |
| 636 | char *zCaptcha = captcha_render(zDecoded); |
| 637 | |
| 638 | @ <p><input type="hidden" name="cs" value="%u(uSeed)" /> |
| 639 | @ Visitors may enter <b>anonymous</b> as the user-ID with |
| @@ -1236,11 +1236,11 @@ | |
| 1236 | ** |
| 1237 | */ |
| 1238 | void register_page(void){ |
| 1239 | const char *zUsername, *zPasswd, *zConfirm, *zContact, *zCS, *zPw, *zCap; |
| 1240 | unsigned int uSeed; |
| 1241 | char const *zDecoded; |
| 1242 | char *zCaptcha; |
| 1243 | if( !db_get_boolean("self-register", 0) ){ |
| 1244 | style_header("Registration not possible"); |
| 1245 | @ <p>This project does not allow user self-registration. Please contact the |
| 1246 | @ project administrator to obtain an account.</p> |
| 1247 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -208,12 +208,12 @@ | |
| 208 | ** On serious (DB-level) error it will probably exit. |
| 209 | ** |
| 210 | ** zPassword may be either the plain-text form or the encrypted |
| 211 | ** form of the user's password. |
| 212 | */ |
| 213 | int login_search_uid(const char *zUsername, const char *zPasswd){ |
| 214 | char *zSha1Pw = sha1_shared_secret(zPasswd, zUsername, 0); |
| 215 | int const uid = |
| 216 | db_int(0, |
| 217 | "SELECT uid FROM user" |
| 218 | " WHERE login=%Q" |
| 219 | " AND length(cap)>0 AND length(pw)>0" |
| @@ -231,12 +231,12 @@ | |
| 231 | ** The zHash parameter must be a random value which must be |
| 232 | ** subsequently stored in user.cookie for later validation. |
| 233 | ** |
| 234 | ** The returned memory should be free()d after use. |
| 235 | */ |
| 236 | char *login_gen_user_cookie_value(const char *zUsername, const char *zHash){ |
| 237 | char *zProjCode = db_get("project-code",NULL); |
| 238 | char *zCode = abbreviated_project_code(zProjCode); |
| 239 | free(zProjCode); |
| 240 | assert((zUsername && *zUsername) && "Invalid user data."); |
| 241 | return mprintf("%s/%z/%s", zHash, zCode, zUsername); |
| 242 | } |
| @@ -252,20 +252,20 @@ | |
| 252 | ** If zDest is not NULL then the generated cookie is copied to |
| 253 | ** *zDdest and ownership is transfered to the caller (who should |
| 254 | ** eventually pass it to free()). |
| 255 | */ |
| 256 | void login_set_user_cookie( |
| 257 | const char *zUsername, /* User's name */ |
| 258 | int uid, /* User's ID */ |
| 259 | char **zDest /* Optional: store generated cookie value. */ |
| 260 | ){ |
| 261 | const char *zCookieName = login_cookie_name(); |
| 262 | const char *zExpire = db_get("cookie-expire","8766"); |
| 263 | int expires = atoi(zExpire)*3600; |
| 264 | char *zHash; |
| 265 | char *zCookie; |
| 266 | const char *zIpAddr = PD("REMOTE_ADDR","nil"); /* IP address of user */ |
| 267 | char *zRemoteAddr = ipPrefix(zIpAddr); /* Abbreviated IP address */ |
| 268 | |
| 269 | assert((zUsername && *zUsername) && (uid > 0) && "Invalid user data."); |
| 270 | zHash = db_text(0, |
| 271 | "SELECT cookie FROM user" |
| @@ -303,16 +303,16 @@ | |
| 303 | ** is used. |
| 304 | ** |
| 305 | ** If zCookieDest is not NULL then the generated cookie is assigned to |
| 306 | ** *zCookieDest and the caller must eventually free() it. |
| 307 | */ |
| 308 | void login_set_anon_cookie(const char *zIpAddr, char **zCookieDest ){ |
| 309 | const char *zNow; /* Current time (julian day number) */ |
| 310 | char *zCookie; /* The login cookie */ |
| 311 | const char *zCookieName; /* Name of the login cookie */ |
| 312 | Blob b; /* Blob used during cookie construction */ |
| 313 | char *zRemoteAddr; /* Abbreviated IP address */ |
| 314 | if(!zIpAddr){ |
| 315 | zIpAddr = PD("REMOTE_ADDR","nil"); |
| 316 | } |
| 317 | zRemoteAddr = ipPrefix(zIpAddr); |
| 318 | zCookieName = login_cookie_name(); |
| @@ -344,11 +344,11 @@ | |
| 344 | */ |
| 345 | void login_clear_login_data(){ |
| 346 | if(!g.userUid){ |
| 347 | return; |
| 348 | }else{ |
| 349 | const char *cookie = login_cookie_name(); |
| 350 | /* To logout, change the cookie value to an empty string */ |
| 351 | cgi_set_cookie(cookie, "", |
| 352 | login_cookie_path(), -86400); |
| 353 | db_multi_exec("UPDATE user SET cookie=NULL, ipaddr=NULL, " |
| 354 | " cexpire=0 WHERE uid=%d" |
| @@ -629,11 +629,11 @@ | |
| 629 | @ <p>If you do not have an account, you can |
| 630 | @ <a href="%s(g.zTop)/register?g=%T(P("G"))">create one</a>. |
| 631 | } |
| 632 | if( zAnonPw ){ |
| 633 | unsigned int uSeed = captcha_seed(); |
| 634 | const char *zDecoded = captcha_decode(uSeed); |
| 635 | int bAutoCaptcha = db_get_boolean("auto-captcha", 0); |
| 636 | char *zCaptcha = captcha_render(zDecoded); |
| 637 | |
| 638 | @ <p><input type="hidden" name="cs" value="%u(uSeed)" /> |
| 639 | @ Visitors may enter <b>anonymous</b> as the user-ID with |
| @@ -1236,11 +1236,11 @@ | |
| 1236 | ** |
| 1237 | */ |
| 1238 | void register_page(void){ |
| 1239 | const char *zUsername, *zPasswd, *zConfirm, *zContact, *zCS, *zPw, *zCap; |
| 1240 | unsigned int uSeed; |
| 1241 | const char *zDecoded; |
| 1242 | char *zCaptcha; |
| 1243 | if( !db_get_boolean("self-register", 0) ){ |
| 1244 | style_header("Registration not possible"); |
| 1245 | @ <p>This project does not allow user self-registration. Please contact the |
| 1246 | @ project administrator to obtain an account.</p> |
| 1247 |
+20
-20
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -229,45 +229,45 @@ | ||
| 229 | 229 | */ |
| 230 | 230 | int resultCode; /* used for passing back specific codes |
| 231 | 231 | ** from /json callbacks. */ |
| 232 | 232 | int errorDetailParanoia; /* 0=full error codes, 1=%10, 2=%100, 3=%1000 */ |
| 233 | 233 | cson_output_opt outOpt; /* formatting options for JSON mode. */ |
| 234 | - cson_value * authToken; /* authentication token */ | |
| 235 | - char const * jsonp; /* Name of JSONP function wrapper. */ | |
| 234 | + cson_value *authToken; /* authentication token */ | |
| 235 | + const char *jsonp; /* Name of JSONP function wrapper. */ | |
| 236 | 236 | unsigned char dispatchDepth /* Tells JSON command dispatching |
| 237 | 237 | which argument we are currently |
| 238 | 238 | working on. For this purpose, arg#0 |
| 239 | 239 | is the "json" path/CLI arg. |
| 240 | 240 | */; |
| 241 | 241 | struct { /* "garbage collector" */ |
| 242 | - cson_value * v; | |
| 243 | - cson_array * a; | |
| 242 | + cson_value *v; | |
| 243 | + cson_array *a; | |
| 244 | 244 | } gc; |
| 245 | 245 | struct { /* JSON POST data. */ |
| 246 | - cson_value * v; | |
| 247 | - cson_array * a; | |
| 246 | + cson_value *v; | |
| 247 | + cson_array *a; | |
| 248 | 248 | int offset; /* Tells us which PATH_INFO/CLI args |
| 249 | 249 | part holds the "json" command, so |
| 250 | 250 | that we can account for sub-repos |
| 251 | 251 | and path prefixes. This is handled |
| 252 | 252 | differently for CLI and CGI modes. |
| 253 | 253 | */ |
| 254 | - char const * commandStr /*"command" request param.*/; | |
| 254 | + const char *commandStr /*"command" request param.*/; | |
| 255 | 255 | } cmd; |
| 256 | 256 | struct { /* JSON POST data. */ |
| 257 | - cson_value * v; | |
| 258 | - cson_object * o; | |
| 257 | + cson_value *v; | |
| 258 | + cson_object *o; | |
| 259 | 259 | } post; |
| 260 | 260 | struct { /* GET/COOKIE params in JSON mode. */ |
| 261 | - cson_value * v; | |
| 262 | - cson_object * o; | |
| 261 | + cson_value *v; | |
| 262 | + cson_object *o; | |
| 263 | 263 | } param; |
| 264 | 264 | struct { |
| 265 | - cson_value * v; | |
| 266 | - cson_object * o; | |
| 265 | + cson_value *v; | |
| 266 | + cson_object *o; | |
| 267 | 267 | } reqPayload; /* request payload object (if any) */ |
| 268 | - cson_array * warnings; /* response warnings */ | |
| 268 | + cson_array *warnings; /* response warnings */ | |
| 269 | 269 | int timerId; /* fetched from fossil_timer_start() */ |
| 270 | 270 | } json; |
| 271 | 271 | #endif /* FOSSIL_ENABLE_JSON */ |
| 272 | 272 | }; |
| 273 | 273 | |
| @@ -391,11 +391,11 @@ | ||
| 391 | 391 | unsigned int nLine; /* Number of lines in the file*/ |
| 392 | 392 | unsigned int i, j, k; /* Loop counters */ |
| 393 | 393 | int n; /* Number of bytes in one line */ |
| 394 | 394 | char *z; /* General use string pointer */ |
| 395 | 395 | char **newArgv; /* New expanded g.argv under construction */ |
| 396 | - char const * zFileName; /* input file name */ | |
| 396 | + const char *zFileName; /* input file name */ | |
| 397 | 397 | FILE *inFile; /* input FILE */ |
| 398 | 398 | #if defined(_WIN32) |
| 399 | 399 | wchar_t buf[MAX_PATH]; |
| 400 | 400 | #endif |
| 401 | 401 | |
| @@ -1004,12 +1004,12 @@ | ||
| 1004 | 1004 | ** %fossil help --w|-www Show list of WWW pages |
| 1005 | 1005 | */ |
| 1006 | 1006 | void help_cmd(void){ |
| 1007 | 1007 | int rc, idx, isPage = 0; |
| 1008 | 1008 | const char *z; |
| 1009 | - char const * zCmdOrPage; | |
| 1010 | - char const * zCmdOrPagePlural; | |
| 1009 | + const char *zCmdOrPage; | |
| 1010 | + const char *zCmdOrPagePlural; | |
| 1011 | 1011 | if( g.argc<3 ){ |
| 1012 | 1012 | z = g.argv[0]; |
| 1013 | 1013 | fossil_print( |
| 1014 | 1014 | "Usage: %s help COMMAND\n" |
| 1015 | 1015 | "Common COMMANDs: (use \"%s help -a|--all\" for a complete list)\n", |
| @@ -1074,18 +1074,18 @@ | ||
| 1074 | 1074 | /* |
| 1075 | 1075 | ** WEBPAGE: help |
| 1076 | 1076 | ** URL: /help/CMD |
| 1077 | 1077 | */ |
| 1078 | 1078 | void help_page(void){ |
| 1079 | - const char * zCmd = P("cmd"); | |
| 1079 | + const char *zCmd = P("cmd"); | |
| 1080 | 1080 | |
| 1081 | 1081 | if( zCmd==0 ) zCmd = P("name"); |
| 1082 | 1082 | style_header("Command-line Help"); |
| 1083 | 1083 | if( zCmd ){ |
| 1084 | 1084 | int rc, idx; |
| 1085 | 1085 | char *z, *s, *d; |
| 1086 | - char const * zCmdOrPage = ('/'==*zCmd) ? "page" : "command"; | |
| 1086 | + const char *zCmdOrPage = ('/'==*zCmd) ? "page" : "command"; | |
| 1087 | 1087 | style_submenu_element("Command-List", "Command-List", "%s/help", g.zTop); |
| 1088 | 1088 | @ <h1>The "%s(zCmd)" %s(zCmdOrPage):</h1> |
| 1089 | 1089 | rc = name_search(zCmd, aCommand, count(aCommand), 0, &idx); |
| 1090 | 1090 | if( rc==1 ){ |
| 1091 | 1091 | @ unknown command: %s(zCmd) |
| @@ -2122,11 +2122,11 @@ | ||
| 2122 | 2122 | zAltBase = find_option("baseurl", 0, 1); |
| 2123 | 2123 | if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI; |
| 2124 | 2124 | if( zAltBase ){ |
| 2125 | 2125 | set_base_url(zAltBase); |
| 2126 | 2126 | } |
| 2127 | - if ( find_option("localhost", 0, 0)!=0 ){ | |
| 2127 | + if( find_option("localhost", 0, 0)!=0 ){ | |
| 2128 | 2128 | flags |= HTTP_SERVER_LOCALHOST; |
| 2129 | 2129 | } |
| 2130 | 2130 | |
| 2131 | 2131 | /* We should be done with options.. */ |
| 2132 | 2132 | verify_all_options(); |
| 2133 | 2133 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -229,45 +229,45 @@ | |
| 229 | */ |
| 230 | int resultCode; /* used for passing back specific codes |
| 231 | ** from /json callbacks. */ |
| 232 | int errorDetailParanoia; /* 0=full error codes, 1=%10, 2=%100, 3=%1000 */ |
| 233 | cson_output_opt outOpt; /* formatting options for JSON mode. */ |
| 234 | cson_value * authToken; /* authentication token */ |
| 235 | char const * jsonp; /* Name of JSONP function wrapper. */ |
| 236 | unsigned char dispatchDepth /* Tells JSON command dispatching |
| 237 | which argument we are currently |
| 238 | working on. For this purpose, arg#0 |
| 239 | is the "json" path/CLI arg. |
| 240 | */; |
| 241 | struct { /* "garbage collector" */ |
| 242 | cson_value * v; |
| 243 | cson_array * a; |
| 244 | } gc; |
| 245 | struct { /* JSON POST data. */ |
| 246 | cson_value * v; |
| 247 | cson_array * a; |
| 248 | int offset; /* Tells us which PATH_INFO/CLI args |
| 249 | part holds the "json" command, so |
| 250 | that we can account for sub-repos |
| 251 | and path prefixes. This is handled |
| 252 | differently for CLI and CGI modes. |
| 253 | */ |
| 254 | char const * commandStr /*"command" request param.*/; |
| 255 | } cmd; |
| 256 | struct { /* JSON POST data. */ |
| 257 | cson_value * v; |
| 258 | cson_object * o; |
| 259 | } post; |
| 260 | struct { /* GET/COOKIE params in JSON mode. */ |
| 261 | cson_value * v; |
| 262 | cson_object * o; |
| 263 | } param; |
| 264 | struct { |
| 265 | cson_value * v; |
| 266 | cson_object * o; |
| 267 | } reqPayload; /* request payload object (if any) */ |
| 268 | cson_array * warnings; /* response warnings */ |
| 269 | int timerId; /* fetched from fossil_timer_start() */ |
| 270 | } json; |
| 271 | #endif /* FOSSIL_ENABLE_JSON */ |
| 272 | }; |
| 273 | |
| @@ -391,11 +391,11 @@ | |
| 391 | unsigned int nLine; /* Number of lines in the file*/ |
| 392 | unsigned int i, j, k; /* Loop counters */ |
| 393 | int n; /* Number of bytes in one line */ |
| 394 | char *z; /* General use string pointer */ |
| 395 | char **newArgv; /* New expanded g.argv under construction */ |
| 396 | char const * zFileName; /* input file name */ |
| 397 | FILE *inFile; /* input FILE */ |
| 398 | #if defined(_WIN32) |
| 399 | wchar_t buf[MAX_PATH]; |
| 400 | #endif |
| 401 | |
| @@ -1004,12 +1004,12 @@ | |
| 1004 | ** %fossil help --w|-www Show list of WWW pages |
| 1005 | */ |
| 1006 | void help_cmd(void){ |
| 1007 | int rc, idx, isPage = 0; |
| 1008 | const char *z; |
| 1009 | char const * zCmdOrPage; |
| 1010 | char const * zCmdOrPagePlural; |
| 1011 | if( g.argc<3 ){ |
| 1012 | z = g.argv[0]; |
| 1013 | fossil_print( |
| 1014 | "Usage: %s help COMMAND\n" |
| 1015 | "Common COMMANDs: (use \"%s help -a|--all\" for a complete list)\n", |
| @@ -1074,18 +1074,18 @@ | |
| 1074 | /* |
| 1075 | ** WEBPAGE: help |
| 1076 | ** URL: /help/CMD |
| 1077 | */ |
| 1078 | void help_page(void){ |
| 1079 | const char * zCmd = P("cmd"); |
| 1080 | |
| 1081 | if( zCmd==0 ) zCmd = P("name"); |
| 1082 | style_header("Command-line Help"); |
| 1083 | if( zCmd ){ |
| 1084 | int rc, idx; |
| 1085 | char *z, *s, *d; |
| 1086 | char const * zCmdOrPage = ('/'==*zCmd) ? "page" : "command"; |
| 1087 | style_submenu_element("Command-List", "Command-List", "%s/help", g.zTop); |
| 1088 | @ <h1>The "%s(zCmd)" %s(zCmdOrPage):</h1> |
| 1089 | rc = name_search(zCmd, aCommand, count(aCommand), 0, &idx); |
| 1090 | if( rc==1 ){ |
| 1091 | @ unknown command: %s(zCmd) |
| @@ -2122,11 +2122,11 @@ | |
| 2122 | zAltBase = find_option("baseurl", 0, 1); |
| 2123 | if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI; |
| 2124 | if( zAltBase ){ |
| 2125 | set_base_url(zAltBase); |
| 2126 | } |
| 2127 | if ( find_option("localhost", 0, 0)!=0 ){ |
| 2128 | flags |= HTTP_SERVER_LOCALHOST; |
| 2129 | } |
| 2130 | |
| 2131 | /* We should be done with options.. */ |
| 2132 | verify_all_options(); |
| 2133 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -229,45 +229,45 @@ | |
| 229 | */ |
| 230 | int resultCode; /* used for passing back specific codes |
| 231 | ** from /json callbacks. */ |
| 232 | int errorDetailParanoia; /* 0=full error codes, 1=%10, 2=%100, 3=%1000 */ |
| 233 | cson_output_opt outOpt; /* formatting options for JSON mode. */ |
| 234 | cson_value *authToken; /* authentication token */ |
| 235 | const char *jsonp; /* Name of JSONP function wrapper. */ |
| 236 | unsigned char dispatchDepth /* Tells JSON command dispatching |
| 237 | which argument we are currently |
| 238 | working on. For this purpose, arg#0 |
| 239 | is the "json" path/CLI arg. |
| 240 | */; |
| 241 | struct { /* "garbage collector" */ |
| 242 | cson_value *v; |
| 243 | cson_array *a; |
| 244 | } gc; |
| 245 | struct { /* JSON POST data. */ |
| 246 | cson_value *v; |
| 247 | cson_array *a; |
| 248 | int offset; /* Tells us which PATH_INFO/CLI args |
| 249 | part holds the "json" command, so |
| 250 | that we can account for sub-repos |
| 251 | and path prefixes. This is handled |
| 252 | differently for CLI and CGI modes. |
| 253 | */ |
| 254 | const char *commandStr /*"command" request param.*/; |
| 255 | } cmd; |
| 256 | struct { /* JSON POST data. */ |
| 257 | cson_value *v; |
| 258 | cson_object *o; |
| 259 | } post; |
| 260 | struct { /* GET/COOKIE params in JSON mode. */ |
| 261 | cson_value *v; |
| 262 | cson_object *o; |
| 263 | } param; |
| 264 | struct { |
| 265 | cson_value *v; |
| 266 | cson_object *o; |
| 267 | } reqPayload; /* request payload object (if any) */ |
| 268 | cson_array *warnings; /* response warnings */ |
| 269 | int timerId; /* fetched from fossil_timer_start() */ |
| 270 | } json; |
| 271 | #endif /* FOSSIL_ENABLE_JSON */ |
| 272 | }; |
| 273 | |
| @@ -391,11 +391,11 @@ | |
| 391 | unsigned int nLine; /* Number of lines in the file*/ |
| 392 | unsigned int i, j, k; /* Loop counters */ |
| 393 | int n; /* Number of bytes in one line */ |
| 394 | char *z; /* General use string pointer */ |
| 395 | char **newArgv; /* New expanded g.argv under construction */ |
| 396 | const char *zFileName; /* input file name */ |
| 397 | FILE *inFile; /* input FILE */ |
| 398 | #if defined(_WIN32) |
| 399 | wchar_t buf[MAX_PATH]; |
| 400 | #endif |
| 401 | |
| @@ -1004,12 +1004,12 @@ | |
| 1004 | ** %fossil help --w|-www Show list of WWW pages |
| 1005 | */ |
| 1006 | void help_cmd(void){ |
| 1007 | int rc, idx, isPage = 0; |
| 1008 | const char *z; |
| 1009 | const char *zCmdOrPage; |
| 1010 | const char *zCmdOrPagePlural; |
| 1011 | if( g.argc<3 ){ |
| 1012 | z = g.argv[0]; |
| 1013 | fossil_print( |
| 1014 | "Usage: %s help COMMAND\n" |
| 1015 | "Common COMMANDs: (use \"%s help -a|--all\" for a complete list)\n", |
| @@ -1074,18 +1074,18 @@ | |
| 1074 | /* |
| 1075 | ** WEBPAGE: help |
| 1076 | ** URL: /help/CMD |
| 1077 | */ |
| 1078 | void help_page(void){ |
| 1079 | const char *zCmd = P("cmd"); |
| 1080 | |
| 1081 | if( zCmd==0 ) zCmd = P("name"); |
| 1082 | style_header("Command-line Help"); |
| 1083 | if( zCmd ){ |
| 1084 | int rc, idx; |
| 1085 | char *z, *s, *d; |
| 1086 | const char *zCmdOrPage = ('/'==*zCmd) ? "page" : "command"; |
| 1087 | style_submenu_element("Command-List", "Command-List", "%s/help", g.zTop); |
| 1088 | @ <h1>The "%s(zCmd)" %s(zCmdOrPage):</h1> |
| 1089 | rc = name_search(zCmd, aCommand, count(aCommand), 0, &idx); |
| 1090 | if( rc==1 ){ |
| 1091 | @ unknown command: %s(zCmd) |
| @@ -2122,11 +2122,11 @@ | |
| 2122 | zAltBase = find_option("baseurl", 0, 1); |
| 2123 | if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI; |
| 2124 | if( zAltBase ){ |
| 2125 | set_base_url(zAltBase); |
| 2126 | } |
| 2127 | if( find_option("localhost", 0, 0)!=0 ){ |
| 2128 | flags |= HTTP_SERVER_LOCALHOST; |
| 2129 | } |
| 2130 | |
| 2131 | /* We should be done with options.. */ |
| 2132 | verify_all_options(); |
| 2133 |
+2
-2
| --- src/merge3.c | ||
| +++ src/merge3.c | ||
| @@ -136,11 +136,11 @@ | ||
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /* |
| 139 | 139 | ** Text of boundary markers for merge conflicts. |
| 140 | 140 | */ |
| 141 | -static char const * const mergeMarker[] = { | |
| 141 | +static const char *const mergeMarker[] = { | |
| 142 | 142 | /*123456789 123456789 123456789 123456789 123456789 123456789 123456789*/ |
| 143 | 143 | "<<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<<<<<\n", |
| 144 | 144 | "======= COMMON ANCESTOR content follows ============================\n", |
| 145 | 145 | "======= MERGED IN content follows ==================================\n", |
| 146 | 146 | ">>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n" |
| @@ -368,11 +368,11 @@ | ||
| 368 | 368 | ** fossil commit |
| 369 | 369 | ** |
| 370 | 370 | */ |
| 371 | 371 | void delta_3waymerge_cmd(void){ |
| 372 | 372 | Blob pivot, v1, v2, merged; |
| 373 | - | |
| 373 | + | |
| 374 | 374 | /* We should be done with options.. */ |
| 375 | 375 | verify_all_options(); |
| 376 | 376 | |
| 377 | 377 | if( g.argc!=6 ){ |
| 378 | 378 | usage("PIVOT V1 V2 MERGED"); |
| 379 | 379 |
| --- src/merge3.c | |
| +++ src/merge3.c | |
| @@ -136,11 +136,11 @@ | |
| 136 | } |
| 137 | |
| 138 | /* |
| 139 | ** Text of boundary markers for merge conflicts. |
| 140 | */ |
| 141 | static char const * const mergeMarker[] = { |
| 142 | /*123456789 123456789 123456789 123456789 123456789 123456789 123456789*/ |
| 143 | "<<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<<<<<\n", |
| 144 | "======= COMMON ANCESTOR content follows ============================\n", |
| 145 | "======= MERGED IN content follows ==================================\n", |
| 146 | ">>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n" |
| @@ -368,11 +368,11 @@ | |
| 368 | ** fossil commit |
| 369 | ** |
| 370 | */ |
| 371 | void delta_3waymerge_cmd(void){ |
| 372 | Blob pivot, v1, v2, merged; |
| 373 | |
| 374 | /* We should be done with options.. */ |
| 375 | verify_all_options(); |
| 376 | |
| 377 | if( g.argc!=6 ){ |
| 378 | usage("PIVOT V1 V2 MERGED"); |
| 379 |
| --- src/merge3.c | |
| +++ src/merge3.c | |
| @@ -136,11 +136,11 @@ | |
| 136 | } |
| 137 | |
| 138 | /* |
| 139 | ** Text of boundary markers for merge conflicts. |
| 140 | */ |
| 141 | static const char *const mergeMarker[] = { |
| 142 | /*123456789 123456789 123456789 123456789 123456789 123456789 123456789*/ |
| 143 | "<<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<<<<<\n", |
| 144 | "======= COMMON ANCESTOR content follows ============================\n", |
| 145 | "======= MERGED IN content follows ==================================\n", |
| 146 | ">>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n" |
| @@ -368,11 +368,11 @@ | |
| 368 | ** fossil commit |
| 369 | ** |
| 370 | */ |
| 371 | void delta_3waymerge_cmd(void){ |
| 372 | Blob pivot, v1, v2, merged; |
| 373 | |
| 374 | /* We should be done with options.. */ |
| 375 | verify_all_options(); |
| 376 | |
| 377 | if( g.argc!=6 ){ |
| 378 | usage("PIVOT V1 V2 MERGED"); |
| 379 |
+2
-2
| --- src/report.c | ||
| +++ src/report.c | ||
| @@ -1112,11 +1112,11 @@ | ||
| 1112 | 1112 | ** show all reports, which can be used for ticket show. |
| 1113 | 1113 | ** Output is written to stdout as tab delimited table |
| 1114 | 1114 | */ |
| 1115 | 1115 | void rpt_list_reports(void){ |
| 1116 | 1116 | Stmt q; |
| 1117 | - char const aRptOutFrmt[] = "%s\t%s\n"; | |
| 1117 | + const char aRptOutFrmt[] = "%s\t%s\n"; | |
| 1118 | 1118 | |
| 1119 | 1119 | fossil_print("Available reports:\n"); |
| 1120 | 1120 | fossil_print(aRptOutFrmt,"report number","report title"); |
| 1121 | 1121 | fossil_print(aRptOutFrmt,zFullTicketRptRn,zFullTicketRptTitle); |
| 1122 | 1122 | db_prepare(&q,"SELECT rn,title FROM reportfmt ORDER BY rn"); |
| @@ -1217,11 +1217,11 @@ | ||
| 1217 | 1217 | char *zErr1 = 0; |
| 1218 | 1218 | char *zErr2 = 0; |
| 1219 | 1219 | int count = 0; |
| 1220 | 1220 | int rn; |
| 1221 | 1221 | |
| 1222 | - if (!zRep || !strcmp(zRep,zFullTicketRptRn) || !strcmp(zRep,zFullTicketRptTitle) ){ | |
| 1222 | + if( !zRep || !strcmp(zRep,zFullTicketRptRn) || !strcmp(zRep,zFullTicketRptTitle) ){ | |
| 1223 | 1223 | zSql = "SELECT * FROM ticket"; |
| 1224 | 1224 | }else{ |
| 1225 | 1225 | rn = atoi(zRep); |
| 1226 | 1226 | if( rn ){ |
| 1227 | 1227 | db_prepare(&q, |
| 1228 | 1228 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -1112,11 +1112,11 @@ | |
| 1112 | ** show all reports, which can be used for ticket show. |
| 1113 | ** Output is written to stdout as tab delimited table |
| 1114 | */ |
| 1115 | void rpt_list_reports(void){ |
| 1116 | Stmt q; |
| 1117 | char const aRptOutFrmt[] = "%s\t%s\n"; |
| 1118 | |
| 1119 | fossil_print("Available reports:\n"); |
| 1120 | fossil_print(aRptOutFrmt,"report number","report title"); |
| 1121 | fossil_print(aRptOutFrmt,zFullTicketRptRn,zFullTicketRptTitle); |
| 1122 | db_prepare(&q,"SELECT rn,title FROM reportfmt ORDER BY rn"); |
| @@ -1217,11 +1217,11 @@ | |
| 1217 | char *zErr1 = 0; |
| 1218 | char *zErr2 = 0; |
| 1219 | int count = 0; |
| 1220 | int rn; |
| 1221 | |
| 1222 | if (!zRep || !strcmp(zRep,zFullTicketRptRn) || !strcmp(zRep,zFullTicketRptTitle) ){ |
| 1223 | zSql = "SELECT * FROM ticket"; |
| 1224 | }else{ |
| 1225 | rn = atoi(zRep); |
| 1226 | if( rn ){ |
| 1227 | db_prepare(&q, |
| 1228 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -1112,11 +1112,11 @@ | |
| 1112 | ** show all reports, which can be used for ticket show. |
| 1113 | ** Output is written to stdout as tab delimited table |
| 1114 | */ |
| 1115 | void rpt_list_reports(void){ |
| 1116 | Stmt q; |
| 1117 | const char aRptOutFrmt[] = "%s\t%s\n"; |
| 1118 | |
| 1119 | fossil_print("Available reports:\n"); |
| 1120 | fossil_print(aRptOutFrmt,"report number","report title"); |
| 1121 | fossil_print(aRptOutFrmt,zFullTicketRptRn,zFullTicketRptTitle); |
| 1122 | db_prepare(&q,"SELECT rn,title FROM reportfmt ORDER BY rn"); |
| @@ -1217,11 +1217,11 @@ | |
| 1217 | char *zErr1 = 0; |
| 1218 | char *zErr2 = 0; |
| 1219 | int count = 0; |
| 1220 | int rn; |
| 1221 | |
| 1222 | if( !zRep || !strcmp(zRep,zFullTicketRptRn) || !strcmp(zRep,zFullTicketRptTitle) ){ |
| 1223 | zSql = "SELECT * FROM ticket"; |
| 1224 | }else{ |
| 1225 | rn = atoi(zRep); |
| 1226 | if( rn ){ |
| 1227 | db_prepare(&q, |
| 1228 |
+8
-8
| --- src/tag.c | ||
| +++ src/tag.c | ||
| @@ -50,11 +50,11 @@ | ||
| 50 | 50 | |
| 51 | 51 | /* Query for children of :pid to which to propagate the tag. |
| 52 | 52 | ** Three returns: (1) rid of the child. (2) timestamp of child. |
| 53 | 53 | ** (3) True to propagate or false to block. |
| 54 | 54 | */ |
| 55 | - db_prepare(&s, | |
| 55 | + db_prepare(&s, | |
| 56 | 56 | "SELECT cid, plink.mtime," |
| 57 | 57 | " coalesce(srcid=0 AND tagxref.mtime<:mtime, %d) AS doit" |
| 58 | 58 | " FROM plink LEFT JOIN tagxref ON cid=rid AND tagid=%d" |
| 59 | 59 | " WHERE pid=:pid AND isprim", |
| 60 | 60 | tagType==2, tagid |
| @@ -179,11 +179,11 @@ | ||
| 179 | 179 | db_finalize(&s); |
| 180 | 180 | if( rc==SQLITE_ROW ){ |
| 181 | 181 | /* Another entry that is more recent already exists. Do nothing */ |
| 182 | 182 | return tagid; |
| 183 | 183 | } |
| 184 | - db_prepare(&s, | |
| 184 | + db_prepare(&s, | |
| 185 | 185 | "REPLACE INTO tagxref(tagid,tagtype,srcId,origid,value,mtime,rid)" |
| 186 | 186 | " VALUES(%d,%d,%d,%d,%Q,:mtime,%d)", |
| 187 | 187 | tagid, tagtype, srcId, rid, zValue, rid |
| 188 | 188 | ); |
| 189 | 189 | db_bind_double(&s, ":mtime", mtime); |
| @@ -256,11 +256,11 @@ | ||
| 256 | 256 | zTag = g.argv[2]; |
| 257 | 257 | switch( zTag[0] ){ |
| 258 | 258 | case '+': tagtype = 1; break; |
| 259 | 259 | case '*': tagtype = 2; break; |
| 260 | 260 | case '-': tagtype = 0; break; |
| 261 | - default: | |
| 261 | + default: | |
| 262 | 262 | fossil_fatal("tag should begin with '+', '*', or '-'"); |
| 263 | 263 | return; |
| 264 | 264 | } |
| 265 | 265 | rid = name_to_rid(g.argv[3]); |
| 266 | 266 | if( rid==0 ){ |
| @@ -378,22 +378,22 @@ | ||
| 378 | 378 | ** |
| 379 | 379 | ** fossil update tag:decaf |
| 380 | 380 | ** |
| 381 | 381 | ** will assume that "decaf" is a tag/branch name. |
| 382 | 382 | ** |
| 383 | -** only allow --date-override and --user-override in | |
| 383 | +** only allow --date-override and --user-override in | |
| 384 | 384 | ** %fossil tag add --date-override 'YYYY-MMM-DD HH:MM:SS' \\ |
| 385 | -** --user-override user | |
| 385 | +** --user-override user | |
| 386 | 386 | ** in order to import history from other scm systems |
| 387 | 387 | */ |
| 388 | 388 | void tag_cmd(void){ |
| 389 | 389 | int n; |
| 390 | 390 | int fRaw = find_option("raw","",0)!=0; |
| 391 | 391 | int fPropagate = find_option("propagate","",0)!=0; |
| 392 | 392 | const char *zPrefix = fRaw ? "" : "sym-"; |
| 393 | - char const * zFindLimit = find_option("limit","n",1); | |
| 394 | - int const nFindLimit = zFindLimit ? atoi(zFindLimit) : -2000; | |
| 393 | + const char *zFindLimit = find_option("limit","n",1); | |
| 394 | + const int nFindLimit = zFindLimit ? atoi(zFindLimit) : -2000; | |
| 395 | 395 | |
| 396 | 396 | db_find_and_open_repository(0, 0); |
| 397 | 397 | if( g.argc<3 ){ |
| 398 | 398 | goto tag_cmd_usage; |
| 399 | 399 | } |
| @@ -478,11 +478,11 @@ | ||
| 478 | 478 | }else |
| 479 | 479 | |
| 480 | 480 | if( strncmp(g.argv[2],"list",n)==0 ){ |
| 481 | 481 | Stmt q; |
| 482 | 482 | if( g.argc==3 ){ |
| 483 | - db_prepare(&q, | |
| 483 | + db_prepare(&q, | |
| 484 | 484 | "SELECT tagname FROM tag" |
| 485 | 485 | " WHERE EXISTS(SELECT 1 FROM tagxref" |
| 486 | 486 | " WHERE tagid=tag.tagid" |
| 487 | 487 | " AND tagtype>0)" |
| 488 | 488 | " ORDER BY tagname" |
| 489 | 489 |
| --- src/tag.c | |
| +++ src/tag.c | |
| @@ -50,11 +50,11 @@ | |
| 50 | |
| 51 | /* Query for children of :pid to which to propagate the tag. |
| 52 | ** Three returns: (1) rid of the child. (2) timestamp of child. |
| 53 | ** (3) True to propagate or false to block. |
| 54 | */ |
| 55 | db_prepare(&s, |
| 56 | "SELECT cid, plink.mtime," |
| 57 | " coalesce(srcid=0 AND tagxref.mtime<:mtime, %d) AS doit" |
| 58 | " FROM plink LEFT JOIN tagxref ON cid=rid AND tagid=%d" |
| 59 | " WHERE pid=:pid AND isprim", |
| 60 | tagType==2, tagid |
| @@ -179,11 +179,11 @@ | |
| 179 | db_finalize(&s); |
| 180 | if( rc==SQLITE_ROW ){ |
| 181 | /* Another entry that is more recent already exists. Do nothing */ |
| 182 | return tagid; |
| 183 | } |
| 184 | db_prepare(&s, |
| 185 | "REPLACE INTO tagxref(tagid,tagtype,srcId,origid,value,mtime,rid)" |
| 186 | " VALUES(%d,%d,%d,%d,%Q,:mtime,%d)", |
| 187 | tagid, tagtype, srcId, rid, zValue, rid |
| 188 | ); |
| 189 | db_bind_double(&s, ":mtime", mtime); |
| @@ -256,11 +256,11 @@ | |
| 256 | zTag = g.argv[2]; |
| 257 | switch( zTag[0] ){ |
| 258 | case '+': tagtype = 1; break; |
| 259 | case '*': tagtype = 2; break; |
| 260 | case '-': tagtype = 0; break; |
| 261 | default: |
| 262 | fossil_fatal("tag should begin with '+', '*', or '-'"); |
| 263 | return; |
| 264 | } |
| 265 | rid = name_to_rid(g.argv[3]); |
| 266 | if( rid==0 ){ |
| @@ -378,22 +378,22 @@ | |
| 378 | ** |
| 379 | ** fossil update tag:decaf |
| 380 | ** |
| 381 | ** will assume that "decaf" is a tag/branch name. |
| 382 | ** |
| 383 | ** only allow --date-override and --user-override in |
| 384 | ** %fossil tag add --date-override 'YYYY-MMM-DD HH:MM:SS' \\ |
| 385 | ** --user-override user |
| 386 | ** in order to import history from other scm systems |
| 387 | */ |
| 388 | void tag_cmd(void){ |
| 389 | int n; |
| 390 | int fRaw = find_option("raw","",0)!=0; |
| 391 | int fPropagate = find_option("propagate","",0)!=0; |
| 392 | const char *zPrefix = fRaw ? "" : "sym-"; |
| 393 | char const * zFindLimit = find_option("limit","n",1); |
| 394 | int const nFindLimit = zFindLimit ? atoi(zFindLimit) : -2000; |
| 395 | |
| 396 | db_find_and_open_repository(0, 0); |
| 397 | if( g.argc<3 ){ |
| 398 | goto tag_cmd_usage; |
| 399 | } |
| @@ -478,11 +478,11 @@ | |
| 478 | }else |
| 479 | |
| 480 | if( strncmp(g.argv[2],"list",n)==0 ){ |
| 481 | Stmt q; |
| 482 | if( g.argc==3 ){ |
| 483 | db_prepare(&q, |
| 484 | "SELECT tagname FROM tag" |
| 485 | " WHERE EXISTS(SELECT 1 FROM tagxref" |
| 486 | " WHERE tagid=tag.tagid" |
| 487 | " AND tagtype>0)" |
| 488 | " ORDER BY tagname" |
| 489 |
| --- src/tag.c | |
| +++ src/tag.c | |
| @@ -50,11 +50,11 @@ | |
| 50 | |
| 51 | /* Query for children of :pid to which to propagate the tag. |
| 52 | ** Three returns: (1) rid of the child. (2) timestamp of child. |
| 53 | ** (3) True to propagate or false to block. |
| 54 | */ |
| 55 | db_prepare(&s, |
| 56 | "SELECT cid, plink.mtime," |
| 57 | " coalesce(srcid=0 AND tagxref.mtime<:mtime, %d) AS doit" |
| 58 | " FROM plink LEFT JOIN tagxref ON cid=rid AND tagid=%d" |
| 59 | " WHERE pid=:pid AND isprim", |
| 60 | tagType==2, tagid |
| @@ -179,11 +179,11 @@ | |
| 179 | db_finalize(&s); |
| 180 | if( rc==SQLITE_ROW ){ |
| 181 | /* Another entry that is more recent already exists. Do nothing */ |
| 182 | return tagid; |
| 183 | } |
| 184 | db_prepare(&s, |
| 185 | "REPLACE INTO tagxref(tagid,tagtype,srcId,origid,value,mtime,rid)" |
| 186 | " VALUES(%d,%d,%d,%d,%Q,:mtime,%d)", |
| 187 | tagid, tagtype, srcId, rid, zValue, rid |
| 188 | ); |
| 189 | db_bind_double(&s, ":mtime", mtime); |
| @@ -256,11 +256,11 @@ | |
| 256 | zTag = g.argv[2]; |
| 257 | switch( zTag[0] ){ |
| 258 | case '+': tagtype = 1; break; |
| 259 | case '*': tagtype = 2; break; |
| 260 | case '-': tagtype = 0; break; |
| 261 | default: |
| 262 | fossil_fatal("tag should begin with '+', '*', or '-'"); |
| 263 | return; |
| 264 | } |
| 265 | rid = name_to_rid(g.argv[3]); |
| 266 | if( rid==0 ){ |
| @@ -378,22 +378,22 @@ | |
| 378 | ** |
| 379 | ** fossil update tag:decaf |
| 380 | ** |
| 381 | ** will assume that "decaf" is a tag/branch name. |
| 382 | ** |
| 383 | ** only allow --date-override and --user-override in |
| 384 | ** %fossil tag add --date-override 'YYYY-MMM-DD HH:MM:SS' \\ |
| 385 | ** --user-override user |
| 386 | ** in order to import history from other scm systems |
| 387 | */ |
| 388 | void tag_cmd(void){ |
| 389 | int n; |
| 390 | int fRaw = find_option("raw","",0)!=0; |
| 391 | int fPropagate = find_option("propagate","",0)!=0; |
| 392 | const char *zPrefix = fRaw ? "" : "sym-"; |
| 393 | const char *zFindLimit = find_option("limit","n",1); |
| 394 | const int nFindLimit = zFindLimit ? atoi(zFindLimit) : -2000; |
| 395 | |
| 396 | db_find_and_open_repository(0, 0); |
| 397 | if( g.argc<3 ){ |
| 398 | goto tag_cmd_usage; |
| 399 | } |
| @@ -478,11 +478,11 @@ | |
| 478 | }else |
| 479 | |
| 480 | if( strncmp(g.argv[2],"list",n)==0 ){ |
| 481 | Stmt q; |
| 482 | if( g.argc==3 ){ |
| 483 | db_prepare(&q, |
| 484 | "SELECT tagname FROM tag" |
| 485 | " WHERE EXISTS(SELECT 1 FROM tagxref" |
| 486 | " WHERE tagid=tag.tagid" |
| 487 | " AND tagtype>0)" |
| 488 | " ORDER BY tagname" |
| 489 |
+22
-22
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -1969,11 +1969,11 @@ | ||
| 1969 | 1969 | |
| 1970 | 1970 | /* |
| 1971 | 1971 | ** Set by stats_report_init_view() to one of the y=XXXX values |
| 1972 | 1972 | ** accepted by /timeline?y=XXXX. |
| 1973 | 1973 | */ |
| 1974 | -static const char * statsReportTimelineYFlag = NULL; | |
| 1974 | +static const char *statsReportTimelineYFlag = NULL; | |
| 1975 | 1975 | |
| 1976 | 1976 | /* |
| 1977 | 1977 | ** Creates a TEMP VIEW named v_reports which is a wrapper around the |
| 1978 | 1978 | ** EVENT table filtered on event.type. It looks for the request |
| 1979 | 1979 | ** parameter 'type' (reminder: we "should" use 'y' for consistency |
| @@ -1990,12 +1990,12 @@ | ||
| 1990 | 1990 | ** Returns one of: 'c', 'w', 'g', 't', 'e', representing the type of |
| 1991 | 1991 | ** filter it applies, or '*' if no filter is applied (i.e. if "all" is |
| 1992 | 1992 | ** used). |
| 1993 | 1993 | */ |
| 1994 | 1994 | static int stats_report_init_view(){ |
| 1995 | - const char * zType = PD("type","*"); /* analog to /timeline?y=... */ | |
| 1996 | - const char * zRealType = NULL; /* normalized form of zType */ | |
| 1995 | + const char *zType = PD("type","*"); /* analog to /timeline?y=... */ | |
| 1996 | + const char *zRealType = NULL; /* normalized form of zType */ | |
| 1997 | 1997 | int rc = 0; /* result code */ |
| 1998 | 1998 | assert( !statsReportType && "Must not be called more than once." ); |
| 1999 | 1999 | switch( (zType && *zType) ? *zType : 0 ){ |
| 2000 | 2000 | case 'c': |
| 2001 | 2001 | case 'C': |
| @@ -2044,11 +2044,11 @@ | ||
| 2044 | 2044 | ** Returns a string suitable (for a given value of suitable) for |
| 2045 | 2045 | ** use in a label with the header of the /reports pages, dependent |
| 2046 | 2046 | ** on the 'type' flag. See stats_report_init_view(). |
| 2047 | 2047 | ** The returned bytes are static. |
| 2048 | 2048 | */ |
| 2049 | -static const char * stats_report_label_for_type(){ | |
| 2049 | +static const char *stats_report_label_for_type(){ | |
| 2050 | 2050 | assert( statsReportType && "Must call stats_report_init_view() first." ); |
| 2051 | 2051 | switch( statsReportType ){ |
| 2052 | 2052 | case 'c': |
| 2053 | 2053 | return "checkins"; |
| 2054 | 2054 | case 'e': |
| @@ -2071,13 +2071,13 @@ | ||
| 2071 | 2071 | ** time this is called. e.g. if called from the 'byuser' view then |
| 2072 | 2072 | ** zCurrentViewName must be "byuser". Any URL parameters which need to |
| 2073 | 2073 | ** be added to the generated URLs should be passed in zParam. The |
| 2074 | 2074 | ** caller is expected to have already encoded any zParam in the %T or |
| 2075 | 2075 | ** %t encoding. */ |
| 2076 | -static void stats_report_event_types_menu(const char * zCurrentViewName, | |
| 2077 | - const char * zParam){ | |
| 2078 | - char * zTop; | |
| 2076 | +static void stats_report_event_types_menu(const char *zCurrentViewName, | |
| 2077 | + const char *zParam){ | |
| 2078 | + char *zTop; | |
| 2079 | 2079 | if(zParam && !*zParam){ |
| 2080 | 2080 | zParam = NULL; |
| 2081 | 2081 | } |
| 2082 | 2082 | zTop = mprintf("%s/reports?view=%s%s%s", g.zTop, zCurrentViewName, |
| 2083 | 2083 | zParam ? "&" : "", zParam); |
| @@ -2121,11 +2121,11 @@ | ||
| 2121 | 2121 | /* |
| 2122 | 2122 | ** Helper for stats_report_by_month_year(), which generates a list of |
| 2123 | 2123 | ** week numbers. zTimeframe should be either a timeframe in the form YYYY |
| 2124 | 2124 | ** or YYYY-MM. |
| 2125 | 2125 | */ |
| 2126 | -static void stats_report_output_week_links(const char * zTimeframe){ | |
| 2126 | +static void stats_report_output_week_links(const char *zTimeframe){ | |
| 2127 | 2127 | Stmt stWeek = empty_Stmt; |
| 2128 | 2128 | char yearPart[5] = {0,0,0,0,0}; |
| 2129 | 2129 | memcpy(yearPart, zTimeframe, 4); |
| 2130 | 2130 | db_prepare(&stWeek, |
| 2131 | 2131 | "SELECT DISTINCT strftime('%%W',mtime) AS wk, " |
| @@ -2135,11 +2135,11 @@ | ||
| 2135 | 2135 | "WHERE ym=%Q AND mtime < current_timestamp " |
| 2136 | 2136 | "GROUP BY wk ORDER BY wk", |
| 2137 | 2137 | strlen(zTimeframe), |
| 2138 | 2138 | zTimeframe); |
| 2139 | 2139 | while( SQLITE_ROW == db_step(&stWeek) ){ |
| 2140 | - const char * zWeek = db_column_text(&stWeek,0); | |
| 2140 | + const char *zWeek = db_column_text(&stWeek,0); | |
| 2141 | 2141 | const int nCount = db_column_int(&stWeek,1); |
| 2142 | 2142 | cgi_printf("<a href='%s/timeline?" |
| 2143 | 2143 | "yw=%t-%t&n=%d&y=%s'>%s</a>", |
| 2144 | 2144 | g.zTop, yearPart, zWeek, |
| 2145 | 2145 | nCount, statsReportTimelineYFlag, zWeek); |
| @@ -2154,18 +2154,18 @@ | ||
| 2154 | 2154 | ** then the report is restricted to events created by the named user |
| 2155 | 2155 | ** account. |
| 2156 | 2156 | */ |
| 2157 | 2157 | static void stats_report_by_month_year(char includeMonth, |
| 2158 | 2158 | char includeWeeks, |
| 2159 | - const char * zUserName){ | |
| 2159 | + const char *zUserName){ | |
| 2160 | 2160 | Stmt query = empty_Stmt; |
| 2161 | 2161 | int nRowNumber = 0; /* current TR number */ |
| 2162 | 2162 | int nEventTotal = 0; /* Total event count */ |
| 2163 | 2163 | int rowClass = 0; /* counter for alternating |
| 2164 | 2164 | row colors */ |
| 2165 | 2165 | Blob sql = empty_blob; /* SQL */ |
| 2166 | - const char * zTimeLabel = includeMonth ? "Year/Month" : "Year"; | |
| 2166 | + const char *zTimeLabel = includeMonth ? "Year/Month" : "Year"; | |
| 2167 | 2167 | char zPrevYear[5] = {0}; /* For keeping track of when |
| 2168 | 2168 | we change years while looping */ |
| 2169 | 2169 | int nEventsPerYear = 0; /* Total event count for the |
| 2170 | 2170 | current year */ |
| 2171 | 2171 | char showYearTotal = 0; /* Flag telling us when to show |
| @@ -2216,11 +2216,11 @@ | ||
| 2216 | 2216 | } |
| 2217 | 2217 | ++iterations; |
| 2218 | 2218 | } |
| 2219 | 2219 | db_reset(&query); |
| 2220 | 2220 | while( SQLITE_ROW == db_step(&query) ){ |
| 2221 | - const char * zTimeframe = db_column_text(&query, 0); | |
| 2221 | + const char *zTimeframe = db_column_text(&query, 0); | |
| 2222 | 2222 | const int nCount = db_column_int(&query, 1); |
| 2223 | 2223 | int nSize = nCount |
| 2224 | 2224 | ? (int)(100 * nCount / nMaxEvents) |
| 2225 | 2225 | : 1; |
| 2226 | 2226 | showYearTotal = 0; |
| @@ -2301,11 +2301,11 @@ | ||
| 2301 | 2301 | @ <td colspan='2'>Yearly total: %d(nEventsPerYear)</td> |
| 2302 | 2302 | @</tr> |
| 2303 | 2303 | } |
| 2304 | 2304 | @ </tbody></table> |
| 2305 | 2305 | if(nEventTotal){ |
| 2306 | - const char * zAvgLabel = includeMonth ? "month" : "year"; | |
| 2306 | + const char *zAvgLabel = includeMonth ? "month" : "year"; | |
| 2307 | 2307 | int nAvg = iterations ? (nEventTotal/iterations) : 0; |
| 2308 | 2308 | @ <br><div>Total events: %d(nEventTotal) |
| 2309 | 2309 | @ <br>Average per active %s(zAvgLabel): %d(nAvg) |
| 2310 | 2310 | @ </div> |
| 2311 | 2311 | } |
| @@ -2351,11 +2351,11 @@ | ||
| 2351 | 2351 | nMaxEvents = nCount; |
| 2352 | 2352 | } |
| 2353 | 2353 | } |
| 2354 | 2354 | db_reset(&query); |
| 2355 | 2355 | while( SQLITE_ROW == db_step(&query) ){ |
| 2356 | - const char * zUser = db_column_text(&query, 0); | |
| 2356 | + const char *zUser = db_column_text(&query, 0); | |
| 2357 | 2357 | const int nCount = db_column_int(&query, 1); |
| 2358 | 2358 | int nSize = nCount |
| 2359 | 2359 | ? (int)(100 * nCount / nMaxEvents) |
| 2360 | 2360 | : 0; |
| 2361 | 2361 | if(!nCount) continue /* arguable! Possible? */; |
| @@ -2391,11 +2391,11 @@ | ||
| 2391 | 2391 | int rowClass = 0; /* counter for alternating |
| 2392 | 2392 | row colors */ |
| 2393 | 2393 | Blob sql = empty_blob; /* SQL */ |
| 2394 | 2394 | int nMaxEvents = 1; /* max number of events for |
| 2395 | 2395 | all rows. */ |
| 2396 | - static const char * const daysOfWeek[] = { | |
| 2396 | + static const char *const daysOfWeek[] = { | |
| 2397 | 2397 | "Monday", "Tuesday", "Wednesday", "Thursday", |
| 2398 | 2398 | "Friday", "Saturday", "Sunday" |
| 2399 | 2399 | }; |
| 2400 | 2400 | |
| 2401 | 2401 | stats_report_init_view(); |
| @@ -2424,11 +2424,11 @@ | ||
| 2424 | 2424 | nMaxEvents = nCount; |
| 2425 | 2425 | } |
| 2426 | 2426 | } |
| 2427 | 2427 | db_reset(&query); |
| 2428 | 2428 | while( SQLITE_ROW == db_step(&query) ){ |
| 2429 | - int const dayNum =db_column_int(&query, 0); | |
| 2429 | + const int dayNum =db_column_int(&query, 0); | |
| 2430 | 2430 | const int nCount = db_column_int(&query, 1); |
| 2431 | 2431 | int nSize = nCount |
| 2432 | 2432 | ? (int)(100 * nCount / nMaxEvents) |
| 2433 | 2433 | : 0; |
| 2434 | 2434 | if(!nCount) continue /* arguable! Possible? */; |
| @@ -2454,16 +2454,16 @@ | ||
| 2454 | 2454 | /* |
| 2455 | 2455 | ** Helper for stats_report_by_month_year(), which generates a list of |
| 2456 | 2456 | ** week numbers. zTimeframe should be either a timeframe in the form YYYY |
| 2457 | 2457 | ** or YYYY-MM. |
| 2458 | 2458 | */ |
| 2459 | -static void stats_report_year_weeks(const char * zUserName){ | |
| 2460 | - const char * zYear = P("y"); | |
| 2459 | +static void stats_report_year_weeks(const char *zUserName){ | |
| 2460 | + const char *zYear = P("y"); | |
| 2461 | 2461 | int nYear = zYear ? strlen(zYear) : 0; |
| 2462 | 2462 | int i = 0; |
| 2463 | 2463 | Stmt qYears = empty_Stmt; |
| 2464 | - char * zDefaultYear = NULL; | |
| 2464 | + char *zDefaultYear = NULL; | |
| 2465 | 2465 | Blob sql = empty_blob; |
| 2466 | 2466 | int nMaxEvents = 1; /* max number of events for |
| 2467 | 2467 | all rows. */ |
| 2468 | 2468 | int iterations = 0; /* # of active time periods. */ |
| 2469 | 2469 | stats_report_init_view(); |
| @@ -2484,11 +2484,11 @@ | ||
| 2484 | 2484 | blob_append(&sql,"GROUP BY y ORDER BY y", -1); |
| 2485 | 2485 | db_prepare(&qYears, blob_str(&sql)); |
| 2486 | 2486 | blob_reset(&sql); |
| 2487 | 2487 | cgi_printf("Select year: "); |
| 2488 | 2488 | while( SQLITE_ROW == db_step(&qYears) ){ |
| 2489 | - const char * zT = db_column_text(&qYears, 0); | |
| 2489 | + const char *zT = db_column_text(&qYears, 0); | |
| 2490 | 2490 | if( i++ ){ |
| 2491 | 2491 | cgi_printf(" "); |
| 2492 | 2492 | } |
| 2493 | 2493 | cgi_printf("<a href='?view=byweek&y=%s&type=%c", zT, |
| 2494 | 2494 | (char)statsReportType); |
| @@ -2544,11 +2544,11 @@ | ||
| 2544 | 2544 | } |
| 2545 | 2545 | ++iterations; |
| 2546 | 2546 | } |
| 2547 | 2547 | db_reset(&stWeek); |
| 2548 | 2548 | while( SQLITE_ROW == db_step(&stWeek) ){ |
| 2549 | - const char * zWeek = db_column_text(&stWeek,0); | |
| 2549 | + const char *zWeek = db_column_text(&stWeek,0); | |
| 2550 | 2550 | const int nCount = db_column_int(&stWeek,1); |
| 2551 | 2551 | int nSize = nCount |
| 2552 | 2552 | ? (int)(100 * nCount / nMaxEvents) |
| 2553 | 2553 | : 0; |
| 2554 | 2554 | if(!nSize) nSize = 1; |
| @@ -2604,11 +2604,11 @@ | ||
| 2604 | 2604 | ** y=YYYY The year to report (default is the server's |
| 2605 | 2605 | ** current year). |
| 2606 | 2606 | */ |
| 2607 | 2607 | void stats_report_page(){ |
| 2608 | 2608 | HQuery url; /* URL for various branch links */ |
| 2609 | - const char * zView = P("view"); /* Which view/report to show. */ | |
| 2609 | + const char *zView = P("view"); /* Which view/report to show. */ | |
| 2610 | 2610 | const char *zUserName = P("user"); |
| 2611 | 2611 | |
| 2612 | 2612 | login_check_credentials(); |
| 2613 | 2613 | if( !g.perm.Read ){ login_needed(); return; } |
| 2614 | 2614 | if(!zUserName) zUserName = P("u"); |
| 2615 | 2615 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1969,11 +1969,11 @@ | |
| 1969 | |
| 1970 | /* |
| 1971 | ** Set by stats_report_init_view() to one of the y=XXXX values |
| 1972 | ** accepted by /timeline?y=XXXX. |
| 1973 | */ |
| 1974 | static const char * statsReportTimelineYFlag = NULL; |
| 1975 | |
| 1976 | /* |
| 1977 | ** Creates a TEMP VIEW named v_reports which is a wrapper around the |
| 1978 | ** EVENT table filtered on event.type. It looks for the request |
| 1979 | ** parameter 'type' (reminder: we "should" use 'y' for consistency |
| @@ -1990,12 +1990,12 @@ | |
| 1990 | ** Returns one of: 'c', 'w', 'g', 't', 'e', representing the type of |
| 1991 | ** filter it applies, or '*' if no filter is applied (i.e. if "all" is |
| 1992 | ** used). |
| 1993 | */ |
| 1994 | static int stats_report_init_view(){ |
| 1995 | const char * zType = PD("type","*"); /* analog to /timeline?y=... */ |
| 1996 | const char * zRealType = NULL; /* normalized form of zType */ |
| 1997 | int rc = 0; /* result code */ |
| 1998 | assert( !statsReportType && "Must not be called more than once." ); |
| 1999 | switch( (zType && *zType) ? *zType : 0 ){ |
| 2000 | case 'c': |
| 2001 | case 'C': |
| @@ -2044,11 +2044,11 @@ | |
| 2044 | ** Returns a string suitable (for a given value of suitable) for |
| 2045 | ** use in a label with the header of the /reports pages, dependent |
| 2046 | ** on the 'type' flag. See stats_report_init_view(). |
| 2047 | ** The returned bytes are static. |
| 2048 | */ |
| 2049 | static const char * stats_report_label_for_type(){ |
| 2050 | assert( statsReportType && "Must call stats_report_init_view() first." ); |
| 2051 | switch( statsReportType ){ |
| 2052 | case 'c': |
| 2053 | return "checkins"; |
| 2054 | case 'e': |
| @@ -2071,13 +2071,13 @@ | |
| 2071 | ** time this is called. e.g. if called from the 'byuser' view then |
| 2072 | ** zCurrentViewName must be "byuser". Any URL parameters which need to |
| 2073 | ** be added to the generated URLs should be passed in zParam. The |
| 2074 | ** caller is expected to have already encoded any zParam in the %T or |
| 2075 | ** %t encoding. */ |
| 2076 | static void stats_report_event_types_menu(const char * zCurrentViewName, |
| 2077 | const char * zParam){ |
| 2078 | char * zTop; |
| 2079 | if(zParam && !*zParam){ |
| 2080 | zParam = NULL; |
| 2081 | } |
| 2082 | zTop = mprintf("%s/reports?view=%s%s%s", g.zTop, zCurrentViewName, |
| 2083 | zParam ? "&" : "", zParam); |
| @@ -2121,11 +2121,11 @@ | |
| 2121 | /* |
| 2122 | ** Helper for stats_report_by_month_year(), which generates a list of |
| 2123 | ** week numbers. zTimeframe should be either a timeframe in the form YYYY |
| 2124 | ** or YYYY-MM. |
| 2125 | */ |
| 2126 | static void stats_report_output_week_links(const char * zTimeframe){ |
| 2127 | Stmt stWeek = empty_Stmt; |
| 2128 | char yearPart[5] = {0,0,0,0,0}; |
| 2129 | memcpy(yearPart, zTimeframe, 4); |
| 2130 | db_prepare(&stWeek, |
| 2131 | "SELECT DISTINCT strftime('%%W',mtime) AS wk, " |
| @@ -2135,11 +2135,11 @@ | |
| 2135 | "WHERE ym=%Q AND mtime < current_timestamp " |
| 2136 | "GROUP BY wk ORDER BY wk", |
| 2137 | strlen(zTimeframe), |
| 2138 | zTimeframe); |
| 2139 | while( SQLITE_ROW == db_step(&stWeek) ){ |
| 2140 | const char * zWeek = db_column_text(&stWeek,0); |
| 2141 | const int nCount = db_column_int(&stWeek,1); |
| 2142 | cgi_printf("<a href='%s/timeline?" |
| 2143 | "yw=%t-%t&n=%d&y=%s'>%s</a>", |
| 2144 | g.zTop, yearPart, zWeek, |
| 2145 | nCount, statsReportTimelineYFlag, zWeek); |
| @@ -2154,18 +2154,18 @@ | |
| 2154 | ** then the report is restricted to events created by the named user |
| 2155 | ** account. |
| 2156 | */ |
| 2157 | static void stats_report_by_month_year(char includeMonth, |
| 2158 | char includeWeeks, |
| 2159 | const char * zUserName){ |
| 2160 | Stmt query = empty_Stmt; |
| 2161 | int nRowNumber = 0; /* current TR number */ |
| 2162 | int nEventTotal = 0; /* Total event count */ |
| 2163 | int rowClass = 0; /* counter for alternating |
| 2164 | row colors */ |
| 2165 | Blob sql = empty_blob; /* SQL */ |
| 2166 | const char * zTimeLabel = includeMonth ? "Year/Month" : "Year"; |
| 2167 | char zPrevYear[5] = {0}; /* For keeping track of when |
| 2168 | we change years while looping */ |
| 2169 | int nEventsPerYear = 0; /* Total event count for the |
| 2170 | current year */ |
| 2171 | char showYearTotal = 0; /* Flag telling us when to show |
| @@ -2216,11 +2216,11 @@ | |
| 2216 | } |
| 2217 | ++iterations; |
| 2218 | } |
| 2219 | db_reset(&query); |
| 2220 | while( SQLITE_ROW == db_step(&query) ){ |
| 2221 | const char * zTimeframe = db_column_text(&query, 0); |
| 2222 | const int nCount = db_column_int(&query, 1); |
| 2223 | int nSize = nCount |
| 2224 | ? (int)(100 * nCount / nMaxEvents) |
| 2225 | : 1; |
| 2226 | showYearTotal = 0; |
| @@ -2301,11 +2301,11 @@ | |
| 2301 | @ <td colspan='2'>Yearly total: %d(nEventsPerYear)</td> |
| 2302 | @</tr> |
| 2303 | } |
| 2304 | @ </tbody></table> |
| 2305 | if(nEventTotal){ |
| 2306 | const char * zAvgLabel = includeMonth ? "month" : "year"; |
| 2307 | int nAvg = iterations ? (nEventTotal/iterations) : 0; |
| 2308 | @ <br><div>Total events: %d(nEventTotal) |
| 2309 | @ <br>Average per active %s(zAvgLabel): %d(nAvg) |
| 2310 | @ </div> |
| 2311 | } |
| @@ -2351,11 +2351,11 @@ | |
| 2351 | nMaxEvents = nCount; |
| 2352 | } |
| 2353 | } |
| 2354 | db_reset(&query); |
| 2355 | while( SQLITE_ROW == db_step(&query) ){ |
| 2356 | const char * zUser = db_column_text(&query, 0); |
| 2357 | const int nCount = db_column_int(&query, 1); |
| 2358 | int nSize = nCount |
| 2359 | ? (int)(100 * nCount / nMaxEvents) |
| 2360 | : 0; |
| 2361 | if(!nCount) continue /* arguable! Possible? */; |
| @@ -2391,11 +2391,11 @@ | |
| 2391 | int rowClass = 0; /* counter for alternating |
| 2392 | row colors */ |
| 2393 | Blob sql = empty_blob; /* SQL */ |
| 2394 | int nMaxEvents = 1; /* max number of events for |
| 2395 | all rows. */ |
| 2396 | static const char * const daysOfWeek[] = { |
| 2397 | "Monday", "Tuesday", "Wednesday", "Thursday", |
| 2398 | "Friday", "Saturday", "Sunday" |
| 2399 | }; |
| 2400 | |
| 2401 | stats_report_init_view(); |
| @@ -2424,11 +2424,11 @@ | |
| 2424 | nMaxEvents = nCount; |
| 2425 | } |
| 2426 | } |
| 2427 | db_reset(&query); |
| 2428 | while( SQLITE_ROW == db_step(&query) ){ |
| 2429 | int const dayNum =db_column_int(&query, 0); |
| 2430 | const int nCount = db_column_int(&query, 1); |
| 2431 | int nSize = nCount |
| 2432 | ? (int)(100 * nCount / nMaxEvents) |
| 2433 | : 0; |
| 2434 | if(!nCount) continue /* arguable! Possible? */; |
| @@ -2454,16 +2454,16 @@ | |
| 2454 | /* |
| 2455 | ** Helper for stats_report_by_month_year(), which generates a list of |
| 2456 | ** week numbers. zTimeframe should be either a timeframe in the form YYYY |
| 2457 | ** or YYYY-MM. |
| 2458 | */ |
| 2459 | static void stats_report_year_weeks(const char * zUserName){ |
| 2460 | const char * zYear = P("y"); |
| 2461 | int nYear = zYear ? strlen(zYear) : 0; |
| 2462 | int i = 0; |
| 2463 | Stmt qYears = empty_Stmt; |
| 2464 | char * zDefaultYear = NULL; |
| 2465 | Blob sql = empty_blob; |
| 2466 | int nMaxEvents = 1; /* max number of events for |
| 2467 | all rows. */ |
| 2468 | int iterations = 0; /* # of active time periods. */ |
| 2469 | stats_report_init_view(); |
| @@ -2484,11 +2484,11 @@ | |
| 2484 | blob_append(&sql,"GROUP BY y ORDER BY y", -1); |
| 2485 | db_prepare(&qYears, blob_str(&sql)); |
| 2486 | blob_reset(&sql); |
| 2487 | cgi_printf("Select year: "); |
| 2488 | while( SQLITE_ROW == db_step(&qYears) ){ |
| 2489 | const char * zT = db_column_text(&qYears, 0); |
| 2490 | if( i++ ){ |
| 2491 | cgi_printf(" "); |
| 2492 | } |
| 2493 | cgi_printf("<a href='?view=byweek&y=%s&type=%c", zT, |
| 2494 | (char)statsReportType); |
| @@ -2544,11 +2544,11 @@ | |
| 2544 | } |
| 2545 | ++iterations; |
| 2546 | } |
| 2547 | db_reset(&stWeek); |
| 2548 | while( SQLITE_ROW == db_step(&stWeek) ){ |
| 2549 | const char * zWeek = db_column_text(&stWeek,0); |
| 2550 | const int nCount = db_column_int(&stWeek,1); |
| 2551 | int nSize = nCount |
| 2552 | ? (int)(100 * nCount / nMaxEvents) |
| 2553 | : 0; |
| 2554 | if(!nSize) nSize = 1; |
| @@ -2604,11 +2604,11 @@ | |
| 2604 | ** y=YYYY The year to report (default is the server's |
| 2605 | ** current year). |
| 2606 | */ |
| 2607 | void stats_report_page(){ |
| 2608 | HQuery url; /* URL for various branch links */ |
| 2609 | const char * zView = P("view"); /* Which view/report to show. */ |
| 2610 | const char *zUserName = P("user"); |
| 2611 | |
| 2612 | login_check_credentials(); |
| 2613 | if( !g.perm.Read ){ login_needed(); return; } |
| 2614 | if(!zUserName) zUserName = P("u"); |
| 2615 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1969,11 +1969,11 @@ | |
| 1969 | |
| 1970 | /* |
| 1971 | ** Set by stats_report_init_view() to one of the y=XXXX values |
| 1972 | ** accepted by /timeline?y=XXXX. |
| 1973 | */ |
| 1974 | static const char *statsReportTimelineYFlag = NULL; |
| 1975 | |
| 1976 | /* |
| 1977 | ** Creates a TEMP VIEW named v_reports which is a wrapper around the |
| 1978 | ** EVENT table filtered on event.type. It looks for the request |
| 1979 | ** parameter 'type' (reminder: we "should" use 'y' for consistency |
| @@ -1990,12 +1990,12 @@ | |
| 1990 | ** Returns one of: 'c', 'w', 'g', 't', 'e', representing the type of |
| 1991 | ** filter it applies, or '*' if no filter is applied (i.e. if "all" is |
| 1992 | ** used). |
| 1993 | */ |
| 1994 | static int stats_report_init_view(){ |
| 1995 | const char *zType = PD("type","*"); /* analog to /timeline?y=... */ |
| 1996 | const char *zRealType = NULL; /* normalized form of zType */ |
| 1997 | int rc = 0; /* result code */ |
| 1998 | assert( !statsReportType && "Must not be called more than once." ); |
| 1999 | switch( (zType && *zType) ? *zType : 0 ){ |
| 2000 | case 'c': |
| 2001 | case 'C': |
| @@ -2044,11 +2044,11 @@ | |
| 2044 | ** Returns a string suitable (for a given value of suitable) for |
| 2045 | ** use in a label with the header of the /reports pages, dependent |
| 2046 | ** on the 'type' flag. See stats_report_init_view(). |
| 2047 | ** The returned bytes are static. |
| 2048 | */ |
| 2049 | static const char *stats_report_label_for_type(){ |
| 2050 | assert( statsReportType && "Must call stats_report_init_view() first." ); |
| 2051 | switch( statsReportType ){ |
| 2052 | case 'c': |
| 2053 | return "checkins"; |
| 2054 | case 'e': |
| @@ -2071,13 +2071,13 @@ | |
| 2071 | ** time this is called. e.g. if called from the 'byuser' view then |
| 2072 | ** zCurrentViewName must be "byuser". Any URL parameters which need to |
| 2073 | ** be added to the generated URLs should be passed in zParam. The |
| 2074 | ** caller is expected to have already encoded any zParam in the %T or |
| 2075 | ** %t encoding. */ |
| 2076 | static void stats_report_event_types_menu(const char *zCurrentViewName, |
| 2077 | const char *zParam){ |
| 2078 | char *zTop; |
| 2079 | if(zParam && !*zParam){ |
| 2080 | zParam = NULL; |
| 2081 | } |
| 2082 | zTop = mprintf("%s/reports?view=%s%s%s", g.zTop, zCurrentViewName, |
| 2083 | zParam ? "&" : "", zParam); |
| @@ -2121,11 +2121,11 @@ | |
| 2121 | /* |
| 2122 | ** Helper for stats_report_by_month_year(), which generates a list of |
| 2123 | ** week numbers. zTimeframe should be either a timeframe in the form YYYY |
| 2124 | ** or YYYY-MM. |
| 2125 | */ |
| 2126 | static void stats_report_output_week_links(const char *zTimeframe){ |
| 2127 | Stmt stWeek = empty_Stmt; |
| 2128 | char yearPart[5] = {0,0,0,0,0}; |
| 2129 | memcpy(yearPart, zTimeframe, 4); |
| 2130 | db_prepare(&stWeek, |
| 2131 | "SELECT DISTINCT strftime('%%W',mtime) AS wk, " |
| @@ -2135,11 +2135,11 @@ | |
| 2135 | "WHERE ym=%Q AND mtime < current_timestamp " |
| 2136 | "GROUP BY wk ORDER BY wk", |
| 2137 | strlen(zTimeframe), |
| 2138 | zTimeframe); |
| 2139 | while( SQLITE_ROW == db_step(&stWeek) ){ |
| 2140 | const char *zWeek = db_column_text(&stWeek,0); |
| 2141 | const int nCount = db_column_int(&stWeek,1); |
| 2142 | cgi_printf("<a href='%s/timeline?" |
| 2143 | "yw=%t-%t&n=%d&y=%s'>%s</a>", |
| 2144 | g.zTop, yearPart, zWeek, |
| 2145 | nCount, statsReportTimelineYFlag, zWeek); |
| @@ -2154,18 +2154,18 @@ | |
| 2154 | ** then the report is restricted to events created by the named user |
| 2155 | ** account. |
| 2156 | */ |
| 2157 | static void stats_report_by_month_year(char includeMonth, |
| 2158 | char includeWeeks, |
| 2159 | const char *zUserName){ |
| 2160 | Stmt query = empty_Stmt; |
| 2161 | int nRowNumber = 0; /* current TR number */ |
| 2162 | int nEventTotal = 0; /* Total event count */ |
| 2163 | int rowClass = 0; /* counter for alternating |
| 2164 | row colors */ |
| 2165 | Blob sql = empty_blob; /* SQL */ |
| 2166 | const char *zTimeLabel = includeMonth ? "Year/Month" : "Year"; |
| 2167 | char zPrevYear[5] = {0}; /* For keeping track of when |
| 2168 | we change years while looping */ |
| 2169 | int nEventsPerYear = 0; /* Total event count for the |
| 2170 | current year */ |
| 2171 | char showYearTotal = 0; /* Flag telling us when to show |
| @@ -2216,11 +2216,11 @@ | |
| 2216 | } |
| 2217 | ++iterations; |
| 2218 | } |
| 2219 | db_reset(&query); |
| 2220 | while( SQLITE_ROW == db_step(&query) ){ |
| 2221 | const char *zTimeframe = db_column_text(&query, 0); |
| 2222 | const int nCount = db_column_int(&query, 1); |
| 2223 | int nSize = nCount |
| 2224 | ? (int)(100 * nCount / nMaxEvents) |
| 2225 | : 1; |
| 2226 | showYearTotal = 0; |
| @@ -2301,11 +2301,11 @@ | |
| 2301 | @ <td colspan='2'>Yearly total: %d(nEventsPerYear)</td> |
| 2302 | @</tr> |
| 2303 | } |
| 2304 | @ </tbody></table> |
| 2305 | if(nEventTotal){ |
| 2306 | const char *zAvgLabel = includeMonth ? "month" : "year"; |
| 2307 | int nAvg = iterations ? (nEventTotal/iterations) : 0; |
| 2308 | @ <br><div>Total events: %d(nEventTotal) |
| 2309 | @ <br>Average per active %s(zAvgLabel): %d(nAvg) |
| 2310 | @ </div> |
| 2311 | } |
| @@ -2351,11 +2351,11 @@ | |
| 2351 | nMaxEvents = nCount; |
| 2352 | } |
| 2353 | } |
| 2354 | db_reset(&query); |
| 2355 | while( SQLITE_ROW == db_step(&query) ){ |
| 2356 | const char *zUser = db_column_text(&query, 0); |
| 2357 | const int nCount = db_column_int(&query, 1); |
| 2358 | int nSize = nCount |
| 2359 | ? (int)(100 * nCount / nMaxEvents) |
| 2360 | : 0; |
| 2361 | if(!nCount) continue /* arguable! Possible? */; |
| @@ -2391,11 +2391,11 @@ | |
| 2391 | int rowClass = 0; /* counter for alternating |
| 2392 | row colors */ |
| 2393 | Blob sql = empty_blob; /* SQL */ |
| 2394 | int nMaxEvents = 1; /* max number of events for |
| 2395 | all rows. */ |
| 2396 | static const char *const daysOfWeek[] = { |
| 2397 | "Monday", "Tuesday", "Wednesday", "Thursday", |
| 2398 | "Friday", "Saturday", "Sunday" |
| 2399 | }; |
| 2400 | |
| 2401 | stats_report_init_view(); |
| @@ -2424,11 +2424,11 @@ | |
| 2424 | nMaxEvents = nCount; |
| 2425 | } |
| 2426 | } |
| 2427 | db_reset(&query); |
| 2428 | while( SQLITE_ROW == db_step(&query) ){ |
| 2429 | const int dayNum =db_column_int(&query, 0); |
| 2430 | const int nCount = db_column_int(&query, 1); |
| 2431 | int nSize = nCount |
| 2432 | ? (int)(100 * nCount / nMaxEvents) |
| 2433 | : 0; |
| 2434 | if(!nCount) continue /* arguable! Possible? */; |
| @@ -2454,16 +2454,16 @@ | |
| 2454 | /* |
| 2455 | ** Helper for stats_report_by_month_year(), which generates a list of |
| 2456 | ** week numbers. zTimeframe should be either a timeframe in the form YYYY |
| 2457 | ** or YYYY-MM. |
| 2458 | */ |
| 2459 | static void stats_report_year_weeks(const char *zUserName){ |
| 2460 | const char *zYear = P("y"); |
| 2461 | int nYear = zYear ? strlen(zYear) : 0; |
| 2462 | int i = 0; |
| 2463 | Stmt qYears = empty_Stmt; |
| 2464 | char *zDefaultYear = NULL; |
| 2465 | Blob sql = empty_blob; |
| 2466 | int nMaxEvents = 1; /* max number of events for |
| 2467 | all rows. */ |
| 2468 | int iterations = 0; /* # of active time periods. */ |
| 2469 | stats_report_init_view(); |
| @@ -2484,11 +2484,11 @@ | |
| 2484 | blob_append(&sql,"GROUP BY y ORDER BY y", -1); |
| 2485 | db_prepare(&qYears, blob_str(&sql)); |
| 2486 | blob_reset(&sql); |
| 2487 | cgi_printf("Select year: "); |
| 2488 | while( SQLITE_ROW == db_step(&qYears) ){ |
| 2489 | const char *zT = db_column_text(&qYears, 0); |
| 2490 | if( i++ ){ |
| 2491 | cgi_printf(" "); |
| 2492 | } |
| 2493 | cgi_printf("<a href='?view=byweek&y=%s&type=%c", zT, |
| 2494 | (char)statsReportType); |
| @@ -2544,11 +2544,11 @@ | |
| 2544 | } |
| 2545 | ++iterations; |
| 2546 | } |
| 2547 | db_reset(&stWeek); |
| 2548 | while( SQLITE_ROW == db_step(&stWeek) ){ |
| 2549 | const char *zWeek = db_column_text(&stWeek,0); |
| 2550 | const int nCount = db_column_int(&stWeek,1); |
| 2551 | int nSize = nCount |
| 2552 | ? (int)(100 * nCount / nMaxEvents) |
| 2553 | : 0; |
| 2554 | if(!nSize) nSize = 1; |
| @@ -2604,11 +2604,11 @@ | |
| 2604 | ** y=YYYY The year to report (default is the server's |
| 2605 | ** current year). |
| 2606 | */ |
| 2607 | void stats_report_page(){ |
| 2608 | HQuery url; /* URL for various branch links */ |
| 2609 | const char *zView = P("view"); /* Which view/report to show. */ |
| 2610 | const char *zUserName = P("user"); |
| 2611 | |
| 2612 | login_check_credentials(); |
| 2613 | if( !g.perm.Read ){ login_needed(); return; } |
| 2614 | if(!zUserName) zUserName = P("u"); |
| 2615 |
+1
-1
| --- src/unicode.c | ||
| +++ src/unicode.c | ||
| @@ -208,11 +208,11 @@ | ||
| 208 | 208 | iHi = iTest-1; |
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | 211 | assert( key>=aDia[iRes] ); |
| 212 | 212 | return ((c > (aDia[iRes]>>3) + (aDia[iRes]&0x07)) ? c : (int)aChar[iRes]); |
| 213 | -}; | |
| 213 | +} | |
| 214 | 214 | |
| 215 | 215 | |
| 216 | 216 | /* |
| 217 | 217 | ** Return true if the argument interpreted as a unicode codepoint |
| 218 | 218 | ** is a diacritical modifier character. |
| 219 | 219 |
| --- src/unicode.c | |
| +++ src/unicode.c | |
| @@ -208,11 +208,11 @@ | |
| 208 | iHi = iTest-1; |
| 209 | } |
| 210 | } |
| 211 | assert( key>=aDia[iRes] ); |
| 212 | return ((c > (aDia[iRes]>>3) + (aDia[iRes]&0x07)) ? c : (int)aChar[iRes]); |
| 213 | }; |
| 214 | |
| 215 | |
| 216 | /* |
| 217 | ** Return true if the argument interpreted as a unicode codepoint |
| 218 | ** is a diacritical modifier character. |
| 219 |
| --- src/unicode.c | |
| +++ src/unicode.c | |
| @@ -208,11 +208,11 @@ | |
| 208 | iHi = iTest-1; |
| 209 | } |
| 210 | } |
| 211 | assert( key>=aDia[iRes] ); |
| 212 | return ((c > (aDia[iRes]>>3) + (aDia[iRes]&0x07)) ? c : (int)aChar[iRes]); |
| 213 | } |
| 214 | |
| 215 | |
| 216 | /* |
| 217 | ** Return true if the argument interpreted as a unicode codepoint |
| 218 | ** is a diacritical modifier character. |
| 219 |
+2
-2
| --- src/util.c | ||
| +++ src/util.c | ||
| @@ -295,11 +295,11 @@ | ||
| 295 | 295 | */ |
| 296 | 296 | int fossil_timer_is_active( int timerId ){ |
| 297 | 297 | if(timerId<1 || timerId>FOSSIL_TIMER_COUNT){ |
| 298 | 298 | return 0; |
| 299 | 299 | }else{ |
| 300 | - int const rc = fossilTimerList[timerId-1].id; | |
| 300 | + const int rc = fossilTimerList[timerId-1].id; | |
| 301 | 301 | assert(!rc || (rc == timerId)); |
| 302 | 302 | return fossilTimerList[timerId-1].id; |
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | 305 | |
| @@ -317,10 +317,10 @@ | ||
| 317 | 317 | |
| 318 | 318 | /* |
| 319 | 319 | ** Returns TRUE if zSym is exactly UUID_SIZE bytes long and contains |
| 320 | 320 | ** only lower-case ASCII hexadecimal values. |
| 321 | 321 | */ |
| 322 | -int fossil_is_uuid(char const * zSym){ | |
| 322 | +int fossil_is_uuid(const char *zSym){ | |
| 323 | 323 | return zSym |
| 324 | 324 | && (UUID_SIZE==strlen(zSym)) |
| 325 | 325 | && validate16(zSym, UUID_SIZE); |
| 326 | 326 | } |
| 327 | 327 |
| --- src/util.c | |
| +++ src/util.c | |
| @@ -295,11 +295,11 @@ | |
| 295 | */ |
| 296 | int fossil_timer_is_active( int timerId ){ |
| 297 | if(timerId<1 || timerId>FOSSIL_TIMER_COUNT){ |
| 298 | return 0; |
| 299 | }else{ |
| 300 | int const rc = fossilTimerList[timerId-1].id; |
| 301 | assert(!rc || (rc == timerId)); |
| 302 | return fossilTimerList[timerId-1].id; |
| 303 | } |
| 304 | } |
| 305 | |
| @@ -317,10 +317,10 @@ | |
| 317 | |
| 318 | /* |
| 319 | ** Returns TRUE if zSym is exactly UUID_SIZE bytes long and contains |
| 320 | ** only lower-case ASCII hexadecimal values. |
| 321 | */ |
| 322 | int fossil_is_uuid(char const * zSym){ |
| 323 | return zSym |
| 324 | && (UUID_SIZE==strlen(zSym)) |
| 325 | && validate16(zSym, UUID_SIZE); |
| 326 | } |
| 327 |
| --- src/util.c | |
| +++ src/util.c | |
| @@ -295,11 +295,11 @@ | |
| 295 | */ |
| 296 | int fossil_timer_is_active( int timerId ){ |
| 297 | if(timerId<1 || timerId>FOSSIL_TIMER_COUNT){ |
| 298 | return 0; |
| 299 | }else{ |
| 300 | const int rc = fossilTimerList[timerId-1].id; |
| 301 | assert(!rc || (rc == timerId)); |
| 302 | return fossilTimerList[timerId-1].id; |
| 303 | } |
| 304 | } |
| 305 | |
| @@ -317,10 +317,10 @@ | |
| 317 | |
| 318 | /* |
| 319 | ** Returns TRUE if zSym is exactly UUID_SIZE bytes long and contains |
| 320 | ** only lower-case ASCII hexadecimal values. |
| 321 | */ |
| 322 | int fossil_is_uuid(const char *zSym){ |
| 323 | return zSym |
| 324 | && (UUID_SIZE==strlen(zSym)) |
| 325 | && validate16(zSym, UUID_SIZE); |
| 326 | } |
| 327 |
+8
-8
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -860,11 +860,11 @@ | ||
| 860 | 860 | ** URL: /wfind?title=TITLE |
| 861 | 861 | ** List all wiki pages whose titles contain the search text |
| 862 | 862 | */ |
| 863 | 863 | void wfind_page(void){ |
| 864 | 864 | Stmt q; |
| 865 | - const char * zTitle; | |
| 865 | + const char *zTitle; | |
| 866 | 866 | login_check_credentials(); |
| 867 | 867 | if( !g.perm.RdWiki ){ login_needed(); return; } |
| 868 | 868 | zTitle = PD("title","*"); |
| 869 | 869 | style_header("Wiki Pages Found"); |
| 870 | 870 | @ <ul> |
| @@ -960,18 +960,18 @@ | ||
| 960 | 960 | ** |
| 961 | 961 | ** zMimeType specifies the N-card for the wiki page. If it is 0, |
| 962 | 962 | ** empty, or "text/x-fossil-wiki" (the default format) then it is |
| 963 | 963 | ** ignored. |
| 964 | 964 | */ |
| 965 | -int wiki_cmd_commit(char const * zPageName, int isNew, Blob *pContent, | |
| 966 | - char const * zMimeType){ | |
| 965 | +int wiki_cmd_commit(const char *zPageName, int isNew, Blob *pContent, | |
| 966 | + const char *zMimeType){ | |
| 967 | 967 | Blob wiki; /* Wiki page content */ |
| 968 | 968 | Blob cksum; /* wiki checksum */ |
| 969 | 969 | int rid; /* artifact ID of parent page */ |
| 970 | 970 | char *zDate; /* timestamp */ |
| 971 | 971 | char *zUuid; /* uuid for rid */ |
| 972 | - | |
| 972 | + | |
| 973 | 973 | rid = db_int(0, |
| 974 | 974 | "SELECT x.rid FROM tag t, tagxref x" |
| 975 | 975 | " WHERE x.tagid=t.tagid AND t.tagname='wiki-%q'" |
| 976 | 976 | " ORDER BY x.mtime DESC LIMIT 1", |
| 977 | 977 | zPageName |
| @@ -1058,12 +1058,12 @@ | ||
| 1058 | 1058 | if( n==0 ){ |
| 1059 | 1059 | goto wiki_cmd_usage; |
| 1060 | 1060 | } |
| 1061 | 1061 | |
| 1062 | 1062 | if( strncmp(g.argv[2],"export",n)==0 ){ |
| 1063 | - char const *zPageName; /* Name of the wiki page to export */ | |
| 1064 | - char const *zFile; /* Name of the output file (0=stdout) */ | |
| 1063 | + const char *zPageName; /* Name of the wiki page to export */ | |
| 1064 | + const char *zFile; /* Name of the output file (0=stdout) */ | |
| 1065 | 1065 | int rid; /* Artifact ID of the wiki page */ |
| 1066 | 1066 | int i; /* Loop counter */ |
| 1067 | 1067 | char *zBody = 0; /* Wiki page content */ |
| 1068 | 1068 | Blob body; /* Wiki page content */ |
| 1069 | 1069 | Manifest *pWiki = 0; /* Parsed wiki page content */ |
| @@ -1091,15 +1091,15 @@ | ||
| 1091 | 1091 | blob_reset(&body); |
| 1092 | 1092 | manifest_destroy(pWiki); |
| 1093 | 1093 | return; |
| 1094 | 1094 | }else if( strncmp(g.argv[2],"commit",n)==0 |
| 1095 | 1095 | || strncmp(g.argv[2],"create",n)==0 ){ |
| 1096 | - char const *zPageName; /* page name */ | |
| 1096 | + const char *zPageName; /* page name */ | |
| 1097 | 1097 | Blob content; /* Input content */ |
| 1098 | 1098 | int rid; |
| 1099 | 1099 | Manifest *pWiki = 0; /* Parsed wiki page content */ |
| 1100 | - char const * zMimeType = find_option("mimetype", "M", 1); | |
| 1100 | + const char *zMimeType = find_option("mimetype", "M", 1); | |
| 1101 | 1101 | if( g.argc!=4 && g.argc!=5 ){ |
| 1102 | 1102 | usage("commit|create PAGENAME ?FILE? [-mimetype TEXT-FORMAT]"); |
| 1103 | 1103 | } |
| 1104 | 1104 | zPageName = g.argv[3]; |
| 1105 | 1105 | if( g.argc==4 ){ |
| 1106 | 1106 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -860,11 +860,11 @@ | |
| 860 | ** URL: /wfind?title=TITLE |
| 861 | ** List all wiki pages whose titles contain the search text |
| 862 | */ |
| 863 | void wfind_page(void){ |
| 864 | Stmt q; |
| 865 | const char * zTitle; |
| 866 | login_check_credentials(); |
| 867 | if( !g.perm.RdWiki ){ login_needed(); return; } |
| 868 | zTitle = PD("title","*"); |
| 869 | style_header("Wiki Pages Found"); |
| 870 | @ <ul> |
| @@ -960,18 +960,18 @@ | |
| 960 | ** |
| 961 | ** zMimeType specifies the N-card for the wiki page. If it is 0, |
| 962 | ** empty, or "text/x-fossil-wiki" (the default format) then it is |
| 963 | ** ignored. |
| 964 | */ |
| 965 | int wiki_cmd_commit(char const * zPageName, int isNew, Blob *pContent, |
| 966 | char const * zMimeType){ |
| 967 | Blob wiki; /* Wiki page content */ |
| 968 | Blob cksum; /* wiki checksum */ |
| 969 | int rid; /* artifact ID of parent page */ |
| 970 | char *zDate; /* timestamp */ |
| 971 | char *zUuid; /* uuid for rid */ |
| 972 | |
| 973 | rid = db_int(0, |
| 974 | "SELECT x.rid FROM tag t, tagxref x" |
| 975 | " WHERE x.tagid=t.tagid AND t.tagname='wiki-%q'" |
| 976 | " ORDER BY x.mtime DESC LIMIT 1", |
| 977 | zPageName |
| @@ -1058,12 +1058,12 @@ | |
| 1058 | if( n==0 ){ |
| 1059 | goto wiki_cmd_usage; |
| 1060 | } |
| 1061 | |
| 1062 | if( strncmp(g.argv[2],"export",n)==0 ){ |
| 1063 | char const *zPageName; /* Name of the wiki page to export */ |
| 1064 | char const *zFile; /* Name of the output file (0=stdout) */ |
| 1065 | int rid; /* Artifact ID of the wiki page */ |
| 1066 | int i; /* Loop counter */ |
| 1067 | char *zBody = 0; /* Wiki page content */ |
| 1068 | Blob body; /* Wiki page content */ |
| 1069 | Manifest *pWiki = 0; /* Parsed wiki page content */ |
| @@ -1091,15 +1091,15 @@ | |
| 1091 | blob_reset(&body); |
| 1092 | manifest_destroy(pWiki); |
| 1093 | return; |
| 1094 | }else if( strncmp(g.argv[2],"commit",n)==0 |
| 1095 | || strncmp(g.argv[2],"create",n)==0 ){ |
| 1096 | char const *zPageName; /* page name */ |
| 1097 | Blob content; /* Input content */ |
| 1098 | int rid; |
| 1099 | Manifest *pWiki = 0; /* Parsed wiki page content */ |
| 1100 | char const * zMimeType = find_option("mimetype", "M", 1); |
| 1101 | if( g.argc!=4 && g.argc!=5 ){ |
| 1102 | usage("commit|create PAGENAME ?FILE? [-mimetype TEXT-FORMAT]"); |
| 1103 | } |
| 1104 | zPageName = g.argv[3]; |
| 1105 | if( g.argc==4 ){ |
| 1106 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -860,11 +860,11 @@ | |
| 860 | ** URL: /wfind?title=TITLE |
| 861 | ** List all wiki pages whose titles contain the search text |
| 862 | */ |
| 863 | void wfind_page(void){ |
| 864 | Stmt q; |
| 865 | const char *zTitle; |
| 866 | login_check_credentials(); |
| 867 | if( !g.perm.RdWiki ){ login_needed(); return; } |
| 868 | zTitle = PD("title","*"); |
| 869 | style_header("Wiki Pages Found"); |
| 870 | @ <ul> |
| @@ -960,18 +960,18 @@ | |
| 960 | ** |
| 961 | ** zMimeType specifies the N-card for the wiki page. If it is 0, |
| 962 | ** empty, or "text/x-fossil-wiki" (the default format) then it is |
| 963 | ** ignored. |
| 964 | */ |
| 965 | int wiki_cmd_commit(const char *zPageName, int isNew, Blob *pContent, |
| 966 | const char *zMimeType){ |
| 967 | Blob wiki; /* Wiki page content */ |
| 968 | Blob cksum; /* wiki checksum */ |
| 969 | int rid; /* artifact ID of parent page */ |
| 970 | char *zDate; /* timestamp */ |
| 971 | char *zUuid; /* uuid for rid */ |
| 972 | |
| 973 | rid = db_int(0, |
| 974 | "SELECT x.rid FROM tag t, tagxref x" |
| 975 | " WHERE x.tagid=t.tagid AND t.tagname='wiki-%q'" |
| 976 | " ORDER BY x.mtime DESC LIMIT 1", |
| 977 | zPageName |
| @@ -1058,12 +1058,12 @@ | |
| 1058 | if( n==0 ){ |
| 1059 | goto wiki_cmd_usage; |
| 1060 | } |
| 1061 | |
| 1062 | if( strncmp(g.argv[2],"export",n)==0 ){ |
| 1063 | const char *zPageName; /* Name of the wiki page to export */ |
| 1064 | const char *zFile; /* Name of the output file (0=stdout) */ |
| 1065 | int rid; /* Artifact ID of the wiki page */ |
| 1066 | int i; /* Loop counter */ |
| 1067 | char *zBody = 0; /* Wiki page content */ |
| 1068 | Blob body; /* Wiki page content */ |
| 1069 | Manifest *pWiki = 0; /* Parsed wiki page content */ |
| @@ -1091,15 +1091,15 @@ | |
| 1091 | blob_reset(&body); |
| 1092 | manifest_destroy(pWiki); |
| 1093 | return; |
| 1094 | }else if( strncmp(g.argv[2],"commit",n)==0 |
| 1095 | || strncmp(g.argv[2],"create",n)==0 ){ |
| 1096 | const char *zPageName; /* page name */ |
| 1097 | Blob content; /* Input content */ |
| 1098 | int rid; |
| 1099 | Manifest *pWiki = 0; /* Parsed wiki page content */ |
| 1100 | const char *zMimeType = find_option("mimetype", "M", 1); |
| 1101 | if( g.argc!=4 && g.argc!=5 ){ |
| 1102 | usage("commit|create PAGENAME ?FILE? [-mimetype TEXT-FORMAT]"); |
| 1103 | } |
| 1104 | zPageName = g.argv[3]; |
| 1105 | if( g.argc==4 ){ |
| 1106 |