[gdal-dev] Notes on gdalbuildvrt.cpp

Even Rouault even.rouault at spatialys.com
Thu Aug 21 12:21:30 PDT 2014


Le jeudi 21 août 2014 21:13:15, Nicu Tofan a écrit :
> Hello Even,
> 
> 
>    - VRTBuilder::pasDatasetProperties line 237
> 
> DatasetProperty* psDatasetProperties
> 
> This is a variable allocated on the stack; on function entry it contains a
> pointer somewhere inside pasDatasetProperties; Say pasDatasetProperties is
> 0x7500000 and psDatasetProperties is
> 0x7500100. Now on line pasDatasetProperties the buffer at 0x7500000gets
> reallocated, possibly moving to, say, 0x90000000; psDatasetPropertiesshould
> now be 0x90000100 but it is still 0x7500100 because it is stored in a
> variable on the stack - namelly the argument psDatasetPropertie.
> 
> On line 457 psDatasetPropertie is used and is going to contain 0x750010. It
> may not trigger an access violation because the address will probably be
> inside the heap but it may generate some hard to find bugs that we all love
> and cherish.

That shouldn't happen because of the return at line 453. But for clarity we 
might have a dedicated function for the processing done between line 412 and 
454 since it doesn't need psDatasetProperties at all.

> 
> As a reflection of mine, this may be the result of the naming convention,
> as psDataset and pasDataset look the same to our animal brains.

Hungarian-style convention.

psXXXX is a Pointer to a single Structure
pasXXXXX is a Pointer to an Array of Structure

> 
> 
> 
>    - Generally this is a sign of non georeferenced images...
> 
> The bounding box becomes a bit more complicated in rotated images, too. I'm
> gonna look into it.

Dealing with non-zero values in gt[2] and gt[4] is clearly out of scope of 
what a regular VRT can do (you need a warped VRT for that).
Well you could still produce a regular VRT (with a rotated geotransform) if 
all the sources have the same rotation in their geotransform, but that's an 
unlikely situation.

> 
> 
> 
>    - GDALProxyPoolDatasetH
> 
> Got it, thanks!
> 
> Regards,
> Nick
> 
> PS Forgot to reply to the list, sorry.

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


More information about the gdal-dev mailing list