[postgis-devel] [PostGIS] #663: shp2pgsql uses the wrong return type for pgis_getopt

PostGIS trac at osgeo.org
Thu Nov 18 17:45:21 PST 2010


#663: shp2pgsql uses the wrong return type for pgis_getopt
---------------------+------------------------------------------------------
 Reporter:  ssinger  |       Owner:  pramsey      
     Type:  patch    |      Status:  new          
 Priority:  medium   |   Milestone:  PostGIS 1.5.3
Component:  postgis  |     Version:  1.5.X        
 Keywords:           |  
---------------------+------------------------------------------------------
 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.

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/663>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-devel mailing list