Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | eliminate many unnessary type-casts |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
5b456cfa6b8ad2a05cc27015446b47c0 |
User & Date: | jan.nijtmans 2015-09-16 10:49:49 |
Context
2015-09-20
| ||
18:17 | merge "stash cat" ... (check-in: ba9d3f08 user: bch tags: trunk) | |
2015-09-16
| ||
10:49 | eliminate many unnessary type-casts ... (check-in: 5b456cfa user: jan.nijtmans tags: trunk) | |
09:18 | Add some "const" keywords in appropriate places. No change in functionality. Eliminates some compiler warnings. ... (check-in: a6fd491d user: jan.nijtmans tags: trunk) | |
Changes
Changes to src/db.c.
︙ | ︙ | |||
2016 2017 2018 2019 2020 2021 2022 | z = fossil_strdup(pSetting->def); }else{ z = fossil_strdup(zDefault); } } return z; } | | | | | 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 | z = fossil_strdup(pSetting->def); }else{ z = fossil_strdup(zDefault); } } return z; } char *db_get_mtime(const char *zName, const char *zFormat, const char *zDefault){ char *z = 0; if( g.repositoryOpen ){ z = db_text(0, "SELECT mtime FROM config WHERE name=%Q", zName); } if( z==0 ){ z = fossil_strdup(zDefault); }else if( zFormat!=0 ){ z = db_text(0, "SELECT strftime(%Q,%Q,'unixepoch');", zFormat, z); } return z; } void db_set(const char *zName, const char *zValue, int globalFlag){ db_begin_transaction(); |
︙ | ︙ |
Changes to src/diffcmd.c.
︙ | ︙ | |||
663 664 665 666 667 668 669 | } /* ** Return the name of the external diff command, or return NULL if ** no external diff command is defined. */ const char *diff_command_external(int guiDiff){ | | | 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 | } /* ** Return the name of the external diff command, or return NULL if ** no external diff command is defined. */ const char *diff_command_external(int guiDiff){ const char *zDefault; const char *zName; if( guiDiff ){ #if defined(_WIN32) zDefault = "WinDiff.exe"; #else zDefault = 0; |
︙ | ︙ |
Changes to src/http_transport.c.
︙ | ︙ | |||
76 77 78 79 80 81 82 | } } /* ** Default SSH command */ #ifdef _WIN32 | | | | | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | } } /* ** Default SSH command */ #ifdef _WIN32 static const char zDefaultSshCmd[] = "plink -ssh -T"; #else static const char zDefaultSshCmd[] = "ssh -e none -T"; #endif /* ** SSH initialization of the transport layer */ int transport_ssh_open(UrlData *pUrlData){ /* For SSH we need to create and run SSH fossil http ** to talk to the remote machine. */ char *zSsh; /* The base SSH command */ Blob zCmd; /* The SSH command */ char *zHost; /* The host name to contact */ int n; /* Size of prefix string */ socket_ssh_resolve_addr(pUrlData); zSsh = db_get("ssh-command", zDefaultSshCmd); blob_init(&zCmd, zSsh, -1); |
︙ | ︙ |
Changes to src/setup.c.
︙ | ︙ | |||
326 327 328 329 330 331 332 | const char *zId, *zLogin, *zInfo, *zCap, *zPw; const char *zGroup; const char *zOldLogin; int doWrite; int uid, i; int higherUser = 0; /* True if user being edited is SETUP and the */ /* user doing the editing is ADMIN. Disallow editing */ | | | 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | const char *zId, *zLogin, *zInfo, *zCap, *zPw; const char *zGroup; const char *zOldLogin; int doWrite; int uid, i; int higherUser = 0; /* True if user being edited is SETUP and the */ /* user doing the editing is ADMIN. Disallow editing */ const char *inherit[128]; int a[128]; const char *oa[128]; /* Must have ADMIN privileges to access this page */ login_check_credentials(); if( !g.perm.Admin ){ login_needed(0); return; } |
︙ | ︙ | |||
904 905 906 907 908 909 910 | ** Generate an entry box for an attribute. */ void entry_attribute( const char *zLabel, /* The text label on the entry box */ int width, /* Width of the entry box */ const char *zVar, /* The corresponding row in the VAR table */ const char *zQParm, /* The query parameter */ | | | 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 | ** Generate an entry box for an attribute. */ void entry_attribute( const char *zLabel, /* The text label on the entry box */ int width, /* Width of the entry box */ const char *zVar, /* The corresponding row in the VAR table */ const char *zQParm, /* The query parameter */ const char *zDflt, /* Default value if VAR table entry does not exist */ int disabled /* 1 if disabled */ ){ const char *zVal = db_get(zVar, zDflt); const char *zQ = P(zQParm); if( zQ && fossil_strcmp(zQ,zVal)!=0 ){ const int nZQ = (int)strlen(zQ); login_verify_csrf_secret(); |
︙ | ︙ | |||
936 937 938 939 940 941 942 | int rows, /* Rows in the textarea */ int cols, /* Columns in the textarea */ const char *zVar, /* The corresponding row in the VAR table */ const char *zQP, /* The query parameter */ const char *zDflt, /* Default value if VAR table entry does not exist */ int disabled /* 1 if the textarea should not be editable */ ){ | | | 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 | int rows, /* Rows in the textarea */ int cols, /* Columns in the textarea */ const char *zVar, /* The corresponding row in the VAR table */ const char *zQP, /* The query parameter */ const char *zDflt, /* Default value if VAR table entry does not exist */ int disabled /* 1 if the textarea should not be editable */ ){ const char *z = db_get(zVar, zDflt); const char *zQ = P(zQP); if( zQ && !disabled && fossil_strcmp(zQ,z)!=0){ const int nZQ = (int)strlen(zQ); login_verify_csrf_secret(); db_set(zVar, zQ, 0); admin_log("Set textarea_attribute %Q to: %.*s%s", zVar, 20, zQ, (nZQ>20 ? "..." : "")); |
︙ | ︙ | |||
970 971 972 973 974 975 976 | const char *zLabel, /* The text label on the menu */ const char *zVar, /* The corresponding row in the VAR table */ const char *zQP, /* The query parameter */ const char *zDflt, /* Default value if VAR table entry does not exist */ int nChoice, /* Number of choices */ const char *const *azChoice /* Choices. 2 per choice: (VAR value, Display) */ ){ | | | 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 | const char *zLabel, /* The text label on the menu */ const char *zVar, /* The corresponding row in the VAR table */ const char *zQP, /* The query parameter */ const char *zDflt, /* Default value if VAR table entry does not exist */ int nChoice, /* Number of choices */ const char *const *azChoice /* Choices. 2 per choice: (VAR value, Display) */ ){ const char *z = db_get(zVar, zDflt); const char *zQ = P(zQP); int i; if( zQ && fossil_strcmp(zQ,z)!=0){ const int nZQ = (int)strlen(zQ); login_verify_csrf_secret(); db_set(zVar, zQ, 0); admin_log("Set multiple_choice_attribute %Q to: %.*s%s", |
︙ | ︙ |
Changes to src/skins.c.
︙ | ︙ | |||
71 72 73 74 75 76 77 | ** attributes of the skin that cannot be easily specified using CSS ** or that need to be known on the server-side. ** ** The following array holds the value for all known skin details. */ static struct SkinDetail { const char *zName; /* Name of the detail */ | | | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | ** attributes of the skin that cannot be easily specified using CSS ** or that need to be known on the server-side. ** ** The following array holds the value for all known skin details. */ static struct SkinDetail { const char *zName; /* Name of the detail */ const char *zValue; /* Value of the detail */ } aSkinDetail[] = { { "timeline-arrowheads", "1" }, { "timeline-circle-nodes", "0" }, { "timeline-color-graph-lines", "0" }, { "white-foreground", "0" }, }; |
︙ | ︙ | |||
248 249 250 251 252 253 254 | unsigned int skin_id(const char *zResource){ unsigned int h = 0; if( zAltSkinDir ){ h = skin_hash(0, zAltSkinDir); }else if( pAltSkin ){ h = skin_hash(0, pAltSkin->zLabel); }else{ | | | 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | unsigned int skin_id(const char *zResource){ unsigned int h = 0; if( zAltSkinDir ){ h = skin_hash(0, zAltSkinDir); }else if( pAltSkin ){ h = skin_hash(0, pAltSkin->zLabel); }else{ char *zMTime = db_get_mtime(zResource, 0, 0); h = skin_hash(0, zMTime); fossil_free(zMTime); } h = skin_hash(h, MANIFEST_UUID); return h; } |
︙ | ︙ |
Changes to src/tktsetup.c.
︙ | ︙ | |||
97 98 99 100 101 102 103 | @ CREATE INDEX ticketchng_idx1 ON ticketchng(tkt_id, tkt_mtime); ; /* ** Return the ticket table definition */ const char *ticket_table_schema(void){ | | | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | @ CREATE INDEX ticketchng_idx1 ON ticketchng(tkt_id, tkt_mtime); ; /* ** Return the ticket table definition */ const char *ticket_table_schema(void){ return db_get("ticket-table", zDefaultTicketTable); } /* ** Common implementation for the ticket setup editor pages. */ static void tktsetup_generic( const char *zTitle, /* Page title */ |
︙ | ︙ | |||
126 127 128 129 130 131 132 | } if( PB("setup") ){ cgi_redirect("tktsetup"); } isSubmit = P("submit")!=0; z = P("x"); if( z==0 ){ | | | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | } if( PB("setup") ){ cgi_redirect("tktsetup"); } isSubmit = P("submit")!=0; z = P("x"); if( z==0 ){ z = db_get(zDbField, zDfltValue); } style_header("Edit %s", zTitle); if( P("clear")!=0 ){ login_verify_csrf_secret(); db_unset(zDbField, 0); if( xRebuild ) xRebuild(); cgi_redirect("tktsetup"); |
︙ | ︙ | |||
238 239 240 241 242 243 244 | @ } ; /* ** Return the ticket common code. */ const char *ticket_common_code(void){ | | | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | @ } ; /* ** Return the ticket common code. */ const char *ticket_common_code(void){ return db_get("ticket-common", zDefaultTicketCommon); } /* ** WEBPAGE: tktsetup_com ** Administrative page used to define TH1 script that is ** common to all ticket screens. */ |
︙ | ︙ | |||
270 271 272 273 274 275 276 | @ return ; /* ** Return the ticket change code. */ const char *ticket_change_code(void){ | | | 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | @ return ; /* ** Return the ticket change code. */ const char *ticket_change_code(void){ return db_get("ticket-change", zDefaultTicketChange); } /* ** WEBPAGE: tktsetup_change ** Adminstrative screen used to view or edit the TH1 script ** that shows ticket changes. */ |
︙ | ︙ | |||
415 416 417 418 419 420 421 | @ </table> ; /* ** Return the code used to generate the new ticket page */ const char *ticket_newpage_code(void){ | | | 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | @ </table> ; /* ** Return the code used to generate the new ticket page */ const char *ticket_newpage_code(void){ return db_get("ticket-newpage", zDefaultNew); } /* ** WEBPAGE: tktsetup_newpage ** Administrative page used to view or edit the TH1 script used ** to enter new tickets. */ |
︙ | ︙ | |||
556 557 558 559 560 561 562 | ; /* ** Return the code used to generate the view ticket page */ const char *ticket_viewpage_code(void){ | | | 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 | ; /* ** Return the code used to generate the view ticket page */ const char *ticket_viewpage_code(void){ return db_get("ticket-viewpage", zDefaultView); } /* ** WEBPAGE: tktsetup_viewpage ** Administrative page used to view or edit the TH1 script that ** displays individual tickets. */ |
︙ | ︙ | |||
697 698 699 700 701 702 703 | @ </table> ; /* ** Return the code used to generate the edit ticket page */ const char *ticket_editpage_code(void){ | | | 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 | @ </table> ; /* ** Return the code used to generate the edit ticket page */ const char *ticket_editpage_code(void){ return db_get("ticket-editpage", zDefaultEdit); } /* ** WEBPAGE: tktsetup_editpage ** Administrative page for viewing or editing the TH1 script that ** drives the ticket editing page. */ |
︙ | ︙ | |||
753 754 755 756 757 758 759 | @ </th1> ; /* ** Return the code used to generate the report list */ const char *ticket_reportlist_code(void){ | | | 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 | @ </th1> ; /* ** Return the code used to generate the report list */ const char *ticket_reportlist_code(void){ return db_get("ticket-reportlist", zDefaultReportList); } /* ** WEBPAGE: tktsetup_reportlist ** Administrative page used to view or edit the TH1 script that ** defines the "report list" page. */ |
︙ | ︙ | |||
846 847 848 849 850 851 852 | ; /* ** Return the template ticket report format: */ const char *ticket_key_template(void){ | | | 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 | ; /* ** Return the template ticket report format: */ const char *ticket_key_template(void){ return db_get("ticket-key-template", zDefaultKey); } /* ** WEBPAGE: tktsetup_keytplt ** ** Administrative page used to view or edit the Key template ** for tickets. |
︙ | ︙ |
Changes to src/xfersetup.c.
︙ | ︙ | |||
112 113 114 115 116 117 118 | } if( P("setup") ){ cgi_redirect("xfersetup"); } isSubmit = P("submit")!=0; z = P("x"); if( z==0 ){ | | | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | } if( P("setup") ){ cgi_redirect("xfersetup"); } isSubmit = P("submit")!=0; z = P("x"); if( z==0 ){ z = db_get(zDbField, zDfltValue); } style_header("Edit %s", zTitle); if( P("clear")!=0 ){ login_verify_csrf_secret(); db_unset(zDbField, 0); if( xRebuild ) xRebuild(); z = zDfltValue; |
︙ | ︙ |