Skip to content

Commit

Permalink
backport changes from QGIS (#493)
Browse files Browse the repository at this point in the history
  • Loading branch information
JanCaha authored Nov 6, 2024
1 parent e781a53 commit 4f5c52d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion mdal/frmts/mdal_h2i.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ bool MDAL::DriverH2i::parseJsonFile( const std::string filePath, MetadataH2i &me
metadata.dirPath = MDAL::dirName( filePath );

}
catch ( Json::exception &e )
catch ( Json::exception & )
{
return false;
}
Expand Down
14 changes: 8 additions & 6 deletions mdal/mdal_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
#include <stdlib.h>

#ifdef _MSC_VER
#ifndef UNICODE
#define UNICODE
#endif
#include <locale>
#include <codecvt>
#include <stringapiset.h>
Expand Down Expand Up @@ -1145,12 +1147,12 @@ std::vector<std::string> MDAL::Library::libraryFilesInDir( const std::string &di
{
std::vector<std::string> filesList;
#ifdef _WIN32
WIN32_FIND_DATA data;
WIN32_FIND_DATAA data;
HANDLE hFind;
std::string pattern = dirPath;
pattern.push_back( '*' );

hFind = FindFirstFile( pattern.c_str(), &data );
hFind = FindFirstFileA( pattern.c_str(), &data );

if ( hFind == INVALID_HANDLE_VALUE )
return filesList;
Expand All @@ -1161,7 +1163,7 @@ std::vector<std::string> MDAL::Library::libraryFilesInDir( const std::string &di
if ( !fileName.empty() && fileExtension( fileName ) == ".dll" )
filesList.push_back( fileName );
}
while ( FindNextFile( hFind, &data ) != 0 );
while ( FindNextFileA( hFind, &data ) != 0 );

FindClose( hFind );
#else
Expand All @@ -1172,8 +1174,8 @@ std::vector<std::string> MDAL::Library::libraryFilesInDir( const std::string &di
std::string fileName( de->d_name );
if ( !fileName.empty() )
{
std::string extentsion = fileExtension( fileName );
if ( extentsion == ".so" || extentsion == ".dylib" )
std::string extension = fileExtension( fileName );
if ( extension == ".so" || extension == ".dylib" )
filesList.push_back( fileName );
}
de = readdir( dir );
Expand All @@ -1192,7 +1194,7 @@ bool MDAL::Library::loadLibrary()
#ifdef _WIN32
UINT uOldErrorMode =
SetErrorMode( SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS );
d->mLibrary = LoadLibrary( d->mLibraryFile.c_str() );
d->mLibrary = LoadLibraryA( d->mLibraryFile.c_str() );
SetErrorMode( uOldErrorMode );
#else
d->mLibrary = dlopen( d->mLibraryFile.c_str(), RTLD_LAZY );
Expand Down

0 comments on commit 4f5c52d

Please sign in to comment.