Skip to content

Commit

Permalink
Remove using VSIFilesystemHandler::Open; when possible.
Browse files Browse the repository at this point in the history
The remaining cases should be fixed some other way.
Having a using inside a class definition is not a good way to fix this
compiler error.

cpl_vsi_mem.cpp:966:53: error: too few arguments to function call, expected 3, have 2; did you mean 'VSIArchiveFilesystemHandler::Open'?
    return reinterpret_cast<VSILFILE *>( poHandler->Open( osFilename, "r+" ) );
                                                    ^~~~
                                                    VSIArchiveFilesystemHandler::Open
/Users/schwehr/src/gdal/gdal/port/cpl_vsi_virtual.h:89:23: note: 'VSIArchiveFilesystemHandler::Open' declared here
    VSIVirtualHandle *Open( const char *pszFilename,

Can we just add the bSetError 3rd arg to open?

git-svn-id: https://svn.osgeo.org/gdal/trunk@36990 f0d54148-0727-0410-94bb-9a71ac55c965
  • Loading branch information
schwehr committed Dec 21, 2016
1 parent 16fb318 commit 42c1b5d
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 21 deletions.
3 changes: 3 additions & 0 deletions gdal/port/cpl_vsi_mem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ class VSIMemFilesystemHandler CPL_FINAL : public VSIFilesystemHandler
VSIMemFilesystemHandler();
virtual ~VSIMemFilesystemHandler();

// TODO(schwehr): Fix VSIFileFromMemBuffer so that using is not needed.
using VSIFilesystemHandler::Open;

virtual VSIVirtualHandle *Open( const char *pszFilename,
Expand Down Expand Up @@ -965,6 +966,8 @@ VSILFILE *VSIFileFromMemBuffer( const char *pszFilename,
CPLAtomicInc(&(poFile->nRefCount));
}

// TODO(schwehr): Fix this so that the using statement is not needed.
// Will just adding the bool for bSetError be okay?
return reinterpret_cast<VSILFILE *>( poHandler->Open( osFilename, "r+" ) );
}

Expand Down
2 changes: 0 additions & 2 deletions gdal/port/cpl_vsil_crypt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1417,8 +1417,6 @@ class VSICryptFilesystemHandler CPL_FINAL : public VSIFilesystemHandler
VSICryptFilesystemHandler();
virtual ~VSICryptFilesystemHandler();

using VSIFilesystemHandler::Open;

virtual VSIVirtualHandle *Open( const char *pszFilename,
const char *pszAccess,
bool bSetError ) override;
Expand Down
2 changes: 0 additions & 2 deletions gdal/port/cpl_vsil_curl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,6 @@ class VSICurlFilesystemHandler : public VSIFilesystemHandler
VSICurlFilesystemHandler();
virtual ~VSICurlFilesystemHandler();

using VSIFilesystemHandler::Open;

virtual VSIVirtualHandle *Open( const char *pszFilename,
const char *pszAccess,
bool bSetError ) override;
Expand Down
2 changes: 0 additions & 2 deletions gdal/port/cpl_vsil_curl_streaming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,6 @@ class VSICurlStreamingFSHandler : public VSIFilesystemHandler
VSICurlStreamingFSHandler();
virtual ~VSICurlStreamingFSHandler();

using VSIFilesystemHandler::Open;

virtual VSIVirtualHandle *Open( const char *pszFilename,
const char *pszAccess,
bool bSetError ) override;
Expand Down
4 changes: 0 additions & 4 deletions gdal/port/cpl_vsil_gzip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,6 @@ class VSIGZipFilesystemHandler CPL_FINAL : public VSIFilesystemHandler
VSIGZipFilesystemHandler();
virtual ~VSIGZipFilesystemHandler();

using VSIFilesystemHandler::Open;

virtual VSIVirtualHandle *Open( const char *pszFilename,
const char *pszAccess,
bool bSetError ) override;
Expand Down Expand Up @@ -1978,8 +1976,6 @@ class VSIZipFilesystemHandler CPL_FINAL : public VSIArchiveFilesystemHandler
virtual VSIArchiveReader* CreateReader( const char* pszZipFileName )
override;

using VSIFilesystemHandler::Open;

virtual VSIVirtualHandle *Open( const char *pszFilename,
const char *pszAccess,
bool bSetError ) override;
Expand Down
3 changes: 3 additions & 0 deletions gdal/port/cpl_vsil_sparsefile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class VSISparseFileFilesystemHandler : public VSIFilesystemHandler
vsi_l_offset &nSparseFileOffset,
vsi_l_offset &nSparseFileSize );

