- Fixed return code of shp2pgsql
- Fixed handling of trailing dots in dbf numerical attributes
- Schema aware postgis_proc_upgrade.pl, support for pgsql 7.2.1
+ - Fixed back-compatibility issue in loader (load of null shapefiles)
PostGIS 1.0.4
2005/09/09
void
OpenShape(void)
{
- int j;
- SHPObject *obj=NULL;
-
hSHPHandle = SHPOpen( shp_file, "rb" );
if (hSHPHandle == NULL) {
fprintf(stderr, "%s: shape (.shp) or index files (.shx) can not be opened.\n", shp_file);
exit(-1);
}
SHPGetInfo(hSHPHandle, &num_entities, &shpfiletype, NULL, NULL);
-
- /* Check we have at least a not-null geometry */
- for (j=0; j<num_entities; j++)
- {
- obj = SHPReadObject(hSHPHandle,j);
- if ( obj && obj->nVertices > 0 ) {
- SHPDestroyObject(obj);
- break;
- }
- SHPDestroyObject(obj);
- obj=NULL;
- }
-
- if ( obj == NULL)
- {
- fprintf(stderr, "Shapefile contains %d NULL object(s)\n",
- num_entities);
- exit(-1);
- }
-
}
/*
//open the next object
obj = SHPReadObject(hSHPHandle,j);
+ if ( ! obj ) {
+ fprintf(stderr, "Error reading shape\n");
+ exit(1);
+ }
if (!dump_format)
{
/**********************************************************************
* $Log$
+ * Revision 1.88.2.14 2005/11/01 11:53:18 strk
+ * Dropped initial scan of shapefile - we don't check for all-null geometries anymore. Added check of return from SHPReadObject
+ *
* Revision 1.88.2.13 2005/10/24 16:12:41 strk
* Reverted backport of stricter INTEGER and STRING attributes handling.
* The change is too big to appear in the 1.0 branch.