[gdal-dev] MEM Driver under Vista 64?

Even Rouault even.rouault at mines-paris.org
Wed Aug 27 15:28:30 EDT 2008


Craig,

in fact I missed a small line that make my analysis was not exact and my 
commit r15232 didn't do what I've advertized...

In r15233, hopefully,  ' mem_driver->Create("MEM:::", ...) ' is possible now.

However, be carefull, since it turns out that there's no easy way of avoiding 
GDAL to destroy 'filename.tif' if you 
do 'mem_driver->Create("filename.tif", ...). The Delete() method will be 
called on the driver that recognizes the given filename.

So, as all the drivers, you must avoid giving an existing filename if you 
don't want it to be deleted...

Best regards.

Le Wednesday 27 August 2008 20:59:57, vous avez écrit :
> Even better.  Thanks for the explanation and for submitting a fix.
>
> Craig
>
>
> -----Original Message-----
> From: gdal-dev-bounces at lists.osgeo.org
> [mailto:gdal-dev-bounces at lists.osgeo.org] On Behalf Of Even Rouault
> Sent: Wednesday, August 27, 2008 11:54 AM
> To: gdal-dev at lists.osgeo.org
> Subject: Re: [gdal-dev] MEM Driver under Vista 64?
>
> Craig
>
> In fact the true reason is that the Create() method begins by trying to
> destroy the dataset by calling the Delete() method on it. And that was new
> to
> GDAL 1.5.0.
>
> So when you do some_driver->Create("MEM:::"), the identify method of the
> MEM
>
> driver detects that "MEM:::" prefix is handles by it. then it calls the
> Delete() method on it. But there's not pfnDelete() function for that
> driver,
>
> so it goes on by trying to Open() it and then it fails...
>
> Well, so now, the real fix is to (NULL-) implement the pfnDelete() method
> on
>
> the MEM driver, so that it does ... nothing ;-)
>
> Furthermore, it's safer because otherwise mem_driver->Create("foo.tif",
> ...)
>
> would remove "foo.tif" on the filesystem. So the Delete() method for the
> MEM
>
> driver must absolutely do nothing.
>
> Fixed in trunk in r15232
>
> Le Wednesday 27 August 2008 20:27:01 Craig Miller, vous avez écrit :
> > Thanks Chris.   That did the trick.
> >
> > Perhaps a quick note could be added to the MEM driver doc page?
> >
> > Craig
> >
> >
> > -----Original Message-----
> > From: Chris Eustace [mailto:Chris.Eustace at petrosys.com.au]
> > Sent: Tuesday, August 26, 2008 9:43 PM
> > To: Craig Miller
> > Cc: gdal-dev at lists.osgeo.org
> > Subject: Re: [gdal-dev] MEM Driver under Vista 64?
> >
> > I had a near identical issue when upgrading from V1.4.x to V1.5.2.
> >
> > The code checks the name passed in as the "filename" to Create(). ONLY
> > if it is of the form "MEM:::" will it then look for other expected
> > parameters (including PIXELS, LINES and DATAPOINTER). Otherwise, the
> > passed in filename is pretty much ignored.
> >
> > So, the actual answer is to rename "MEM:::" as anything else and you
> > will be fine.
> >
> > Chris Eustace.
> >
> > Craig Miller wrote:
> > > I am working with an in-house utility written a couple of years ago
> > > that uses the MEM driver.  Recently, after upgrading to Vista64 the
> > > utility stopped working.  As it was using an old version of GDAL, I
> > > decided to
> >
> > fetch
> >
> > > the source from the vault and recompile/link against GDAL 1.5.2.  I
> > > didn't change any code, but the new utility is failing with "ERROR 1:
> > > Missing required field (one of PIXELS, LINES, or DATAPOINTER)"
> > >
> > > I'm assuming the problem is either incorrect source (old code), a 64
> > > bit issue, or a GDAL version issue.  Before I start modifying the code
> > > to allocate memory and include a DATAPOINTER I thought I'd ask if there
>
> were
>
> > > any changes between GDAL 1.4 (Maybe older) GDAL 1.5.2 that might cause
> >
> > this
> >
> > > or if it is a well known Vista 64 problem?
> > >
> > > Here's the snippet of code that is fails on the poMemDriver->Create(.)
> >
> > line:
> > > 	GDALDriver* poMemDriver;
> > > 	CString format = "MEM";
> > > 	CString filename = "MEM:::";
> > >
> > > 	poMemDriver = GetGDALDriverManager()->GetDriverByName(format);
> > > 	if (poMemDriver == NULL)
> > > 	{
> > > 		cout << "\"MEM\" driver not supported." <<  endl;
> > > 		return false;
> > > 	}
> > > 	m_poUtmRgbDataset = poMemDriver->Create( filename,
> > > 		m_poSrcDataset->GetRasterXSize(),
> > > 		m_poSrcDataset->GetRasterYSize(),
> > > 		3,  // 3 Bands, Red, Green, and Blue
> > > 		GDT_Byte,
> > > 		NULL);
> > >
> > >
> > >
> > > _______________________________________________
> > > gdal-dev mailing list
> > > gdal-dev at lists.osgeo.org
> > > http://lists.osgeo.org/mailman/listinfo/gdal-dev
> >
> > No virus found in this incoming message.
> > Checked by AVG - http://www.avg.com
> > Version: 8.0.138 / Virus Database: 270.6.9/1635 - Release Date: 8/26/2008
> > 7:29 AM
> >
> >
> >
> > _______________________________________________
> > gdal-dev mailing list
> > gdal-dev at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com
> Version: 8.0.138 / Virus Database: 270.6.9/1637 - Release Date: 8/27/2008
> 7:01 AM




More information about the gdal-dev mailing list