|
|
@ -345,18 +345,16 @@ public: |
|
|
|
|
|
|
|
|
|
|
|
// Read from the beginning of the buffer
|
|
|
|
// Read from the beginning of the buffer
|
|
|
|
unsigned int nReadPosNext = nReadPos + nSize; |
|
|
|
unsigned int nReadPosNext = nReadPos + nSize; |
|
|
|
if (nReadPosNext >= vch.size()) |
|
|
|
if (nReadPosNext > vch.size()) { |
|
|
|
|
|
|
|
throw std::ios_base::failure("CDataStream::read(): end of data"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
memcpy(pch, &vch[nReadPos], nSize); |
|
|
|
|
|
|
|
if (nReadPosNext == vch.size()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (nReadPosNext > vch.size()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
throw std::ios_base::failure("CDataStream::read(): end of data"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
memcpy(pch, &vch[nReadPos], nSize); |
|
|
|
|
|
|
|
nReadPos = 0; |
|
|
|
nReadPos = 0; |
|
|
|
vch.clear(); |
|
|
|
vch.clear(); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
memcpy(pch, &vch[nReadPos], nSize); |
|
|
|
|
|
|
|
nReadPos = nReadPosNext; |
|
|
|
nReadPos = nReadPosNext; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|