Opened 9 years ago
Closed 5 years ago
#5939 closed enhancement (wontfix)
Natural chaining of prefixes for vsigzip
Reported by: | dsogari | Owned by: | warmerdam |
---|---|---|---|
Priority: | low | Milestone: | closed_because_of_github_migration |
Component: | default | Version: | svn-trunk |
Severity: | trivial | Keywords: | vsigzip; prefixes |
Cc: |
Description
Hi,
It is true that the zip and tar virtual drivers work if the file path is composed of two prefixes and that the natural chaining of prefixes is also supported (e.g., /vsizip/vsicurl instead of /vsizip//vsicurl). But for the gzip driver, this is not true.
However superficial this feature may be, I set out to find if it could be fixed. I took the code for the VSIZipFilesystemHandler::Open method as a starting point, and found that it calls VSIArchiveFilesystemHandler::SplitFilename, which takes care of skipping the right amount of characters to get the inner file path.
Inside SplitFilename, I copied the piece of code that does this and pasted it into a new method for VSIGZipFilesystemHandler, which I simply called SkipPrefix. Then, in each of the places where this behaviour is required, such as in line 1338 of gdal/port/cpl_vsi_gzip.cpp [revision 28977]:
VSIFilesystemHandler *poFSHandler = VSIFileManager::GetHandler( pszFilename + strlen("/vsigzip/"));
I replaced the pointer arithmetic by something like:
const char* pszNonprefixedFilename = SkipPrefix(pszFilename); VSIFilesystemHandler *poFSHandler = VSIFileManager::GetHandler(pszNonprefixedFilename);
Of course, the pszNonprefixedFilename variable may be reutilized within scope.
I know you guys are very busy, and I admire the work you are doing with GDAL. But if you find time, and would like to follow my approach, I attached the revised code of cpl_vsi_gzip.cpp.
In any way, thank you.
Regards.
Attachments (1)
Change History (2)
by , 9 years ago
Attachment: | cpl_vsil_gzip.cpp added |
---|
comment:1 by , 5 years ago
Milestone: | → closed_because_of_github_migration |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.
revised code of cpl_vsi_gzip.cpp