From f9c7ce0ea87843549c99007ec51a8ef1ab0070de Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Fri, 17 Nov 2017 00:07:07 +0100 Subject: [PATCH] Ref T189, DWORD is unsigned --- .../simulator/fsxcommon/simulatorfsxcommon.cpp | 4 ++-- src/plugins/simulator/fsxcommon/simulatorfsxcommon.h | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/plugins/simulator/fsxcommon/simulatorfsxcommon.cpp b/src/plugins/simulator/fsxcommon/simulatorfsxcommon.cpp index b42d3adc9..ad009f424 100644 --- a/src/plugins/simulator/fsxcommon/simulatorfsxcommon.cpp +++ b/src/plugins/simulator/fsxcommon/simulatorfsxcommon.cpp @@ -1584,9 +1584,9 @@ namespace BlackSimPlugin { if (!m_traceSendId) { return; } if (MaxSendIdTraces < 1) { return; } - DWORD dwLastId = -1; + DWORD dwLastId = 0; const HRESULT hr = SimConnect_GetLastSentPacketID(m_hSimConnect, &dwLastId); - if (hr != S_OK || dwLastId < 0) { return; } + if (hr != S_OK) { return; } if (m_sendIdTraces.size() > MaxSendIdTraces) { m_sendIdTraces.removeFirst(); } const TraceFsxSendId trace(dwLastId, simObjectId, details.isEmpty() ? function : details + ", " + function); diff --git a/src/plugins/simulator/fsxcommon/simulatorfsxcommon.h b/src/plugins/simulator/fsxcommon/simulatorfsxcommon.h index 2b71e5b19..08b7fbf74 100644 --- a/src/plugins/simulator/fsxcommon/simulatorfsxcommon.h +++ b/src/plugins/simulator/fsxcommon/simulatorfsxcommon.h @@ -88,11 +88,15 @@ namespace BlackSimPlugin //! Ctor TraceFsxSendId(DWORD sendId, DWORD simObjectId, const QString &comment) : sendId(sendId), simObjectId(simObjectId), comment(comment) - { } + { + Q_ASSERT_X(sendId >= 0, Q_FUNC_INFO, "DWORD is unsigned"); + Q_ASSERT_X(simObjectId >= 0, Q_FUNC_INFO, "DWORD is unsigned"); + } - DWORD sendId = -1; //!< the send id - DWORD simObjectId = -1; //!< corresponding CSimConnectObject - QString comment; //!< where sent + // DWORD is unsigned + DWORD sendId = 0; //!< the send id + DWORD simObjectId = 0; //!< corresponding CSimConnectObject + QString comment; //!< where sent }; //! FSX Simulator Implementation