diff options
author | Andre Hartmann <aha_1980@gmx.de> | 2020-02-24 09:15:49 +0100 |
---|---|---|
committer | Andre Hartmann <aha_1980@gmx.de> | 2020-02-24 15:32:54 +0100 |
commit | 25ca4c9aba7f3bcc8c59b622990d1becc9293ac8 (patch) | |
tree | dcc9faeac8c95c9c83c8d0ba3751e3062adf9468 /src/plugins/canbus/tinycan | |
parent | a3aa54e27094b80feae4e42c5f7e22c3d4022b49 (diff) |
Init API structs without memset
Continuation of a3aa54e
Change-Id: Ic6daa7a754f3c869094770ea3e47a097bf4afa84
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/plugins/canbus/tinycan')
-rw-r--r-- | src/plugins/canbus/tinycan/tinycanbackend.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/plugins/canbus/tinycan/tinycanbackend.cpp b/src/plugins/canbus/tinycan/tinycanbackend.cpp index fdd5aaa..62da66d 100644 --- a/src/plugins/canbus/tinycan/tinycanbackend.cpp +++ b/src/plugins/canbus/tinycan/tinycanbackend.cpp @@ -352,8 +352,7 @@ void TinyCanBackendPrivate::startWrite() const QCanBusFrame frame = q->dequeueOutgoingFrame(); const QByteArray payload = frame.payload(); - TCanMsg message; - ::memset(&message, 0, sizeof(message)); + TCanMsg message = {}; if (Q_UNLIKELY(payload.size() > int(sizeof(message.Data.Bytes)))) { qCWarning(QT_CANBUS_PLUGINS_TINYCAN, "Cannot write frame with payload size %d.", payload.size()); @@ -389,16 +388,14 @@ void TinyCanBackendPrivate::startRead() if (!::CanReceiveGetCount(channelIndex)) break; - TCanMsg message; - ::memset(&message, 0, sizeof(message)); + TCanMsg message = {}; const int messagesToRead = 1; const int ret = ::CanReceive(channelIndex, &message, messagesToRead); if (Q_UNLIKELY(ret < 0)) { q->setError(systemErrorString(ret), QCanBusDevice::CanBusError::ReadError); - TDeviceStatus status; - ::memset(&status, 0, sizeof(status)); + TDeviceStatus status = {}; if (::CanGetDeviceStatus(channelIndex, &status) < 0) { q->setError(systemErrorString(ret), QCanBusDevice::CanBusError::ReadError); |