Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'CPP/7zip/Compress/LzOutWindow.h')
-rw-r--r--CPP/7zip/Compress/LzOutWindow.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/CPP/7zip/Compress/LzOutWindow.h b/CPP/7zip/Compress/LzOutWindow.h
index 507aa7f4..5591744d 100644
--- a/CPP/7zip/Compress/LzOutWindow.h
+++ b/CPP/7zip/Compress/LzOutWindow.h
@@ -35,10 +35,13 @@ public:
}
else do
{
+ UInt32 pos2;
if (pos == _bufSize)
pos = 0;
- _buf[_pos++] = _buf[pos++];
- if (_pos == _limitPos)
+ pos2 = _pos;
+ _buf[pos2++] = _buf[pos++];
+ _pos = pos2;
+ if (pos2 == _limitPos)
FlushWithCheck();
}
while (--len != 0);
@@ -47,15 +50,17 @@ public:
void PutByte(Byte b)
{
- _buf[_pos++] = b;
- if (_pos == _limitPos)
+ UInt32 pos = _pos;
+ _buf[pos++] = b;
+ _pos = pos;
+ if (pos == _limitPos)
FlushWithCheck();
}
Byte GetByte(UInt32 distance) const
{
UInt32 pos = _pos - distance - 1;
- if (pos >= _bufSize)
+ if (distance >= _pos)
pos += _bufSize;
return _buf[pos];
}