summaryrefslogtreecommitdiffstats
path: root/src/server
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-03-20 02:42:29 +0100
committerDavid Robillard <d@drobilla.net>2017-03-20 03:19:33 +0100
commit87e1afd4be4b7ff608d0d799597cc13df2bcdc43 (patch)
tree92cc5dd9dec1dd5828fbed20a3338afe7e77aaa2 /src/server
parent60759acb8f09fbdb8e07102aa2859ce3c804e04a (diff)
downloadingen-87e1afd4be4b7ff608d0d799597cc13df2bcdc43.tar.gz
ingen-87e1afd4be4b7ff608d0d799597cc13df2bcdc43.tar.bz2
ingen-87e1afd4be4b7ff608d0d799597cc13df2bcdc43.zip
Fix value buffer size logic
Diffstat (limited to 'src/server')
-rw-r--r--src/server/Buffer.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/server/Buffer.cpp b/src/server/Buffer.cpp
index 2f26eafb..7af3d47e 100644
--- a/src/server/Buffer.cpp
+++ b/src/server/Buffer.cpp
@@ -406,11 +406,12 @@ Buffer::set_value(const Atom& value)
return;
}
- if (value.size() > _value_buffer->size()) {
- _value_buffer = _factory.claim_buffer(value.type(), 0, value.size());
+ const uint32_t total_size = sizeof(LV2_Atom) + value.size();
+ if (total_size > _value_buffer->capacity()) {
+ _value_buffer = _factory.claim_buffer(value.type(), 0, total_size);
}
- memcpy(_value_buffer->get<LV2_Atom*>(), value.atom(), sizeof(LV2_Atom) + value.size());
+ memcpy(_value_buffer->get<LV2_Atom*>(), value.atom(), total_size);
}
void