RemoteVstPlugin: open file with O_BINARY when reading/writing chunks
When writing chunk to file or read it back from file, open file with
O_BINARY flag. Otherwise on win32 for example line endings (\n) are
converted (\r\n) and with real binary data this screws up things.
Thanks to Oleg Sharonov for pointing this out.
Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
(cherry picked from commit 48a3d4ebe4)
This commit is contained in:
@@ -845,7 +845,7 @@ void RemoteVstPlugin::saveChunkToFile( const std::string & _file )
|
||||
const int len = pluginDispatch( 23, 0, 0, &chunk );
|
||||
if( len > 0 )
|
||||
{
|
||||
int fd = open( _file.c_str(), O_WRONLY );
|
||||
int fd = open( _file.c_str(), O_WRONLY | O_BINARY );
|
||||
write( fd, chunk, len );
|
||||
close( fd );
|
||||
}
|
||||
@@ -871,7 +871,7 @@ void RemoteVstPlugin::loadChunkFromFile( const std::string & _file, int _len )
|
||||
chunk = buf;
|
||||
}
|
||||
|
||||
const int fd = open( _file.c_str(), O_RDONLY );
|
||||
const int fd = open( _file.c_str(), O_RDONLY | O_BINARY );
|
||||
read( fd, chunk, _len );
|
||||
close( fd );
|
||||
pluginDispatch( 24, 0, _len, chunk );
|
||||
|
||||
Reference in New Issue
Block a user