diff --git a/src/common/serialization/vst3/base.cpp b/src/common/serialization/vst3/base.cpp index 0ba0ad31..0ef96324 100644 --- a/src/common/serialization/vst3/base.cpp +++ b/src/common/serialization/vst3/base.cpp @@ -193,7 +193,7 @@ VectorStream::VectorStream(Steinberg::IBStream* stream) { int64 size; assert(stream->tell(&size) == Steinberg::kResultOk); - int32 num_bytes_read; + int32 num_bytes_read = 0; buffer.resize(size); assert(stream->seek(0, Steinberg::IBStream::IStreamSeekMode::kIBSeekSet) == Steinberg::kResultOk); @@ -227,14 +227,12 @@ tresult VectorStream::write_back(Steinberg::IBStream* stream) const { return Steinberg::kInvalidArgument; } - int32 num_bytes_written; + int32 num_bytes_written = 0; assert(stream->seek(0, kIBSeekSet) == Steinberg::kResultOk); - // When writing zero bytes, some hosts will return `kResultFalse` - if (stream->write(const_cast(buffer.data()), buffer.size(), - &num_bytes_written) == Steinberg::kResultOk) { - assert(num_bytes_written == 0 || - static_cast(num_bytes_written) == buffer.size()); - } + assert(stream->write(const_cast(buffer.data()), buffer.size(), + &num_bytes_written) == Steinberg::kResultOk); + assert(num_bytes_written == 0 || + static_cast(num_bytes_written) == buffer.size()); return Steinberg::kResultOk; } @@ -276,7 +274,7 @@ tresult PLUGIN_API VectorStream::write(void* buffer, } std::copy_n(reinterpret_cast(buffer), numBytes, - &this->buffer[seek_position]); + this->buffer.begin() + seek_position); seek_position += numBytes; if (numBytesWritten) { diff --git a/src/common/serialization/vst3/base.h b/src/common/serialization/vst3/base.h index 414c8105..7c8d8319 100644 --- a/src/common/serialization/vst3/base.h +++ b/src/common/serialization/vst3/base.h @@ -225,7 +225,7 @@ class VectorStream : public Steinberg::IBStream, private: std::vector buffer; - size_t seek_position; + size_t seek_position = 0; }; #pragma GCC diagnostic pop diff --git a/src/wine-host/bridges/vst3.cpp b/src/wine-host/bridges/vst3.cpp index f857521e..c5decbce 100644 --- a/src/wine-host/bridges/vst3.cpp +++ b/src/wine-host/bridges/vst3.cpp @@ -139,7 +139,7 @@ void Vst3Bridge::run() { }, [&](Vst3PluginProxy::GetState& request) -> Vst3PluginProxy::GetState::Response { - VectorStream stream; + VectorStream stream{}; tresult result; // This same function is defined in both `IComponent` and @@ -288,6 +288,8 @@ void Vst3Bridge::run() { // and pass that to the initialize function. This object should // be cleaned up again during `Vst3PluginProxy::Destruct`. // TODO: This needs changing when we get to `Vst3HostProxy` + // TODO: Does this have to be run from the UI thread? Figure out + // if it does Steinberg::FUnknown* context = nullptr; if (request.host_application_context_args) { object_instances[request.instance_id]