@@ -388,7 +388,7 @@ bool QgsRasterLayer::isValidRasterFileName(QString const & theFileNameQString)
388
388
GDALAllRegister ();
389
389
390
390
// open the file using gdal making sure we have handled locale properly
391
- myDataset = GDALOpen ( ( const char *)( theFileNameQString. toLocal8Bit (). data () ), GA_ReadOnly );
391
+ myDataset = GDALOpen ( QFile::encodeName ( theFileNameQString). constData ( ), GA_ReadOnly );
392
392
if ( myDataset == NULL )
393
393
{
394
394
return false ;
@@ -489,7 +489,7 @@ QgsRasterLayer::readFile( QString const & fileName )
489
489
GDALAllRegister ();
490
490
491
491
// open the dataset making sure we handle char encoding of locale properly
492
- gdalDataset = (GDALDataset *) GDALOpen (( const char *)( fileName. toLocal8Bit (). data () ), GA_ReadOnly);
492
+ gdalDataset = (GDALDataset *) GDALOpen (QFile::encodeName ( fileName). constData ( ), GA_ReadOnly);
493
493
494
494
if (gdalDataset == NULL )
495
495
{
@@ -4132,7 +4132,7 @@ void QgsRasterLayer::buildPyramids(RasterPyramidList const & theRasterPyramidLis
4132
4132
GDALAllRegister ();
4133
4133
// close the gdal dataset and reopen it in read / write mode
4134
4134
delete gdalDataset;
4135
- gdalDataset = (GDALDataset *) GDALOpen (dataSource. toLocal8Bit (). data (), GA_Update);
4135
+ gdalDataset = (GDALDataset *) GDALOpen (QFile::encodeName (dataSource). constData (), GA_Update);
4136
4136
4137
4137
// if the dataset couldn't be opened in read / write mode, tell the user
4138
4138
if (!gdalDataset) {
@@ -4145,7 +4145,7 @@ void QgsRasterLayer::buildPyramids(RasterPyramidList const & theRasterPyramidLis
4145
4145
Qt::NoButton,
4146
4146
Qt::NoButton );
4147
4147
myMessageBox.exec ();
4148
- gdalDataset = (GDALDataset *) GDALOpen (dataSource. toLocal8Bit (). data (), GA_ReadOnly);
4148
+ gdalDataset = (GDALDataset *) GDALOpen (QFile::encodeName (dataSource). constData (), GA_ReadOnly);
4149
4149
return ;
4150
4150
}
4151
4151
@@ -4215,7 +4215,7 @@ void QgsRasterLayer::buildPyramids(RasterPyramidList const & theRasterPyramidLis
4215
4215
Qt::NoButton );
4216
4216
myMessageBox.exec ();
4217
4217
delete gdalDataset;
4218
- gdalDataset = (GDALDataset *) GDALOpen (dataSource. toLocal8Bit (). data (), GA_ReadOnly);
4218
+ gdalDataset = (GDALDataset *) GDALOpen (QFile::encodeName (dataSource). constData (), GA_ReadOnly);
4219
4219
emit setProgress (0 ,0 );
4220
4220
return ;
4221
4221
}
@@ -4232,7 +4232,7 @@ void QgsRasterLayer::buildPyramids(RasterPyramidList const & theRasterPyramidLis
4232
4232
QgsDebugMsg (" Pyramid overviews built" );
4233
4233
// close the gdal dataset and reopen it in read only mode
4234
4234
delete gdalDataset;
4235
- gdalDataset = (GDALDataset *) GDALOpen (dataSource. toLocal8Bit (). data (), GA_ReadOnly);
4235
+ gdalDataset = (GDALDataset *) GDALOpen (QFile::encodeName (dataSource). constData (), GA_ReadOnly);
4236
4236
emit setProgress (0 ,0 );
4237
4237
QApplication::restoreOverrideCursor ();
4238
4238
}
0 commit comments