From 42d0cdca591d3b6dd5a2235488161dd4027ef72d Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Fri, 14 Feb 2014 22:00:31 +0000 Subject: [PATCH] small fix and added a comment --- src/protocol.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/protocol.cpp b/src/protocol.cpp index 645f9cca..c4d5abf6 100755 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -1824,7 +1824,6 @@ bool CProtocol::ParseMessageFrame ( const CVector& vecbyData, int& iID ) { int i; - int iLenBy; int iCurPos; // vector must be at least "MESS_LEN_WITHOUT_DATA_BYTE" bytes long @@ -1853,7 +1852,7 @@ bool CProtocol::ParseMessageFrame ( const CVector& vecbyData, iCnt = static_cast ( GetValFromStream ( vecbyData, iCurPos, 1 ) ); // 2 bytes length - iLenBy = static_cast ( GetValFromStream ( vecbyData, iCurPos, 2 ) ); + const int iLenBy = static_cast ( GetValFromStream ( vecbyData, iCurPos, 2 ) ); // make sure the length is correct if ( iLenBy != iNumBytesIn - MESS_LEN_WITHOUT_DATA_BYTE ) @@ -1882,6 +1881,10 @@ bool CProtocol::ParseMessageFrame ( const CVector& vecbyData, // Extract actual data ----------------------------------------------------- + +// TODO this memory allocation is done in the real time thread but should be +// done in the low prioirity protocol management thread + vecbyMesBodyData.Init ( iLenBy ); iCurPos = MESS_HEADER_LENGTH_BYTE; // start from beginning of data