4040#include " qgsconfig.h"
4141
4242// use GDAL VSI mechanism
43+ #define CPL_SUPRESS_CPLUSPLUS
4344#include " cpl_vsi.h"
4445#include " cpl_string.h"
4546
@@ -1301,7 +1302,7 @@ char **VSIReadDirRecursive1( const char *pszPath )
13011302 char **papszFiles1 = nullptr ;
13021303 char **papszFiles2 = nullptr ;
13031304 VSIStatBufL psStatBuf;
1304- CPLString osTemp1, osTemp2 ;
1305+ QString temp1, temp2 ;
13051306 int i, j;
13061307 int nCount1, nCount2;
13071308
@@ -1315,41 +1316,35 @@ char **VSIReadDirRecursive1( const char *pszPath )
13151316 for ( i = 0 ; i < nCount1; i++ )
13161317 {
13171318 // build complete file name for stat
1318- osTemp1.clear ();
1319- osTemp1.append ( pszPath );
1320- osTemp1.append ( " /" );
1321- osTemp1.append ( papszFiles1[i] );
1319+ temp1 = QString ( " %1/%2" ).arg ( pszPath, papszFiles1[i] );
13221320
13231321 // if is file, add it
1324- if ( VSIStatL ( osTemp1. c_str (), &psStatBuf ) == 0 &&
1322+ if ( VSIStatL ( temp1. toUtf8 (), &psStatBuf ) == 0 &&
13251323 VSI_ISREG ( psStatBuf.st_mode ) )
13261324 {
13271325 // oFiles.AddString( papszFiles1[i] );
13281326 papszOFiles = CSLAddString ( papszOFiles, papszFiles1[i] );
13291327 }
1330- else if ( VSIStatL ( osTemp1. c_str (), &psStatBuf ) == 0 &&
1328+ else if ( VSIStatL ( temp1. toUtf8 (), &psStatBuf ) == 0 &&
13311329 VSI_ISDIR ( psStatBuf.st_mode ) )
13321330 {
13331331 // add directory entry
1334- osTemp2.clear ();
1335- osTemp2.append ( papszFiles1[i] );
1336- osTemp2.append ( " /" );
1337- // oFiles.AddString( osTemp2.c_str() );
1338- papszOFiles = CSLAddString ( papszOFiles, osTemp2.c_str () );
1332+ temp2 = QString ( " %1/" ).arg ( papszFiles1[i] );
1333+
1334+ // oFiles.AddString( temp2.toUtf8() );
1335+ papszOFiles = CSLAddString ( papszOFiles, temp2.toUtf8 () );
13391336
13401337 // recursively add files inside directory
1341- papszFiles2 = VSIReadDirRecursive1 ( osTemp1. c_str () );
1338+ papszFiles2 = VSIReadDirRecursive1 ( temp1. toUtf8 () );
13421339 if ( papszFiles2 )
13431340 {
13441341 nCount2 = CSLCount ( papszFiles2 );
13451342 for ( j = 0 ; j < nCount2; j++ )
13461343 {
1347- osTemp2.clear ();
1348- osTemp2.append ( papszFiles1[i] );
1349- osTemp2.append ( " /" );
1350- osTemp2.append ( papszFiles2[j] );
1351- // oFiles.AddString( osTemp2.c_str() );
1352- papszOFiles = CSLAddString ( papszOFiles, osTemp2.c_str () );
1344+ temp2 = QString ( " %1/%2" ).arg ( papszFiles1[i], papszFiles2[j] );
1345+
1346+ // oFiles.AddString( temp2.toUtf8() );
1347+ papszOFiles = CSLAddString ( papszOFiles, temp2.toUtf8 () );
13531348 }
13541349 CSLDestroy ( papszFiles2 );
13551350 }
0 commit comments