summaryrefslogtreecommitdiffstats
path: root/src/Stream.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-08-27 17:24:28 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-01-13 03:39:28 +0100
commit04ab1a3420b46af046a898ee5510e0d9b25ed24c (patch)
tree4e9d300bb38d434305d00337535c7c4077bc57c4 /src/Stream.cpp
parent2017-08-23 (diff)
downloadAltCraft-04ab1a3420b46af046a898ee5510e0d9b25ed24c.tar
AltCraft-04ab1a3420b46af046a898ee5510e0d9b25ed24c.tar.gz
AltCraft-04ab1a3420b46af046a898ee5510e0d9b25ed24c.tar.bz2
AltCraft-04ab1a3420b46af046a898ee5510e0d9b25ed24c.tar.lz
AltCraft-04ab1a3420b46af046a898ee5510e0d9b25ed24c.tar.xz
AltCraft-04ab1a3420b46af046a898ee5510e0d9b25ed24c.tar.zst
AltCraft-04ab1a3420b46af046a898ee5510e0d9b25ed24c.zip
Diffstat (limited to 'src/Stream.cpp')
-rw-r--r--src/Stream.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Stream.cpp b/src/Stream.cpp
index a44b91c..28680c6 100644
--- a/src/Stream.cpp
+++ b/src/Stream.cpp
@@ -281,8 +281,9 @@ void StreamOutput::WriteByteArray(std::vector<unsigned char> value) {
void StreamBuffer::ReadData(unsigned char *buffPtr, size_t buffLen) {
size_t bufferLengthLeft = buffer + bufferLength - bufferPtr;
+
if (bufferLengthLeft < buffLen)
- throw std::runtime_error("Required data is more, than in buffer available");
+ throw std::runtime_error("Internal error: StreamBuffer reader out of data");
std::memcpy(buffPtr, bufferPtr, buffLen);
bufferPtr += buffLen;
}
@@ -290,7 +291,7 @@ void StreamBuffer::ReadData(unsigned char *buffPtr, size_t buffLen) {
void StreamBuffer::WriteData(unsigned char *buffPtr, size_t buffLen) {
size_t bufferLengthLeft = buffer + bufferLength - bufferPtr;
if (bufferLengthLeft < buffLen)
- throw std::runtime_error("Required data is more, than in buffer available");
+ throw std::runtime_error("Internal error: StreamBuffer writer out of data");
std::memcpy(bufferPtr, buffPtr, buffLen);
bufferPtr += buffLen;
}