avoid including GDAL C++ api (fixes #17849)

This commit is contained in:
Juergen E. Fischer 2018-01-14 16:57:03 +01:00
parent c4aa4d076b
commit abe89b6aa8
4 changed files with 17 additions and 22 deletions

View File

@ -16,7 +16,7 @@
#include "qgsalignraster.h"
#include <gdalwarper.h>
#include <ogr_spatialref.h>
#include <ogr_srs_api.h>
#include <cpl_conv.h>
#include <limits>

View File

@ -42,6 +42,7 @@
#include "qgsanimatedicon.h"
// use GDAL VSI mechanism
#define CPL_SUPRESS_CPLUSPLUS
#include "cpl_vsi.h"
#include "cpl_string.h"
@ -1329,7 +1330,7 @@ char **VSIReadDirRecursive1( const char *pszPath )
char **papszFiles1 = nullptr;
char **papszFiles2 = nullptr;
VSIStatBufL psStatBuf;
CPLString osTemp1, osTemp2;
QString temp1, temp2;
int i, j;
int nCount1, nCount2;
@ -1343,41 +1344,35 @@ char **VSIReadDirRecursive1( const char *pszPath )
for ( i = 0; i < nCount1; i++ )
{
// build complete file name for stat
osTemp1.clear();
osTemp1.append( pszPath );
osTemp1.append( "/" );
osTemp1.append( papszFiles1[i] );
temp1 = QString( "%1/%2" ).arg( pszPath, papszFiles1[i] );
// if is file, add it
if ( VSIStatL( osTemp1.c_str(), &psStatBuf ) == 0 &&
if ( VSIStatL( temp1.toUtf8(), &psStatBuf ) == 0 &&
VSI_ISREG( psStatBuf.st_mode ) )
{
// oFiles.AddString( papszFiles1[i] );
papszOFiles = CSLAddString( papszOFiles, papszFiles1[i] );
}
else if ( VSIStatL( osTemp1.c_str(), &psStatBuf ) == 0 &&
else if ( VSIStatL( temp1.toUtf8(), &psStatBuf ) == 0 &&
VSI_ISDIR( psStatBuf.st_mode ) )
{
// add directory entry
osTemp2.clear();
osTemp2.append( papszFiles1[i] );
osTemp2.append( "/" );
// oFiles.AddString( osTemp2.c_str() );
papszOFiles = CSLAddString( papszOFiles, osTemp2.c_str() );
temp2 = QString( "%1/" ).arg( papszFiles1[i] );
// oFiles.AddString( temp2.toUtf8() );
papszOFiles = CSLAddString( papszOFiles, temp2.toUtf8() );
// recursively add files inside directory
papszFiles2 = VSIReadDirRecursive1( osTemp1.c_str() );
papszFiles2 = VSIReadDirRecursive1( temp1.toUtf8() );
if ( papszFiles2 )
{
nCount2 = CSLCount( papszFiles2 );
for ( j = 0; j < nCount2; j++ )
{
osTemp2.clear();
osTemp2.append( papszFiles1[i] );
osTemp2.append( "/" );
osTemp2.append( papszFiles2[j] );
// oFiles.AddString( osTemp2.c_str() );
papszOFiles = CSLAddString( papszOFiles, osTemp2.c_str() );
temp2 = QString( "%1/%2" ).arg( papszFiles1[i], papszFiles2[j] );
// oFiles.AddString( temp2.toUtf8() );
papszOFiles = CSLAddString( papszOFiles, temp2.toUtf8() );
}
CSLDestroy( papszFiles2 );
}

View File

@ -55,7 +55,7 @@
#include <QDebug>
#include <gdalwarper.h>
#include <ogr_spatialref.h>
#include <ogr_srs_api.h>
#include <cpl_conv.h>
#include <cpl_string.h>

View File

@ -50,7 +50,7 @@
#endif
#include "gdalwarper.h"
#include "ogr_spatialref.h"
#include "ogr_srs_api.h"
#include "cpl_conv.h"
#include "cpl_string.h"