Opened 15 years ago

Closed 13 years ago

#2930 closed defect (fixed)

Cleanup Win32 Compile Warnings

Reported by: warmerdam Owned by: chaitanya
Priority: normal Milestone:
Component: GDAL_Raster Version: svn-trunk
Severity: normal Keywords: warning cleanup
Cc: Daniel Morissette, aboudreault

Description

The following compile warnings were pulled off the win32 buildbot and appear to be in code under the direct control of the GDAL project. Please attempt to cleanup the warnings in an appropriate fashion.

cpl_minixml.cpp(1814) : warning C4244: 'argument' : conversion from 'vsi_l_offset' to 'size_t', possible loss of data
cpl_vsi_mem.cpp(301) : warning C4244: '=' : conversion from 'vsi_l_offset' to 'size_t', possible loss of data
cpl_vsi_mem.cpp(483) : warning C4244: '=' : conversion from 'vsi_l_offset' to '_off_t', possible loss of data
cpl_vsil_gzip.cpp(1063) : warning C4244: '=' : conversion from 'GUIntBig' to '_off_t', possible loss of data
cpl_vsil_gzip.cpp(1080) : warning C4244: '=' : conversion from 'GUIntBig' to '_off_t', possible loss of data
cpl_vsil_gzip.cpp(1600) : warning C4244: '=' : conversion from 'const vsi_l_offset' to '_off_t', possible loss of data
cpl_vsil_gzip.cpp(1619) : warning C4244: '=' : conversion from 'vsi_l_offset' to '_off_t', possible loss of data
cpl_vsil_subfile.cpp(279) : warning C4244: '=' : conversion from 'vsi_l_offset' to 'int', possible loss of data
cpl_vsil_subfile.cpp(308) : warning C4244: '=' : conversion from 'vsi_l_offset' to '_off_t', possible loss of data
cpl_vsil_subfile.cpp(310) : warning C4244: '-=' : conversion from 'vsi_l_offset' to '_off_t', possible loss of data
ddfmodule.cpp(337) : warning C4244: '=' : conversion from 'vsi_l_offset' to 'long', possible loss of data
dgnread.cpp(969) : warning C4307: '-' : integral constant overflow
gdaldataset.cpp(76) : warning C4244: 'return' : conversion from 'GIntBig' to 'unsigned long', possible loss of data
gdal_misc.cpp(1461) : warning C4244: '=' : conversion from 'vsi_l_offset' to 'int', possible loss of data
overview.cpp(358) : warning C4244: '=' : conversion from 'int' to 'float', possible loss of data
overview.cpp(452) : warning C4244: '=' : conversion from 'int' to 'float', possible loss of data
overview.cpp(547) : warning C4244: '=' : conversion from 'int' to 'float', possible loss of data
gdaljp2metadata.cpp(223) : warning C4244: '=' : conversion from 'GIntBig' to 'int', possible loss of data
gdaljp2metadata.cpp(233) : warning C4244: '=' : conversion from 'GIntBig' to 'int', possible loss of data
gdaljp2box.cpp(208) : warning C4244: 'argument' : conversion from 'GIntBig' to 'size_t', possible loss of data
gdaljp2box.cpp(210) : warning C4244: 'argument' : conversion from 'GIntBig' to 'size_t', possible loss of data
gdaljp2box.cpp(339) : warning C4244: '+=' : conversion from 'GIntBig' to 'int', possible loss of data
gdaljp2box.cpp(360) : warning C4244: 'argument' : conversion from 'GIntBig' to 'size_t', possible loss of data
gdalproxypool.cpp(175) : warning C4390: ';' : empty controlled statement found; is this the intent?
gdalproxypool.cpp(177) : warning C4390: ';' : empty controlled statement found; is this the intent?
gdalproxypool.cpp(180) : warning C4390: ';' : empty controlled statement found; is this the intent?
gdalwarper.cpp(594) : warning C4244: '=' : conversion from 'int' to 'float', possible loss of data
gdalcutline.cpp(177) : warning C4244: '*=' : conversion from 'double' to 'float', possible loss of data
gdalproximity.cpp(173) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
gdalproximity.cpp(178) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
gdalproximity.cpp(361) : warning C4244: '*=' : conversion from 'double' to 'float', possible loss of data
gdalproximity.cpp(459) : warning C4244: 'initializing' : conversion from 'double' to 'float', possible loss of data
gdalproximity.cpp(466) : warning C4244: '=' : conversion from 'int' to 'float', possible loss of data
gdalproximity.cpp(489) : warning C4244: '=' : conversion from 'int' to 'float', possible loss of data
gdalproximity.cpp(509) : warning C4244: '=' : conversion from 'int' to 'float', possible loss of data
rasterfill.cpp(123) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
rasterfill.cpp(745) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
hfaband.cpp(924) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
hfaband.cpp(1148) : warning C4244: 'argument' : conversion from 'vsi_l_offset' to 'int', possible loss of data
gt_overview.cpp(593) : warning C4244: '=' : conversion from 'toff_t' to 'uint32', possible loss of data
ehdrdataset.cpp(205) : warning C4244: '=' : conversion from 'vsi_l_offset' to 'int', possible loss of data
ehdrdataset.cpp(270) : warning C4244: '=' : conversion from 'vsi_l_offset' to 'int', possible loss of data
ehdrdataset.cpp(1234) : warning C4244: 'argument' : conversion from 'vsi_l_offset' to 'int', possible loss of data
cpgdataset.cpp(1295) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
cpgdataset.cpp(1319) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
cpgdataset.cpp(1320) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
cpgdataset.cpp(1327) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
cpgdataset.cpp(1328) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
cpgdataset.cpp(1335) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
cpgdataset.cpp(1336) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
cpgdataset.cpp(1343) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
cpgdataset.cpp(1344) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
genbindataset.cpp(277) : warning C4244: '=' : conversion from 'vsi_l_offset' to 'int', possible loss of data
genbindataset.cpp(279) : warning C4244: '=' : conversion from 'vsi_l_offset' to 'unsigned int', possible loss of data
eirdataset.cpp(503) : warning C4244: 'argument' : conversion from 'vsi_l_offset' to 'int', possible loss of data
sar_ceosdataset.cpp(419) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
sar_ceosdataset.cpp(443) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
sar_ceosdataset.cpp(444) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
sar_ceosdataset.cpp(451) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
sar_ceosdataset.cpp(452) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
sar_ceosdataset.cpp(459) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
sar_ceosdataset.cpp(460) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
sar_ceosdataset.cpp(467) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
sar_ceosdataset.cpp(468) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
sar_ceosdataset.cpp(603) : warning C4244: 'argument' : conversion from 'double' to 'float', possible loss of data
sar_ceosdataset.cpp(614) : warning C4244: 'argument' : conversion from 'double' to 'float', possible loss of data
sar_ceosdataset.cpp(626) : warning C4244: 'argument' : conversion from 'double' to 'float', possible loss of data
sar_ceosdataset.cpp(632) : warning C4244: 'argument' : conversion from 'double' to 'float', possible loss of data
dted_api.c(177) : warning C4244: '=' : conversion from 'vsi_l_offset' to 'int', possible loss of data
dted_api.c(181) : warning C4244: '=' : conversion from 'vsi_l_offset' to 'int', possible loss of data
dted_api.c(185) : warning C4244: '=' : conversion from 'vsi_l_offset' to 'int', possible loss of data
dted_api.c(204) : warning C4244: '=' : conversion from 'vsi_l_offset' to 'int', possible loss of data
dted_api.c(432) : warning C4018: '>' : signed/unsigned mismatch
dted_api.c(703) : warning C4018: '<' : signed/unsigned mismatch
vrtdataset.cpp(637) : warning C4244: '=' : conversion from 'vsi_l_offset' to 'unsigned int', possible loss of data
vrtfilters.cpp(458) : warning C4244: 'initializing' : conversion from 'double' to 'float', possible loss of data
rmfdataset.cpp(421) : warning C4244: '=' : conversion from 'vsi_l_offset' to 'GUInt32', possible loss of data
nitffile.c(383) : warning C4244: '=' : conversion from 'vsi_l_offset' to 'int', possible loss of data
nitffile.c(1002) : warning C4018: '<' : signed/unsigned mismatch
nitffile.c(1011) : warning C4018: '<' : signed/unsigned mismatch
nitffile.c(1359) : warning C4018: '<' : signed/unsigned mismatch
nitfimage.c(215) : warning C4018: '<' : signed/unsigned mismatch
nitfimage.c(238) : warning C4018: '<' : signed/unsigned mismatch
nitfimage.c(259) : warning C4018: '<' : signed/unsigned mismatch
nitfimage.c(341) : warning C4018: '<' : signed/unsigned mismatch
nitfimage.c(345) : warning C4018: '<' : signed/unsigned mismatch
nitfimage.c(357) : warning C4018: '<' : signed/unsigned mismatch
nitfimage.c(365) : warning C4018: '<' : signed/unsigned mismatch
nitfimage.c(373) : warning C4018: '<' : signed/unsigned mismatch
nitfimage.c(381) : warning C4018: '<' : signed/unsigned mismatch
nitfimage.c(415) : warning C4018: '<' : signed/unsigned mismatch
nitfimage.c(450) : warning C4018: '<' : signed/unsigned mismatch
nitfimage.c(459) : warning C4018: '<' : signed/unsigned mismatch
nitfimage.c(466) : warning C4018: '<' : signed/unsigned mismatch
nitfimage.c(487) : warning C4018: '>' : signed/unsigned mismatch
nitfimage.c(575) : warning C4018: '<=' : signed/unsigned mismatch
nitfimage.c(587) : warning C4018: '<' : signed/unsigned mismatch
nitfimage.c(606) : warning C4018: '<' : signed/unsigned mismatch
nitfimage.c(613) : warning C4018: '<' : signed/unsigned mismatch
nitfimage.c(646) : warning C4244: '=' : conversion from 'GIntBig' to 'int', possible loss of data
nitfimage.c(655) : warning C4244: '=' : conversion from 'GIntBig' to 'int', possible loss of data
nitfimage.c(663) : warning C4244: '=' : conversion from 'GIntBig' to 'int', possible loss of data
nitfimage.c(671) : warning C4244: '=' : conversion from 'GIntBig' to 'int', possible loss of data
nitfimage.c(679) : warning C4244: '=' : conversion from 'GIntBig' to 'int', possible loss of data
nitfimage.c(2669) : warning C4018: '<' : signed/unsigned mismatch
pcidskdataset.cpp(1057) : warning C4244: 'initializing' : conversion from 'vsi_l_offset' to 'int', possible loss of data
pcidsktiledrasterband.cpp(115) : warning C4244: '=' : conversion from 'vsi_l_offset' to 'int', possible loss of data
pcidsktiledrasterband.cpp(284) : warning C4244: '=' : conversion from 'vsi_l_offset' to 'int', possible loss of data
airsardataset.cpp(198) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
airsardataset.cpp(209) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
airsardataset.cpp(212) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
airsardataset.cpp(222) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
airsardataset.cpp(225) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
airsardataset.cpp(234) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
airsardataset.cpp(245) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
airsardataset.cpp(248) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
airsardataset.cpp(257) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
rs2dataset.cpp(321) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
rs2dataset.cpp(331) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
rikdataset.cpp(519) : warning C4101: 'errStr' : unreferenced local variable
levellerdataset.cpp(492) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
IdrisiDataset.cpp(1426) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
IdrisiDataset.cpp(1429) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
IdrisiDataset.cpp(1433) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
terragendataset.cpp(410) : warning C4244: '*=' : conversion from 'double' to 'float', possible loss of data
terragendataset.cpp(411) : warning C4244: '/=' : conversion from 'double' to 'float', possible loss of data
terragendataset.cpp(899) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
gsagdataset.cpp(339) : warning C4244: '=' : conversion from 'vsi_l_offset' to 'size_t', possible loss of data
gsagdataset.cpp(630) : warning C4244: 'initializing' : conversion from 'vsi_l_offset' to 'int', possible loss of data
gsagdataset.cpp(1312) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
gsagdataset.cpp(1443) : warning C4244: 'initializing' : conversion from 'vsi_l_offset' to 'int', possible loss of data
gsbgdataset.cpp(1029) : warning C4244: 'initializing' : conversion from 'double' to 'float', possible loss of data
gs7bgdataset.cpp(495) : warning C4244: '=' : conversion from 'vsi_l_offset' to 'size_t', possible loss of data
pdsdataset.cpp(448) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
pdsdataset.cpp(452) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
pdsdataset.cpp(456) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
pdsdataset.cpp(460) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
isis2dataset.cpp(377) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
isis2dataset.cpp(381) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
isis2dataset.cpp(385) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
isis2dataset.cpp(389) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
isis3dataset.cpp(518) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
isis3dataset.cpp(522) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
isis3dataset.cpp(526) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
isis3dataset.cpp(530) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
adrgdataset.cpp(369) : warning C4244: 'initializing' : conversion from 'vsi_l_offset' to 'int', possible loss of data
adrgdataset.cpp(377) : warning C4244: 'initializing' : conversion from 'vsi_l_offset' to 'int', possible loss of data
adrgdataset.cpp(423) : warning C4244: 'initializing' : conversion from 'vsi_l_offset' to 'int', possible loss of data
adrgdataset.cpp(431) : warning C4244: 'initializing' : conversion from 'vsi_l_offset' to 'int', possible loss of data
adrgdataset.cpp(574) : warning C4244: 'initializing' : conversion from 'vsi_l_offset' to 'int', possible loss of data
blx.c(176) : warning C4018: '>=' : signed/unsigned mismatch
blx.c(224) : warning C4018: '<' : signed/unsigned mismatch
blx.c(228) : warning C4018: '<' : signed/unsigned mismatch
blx.c(233) : warning C4018: '<' : signed/unsigned mismatch
blx.c(236) : warning C4018: '<' : signed/unsigned mismatch
blx.c(237) : warning C4018: '<' : signed/unsigned mismatch
blx.c(258) : warning C4018: '<' : signed/unsigned mismatch
blx.c(262) : warning C4018: '<' : signed/unsigned mismatch
blx.c(267) : warning C4018: '<' : signed/unsigned mismatch
blx.c(270) : warning C4018: '<' : signed/unsigned mismatch
blx.c(271) : warning C4018: '<' : signed/unsigned mismatch
blx.c(286) : warning C4018: '<' : signed/unsigned mismatch
blx.c(287) : warning C4018: '<' : signed/unsigned mismatch
blx.c(296) : warning C4018: '<' : signed/unsigned mismatch
blx.c(301) : warning C4018: '<' : signed/unsigned mismatch
blx.c(302) : warning C4018: '<' : signed/unsigned mismatch
blx.c(306) : warning C4018: '<' : signed/unsigned mismatch
blx.c(317) : warning C4018: '<' : signed/unsigned mismatch
blx.c(318) : warning C4018: '<' : signed/unsigned mismatch
blx.c(325) : warning C4018: '<' : signed/unsigned mismatch
blx.c(330) : warning C4018: '<' : signed/unsigned mismatch
blx.c(331) : warning C4018: '<' : signed/unsigned mismatch
blx.c(335) : warning C4018: '<' : signed/unsigned mismatch
blx.c(702) : warning C4018: '<' : signed/unsigned mismatch
blx.c(742) : warning C4018: '<' : signed/unsigned mismatch
blx.c(789) : warning C4018: '<' : signed/unsigned mismatch
blx.c(844) : warning C4018: '<' : signed/unsigned mismatch
blx.c(1268) : warning C4018: '<' : signed/unsigned mismatch
jpgdataset.cpp(1903) : warning C4244: '=' : conversion from 'vsi_l_offset' to 'GUInt32', possible loss of data
bsb_read.c(465) : warning C4244: '=' : conversion from 'vsi_l_offset' to 'int', possible loss of data
bsb_read.c(483) : warning C4244: '=' : conversion from 'vsi_l_offset' to 'int', possible loss of data
bsb_read.c(831) : warning C4244: 'initializing' : conversion from 'vsi_l_offset' to 'int', possible loss of data
bsb_read.c(872) : warning C4244: '=' : conversion from 'vsi_l_offset' to 'int', possible loss of data

