aboutsummaryrefslogtreecommitdiff
path: root/CPP/7zip/Compress/PpmdZip.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--CPP/7zip/Compress/PpmdZip.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/CPP/7zip/Compress/PpmdZip.cpp b/CPP/7zip/Compress/PpmdZip.cpp
index 5039131..e59e52f 100644
--- a/CPP/7zip/Compress/PpmdZip.cpp
+++ b/CPP/7zip/Compress/PpmdZip.cpp
@@ -12,6 +12,15 @@
12namespace NCompress { 12namespace NCompress {
13namespace NPpmdZip { 13namespace NPpmdZip {
14 14
15static const UInt32 kBufSize = 1 << 20;
16
17bool CBuf::Alloc()
18{
19 if (!Buf)
20 Buf = (Byte *)::MidAlloc(kBufSize);
21 return (Buf != NULL);
22}
23
15CDecoder::CDecoder(bool fullFileMode): 24CDecoder::CDecoder(bool fullFileMode):
16 _fullFileMode(fullFileMode) 25 _fullFileMode(fullFileMode)
17{ 26{
@@ -255,7 +264,10 @@ Z7_COM7F_IMF(CEncoder::Code(ISequentialInStream *inStream, ISequentialOutStream
255 Ppmd8_Init(&_ppmd, (unsigned)_props.Order, (unsigned)_props.Restor); 264 Ppmd8_Init(&_ppmd, (unsigned)_props.Order, (unsigned)_props.Restor);
256 265
257 { 266 {
258 const UInt32 val = (UInt32)(((unsigned)_props.Order - 1) + ((_props.MemSizeMB - 1) << 4) + ((unsigned)_props.Restor << 12)); 267 const unsigned val =
268 ((unsigned)_props.Order - 1)
269 + (((unsigned)_props.MemSizeMB - 1) << 4)
270 + ((unsigned)_props.Restor << 12);
259 _outStream.WriteByte((Byte)(val & 0xFF)); 271 _outStream.WriteByte((Byte)(val & 0xFF));
260 _outStream.WriteByte((Byte)(val >> 8)); 272 _outStream.WriteByte((Byte)(val >> 8));
261 } 273 }
@@ -294,7 +306,4 @@ Z7_COM7F_IMF(CEncoder::Code(ISequentialInStream *inStream, ISequentialOutStream
294 } 306 }
295} 307}
296 308
297
298
299
300}} 309}}