Fossil SCM

Fix some const-correctness warnings with gcc 15.2.

danield 2026-04-27 11:27 UTC trunk
Commit ea099022b54d22be2a85d10afc82b0db25b292240038642b578835088b8827b7
+3 -3
--- src/alerts.c
+++ src/alerts.c
@@ -836,16 +836,16 @@
836836
837837
/*
838838
** Return the hostname portion of an email address - the part following
839839
** the @
840840
*/
841
-char *alert_hostname(const char *zAddr){
842
- char *z = strchr(zAddr, '@');
841
+const char *alert_hostname(const char *zAddr){
842
+ const char *z = strchr(zAddr, '@');
843843
if( z ){
844844
z++;
845845
}else{
846
- z = (char*)zAddr;
846
+ z = zAddr;
847847
}
848848
return z;
849849
}
850850
851851
/*
852852
--- src/alerts.c
+++ src/alerts.c
@@ -836,16 +836,16 @@
836
837 /*
838 ** Return the hostname portion of an email address - the part following
839 ** the @
840 */
841 char *alert_hostname(const char *zAddr){
842 char *z = strchr(zAddr, '@');
843 if( z ){
844 z++;
845 }else{
846 z = (char*)zAddr;
847 }
848 return z;
849 }
850
851 /*
852
--- src/alerts.c
+++ src/alerts.c
@@ -836,16 +836,16 @@
836
837 /*
838 ** Return the hostname portion of an email address - the part following
839 ** the @
840 */
841 const char *alert_hostname(const char *zAddr){
842 const char *z = strchr(zAddr, '@');
843 if( z ){
844 z++;
845 }else{
846 z = zAddr;
847 }
848 return z;
849 }
850
851 /*
852
+1 -1
--- src/builtin.c
+++ src/builtin.c
@@ -65,11 +65,11 @@
6565
int i = builtin_file_index(zFilename);
6666
if( i>=0 ){
6767
if( piSize ) *piSize = aBuiltinFiles[i].nByte;
6868
return aBuiltinFiles[i].pData;
6969
}else{
70
- char *zV = strstr(zFilename, "-v");
70
+ const char *zV = strstr(zFilename, "-v");
7171
if( zV!=0 ){
7272
for(i=0; fossil_isdigit(zV[i+2]); i++){}
7373
if( i>=8 && zV[i+2]=='.' ){
7474
char *zNew = mprintf("%.*s%s", (int)(zV-zFilename), zFilename, zV+i+2);
7575
const unsigned char *pRes = builtin_file(zNew, piSize);
7676
--- src/builtin.c
+++ src/builtin.c
@@ -65,11 +65,11 @@
65 int i = builtin_file_index(zFilename);
66 if( i>=0 ){
67 if( piSize ) *piSize = aBuiltinFiles[i].nByte;
68 return aBuiltinFiles[i].pData;
69 }else{
70 char *zV = strstr(zFilename, "-v");
71 if( zV!=0 ){
72 for(i=0; fossil_isdigit(zV[i+2]); i++){}
73 if( i>=8 && zV[i+2]=='.' ){
74 char *zNew = mprintf("%.*s%s", (int)(zV-zFilename), zFilename, zV+i+2);
75 const unsigned char *pRes = builtin_file(zNew, piSize);
76
--- src/builtin.c
+++ src/builtin.c
@@ -65,11 +65,11 @@
65 int i = builtin_file_index(zFilename);
66 if( i>=0 ){
67 if( piSize ) *piSize = aBuiltinFiles[i].nByte;
68 return aBuiltinFiles[i].pData;
69 }else{
70 const char *zV = strstr(zFilename, "-v");
71 if( zV!=0 ){
72 for(i=0; fossil_isdigit(zV[i+2]); i++){}
73 if( i>=8 && zV[i+2]=='.' ){
74 char *zNew = mprintf("%.*s%s", (int)(zV-zFilename), zFilename, zV+i+2);
75 const unsigned char *pRes = builtin_file(zNew, piSize);
76
+2 -2
--- src/cgi.c
+++ src/cgi.c
@@ -1390,11 +1390,11 @@
13901390
**
13911391
*/
13921392
void cgi_init(void){
13931393
char *z;
13941394
const char *zType;
1395
- char *zSemi;
1395
+ const char *zSemi;
13961396
int len;
13971397
const char *zRequestUri = cgi_parameter("REQUEST_URI",0);
13981398
const char *zScriptName = cgi_parameter("SCRIPT_NAME",0);
13991399
const char *zPathInfo = cgi_parameter("PATH_INFO",0);
14001400
const char *zContentLength = 0;
@@ -1412,11 +1412,11 @@
14121412
** to compute it from REQUEST_URI and PATH_INFO. */
14131413
if( zScriptName==0 ){
14141414
if( zRequestUri==0 || zPathInfo==0 ){
14151415
malformed_request("missing SCRIPT_NAME"); /* Does not return */
14161416
}
1417
- z = strstr(zRequestUri,zPathInfo);
1417
+ z = (char*)strstr(zRequestUri,zPathInfo);
14181418
if( z==0 ){
14191419
malformed_request("PATH_INFO not found in REQUEST_URI");
14201420
}
14211421
zScriptName = fossil_strndup(zRequestUri,(int)(z-zRequestUri));
14221422
cgi_set_parameter("SCRIPT_NAME", zScriptName);
14231423
--- src/cgi.c
+++ src/cgi.c
@@ -1390,11 +1390,11 @@
1390 **
1391 */
1392 void cgi_init(void){
1393 char *z;
1394 const char *zType;
1395 char *zSemi;
1396 int len;
1397 const char *zRequestUri = cgi_parameter("REQUEST_URI",0);
1398 const char *zScriptName = cgi_parameter("SCRIPT_NAME",0);
1399 const char *zPathInfo = cgi_parameter("PATH_INFO",0);
1400 const char *zContentLength = 0;
@@ -1412,11 +1412,11 @@
1412 ** to compute it from REQUEST_URI and PATH_INFO. */
1413 if( zScriptName==0 ){
1414 if( zRequestUri==0 || zPathInfo==0 ){
1415 malformed_request("missing SCRIPT_NAME"); /* Does not return */
1416 }
1417 z = strstr(zRequestUri,zPathInfo);
1418 if( z==0 ){
1419 malformed_request("PATH_INFO not found in REQUEST_URI");
1420 }
1421 zScriptName = fossil_strndup(zRequestUri,(int)(z-zRequestUri));
1422 cgi_set_parameter("SCRIPT_NAME", zScriptName);
1423
--- src/cgi.c
+++ src/cgi.c
@@ -1390,11 +1390,11 @@
1390 **
1391 */
1392 void cgi_init(void){
1393 char *z;
1394 const char *zType;
1395 const char *zSemi;
1396 int len;
1397 const char *zRequestUri = cgi_parameter("REQUEST_URI",0);
1398 const char *zScriptName = cgi_parameter("SCRIPT_NAME",0);
1399 const char *zPathInfo = cgi_parameter("PATH_INFO",0);
1400 const char *zContentLength = 0;
@@ -1412,11 +1412,11 @@
1412 ** to compute it from REQUEST_URI and PATH_INFO. */
1413 if( zScriptName==0 ){
1414 if( zRequestUri==0 || zPathInfo==0 ){
1415 malformed_request("missing SCRIPT_NAME"); /* Does not return */
1416 }
1417 z = (char*)strstr(zRequestUri,zPathInfo);
1418 if( z==0 ){
1419 malformed_request("PATH_INFO not found in REQUEST_URI");
1420 }
1421 zScriptName = fossil_strndup(zRequestUri,(int)(z-zRequestUri));
1422 cgi_set_parameter("SCRIPT_NAME", zScriptName);
1423
+1 -1
--- src/db.c
+++ src/db.c
@@ -4534,11 +4534,11 @@
45344534
if( strchr(zVal,'\n')==0 ){
45354535
fossil_print("%-24s %-11s %s\n", pSetting->name, zName, zVal);
45364536
}else{
45374537
fossil_print("%-24s %-11s\n", pSetting->name, zName);
45384538
while( zVal[0] ){
4539
- char *zNL = strchr(zVal, '\n');
4539
+ const char *zNL = strchr(zVal, '\n');
45404540
if( zNL==0 ){
45414541
fossil_print(" %s\n", zVal);
45424542
break;
45434543
}else{
45444544
int n = (int)(zNL - zVal);
45454545
--- src/db.c
+++ src/db.c
@@ -4534,11 +4534,11 @@
4534 if( strchr(zVal,'\n')==0 ){
4535 fossil_print("%-24s %-11s %s\n", pSetting->name, zName, zVal);
4536 }else{
4537 fossil_print("%-24s %-11s\n", pSetting->name, zName);
4538 while( zVal[0] ){
4539 char *zNL = strchr(zVal, '\n');
4540 if( zNL==0 ){
4541 fossil_print(" %s\n", zVal);
4542 break;
4543 }else{
4544 int n = (int)(zNL - zVal);
4545
--- src/db.c
+++ src/db.c
@@ -4534,11 +4534,11 @@
4534 if( strchr(zVal,'\n')==0 ){
4535 fossil_print("%-24s %-11s %s\n", pSetting->name, zName, zVal);
4536 }else{
4537 fossil_print("%-24s %-11s\n", pSetting->name, zName);
4538 while( zVal[0] ){
4539 const char *zNL = strchr(zVal, '\n');
4540 if( zNL==0 ){
4541 fossil_print(" %s\n", zVal);
4542 break;
4543 }else{
4544 int n = (int)(zNL - zVal);
4545
+1 -1
--- src/printf.c
+++ src/printf.c
@@ -344,11 +344,11 @@
344344
double rounder; /* Used for rounding floating point values */
345345
etByte flag_dp; /* True if decimal point should be shown */
346346
etByte flag_rtz; /* True if trailing zeros should be removed */
347347
etByte flag_exp; /* True to force display of the exponent */
348348
int nsd; /* Number of significant digits returned */
349
- char *zFmtLookup;
349
+ const char *zFmtLookup;
350350
351351
count = length = 0;
352352
bufpt = 0;
353353
for(; (c=(*fmt))!=0; ++fmt){
354354
if( c!='%' ){
355355
--- src/printf.c
+++ src/printf.c
@@ -344,11 +344,11 @@
344 double rounder; /* Used for rounding floating point values */
345 etByte flag_dp; /* True if decimal point should be shown */
346 etByte flag_rtz; /* True if trailing zeros should be removed */
347 etByte flag_exp; /* True to force display of the exponent */
348 int nsd; /* Number of significant digits returned */
349 char *zFmtLookup;
350
351 count = length = 0;
352 bufpt = 0;
353 for(; (c=(*fmt))!=0; ++fmt){
354 if( c!='%' ){
355
--- src/printf.c
+++ src/printf.c
@@ -344,11 +344,11 @@
344 double rounder; /* Used for rounding floating point values */
345 etByte flag_dp; /* True if decimal point should be shown */
346 etByte flag_rtz; /* True if trailing zeros should be removed */
347 etByte flag_exp; /* True to force display of the exponent */
348 int nsd; /* Number of significant digits returned */
349 const char *zFmtLookup;
350
351 count = length = 0;
352 bufpt = 0;
353 for(; (c=(*fmt))!=0; ++fmt){
354 if( c!='%' ){
355
+1 -1
--- src/style.c
+++ src/style.c
@@ -629,11 +629,11 @@
629629
zFormat = db_get("default-csp",0);
630630
if( zFormat==0 || zFormat[0]==0 ){
631631
zFormat = zBackupCSP;
632632
}
633633
blob_init(&csp, 0, 0);
634
- while( zFormat[0] && (zNonce = strstr(zFormat,"$nonce"))!=0 ){
634
+ while( zFormat[0] && (zNonce = (char*)strstr(zFormat,"$nonce"))!=0 ){
635635
blob_append(&csp, zFormat, (int)(zNonce - zFormat));
636636
blob_append(&csp, style_nonce(), -1);
637637
zFormat = zNonce + 6;
638638
}
639639
blob_append(&csp, zFormat, -1);
640640
--- src/style.c
+++ src/style.c
@@ -629,11 +629,11 @@
629 zFormat = db_get("default-csp",0);
630 if( zFormat==0 || zFormat[0]==0 ){
631 zFormat = zBackupCSP;
632 }
633 blob_init(&csp, 0, 0);
634 while( zFormat[0] && (zNonce = strstr(zFormat,"$nonce"))!=0 ){
635 blob_append(&csp, zFormat, (int)(zNonce - zFormat));
636 blob_append(&csp, style_nonce(), -1);
637 zFormat = zNonce + 6;
638 }
639 blob_append(&csp, zFormat, -1);
640
--- src/style.c
+++ src/style.c
@@ -629,11 +629,11 @@
629 zFormat = db_get("default-csp",0);
630 if( zFormat==0 || zFormat[0]==0 ){
631 zFormat = zBackupCSP;
632 }
633 blob_init(&csp, 0, 0);
634 while( zFormat[0] && (zNonce = (char*)strstr(zFormat,"$nonce"))!=0 ){
635 blob_append(&csp, zFormat, (int)(zNonce - zFormat));
636 blob_append(&csp, style_nonce(), -1);
637 zFormat = zNonce + 6;
638 }
639 blob_append(&csp, zFormat, -1);
640

Keyboard Shortcuts

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