[Gdal-dev] GDALOpenInfo question

Frank Warmerdam warmerdam at pobox.com
Mon Feb 12 17:36:39 EST 2007

Meek, Allan wrote:
> Hi,
> In GDALOpenInfo::GDALOpenInfo(const char * pszFilenameIn, GDALAccess
> eAccessIn), VSIFOpen tries to open the specified image. If it succeeds,
> it reads in 1024 bytes, then calls VSIRewind. If it fails, VSIFOpenL
> tries to open the file. If this succeeds, 1024 bytes are read, then the
> file is closed.
> Is there a reason for this difference? Shouldn't the file just be
> rewinded in the second case?


In the VSIFOpen() case the file handle is left open, and attached to
the GDALOpenInfo.  It is rewound to ensure that the reading position
is at a known location for drivers that want to use the file handle.

In the VSIFOpenL() case we close it when we are done as there is no
way for drivers to realize this is a VSI*L style handle.  So it is
safter to just close it and let them reopen if they want.

Since it is being closed, there is no need to rewind.

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

More information about the Gdal-dev mailing list