aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/ByteArrayInputStream.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Minecraft.World/ByteArrayInputStream.cpp')
-rw-r--r--Minecraft.World/ByteArrayInputStream.cpp13
1 files changed, 1 insertions, 12 deletions
diff --git a/Minecraft.World/ByteArrayInputStream.cpp b/Minecraft.World/ByteArrayInputStream.cpp
index 9509206d..d79eff36 100644
--- a/Minecraft.World/ByteArrayInputStream.cpp
+++ b/Minecraft.World/ByteArrayInputStream.cpp
@@ -10,19 +10,8 @@
//offset - the offset in the buffer of the first byte to read.
//length - the maximum number of bytes to read from the buffer.
ByteArrayInputStream::ByteArrayInputStream(byteArray buf, unsigned int offset, unsigned int length)
- : pos(offset), mark(offset)
+ : pos( offset ), count( min( offset+length, buf.length ) ), mark( offset )
{
- if (offset > buf.length)
- {
- count = buf.length;
- }
- else if (length > buf.length - offset)
- {
- count = buf.length;
- }
- else
- {
- count = offset + length;
this->buf = buf;
}