Opened 13 years ago

Closed 12 years ago

#663 closed patch (fixed)

shp2pgsql uses the wrong return type for pgis_getopt

Reported by: ssinger Owned by: pramsey
Priority: medium Milestone: PostGIS 1.5.4
Component: utils/loader-dumper Version: 1.5.X
Keywords: Cc:

Description

pgis_getopt is defined to return an int (like a normal getopt).

However in shp2pgsql-cli and -gui the value is being stored as a char.

The compiler then promotes this char back to an int to compare with EOF. The promotion of a char to an int with respect to negative numbers differs based on hardware platform. On powerpc the ((char)-1) != -1

If we store the result of pgis_getopt as an int we avoid this issue.

Patch attached.

Attachments (1)

getopt_return.diff (624 bytes ) - added by ssinger 13 years ago.
patch to fix the bug

Download all attachments as: .zip

Change History (6)

by ssinger, 13 years ago

Attachment: getopt_return.diff added

patch to fix the bug

comment:1 by jadams, 13 years ago

Fixed on trunk in revision 6935. Not fixed on 1.5 yet.

comment:2 by strk, 13 years ago

Component: postgisloader/dumper

comment:3 by robe, 13 years ago

Milestone: PostGIS 1.5.3PostGIS 2.0.0

comment:4 by pramsey, 12 years ago

Milestone: PostGIS 2.0.0PostGIS 1.5.4

comment:5 by pramsey, 12 years ago

Resolution: fixed
Status: newclosed

r9206 in 1.5 branch

Note: See TracTickets for help on using tickets.