@@ -88,6 +88,7 @@ struct ERect
88
88
#include " lmms_basics.h"
89
89
#include " Midi.h"
90
90
#include " communication.h"
91
+ #include " IoHelper.h"
91
92
92
93
#include " VstSyncData.h"
93
94
@@ -678,9 +679,9 @@ void RemoteVstPlugin::init( const std::string & _plugin_file )
678
679
679
680
680
681
681
- static void close_check ( int fd )
682
+ static void close_check ( FILE* fp )
682
683
{
683
- if ( close ( fd ) )
684
+ if ( fclose ( fp ) )
684
685
{
685
686
perror ( " close" );
686
687
}
@@ -790,7 +791,7 @@ void RemoteVstPlugin::destroyEditor()
790
791
791
792
bool RemoteVstPlugin::load ( const std::string & _plugin_file )
792
793
{
793
- if ( ( m_libInst = LoadLibrary ( _plugin_file.c_str () ) ) == NULL )
794
+ if ( ( m_libInst = LoadLibraryW ( toWString ( _plugin_file) .c_str () ) ) == NULL )
794
795
{
795
796
// give VstPlugin class a chance to start 32 bit version of RemoteVstPlugin
796
797
if ( GetLastError () == ERROR_BAD_EXE_FORMAT )
@@ -1072,13 +1073,13 @@ void RemoteVstPlugin::saveChunkToFile( const std::string & _file )
1072
1073
const int len = pluginDispatch ( 23 , 0 , 0 , &chunk );
1073
1074
if ( len > 0 )
1074
1075
{
1075
- int fd = open ( _file. c_str (), O_WRONLY | O_BINARY );
1076
- if ( :: write ( fd, chunk, len ) != len )
1076
+ FILE* fp = F_OPEN_UTF8 ( _file, " wb " );
1077
+ if ( fwrite ( chunk, len, 1 , fp ) != len )
1077
1078
{
1078
1079
fprintf ( stderr,
1079
1080
" Error saving chunk to file.\n " );
1080
1081
}
1081
- close_check ( fd );
1082
+ close_check ( fp );
1082
1083
}
1083
1084
}
1084
1085
}
@@ -1237,7 +1238,7 @@ void RemoteVstPlugin::savePreset( const std::string & _file )
1237
1238
if (!isPreset &&!chunky) uIntToFile = (unsigned int ) m_plugin->numPrograms ;
1238
1239
pBank->numPrograms = endian_swap ( uIntToFile );
1239
1240
1240
- FILE * stream = fopen ( _file. c_str () , " w" );
1241
+ FILE * stream = F_OPEN_UTF8 ( _file, " w" );
1241
1242
fwrite ( pBank, 1 , 28 , stream );
1242
1243
fwrite ( progName, 1 , isPreset ? 28 : 128 , stream );
1243
1244
if ( chunky ) {
@@ -1289,7 +1290,7 @@ void RemoteVstPlugin::loadPresetFile( const std::string & _file )
1289
1290
unsigned int * pLen = new unsigned int [ 1 ];
1290
1291
unsigned int len = 0 ;
1291
1292
sBank * pBank = (sBank *) new char [ sizeof ( sBank ) ];
1292
- FILE * stream = fopen ( _file. c_str () , " r" );
1293
+ FILE * stream = F_OPEN_UTF8 ( _file, " r" );
1293
1294
if ( fread ( pBank, 1 , 56 , stream ) != 56 )
1294
1295
{
1295
1296
fprintf ( stderr, " Error loading preset file.\n " );
@@ -1390,12 +1391,12 @@ void RemoteVstPlugin::loadChunkFromFile( const std::string & _file, int _len )
1390
1391
{
1391
1392
char * chunk = new char [_len];
1392
1393
1393
- const int fd = open ( _file. c_str (), O_RDONLY | O_BINARY );
1394
- if ( :: read ( fd, chunk , _len ) != _len )
1394
+ FILE* fp = F_OPEN_UTF8 ( _file, " rb " );
1395
+ if ( fread ( chunk, 1 , _len, fp ) != _len )
1395
1396
{
1396
1397
fprintf ( stderr, " Error loading chunk from file.\n " );
1397
1398
}
1398
- close_check ( fd );
1399
+ close_check ( fp );
1399
1400
1400
1401
pluginDispatch ( effSetChunk, 0 , _len, chunk );
1401
1402
0 commit comments