@@ -1342,71 +1342,6 @@ void QgsZipItem::init()
1342
1342
1343
1343
}
1344
1344
1345
- // internal function to scan a vsidir (zip or tar file) recursively
1346
- // GDAL trunk has this since r24423 (05/16/12) - VSIReadDirRecursive()
1347
- // use a copy of the function internally for now,
1348
- // but use char ** and CSLAddString, because CPLStringList was added in gdal-1.9
1349
- char **VSIReadDirRecursive1 ( const char *pszPath )
1350
- {
1351
- // CPLStringList oFiles = nullptr;
1352
- char **papszOFiles = nullptr ;
1353
- char **papszFiles1 = nullptr ;
1354
- char **papszFiles2 = nullptr ;
1355
- VSIStatBufL psStatBuf;
1356
- QString temp1, temp2;
1357
- int i, j;
1358
- int nCount1, nCount2;
1359
-
1360
- // get listing
1361
- papszFiles1 = VSIReadDir ( pszPath );
1362
- if ( ! papszFiles1 )
1363
- return nullptr ;
1364
-
1365
- // get files and directories inside listing
1366
- nCount1 = CSLCount ( papszFiles1 );
1367
- for ( i = 0 ; i < nCount1; i++ )
1368
- {
1369
- // build complete file name for stat
1370
- temp1 = QString ( " %1/%2" ).arg ( pszPath, papszFiles1[i] );
1371
-
1372
- // if is file, add it
1373
- if ( VSIStatL ( temp1.toUtf8 (), &psStatBuf ) == 0 &&
1374
- VSI_ISREG ( psStatBuf.st_mode ) )
1375
- {
1376
- // oFiles.AddString( papszFiles1[i] );
1377
- papszOFiles = CSLAddString ( papszOFiles, papszFiles1[i] );
1378
- }
1379
- else if ( VSIStatL ( temp1.toUtf8 (), &psStatBuf ) == 0 &&
1380
- VSI_ISDIR ( psStatBuf.st_mode ) )
1381
- {
1382
- // add directory entry
1383
- temp2 = QString ( " %1/" ).arg ( papszFiles1[i] );
1384
-
1385
- // oFiles.AddString( temp2.toUtf8() );
1386
- papszOFiles = CSLAddString ( papszOFiles, temp2.toUtf8 () );
1387
-
1388
- // recursively add files inside directory
1389
- papszFiles2 = VSIReadDirRecursive1 ( temp1.toUtf8 () );
1390
- if ( papszFiles2 )
1391
- {
1392
- nCount2 = CSLCount ( papszFiles2 );
1393
- for ( j = 0 ; j < nCount2; j++ )
1394
- {
1395
- temp2 = QString ( " %1/%2" ).arg ( papszFiles1[i], papszFiles2[j] );
1396
-
1397
- // oFiles.AddString( temp2.toUtf8() );
1398
- papszOFiles = CSLAddString ( papszOFiles, temp2.toUtf8 () );
1399
- }
1400
- CSLDestroy ( papszFiles2 );
1401
- }
1402
- }
1403
- }
1404
- CSLDestroy ( papszFiles1 );
1405
-
1406
- // return oFiles.StealList();
1407
- return papszOFiles;
1408
- }
1409
-
1410
1345
QVector<QgsDataItem *> QgsZipItem::createChildren ()
1411
1346
{
1412
1347
QVector<QgsDataItem *> children;
@@ -1599,10 +1534,10 @@ QStringList QgsZipItem::getZipFileList()
1599
1534
1600
1535
// get list of files inside zip file
1601
1536
QgsDebugMsgLevel ( QString ( " Open file %1 with gdal vsi" ).arg ( mVsiPrefix + mFilePath ), 3 );
1602
- char **papszSiblingFiles = VSIReadDirRecursive1 ( QString ( mVsiPrefix + mFilePath ).toLocal8Bit ().constData () );
1537
+ char **papszSiblingFiles = VSIReadDirRecursive ( QString ( mVsiPrefix + mFilePath ).toLocal8Bit ().constData () );
1603
1538
if ( papszSiblingFiles )
1604
1539
{
1605
- for ( int i = 0 ; i < CSLCount ( papszSiblingFiles ) ; i++ )
1540
+ for ( int i = 0 ; papszSiblingFiles[i] ; i++ )
1606
1541
{
1607
1542
tmpPath = papszSiblingFiles[i];
1608
1543
QgsDebugMsgLevel ( QString ( " Read file %1" ).arg ( tmpPath ), 3 );
0 commit comments