Opened 16 years ago

Closed 16 years ago

#2119 closed defect (fixed)

terragen: overflow in implicit constant conversion

Reported by: Even Rouault Owned by: rayg
Priority: normal Milestone: 1.5.1
Component: default Version: 1.4.4
Severity: normal Keywords: terragen
Cc: warmerdam, Mateusz Łoskot

Description

When compiling GDAL (1.5, and 1.4.X probably), the following warning is emitted :

terragendataset.cpp: In constructor 'TerragenDataset::TerragenDataset()':
terragendataset.cpp:463: warning: overflow in implicit constant conversion

Declaration : GInt16 m_nHeightScale;

Initialization: m_nHeightScale = 65536;

Hence the warning.

Change History (7)

comment:1 by Mateusz Łoskot, 16 years ago

Cc: Mateusz Łoskot added

comment:2 by Mateusz Łoskot, 16 years ago

It should be safe to change the type from 16-bit to 32-bit integer. Or to change from signed 16-bit integer to unsigned that ranges from 0 to 65535 assuming value 65536 is wrong :-)

comment:3 by rayg, 16 years ago

heightscale init'd to zero. Type must be Gint16; is data file field.

comment:4 by Mateusz Łoskot, 16 years ago

rayg,

Is the r13440 changeset related to this bug? Please, may I ask for providing commit message that includes, at least, ticket number that submission refers too? Thanks!

comment:5 by rayg, 16 years ago

Yeah, sorry about that... I realized I'd forgotten to comment just after I checked the file in. I'm used to scc systems that prompt for comments.

comment:6 by Mateusz Łoskot, 16 years ago

No problem, thanks!

comment:7 by Even Rouault, 16 years ago

Milestone: 1.5.1
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.