Opened 12 years ago

Closed 12 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 Changed 12 years ago by Mateusz Łoskot

Cc: Mateusz Łoskot added

comment:2 Changed 12 years ago by Mateusz Łoskot

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 Changed 12 years ago by rayg

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

comment:4 Changed 12 years ago by Mateusz Łoskot

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 Changed 12 years ago by rayg

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 Changed 12 years ago by Mateusz Łoskot

No problem, thanks!

comment:7 Changed 12 years ago by Even Rouault

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