diff options
Diffstat (limited to 'K2LABI/ABI/ResultParser.cpp')
-rw-r--r-- | K2LABI/ABI/ResultParser.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/K2LABI/ABI/ResultParser.cpp b/K2LABI/ABI/ResultParser.cpp new file mode 100644 index 0000000..b5e39bc --- /dev/null +++ b/K2LABI/ABI/ResultParser.cpp @@ -0,0 +1,29 @@ +#include "k2l-type.h" +#include "ResultParser.h" +#include <string.h> + +BYTE* CResultParser::ToByteArray(ParamDef* pParams, int nParamCount, int& nResultLength) +{ + int nLength = 0; + for (int i = 0; i < nParamCount; i++) + { + nLength += pParams[i].m_nLength; + } + + BYTE* pBuffer = NULL; + if (nLength) + { + nLength = (nLength + 1) & ~1; + pBuffer = new BYTE[nLength]; + memset(pBuffer, 0, nLength); + BYTE* pTemBuf = pBuffer; + for(int i = 0; i < nParamCount; i++) + { + memcpy(pTemBuf, pParams[i].m_pData, pParams[i].m_nLength); + pTemBuf += pParams[i].m_nLength; + } + } + + nResultLength = nLength; + return pBuffer; +} |