Opened 10 years ago

Closed 10 years ago

#3090 closed patch (fixed)

A confusing line in Raster/rt_pg/rt_pg.c

Reported by: kain Owned by: Bborie Park
Priority: low Milestone: PostGIS 2.1.7
Component: raster Version: 2.1.x
Keywords: Cc:

Description

In function RASTER_setPixelValuesArray() of aster/rt_pg/rt_pg.c:

 3538 -   else if (!PG_ARGISNULL(6) & PG_GETARG_BOOL(6)) {
 3538 +   else if (!PG_ARGISNULL(6) && PG_GETARG_BOOL(6)) {

I'm confused, because BOOL & BOOL == BOOL && BOOL seems correct, but it's only logical, we will never know what happens in C language, right?

Change History (4)

comment:1 by kain, 10 years ago

And & will force PG_GETARG_BOOL(6) be invoked no matter @6 is NULL or not, it is incorrect from logical side.

in reply to:  1 comment:2 by kain, 10 years ago

Replying to kain:

And & will force PG_GETARG_BOOL(6) be invoked no matter @6 is NULL or not, it is incorrect from logical side.

Another example, if ( NOTNULL(p) && SUCCESS_FREE(p) ) , if we use & instead of &&, the app will crash, so & and && are not equal even both left/right are BOOL.

comment:3 by Bborie Park, 10 years ago

Status: newassigned

comment:4 by Bborie Park, 10 years ago

Resolution: fixed
Status: assignedclosed

Fixed in branch 2.1 as of r13394. Fixed in master as of r13395

Note: See TracTickets for help on using tickets.