seven-zip 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/ci.yml +31 -0
- data/.github/workflows/release.yml +30 -0
- data/.gitignore +27 -0
- data/.travis.yml +35 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +20 -0
- data/README.md +204 -0
- data/Rakefile +79 -0
- data/ext/C/Types.h +254 -0
- data/ext/CPP/7zip/Archive/IArchive.h +234 -0
- data/ext/CPP/7zip/IDecl.h +15 -0
- data/ext/CPP/7zip/IPassword.h +24 -0
- data/ext/CPP/7zip/IProgress.h +33 -0
- data/ext/CPP/7zip/IStream.h +58 -0
- data/ext/CPP/7zip/PropID.h +76 -0
- data/ext/CPP/Common/MyCom.h +225 -0
- data/ext/CPP/Common/MyGuidDef.h +54 -0
- data/ext/CPP/Common/MyInitGuid.h +22 -0
- data/ext/CPP/Common/MyUnknown.h +13 -0
- data/ext/CPP/Common/MyWindows.h +204 -0
- data/ext/CPP/Common/Types.h +11 -0
- data/ext/CPP/Windows/PropVariant.h +56 -0
- data/ext/CPP/include_windows/basetyps.h +19 -0
- data/ext/CPP/include_windows/tchar.h +89 -0
- data/ext/CPP/include_windows/windows.h +194 -0
- data/ext/p7zip/Asm/x64/7zCrcT8U.asm +103 -0
- data/ext/p7zip/Asm/x86/7zCrcT8U.asm +101 -0
- data/ext/p7zip/C/7zBuf.h +39 -0
- data/ext/p7zip/C/7zBuf2.c +45 -0
- data/ext/p7zip/C/7zCrc.c +76 -0
- data/ext/p7zip/C/7zCrc.h +25 -0
- data/ext/p7zip/C/7zCrcOpt.c +34 -0
- data/ext/p7zip/C/7zCrcT8.c +43 -0
- data/ext/p7zip/C/7zStream.c +169 -0
- data/ext/p7zip/C/7zVersion.h +7 -0
- data/ext/p7zip/C/Aes.c +284 -0
- data/ext/p7zip/C/Aes.h +38 -0
- data/ext/p7zip/C/Alloc.back3 +238 -0
- data/ext/p7zip/C/Alloc.c +280 -0
- data/ext/p7zip/C/Alloc.c.back +243 -0
- data/ext/p7zip/C/Alloc.c.back2 +222 -0
- data/ext/p7zip/C/Alloc.h +27 -0
- data/ext/p7zip/C/Bra.c +133 -0
- data/ext/p7zip/C/Bra.h +68 -0
- data/ext/p7zip/C/Bra86.c +85 -0
- data/ext/p7zip/C/BraIA64.c +67 -0
- data/ext/p7zip/C/BwtSort.c +516 -0
- data/ext/p7zip/C/BwtSort.h +30 -0
- data/ext/p7zip/C/CpuArch.c +168 -0
- data/ext/p7zip/C/CpuArch.h +155 -0
- data/ext/p7zip/C/Delta.c +62 -0
- data/ext/p7zip/C/Delta.h +23 -0
- data/ext/p7zip/C/HuffEnc.c +146 -0
- data/ext/p7zip/C/HuffEnc.h +27 -0
- data/ext/p7zip/C/LzFind.c +761 -0
- data/ext/p7zip/C/LzFind.h +115 -0
- data/ext/p7zip/C/LzFindMt.c +793 -0
- data/ext/p7zip/C/LzFindMt.h +105 -0
- data/ext/p7zip/C/LzHash.h +54 -0
- data/ext/p7zip/C/Lzma2Dec.c +356 -0
- data/ext/p7zip/C/Lzma2Dec.h +84 -0
- data/ext/p7zip/C/Lzma2Enc.c +477 -0
- data/ext/p7zip/C/Lzma2Enc.h +66 -0
- data/ext/p7zip/C/LzmaDec.c +999 -0
- data/ext/p7zip/C/LzmaDec.h +231 -0
- data/ext/p7zip/C/LzmaEnc.c +2268 -0
- data/ext/p7zip/C/LzmaEnc.h +80 -0
- data/ext/p7zip/C/LzmaUtil/Lzma86Dec.c +61 -0
- data/ext/p7zip/C/LzmaUtil/Lzma86Dec.h +51 -0
- data/ext/p7zip/C/LzmaUtil/Lzma86Enc.c +113 -0
- data/ext/p7zip/C/LzmaUtil/Lzma86Enc.h +78 -0
- data/ext/p7zip/C/MtCoder.c +327 -0
- data/ext/p7zip/C/MtCoder.h +98 -0
- data/ext/p7zip/C/Ppmd.h +85 -0
- data/ext/p7zip/C/Ppmd7.c +708 -0
- data/ext/p7zip/C/Ppmd7.h +140 -0
- data/ext/p7zip/C/Ppmd7Dec.c +187 -0
- data/ext/p7zip/C/Ppmd7Enc.c +185 -0
- data/ext/p7zip/C/Ppmd8.c +1120 -0
- data/ext/p7zip/C/Ppmd8.h +133 -0
- data/ext/p7zip/C/Ppmd8Dec.c +155 -0
- data/ext/p7zip/C/Ppmd8Enc.c +161 -0
- data/ext/p7zip/C/RotateDefs.h +20 -0
- data/ext/p7zip/C/Sha256.c +204 -0
- data/ext/p7zip/C/Sha256.h +26 -0
- data/ext/p7zip/C/Sort.c +93 -0
- data/ext/p7zip/C/Sort.h +20 -0
- data/ext/p7zip/C/Threads.c +582 -0
- data/ext/p7zip/C/Threads.h +123 -0
- data/ext/p7zip/C/Types.h +254 -0
- data/ext/p7zip/C/Xz.c +88 -0
- data/ext/p7zip/C/Xz.h +252 -0
- data/ext/p7zip/C/XzCrc64.c +33 -0
- data/ext/p7zip/C/XzCrc64.h +26 -0
- data/ext/p7zip/C/XzDec.c +875 -0
- data/ext/p7zip/C/XzEnc.c +497 -0
- data/ext/p7zip/C/XzEnc.h +25 -0
- data/ext/p7zip/C/XzIn.c +306 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zCompressionMode.cpp +3 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zCompressionMode.h +50 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zDecode.cpp +332 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zDecode.h +68 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zEncode.cpp +444 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zEncode.h +55 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zExtract.cpp +270 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderInStream.cpp +123 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderInStream.h +58 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderOutStream.cpp +149 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderOutStream.h +58 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zHandler.cpp +482 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zHandler.h +119 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zHandlerOut.cpp +483 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zHeader.cpp +14 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zHeader.h +97 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zIn.cpp +1276 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zIn.h +245 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zItem.h +268 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zOut.cpp +866 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zOut.h +152 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zProperties.cpp +164 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zProperties.h +22 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zRegister.cpp +18 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zSpecStream.cpp +24 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zSpecStream.h +35 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zUpdate.cpp +1216 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zUpdate.h +88 -0
- data/ext/p7zip/CPP/7zip/Archive/ApmHandler.cpp +356 -0
- data/ext/p7zip/CPP/7zip/Archive/ArchiveExports.cpp +135 -0
- data/ext/p7zip/CPP/7zip/Archive/ArjHandler.cpp +798 -0
- data/ext/p7zip/CPP/7zip/Archive/Bz2Handler.cpp +423 -0
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabBlockInStream.cpp +189 -0
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabBlockInStream.h +44 -0
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabHandler.cpp +929 -0
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabHandler.h +28 -0
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabHeader.cpp +15 -0
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabHeader.h +44 -0
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabIn.cpp +272 -0
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabIn.h +161 -0
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabItem.h +63 -0
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabRegister.cpp +13 -0
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHandler.cpp +721 -0
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHandler.h +29 -0
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHeader.cpp +24 -0
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHeader.h +28 -0
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmIn.cpp +937 -0
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmIn.h +244 -0
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmRegister.cpp +13 -0
- data/ext/p7zip/CPP/7zip/Archive/Com/ComHandler.cpp +239 -0
- data/ext/p7zip/CPP/7zip/Archive/Com/ComHandler.h +28 -0
- data/ext/p7zip/CPP/7zip/Archive/Com/ComIn.cpp +389 -0
- data/ext/p7zip/CPP/7zip/Archive/Com/ComIn.h +119 -0
- data/ext/p7zip/CPP/7zip/Archive/Com/ComRegister.cpp +13 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2.cpp +121 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2.h +174 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2MT.cpp +240 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2MT.h +80 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2ST.cpp +239 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2ST.h +88 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/CrossThreadProgress.cpp +15 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/CrossThreadProgress.h +37 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/DummyOutStream.cpp +22 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/DummyOutStream.h +24 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/FindSignature.cpp +62 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/FindSignature.h +12 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/HandlerOut.cpp +623 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/HandlerOut.h +87 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/InStreamWithCRC.cpp +42 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/InStreamWithCRC.h +67 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/ItemNameUtils.cpp +61 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/ItemNameUtils.h +24 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/MultiStream.cpp +190 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/MultiStream.h +84 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp +18 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/OutStreamWithCRC.h +36 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/OutStreamWithSha1.cpp +18 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/OutStreamWithSha1.h +36 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/ParseProperties.cpp +177 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/ParseProperties.h +18 -0
- data/ext/p7zip/CPP/7zip/Archive/CpioHandler.cpp +624 -0
- data/ext/p7zip/CPP/7zip/Archive/CramfsHandler.cpp +644 -0
- data/ext/p7zip/CPP/7zip/Archive/DebHandler.cpp +413 -0
- data/ext/p7zip/CPP/7zip/Archive/DeflateProps.cpp +118 -0
- data/ext/p7zip/CPP/7zip/Archive/DeflateProps.h +35 -0
- data/ext/p7zip/CPP/7zip/Archive/DllExports2.cpp +76 -0
- data/ext/p7zip/CPP/7zip/Archive/DmgHandler.cpp +918 -0
- data/ext/p7zip/CPP/7zip/Archive/ElfHandler.cpp +534 -0
- data/ext/p7zip/CPP/7zip/Archive/FatHandler.cpp +996 -0
- data/ext/p7zip/CPP/7zip/Archive/FlvHandler.cpp +544 -0
- data/ext/p7zip/CPP/7zip/Archive/GzHandler.cpp +698 -0
- data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsHandler.cpp +243 -0
- data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsHandler.h +26 -0
- data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsIn.cpp +480 -0
- data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsIn.h +154 -0
- data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsRegister.cpp +13 -0
- data/ext/p7zip/CPP/7zip/Archive/IArchive.h +234 -0
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHandler.cpp +326 -0
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHandler.h +30 -0
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHeader.cpp +21 -0
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHeader.h +61 -0
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoIn.cpp +453 -0
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoIn.h +315 -0
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoItem.h +141 -0
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoRegister.cpp +13 -0
- data/ext/p7zip/CPP/7zip/Archive/LzhHandler.cpp +775 -0
- data/ext/p7zip/CPP/7zip/Archive/LzmaHandler.cpp +430 -0
- data/ext/p7zip/CPP/7zip/Archive/MachoHandler.cpp +500 -0
- data/ext/p7zip/CPP/7zip/Archive/MbrHandler.cpp +507 -0
- data/ext/p7zip/CPP/7zip/Archive/MslzHandler.cpp +257 -0
- data/ext/p7zip/CPP/7zip/Archive/MubHandler.cpp +266 -0
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisDecode.cpp +130 -0
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisDecode.h +47 -0
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisHandler.cpp +510 -0
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisHandler.h +43 -0
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisIn.cpp +1461 -0
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisIn.h +181 -0
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisRegister.cpp +13 -0
- data/ext/p7zip/CPP/7zip/Archive/NtfsHandler.cpp +1764 -0
- data/ext/p7zip/CPP/7zip/Archive/PeHandler.cpp +1752 -0
- data/ext/p7zip/CPP/7zip/Archive/PpmdHandler.cpp +456 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarHandler.cpp +869 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarHandler.h +66 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarHeader.cpp +21 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarHeader.h +205 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarIn.cpp +478 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarIn.h +123 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarItem.cpp +55 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarItem.h +79 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarRegister.cpp +13 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarVolumeInStream.cpp +78 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarVolumeInStream.h +49 -0
- data/ext/p7zip/CPP/7zip/Archive/RpmHandler.cpp +292 -0
- data/ext/p7zip/CPP/7zip/Archive/SplitHandler.cpp +366 -0
- data/ext/p7zip/CPP/7zip/Archive/SquashfsHandler.cpp +2155 -0
- data/ext/p7zip/CPP/7zip/Archive/SwfHandler.cpp +706 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarHandler.cpp +386 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarHandler.h +61 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarHandlerOut.cpp +122 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarHeader.cpp +25 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarHeader.h +108 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarIn.cpp +207 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarIn.h +17 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarItem.h +72 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarOut.cpp +187 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarOut.h +28 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarRegister.cpp +18 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarUpdate.cpp +139 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarUpdate.h +34 -0
- data/ext/p7zip/CPP/7zip/Archive/Udf/UdfHandler.cpp +451 -0
- data/ext/p7zip/CPP/7zip/Archive/Udf/UdfHandler.h +37 -0
- data/ext/p7zip/CPP/7zip/Archive/Udf/UdfIn.cpp +876 -0
- data/ext/p7zip/CPP/7zip/Archive/Udf/UdfIn.h +375 -0
- data/ext/p7zip/CPP/7zip/Archive/Udf/UdfRegister.cpp +13 -0
- data/ext/p7zip/CPP/7zip/Archive/VhdHandler.cpp +734 -0
- data/ext/p7zip/CPP/7zip/Archive/Wim/WimHandler.cpp +660 -0
- data/ext/p7zip/CPP/7zip/Archive/Wim/WimHandler.h +77 -0
- data/ext/p7zip/CPP/7zip/Archive/Wim/WimHandlerOut.cpp +639 -0
- data/ext/p7zip/CPP/7zip/Archive/Wim/WimIn.cpp +855 -0
- data/ext/p7zip/CPP/7zip/Archive/Wim/WimIn.h +297 -0
- data/ext/p7zip/CPP/7zip/Archive/Wim/WimRegister.cpp +18 -0
- data/ext/p7zip/CPP/7zip/Archive/XarHandler.cpp +588 -0
- data/ext/p7zip/CPP/7zip/Archive/XzHandler.cpp +707 -0
- data/ext/p7zip/CPP/7zip/Archive/ZHandler.cpp +161 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipAddCommon.cpp +379 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipAddCommon.h +56 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipCompressionMode.h +42 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHandler.cpp +822 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHandler.h +101 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp +537 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHeader.cpp +36 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHeader.h +284 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipIn.cpp +893 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipIn.h +125 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipItem.cpp +181 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipItem.h +281 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipItemEx.h +34 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipOut.cpp +289 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipOut.h +56 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipRegister.cpp +18 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipUpdate.cpp +1076 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipUpdate.h +58 -0
- data/ext/p7zip/CPP/7zip/Bundles/Format7zFree/makefile +328 -0
- data/ext/p7zip/CPP/7zip/Bundles/Format7zFree/makefile.depend +4962 -0
- data/ext/p7zip/CPP/7zip/Bundles/Format7zFree/makefile.list +265 -0
- data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_7zFM.txt +163 -0
- data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_7zG.txt +131 -0
- data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_7za.txt +253 -0
- data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_ALL.txt +32 -0
- data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_Format7zFree.txt +290 -0
- data/ext/p7zip/CPP/7zip/CMAKE/generate.sh +37 -0
- data/ext/p7zip/CPP/7zip/CMAKE/generate_xcode.sh +32 -0
- data/ext/p7zip/CPP/7zip/Common/CWrappers.cpp +226 -0
- data/ext/p7zip/CPP/7zip/Common/CWrappers.h +109 -0
- data/ext/p7zip/CPP/7zip/Common/CreateCoder.cpp +293 -0
- data/ext/p7zip/CPP/7zip/Common/CreateCoder.h +98 -0
- data/ext/p7zip/CPP/7zip/Common/FilePathAutoRename.cpp +55 -0
- data/ext/p7zip/CPP/7zip/Common/FilePathAutoRename.h +10 -0
- data/ext/p7zip/CPP/7zip/Common/FileStreams.cpp +273 -0
- data/ext/p7zip/CPP/7zip/Common/FileStreams.h +134 -0
- data/ext/p7zip/CPP/7zip/Common/FilterCoder.cpp +247 -0
- data/ext/p7zip/CPP/7zip/Common/FilterCoder.h +128 -0
- data/ext/p7zip/CPP/7zip/Common/InBuffer.cpp +83 -0
- data/ext/p7zip/CPP/7zip/Common/InBuffer.h +81 -0
- data/ext/p7zip/CPP/7zip/Common/InOutTempBuffer.cpp +122 -0
- data/ext/p7zip/CPP/7zip/Common/InOutTempBuffer.h +48 -0
- data/ext/p7zip/CPP/7zip/Common/LimitedStreams.cpp +154 -0
- data/ext/p7zip/CPP/7zip/Common/LimitedStreams.h +125 -0
- data/ext/p7zip/CPP/7zip/Common/LockedStream.cpp +23 -0
- data/ext/p7zip/CPP/7zip/Common/LockedStream.h +38 -0
- data/ext/p7zip/CPP/7zip/Common/MemBlocks.cpp +183 -0
- data/ext/p7zip/CPP/7zip/Common/MemBlocks.h +71 -0
- data/ext/p7zip/CPP/7zip/Common/MethodId.cpp +27 -0
- data/ext/p7zip/CPP/7zip/Common/MethodId.h +10 -0
- data/ext/p7zip/CPP/7zip/Common/MethodProps.cpp +99 -0
- data/ext/p7zip/CPP/7zip/Common/MethodProps.h +41 -0
- data/ext/p7zip/CPP/7zip/Common/OffsetStream.cpp +35 -0
- data/ext/p7zip/CPP/7zip/Common/OffsetStream.h +25 -0
- data/ext/p7zip/CPP/7zip/Common/OutBuffer.cpp +116 -0
- data/ext/p7zip/CPP/7zip/Common/OutBuffer.h +64 -0
- data/ext/p7zip/CPP/7zip/Common/OutMemStream.cpp +142 -0
- data/ext/p7zip/CPP/7zip/Common/OutMemStream.h +96 -0
- data/ext/p7zip/CPP/7zip/Common/ProgressMt.cpp +53 -0
- data/ext/p7zip/CPP/7zip/Common/ProgressMt.h +46 -0
- data/ext/p7zip/CPP/7zip/Common/ProgressUtils.cpp +42 -0
- data/ext/p7zip/CPP/7zip/Common/ProgressUtils.h +34 -0
- data/ext/p7zip/CPP/7zip/Common/RegisterArc.h +32 -0
- data/ext/p7zip/CPP/7zip/Common/RegisterCodec.h +33 -0
- data/ext/p7zip/CPP/7zip/Common/StreamBinder.cpp +152 -0
- data/ext/p7zip/CPP/7zip/Common/StreamBinder.h +38 -0
- data/ext/p7zip/CPP/7zip/Common/StreamObjects.cpp +221 -0
- data/ext/p7zip/CPP/7zip/Common/StreamObjects.h +135 -0
- data/ext/p7zip/CPP/7zip/Common/StreamUtils.cpp +56 -0
- data/ext/p7zip/CPP/7zip/Common/StreamUtils.h +13 -0
- data/ext/p7zip/CPP/7zip/Common/VirtThread.cpp +46 -0
- data/ext/p7zip/CPP/7zip/Common/VirtThread.h +23 -0
- data/ext/p7zip/CPP/7zip/Compress/ArjDecoder1.cpp +309 -0
- data/ext/p7zip/CPP/7zip/Compress/ArjDecoder1.h +98 -0
- data/ext/p7zip/CPP/7zip/Compress/ArjDecoder2.cpp +90 -0
- data/ext/p7zip/CPP/7zip/Compress/ArjDecoder2.h +59 -0
- data/ext/p7zip/CPP/7zip/Compress/BZip2Const.h +54 -0
- data/ext/p7zip/CPP/7zip/Compress/BZip2Crc.cpp +26 -0
- data/ext/p7zip/CPP/7zip/Compress/BZip2Crc.h +31 -0
- data/ext/p7zip/CPP/7zip/Compress/BZip2Decoder.cpp +943 -0
- data/ext/p7zip/CPP/7zip/Compress/BZip2Decoder.h +205 -0
- data/ext/p7zip/CPP/7zip/Compress/BZip2Encoder.cpp +895 -0
- data/ext/p7zip/CPP/7zip/Compress/BZip2Encoder.h +245 -0
- data/ext/p7zip/CPP/7zip/Compress/BZip2Register.cpp +20 -0
- data/ext/p7zip/CPP/7zip/Compress/Bcj2Coder.cpp +386 -0
- data/ext/p7zip/CPP/7zip/Compress/Bcj2Coder.h +115 -0
- data/ext/p7zip/CPP/7zip/Compress/Bcj2Register.cpp +19 -0
- data/ext/p7zip/CPP/7zip/Compress/BcjCoder.cpp +15 -0
- data/ext/p7zip/CPP/7zip/Compress/BcjCoder.h +19 -0
- data/ext/p7zip/CPP/7zip/Compress/BcjRegister.cpp +19 -0
- data/ext/p7zip/CPP/7zip/Compress/BitlDecoder.cpp +24 -0
- data/ext/p7zip/CPP/7zip/Compress/BitlDecoder.h +141 -0
- data/ext/p7zip/CPP/7zip/Compress/BitlEncoder.h +57 -0
- data/ext/p7zip/CPP/7zip/Compress/BitmDecoder.h +66 -0
- data/ext/p7zip/CPP/7zip/Compress/BitmEncoder.h +50 -0
- data/ext/p7zip/CPP/7zip/Compress/BranchCoder.cpp +19 -0
- data/ext/p7zip/CPP/7zip/Compress/BranchCoder.h +44 -0
- data/ext/p7zip/CPP/7zip/Compress/BranchMisc.cpp +37 -0
- data/ext/p7zip/CPP/7zip/Compress/BranchMisc.h +14 -0
- data/ext/p7zip/CPP/7zip/Compress/BranchRegister.cpp +30 -0
- data/ext/p7zip/CPP/7zip/Compress/ByteSwap.cpp +73 -0
- data/ext/p7zip/CPP/7zip/Compress/CodecExports.cpp +160 -0
- data/ext/p7zip/CPP/7zip/Compress/CopyCoder.cpp +67 -0
- data/ext/p7zip/CPP/7zip/Compress/CopyCoder.h +34 -0
- data/ext/p7zip/CPP/7zip/Compress/CopyRegister.cpp +14 -0
- data/ext/p7zip/CPP/7zip/Compress/Deflate64Register.cpp +20 -0
- data/ext/p7zip/CPP/7zip/Compress/DeflateConst.h +134 -0
- data/ext/p7zip/CPP/7zip/Compress/DeflateDecoder.cpp +353 -0
- data/ext/p7zip/CPP/7zip/Compress/DeflateDecoder.h +157 -0
- data/ext/p7zip/CPP/7zip/Compress/DeflateEncoder.cpp +986 -0
- data/ext/p7zip/CPP/7zip/Compress/DeflateEncoder.h +211 -0
- data/ext/p7zip/CPP/7zip/Compress/DeflateRegister.cpp +21 -0
- data/ext/p7zip/CPP/7zip/Compress/DeltaFilter.cpp +112 -0
- data/ext/p7zip/CPP/7zip/Compress/DllExports.cpp +39 -0
- data/ext/p7zip/CPP/7zip/Compress/DllExports2.cpp +28 -0
- data/ext/p7zip/CPP/7zip/Compress/HuffmanDecoder.h +89 -0
- data/ext/p7zip/CPP/7zip/Compress/ImplodeDecoder.cpp +219 -0
- data/ext/p7zip/CPP/7zip/Compress/ImplodeDecoder.h +57 -0
- data/ext/p7zip/CPP/7zip/Compress/ImplodeHuffmanDecoder.cpp +89 -0
- data/ext/p7zip/CPP/7zip/Compress/ImplodeHuffmanDecoder.h +34 -0
- data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp +531 -0
- data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp +1018 -0
- data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBench.h +48 -0
- data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.cpp +311 -0
- data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.h +20 -0
- data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/makefile +173 -0
- data/ext/p7zip/CPP/7zip/Compress/LzOutWindow.cpp +14 -0
- data/ext/p7zip/CPP/7zip/Compress/LzOutWindow.h +66 -0
- data/ext/p7zip/CPP/7zip/Compress/LzhDecoder.cpp +220 -0
- data/ext/p7zip/CPP/7zip/Compress/LzhDecoder.h +106 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzma2Decoder.cpp +189 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzma2Decoder.h +73 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzma2Encoder.cpp +94 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzma2Encoder.h +36 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzma2Register.cpp +20 -0
- data/ext/p7zip/CPP/7zip/Compress/LzmaDecoder.cpp +252 -0
- data/ext/p7zip/CPP/7zip/Compress/LzmaDecoder.h +84 -0
- data/ext/p7zip/CPP/7zip/Compress/LzmaEncoder.cpp +149 -0
- data/ext/p7zip/CPP/7zip/Compress/LzmaEncoder.h +36 -0
- data/ext/p7zip/CPP/7zip/Compress/LzmaRegister.cpp +20 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzx.h +61 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzx86Converter.cpp +90 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzx86Converter.h +46 -0
- data/ext/p7zip/CPP/7zip/Compress/LzxDecoder.cpp +387 -0
- data/ext/p7zip/CPP/7zip/Compress/LzxDecoder.h +159 -0
- data/ext/p7zip/CPP/7zip/Compress/Mtf8.h +193 -0
- data/ext/p7zip/CPP/7zip/Compress/PpmdDecoder.cpp +167 -0
- data/ext/p7zip/CPP/7zip/Compress/PpmdDecoder.h +78 -0
- data/ext/p7zip/CPP/7zip/Compress/PpmdEncoder.cpp +119 -0
- data/ext/p7zip/CPP/7zip/Compress/PpmdEncoder.h +48 -0
- data/ext/p7zip/CPP/7zip/Compress/PpmdRegister.cpp +21 -0
- data/ext/p7zip/CPP/7zip/Compress/PpmdZip.cpp +223 -0
- data/ext/p7zip/CPP/7zip/Compress/PpmdZip.h +72 -0
- data/ext/p7zip/CPP/7zip/Compress/QuantumDecoder.cpp +175 -0
- data/ext/p7zip/CPP/7zip/Compress/QuantumDecoder.h +264 -0
- data/ext/p7zip/CPP/7zip/Compress/RangeCoder.h +205 -0
- data/ext/p7zip/CPP/7zip/Compress/RangeCoderBit.h +114 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar/makefile +34 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar/makefile.depend +158 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar/makefile.list +64 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar1Decoder.cpp +480 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar1Decoder.h +88 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar2Decoder.cpp +391 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar2Decoder.h +174 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar3Decoder.cpp +897 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar3Decoder.h +267 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar3Vm.cpp +1091 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar3Vm.h +179 -0
- data/ext/p7zip/CPP/7zip/Compress/RarCodecsRegister.cpp +26 -0
- data/ext/p7zip/CPP/7zip/Compress/ShrinkDecoder.cpp +145 -0
- data/ext/p7zip/CPP/7zip/Compress/ShrinkDecoder.h +38 -0
- data/ext/p7zip/CPP/7zip/Compress/ZDecoder.cpp +159 -0
- data/ext/p7zip/CPP/7zip/Compress/ZDecoder.h +42 -0
- data/ext/p7zip/CPP/7zip/Compress/ZlibDecoder.cpp +89 -0
- data/ext/p7zip/CPP/7zip/Compress/ZlibDecoder.h +48 -0
- data/ext/p7zip/CPP/7zip/Compress/ZlibEncoder.cpp +61 -0
- data/ext/p7zip/CPP/7zip/Compress/ZlibEncoder.h +48 -0
- data/ext/p7zip/CPP/7zip/Crypto/7zAes.cpp +244 -0
- data/ext/p7zip/CPP/7zip/Crypto/7zAes.h +117 -0
- data/ext/p7zip/CPP/7zip/Crypto/7zAesRegister.cpp +18 -0
- data/ext/p7zip/CPP/7zip/Crypto/HmacSha1.cpp +109 -0
- data/ext/p7zip/CPP/7zip/Crypto/HmacSha1.h +39 -0
- data/ext/p7zip/CPP/7zip/Crypto/MyAes.cpp +48 -0
- data/ext/p7zip/CPP/7zip/Crypto/MyAes.h +38 -0
- data/ext/p7zip/CPP/7zip/Crypto/Pbkdf2HmacSha1.cpp +83 -0
- data/ext/p7zip/CPP/7zip/Crypto/Pbkdf2HmacSha1.h +21 -0
- data/ext/p7zip/CPP/7zip/Crypto/RandGen.cpp +107 -0
- data/ext/p7zip/CPP/7zip/Crypto/RandGen.h +21 -0
- data/ext/p7zip/CPP/7zip/Crypto/Rar20Crypto.cpp +133 -0
- data/ext/p7zip/CPP/7zip/Crypto/Rar20Crypto.h +50 -0
- data/ext/p7zip/CPP/7zip/Crypto/RarAes.cpp +134 -0
- data/ext/p7zip/CPP/7zip/Crypto/RarAes.h +47 -0
- data/ext/p7zip/CPP/7zip/Crypto/Sha1.cpp +229 -0
- data/ext/p7zip/CPP/7zip/Crypto/Sha1.h +68 -0
- data/ext/p7zip/CPP/7zip/Crypto/WzAes.cpp +221 -0
- data/ext/p7zip/CPP/7zip/Crypto/WzAes.h +125 -0
- data/ext/p7zip/CPP/7zip/Crypto/ZipCrypto.cpp +88 -0
- data/ext/p7zip/CPP/7zip/Crypto/ZipCrypto.h +56 -0
- data/ext/p7zip/CPP/7zip/Crypto/ZipStrong.cpp +164 -0
- data/ext/p7zip/CPP/7zip/Crypto/ZipStrong.h +47 -0
- data/ext/p7zip/CPP/7zip/Guid.txt +170 -0
- data/ext/p7zip/CPP/7zip/ICoder.h +186 -0
- data/ext/p7zip/CPP/7zip/IDecl.h +15 -0
- data/ext/p7zip/CPP/7zip/IPassword.h +24 -0
- data/ext/p7zip/CPP/7zip/IProgress.h +33 -0
- data/ext/p7zip/CPP/7zip/IStream.h +58 -0
- data/ext/p7zip/CPP/7zip/MyVersion.h +11 -0
- data/ext/p7zip/CPP/7zip/PREMAKE/generate.sh +18 -0
- data/ext/p7zip/CPP/7zip/PREMAKE/premake4.lua +263 -0
- data/ext/p7zip/CPP/7zip/PropID.h +76 -0
- data/ext/p7zip/CPP/7zip/QMAKE/7ZA/7ZA.pro +228 -0
- data/ext/p7zip/CPP/7zip/QMAKE/7ZA/7ZA_osx.pro +228 -0
- data/ext/p7zip/CPP/7zip/QMAKE/test_emul/test_emul.pro +26 -0
- data/ext/p7zip/CPP/7zip/TEST/TestUI/TestUI.cpp +560 -0
- data/ext/p7zip/CPP/7zip/TEST/TestUI/makefile +33 -0
- data/ext/p7zip/CPP/7zip/TEST/TestUI/makefile.depend +577 -0
- data/ext/p7zip/CPP/7zip/TEST/TestUI/makefile.list +16 -0
- data/ext/p7zip/CPP/Common/AutoPtr.h +35 -0
- data/ext/p7zip/CPP/Common/Buffer.h +77 -0
- data/ext/p7zip/CPP/Common/CRC.cpp +7 -0
- data/ext/p7zip/CPP/Common/C_FileIO.cpp +88 -0
- data/ext/p7zip/CPP/Common/C_FileIO.h +47 -0
- data/ext/p7zip/CPP/Common/ComTry.h +18 -0
- data/ext/p7zip/CPP/Common/CommandLineParser.cpp +230 -0
- data/ext/p7zip/CPP/Common/CommandLineParser.h +72 -0
- data/ext/p7zip/CPP/Common/Defs.h +20 -0
- data/ext/p7zip/CPP/Common/DynamicBuffer.h +50 -0
- data/ext/p7zip/CPP/Common/IntToString.cpp +77 -0
- data/ext/p7zip/CPP/Common/IntToString.h +19 -0
- data/ext/p7zip/CPP/Common/Lang.cpp +130 -0
- data/ext/p7zip/CPP/Common/Lang.h +28 -0
- data/ext/p7zip/CPP/Common/ListFileUtils.cpp +75 -0
- data/ext/p7zip/CPP/Common/ListFileUtils.h +11 -0
- data/ext/p7zip/CPP/Common/MyCom.h +225 -0
- data/ext/p7zip/CPP/Common/MyException.h +14 -0
- data/ext/p7zip/CPP/Common/MyGuidDef.h +54 -0
- data/ext/p7zip/CPP/Common/MyInitGuid.h +22 -0
- data/ext/p7zip/CPP/Common/MyMap.cpp +140 -0
- data/ext/p7zip/CPP/Common/MyMap.h +28 -0
- data/ext/p7zip/CPP/Common/MyString.cpp +206 -0
- data/ext/p7zip/CPP/Common/MyString.h +601 -0
- data/ext/p7zip/CPP/Common/MyUnknown.h +13 -0
- data/ext/p7zip/CPP/Common/MyVector.cpp +87 -0
- data/ext/p7zip/CPP/Common/MyVector.h +266 -0
- data/ext/p7zip/CPP/Common/MyWindows.cpp +111 -0
- data/ext/p7zip/CPP/Common/MyWindows.h +218 -0
- data/ext/p7zip/CPP/Common/MyXml.cpp +209 -0
- data/ext/p7zip/CPP/Common/MyXml.h +40 -0
- data/ext/p7zip/CPP/Common/NewHandler.h +16 -0
- data/ext/p7zip/CPP/Common/StdInStream.cpp +100 -0
- data/ext/p7zip/CPP/Common/StdInStream.h +32 -0
- data/ext/p7zip/CPP/Common/StdOutStream.cpp +93 -0
- data/ext/p7zip/CPP/Common/StdOutStream.h +35 -0
- data/ext/p7zip/CPP/Common/StringConvert.cpp +181 -0
- data/ext/p7zip/CPP/Common/StringConvert.h +73 -0
- data/ext/p7zip/CPP/Common/StringToInt.cpp +90 -0
- data/ext/p7zip/CPP/Common/StringToInt.h +18 -0
- data/ext/p7zip/CPP/Common/TextConfig.cpp +138 -0
- data/ext/p7zip/CPP/Common/TextConfig.h +22 -0
- data/ext/p7zip/CPP/Common/Types.h +11 -0
- data/ext/p7zip/CPP/Common/UTFConvert.cpp +145 -0
- data/ext/p7zip/CPP/Common/UTFConvert.h +11 -0
- data/ext/p7zip/CPP/Common/Wildcard.cpp +462 -0
- data/ext/p7zip/CPP/Common/Wildcard.h +80 -0
- data/ext/p7zip/CPP/Windows/COM.cpp +37 -0
- data/ext/p7zip/CPP/Windows/COM.h +69 -0
- data/ext/p7zip/CPP/Windows/Clipboard.cpp +160 -0
- data/ext/p7zip/CPP/Windows/Clipboard.h +28 -0
- data/ext/p7zip/CPP/Windows/CommonDialog.h +19 -0
- data/ext/p7zip/CPP/Windows/Control/ComboBox.h +82 -0
- data/ext/p7zip/CPP/Windows/Control/Controls.cpp +515 -0
- data/ext/p7zip/CPP/Windows/Control/Dialog.cpp +560 -0
- data/ext/p7zip/CPP/Windows/Control/Dialog.h +179 -0
- data/ext/p7zip/CPP/Windows/Control/DialogImpl.h +73 -0
- data/ext/p7zip/CPP/Windows/Control/Edit.h +24 -0
- data/ext/p7zip/CPP/Windows/Control/ListView.h +164 -0
- data/ext/p7zip/CPP/Windows/Control/ProgressBar.h +34 -0
- data/ext/p7zip/CPP/Windows/Control/Static.h +23 -0
- data/ext/p7zip/CPP/Windows/Control/StatusBar.h +56 -0
- data/ext/p7zip/CPP/Windows/Control/Window2.cpp +211 -0
- data/ext/p7zip/CPP/Windows/Control/Window2.h +111 -0
- data/ext/p7zip/CPP/Windows/DLL.cpp +193 -0
- data/ext/p7zip/CPP/Windows/DLL.h +48 -0
- data/ext/p7zip/CPP/Windows/Defs.h +17 -0
- data/ext/p7zip/CPP/Windows/Error.cpp +58 -0
- data/ext/p7zip/CPP/Windows/Error.h +33 -0
- data/ext/p7zip/CPP/Windows/FileDir.cpp +927 -0
- data/ext/p7zip/CPP/Windows/FileDir.h +115 -0
- data/ext/p7zip/CPP/Windows/FileFind.cpp +604 -0
- data/ext/p7zip/CPP/Windows/FileFind.h +126 -0
- data/ext/p7zip/CPP/Windows/FileIO.cpp +475 -0
- data/ext/p7zip/CPP/Windows/FileIO.h +110 -0
- data/ext/p7zip/CPP/Windows/FileName.cpp +50 -0
- data/ext/p7zip/CPP/Windows/FileName.h +27 -0
- data/ext/p7zip/CPP/Windows/Menu.h +4 -0
- data/ext/p7zip/CPP/Windows/NtCheck.h +44 -0
- data/ext/p7zip/CPP/Windows/PropVariant.cpp +243 -0
- data/ext/p7zip/CPP/Windows/PropVariant.h +56 -0
- data/ext/p7zip/CPP/Windows/PropVariantConversions.cpp +142 -0
- data/ext/p7zip/CPP/Windows/PropVariantConversions.h +14 -0
- data/ext/p7zip/CPP/Windows/PropVariantUtils.cpp +78 -0
- data/ext/p7zip/CPP/Windows/PropVariantUtils.h +28 -0
- data/ext/p7zip/CPP/Windows/Registry.cpp +313 -0
- data/ext/p7zip/CPP/Windows/Registry.h +113 -0
- data/ext/p7zip/CPP/Windows/ResourceString.h +22 -0
- data/ext/p7zip/CPP/Windows/Shell.h +21 -0
- data/ext/p7zip/CPP/Windows/Synchronization.cpp +157 -0
- data/ext/p7zip/CPP/Windows/Synchronization.h +187 -0
- data/ext/p7zip/CPP/Windows/Synchronization2.h +218 -0
- data/ext/p7zip/CPP/Windows/System.cpp +166 -0
- data/ext/p7zip/CPP/Windows/System.h +16 -0
- data/ext/p7zip/CPP/Windows/Thread.h +41 -0
- data/ext/p7zip/CPP/Windows/Time.cpp +88 -0
- data/ext/p7zip/CPP/Windows/Time.h +21 -0
- data/ext/p7zip/CPP/Windows/Window.cpp +101 -0
- data/ext/p7zip/CPP/Windows/Window.h +43 -0
- data/ext/p7zip/CPP/include_windows/basetyps.h +19 -0
- data/ext/p7zip/CPP/include_windows/tchar.h +89 -0
- data/ext/p7zip/CPP/include_windows/windows.h +194 -0
- data/ext/p7zip/CPP/myWindows/StdAfx.h +124 -0
- data/ext/p7zip/CPP/myWindows/config.h +67 -0
- data/ext/p7zip/CPP/myWindows/initguid.h +4 -0
- data/ext/p7zip/CPP/myWindows/makefile +21 -0
- data/ext/p7zip/CPP/myWindows/makefile.depend +32 -0
- data/ext/p7zip/CPP/myWindows/makefile.list +28 -0
- data/ext/p7zip/CPP/myWindows/myAddExeFlag.cpp +20 -0
- data/ext/p7zip/CPP/myWindows/myGetTickCount.cpp +8 -0
- data/ext/p7zip/CPP/myWindows/myPrivate.h +17 -0
- data/ext/p7zip/CPP/myWindows/mySplitCommandLine.cpp +82 -0
- data/ext/p7zip/CPP/myWindows/test_emul.cpp +745 -0
- data/ext/p7zip/CPP/myWindows/wine_GetXXXDefaultLangID.cpp +741 -0
- data/ext/p7zip/CPP/myWindows/wine_date_and_time.cpp +434 -0
- data/ext/p7zip/ChangeLog +914 -0
- data/ext/p7zip/DOCS/7zC.txt +194 -0
- data/ext/p7zip/DOCS/7zFormat.txt +469 -0
- data/ext/p7zip/DOCS/License.txt +52 -0
- data/ext/p7zip/DOCS/MANUAL/commands/add.htm +87 -0
- data/ext/p7zip/DOCS/MANUAL/commands/bench.htm +79 -0
- data/ext/p7zip/DOCS/MANUAL/commands/delete.htm +59 -0
- data/ext/p7zip/DOCS/MANUAL/commands/extract.htm +91 -0
- data/ext/p7zip/DOCS/MANUAL/commands/extract_full.htm +68 -0
- data/ext/p7zip/DOCS/MANUAL/commands/index.htm +33 -0
- data/ext/p7zip/DOCS/MANUAL/commands/list.htm +77 -0
- data/ext/p7zip/DOCS/MANUAL/commands/style.css +232 -0
- data/ext/p7zip/DOCS/MANUAL/commands/test.htm +46 -0
- data/ext/p7zip/DOCS/MANUAL/commands/update.htm +66 -0
- data/ext/p7zip/DOCS/MANUAL/exit_codes.htm +27 -0
- data/ext/p7zip/DOCS/MANUAL/index.htm +29 -0
- data/ext/p7zip/DOCS/MANUAL/style.css +232 -0
- data/ext/p7zip/DOCS/MANUAL/switches/ar_exclude.htm +56 -0
- data/ext/p7zip/DOCS/MANUAL/switches/ar_include.htm +83 -0
- data/ext/p7zip/DOCS/MANUAL/switches/ar_no.htm +52 -0
- data/ext/p7zip/DOCS/MANUAL/switches/charset.htm +49 -0
- data/ext/p7zip/DOCS/MANUAL/switches/exclude.htm +60 -0
- data/ext/p7zip/DOCS/MANUAL/switches/include.htm +87 -0
- data/ext/p7zip/DOCS/MANUAL/switches/index.htm +64 -0
- data/ext/p7zip/DOCS/MANUAL/switches/large_pages.htm +50 -0
- data/ext/p7zip/DOCS/MANUAL/switches/list_tech.htm +36 -0
- data/ext/p7zip/DOCS/MANUAL/switches/method.htm +625 -0
- data/ext/p7zip/DOCS/MANUAL/switches/output_dir.htm +53 -0
- data/ext/p7zip/DOCS/MANUAL/switches/overwrite.htm +56 -0
- data/ext/p7zip/DOCS/MANUAL/switches/password.htm +54 -0
- data/ext/p7zip/DOCS/MANUAL/switches/recurse.htm +83 -0
- data/ext/p7zip/DOCS/MANUAL/switches/sfx.htm +156 -0
- data/ext/p7zip/DOCS/MANUAL/switches/ssc.htm +50 -0
- data/ext/p7zip/DOCS/MANUAL/switches/stdin.htm +55 -0
- data/ext/p7zip/DOCS/MANUAL/switches/stdout.htm +50 -0
- data/ext/p7zip/DOCS/MANUAL/switches/stop_switch.htm +31 -0
- data/ext/p7zip/DOCS/MANUAL/switches/style.css +232 -0
- data/ext/p7zip/DOCS/MANUAL/switches/type.htm +83 -0
- data/ext/p7zip/DOCS/MANUAL/switches/update.htm +176 -0
- data/ext/p7zip/DOCS/MANUAL/switches/volume.htm +49 -0
- data/ext/p7zip/DOCS/MANUAL/switches/working_dir.htm +55 -0
- data/ext/p7zip/DOCS/MANUAL/switches/yes.htm +48 -0
- data/ext/p7zip/DOCS/MANUAL/syntax.htm +120 -0
- data/ext/p7zip/DOCS/Methods.txt +152 -0
- data/ext/p7zip/DOCS/copying.txt +504 -0
- data/ext/p7zip/DOCS/history.txt +456 -0
- data/ext/p7zip/DOCS/lzma.txt +598 -0
- data/ext/p7zip/DOCS/readme.txt +181 -0
- data/ext/p7zip/DOCS/unRarLicense.txt +41 -0
- data/ext/p7zip/README +358 -0
- data/ext/p7zip/TODO +39 -0
- data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/ChangeLog +41 -0
- data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/readme +21 -0
- data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/readme.u7z +30 -0
- data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/u7z +133 -0
- data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/README +21 -0
- data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/check/check.sh +117 -0
- data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/check/files.tar +0 -0
- data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/man1/p7zip.1 +33 -0
- data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/p7zip +144 -0
- data/ext/p7zip/contrib/qnx630sp3/qnx630sp3-shared +14 -0
- data/ext/p7zip/contrib/qnx630sp3/qnx630sp3-static +10 -0
- data/ext/p7zip/extconf.rb +101 -0
- data/ext/p7zip/install.sh +206 -0
- data/ext/p7zip/install_local_context_menu.sh +18 -0
- data/ext/p7zip/integration_context_menu.txt +51 -0
- data/ext/p7zip/makefile +181 -0
- data/ext/p7zip/makefile.aix_gcc +22 -0
- data/ext/p7zip/makefile.beos +18 -0
- data/ext/p7zip/makefile.crc32 +8 -0
- data/ext/p7zip/makefile.cygwin +20 -0
- data/ext/p7zip/makefile.cygwin_asm +21 -0
- data/ext/p7zip/makefile.djgpp_old +21 -0
- data/ext/p7zip/makefile.djgpp_watt +47 -0
- data/ext/p7zip/makefile.freebsd5 +20 -0
- data/ext/p7zip/makefile.freebsd6 +20 -0
- data/ext/p7zip/makefile.glb +39 -0
- data/ext/p7zip/makefile.gprof +18 -0
- data/ext/p7zip/makefile.hpux-acc +17 -0
- data/ext/p7zip/makefile.hpux-acc_64 +19 -0
- data/ext/p7zip/makefile.hpux-gcc +21 -0
- data/ext/p7zip/makefile.linux_amd64 +22 -0
- data/ext/p7zip/makefile.linux_amd64_asm +24 -0
- data/ext/p7zip/makefile.linux_amd64_asm_icc +27 -0
- data/ext/p7zip/makefile.linux_any_cpu +22 -0
- data/ext/p7zip/makefile.linux_any_cpu_gcc_4.X +24 -0
- data/ext/p7zip/makefile.linux_clang_amd64 +22 -0
- data/ext/p7zip/makefile.linux_cross_arm +22 -0
- data/ext/p7zip/makefile.linux_gcc_2.95_no_need_for_libstdc +20 -0
- data/ext/p7zip/makefile.linux_other +23 -0
- data/ext/p7zip/makefile.linux_s390x +23 -0
- data/ext/p7zip/makefile.linux_x86_asm_gcc_4.X +26 -0
- data/ext/p7zip/makefile.linux_x86_asm_gcc_4.X_fltk +26 -0
- data/ext/p7zip/makefile.linux_x86_asm_gcc_mudflap_4.X +26 -0
- data/ext/p7zip/makefile.linux_x86_asm_icc +25 -0
- data/ext/p7zip/makefile.linux_x86_icc +24 -0
- data/ext/p7zip/makefile.machine_base +22 -0
- data/ext/p7zip/makefile.macosx_32bits +20 -0
- data/ext/p7zip/makefile.macosx_32bits_asm +23 -0
- data/ext/p7zip/makefile.macosx_32bits_ppc +21 -0
- data/ext/p7zip/makefile.macosx_64bits +20 -0
- data/ext/p7zip/makefile.macosx_llvm_64bits +20 -0
- data/ext/p7zip/makefile.netbsd +21 -0
- data/ext/p7zip/makefile.netware_asm_gcc_3.X +41 -0
- data/ext/p7zip/makefile.oldmake +174 -0
- data/ext/p7zip/makefile.openbsd +20 -0
- data/ext/p7zip/makefile.openbsd_no_port +20 -0
- data/ext/p7zip/makefile.qnx_shared.bin +21 -0
- data/ext/p7zip/makefile.qnx_static +21 -0
- data/ext/p7zip/makefile.rules +661 -0
- data/ext/p7zip/makefile.solaris_sparc_CC_32 +21 -0
- data/ext/p7zip/makefile.solaris_sparc_CC_64 +23 -0
- data/ext/p7zip/makefile.solaris_sparc_gcc +21 -0
- data/ext/p7zip/makefile.solaris_x86 +19 -0
- data/ext/p7zip/makefile.tru64 +22 -0
- data/ext/seven_zip_ruby/extconf.rb +127 -0
- data/ext/seven_zip_ruby/guid_defs.h +29 -0
- data/ext/seven_zip_ruby/mutex.h +10 -0
- data/ext/seven_zip_ruby/posix/mutex.h +94 -0
- data/ext/seven_zip_ruby/seven_zip_archive.cpp +1876 -0
- data/ext/seven_zip_ruby/seven_zip_archive.h +548 -0
- data/ext/seven_zip_ruby/util_common.cpp +28 -0
- data/ext/seven_zip_ruby/util_common.h +515 -0
- data/ext/seven_zip_ruby/utils.cpp +575 -0
- data/ext/seven_zip_ruby/utils.h +25 -0
- data/ext/seven_zip_ruby/win32/mutex.h +130 -0
- data/lib/seven_zip_ruby/7z.dll +0 -0
- data/lib/seven_zip_ruby/7z.sfx +0 -0
- data/lib/seven_zip_ruby/7z64.dll +0 -0
- data/lib/seven_zip_ruby/7zCon.sfx +0 -0
- data/lib/seven_zip_ruby/archive_info.rb +21 -0
- data/lib/seven_zip_ruby/entry_info.rb +46 -0
- data/lib/seven_zip_ruby/exception.rb +10 -0
- data/lib/seven_zip_ruby/seven_zip_reader.rb +537 -0
- data/lib/seven_zip_ruby/seven_zip_writer.rb +502 -0
- data/lib/seven_zip_ruby/update_info.rb +116 -0
- data/lib/seven_zip_ruby/version.rb +3 -0
- data/lib/seven_zip_ruby.rb +34 -0
- data/seven-zip.gemspec +35 -0
- data/spec/seven_zip.7z +0 -0
- data/spec/seven_zip_password.7z +0 -0
- data/spec/seven_zip_ruby_spec.rb +703 -0
- data/spec/seven_zip_ruby_spec_helper.rb +144 -0
- metadata +829 -0
@@ -0,0 +1,897 @@
|
|
1
|
+
// Rar3Decoder.cpp
|
2
|
+
// According to unRAR license, this code may not be used to develop
|
3
|
+
// a program that creates RAR archives
|
4
|
+
|
5
|
+
/* This code uses Carryless rangecoder (1999): Dmitry Subbotin : Public domain */
|
6
|
+
|
7
|
+
#include "StdAfx.h"
|
8
|
+
|
9
|
+
#include "../../../C/Alloc.h"
|
10
|
+
|
11
|
+
#include "../Common/StreamUtils.h"
|
12
|
+
|
13
|
+
#include "Rar3Decoder.h"
|
14
|
+
|
15
|
+
namespace NCompress {
|
16
|
+
namespace NRar3 {
|
17
|
+
|
18
|
+
static void *SzBigAlloc(void *, size_t size) { return BigAlloc(size); }
|
19
|
+
static void SzBigFree(void *, void *address) { BigFree(address); }
|
20
|
+
static ISzAlloc g_BigAlloc = { SzBigAlloc, SzBigFree };
|
21
|
+
|
22
|
+
static const UInt32 kNumAlignReps = 15;
|
23
|
+
|
24
|
+
static const UInt32 kSymbolReadTable = 256;
|
25
|
+
static const UInt32 kSymbolRep = 259;
|
26
|
+
static const UInt32 kSymbolLen2 = kSymbolRep + kNumReps;
|
27
|
+
|
28
|
+
static const Byte kLenStart[kLenTableSize] = {0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128,160,192,224};
|
29
|
+
static const Byte kLenDirectBits[kLenTableSize] = {0,0,0,0,0,0,0,0,1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5};
|
30
|
+
|
31
|
+
static const Byte kDistDirectBits[kDistTableSize] =
|
32
|
+
{0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,
|
33
|
+
16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
34
|
+
18,18,18,18,18,18,18,18,18,18,18,18};
|
35
|
+
|
36
|
+
static const Byte kLevelDirectBits[kLevelTableSize] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};
|
37
|
+
|
38
|
+
static const Byte kLen2DistStarts[kNumLen2Symbols]={0,4,8,16,32,64,128,192};
|
39
|
+
static const Byte kLen2DistDirectBits[kNumLen2Symbols]={2,2,3, 4, 5, 6, 6, 6};
|
40
|
+
|
41
|
+
static const UInt32 kDistLimit3 = 0x2000 - 2;
|
42
|
+
static const UInt32 kDistLimit4 = 0x40000 - 2;
|
43
|
+
|
44
|
+
static const UInt32 kNormalMatchMinLen = 3;
|
45
|
+
|
46
|
+
static const UInt32 kVmDataSizeMax = 1 << 16;
|
47
|
+
static const UInt32 kVmCodeSizeMax = 1 << 16;
|
48
|
+
|
49
|
+
extern "C" {
|
50
|
+
|
51
|
+
static UInt32 Range_GetThreshold(void *pp, UInt32 total)
|
52
|
+
{
|
53
|
+
CRangeDecoder *p = (CRangeDecoder *)pp;
|
54
|
+
return p->Code / (p->Range /= total);
|
55
|
+
}
|
56
|
+
|
57
|
+
static void Range_Decode(void *pp, UInt32 start, UInt32 size)
|
58
|
+
{
|
59
|
+
CRangeDecoder *p = (CRangeDecoder *)pp;
|
60
|
+
start *= p->Range;
|
61
|
+
p->Low += start;
|
62
|
+
p->Code -= start;
|
63
|
+
p->Range *= size;
|
64
|
+
p->Normalize();
|
65
|
+
}
|
66
|
+
|
67
|
+
static UInt32 Range_DecodeBit(void *pp, UInt32 size0)
|
68
|
+
{
|
69
|
+
CRangeDecoder *p = (CRangeDecoder *)pp;
|
70
|
+
if (p->Code / (p->Range >>= 14) < size0)
|
71
|
+
{
|
72
|
+
Range_Decode(p, 0, size0);
|
73
|
+
return 0;
|
74
|
+
}
|
75
|
+
else
|
76
|
+
{
|
77
|
+
Range_Decode(p, size0, (1 << 14) - size0);
|
78
|
+
return 1;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
}
|
83
|
+
|
84
|
+
CRangeDecoder::CRangeDecoder()
|
85
|
+
{
|
86
|
+
s.GetThreshold = Range_GetThreshold;
|
87
|
+
s.Decode = Range_Decode;
|
88
|
+
s.DecodeBit = Range_DecodeBit;
|
89
|
+
}
|
90
|
+
|
91
|
+
CDecoder::CDecoder():
|
92
|
+
_window(0),
|
93
|
+
_winPos(0),
|
94
|
+
_wrPtr(0),
|
95
|
+
_lzSize(0),
|
96
|
+
_writtenFileSize(0),
|
97
|
+
_vmData(0),
|
98
|
+
_vmCode(0),
|
99
|
+
m_IsSolid(false)
|
100
|
+
{
|
101
|
+
Ppmd7_Construct(&_ppmd);
|
102
|
+
}
|
103
|
+
|
104
|
+
CDecoder::~CDecoder()
|
105
|
+
{
|
106
|
+
InitFilters();
|
107
|
+
::MidFree(_vmData);
|
108
|
+
::MidFree(_window);
|
109
|
+
Ppmd7_Free(&_ppmd, &g_BigAlloc);
|
110
|
+
}
|
111
|
+
|
112
|
+
HRESULT CDecoder::WriteDataToStream(const Byte *data, UInt32 size)
|
113
|
+
{
|
114
|
+
return WriteStream(_outStream, data, size);
|
115
|
+
}
|
116
|
+
|
117
|
+
HRESULT CDecoder::WriteData(const Byte *data, UInt32 size)
|
118
|
+
{
|
119
|
+
HRESULT res = S_OK;
|
120
|
+
if (_writtenFileSize < _unpackSize)
|
121
|
+
{
|
122
|
+
UInt32 curSize = size;
|
123
|
+
UInt64 remain = _unpackSize - _writtenFileSize;
|
124
|
+
if (remain < curSize)
|
125
|
+
curSize = (UInt32)remain;
|
126
|
+
res = WriteDataToStream(data, curSize);
|
127
|
+
}
|
128
|
+
_writtenFileSize += size;
|
129
|
+
return res;
|
130
|
+
}
|
131
|
+
|
132
|
+
HRESULT CDecoder::WriteArea(UInt32 startPtr, UInt32 endPtr)
|
133
|
+
{
|
134
|
+
if (startPtr <= endPtr)
|
135
|
+
return WriteData(_window + startPtr, endPtr - startPtr);
|
136
|
+
RINOK(WriteData(_window + startPtr, kWindowSize - startPtr));
|
137
|
+
return WriteData(_window, endPtr);
|
138
|
+
}
|
139
|
+
|
140
|
+
void CDecoder::ExecuteFilter(int tempFilterIndex, NVm::CBlockRef &outBlockRef)
|
141
|
+
{
|
142
|
+
CTempFilter *tempFilter = _tempFilters[tempFilterIndex];
|
143
|
+
tempFilter->InitR[6] = (UInt32)_writtenFileSize;
|
144
|
+
NVm::SetValue32(&tempFilter->GlobalData[0x24], (UInt32)_writtenFileSize);
|
145
|
+
NVm::SetValue32(&tempFilter->GlobalData[0x28], (UInt32)(_writtenFileSize >> 32));
|
146
|
+
CFilter *filter = _filters[tempFilter->FilterIndex];
|
147
|
+
_vm.Execute(filter, tempFilter, outBlockRef, filter->GlobalData);
|
148
|
+
delete tempFilter;
|
149
|
+
_tempFilters[tempFilterIndex] = 0;
|
150
|
+
}
|
151
|
+
|
152
|
+
HRESULT CDecoder::WriteBuf()
|
153
|
+
{
|
154
|
+
UInt32 writtenBorder = _wrPtr;
|
155
|
+
UInt32 writeSize = (_winPos - writtenBorder) & kWindowMask;
|
156
|
+
for (int i = 0; i < _tempFilters.Size(); i++)
|
157
|
+
{
|
158
|
+
CTempFilter *filter = _tempFilters[i];
|
159
|
+
if (filter == NULL)
|
160
|
+
continue;
|
161
|
+
if (filter->NextWindow)
|
162
|
+
{
|
163
|
+
filter->NextWindow = false;
|
164
|
+
continue;
|
165
|
+
}
|
166
|
+
UInt32 blockStart = filter->BlockStart;
|
167
|
+
UInt32 blockSize = filter->BlockSize;
|
168
|
+
if (((blockStart - writtenBorder) & kWindowMask) < writeSize)
|
169
|
+
{
|
170
|
+
if (writtenBorder != blockStart)
|
171
|
+
{
|
172
|
+
RINOK(WriteArea(writtenBorder, blockStart));
|
173
|
+
writtenBorder = blockStart;
|
174
|
+
writeSize = (_winPos - writtenBorder) & kWindowMask;
|
175
|
+
}
|
176
|
+
if (blockSize <= writeSize)
|
177
|
+
{
|
178
|
+
UInt32 blockEnd = (blockStart + blockSize) & kWindowMask;
|
179
|
+
if (blockStart < blockEnd || blockEnd == 0)
|
180
|
+
_vm.SetMemory(0, _window + blockStart, blockSize);
|
181
|
+
else
|
182
|
+
{
|
183
|
+
UInt32 tailSize = kWindowSize - blockStart;
|
184
|
+
_vm.SetMemory(0, _window + blockStart, tailSize);
|
185
|
+
_vm.SetMemory(tailSize, _window, blockEnd);
|
186
|
+
}
|
187
|
+
NVm::CBlockRef outBlockRef;
|
188
|
+
ExecuteFilter(i, outBlockRef);
|
189
|
+
while (i + 1 < _tempFilters.Size())
|
190
|
+
{
|
191
|
+
CTempFilter *nextFilter = _tempFilters[i + 1];
|
192
|
+
if (nextFilter == NULL || nextFilter->BlockStart != blockStart ||
|
193
|
+
nextFilter->BlockSize != outBlockRef.Size || nextFilter->NextWindow)
|
194
|
+
break;
|
195
|
+
_vm.SetMemory(0, _vm.GetDataPointer(outBlockRef.Offset), outBlockRef.Size);
|
196
|
+
ExecuteFilter(++i, outBlockRef);
|
197
|
+
}
|
198
|
+
WriteDataToStream(_vm.GetDataPointer(outBlockRef.Offset), outBlockRef.Size);
|
199
|
+
_writtenFileSize += outBlockRef.Size;
|
200
|
+
writtenBorder = blockEnd;
|
201
|
+
writeSize = (_winPos - writtenBorder) & kWindowMask;
|
202
|
+
}
|
203
|
+
else
|
204
|
+
{
|
205
|
+
for (int j = i; j < _tempFilters.Size(); j++)
|
206
|
+
{
|
207
|
+
CTempFilter *filter = _tempFilters[j];
|
208
|
+
if (filter != NULL && filter->NextWindow)
|
209
|
+
filter->NextWindow = false;
|
210
|
+
}
|
211
|
+
_wrPtr = writtenBorder;
|
212
|
+
return S_OK; // check it
|
213
|
+
}
|
214
|
+
}
|
215
|
+
}
|
216
|
+
|
217
|
+
_wrPtr = _winPos;
|
218
|
+
return WriteArea(writtenBorder, _winPos);
|
219
|
+
}
|
220
|
+
|
221
|
+
void CDecoder::InitFilters()
|
222
|
+
{
|
223
|
+
_lastFilter = 0;
|
224
|
+
int i;
|
225
|
+
for (i = 0; i < _tempFilters.Size(); i++)
|
226
|
+
delete _tempFilters[i];
|
227
|
+
_tempFilters.Clear();
|
228
|
+
for (i = 0; i < _filters.Size(); i++)
|
229
|
+
delete _filters[i];
|
230
|
+
_filters.Clear();
|
231
|
+
}
|
232
|
+
|
233
|
+
bool CDecoder::AddVmCode(UInt32 firstByte, UInt32 codeSize)
|
234
|
+
{
|
235
|
+
CMemBitDecoder inp;
|
236
|
+
inp.Init(_vmData, codeSize);
|
237
|
+
|
238
|
+
UInt32 filterIndex;
|
239
|
+
if (firstByte & 0x80)
|
240
|
+
{
|
241
|
+
filterIndex = NVm::ReadEncodedUInt32(inp);
|
242
|
+
if (filterIndex == 0)
|
243
|
+
InitFilters();
|
244
|
+
else
|
245
|
+
filterIndex--;
|
246
|
+
}
|
247
|
+
else
|
248
|
+
filterIndex = _lastFilter;
|
249
|
+
if (filterIndex > (UInt32)_filters.Size())
|
250
|
+
return false;
|
251
|
+
_lastFilter = filterIndex;
|
252
|
+
bool newFilter = (filterIndex == (UInt32)_filters.Size());
|
253
|
+
|
254
|
+
CFilter *filter;
|
255
|
+
if (newFilter)
|
256
|
+
{
|
257
|
+
// check if too many filters
|
258
|
+
if (filterIndex > 1024)
|
259
|
+
return false;
|
260
|
+
filter = new CFilter;
|
261
|
+
_filters.Add(filter);
|
262
|
+
}
|
263
|
+
else
|
264
|
+
{
|
265
|
+
filter = _filters[filterIndex];
|
266
|
+
filter->ExecCount++;
|
267
|
+
}
|
268
|
+
|
269
|
+
int numEmptyItems = 0;
|
270
|
+
int i;
|
271
|
+
for (i = 0; i < _tempFilters.Size(); i++)
|
272
|
+
{
|
273
|
+
_tempFilters[i - numEmptyItems] = _tempFilters[i];
|
274
|
+
if (_tempFilters[i] == NULL)
|
275
|
+
numEmptyItems++;
|
276
|
+
if (numEmptyItems > 0)
|
277
|
+
_tempFilters[i] = NULL;
|
278
|
+
}
|
279
|
+
if (numEmptyItems == 0)
|
280
|
+
{
|
281
|
+
_tempFilters.Add(NULL);
|
282
|
+
numEmptyItems = 1;
|
283
|
+
}
|
284
|
+
CTempFilter *tempFilter = new CTempFilter;
|
285
|
+
_tempFilters[_tempFilters.Size() - numEmptyItems] = tempFilter;
|
286
|
+
tempFilter->FilterIndex = filterIndex;
|
287
|
+
tempFilter->ExecCount = filter->ExecCount;
|
288
|
+
|
289
|
+
UInt32 blockStart = NVm::ReadEncodedUInt32(inp);
|
290
|
+
if (firstByte & 0x40)
|
291
|
+
blockStart += 258;
|
292
|
+
tempFilter->BlockStart = (blockStart + _winPos) & kWindowMask;
|
293
|
+
if (firstByte & 0x20)
|
294
|
+
filter->BlockSize = NVm::ReadEncodedUInt32(inp);
|
295
|
+
tempFilter->BlockSize = filter->BlockSize;
|
296
|
+
tempFilter->NextWindow = _wrPtr != _winPos && ((_wrPtr - _winPos) & kWindowMask) <= blockStart;
|
297
|
+
|
298
|
+
memset(tempFilter->InitR, 0, sizeof(tempFilter->InitR));
|
299
|
+
tempFilter->InitR[3] = NVm::kGlobalOffset;
|
300
|
+
tempFilter->InitR[4] = tempFilter->BlockSize;
|
301
|
+
tempFilter->InitR[5] = tempFilter->ExecCount;
|
302
|
+
if (firstByte & 0x10)
|
303
|
+
{
|
304
|
+
UInt32 initMask = inp.ReadBits(NVm::kNumGpRegs);
|
305
|
+
for (int i = 0; i < NVm::kNumGpRegs; i++)
|
306
|
+
if (initMask & (1 << i))
|
307
|
+
tempFilter->InitR[i] = NVm::ReadEncodedUInt32(inp);
|
308
|
+
}
|
309
|
+
if (newFilter)
|
310
|
+
{
|
311
|
+
UInt32 vmCodeSize = NVm::ReadEncodedUInt32(inp);
|
312
|
+
if (vmCodeSize >= kVmCodeSizeMax || vmCodeSize == 0)
|
313
|
+
return false;
|
314
|
+
for (UInt32 i = 0; i < vmCodeSize; i++)
|
315
|
+
_vmCode[i] = (Byte)inp.ReadBits(8);
|
316
|
+
_vm.PrepareProgram(_vmCode, vmCodeSize, filter);
|
317
|
+
}
|
318
|
+
|
319
|
+
tempFilter->AllocateEmptyFixedGlobal();
|
320
|
+
|
321
|
+
Byte *globalData = &tempFilter->GlobalData[0];
|
322
|
+
for (i = 0; i < NVm::kNumGpRegs; i++)
|
323
|
+
NVm::SetValue32(&globalData[i * 4], tempFilter->InitR[i]);
|
324
|
+
NVm::SetValue32(&globalData[NVm::NGlobalOffset::kBlockSize], tempFilter->BlockSize);
|
325
|
+
NVm::SetValue32(&globalData[NVm::NGlobalOffset::kBlockPos], 0); // It was commented. why?
|
326
|
+
NVm::SetValue32(&globalData[NVm::NGlobalOffset::kExecCount], tempFilter->ExecCount);
|
327
|
+
|
328
|
+
if (firstByte & 8)
|
329
|
+
{
|
330
|
+
UInt32 dataSize = NVm::ReadEncodedUInt32(inp);
|
331
|
+
if (dataSize > NVm::kGlobalSize - NVm::kFixedGlobalSize)
|
332
|
+
return false;
|
333
|
+
CRecordVector<Byte> &globalData = tempFilter->GlobalData;
|
334
|
+
int requredSize = (int)(dataSize + NVm::kFixedGlobalSize);
|
335
|
+
if (globalData.Size() < requredSize)
|
336
|
+
{
|
337
|
+
globalData.Reserve(requredSize);
|
338
|
+
for (; globalData.Size() < requredSize; i++)
|
339
|
+
globalData.Add(0);
|
340
|
+
}
|
341
|
+
for (UInt32 i = 0; i < dataSize; i++)
|
342
|
+
globalData[NVm::kFixedGlobalSize + i] = (Byte)inp.ReadBits(8);
|
343
|
+
}
|
344
|
+
return true;
|
345
|
+
}
|
346
|
+
|
347
|
+
bool CDecoder::ReadVmCodeLZ()
|
348
|
+
{
|
349
|
+
UInt32 firstByte = ReadBits(8);
|
350
|
+
UInt32 length = (firstByte & 7) + 1;
|
351
|
+
if (length == 7)
|
352
|
+
length = ReadBits(8) + 7;
|
353
|
+
else if (length == 8)
|
354
|
+
length = ReadBits(16);
|
355
|
+
if (length > kVmDataSizeMax)
|
356
|
+
return false;
|
357
|
+
for (UInt32 i = 0; i < length; i++)
|
358
|
+
_vmData[i] = (Byte)ReadBits(8);
|
359
|
+
return AddVmCode(firstByte, length);
|
360
|
+
}
|
361
|
+
|
362
|
+
bool CDecoder::ReadVmCodePPM()
|
363
|
+
{
|
364
|
+
int firstByte = DecodePpmSymbol();
|
365
|
+
if (firstByte < 0)
|
366
|
+
return false;
|
367
|
+
UInt32 length = (firstByte & 7) + 1;
|
368
|
+
if (length == 7)
|
369
|
+
{
|
370
|
+
int b1 = DecodePpmSymbol();
|
371
|
+
if (b1 < 0)
|
372
|
+
return false;
|
373
|
+
length = b1 + 7;
|
374
|
+
}
|
375
|
+
else if (length == 8)
|
376
|
+
{
|
377
|
+
int b1 = DecodePpmSymbol();
|
378
|
+
if (b1 < 0)
|
379
|
+
return false;
|
380
|
+
int b2 = DecodePpmSymbol();
|
381
|
+
if (b2 < 0)
|
382
|
+
return false;
|
383
|
+
length = b1 * 256 + b2;
|
384
|
+
}
|
385
|
+
if (length > kVmDataSizeMax)
|
386
|
+
return false;
|
387
|
+
for (UInt32 i = 0; i < length; i++)
|
388
|
+
{
|
389
|
+
int b = DecodePpmSymbol();
|
390
|
+
if (b < 0)
|
391
|
+
return false;
|
392
|
+
_vmData[i] = (Byte)b;
|
393
|
+
}
|
394
|
+
return AddVmCode(firstByte, length);
|
395
|
+
}
|
396
|
+
|
397
|
+
#define RIF(x) { if (!(x)) return S_FALSE; }
|
398
|
+
|
399
|
+
UInt32 CDecoder::ReadBits(int numBits) { return m_InBitStream.bitDecoder.ReadBits(numBits); }
|
400
|
+
|
401
|
+
/////////////////////////////////////////////////
|
402
|
+
// PPM
|
403
|
+
|
404
|
+
HRESULT CDecoder::InitPPM()
|
405
|
+
{
|
406
|
+
Byte maxOrder = (Byte)ReadBits(7);
|
407
|
+
|
408
|
+
bool reset = ((maxOrder & 0x20) != 0);
|
409
|
+
int maxMB = 0;
|
410
|
+
if (reset)
|
411
|
+
maxMB = (Byte)ReadBits(8);
|
412
|
+
else
|
413
|
+
{
|
414
|
+
if (PpmError || !Ppmd7_WasAllocated(&_ppmd))
|
415
|
+
return S_FALSE;
|
416
|
+
}
|
417
|
+
if (maxOrder & 0x40)
|
418
|
+
PpmEscChar = (Byte)ReadBits(8);
|
419
|
+
m_InBitStream.InitRangeCoder();
|
420
|
+
/*
|
421
|
+
if (m_InBitStream.m_BitPos != 0)
|
422
|
+
return S_FALSE;
|
423
|
+
*/
|
424
|
+
if (reset)
|
425
|
+
{
|
426
|
+
PpmError = true;
|
427
|
+
maxOrder = (maxOrder & 0x1F) + 1;
|
428
|
+
if (maxOrder > 16)
|
429
|
+
maxOrder = 16 + (maxOrder - 16) * 3;
|
430
|
+
if (maxOrder == 1)
|
431
|
+
{
|
432
|
+
Ppmd7_Free(&_ppmd, &g_BigAlloc);
|
433
|
+
return S_FALSE;
|
434
|
+
}
|
435
|
+
if (!Ppmd7_Alloc(&_ppmd, (maxMB + 1) << 20, &g_BigAlloc))
|
436
|
+
return E_OUTOFMEMORY;
|
437
|
+
Ppmd7_Init(&_ppmd, maxOrder);
|
438
|
+
PpmError = false;
|
439
|
+
}
|
440
|
+
return S_OK;
|
441
|
+
}
|
442
|
+
|
443
|
+
int CDecoder::DecodePpmSymbol() { return Ppmd7_DecodeSymbol(&_ppmd, &m_InBitStream.s); }
|
444
|
+
|
445
|
+
HRESULT CDecoder::DecodePPM(Int32 num, bool &keepDecompressing)
|
446
|
+
{
|
447
|
+
keepDecompressing = false;
|
448
|
+
if (PpmError)
|
449
|
+
return S_FALSE;
|
450
|
+
do
|
451
|
+
{
|
452
|
+
if (((_wrPtr - _winPos) & kWindowMask) < 260 && _wrPtr != _winPos)
|
453
|
+
{
|
454
|
+
RINOK(WriteBuf());
|
455
|
+
if (_writtenFileSize > _unpackSize)
|
456
|
+
{
|
457
|
+
keepDecompressing = false;
|
458
|
+
return S_OK;
|
459
|
+
}
|
460
|
+
}
|
461
|
+
int c = DecodePpmSymbol();
|
462
|
+
if (c < 0)
|
463
|
+
{
|
464
|
+
PpmError = true;
|
465
|
+
return S_FALSE;
|
466
|
+
}
|
467
|
+
if (c == PpmEscChar)
|
468
|
+
{
|
469
|
+
int nextCh = DecodePpmSymbol();
|
470
|
+
if (nextCh < 0)
|
471
|
+
{
|
472
|
+
PpmError = true;
|
473
|
+
return S_FALSE;
|
474
|
+
}
|
475
|
+
if (nextCh == 0)
|
476
|
+
return ReadTables(keepDecompressing);
|
477
|
+
if (nextCh == 2 || nextCh == -1)
|
478
|
+
return S_OK;
|
479
|
+
if (nextCh == 3)
|
480
|
+
{
|
481
|
+
if (!ReadVmCodePPM())
|
482
|
+
{
|
483
|
+
PpmError = true;
|
484
|
+
return S_FALSE;
|
485
|
+
}
|
486
|
+
continue;
|
487
|
+
}
|
488
|
+
if (nextCh == 4 || nextCh == 5)
|
489
|
+
{
|
490
|
+
UInt32 distance = 0;
|
491
|
+
UInt32 length = 4;
|
492
|
+
if (nextCh == 4)
|
493
|
+
{
|
494
|
+
for (int i = 0; i < 3; i++)
|
495
|
+
{
|
496
|
+
int c = DecodePpmSymbol();
|
497
|
+
if (c < 0)
|
498
|
+
{
|
499
|
+
PpmError = true;
|
500
|
+
return S_FALSE;
|
501
|
+
}
|
502
|
+
distance = (distance << 8) + (Byte)c;
|
503
|
+
}
|
504
|
+
distance++;
|
505
|
+
length += 28;
|
506
|
+
}
|
507
|
+
int c = DecodePpmSymbol();
|
508
|
+
if (c < 0)
|
509
|
+
{
|
510
|
+
PpmError = true;
|
511
|
+
return S_FALSE;
|
512
|
+
}
|
513
|
+
length += c;
|
514
|
+
if (distance >= _lzSize)
|
515
|
+
return S_FALSE;
|
516
|
+
CopyBlock(distance, length);
|
517
|
+
num -= (Int32)length;
|
518
|
+
continue;
|
519
|
+
}
|
520
|
+
}
|
521
|
+
PutByte((Byte)c);
|
522
|
+
num--;
|
523
|
+
}
|
524
|
+
while (num >= 0);
|
525
|
+
keepDecompressing = true;
|
526
|
+
return S_OK;
|
527
|
+
}
|
528
|
+
|
529
|
+
/////////////////////////////////////////////////
|
530
|
+
// LZ
|
531
|
+
|
532
|
+
HRESULT CDecoder::ReadTables(bool &keepDecompressing)
|
533
|
+
{
|
534
|
+
keepDecompressing = true;
|
535
|
+
ReadBits((8 - m_InBitStream.bitDecoder.GetBitPosition()) & 7);
|
536
|
+
if (ReadBits(1) != 0)
|
537
|
+
{
|
538
|
+
_lzMode = false;
|
539
|
+
return InitPPM();
|
540
|
+
}
|
541
|
+
|
542
|
+
_lzMode = true;
|
543
|
+
PrevAlignBits = 0;
|
544
|
+
PrevAlignCount = 0;
|
545
|
+
|
546
|
+
Byte levelLevels[kLevelTableSize];
|
547
|
+
Byte newLevels[kTablesSizesSum];
|
548
|
+
|
549
|
+
if (ReadBits(1) == 0)
|
550
|
+
memset(m_LastLevels, 0, kTablesSizesSum);
|
551
|
+
|
552
|
+
int i;
|
553
|
+
for (i = 0; i < kLevelTableSize; i++)
|
554
|
+
{
|
555
|
+
UInt32 length = ReadBits(4);
|
556
|
+
if (length == 15)
|
557
|
+
{
|
558
|
+
UInt32 zeroCount = ReadBits(4);
|
559
|
+
if (zeroCount != 0)
|
560
|
+
{
|
561
|
+
zeroCount += 2;
|
562
|
+
while (zeroCount-- > 0 && i < kLevelTableSize)
|
563
|
+
levelLevels[i++]=0;
|
564
|
+
i--;
|
565
|
+
continue;
|
566
|
+
}
|
567
|
+
}
|
568
|
+
levelLevels[i] = (Byte)length;
|
569
|
+
}
|
570
|
+
RIF(m_LevelDecoder.SetCodeLengths(levelLevels));
|
571
|
+
i = 0;
|
572
|
+
while (i < kTablesSizesSum)
|
573
|
+
{
|
574
|
+
UInt32 number = m_LevelDecoder.DecodeSymbol(&m_InBitStream.bitDecoder);
|
575
|
+
if (number < 16)
|
576
|
+
{
|
577
|
+
newLevels[i] = Byte((number + m_LastLevels[i]) & 15);
|
578
|
+
i++;
|
579
|
+
}
|
580
|
+
else if (number > kLevelTableSize)
|
581
|
+
return S_FALSE;
|
582
|
+
else
|
583
|
+
{
|
584
|
+
int num;
|
585
|
+
if (((number - 16) & 1) == 0)
|
586
|
+
num = ReadBits(3) + 3;
|
587
|
+
else
|
588
|
+
num = ReadBits(7) + 11;
|
589
|
+
if (number < 18)
|
590
|
+
{
|
591
|
+
if (i == 0)
|
592
|
+
return S_FALSE;
|
593
|
+
for (; num > 0 && i < kTablesSizesSum; num--, i++)
|
594
|
+
newLevels[i] = newLevels[i - 1];
|
595
|
+
}
|
596
|
+
else
|
597
|
+
{
|
598
|
+
for (; num > 0 && i < kTablesSizesSum; num--)
|
599
|
+
newLevels[i++] = 0;
|
600
|
+
}
|
601
|
+
}
|
602
|
+
}
|
603
|
+
TablesRead = true;
|
604
|
+
|
605
|
+
// original code has check here:
|
606
|
+
/*
|
607
|
+
if (InAddr > ReadTop)
|
608
|
+
{
|
609
|
+
keepDecompressing = false;
|
610
|
+
return true;
|
611
|
+
}
|
612
|
+
*/
|
613
|
+
|
614
|
+
RIF(m_MainDecoder.SetCodeLengths(&newLevels[0]));
|
615
|
+
RIF(m_DistDecoder.SetCodeLengths(&newLevels[kMainTableSize]));
|
616
|
+
RIF(m_AlignDecoder.SetCodeLengths(&newLevels[kMainTableSize + kDistTableSize]));
|
617
|
+
RIF(m_LenDecoder.SetCodeLengths(&newLevels[kMainTableSize + kDistTableSize + kAlignTableSize]));
|
618
|
+
|
619
|
+
memcpy(m_LastLevels, newLevels, kTablesSizesSum);
|
620
|
+
return S_OK;
|
621
|
+
}
|
622
|
+
|
623
|
+
class CCoderReleaser
|
624
|
+
{
|
625
|
+
CDecoder *m_Coder;
|
626
|
+
public:
|
627
|
+
CCoderReleaser(CDecoder *coder): m_Coder(coder) {}
|
628
|
+
~CCoderReleaser()
|
629
|
+
{
|
630
|
+
m_Coder->ReleaseStreams();
|
631
|
+
}
|
632
|
+
};
|
633
|
+
|
634
|
+
HRESULT CDecoder::ReadEndOfBlock(bool &keepDecompressing)
|
635
|
+
{
|
636
|
+
if (ReadBits(1) != 0)
|
637
|
+
{
|
638
|
+
// old file
|
639
|
+
TablesRead = false;
|
640
|
+
return ReadTables(keepDecompressing);
|
641
|
+
}
|
642
|
+
// new file
|
643
|
+
keepDecompressing = false;
|
644
|
+
TablesRead = (ReadBits(1) == 0);
|
645
|
+
return S_OK;
|
646
|
+
}
|
647
|
+
|
648
|
+
UInt32 kDistStart[kDistTableSize];
|
649
|
+
|
650
|
+
class CDistInit
|
651
|
+
{
|
652
|
+
public:
|
653
|
+
CDistInit() { Init(); }
|
654
|
+
void Init()
|
655
|
+
{
|
656
|
+
UInt32 start = 0;
|
657
|
+
for (UInt32 i = 0; i < kDistTableSize; i++)
|
658
|
+
{
|
659
|
+
kDistStart[i] = start;
|
660
|
+
start += (1 << kDistDirectBits[i]);
|
661
|
+
}
|
662
|
+
}
|
663
|
+
} g_DistInit;
|
664
|
+
|
665
|
+
HRESULT CDecoder::DecodeLZ(bool &keepDecompressing)
|
666
|
+
{
|
667
|
+
UInt32 rep0 = _reps[0];
|
668
|
+
UInt32 rep1 = _reps[1];
|
669
|
+
UInt32 rep2 = _reps[2];
|
670
|
+
UInt32 rep3 = _reps[3];
|
671
|
+
UInt32 length = _lastLength;
|
672
|
+
for (;;)
|
673
|
+
{
|
674
|
+
if (((_wrPtr - _winPos) & kWindowMask) < 260 && _wrPtr != _winPos)
|
675
|
+
{
|
676
|
+
RINOK(WriteBuf());
|
677
|
+
if (_writtenFileSize > _unpackSize)
|
678
|
+
{
|
679
|
+
keepDecompressing = false;
|
680
|
+
return S_OK;
|
681
|
+
}
|
682
|
+
}
|
683
|
+
UInt32 number = m_MainDecoder.DecodeSymbol(&m_InBitStream.bitDecoder);
|
684
|
+
if (number < 256)
|
685
|
+
{
|
686
|
+
PutByte((Byte)number);
|
687
|
+
continue;
|
688
|
+
}
|
689
|
+
else if (number == kSymbolReadTable)
|
690
|
+
{
|
691
|
+
RINOK(ReadEndOfBlock(keepDecompressing));
|
692
|
+
break;
|
693
|
+
}
|
694
|
+
else if (number == 257)
|
695
|
+
{
|
696
|
+
if (!ReadVmCodeLZ())
|
697
|
+
return S_FALSE;
|
698
|
+
continue;
|
699
|
+
}
|
700
|
+
else if (number == 258)
|
701
|
+
{
|
702
|
+
if (length == 0)
|
703
|
+
return S_FALSE;
|
704
|
+
}
|
705
|
+
else if (number < kSymbolRep + 4)
|
706
|
+
{
|
707
|
+
if (number != kSymbolRep)
|
708
|
+
{
|
709
|
+
UInt32 distance;
|
710
|
+
if (number == kSymbolRep + 1)
|
711
|
+
distance = rep1;
|
712
|
+
else
|
713
|
+
{
|
714
|
+
if (number == kSymbolRep + 2)
|
715
|
+
distance = rep2;
|
716
|
+
else
|
717
|
+
{
|
718
|
+
distance = rep3;
|
719
|
+
rep3 = rep2;
|
720
|
+
}
|
721
|
+
rep2 = rep1;
|
722
|
+
}
|
723
|
+
rep1 = rep0;
|
724
|
+
rep0 = distance;
|
725
|
+
}
|
726
|
+
|
727
|
+
UInt32 number = m_LenDecoder.DecodeSymbol(&m_InBitStream.bitDecoder);
|
728
|
+
if (number >= kLenTableSize)
|
729
|
+
return S_FALSE;
|
730
|
+
length = 2 + kLenStart[number] + m_InBitStream.bitDecoder.ReadBits(kLenDirectBits[number]);
|
731
|
+
}
|
732
|
+
else
|
733
|
+
{
|
734
|
+
rep3 = rep2;
|
735
|
+
rep2 = rep1;
|
736
|
+
rep1 = rep0;
|
737
|
+
if (number < 271)
|
738
|
+
{
|
739
|
+
number -= 263;
|
740
|
+
rep0 = kLen2DistStarts[number] + m_InBitStream.bitDecoder.ReadBits(kLen2DistDirectBits[number]);
|
741
|
+
length = 2;
|
742
|
+
}
|
743
|
+
else if (number < 299)
|
744
|
+
{
|
745
|
+
number -= 271;
|
746
|
+
length = kNormalMatchMinLen + (UInt32)kLenStart[number] + m_InBitStream.bitDecoder.ReadBits(kLenDirectBits[number]);
|
747
|
+
UInt32 number = m_DistDecoder.DecodeSymbol(&m_InBitStream.bitDecoder);
|
748
|
+
if (number >= kDistTableSize)
|
749
|
+
return S_FALSE;
|
750
|
+
rep0 = kDistStart[number];
|
751
|
+
int numBits = kDistDirectBits[number];
|
752
|
+
if (number >= (kNumAlignBits * 2) + 2)
|
753
|
+
{
|
754
|
+
if (numBits > kNumAlignBits)
|
755
|
+
rep0 += (m_InBitStream.bitDecoder.ReadBits(numBits - kNumAlignBits) << kNumAlignBits);
|
756
|
+
if (PrevAlignCount > 0)
|
757
|
+
{
|
758
|
+
PrevAlignCount--;
|
759
|
+
rep0 += PrevAlignBits;
|
760
|
+
}
|
761
|
+
else
|
762
|
+
{
|
763
|
+
UInt32 number = m_AlignDecoder.DecodeSymbol(&m_InBitStream.bitDecoder);
|
764
|
+
if (number < (1 << kNumAlignBits))
|
765
|
+
{
|
766
|
+
rep0 += number;
|
767
|
+
PrevAlignBits = number;
|
768
|
+
}
|
769
|
+
else if (number == (1 << kNumAlignBits))
|
770
|
+
{
|
771
|
+
PrevAlignCount = kNumAlignReps;
|
772
|
+
rep0 += PrevAlignBits;
|
773
|
+
}
|
774
|
+
else
|
775
|
+
return S_FALSE;
|
776
|
+
}
|
777
|
+
}
|
778
|
+
else
|
779
|
+
rep0 += m_InBitStream.bitDecoder.ReadBits(numBits);
|
780
|
+
length += ((kDistLimit4 - rep0) >> 31) + ((kDistLimit3 - rep0) >> 31);
|
781
|
+
}
|
782
|
+
else
|
783
|
+
return S_FALSE;
|
784
|
+
}
|
785
|
+
if (rep0 >= _lzSize)
|
786
|
+
return S_FALSE;
|
787
|
+
CopyBlock(rep0, length);
|
788
|
+
}
|
789
|
+
_reps[0] = rep0;
|
790
|
+
_reps[1] = rep1;
|
791
|
+
_reps[2] = rep2;
|
792
|
+
_reps[3] = rep3;
|
793
|
+
_lastLength = length;
|
794
|
+
|
795
|
+
return S_OK;
|
796
|
+
}
|
797
|
+
|
798
|
+
HRESULT CDecoder::CodeReal(ICompressProgressInfo *progress)
|
799
|
+
{
|
800
|
+
_writtenFileSize = 0;
|
801
|
+
if (!m_IsSolid)
|
802
|
+
{
|
803
|
+
_lzSize = 0;
|
804
|
+
_winPos = 0;
|
805
|
+
_wrPtr = 0;
|
806
|
+
for (int i = 0; i < kNumReps; i++)
|
807
|
+
_reps[i] = 0;
|
808
|
+
_lastLength = 0;
|
809
|
+
memset(m_LastLevels, 0, kTablesSizesSum);
|
810
|
+
TablesRead = false;
|
811
|
+
PpmEscChar = 2;
|
812
|
+
PpmError = true;
|
813
|
+
InitFilters();
|
814
|
+
}
|
815
|
+
if (!m_IsSolid || !TablesRead)
|
816
|
+
{
|
817
|
+
bool keepDecompressing;
|
818
|
+
RINOK(ReadTables(keepDecompressing));
|
819
|
+
if (!keepDecompressing)
|
820
|
+
return S_OK;
|
821
|
+
}
|
822
|
+
|
823
|
+
for (;;)
|
824
|
+
{
|
825
|
+
bool keepDecompressing;
|
826
|
+
if (_lzMode)
|
827
|
+
{
|
828
|
+
RINOK(DecodeLZ(keepDecompressing))
|
829
|
+
}
|
830
|
+
else
|
831
|
+
{
|
832
|
+
RINOK(DecodePPM(1 << 18, keepDecompressing))
|
833
|
+
}
|
834
|
+
UInt64 packSize = m_InBitStream.bitDecoder.GetProcessedSize();
|
835
|
+
RINOK(progress->SetRatioInfo(&packSize, &_writtenFileSize));
|
836
|
+
if (!keepDecompressing)
|
837
|
+
break;
|
838
|
+
}
|
839
|
+
RINOK(WriteBuf());
|
840
|
+
UInt64 packSize = m_InBitStream.bitDecoder.GetProcessedSize();
|
841
|
+
RINOK(progress->SetRatioInfo(&packSize, &_writtenFileSize));
|
842
|
+
if (_writtenFileSize < _unpackSize)
|
843
|
+
return S_FALSE;
|
844
|
+
return S_OK;
|
845
|
+
}
|
846
|
+
|
847
|
+
STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
|
848
|
+
const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
|
849
|
+
{
|
850
|
+
try
|
851
|
+
{
|
852
|
+
if (inSize == NULL || outSize == NULL)
|
853
|
+
return E_INVALIDARG;
|
854
|
+
|
855
|
+
if (_vmData == 0)
|
856
|
+
{
|
857
|
+
_vmData = (Byte *)::MidAlloc(kVmDataSizeMax + kVmCodeSizeMax);
|
858
|
+
if (_vmData == 0)
|
859
|
+
return E_OUTOFMEMORY;
|
860
|
+
_vmCode = _vmData + kVmDataSizeMax;
|
861
|
+
}
|
862
|
+
|
863
|
+
if (_window == 0)
|
864
|
+
{
|
865
|
+
_window = (Byte *)::MidAlloc(kWindowSize);
|
866
|
+
if (_window == 0)
|
867
|
+
return E_OUTOFMEMORY;
|
868
|
+
}
|
869
|
+
if (!m_InBitStream.bitDecoder.Create(1 << 20))
|
870
|
+
return E_OUTOFMEMORY;
|
871
|
+
if (!_vm.Create())
|
872
|
+
return E_OUTOFMEMORY;
|
873
|
+
|
874
|
+
|
875
|
+
m_InBitStream.bitDecoder.SetStream(inStream);
|
876
|
+
m_InBitStream.bitDecoder.Init();
|
877
|
+
_outStream = outStream;
|
878
|
+
|
879
|
+
CCoderReleaser coderReleaser(this);
|
880
|
+
_unpackSize = *outSize;
|
881
|
+
return CodeReal(progress);
|
882
|
+
}
|
883
|
+
catch(const CInBufferException &e) { return e.ErrorCode; }
|
884
|
+
catch(...) { return S_FALSE; }
|
885
|
+
// CNewException is possible here. But probably CNewException is caused
|
886
|
+
// by error in data stream.
|
887
|
+
}
|
888
|
+
|
889
|
+
STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *data, UInt32 size)
|
890
|
+
{
|
891
|
+
if (size < 1)
|
892
|
+
return E_INVALIDARG;
|
893
|
+
m_IsSolid = (data[0] != 0);
|
894
|
+
return S_OK;
|
895
|
+
}
|
896
|
+
|
897
|
+
}}
|