Skip to content

Commit abe89b6

Browse files
committed
avoid including GDAL C++ api (fixes #17849)
1 parent c4aa4d0 commit abe89b6

File tree

4 files changed

+17
-22
lines changed

4 files changed

+17
-22
lines changed

src/analysis/raster/qgsalignraster.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "qgsalignraster.h"
1717

1818
#include <gdalwarper.h>
19-
#include <ogr_spatialref.h>
19+
#include <ogr_srs_api.h>
2020
#include <cpl_conv.h>
2121
#include <limits>
2222

src/core/qgsdataitem.cpp

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "qgsanimatedicon.h"
4343

4444
// use GDAL VSI mechanism
45+
#define CPL_SUPRESS_CPLUSPLUS
4546
#include "cpl_vsi.h"
4647
#include "cpl_string.h"
4748

@@ -1329,7 +1330,7 @@ char **VSIReadDirRecursive1( const char *pszPath )
13291330
char **papszFiles1 = nullptr;
13301331
char **papszFiles2 = nullptr;
13311332
VSIStatBufL psStatBuf;
1332-
CPLString osTemp1, osTemp2;
1333+
QString temp1, temp2;
13331334
int i, j;
13341335
int nCount1, nCount2;
13351336

@@ -1343,41 +1344,35 @@ char **VSIReadDirRecursive1( const char *pszPath )
13431344
for ( i = 0; i < nCount1; i++ )
13441345
{
13451346
// build complete file name for stat
1346-
osTemp1.clear();
1347-
osTemp1.append( pszPath );
1348-
osTemp1.append( "/" );
1349-
osTemp1.append( papszFiles1[i] );
1347+
temp1 = QString( "%1/%2" ).arg( pszPath, papszFiles1[i] );
13501348

13511349
// if is file, add it
1352-
if ( VSIStatL( osTemp1.c_str(), &psStatBuf ) == 0 &&
1350+
if ( VSIStatL( temp1.toUtf8(), &psStatBuf ) == 0 &&
13531351
VSI_ISREG( psStatBuf.st_mode ) )
13541352
{
13551353
// oFiles.AddString( papszFiles1[i] );
13561354
papszOFiles = CSLAddString( papszOFiles, papszFiles1[i] );
13571355
}
1358-
else if ( VSIStatL( osTemp1.c_str(), &psStatBuf ) == 0 &&
1356+
else if ( VSIStatL( temp1.toUtf8(), &psStatBuf ) == 0 &&
13591357
VSI_ISDIR( psStatBuf.st_mode ) )
13601358
{
13611359
// add directory entry
1362-
osTemp2.clear();
1363-
osTemp2.append( papszFiles1[i] );
1364-
osTemp2.append( "/" );
1365-
// oFiles.AddString( osTemp2.c_str() );
1366-
papszOFiles = CSLAddString( papszOFiles, osTemp2.c_str() );
1360+
temp2 = QString( "%1/" ).arg( papszFiles1[i] );
1361+
1362+
// oFiles.AddString( temp2.toUtf8() );
1363+
papszOFiles = CSLAddString( papszOFiles, temp2.toUtf8() );
13671364

13681365
// recursively add files inside directory
1369-
papszFiles2 = VSIReadDirRecursive1( osTemp1.c_str() );
1366+
papszFiles2 = VSIReadDirRecursive1( temp1.toUtf8() );
13701367
if ( papszFiles2 )
13711368
{
13721369
nCount2 = CSLCount( papszFiles2 );
13731370
for ( j = 0; j < nCount2; j++ )
13741371
{
1375-
osTemp2.clear();
1376-
osTemp2.append( papszFiles1[i] );
1377-
osTemp2.append( "/" );
1378-
osTemp2.append( papszFiles2[j] );
1379-
// oFiles.AddString( osTemp2.c_str() );
1380-
papszOFiles = CSLAddString( papszOFiles, osTemp2.c_str() );
1372+
temp2 = QString( "%1/%2" ).arg( papszFiles1[i], papszFiles2[j] );
1373+
1374+
// oFiles.AddString( temp2.toUtf8() );
1375+
papszOFiles = CSLAddString( papszOFiles, temp2.toUtf8() );
13811376
}
13821377
CSLDestroy( papszFiles2 );
13831378
}

src/providers/gdal/qgsgdalprovider.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
#include <QDebug>
5656

5757
#include <gdalwarper.h>
58-
#include <ogr_spatialref.h>
58+
#include <ogr_srs_api.h>
5959
#include <cpl_conv.h>
6060
#include <cpl_string.h>
6161

src/providers/wcs/qgswcsprovider.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
#endif
5151

5252
#include "gdalwarper.h"
53-
#include "ogr_spatialref.h"
53+
#include "ogr_srs_api.h"
5454
#include "cpl_conv.h"
5555
#include "cpl_string.h"
5656

0 commit comments

Comments
 (0)