Attachments (3)

2930 nitf,dted,grib,rik.diff (30.7 KB ) - added by chaitanya 15 years ago.
GDAL_OGR_mitab.diff (39.6 KB ) - added by chaitanya 15 years ago.
Patch for mitab driver.
gdal-analyze-build-r17542.txt.bz2 (46.1 KB ) - added by Mateusz Łoskot 15 years ago.
Build log generated for trunk r17542 using Visual Studio Team System 2008 with static code analysis tools enabled.

Download all attachments as: .zip

Change History (16)

by chaitanya, 15 years ago

comment:1 by chaitanya, 15 years ago

Status: newassigned

Frank,

Can you give a glance at the attachment? I want to make sure that I am on the right track. I'll apply the patch and go ahead with the rest similarly, unless you suggest anything else.

comment:2 by warmerdam, 15 years ago

The approach generally looks ok though I haven't reviewed particularly closely.

comment:3 by chaitanya, 15 years ago

Fixed some VC++8.0 compiler warnings in nitf, dted, grib, rik drivers in r17398 in trunk.

comment:4 by Even Rouault, 15 years ago

r17401 : /trunk/gdal/frmts/nitf/ (nitfdataset.cpp nitfimage.c): Fix GCC warnings introduced by r17398

-> you should also check that fixing MSVC warnings doesn't cause newer GCC warnings. (My GCC version: 4.2.4). The warnings fixed by r17401 can only detected by GCC because the printf-like functions in CPL are declared with the CPL_PRINT_FUNC_FORMAT attribute, which is a GCC-only hint.