// TODO(schwehr): Fix VSISparseFileFilesystemHandler::Stat to not need using.
using VSIFilesystemHandler::Open;

virtual VSIVirtualHandle *Open( const char *pszFilename,
Expand Down Expand Up @@ -464,6 +465,8 @@ int VSISparseFileFilesystemHandler::Stat( const char * pszFilename,
int nFlags )

{
// TODO(schwehr): Fix this so that the using statement is not needed.
// Will just adding the bool for bSetError be okay?
VSIVirtualHandle *poFile = Open( pszFilename, "r" );

memset( psStatBuf, 0, sizeof(VSIStatBufL) );
Expand Down
4 changes: 0 additions & 4 deletions gdal/port/cpl_vsil_stdout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ void VSIStdoutSetRedirection( VSIWriteFunction pFct, FILE* stream )
class VSIStdoutFilesystemHandler CPL_FINAL : public VSIFilesystemHandler
{
public:
using VSIFilesystemHandler::Open;

virtual VSIVirtualHandle *Open( const char *pszFilename,
const char *pszAccess,
bool bSetError ) override;
Expand Down Expand Up @@ -247,8 +245,6 @@ int VSIStdoutFilesystemHandler::Stat( const char * /* pszFilename */,
class VSIStdoutRedirectFilesystemHandler CPL_FINAL : public VSIFilesystemHandler
{
public:
using VSIFilesystemHandler::Open;

virtual VSIVirtualHandle *Open( const char *pszFilename,
const char *pszAccess,
bool bSetError ) override;
Expand Down
2 changes: 0 additions & 2 deletions gdal/port/cpl_vsil_subfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ class VSISubFileFilesystemHandler : public VSIFilesystemHandler
vsi_l_offset &nSubFileOffset,
vsi_l_offset &nSubFileSize );

using VSIFilesystemHandler::Open;

virtual VSIVirtualHandle *Open( const char *pszFilename,
const char *pszAccess,
bool bSetError ) override;
Expand Down
2 changes: 0 additions & 2 deletions gdal/port/cpl_vsil_tar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,6 @@ class VSITarFilesystemHandler CPL_FINAL : public VSIArchiveFilesystemHandler
virtual std::vector<CPLString> GetExtensions() override;
virtual VSIArchiveReader* CreateReader(const char* pszTarFileName) override;

using VSIFilesystemHandler::Open;

virtual VSIVirtualHandle *Open( const char *pszFilename,
const char *pszAccess,
bool bSetError ) override;
Expand Down
2 changes: 0 additions & 2 deletions gdal/port/cpl_vsil_unix_stdio_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ class VSIUnixStdioFilesystemHandler CPL_FINAL : public VSIFilesystemHandler
virtual ~VSIUnixStdioFilesystemHandler();
#endif

using VSIFilesystemHandler::Open;

virtual VSIVirtualHandle *Open( const char *pszFilename,
const char *pszAccess,
bool bSetError ) override;
Expand Down
2 changes: 1 addition & 1 deletion gdal/port/cpl_vsil_win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ CPL_CVSID("$Id$");
class VSIWin32FilesystemHandler CPL_FINAL : public VSIFilesystemHandler
{
public:

// TODO(schwehr): Fix Open call to remove the need for this using call.
using VSIFilesystemHandler::Open;

virtual VSIVirtualHandle *Open( const char *pszFilename,
Expand Down

0 comments on commit 42c1b5d

Please sign in to comment.