From c1f5075e1693ba2d79bd81e4d4dce772d828a065 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Tue, 7 Jul 2009 17:05:31 +0200 Subject: [PATCH] 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 (cherry picked from commit 48a3d4ebe412c46473390a2467a638a8de8edbc1) --- plugins/vst_base/remote_vst_plugin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/vst_base/remote_vst_plugin.cpp b/plugins/vst_base/remote_vst_plugin.cpp index 956f82228..1dfdcdbf1 100644 --- a/plugins/vst_base/remote_vst_plugin.cpp +++ b/plugins/vst_base/remote_vst_plugin.cpp @@ -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 );