[GRASS-dev] Updated OGR/SHAPELIB based DBF driver crashing with GRASS SVN

Frank Warmerdam warmerdam at pobox.com
Wed Apr 9 13:01:44 EDT 2008


Glynn Clements wrote:
> 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;
> }
>

Folks,

I'm just trying to catch up on this topic.  There is already a stdio
based implementation in shapelib itself.  I have attached it,and it is
normally in a file called safileio.c.

I'm afraid I'm uncertain of the implications of mixing the Shapelib 1.3
code with GDAL's using Shapelib 1.2.  It seems potentially like it could
be a problem.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: safileio.c
Type: text/x-csrc
Size: 9678 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20080409/f91cd506/safileio-0001.bin


More information about the grass-dev mailing list