[gdal-dev] Possible SyncToDisk() bug in 1.5

Martin Chapman mchapman at texelinc.com
Sun Dec 16 19:15:38 EST 2007


This code:

 

--

string sLayerName = (string)
m_pDataSource->GetLayer(0)->GetLayerDefn()->GetName();

string sSQL = "CREATE SPATIAL INDEX ON " + sLayerName;

m_pDataSource->ExecuteSQL((const char*) sSQL.c_str(), NULL, "");

--

 

throws an error in the file/function below on the line -
hSHP->sHooks.FFlush( hSHP->fpSHX );

because hSHP->fpSHX is NULL.  The question is why is hSHP->fpSHX NULL when
it used to pickup the shape index file.  Anyone else have this problem with
1.5? 

 

\gdal\ogr\ogrsf_frmts\shape\ogrshapelayer.cpp

 

OGRErr OGRShapeLayer::SyncToDisk()

 

{

    if( bHeaderDirty )

    {

        if( hSHP != NULL )

            SHPWriteHeader( hSHP );

 

        if( hDBF != NULL )

            DBFUpdateHeader( hDBF );

        

        bHeaderDirty = FALSE;

    }

 

    if( hSHP != NULL )

    {

        hSHP->sHooks.FFlush( hSHP->fpSHP );

        hSHP->sHooks.FFlush( hSHP->fpSHX );  ka-boom!

    }

 

    if( hDBF != NULL )

        hDBF->sHooks.FFlush( hDBF->fp );

 

    return OGRERR_NONE;

}

 

Best regards,

 

Martin Chapman

Chief Software Architect

Fortified Datacom Inc.

http://www.fortifieddatacom.com

mchapman at fortifieddatacom.com

303-324-1065

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20071216/6d1973a1/attachment.html


More information about the gdal-dev mailing list