[gdal-dev] Re: [GRASS-dev] Updated OGR/SHAPELIB based DBF driver
crashing with GRASS SVN
Glynn Clements
glynn at gclements.plus.com
Wed Apr 9 12:52:14 EDT 2008
Markus Neteler wrote:
> after syncing (as regularly) the DBF driver from SHAPELIB embedded
> in OGR, we face the problem that it no longer works with older GDAL
> versions than current SVN:
>
> http://trac.osgeo.org/grass/ticket/110
>
> I don't know what to do. In essence, I don't want to fork our version
> from yours.
>
> Any ideas?
I suggest using a "stub" implementation of the I/O hooks. E.g.:
typedef struct {
FILE* (*FOpen) ( const char *filename, const char *path);
size_t (*FRead) ( void *p, size_t size, size_t nmemb, FILE* file);
size_t (*FWrite)( void *p, size_t size, size_t nmemb, FILE* file);
long (*FSeek) ( FILE* file, long offset, int whence );
long (*FTell) ( FILE* file );
int (*FFlush)( FILE* file );
int (*FClose)( FILE* file );
void (*Error) ( const char *message );
} SAHooks;
static void error_fn( const char *message )
{
G_fatal_error("%s", message);
}
static void SASetupDefaultHooks( SAHooks *psHooks )
{
psHooks->FOpen = fopen;
psHooks->FRead = fread;
psHooks->FWrite = fwrite;
psHooks->FSeek = fseek;
psHooks->FTell = ftell;
psHooks->FFlush = fflush;
psHooks->FClose = fclose;
psHooks->Error = error_fn;
}
--
Glynn Clements <glynn at gclements.plus.com>
More information about the gdal-dev
mailing list