Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions plugins/vst_base/RemoteVstPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,7 @@ void RemoteVstPlugin::init( const std::string & _plugin_file )

static void close_check( FILE* fp )
{
if (!fp) {return;}
if( fclose( fp ) )
{
perror( "close" );
Expand Down Expand Up @@ -1115,6 +1116,12 @@ void RemoteVstPlugin::saveChunkToFile( const std::string & _file )
if( len > 0 )
{
FILE* fp = F_OPEN_UTF8( _file, "wb" );
if (!fp)
{
fprintf( stderr,
"Error opening file for saving chunk.\n" );
return;
}
if ( fwrite( chunk, 1, len, fp ) != len )
{
fprintf( stderr,
Expand Down Expand Up @@ -1280,6 +1287,12 @@ void RemoteVstPlugin::savePreset( const std::string & _file )
pBank->numPrograms = endian_swap( uIntToFile );

FILE * stream = F_OPEN_UTF8( _file, "w" );
if (!stream)
{
fprintf( stderr,
"Error opening file for saving preset.\n" );
return;
}
fwrite ( pBank, 1, 28, stream );
fwrite ( progName, 1, isPreset ? 28 : 128, stream );
if ( chunky ) {
Expand Down Expand Up @@ -1332,6 +1345,12 @@ void RemoteVstPlugin::loadPresetFile( const std::string & _file )
unsigned int len = 0;
sBank * pBank = (sBank*) new char[ sizeof( sBank ) ];
FILE * stream = F_OPEN_UTF8( _file, "r" );
if (!stream)
{
fprintf( stderr,
"Error opening file for loading preset.\n" );
return;
}
if ( fread ( pBank, 1, 56, stream ) != 56 )
{
fprintf( stderr, "Error loading preset file.\n" );
Expand Down Expand Up @@ -1433,6 +1452,12 @@ void RemoteVstPlugin::loadChunkFromFile( const std::string & _file, int _len )
char * chunk = new char[_len];

FILE* fp = F_OPEN_UTF8( _file, "rb" );
if (!fp)
{
fprintf( stderr,
"Error opening file for loading chunk.\n" );
return;
}
if ( fread( chunk, 1, _len, fp ) != _len )
{
fprintf( stderr, "Error loading chunk from file.\n" );
Expand Down