gdal icon indicating copy to clipboard operation
gdal copied to clipboard

C++ify our use of VSIFILE*

Open rouault opened this issue 4 years ago • 1 comments

Within the code base, we use mostly the C API of VSIFILE*. This is not super elegant, slightly inefficient (due to an extra C layer) and we have to manage explicitly VSIFCloseL() calls. We could add a static std::unique_ptr<VSIVirtualHandle> Open(const char *pszFilename, const char *pszAccess) method in VSIFileManager and then call methods on the returned pointer.

rouault avatar Oct 11 '21 11:10 rouault

@dbaston Since that ticket was created we have now typedef std::unique_ptr<VSIVirtualHandle, VSIVirtualHandleCloser> VSIVirtualHandleUniquePtr; (https://github.com/OSGeo/gdal/pull/7559), and in a number of places (drivers mostly) uses of the C API have been replaced by the VSIVirtualHandle equivalent calls (in follow up pull requests). But there's certainly more work to be continued

rouault avatar May 16 '24 14:05 rouault