Here is a proposed patch to plugins/ola/olaouthread.cpp. It is untested because I have not been able to get a clean build of QLC+ on my machine.
Code: Select all
*** olaoutthread.cpp.orig 2015-07-10 23:49:43.000000000 -0700
--- olaoutthread.cpp 2015-07-10 23:54:48.000000000 -0700
***************
*** 104,113 ****
*/
int OlaOutThread::write_dmx(unsigned int universe, const QByteArray& data)
{
- m_data.universe = universe;
- memcpy(m_data.data, data.data(), data.size());
if (m_pipe)
m_pipe->Send((uint8_t*) &m_data, sizeof(m_data));
return 0;
}
--- 104,123 ----
*/
int OlaOutThread::write_dmx(unsigned int universe, const QByteArray& data)
{
if (m_pipe)
+ {
+ const int src_sz = data.size();
+ Q_ASSERT(src_sz <= sizeof(m_data.data));
+
+ m_data.universe = universe;
+ memcpy(m_data.data, data.data(), src_sz);
+
+ // if a full src buffer was not provided, fill the rest of the dst buffer with zeroes.
+ if (src_sz < sizeof(m_data.data))
+ memset(m_data.data+src_sz, 0, sizeof(m_data.data)-src_sz);
+
m_pipe->Send((uint8_t*) &m_data, sizeof(m_data));
+ }
return 0;
}