comment:5 by chaitanya, 15 years ago

Fixed some VC++8.0 compiler warnings in bsb, adrg, airsar, blx, aigrid, iso8211, ceos2 drivers and some code in CPL in r17405 in trunk.

Thanks to rouault for the correction r17401. I should have checked in with GCC too. I am going to from this time onwards.

Using GCC 4.3.2-1ubuntu12 on x86_64 I didn't find any change in the warnings.

comment:6 by chaitanya, 15 years ago

Fixed some more VC++8.0 compiler warnings in sdts driver and some ogr code in r17434 in trunk.

comment:7 by chaitanya, 15 years ago

Cc: Daniel Morissette added

Daniel,

I'm attaching the patch for mitab driver. This fixes most of the warnings given by VC8.0 compiler.

by chaitanya, 15 years ago

Attachment: GDAL_OGR_mitab.diff added

Patch for mitab driver.

comment:8 by Mateusz Łoskot, 15 years ago

I use Team System edition Visual Studio 2008 where static analysis tools are available. Here is build log generated for trunk (r17542) with some extra warnings that potentially may be relevant:

http://mateusz.loskot.net/tmp/gdal/gdal-analyze-build-r17542.txt

I'll try to attach it to the ticket as well.

by Mateusz Łoskot, 15 years ago

Build log generated for trunk r17542 using Visual Studio Team System 2008 with static code analysis tools enabled.

comment:9 by Mateusz Łoskot, 15 years ago

By the way of this clean-up, IMHO it would be a good idea to try to build GDAL using GCC with -Weffc++ option and see what it says.

comment:10 by chaitanya, 14 years ago

Reverted a change from r17398 in r19985 (#3674).

comment:11 by Daniel Morissette, 14 years ago

Cc: aboudreault added

Alan, can you please review the MITAB patch (comment:7) and apply it to MITAB?

comment:12 by aboudreault, 14 years ago

Committed in mitab CVS. Thanks chaitanya!

comment:13 by Even Rouault, 13 years ago

Milestone: 1.8.1
Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.