Fossil SCM

Be strict about compiler warnings for Windows builds.

drh 2022-01-27 11:20 trunk merge
Commit 57f16ce8e550f3eac0a22d6c83f24d92885e99cc97229a9550f95984831628fe
+1 -1
--- src/alerts.c
+++ src/alerts.c
@@ -2325,11 +2325,11 @@
23252325
sqlite3_int64 iMtime = db_column_int64(&q, 6);
23262326
double rAge = (iNow - iMtime)/86400.0;
23272327
int uid = db_column_int(&q, 8);
23282328
const char *zUname = db_column_text(&q, 3);
23292329
sqlite3_int64 iContact = db_column_int64(&q, 9);
2330
- double rContact = (iNow/86400) - iContact;
2330
+ double rContact = (iNow/86400.0) - iContact;
23312331
@ <tr>
23322332
@ <td><a href='%R/alerts?sid=%d(db_column_int(&q,0))'>\
23332333
@ %h(db_column_text(&q,1))</a></td>
23342334
@ <td>%h(db_column_text(&q,2))</td>
23352335
@ <td>%s(db_column_int(&q,5)?"digest":"")</td>
23362336
--- src/alerts.c
+++ src/alerts.c
@@ -2325,11 +2325,11 @@
2325 sqlite3_int64 iMtime = db_column_int64(&q, 6);
2326 double rAge = (iNow - iMtime)/86400.0;
2327 int uid = db_column_int(&q, 8);
2328 const char *zUname = db_column_text(&q, 3);
2329 sqlite3_int64 iContact = db_column_int64(&q, 9);
2330 double rContact = (iNow/86400) - iContact;
2331 @ <tr>
2332 @ <td><a href='%R/alerts?sid=%d(db_column_int(&q,0))'>\
2333 @ %h(db_column_text(&q,1))</a></td>
2334 @ <td>%h(db_column_text(&q,2))</td>
2335 @ <td>%s(db_column_int(&q,5)?"digest":"")</td>
2336
--- src/alerts.c
+++ src/alerts.c
@@ -2325,11 +2325,11 @@
2325 sqlite3_int64 iMtime = db_column_int64(&q, 6);
2326 double rAge = (iNow - iMtime)/86400.0;
2327 int uid = db_column_int(&q, 8);
2328 const char *zUname = db_column_text(&q, 3);
2329 sqlite3_int64 iContact = db_column_int64(&q, 9);
2330 double rContact = (iNow/86400.0) - iContact;
2331 @ <tr>
2332 @ <td><a href='%R/alerts?sid=%d(db_column_int(&q,0))'>\
2333 @ %h(db_column_text(&q,1))</a></td>
2334 @ <td>%h(db_column_text(&q,2))</td>
2335 @ <td>%s(db_column_int(&q,5)?"digest":"")</td>
2336
+2 -1
--- src/diff.c
+++ src/diff.c
@@ -3355,11 +3355,12 @@
33553355
if( strcmp(zLimit,"none")==0 ){
33563356
iLimit = 0;
33573357
mxTime = 0;
33583358
}else if( sqlite3_strglob("*[0-9]s", zLimit)==0 ){
33593359
iLimit = 0;
3360
- mxTime = current_time_in_milliseconds() + 1000.0*atof(zLimit);
3360
+ mxTime =
3361
+ (sqlite3_int64)(current_time_in_milliseconds() + 1000.0*atof(zLimit));
33613362
}else{
33623363
iLimit = atoi(zLimit);
33633364
if( iLimit<=0 ) iLimit = 30;
33643365
mxTime = 0;
33653366
}
33663367
--- src/diff.c
+++ src/diff.c
@@ -3355,11 +3355,12 @@
3355 if( strcmp(zLimit,"none")==0 ){
3356 iLimit = 0;
3357 mxTime = 0;
3358 }else if( sqlite3_strglob("*[0-9]s", zLimit)==0 ){
3359 iLimit = 0;
3360 mxTime = current_time_in_milliseconds() + 1000.0*atof(zLimit);
 
3361 }else{
3362 iLimit = atoi(zLimit);
3363 if( iLimit<=0 ) iLimit = 30;
3364 mxTime = 0;
3365 }
3366
--- src/diff.c
+++ src/diff.c
@@ -3355,11 +3355,12 @@
3355 if( strcmp(zLimit,"none")==0 ){
3356 iLimit = 0;
3357 mxTime = 0;
3358 }else if( sqlite3_strglob("*[0-9]s", zLimit)==0 ){
3359 iLimit = 0;
3360 mxTime =
3361 (sqlite3_int64)(current_time_in_milliseconds() + 1000.0*atof(zLimit));
3362 }else{
3363 iLimit = atoi(zLimit);
3364 if( iLimit<=0 ) iLimit = 30;
3365 mxTime = 0;
3366 }
3367
+3 -1
--- src/repolist.c
+++ src/repolist.c
@@ -205,11 +205,13 @@
205205
if( x.isRepolistSkin==2 && !allRepo ){
206206
/* Repositories with repolist-skin==2 are omitted from directory
207207
** scan lists, but included in "fossil all ui" lists */
208208
continue;
209209
}
210
- iAge = (rNow - x.rMTime)*86400;
210
+ /* Assert that the following cast will not narrow in fact. */
211
+ assert((rNow - x.rMTime)<=(((unsigned)~0)>>1)/86400.0);
212
+ iAge = (int)((rNow - x.rMTime)*86400);
211213
if( iAge<0 ) x.rMTime = rNow;
212214
zAge = human_readable_age(rNow - x.rMTime);
213215
blob_append_sql(&html, "<tr><td valign='top'>");
214216
if( sqlite3_strglob("*.fossil", zName)!=0 ){
215217
/* The "fossil server DIRECTORY" and "fossil ui DIRECTORY" commands
216218
--- src/repolist.c
+++ src/repolist.c
@@ -205,11 +205,13 @@
205 if( x.isRepolistSkin==2 && !allRepo ){
206 /* Repositories with repolist-skin==2 are omitted from directory
207 ** scan lists, but included in "fossil all ui" lists */
208 continue;
209 }
210 iAge = (rNow - x.rMTime)*86400;
 
 
211 if( iAge<0 ) x.rMTime = rNow;
212 zAge = human_readable_age(rNow - x.rMTime);
213 blob_append_sql(&html, "<tr><td valign='top'>");
214 if( sqlite3_strglob("*.fossil", zName)!=0 ){
215 /* The "fossil server DIRECTORY" and "fossil ui DIRECTORY" commands
216
--- src/repolist.c
+++ src/repolist.c
@@ -205,11 +205,13 @@
205 if( x.isRepolistSkin==2 && !allRepo ){
206 /* Repositories with repolist-skin==2 are omitted from directory
207 ** scan lists, but included in "fossil all ui" lists */
208 continue;
209 }
210 /* Assert that the following cast will not narrow in fact. */
211 assert((rNow - x.rMTime)<=(((unsigned)~0)>>1)/86400.0);
212 iAge = (int)((rNow - x.rMTime)*86400);
213 if( iAge<0 ) x.rMTime = rNow;
214 zAge = human_readable_age(rNow - x.rMTime);
215 blob_append_sql(&html, "<tr><td valign='top'>");
216 if( sqlite3_strglob("*.fossil", zName)!=0 ){
217 /* The "fossil server DIRECTORY" and "fossil ui DIRECTORY" commands
218
+7 -4
--- src/stat.c
+++ src/stat.c
@@ -999,14 +999,17 @@
999999
r = 0;
10001000
n = 0;
10011001
while( db_step(&q)==SQLITE_ROW ){
10021002
r += db_column_int(&q, 0);
10031003
if( n50pct==0 && r>=sumCmpr/2 ) n50pct = n;
1004
- if( n==(nTotal+99)/100 ) sz1pct = r;
1005
- if( n==(nTotal+9)/10 ) sz10pct = r;
1006
- if( n==(nTotal+4)/5 ) sz25pct = r;
1007
- if( n==(nTotal+1)/2 ){ sz50pct = r; medCmpr = db_column_int(&q,0); }
1004
+ if( n==(nTotal+99)/100 ) sz1pct = (sqlite3_int64)r;
1005
+ if( n==(nTotal+9)/10 ) sz10pct = (sqlite3_int64)r;
1006
+ if( n==(nTotal+4)/5 ) sz25pct = (sqlite3_int64)r;
1007
+ if( n==(nTotal+1)/2 ){
1008
+ sz50pct = (sqlite3_int64)r;
1009
+ medCmpr = db_column_int(&q,0);
1010
+ }
10081011
n++;
10091012
}
10101013
db_finalize(&q);
10111014
10121015
@ <h1>Overall Artifact Size Statistics:</h1>
10131016
--- src/stat.c
+++ src/stat.c
@@ -999,14 +999,17 @@
999 r = 0;
1000 n = 0;
1001 while( db_step(&q)==SQLITE_ROW ){
1002 r += db_column_int(&q, 0);
1003 if( n50pct==0 && r>=sumCmpr/2 ) n50pct = n;
1004 if( n==(nTotal+99)/100 ) sz1pct = r;
1005 if( n==(nTotal+9)/10 ) sz10pct = r;
1006 if( n==(nTotal+4)/5 ) sz25pct = r;
1007 if( n==(nTotal+1)/2 ){ sz50pct = r; medCmpr = db_column_int(&q,0); }
 
 
 
1008 n++;
1009 }
1010 db_finalize(&q);
1011
1012 @ <h1>Overall Artifact Size Statistics:</h1>
1013
--- src/stat.c
+++ src/stat.c
@@ -999,14 +999,17 @@
999 r = 0;
1000 n = 0;
1001 while( db_step(&q)==SQLITE_ROW ){
1002 r += db_column_int(&q, 0);
1003 if( n50pct==0 && r>=sumCmpr/2 ) n50pct = n;
1004 if( n==(nTotal+99)/100 ) sz1pct = (sqlite3_int64)r;
1005 if( n==(nTotal+9)/10 ) sz10pct = (sqlite3_int64)r;
1006 if( n==(nTotal+4)/5 ) sz25pct = (sqlite3_int64)r;
1007 if( n==(nTotal+1)/2 ){
1008 sz50pct = (sqlite3_int64)r;
1009 medCmpr = db_column_int(&q,0);
1010 }
1011 n++;
1012 }
1013 db_finalize(&q);
1014
1015 @ <h1>Overall Artifact Size Statistics:</h1>
1016
+1 -1
--- src/tar.c
+++ src/tar.c
@@ -496,11 +496,11 @@
496496
nPrefix = blob_size(&filename);
497497
498498
pManifest = manifest_get(rid, CFTYPE_MANIFEST, 0);
499499
if( pManifest ){
500500
int flg, eflg = 0;
501
- mTime = (pManifest->rDate - 2440587.5)*86400.0;
501
+ mTime = (unsigned)((pManifest->rDate - 2440587.5)*86400.0);
502502
if( pTar ) tar_begin(mTime);
503503
flg = db_get_manifest_setting();
504504
if( flg ){
505505
/* eflg is the effective flags, taking include/exclude into account */
506506
if( (pInclude==0 || glob_match(pInclude, "manifest"))
507507
--- src/tar.c
+++ src/tar.c
@@ -496,11 +496,11 @@
496 nPrefix = blob_size(&filename);
497
498 pManifest = manifest_get(rid, CFTYPE_MANIFEST, 0);
499 if( pManifest ){
500 int flg, eflg = 0;
501 mTime = (pManifest->rDate - 2440587.5)*86400.0;
502 if( pTar ) tar_begin(mTime);
503 flg = db_get_manifest_setting();
504 if( flg ){
505 /* eflg is the effective flags, taking include/exclude into account */
506 if( (pInclude==0 || glob_match(pInclude, "manifest"))
507
--- src/tar.c
+++ src/tar.c
@@ -496,11 +496,11 @@
496 nPrefix = blob_size(&filename);
497
498 pManifest = manifest_get(rid, CFTYPE_MANIFEST, 0);
499 if( pManifest ){
500 int flg, eflg = 0;
501 mTime = (unsigned)((pManifest->rDate - 2440587.5)*86400.0);
502 if( pTar ) tar_begin(mTime);
503 flg = db_get_manifest_setting();
504 if( flg ){
505 /* eflg is the effective flags, taking include/exclude into account */
506 if( (pInclude==0 || glob_match(pInclude, "manifest"))
507
+1 -1
--- src/zip.c
+++ src/zip.c
@@ -236,11 +236,11 @@
236236
*/
237237
void zip_set_timedate(double rDate){
238238
char *zDate = db_text(0, "SELECT datetime(%.17g)", rDate);
239239
zip_set_timedate_from_str(zDate);
240240
fossil_free(zDate);
241
- unixTime = (rDate - 2440587.5)*86400.0;
241
+ unixTime = (int)((rDate - 2440587.5)*86400.0);
242242
}
243243
244244
/*
245245
** Append a single file to a growing ZIP archive.
246246
**
247247
--- src/zip.c
+++ src/zip.c
@@ -236,11 +236,11 @@
236 */
237 void zip_set_timedate(double rDate){
238 char *zDate = db_text(0, "SELECT datetime(%.17g)", rDate);
239 zip_set_timedate_from_str(zDate);
240 fossil_free(zDate);
241 unixTime = (rDate - 2440587.5)*86400.0;
242 }
243
244 /*
245 ** Append a single file to a growing ZIP archive.
246 **
247
--- src/zip.c
+++ src/zip.c
@@ -236,11 +236,11 @@
236 */
237 void zip_set_timedate(double rDate){
238 char *zDate = db_text(0, "SELECT datetime(%.17g)", rDate);
239 zip_set_timedate_from_str(zDate);
240 fossil_free(zDate);
241 unixTime = (int)((rDate - 2440587.5)*86400.0);
242 }
243
244 /*
245 ** Append a single file to a growing ZIP archive.
246 **
247
--- tools/makemake.tcl
+++ tools/makemake.tcl
@@ -1628,11 +1628,11 @@
16281628
16291629
!if $(FOSSIL_ENABLE_TCL)!=0
16301630
INCL = $(INCL) /I"$(TCLINCDIR)"
16311631
!endif
16321632
1633
-CFLAGS = /nologo
1633
+CFLAGS = /nologo /W2 /WX
16341634
LDFLAGS =
16351635
16361636
CFLAGS = $(CFLAGS) /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS
16371637
CFLAGS = $(CFLAGS) /D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_NONSTDC_NO_WARNINGS
16381638
16391639
--- tools/makemake.tcl
+++ tools/makemake.tcl
@@ -1628,11 +1628,11 @@
1628
1629 !if $(FOSSIL_ENABLE_TCL)!=0
1630 INCL = $(INCL) /I"$(TCLINCDIR)"
1631 !endif
1632
1633 CFLAGS = /nologo
1634 LDFLAGS =
1635
1636 CFLAGS = $(CFLAGS) /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS
1637 CFLAGS = $(CFLAGS) /D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_NONSTDC_NO_WARNINGS
1638
1639
--- tools/makemake.tcl
+++ tools/makemake.tcl
@@ -1628,11 +1628,11 @@
1628
1629 !if $(FOSSIL_ENABLE_TCL)!=0
1630 INCL = $(INCL) /I"$(TCLINCDIR)"
1631 !endif
1632
1633 CFLAGS = /nologo /W2 /WX
1634 LDFLAGS =
1635
1636 CFLAGS = $(CFLAGS) /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS
1637 CFLAGS = $(CFLAGS) /D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_NONSTDC_NO_WARNINGS
1638
1639
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -173,11 +173,11 @@
173173
174174
!if $(FOSSIL_ENABLE_TCL)!=0
175175
INCL = $(INCL) /I"$(TCLINCDIR)"
176176
!endif
177177
178
-CFLAGS = /nologo
178
+CFLAGS = /nologo /W2 /WX
179179
LDFLAGS =
180180
181181
CFLAGS = $(CFLAGS) /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS
182182
CFLAGS = $(CFLAGS) /D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_NONSTDC_NO_WARNINGS
183183
184184
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -173,11 +173,11 @@
173
174 !if $(FOSSIL_ENABLE_TCL)!=0
175 INCL = $(INCL) /I"$(TCLINCDIR)"
176 !endif
177
178 CFLAGS = /nologo
179 LDFLAGS =
180
181 CFLAGS = $(CFLAGS) /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS
182 CFLAGS = $(CFLAGS) /D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_NONSTDC_NO_WARNINGS
183
184
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -173,11 +173,11 @@
173
174 !if $(FOSSIL_ENABLE_TCL)!=0
175 INCL = $(INCL) /I"$(TCLINCDIR)"
176 !endif
177
178 CFLAGS = /nologo /W2 /WX
179 LDFLAGS =
180
181 CFLAGS = $(CFLAGS) /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS
182 CFLAGS = $(CFLAGS) /D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_NONSTDC_NO_WARNINGS
183
184

Keyboard Shortcuts

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