Skip to content
Commits on Source (7)
......@@ -111,7 +111,7 @@ if(UNIX)
endif(UNIX)
set(shp_SOVERSION 1)
set(shp_VERSION 1.4.1)
set(shp_VERSION 1.5.0)
set_target_properties(shp
PROPERTIES
SOVERSION ${shp_SOVERSION}
......
2019-02-28 Even Rouault <even.rouault at spatialys.com>
* Fix 'make distcheck' broken by nth-2 commit
* Shapelib 1.5.0 released
2019-02-28 Even Rouault <even.rouault at spatialys.com>
* shpopen.c: resync with GDAL internal shapelib to avoid being dependent
on correctness of file size field in .shp. Fixes
https://lists.osgeo.org/pipermail/gdal-dev/2018-October/049218.html
2019-02-28 Even Rouault <even.rouault at spatialys.com>
* contrib/shpgeo.h/.c: Remove PROJ.4 dependency and functionality,
causing removal of SHPProject(), SHPSetProjection() and SHPFreeProjection()
* contrib/shpproj.c: removed
2018-08-16 Even Rouault <even.rouault at spatialys.com>
* shpopen.c, dbfopen.c, shptree.c, sbnsearch.c: resyc with GDAL
internal shapelib. Mostly to allow building those files as C++
without warning. Also add FTDate entry in DBFFieldType
(see https://github.com/OSGeo/gdal/pull/308). And some other
code cleanups
2018-08-16 Even Rouault <even.rouault at spatialys.com>
* dbfopen.c: fix a bug where the end of file character was
written on top of the first character of the first field name
when deleting a field on a .dbf without records.
Fixes https://github.com/OSGeo/gdal/issues/863
2018-06-15 Even Rouault <even.rouault at spatialys.com>
* safileio.c: remove duplicate test. Patch by Jaroslav Fojtik.
Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2744
2017-09-14 Even Rouault <even.rouault at spatialys.com>
* Shapelib 1.4.1 released
2017-09-10 Even Rouault <even.rouault at spatialys.com>
* shpopen.c: resync with GDAL copy. Make sure to zero terminate all
......
......@@ -554,8 +554,6 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PROJ_CFLAGS = @PROJ_CFLAGS@
PROJ_LIBS = @PROJ_LIBS@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
......
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for shapelib 1.4.1.
# Generated by GNU Autoconf 2.69 for shapelib 1.5.0.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
......@@ -587,8 +587,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='shapelib'
PACKAGE_TARNAME='shapelib'
PACKAGE_VERSION='1.4.1'
PACKAGE_STRING='shapelib 1.4.1'
PACKAGE_VERSION='1.5.0'
PACKAGE_STRING='shapelib 1.5.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
 
......@@ -636,8 +636,6 @@ LIBOBJS
PLATFORM_WIN32_FALSE
PLATFORM_WIN32_TRUE
LIBM
PROJ_LIBS
PROJ_CFLAGS
CXXCPP
CPP
LT_SYS_LIBRARY_PATH
......@@ -773,8 +771,6 @@ with_aix_soname
with_gnu_ld
with_sysroot
enable_libtool_lock
with_proj_cflags
with_proj_libs
'
ac_precious_vars='build_alias
host_alias
......@@ -1340,7 +1336,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures shapelib 1.4.1 to adapt to many kinds of systems.
\`configure' configures shapelib 1.5.0 to adapt to many kinds of systems.
 
Usage: $0 [OPTION]... [VAR=VALUE]...
 
......@@ -1411,7 +1407,7 @@ fi
 
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of shapelib 1.4.1:";;
short | recursive ) echo "Configuration of shapelib 1.5.0:";;
esac
cat <<\_ACEOF
 
......@@ -1442,8 +1438,6 @@ Optional Packages:
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
--with-sysroot[=DIR] Search for dependent libraries within DIR (or the
compiler's sysroot if not specified).
--with-proj-cflags CFLAGS for the PROJ.4 headers
--with-proj-libs LIBS for the PROJ.4 libraries
 
Some influential environment variables:
CC C compiler command
......@@ -1526,7 +1520,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
shapelib configure 1.4.1
shapelib configure 1.5.0
generated by GNU Autoconf 2.69
 
Copyright (C) 2012 Free Software Foundation, Inc.
......@@ -1925,7 +1919,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
 
It was created by shapelib $as_me 1.4.1, which was
It was created by shapelib $as_me 1.5.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
 
$ $0 $@
......@@ -2791,7 +2785,7 @@ fi
 
# Define the identity of the package.
PACKAGE='shapelib'
VERSION='1.4.1'
VERSION='1.5.0'
 
 
cat >>confdefs.h <<_ACEOF
......@@ -4137,7 +4131,7 @@ unknown)
esac
 
 
SHAPELIB_SO_VERSION=2:2:0
SHAPELIB_SO_VERSION=3:0:1
 
 
ac_ext=c
......@@ -16681,26 +16675,6 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 
 
# Check whether --with-proj-cflags was given.
if test "${with_proj_cflags+set}" = set; then :
withval=$with_proj_cflags; if test "$withval" != ""; then PROJ_CFLAGS="$withval"; else PROJ_CFLAGS=""; fi
else
PROJ_CFLAGS='-DPROJ4'
fi
# Check whether --with-proj-libs was given.
if test "${with_proj_libs+set}" = set; then :
withval=$with_proj_libs; PROJ_LIBS="$withval"
else
PROJ_LIBS='-lproj'
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for floor in -lm" >&5
$as_echo_n "checking for floor in -lm... " >&6; }
if ${ac_cv_lib_m_floor+:} false; then :
......@@ -16767,7 +16741,6 @@ fi
echo
echo "Configuration summary for $PACKAGE $VERSION:"
echo " - Host: ${host}"
echo " - PROJ flags: $PROJ_CFLAGS $PROJ_LIBS"
echo
 
ac_config_files="$ac_config_files Makefile contrib/Makefile shapelib.pc"
......@@ -17351,7 +17324,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by shapelib $as_me 1.4.1, which was
This file was extended by shapelib $as_me 1.5.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
 
CONFIG_FILES = $CONFIG_FILES
......@@ -17408,7 +17381,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
shapelib config.status 1.4.1
shapelib config.status 1.5.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
 
......
dnl Process this file with autoconf to produce a configure script.
m4_define(shapelib_version_major, 1)
m4_define(shapelib_version_minor, 4)
m4_define(shapelib_version_micro, 1)
m4_define(shapelib_version_minor, 5)
m4_define(shapelib_version_micro, 0)
AC_PREREQ(2.62)
AC_INIT(shapelib, shapelib_version_major.shapelib_version_minor.shapelib_version_micro)
......@@ -16,7 +16,7 @@ AM_SILENT_RULES([yes])
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
dnl See http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
AC_SUBST([SHAPELIB_SO_VERSION], [2:2:0])
AC_SUBST([SHAPELIB_SO_VERSION], [3:0:1])
AC_PROG_CC
AC_PROG_CXX
......@@ -27,19 +27,6 @@ AC_LANG([C++])
dnl ************************** Libtool initialization *************************
LT_INIT
dnl ********************************* Modules *********************************
AC_ARG_WITH([proj-cflags],
[AS_HELP_STRING([--with-proj-cflags], [CFLAGS for the PROJ.4 headers])],
[if test "$withval" != ""; then PROJ_CFLAGS="$withval"; else PROJ_CFLAGS=""; fi],
[PROJ_CFLAGS='-DPROJ4'])
AC_SUBST([PROJ_CFLAGS])
AC_ARG_WITH([proj-libs],
[AS_HELP_STRING([--with-proj-libs], [LIBS for the PROJ.4 libraries])],
[PROJ_LIBS="$withval"],
[PROJ_LIBS='-lproj'])
AC_SUBST([PROJ_LIBS])
dnl ****************************** Detect libm *******************************
AC_CHECK_LIB(m,floor,LIBM=-lm)
......@@ -62,7 +49,6 @@ dnl ********************************* Summary *********************************
echo
echo "Configuration summary for $PACKAGE $VERSION:"
echo " - Host: ${host}"
echo " - PROJ flags: $PROJ_CFLAGS $PROJ_LIBS"
echo
AC_CONFIG_FILES([Makefile contrib/Makefile shapelib.pc])
......
CONTRIB_CFLAGS = -I$(top_srcdir) -DDEBUG -DDEBUG2
# Extra files to distribute in the source tarball
EXTRA_DIST = makefile.vc tests/shpproj.sh doc/Shape_PointInPoly_README.txt doc/shpproj.txt doc/shpsort.txt ShapeFileII.pas
EXTRA_DIST = makefile.vc tests/shpproj.sh doc/Shape_PointInPoly_README.txt doc/shpsort.txt ShapeFileII.pas
# Installed executables
bin_PROGRAMS = dbfcat dbfinfo shpcat shpdxf shpfix shpsort Shape_PointInPoly shpcentrd shpdata shpinfo shpproj shpwkb
bin_PROGRAMS = dbfcat dbfinfo shpcat shpdxf shpfix shpsort Shape_PointInPoly shpcentrd shpdata shpinfo shpwkb
dbfcat_SOURCES = dbfcat.c
dbfcat_CPPFLAGS = $(CONTRIB_CFLAGS)
......@@ -35,24 +35,20 @@ Shape_PointInPoly_CPPFLAGS = $(CONTRIB_CFLAGS)
Shape_PointInPoly_LDADD = $(top_builddir)/libshp.la
shpcentrd_SOURCES = shpcentrd.c shpgeo.c shpgeo.h
shpcentrd_CPPFLAGS = $(CONTRIB_CFLAGS) $(PROJ_CFLAGS)
shpcentrd_LDADD = $(top_builddir)/libshp.la $(PROJ_LIBS) -lm
shpcentrd_CPPFLAGS = $(CONTRIB_CFLAGS)
shpcentrd_LDADD = $(top_builddir)/libshp.la -lm
shpdata_SOURCES = shpdata.c shpgeo.c shpgeo.h
shpdata_CPPFLAGS = $(CONTRIB_CFLAGS) $(PROJ_CFLAGS)
shpdata_LDADD = $(top_builddir)/libshp.la $(PROJ_LIBS) -lm
shpdata_CPPFLAGS = $(CONTRIB_CFLAGS)
shpdata_LDADD = $(top_builddir)/libshp.la -lm
shpinfo_SOURCES = shpinfo.c shpgeo.c shpgeo.h
shpinfo_CPPFLAGS = $(CONTRIB_CFLAGS) $(PROJ_CFLAGS)
shpinfo_LDADD = $(top_builddir)/libshp.la $(PROJ_LIBS) -lm
shpproj_SOURCES = shpproj.c shpgeo.c shpgeo.h
shpproj_CPPFLAGS = $(CONTRIB_CFLAGS) $(PROJ_CFLAGS)
shpproj_LDADD = $(top_builddir)/libshp.la $(PROJ_LIBS) -lm
shpinfo_CPPFLAGS = $(CONTRIB_CFLAGS)
shpinfo_LDADD = $(top_builddir)/libshp.la -lm
shpwkb_SOURCES = shpwkb.c shpgeo.c shpgeo.h
shpwkb_CPPFLAGS = $(CONTRIB_CFLAGS) $(PROJ_CFLAGS)
shpwkb_LDADD = $(top_builddir)/libshp.la $(PROJ_LIBS) -lm
shpwkb_CPPFLAGS = $(CONTRIB_CFLAGS)
shpwkb_LDADD = $(top_builddir)/libshp.la -lm
# Tests
TESTS_ENVIRONMENT = top_builddir=$(abs_top_builddir)
......
......@@ -91,7 +91,7 @@ host_triplet = @host@
bin_PROGRAMS = dbfcat$(EXEEXT) dbfinfo$(EXEEXT) shpcat$(EXEEXT) \
shpdxf$(EXEEXT) shpfix$(EXEEXT) shpsort$(EXEEXT) \
Shape_PointInPoly$(EXEEXT) shpcentrd$(EXEEXT) shpdata$(EXEEXT) \
shpinfo$(EXEEXT) shpproj$(EXEEXT) shpwkb$(EXEEXT)
shpinfo$(EXEEXT) shpwkb$(EXEEXT)
subdir = contrib
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
......@@ -126,13 +126,11 @@ shpcat_DEPENDENCIES = $(top_builddir)/libshp.la
am_shpcentrd_OBJECTS = shpcentrd-shpcentrd.$(OBJEXT) \
shpcentrd-shpgeo.$(OBJEXT)
shpcentrd_OBJECTS = $(am_shpcentrd_OBJECTS)
am__DEPENDENCIES_1 =
shpcentrd_DEPENDENCIES = $(top_builddir)/libshp.la \
$(am__DEPENDENCIES_1)
shpcentrd_DEPENDENCIES = $(top_builddir)/libshp.la
am_shpdata_OBJECTS = shpdata-shpdata.$(OBJEXT) \
shpdata-shpgeo.$(OBJEXT)
shpdata_OBJECTS = $(am_shpdata_OBJECTS)
shpdata_DEPENDENCIES = $(top_builddir)/libshp.la $(am__DEPENDENCIES_1)
shpdata_DEPENDENCIES = $(top_builddir)/libshp.la
am_shpdxf_OBJECTS = shpdxf-shpdxf.$(OBJEXT)
shpdxf_OBJECTS = $(am_shpdxf_OBJECTS)
shpdxf_DEPENDENCIES = $(top_builddir)/libshp.la
......@@ -142,17 +140,13 @@ shpfix_DEPENDENCIES = $(top_builddir)/libshp.la
am_shpinfo_OBJECTS = shpinfo-shpinfo.$(OBJEXT) \
shpinfo-shpgeo.$(OBJEXT)
shpinfo_OBJECTS = $(am_shpinfo_OBJECTS)
shpinfo_DEPENDENCIES = $(top_builddir)/libshp.la $(am__DEPENDENCIES_1)
am_shpproj_OBJECTS = shpproj-shpproj.$(OBJEXT) \
shpproj-shpgeo.$(OBJEXT)
shpproj_OBJECTS = $(am_shpproj_OBJECTS)
shpproj_DEPENDENCIES = $(top_builddir)/libshp.la $(am__DEPENDENCIES_1)
shpinfo_DEPENDENCIES = $(top_builddir)/libshp.la
am_shpsort_OBJECTS = shpsort-shpsort.$(OBJEXT)
shpsort_OBJECTS = $(am_shpsort_OBJECTS)
shpsort_DEPENDENCIES = $(top_builddir)/libshp.la
am_shpwkb_OBJECTS = shpwkb-shpwkb.$(OBJEXT) shpwkb-shpgeo.$(OBJEXT)
shpwkb_OBJECTS = $(am_shpwkb_OBJECTS)
shpwkb_DEPENDENCIES = $(top_builddir)/libshp.la $(am__DEPENDENCIES_1)
shpwkb_DEPENDENCIES = $(top_builddir)/libshp.la
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
......@@ -208,13 +202,11 @@ am__v_CXXLD_1 =
SOURCES = $(Shape_PointInPoly_SOURCES) $(dbfcat_SOURCES) \
$(dbfinfo_SOURCES) $(shpcat_SOURCES) $(shpcentrd_SOURCES) \
$(shpdata_SOURCES) $(shpdxf_SOURCES) $(shpfix_SOURCES) \
$(shpinfo_SOURCES) $(shpproj_SOURCES) $(shpsort_SOURCES) \
$(shpwkb_SOURCES)
$(shpinfo_SOURCES) $(shpsort_SOURCES) $(shpwkb_SOURCES)
DIST_SOURCES = $(Shape_PointInPoly_SOURCES) $(dbfcat_SOURCES) \
$(dbfinfo_SOURCES) $(shpcat_SOURCES) $(shpcentrd_SOURCES) \
$(shpdata_SOURCES) $(shpdxf_SOURCES) $(shpfix_SOURCES) \
$(shpinfo_SOURCES) $(shpproj_SOURCES) $(shpsort_SOURCES) \
$(shpwkb_SOURCES)
$(shpinfo_SOURCES) $(shpsort_SOURCES) $(shpwkb_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
......@@ -508,8 +500,6 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PROJ_CFLAGS = @PROJ_CFLAGS@
PROJ_LIBS = @PROJ_LIBS@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
......@@ -574,7 +564,7 @@ top_srcdir = @top_srcdir@
CONTRIB_CFLAGS = -I$(top_srcdir) -DDEBUG -DDEBUG2
# Extra files to distribute in the source tarball
EXTRA_DIST = makefile.vc tests/shpproj.sh doc/Shape_PointInPoly_README.txt doc/shpproj.txt doc/shpsort.txt ShapeFileII.pas
EXTRA_DIST = makefile.vc tests/shpproj.sh doc/Shape_PointInPoly_README.txt doc/shpsort.txt ShapeFileII.pas
dbfcat_SOURCES = dbfcat.c
dbfcat_CPPFLAGS = $(CONTRIB_CFLAGS)
dbfcat_LDADD = $(top_builddir)/libshp.la
......@@ -597,20 +587,17 @@ Shape_PointInPoly_SOURCES = Shape_PointInPoly.cpp
Shape_PointInPoly_CPPFLAGS = $(CONTRIB_CFLAGS)
Shape_PointInPoly_LDADD = $(top_builddir)/libshp.la
shpcentrd_SOURCES = shpcentrd.c shpgeo.c shpgeo.h
shpcentrd_CPPFLAGS = $(CONTRIB_CFLAGS) $(PROJ_CFLAGS)
shpcentrd_LDADD = $(top_builddir)/libshp.la $(PROJ_LIBS) -lm
shpcentrd_CPPFLAGS = $(CONTRIB_CFLAGS)
shpcentrd_LDADD = $(top_builddir)/libshp.la -lm
shpdata_SOURCES = shpdata.c shpgeo.c shpgeo.h
shpdata_CPPFLAGS = $(CONTRIB_CFLAGS) $(PROJ_CFLAGS)
shpdata_LDADD = $(top_builddir)/libshp.la $(PROJ_LIBS) -lm
shpdata_CPPFLAGS = $(CONTRIB_CFLAGS)
shpdata_LDADD = $(top_builddir)/libshp.la -lm
shpinfo_SOURCES = shpinfo.c shpgeo.c shpgeo.h
shpinfo_CPPFLAGS = $(CONTRIB_CFLAGS) $(PROJ_CFLAGS)
shpinfo_LDADD = $(top_builddir)/libshp.la $(PROJ_LIBS) -lm
shpproj_SOURCES = shpproj.c shpgeo.c shpgeo.h
shpproj_CPPFLAGS = $(CONTRIB_CFLAGS) $(PROJ_CFLAGS)
shpproj_LDADD = $(top_builddir)/libshp.la $(PROJ_LIBS) -lm
shpinfo_CPPFLAGS = $(CONTRIB_CFLAGS)
shpinfo_LDADD = $(top_builddir)/libshp.la -lm
shpwkb_SOURCES = shpwkb.c shpgeo.c shpgeo.h
shpwkb_CPPFLAGS = $(CONTRIB_CFLAGS) $(PROJ_CFLAGS)
shpwkb_LDADD = $(top_builddir)/libshp.la $(PROJ_LIBS) -lm
shpwkb_CPPFLAGS = $(CONTRIB_CFLAGS)
shpwkb_LDADD = $(top_builddir)/libshp.la -lm
# Tests
TESTS_ENVIRONMENT = top_builddir=$(abs_top_builddir)
......@@ -734,10 +721,6 @@ shpinfo$(EXEEXT): $(shpinfo_OBJECTS) $(shpinfo_DEPENDENCIES) $(EXTRA_shpinfo_DEP
@rm -f shpinfo$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(shpinfo_OBJECTS) $(shpinfo_LDADD) $(LIBS)
shpproj$(EXEEXT): $(shpproj_OBJECTS) $(shpproj_DEPENDENCIES) $(EXTRA_shpproj_DEPENDENCIES)
@rm -f shpproj$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(shpproj_OBJECTS) $(shpproj_LDADD) $(LIBS)
shpsort$(EXEEXT): $(shpsort_OBJECTS) $(shpsort_DEPENDENCIES) $(EXTRA_shpsort_DEPENDENCIES)
@rm -f shpsort$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(shpsort_OBJECTS) $(shpsort_LDADD) $(LIBS)
......@@ -764,8 +747,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shpfix-shpfix.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shpinfo-shpgeo.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shpinfo-shpinfo.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shpproj-shpgeo.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shpproj-shpproj.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shpsort-shpsort.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shpwkb-shpgeo.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shpwkb-shpwkb.Po@am__quote@
......@@ -945,34 +926,6 @@ shpinfo-shpgeo.obj: shpgeo.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(shpinfo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o shpinfo-shpgeo.obj `if test -f 'shpgeo.c'; then $(CYGPATH_W) 'shpgeo.c'; else $(CYGPATH_W) '$(srcdir)/shpgeo.c'; fi`
shpproj-shpproj.o: shpproj.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(shpproj_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT shpproj-shpproj.o -MD -MP -MF $(DEPDIR)/shpproj-shpproj.Tpo -c -o shpproj-shpproj.o `test -f 'shpproj.c' || echo '$(srcdir)/'`shpproj.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/shpproj-shpproj.Tpo $(DEPDIR)/shpproj-shpproj.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='shpproj.c' object='shpproj-shpproj.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(shpproj_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o shpproj-shpproj.o `test -f 'shpproj.c' || echo '$(srcdir)/'`shpproj.c
shpproj-shpproj.obj: shpproj.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(shpproj_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT shpproj-shpproj.obj -MD -MP -MF $(DEPDIR)/shpproj-shpproj.Tpo -c -o shpproj-shpproj.obj `if test -f 'shpproj.c'; then $(CYGPATH_W) 'shpproj.c'; else $(CYGPATH_W) '$(srcdir)/shpproj.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/shpproj-shpproj.Tpo $(DEPDIR)/shpproj-shpproj.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='shpproj.c' object='shpproj-shpproj.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(shpproj_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o shpproj-shpproj.obj `if test -f 'shpproj.c'; then $(CYGPATH_W) 'shpproj.c'; else $(CYGPATH_W) '$(srcdir)/shpproj.c'; fi`
shpproj-shpgeo.o: shpgeo.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(shpproj_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT shpproj-shpgeo.o -MD -MP -MF $(DEPDIR)/shpproj-shpgeo.Tpo -c -o shpproj-shpgeo.o `test -f 'shpgeo.c' || echo '$(srcdir)/'`shpgeo.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/shpproj-shpgeo.Tpo $(DEPDIR)/shpproj-shpgeo.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='shpgeo.c' object='shpproj-shpgeo.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(shpproj_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o shpproj-shpgeo.o `test -f 'shpgeo.c' || echo '$(srcdir)/'`shpgeo.c
shpproj-shpgeo.obj: shpgeo.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(shpproj_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT shpproj-shpgeo.obj -MD -MP -MF $(DEPDIR)/shpproj-shpgeo.Tpo -c -o shpproj-shpgeo.obj `if test -f 'shpgeo.c'; then $(CYGPATH_W) 'shpgeo.c'; else $(CYGPATH_W) '$(srcdir)/shpgeo.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/shpproj-shpgeo.Tpo $(DEPDIR)/shpproj-shpgeo.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='shpgeo.c' object='shpproj-shpgeo.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(shpproj_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o shpproj-shpgeo.obj `if test -f 'shpgeo.c'; then $(CYGPATH_W) 'shpgeo.c'; else $(CYGPATH_W) '$(srcdir)/shpgeo.c'; fi`
shpsort-shpsort.o: shpsort.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(shpsort_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT shpsort-shpsort.o -MD -MP -MF $(DEPDIR)/shpsort-shpsort.Tpo -c -o shpsort-shpsort.o `test -f 'shpsort.c' || echo '$(srcdir)/'`shpsort.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/shpsort-shpsort.Tpo $(DEPDIR)/shpsort-shpsort.Po
......
shpproj
using the projection tools proj and invproj
we have implemented a shapefile projection utility
shpproj shp_file new_shp ( -i=in_proj_file | -i="in_params" | -i=geographic ) ( -o=out_info_file | -o="out_params" | -o=geographic )
INPUT
Input can come from one of three sources. A projection parameter file,
directly through parameters or geographic. If the shapefile has an associated
prj file, name the same as the shapefile but ending in ".prj" it will be used
by default ignoring all other parameters. If input is omitted it defaults to
geographic, unless the default prj file exists..
OUTPUT
Output can come from one of three sources. A projection parameter file,
directly through parameters or geographic. If output is omitted it defaults
to geographic.
PROJECTION PARAMETER FILE
This file MUST end with the extension ".prj". It has the form of one
projection parameter per line. Parameters can be in any order.
PROJECTION PARAMETERS
Are the same as used by proj and invproj.
use proj -lP to see available projections
proj -lu to see available units
proj -le to see available ellipsoid
USAGE
the following example projects file rowtest to row3, moving data from Stateplane NAD83 zone 1002 to utm zone 16 in meters
shpproj rowtest row -i="init=nad83:1002 units=us-ft" -o="proj=utm zone=16 units=m"
shpproj rowtest row3 -o="proj=utm zone=18 units=m" -i="zone=16 proj=utm units=us-ft"
shpproj rowtest row3 -o="proj=utm zone=18 units=m"
shpproj rowtest row3 -i=myfile.prj -o=geographic
shpproj rowtest row3 -is=myfile.prj
Datums
Stateplane data can be accessed by the init function
init=nad83:1003
which is of the form
datum:FIPSzone
To move from NAD27 to NAD83 or otherwise the shpproj utility moves to
geographic coordinates and the back to the desired datum. proj can handle
direct datum to datum conversions but it is umimplemented here.
for a complete listing of FIPSZones by datum read nad/nad.lst in the PROJ4
library
CAUTION
It is possible to get very poor results for projection values when using
coordinates VERY far away from the intended scope of the projection.
An example of a poor projection choice would be to move from nad83:1002
(Georgia West) for data in California into utm. The resulting data will be
much less accurate than if it had started as geographic.
CFLAGS = /Ox /MD /nologo /I.. /IC:\OSGeo4W\include \
/D_LITTLE_ENDIAN -DPROJ4
/D_LITTLE_ENDIAN
LINKARGS = ..\shapelib_i.lib C:\OSGeo4W\lib\proj_i.lib
LINKARGS = ..\shapelib_i.lib
default: all
all: shpcat.exe shpcentrd.exe shpdxf.exe shpinfo.exe shpproj.exe
all: shpcat.exe shpcentrd.exe shpdxf.exe shpinfo.exe
shpcat.exe: shpcat.obj shpgeo.obj
$(CC) $(CFLAGS) shpcat.obj $(LINKARGS)
......@@ -16,10 +16,6 @@ shpcentrd.exe: shpcentrd.obj shpgeo.obj
$(CC) $(CFLAGS) shpcentrd.obj shpgeo.obj $(LINKARGS)
if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1
shpproj.exe: shpproj.obj shpgeo.obj
$(CC) $(CFLAGS) shpproj.obj shpgeo.obj $(LINKARGS)
if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1
shpdxf.exe: shpdxf.obj shpgeo.obj
$(CC) $(CFLAGS) shpdxf.obj $(LINKARGS)
if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1
......
......@@ -32,6 +32,11 @@
* use -DPROJ4 to compile in Projection support
*
* $Log: shpgeo.c,v $
* Revision 1.17 2019-02-28 15:51:49 erouault
* * contrib/shpgeo.h/.c: Remove PROJ.4 dependency and functionality,
* causing removal of SHPProject(), SHPSetProjection() and SHPFreeProjection()
* * contrib/shpproj.c: removed
*
* Revision 1.16 2017-07-10 18:01:35 erouault
* * contrib/shpgeo.c: fix compilation on _MSC_VER < 1800 regarding lack
* of NAN macro.
......@@ -182,91 +187,6 @@ static void * SfRealloc( void * pMem, int nNewSize )
return( (void *) realloc(pMem,nNewSize) );
}
/* **************************************************************************
* SHPPRoject
*
* Project points using projection handles, for use with PROJ4.3
*
* act as a wrapper to protect against library changes in PROJ
*
* **************************************************************************/
int SHPProject ( SHPObject *psCShape, projPJ inproj, projPJ outproj ) {
#ifdef PROJ4
int j;
if ( pj_is_latlong(inproj) ) {
for(j=0; j < psCShape->nVertices; j++) {
psCShape->padfX[j] *= DEG_TO_RAD;
psCShape->padfY[j] *= DEG_TO_RAD;
}
}
pj_transform(inproj, outproj, psCShape->nVertices, 0, psCShape->padfX,
psCShape->padfY, NULL);
if ( pj_is_latlong(outproj) ) {
for(j=0; j < psCShape->nVertices; j++) {
psCShape->padfX[j] *= RAD_TO_DEG;
psCShape->padfY[j] *= RAD_TO_DEG;
}
}
/* Recompute new Extents of projected Object */
SHPComputeExtents ( psCShape );
#endif
return ( 1 );
}
/* **************************************************************************
* SHPSetProjection
*
* establish a projection handle for use with PROJ4.3
*
* act as a wrapper to protect against library changes in PROJ
*
* **************************************************************************/
projPJ SHPSetProjection ( int param_cnt, char **params ) {
#ifdef PROJ4
projPJ *p = NULL;
if ( param_cnt > 0 && params[0] )
{
p = pj_init ( param_cnt, params );
}
else
{
char* params_local[] = { "+proj=longlat", NULL };
p = pj_init ( 1, params_local );
}
return ( p );
#else
return ( NULL );
#endif
}
/* **************************************************************************
* SHPFreeProjection
*
* release a projection handle for use with PROJ4.3
*
* act as a wrapper to protect against library changes in PROJ
*
* **************************************************************************/
int SHPFreeProjection ( projPJ p) {
#ifdef PROJ4
if ( p )
pj_free ( p );
#endif
return ( 1 );
}
/* **************************************************************************
* SHPOGisType
*
......
......@@ -27,6 +27,11 @@
*
*
* $Log: shpgeo.h,v $
* Revision 1.5 2019-02-28 15:51:49 erouault
* * contrib/shpgeo.h/.c: Remove PROJ.4 dependency and functionality,
* causing removal of SHPProject(), SHPSetProjection() and SHPFreeProjection()
* * contrib/shpproj.c: removed
*
* Revision 1.4 2016-12-05 12:44:07 erouault
* * Major overhaul of Makefile build system to use autoconf/automake.
*
......@@ -72,12 +77,6 @@
extern "C" {
#endif
#ifdef PROJ4
#include "proj_api.h"
#else
typedef void* projPJ;
#endif
#define SHPD_POINT 1
#define SHPD_LINE 2
#define SHPD_AREA 4
......@@ -112,10 +111,6 @@ typedef struct { int cParts;
extern char * asFileName ( const char *fil, char *ext );
extern int SHPProject ( SHPObject *psCShape,
projPJ inproj, projPJ outproj );
extern projPJ SHPSetProjection ( int param_cnt, char **params );
extern int SHPFreeProjection ( projPJ p);
extern int SHPDimension ( int SHPType );
......
/******************************************************************************
* Copyright (c) 1999, Carl Anderson
*
* This code is based in part on the earlier work of Frank Warmerdam
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
******************************************************************************
*
* requires shapelib 1.2
* gcc shpproj ../shpopen.o ../dbfopen.o shpgeo.o -lm -lproj -o shpproj
*
* this requires linking with the PROJ4.3 projection library available from
*
* ftp://kai.er.usgs.gov/ftp/PROJ.4
*
*
* SHPGeo must be compiled with -DPROJ4 support
*
* $Log: shpproj.c,v $
* Revision 1.10 2011-07-24 03:17:46 fwarmerdam
* include string.h and stdlib.h where needed in contrib (#2146)
*
* Revision 1.9 2002-01-15 14:37:08 warmerda
* upgrade to use proj_api.h
*
* Revision 1.8 2002/01/11 15:47:26 warmerda
* several fixes
*
* Revision 1.7 2002/01/11 15:23:28 warmerda
* use text mode reading and writing .prj files
*
* Revision 1.6 1999/05/26 02:56:31 candrsn
* updates to shpdxf, dbfinfo, port from Shapelib 1.1.5 of dbfcat and shpinfo
*
* Revision 1.2 1999/05/13 19:30:52 warmerda
* Removed libgen.h, added url for PROJ.4, and corrected unsafe return of
* local variable in asFileName().
*
*/
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "shapefil.h"
#include "shpgeo.h"
int main( int argc, char ** argv )
{
SHPHandle old_SHP, new_SHP;
DBFHandle old_DBF, new_DBF;
int nShapeType, nEntities, nVertices, nParts, *panParts, i, iPart, j;
double *padVertices, adBounds[4];
const char *pszPlus;
DBFFieldType idfld_type;
SHPObject *psCShape;
FILE *ifp = NULL;
int idfld, nflds;
char kv[257] = "";
char idfldName[120] = "";
char fldName[120] = "";
char shpFileName[120] = "";
char dbfFileName[120] = "";
char prjFileName[120] = "";
char parg[80];
double apeture[4];
int inarg, outarg;
char *DBFRow = NULL;
/* for testing only
char *in_args[] = { "init=nad83:1002", "units=us-ft" };
char *out_args[] = { "proj=utm", "zone=16", "units=m" };
*/
char *in_args[16];
char *out_args[16];
int in_argc = 0 , out_argc = 0, outf_arg;
char *arglst;
projPJ orig_prj, new_prj;
va_list myargs, moargs;
if( argc < 4)
{
printf( "shpproj shp_file new_shp ( -i=in_proj_file | -i=\"in_params\" | -i=geographic ) ( -o=out_info_file | -o=\"out_params\" | -o=geographic ) \n" );
exit( 1 );
}
old_SHP = SHPOpen( argv[1], "rb" );
old_DBF = DBFOpen( argv[1], "rb" );
if( old_SHP == NULL || old_DBF == NULL )
{
printf( "Unable to open old files:%s\n", argv[1] );
exit( 1 );
}
outf_arg = 2;
inarg = 0;
outarg = 0;
for ( i = 3; i < argc; i++ ) {
if ( !strncmp ("-i=", argv[i], 3 )) inarg = i;
if ( !strncmp ("-o=", argv[i], 3 )) outarg = i;
}
/* if shapefile has a prj component then use that
else try for a file then read args as list */
if( inarg == 0 )
{
strcpy( prjFileName, argv[1] );
ifp = fopen( asFileName ( prjFileName, "prj" ),"rt");
}
else
{
ifp = fopen( asFileName ( argv[inarg] + 3, "prj" ),"rt");
}
i = 0;
if ( ifp ) {
if( inarg == 0 )
printf ("using default file proj params from <- %s\n",
asFileName ( prjFileName, "prj" ) );
else
printf ("using file proj params from <- %s\n",
asFileName ( argv[inarg] + 3, "prj" ) );
while( fscanf( ifp, "%s", parg) != EOF ) {
in_args[i] = malloc ( strlen(parg)+1 );
strcpy ( in_args[i], parg);
i++;
}
in_argc = i;
fclose (ifp);
}
else {
if ( inarg > 0 ) {
arglst = argv[inarg] + 3;
j = 0;
i = 0;
while ( j < strlen (arglst) ) {
in_argc += sscanf ( arglst + j, "%s", parg);
in_args[i] = malloc( strlen (parg)+1);
strcpy (in_args[i], parg);
i++;
j += strlen (parg) +1;
if ( arglst[j] + 1 == 0 ) j = strlen (argv[inarg]);
}
}
}
i = 0;
if ( outarg > 0 ) ifp = fopen( asFileName ( argv[outarg] + 3, "prj" ),"rt");
if ( ifp ) {
while( fscanf( ifp, "%s", parg) != EOF ) {
out_args[i] = malloc ( strlen(parg));
strcpy ( out_args[i], parg);
i++;
}
out_argc = i;
fclose (ifp);
}
else {
if ( outarg > 0 ) {
arglst = argv[outarg] + 3;
j = 0;
i = 0;
while ( j < strlen (arglst) ) {
out_argc += sscanf ( arglst + j, "%s", parg);
out_args[i] = malloc( strlen (parg)+1);
strcpy (out_args[i], parg);
i++;
j += strlen (parg) +1;
if ( arglst[j] + 1 == 0 ) j = strlen (argv[outarg]);
}
}
}
if ( !strcmp( argv[inarg], "-i=geographic" )) in_argc = 0;
if ( !strcmp( argv[outarg], "-o=geographic" )) out_argc = 0;
orig_prj = SHPSetProjection ( in_argc, in_args );
new_prj = SHPSetProjection ( out_argc, out_args );
if ( !(( (!in_argc) || orig_prj) && ( (!out_argc) || new_prj) )) {
fprintf (stderr, "unable to process projection, exiting...\n");
exit(1);
}
SHPGetInfo( old_SHP, &nEntities, &nShapeType, NULL, NULL);
new_SHP = SHPCreate ( argv[outf_arg], nShapeType );
new_DBF = DBFCloneEmpty (old_DBF, argv[outf_arg]);
if( new_SHP == NULL || new_DBF == NULL )
{
printf( "Unable to create new files:%s\n", argv[outf_arg] );
exit( 1 );
}
DBFRow = (char *) malloc ( (old_DBF->nRecordLength) + 15 );
for( i = 0; i < nEntities; i++ )
{
int j;
psCShape = SHPReadObject ( old_SHP, i );
SHPProject (psCShape, orig_prj, new_prj );
SHPWriteObject ( new_SHP, -1, psCShape );
SHPDestroyObject ( psCShape );
memcpy ( DBFRow, DBFReadTuple ( old_DBF, i ), old_DBF->nRecordLength );
DBFWriteTuple ( new_DBF, new_DBF->nRecords, DBFRow );
}
SHPFreeProjection ( orig_prj );
SHPFreeProjection ( new_prj );
/* store projection params into prj file */
ifp = fopen( asFileName ( argv[outf_arg], "prj" ),"wt");
if ( ifp ) {
if ( out_argc == 0 )
{ fprintf( ifp, "proj=geographic\n" ); }
else
{ for ( i = 0; i < out_argc; i++ )
fprintf( ifp, "%s\n", out_args[i]);
}
fclose (ifp);
}
SHPClose( old_SHP );
SHPClose( new_SHP );
DBFClose( old_DBF );
DBFClose( new_DBF );
printf ("\n");
}
......@@ -18,15 +18,9 @@ $top_builddir/dbfadd "$testdir/test" "3"
$top_builddir/dbfadd "$testdir/test" "4"
$top_builddir/dbfadd "$testdir/test" "5"
$top_builddir/contrib/shpproj "$testdir/test" "$testdir/test_1" -i=geographic -o="init=nad83:1002 units=us-ft"
$top_builddir/contrib/shpproj "$testdir/test_1" "$testdir/test_2" -o="proj=utm zone=16 units=m"
$top_builddir/contrib/shpproj "$testdir/test_2" "$testdir/test_3" -o=geographic
$top_builddir/shpdump -precision 8 "$testdir/test" > "$testdir/test.out"
$top_builddir/shpdump -precision 8 "$testdir/test_3" > "$testdir/test_3.out"
result="$(diff "$testdir/test.out" "$testdir/test_3.out")"
result="$(diff "$testdir/test.out")"
if [ "$result" == "" ]; then
echo "******* Test Succeeded *********"
rm -f "$testdir/test*"
......
This diff is collapsed.
shapelib (1.4.1-4) UNRELEASED; urgency=medium
shapelib (1.5.0-1~exp1) experimental; urgency=medium
* New upstream release.
* Bump Standards-Version to 4.3.0, no changes.
* Add Build-Depends-Package field to symbols file.
* Drop libproj-dev build dependency.
* Rename manpages to replace .md.1 suffix with .1.
* Drop contrib/shpproj.c from copyright file, removed upstream.
-- Bas Couwenberg <sebastic@debian.org> Sun, 05 Aug 2018 20:59:41 +0200
-- Bas Couwenberg <sebastic@debian.org> Thu, 28 Feb 2019 17:30:55 +0100
shapelib (1.4.1-3) unstable; urgency=medium
......
......@@ -6,7 +6,6 @@ Section: libs
Priority: optional
Build-Depends: debhelper (>= 9),
dh-autoreconf,
libproj-dev,
ronn
Standards-Version: 4.3.0
Vcs-Browser: https://salsa.debian.org/debian-gis-team/shapelib
......
......@@ -46,7 +46,6 @@ Files: contrib/shpcat.c
contrib/shpgeo.c
contrib/shpgeo.h
contrib/shpinfo.c
contrib/shpproj.c
contrib/shpwkb.c
Copyright: 1999, Carl Anderson
License: Expat
......
......@@ -18,6 +18,9 @@ override_dh_clean:
override_dh_auto_build:
dh_auto_build
ronn -r --date="$(BUILD_DATE)" --manual=shplib debian/man/*.md
for FILE in debian/man/*.md.1; do \
mv -v $$FILE debian/man/`basename $$FILE .md.1`.1; \
done
override_dh_auto_install:
dh_auto_install
......
/******************************************************************************
* $Id: safileio.c,v 1.5 2016-12-05 12:44:05 erouault Exp $
* $Id: safileio.c,v 1.6 2018-06-15 19:56:32 erouault Exp $
*
* Project: Shapelib
* Purpose: Default implementation of file io based on stdio.
......@@ -34,6 +34,10 @@
******************************************************************************
*
* $Log: safileio.c,v $
* Revision 1.6 2018-06-15 19:56:32 erouault
* * safileio.c: remove duplicate test. Patch by Jaroslav Fojtik.
* Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2744
*
* Revision 1.5 2016-12-05 12:44:05 erouault
* * Major overhaul of Makefile build system to use autoconf/automake.
*
......@@ -70,7 +74,7 @@
#include <string.h>
#include <stdio.h>
SHP_CVSID("$Id: safileio.c,v 1.5 2016-12-05 12:44:05 erouault Exp $");
SHP_CVSID("$Id: safileio.c,v 1.6 2018-06-15 19:56:32 erouault Exp $");
#ifdef SHPAPI_UTF8_HOOKS
# ifdef SHPAPI_WINDOWS
......@@ -236,7 +240,7 @@ SAFile SAUtf8WFOpen( const char *pszFilename, const char *pszAccess )
const wchar_t *pwszFileName, *pwszAccess;
pwszFileName = Utf8ToWideChar( pszFilename );
pwszAccess = Utf8ToWideChar( pszAccess );
if( pwszFileName != NULL && pwszFileName != NULL)
if( pwszFileName != NULL && pwszAccess != NULL)
{
file = (SAFile) _wfopen( pwszFileName, pwszAccess );
}
......
/******************************************************************************
* $Id: sbnsearch.c,v 1.2 2016-12-05 12:44:05 erouault Exp $
* $Id: sbnsearch.c,v 1.3 2018-08-16 15:39:07 erouault Exp $
*
* Project: Shapelib
* Purpose: Implementation of search in ESRI SBN spatial index.
......@@ -40,7 +40,7 @@
#include <stdlib.h>
#include <string.h>
SHP_CVSID("$Id: sbnsearch.c,v 1.2 2016-12-05 12:44:05 erouault Exp $")
SHP_CVSID("$Id: sbnsearch.c,v 1.3 2018-08-16 15:39:07 erouault Exp $")
#ifndef TRUE
# define TRUE 1
......@@ -59,11 +59,23 @@ SHP_CVSID("$Id: sbnsearch.c,v 1.2 2016-12-05 12:44:05 erouault Exp $")
#endif
#endif
#define READ_MSB_INT(ptr) \
(((ptr)[0] << 24) | ((ptr)[1] << 16) | ((ptr)[2] << 8) | (ptr)[3])
#define CACHED_DEPTH_LIMIT 8
#ifdef __cplusplus
#define STATIC_CAST(type,x) static_cast<type>(x)
#define REINTERPRET_CAST(type,x) reinterpret_cast<type>(x)
#define CONST_CAST(type,x) const_cast<type>(x)
#define SHPLIB_NULLPTR nullptr
#else
#define STATIC_CAST(type,x) ((type)(x))
#define REINTERPRET_CAST(type,x) ((type)(x))
#define CONST_CAST(type,x) ((type)(x))
#define SHPLIB_NULLPTR NULL
#endif
#define READ_MSB_INT(ptr) \
STATIC_CAST(int, (((STATIC_CAST(unsigned, (ptr)[0])) << 24) | ((ptr)[1] << 16) | ((ptr)[2] << 8) | (ptr)[3]))
typedef unsigned char uchar;
typedef int coord;
......@@ -135,9 +147,9 @@ static void SwapWord( int length, void * wordP )
for( i=0; i < length/2; i++ )
{
temp = ((uchar *) wordP)[i];
((uchar *)wordP)[i] = ((uchar *) wordP)[length-i-1];
((uchar *) wordP)[length-i-1] = temp;
temp = STATIC_CAST(uchar*, wordP)[i];
STATIC_CAST(uchar*, wordP)[i] = STATIC_CAST(uchar*, wordP)[length-i-1];
STATIC_CAST(uchar*, wordP)[length-i-1] = temp;
}
}
......@@ -156,8 +168,8 @@ SBNSearchHandle SBNOpenDiskTree( const char* pszSBNFilename,
int nMaxNodes;
int nNodeDescSize;
int nNodeDescCount;
uchar* pabyData = NULL;
SBNNodeDescriptor* pasNodeDescriptor = NULL;
uchar* pabyData = SHPLIB_NULLPTR;
SBNNodeDescriptor* pasNodeDescriptor = SHPLIB_NULLPTR;
uchar abyBinHeader[8];
int nCurNode;
int nNextNonEmptyNode;
......@@ -168,7 +180,7 @@ SBNSearchHandle SBNOpenDiskTree( const char* pszSBNFilename,
/* Establish the byte order on this machine. */
/* -------------------------------------------------------------------- */
i = 1;
if( *((unsigned char *) &i) == 1 )
if( *REINTERPRET_CAST(unsigned char *, &i) == 1 )
bBigEndian = FALSE;
else
bBigEndian = TRUE;
......@@ -176,19 +188,19 @@ SBNSearchHandle SBNOpenDiskTree( const char* pszSBNFilename,
/* -------------------------------------------------------------------- */
/* Initialize the handle structure. */
/* -------------------------------------------------------------------- */
hSBN = (SBNSearchHandle)
calloc(sizeof(struct SBNSearchInfo),1);
hSBN = STATIC_CAST(SBNSearchHandle,
calloc(sizeof(struct SBNSearchInfo),1));
if (psHooks == NULL)
if (psHooks == SHPLIB_NULLPTR)
SASetupDefaultHooks( &(hSBN->sHooks) );
else
memcpy( &(hSBN->sHooks), psHooks, sizeof(SAHooks) );
hSBN->fpSBN = hSBN->sHooks.FOpen(pszSBNFilename, "rb");
if (hSBN->fpSBN == NULL)
if (hSBN->fpSBN == SHPLIB_NULLPTR)
{
free(hSBN);
return NULL;
return SHPLIB_NULLPTR;
}
/* -------------------------------------------------------------------- */
......@@ -206,7 +218,7 @@ SBNSearchHandle SBNOpenDiskTree( const char* pszSBNFilename,
{
hSBN->sHooks.Error( ".sbn file is unreadable, or corrupt." );
SBNCloseDiskTree(hSBN);
return NULL;
return SHPLIB_NULLPTR;
}
/* -------------------------------------------------------------------- */
......@@ -231,7 +243,7 @@ SBNSearchHandle SBNOpenDiskTree( const char* pszSBNFilename,
{
hSBN->sHooks.Error( "Invalid extent in .sbn file." );
SBNCloseDiskTree(hSBN);
return NULL;
return SHPLIB_NULLPTR;
}
/* -------------------------------------------------------------------- */
......@@ -246,7 +258,7 @@ SBNSearchHandle SBNOpenDiskTree( const char* pszSBNFilename,
"Invalid shape count in .sbn : %d", nShapeCount );
hSBN->sHooks.Error( szErrorMsg );
SBNCloseDiskTree(hSBN);
return NULL;
return SHPLIB_NULLPTR;
}
/* Empty spatial index */
......@@ -274,7 +286,7 @@ SBNSearchHandle SBNOpenDiskTree( const char* pszSBNFilename,
{
hSBN->sHooks.Error( "Unexpected bin id" );
SBNCloseDiskTree(hSBN);
return NULL;
return SHPLIB_NULLPTR;
}
/* -------------------------------------------------------------------- */
......@@ -296,20 +308,20 @@ SBNSearchHandle SBNOpenDiskTree( const char* pszSBNFilename,
"Invalid node descriptor size in .sbn : %d", nNodeDescSize );
hSBN->sHooks.Error( szErrorMsg );
SBNCloseDiskTree(hSBN);
return NULL;
return SHPLIB_NULLPTR;
}
/* coverity[tainted_data] */
pabyData = (uchar*) malloc( nNodeDescSize );
pasNodeDescriptor = (SBNNodeDescriptor*)
calloc ( nMaxNodes, sizeof(SBNNodeDescriptor) );
if (pabyData == NULL || pasNodeDescriptor == NULL)
pabyData = STATIC_CAST(uchar*, malloc( nNodeDescSize ));
pasNodeDescriptor = STATIC_CAST(SBNNodeDescriptor*,
calloc ( nMaxNodes, sizeof(SBNNodeDescriptor) ));
if (pabyData == SHPLIB_NULLPTR || pasNodeDescriptor == SHPLIB_NULLPTR)
{
free(pabyData);
free(pasNodeDescriptor);
hSBN->sHooks.Error( "Out of memory error" );
SBNCloseDiskTree(hSBN);
return NULL;
return SHPLIB_NULLPTR;
}
/* -------------------------------------------------------------------- */
......@@ -322,7 +334,7 @@ SBNSearchHandle SBNOpenDiskTree( const char* pszSBNFilename,
free(pasNodeDescriptor);
hSBN->sHooks.Error( "Cannot read node descriptors" );
SBNCloseDiskTree(hSBN);
return NULL;
return SHPLIB_NULLPTR;
}
hSBN->pasNodeDescriptor = pasNodeDescriptor;
......@@ -344,12 +356,12 @@ SBNSearchHandle SBNOpenDiskTree( const char* pszSBNFilename,
{
hSBN->sHooks.Error( "Inconsistent shape count in bin" );
SBNCloseDiskTree(hSBN);
return NULL;
return SHPLIB_NULLPTR;
}
}
free(pabyData);
pabyData = NULL;
/* pabyData = SHPLIB_NULLPTR; */
/* Locate first non-empty node */
nCurNode = 0;
......@@ -360,11 +372,11 @@ SBNSearchHandle SBNOpenDiskTree( const char* pszSBNFilename,
{
hSBN->sHooks.Error( "All nodes are empty" );
SBNCloseDiskTree(hSBN);
return NULL;
return SHPLIB_NULLPTR;
}
pasNodeDescriptor[nCurNode].nBinOffset =
(int) hSBN->sHooks.FTell(hSBN->fpSBN);
STATIC_CAST(int, hSBN->sHooks.FTell(hSBN->fpSBN));
/* Compute the index of the next non empty node. */
nNextNonEmptyNode = nCurNode + 1;
......@@ -395,7 +407,7 @@ SBNSearchHandle SBNOpenDiskTree( const char* pszSBNFilename,
{
hSBN->sHooks.Error( "Unexpected bin id" );
SBNCloseDiskTree(hSBN);
return NULL;
return SHPLIB_NULLPTR;
}
/* Bins are always limited to 100 features */
......@@ -404,7 +416,7 @@ SBNSearchHandle SBNOpenDiskTree( const char* pszSBNFilename,
{
hSBN->sHooks.Error( "Unexpected bin size" );
SBNCloseDiskTree(hSBN);
return NULL;
return SHPLIB_NULLPTR;
}
if( nNextNonEmptyNode < nMaxNodes &&
......@@ -412,7 +424,7 @@ SBNSearchHandle SBNOpenDiskTree( const char* pszSBNFilename,
{
nCurNode = nNextNonEmptyNode;
pasNodeDescriptor[nCurNode].nBinOffset =
(int) hSBN->sHooks.FTell(hSBN->fpSBN) - 8;
STATIC_CAST(int, hSBN->sHooks.FTell(hSBN->fpSBN)) - 8;
/* Compute the index of the next non empty node. */
nNextNonEmptyNode = nCurNode + 1;
......@@ -439,15 +451,15 @@ void SBNCloseDiskTree( SBNSearchHandle hSBN )
int i;
int nMaxNodes;
if (hSBN == NULL)
if (hSBN == SHPLIB_NULLPTR)
return;
if( hSBN->pasNodeDescriptor != NULL )
if( hSBN->pasNodeDescriptor != SHPLIB_NULLPTR )
{
nMaxNodes = (1 << hSBN->nMaxDepth) - 1;
for(i = 0; i < nMaxNodes; i++)
{
if( hSBN->pasNodeDescriptor[i].pabyShapeDesc != NULL )
if( hSBN->pasNodeDescriptor[i].pabyShapeDesc != SHPLIB_NULLPTR )
free(hSBN->pasNodeDescriptor[i].pabyShapeDesc);
}
}
......@@ -470,10 +482,10 @@ void SBNCloseDiskTree( SBNSearchHandle hSBN )
static void * SfRealloc( void * pMem, int nNewSize )
{
if( pMem == NULL )
return( (void *) malloc(nNewSize) );
if( pMem == SHPLIB_NULLPTR )
return malloc(nNewSize);
else
return( (void *) realloc(pMem,nNewSize) );
return realloc(pMem,nNewSize);
}
/************************************************************************/
......@@ -488,11 +500,11 @@ static int SBNAddShapeId( SearchStruct* psSearch,
int* pNewPtr;
psSearch->nShapeAlloc =
(int) (((psSearch->nShapeCount + 100) * 5) / 4);
STATIC_CAST(int, ((psSearch->nShapeCount + 100) * 5) / 4);
pNewPtr =
(int *) SfRealloc( psSearch->panShapeId,
psSearch->nShapeAlloc * sizeof(int) );
if( pNewPtr == NULL )
STATIC_CAST(int *, SfRealloc( psSearch->panShapeId,
psSearch->nShapeAlloc * sizeof(int) ));
if( pNewPtr == SHPLIB_NULLPTR )
{
psSearch->hSBN->sHooks.Error( "Out of memory error" );
return FALSE;
......@@ -556,7 +568,7 @@ static int SBNSearchDiskInternal( SearchStruct* psSearch,
/* -------------------------------------------------------------------- */
/* If this node contains shapes that are cached, then read them. */
/* -------------------------------------------------------------------- */
else if (psNode->pabyShapeDesc != NULL)
else if (psNode->pabyShapeDesc != SHPLIB_NULLPTR)
{
int j;
uchar* pabyShapeDesc = psNode->pabyShapeDesc;
......@@ -607,7 +619,7 @@ static int SBNSearchDiskInternal( SearchStruct* psSearch,
hSBN->sHooks.FSeek(hSBN->fpSBN, psNode->nBinOffset, SEEK_SET);
if (nDepth < CACHED_DEPTH_LIMIT)
psNode->pabyShapeDesc = (uchar*) malloc(psNode->nShapeCount * 8);
psNode->pabyShapeDesc = STATIC_CAST(uchar*, malloc(psNode->nShapeCount * 8));
for(i = 0; i < psNode->nBinCount; i++)
{
......@@ -621,7 +633,7 @@ static int SBNSearchDiskInternal( SearchStruct* psSearch,
{
hSBN->sHooks.Error( "I/O error" );
free(psNode->pabyShapeDesc);
psNode->pabyShapeDesc = NULL;
psNode->pabyShapeDesc = SHPLIB_NULLPTR;
return FALSE;
}
......@@ -629,7 +641,7 @@ static int SBNSearchDiskInternal( SearchStruct* psSearch,
{
hSBN->sHooks.Error( "Unexpected bin id" );
free(psNode->pabyShapeDesc);
psNode->pabyShapeDesc = NULL;
psNode->pabyShapeDesc = SHPLIB_NULLPTR;
return FALSE;
}
......@@ -643,19 +655,19 @@ static int SBNSearchDiskInternal( SearchStruct* psSearch,
{
hSBN->sHooks.Error( "Unexpected bin size" );
free(psNode->pabyShapeDesc);
psNode->pabyShapeDesc = NULL;
psNode->pabyShapeDesc = SHPLIB_NULLPTR;
return FALSE;
}
if( nShapeCountAcc + nShapes > psNode->nShapeCount)
{
free(psNode->pabyShapeDesc);
psNode->pabyShapeDesc = NULL;
psNode->pabyShapeDesc = SHPLIB_NULLPTR;
hSBN->sHooks.Error( "Inconsistent shape count for bin" );
return FALSE;
}
if (nDepth < CACHED_DEPTH_LIMIT && psNode->pabyShapeDesc != NULL)
if (nDepth < CACHED_DEPTH_LIMIT && psNode->pabyShapeDesc != SHPLIB_NULLPTR)
{
pabyBinShape = psNode->pabyShapeDesc + nShapeCountAcc * 8;
}
......@@ -672,7 +684,7 @@ static int SBNSearchDiskInternal( SearchStruct* psSearch,
{
hSBN->sHooks.Error( "I/O error" );
free(psNode->pabyShapeDesc);
psNode->pabyShapeDesc = NULL;
psNode->pabyShapeDesc = SHPLIB_NULLPTR;
return FALSE;
}
......@@ -712,12 +724,12 @@ static int SBNSearchDiskInternal( SearchStruct* psSearch,
bMaxX < bNodeMinX || bMaxY < bNodeMinY ||
bMinX > bNodeMaxX || bMinY > bNodeMaxY )
{
/*printf("shape %d %d %d %d\n", bMinX, bMinY, bMaxX, bMaxY);
printf("node %d %d %d %d\n", bNodeMinX, bNodeMinY, bNodeMaxX, bNodeMaxY);*/
/* printf("shape %d %d %d %d\n", bMinX, bMinY, bMaxX, bMaxY);*/
/* printf("node %d %d %d %d\n", bNodeMinX, bNodeMinY, bNodeMaxX, bNodeMaxY);*/
hSBN->sHooks.Error(
"Invalid shape bounding box in bin" );
free(psNode->pabyShapeDesc);
psNode->pabyShapeDesc = NULL;
psNode->pabyShapeDesc = SHPLIB_NULLPTR;
return FALSE;
}
#endif
......@@ -750,7 +762,7 @@ static int SBNSearchDiskInternal( SearchStruct* psSearch,
if( nShapeCountAcc != psNode->nShapeCount)
{
free(psNode->pabyShapeDesc);
psNode->pabyShapeDesc = NULL;
psNode->pabyShapeDesc = SHPLIB_NULLPTR;
hSBN->sHooks.Error( "Inconsistent shape count for bin" );
return FALSE;
}
......@@ -767,7 +779,7 @@ static int SBNSearchDiskInternal( SearchStruct* psSearch,
if( (nDepth % 2) == 0 ) /* x split */
{
coord bMid = (coord) (1 + ((int)bNodeMinX + bNodeMaxX) / 2);
coord bMid = STATIC_CAST(coord, 1 + (STATIC_CAST(int, bNodeMinX) + bNodeMaxX) / 2);
if( bSearchMinX <= bMid - 1 &&
!SBNSearchDiskInternal( psSearch, nDepth + 1, nNodeId + 1,
bNodeMinX, bNodeMinY,
......@@ -785,7 +797,7 @@ static int SBNSearchDiskInternal( SearchStruct* psSearch,
}
else /* y split */
{
coord bMid = (coord) (1 + ((int)bNodeMinY + bNodeMaxY) / 2);
coord bMid = STATIC_CAST(coord, 1 + (STATIC_CAST(int, bNodeMinY) + bNodeMaxY) / 2);
if( bSearchMinY <= bMid - 1 &&
!SBNSearchDiskInternal( psSearch, nDepth + 1, nNodeId + 1,
bNodeMinX, bNodeMinY,
......@@ -814,7 +826,7 @@ static int SBNSearchDiskInternal( SearchStruct* psSearch,
static int
compare_ints( const void * a, const void * b)
{
return (*(int*)a) - (*(int*)b);
return *REINTERPRET_CAST(const int*, a) - *REINTERPRET_CAST(const int*, b);
}
/************************************************************************/
......@@ -837,11 +849,11 @@ int* SBNSearchDiskTree( SBNSearchHandle hSBN,
dfMaxY = padfBoundsMax[1];
if( dfMinX > dfMaxX || dfMinY > dfMaxY )
return NULL;
return SHPLIB_NULLPTR;
if( dfMaxX < hSBN->dfMinX || dfMaxY < hSBN->dfMinY ||
dfMinX > hSBN->dfMaxX || dfMinY > hSBN->dfMaxY )
return NULL;
return SHPLIB_NULLPTR;
/* -------------------------------------------------------------------- */
/* Compute the search coordinates in [0,255]x[0,255] coord. space */
......@@ -862,7 +874,7 @@ int* SBNSearchDiskTree( SBNSearchHandle hSBN,
{
double dfMinX_255 = (dfMinX - hSBN->dfMinX)
/ dfDiskXExtent * 255.0;
bMinX = (int)floor(dfMinX_255 - 0.005);
bMinX = STATIC_CAST(int, floor(dfMinX_255 - 0.005));
if( bMinX < 0 ) bMinX = 0;
}
......@@ -872,7 +884,7 @@ int* SBNSearchDiskTree( SBNSearchHandle hSBN,
{
double dfMaxX_255 = (dfMaxX - hSBN->dfMinX)
/ dfDiskXExtent * 255.0;
bMaxX = (int)ceil(dfMaxX_255 + 0.005);
bMaxX = STATIC_CAST(int, ceil(dfMaxX_255 + 0.005));
if( bMaxX > 255 ) bMaxX = 255;
}
}
......@@ -890,7 +902,7 @@ int* SBNSearchDiskTree( SBNSearchHandle hSBN,
{
double dfMinY_255 = (dfMinY - hSBN->dfMinY)
/ dfDiskYExtent * 255.0;
bMinY = (int)floor(dfMinY_255 - 0.005);
bMinY = STATIC_CAST(int, floor(dfMinY_255 - 0.005));
if( bMinY < 0 ) bMinY = 0;
}
......@@ -900,7 +912,7 @@ int* SBNSearchDiskTree( SBNSearchHandle hSBN,
{
double dfMaxY_255 = (dfMaxY - hSBN->dfMinY)
/ dfDiskYExtent * 255.0;
bMaxY = (int)ceil(dfMaxY_255 + 0.005);
bMaxY = STATIC_CAST(int, ceil(dfMaxY_255 + 0.005));
if( bMaxY > 255 ) bMaxY = 255;
}
}
......@@ -928,25 +940,25 @@ int* SBNSearchDiskTreeInteger( SBNSearchHandle hSBN,
*pnShapeCount = 0;
if( bMinX > bMaxX || bMinY > bMaxY )
return NULL;
return SHPLIB_NULLPTR;
if( bMaxX < 0 || bMaxY < 0 || bMinX > 255 || bMinY > 255 )
return NULL;
return SHPLIB_NULLPTR;
if( hSBN->nShapeCount == 0 )
return NULL;
return SHPLIB_NULLPTR;
/* -------------------------------------------------------------------- */
/* Run the search. */
/* -------------------------------------------------------------------- */
memset( &sSearch, 0, sizeof(sSearch) );
sSearch.hSBN = hSBN;
sSearch.bMinX = (coord) (bMinX >= 0 ? bMinX : 0);
sSearch.bMinY = (coord) (bMinY >= 0 ? bMinY : 0);
sSearch.bMaxX = (coord) (bMaxX <= 255 ? bMaxX : 255);
sSearch.bMaxY = (coord) (bMaxY <= 255 ? bMaxY : 255);
sSearch.bMinX = STATIC_CAST(coord, bMinX >= 0 ? bMinX : 0);
sSearch.bMinY = STATIC_CAST(coord, bMinY >= 0 ? bMinY : 0);
sSearch.bMaxX = STATIC_CAST(coord, bMaxX <= 255 ? bMaxX : 255);
sSearch.bMaxY = STATIC_CAST(coord, bMaxY <= 255 ? bMaxY : 255);
sSearch.nShapeCount = 0;
sSearch.nShapeAlloc = 0;
sSearch.panShapeId = (int*) calloc(1, sizeof(int));
sSearch.panShapeId = STATIC_CAST(int*, calloc(1, sizeof(int)));
#ifdef DEBUG_IO
sSearch.nBytesRead = 0;
#endif
......@@ -962,7 +974,7 @@ int* SBNSearchDiskTreeInteger( SBNSearchHandle hSBN,
{
free( sSearch.panShapeId );
*pnShapeCount = 0;
return NULL;
return SHPLIB_NULLPTR;
}
*pnShapeCount = sSearch.nShapeCount;
......