(#393) shp2pgsql returns "fseek(-xxx) failed on DBF file." for large (>2GB) DBF files

git-svn-id: http://svn.osgeo.org/postgis/trunk@8967 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Paul Ramsey 2012-01-30 02:47:34 +00:00
parent f9976f0977
commit 9dd9cd1b73
5 changed files with 32 additions and 15 deletions

View file

@ -23,17 +23,9 @@
#include "pgsql2shp-core.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <sys/types.h>
#include <sys/stat.h>
/* Solaris9 does not provide stdint.h */
/* #include <stdint.h> */
#include <inttypes.h>
#include <sys/types.h> /* for getpid() */
#ifdef HAVE_UNISTD_H /* for getpid() and getopt */
#include <unistd.h>
@ -43,10 +35,6 @@
#include <sys/param.h>
#endif
#include "libpq-fe.h"
#include "shapefil.h"
#include "getopt.h"
#include "../liblwgeom/liblwgeom.h" /* for LWGEOM struct and funx */
#include "../liblwgeom/lwgeom_log.h" /* for LWDEBUG macros */

View file

@ -18,10 +18,12 @@
#include <ctype.h>
#include <unistd.h>
#include <errno.h>
#include <math.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <iconv.h>
#include "../postgis_config.h"
#include "libpq-fe.h"
#include "shapefil.h"
#include "shpcommon.h"

View file

@ -76,6 +76,18 @@ SHP_CVSID("$Id: safileio.c,v 1.4 2008-01-16 20:05:14 bram Exp $");
# endif
#endif
/* Local prototypes */
SAFile SADFOpen( const char *pszFilename, const char *pszAccess );
SAOffset SADFRead( void *p, SAOffset size, SAOffset nmemb, SAFile file );
SAOffset SADFWrite( void *p, SAOffset size, SAOffset nmemb, SAFile file );
SAOffset SADFSeek( SAFile file, SAOffset offset, int whence );
SAOffset SADFTell( SAFile file );
int SADFFlush( SAFile file );
int SADFClose( SAFile file );
int SADRemove( const char *filename );
void SADError( const char *message );
/************************************************************************/
/* SADFOpen() */
/************************************************************************/
@ -115,7 +127,11 @@ SAOffset SADFWrite( void *p, SAOffset size, SAOffset nmemb, SAFile file )
SAOffset SADFSeek( SAFile file, SAOffset offset, int whence )
{
#ifdef HAVE_FSEEKO
return (SAOffset) fseeko( (FILE *) file, (off_t) offset, whence );
#else
return (SAOffset) fseek( (FILE *) file, (long) offset, whence );
#endif
}
/************************************************************************/
@ -125,7 +141,11 @@ SAOffset SADFSeek( SAFile file, SAOffset offset, int whence )
SAOffset SADFTell( SAFile file )
{
#ifdef HAVE_FSEEKO
return (SAOffset) ftello( (FILE *) file );
#else
return (SAOffset) ftell( (FILE *) file );
#endif
}
/************************************************************************/

View file

@ -137,7 +137,9 @@
* try to improve SHPAPI_CALL docs
*/
#define _FILE_OFFSET_BITS 64
#include <stdio.h>
#include <sys/types.h>
#ifdef USE_DBMALLOC
#include <dbmalloc.h>
@ -240,8 +242,14 @@ static char *cvsid_aw() { return( cvsid_aw() ? ((char *) NULL) : cpl_cvsid ); }
/* -------------------------------------------------------------------- */
typedef int *SAFile;
#ifndef SAOffset
typedef unsigned long SAOffset;
#ifdef HAVE_SEEKO
# ifndef SAOffset
typedef off_t SAOffset;
# endif
#else
# ifndef SAOffset
typedef unsigned long SAOffset;
# endif
#endif
typedef struct {

View file

@ -27,7 +27,6 @@
#include "shpcommon.h"
#include "getopt.h"
#include "../liblwgeom/stringbuffer.h"
#define RCSID "$Id$"