[gdal-dev] Error in GDALWarp to NWT_GRD

Even Rouault even.rouault at spatialys.com
Thu Jul 14 05:26:50 PDT 2016


Le jeudi 14 juillet 2016 13:07:42, jramm a écrit :
> I added the following to the end of the Create method in
> frmts/northwood/grddataset.cpp:
> 
> 
>     vsi_l_offset nFileSize = 1024 + nXSize * nYSize * 2;

--> beware of the potential int32 overflow in nXSize * nYSize

>     if (VSIFTruncateL(poDS->fp, nFileSize) != 0) {
> 		CPLError(CE_Failure, CPLE_FileIO,
> 				"Failed to allocate space for GRD file");
> 		delete poDS;
> 		return NULL;
>     }
>     poDS->FlushCache(); // Write the header to disk.
> 
> Unfortunately still receiving the error. I wonder if it would be better if
> I explicitly write the zeros with VSIFWriteL?

No, that's what VSIFTruncateL() is supposed to do, in a smarter way depending 
on filesystem capabilities.

> 
> 
> 
> 
> --
> View this message in context:
> http://osgeo-org.1560.x6.nabble.com/Error-in-GDALWarp-to-NWT-GRD-tp5276136
> p5276347.html Sent from the GDAL - Dev mailing list archive at Nabble.com.
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list