- バッファ X へバッファ A, B ……を代入。X の容量が少なければ終端(0xff)を設定。
- static void CopyBuffer(BYTE* lpDst, BYTE* lpSrc, int nLength);
BOOL InBuffer(int* lpRemainLength, BYTE* lpDst, int nDstLength, BYTE* lpSrc, int nSrcLength)
{
int n = nSrcLength - *lpRemainLength;
lpDst += nDstLength - *lpRemainLength;
if (n >= 0)
{
CopyBuffer( lpDst, lpSrc, -- *lpRemainLength );
lpDst[*lpRemainLength] = !n ? lpSrc[*lpRemainLength] : 0xff;
*lpRemainLength = 0;
return FALSE;
}
else
{
CopyBuffer( lpDst, lpSrc, nSrcLength );
*lpRemainLength -= nSrcLength;
return TRUE;
}
}
static void CopyBuffer(BYTE* lpDst, BYTE* lpSrc, int nLength)
{
while (nLength > 0)
{
*lpDst = *lpSrc;
lpDst ++;
lpSrc ++;
nLength --;
}
}