Opened 14 years ago

Closed 14 years ago

#3318 closed defect (fixed)

Ingres : missing parenthesis in logical test ?

Reported by: Even Rouault Owned by: warmerdam
Priority: normal Milestone: 1.7.0
Component: OGR_SF Version: unspecified
Severity: normal Keywords: ingres
Cc:

Description

In ogringrestablelayer.cpp, line 547, there's the following code :

        if( EQUAL(osIngresGeomType,"LSEG") 
            || EQUAL(osIngresGeomType,"ILSEG") 
            && poLS->getNumPoints() != 2 )

gcc emits the following warning :

ogringrestablelayer.cpp: In member function ‘OGRErr OGRIngresTableLayer::PrepareOldStyleGeometry(OGRGeometry*, CPLString&)’:
ogringrestablelayer.cpp:549: warning : suggest parentheses around ‘&&’ within ‘||’

But instead, I would think that the parenthesis should be put like this :

        if( (EQUAL(osIngresGeomType,"LSEG") 
            || EQUAL(osIngresGeomType,"ILSEG")) 
            && poLS->getNumPoints() != 2 )
So the current test would be wrong as && has a greater precedence than

Change History (1)

comment:1 by warmerdam, 14 years ago

Milestone: 1.7.0
Resolution: fixed
Status: newclosed

I agree, fixed in trunk (r18519).

The fix could be backported, but I do not anticipate it being particularly important to do so.

Note: See TracTickets for help on using tickets.