seven_zip_ruby 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +25 -0
- data/.travis.yml +10 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +39 -0
- data/README.md +176 -0
- data/Rakefile +47 -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/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/depend +5 -0
- data/ext/seven_zip_ruby/extconf.rb +131 -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 +1614 -0
- data/ext/seven_zip_ruby/seven_zip_archive.h +515 -0
- data/ext/seven_zip_ruby/util_common.h +444 -0
- data/ext/seven_zip_ruby/utils.cpp +576 -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.rb +16 -0
- data/lib/seven_zip_ruby/7z.dll +0 -0
- data/lib/seven_zip_ruby/7z64.dll +0 -0
- data/lib/seven_zip_ruby/archive_info.rb +21 -0
- data/lib/seven_zip_ruby/entry_info.rb +45 -0
- data/lib/seven_zip_ruby/exception.rb +7 -0
- data/lib/seven_zip_ruby/seven_zip_reader.rb +180 -0
- data/lib/seven_zip_ruby/seven_zip_writer.rb +143 -0
- data/lib/seven_zip_ruby/update_info.rb +116 -0
- data/lib/seven_zip_ruby/version.rb +3 -0
- data/seven_zip_ruby.gemspec +26 -0
- data/spec/seven_zip_ruby_spec.rb +490 -0
- data/spec/seven_zip_ruby_spec_helper.rb +122 -0
- metadata +820 -0
@@ -0,0 +1,66 @@
|
|
1
|
+
/* Lzma2Enc.h -- LZMA2 Encoder
|
2
|
+
2009-02-07 : Igor Pavlov : Public domain */
|
3
|
+
|
4
|
+
#ifndef __LZMA2_ENC_H
|
5
|
+
#define __LZMA2_ENC_H
|
6
|
+
|
7
|
+
#include "LzmaEnc.h"
|
8
|
+
|
9
|
+
#ifdef __cplusplus
|
10
|
+
extern "C" {
|
11
|
+
#endif
|
12
|
+
|
13
|
+
typedef struct
|
14
|
+
{
|
15
|
+
CLzmaEncProps lzmaProps;
|
16
|
+
size_t blockSize;
|
17
|
+
int numBlockThreads;
|
18
|
+
int numTotalThreads;
|
19
|
+
} CLzma2EncProps;
|
20
|
+
|
21
|
+
void Lzma2EncProps_Init(CLzma2EncProps *p);
|
22
|
+
void Lzma2EncProps_Normalize(CLzma2EncProps *p);
|
23
|
+
|
24
|
+
/* ---------- CLzmaEnc2Handle Interface ---------- */
|
25
|
+
|
26
|
+
/* Lzma2Enc_* functions can return the following exit codes:
|
27
|
+
Returns:
|
28
|
+
SZ_OK - OK
|
29
|
+
SZ_ERROR_MEM - Memory allocation error
|
30
|
+
SZ_ERROR_PARAM - Incorrect paramater in props
|
31
|
+
SZ_ERROR_WRITE - Write callback error
|
32
|
+
SZ_ERROR_PROGRESS - some break from progress callback
|
33
|
+
SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
|
34
|
+
*/
|
35
|
+
|
36
|
+
typedef void * CLzma2EncHandle;
|
37
|
+
|
38
|
+
CLzma2EncHandle Lzma2Enc_Create(ISzAlloc *alloc, ISzAlloc *allocBig);
|
39
|
+
void Lzma2Enc_Destroy(CLzma2EncHandle p);
|
40
|
+
SRes Lzma2Enc_SetProps(CLzma2EncHandle p, const CLzma2EncProps *props);
|
41
|
+
Byte Lzma2Enc_WriteProperties(CLzma2EncHandle p);
|
42
|
+
SRes Lzma2Enc_Encode(CLzma2EncHandle p,
|
43
|
+
ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress);
|
44
|
+
|
45
|
+
/* ---------- One Call Interface ---------- */
|
46
|
+
|
47
|
+
/* Lzma2Encode
|
48
|
+
Return code:
|
49
|
+
SZ_OK - OK
|
50
|
+
SZ_ERROR_MEM - Memory allocation error
|
51
|
+
SZ_ERROR_PARAM - Incorrect paramater
|
52
|
+
SZ_ERROR_OUTPUT_EOF - output buffer overflow
|
53
|
+
SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
|
54
|
+
*/
|
55
|
+
|
56
|
+
/*
|
57
|
+
SRes Lzma2Encode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
|
58
|
+
const CLzmaEncProps *props, Byte *propsEncoded, int writeEndMark,
|
59
|
+
ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
|
60
|
+
*/
|
61
|
+
|
62
|
+
#ifdef __cplusplus
|
63
|
+
}
|
64
|
+
#endif
|
65
|
+
|
66
|
+
#endif
|
@@ -0,0 +1,999 @@
|
|
1
|
+
/* LzmaDec.c -- LZMA Decoder
|
2
|
+
2009-09-20 : Igor Pavlov : Public domain */
|
3
|
+
|
4
|
+
#include "LzmaDec.h"
|
5
|
+
|
6
|
+
#include <string.h>
|
7
|
+
|
8
|
+
#define kNumTopBits 24
|
9
|
+
#define kTopValue ((UInt32)1 << kNumTopBits)
|
10
|
+
|
11
|
+
#define kNumBitModelTotalBits 11
|
12
|
+
#define kBitModelTotal (1 << kNumBitModelTotalBits)
|
13
|
+
#define kNumMoveBits 5
|
14
|
+
|
15
|
+
#define RC_INIT_SIZE 5
|
16
|
+
|
17
|
+
#define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); }
|
18
|
+
|
19
|
+
#define IF_BIT_0(p) ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound)
|
20
|
+
#define UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits));
|
21
|
+
#define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits));
|
22
|
+
#define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \
|
23
|
+
{ UPDATE_0(p); i = (i + i); A0; } else \
|
24
|
+
{ UPDATE_1(p); i = (i + i) + 1; A1; }
|
25
|
+
#define GET_BIT(p, i) GET_BIT2(p, i, ; , ;)
|
26
|
+
|
27
|
+
#define TREE_GET_BIT(probs, i) { GET_BIT((probs + i), i); }
|
28
|
+
#define TREE_DECODE(probs, limit, i) \
|
29
|
+
{ i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; }
|
30
|
+
|
31
|
+
/* #define _LZMA_SIZE_OPT */
|
32
|
+
|
33
|
+
#ifdef _LZMA_SIZE_OPT
|
34
|
+
#define TREE_6_DECODE(probs, i) TREE_DECODE(probs, (1 << 6), i)
|
35
|
+
#else
|
36
|
+
#define TREE_6_DECODE(probs, i) \
|
37
|
+
{ i = 1; \
|
38
|
+
TREE_GET_BIT(probs, i); \
|
39
|
+
TREE_GET_BIT(probs, i); \
|
40
|
+
TREE_GET_BIT(probs, i); \
|
41
|
+
TREE_GET_BIT(probs, i); \
|
42
|
+
TREE_GET_BIT(probs, i); \
|
43
|
+
TREE_GET_BIT(probs, i); \
|
44
|
+
i -= 0x40; }
|
45
|
+
#endif
|
46
|
+
|
47
|
+
#define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); }
|
48
|
+
|
49
|
+
#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound)
|
50
|
+
#define UPDATE_0_CHECK range = bound;
|
51
|
+
#define UPDATE_1_CHECK range -= bound; code -= bound;
|
52
|
+
#define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \
|
53
|
+
{ UPDATE_0_CHECK; i = (i + i); A0; } else \
|
54
|
+
{ UPDATE_1_CHECK; i = (i + i) + 1; A1; }
|
55
|
+
#define GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;)
|
56
|
+
#define TREE_DECODE_CHECK(probs, limit, i) \
|
57
|
+
{ i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; }
|
58
|
+
|
59
|
+
|
60
|
+
#define kNumPosBitsMax 4
|
61
|
+
#define kNumPosStatesMax (1 << kNumPosBitsMax)
|
62
|
+
|
63
|
+
#define kLenNumLowBits 3
|
64
|
+
#define kLenNumLowSymbols (1 << kLenNumLowBits)
|
65
|
+
#define kLenNumMidBits 3
|
66
|
+
#define kLenNumMidSymbols (1 << kLenNumMidBits)
|
67
|
+
#define kLenNumHighBits 8
|
68
|
+
#define kLenNumHighSymbols (1 << kLenNumHighBits)
|
69
|
+
|
70
|
+
#define LenChoice 0
|
71
|
+
#define LenChoice2 (LenChoice + 1)
|
72
|
+
#define LenLow (LenChoice2 + 1)
|
73
|
+
#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
|
74
|
+
#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
|
75
|
+
#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
|
76
|
+
|
77
|
+
|
78
|
+
#define kNumStates 12
|
79
|
+
#define kNumLitStates 7
|
80
|
+
|
81
|
+
#define kStartPosModelIndex 4
|
82
|
+
#define kEndPosModelIndex 14
|
83
|
+
#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
|
84
|
+
|
85
|
+
#define kNumPosSlotBits 6
|
86
|
+
#define kNumLenToPosStates 4
|
87
|
+
|
88
|
+
#define kNumAlignBits 4
|
89
|
+
#define kAlignTableSize (1 << kNumAlignBits)
|
90
|
+
|
91
|
+
#define kMatchMinLen 2
|
92
|
+
#define kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols)
|
93
|
+
|
94
|
+
#define IsMatch 0
|
95
|
+
#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
|
96
|
+
#define IsRepG0 (IsRep + kNumStates)
|
97
|
+
#define IsRepG1 (IsRepG0 + kNumStates)
|
98
|
+
#define IsRepG2 (IsRepG1 + kNumStates)
|
99
|
+
#define IsRep0Long (IsRepG2 + kNumStates)
|
100
|
+
#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
|
101
|
+
#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
|
102
|
+
#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
|
103
|
+
#define LenCoder (Align + kAlignTableSize)
|
104
|
+
#define RepLenCoder (LenCoder + kNumLenProbs)
|
105
|
+
#define Literal (RepLenCoder + kNumLenProbs)
|
106
|
+
|
107
|
+
#define LZMA_BASE_SIZE 1846
|
108
|
+
#define LZMA_LIT_SIZE 768
|
109
|
+
|
110
|
+
#define LzmaProps_GetNumProbs(p) ((UInt32)LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((p)->lc + (p)->lp)))
|
111
|
+
|
112
|
+
#if Literal != LZMA_BASE_SIZE
|
113
|
+
StopCompilingDueBUG
|
114
|
+
#endif
|
115
|
+
|
116
|
+
#define LZMA_DIC_MIN (1 << 12)
|
117
|
+
|
118
|
+
/* First LZMA-symbol is always decoded.
|
119
|
+
And it decodes new LZMA-symbols while (buf < bufLimit), but "buf" is without last normalization
|
120
|
+
Out:
|
121
|
+
Result:
|
122
|
+
SZ_OK - OK
|
123
|
+
SZ_ERROR_DATA - Error
|
124
|
+
p->remainLen:
|
125
|
+
< kMatchSpecLenStart : normal remain
|
126
|
+
= kMatchSpecLenStart : finished
|
127
|
+
= kMatchSpecLenStart + 1 : Flush marker
|
128
|
+
= kMatchSpecLenStart + 2 : State Init Marker
|
129
|
+
*/
|
130
|
+
|
131
|
+
static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
|
132
|
+
{
|
133
|
+
CLzmaProb *probs = p->probs;
|
134
|
+
|
135
|
+
unsigned state = p->state;
|
136
|
+
UInt32 rep0 = p->reps[0], rep1 = p->reps[1], rep2 = p->reps[2], rep3 = p->reps[3];
|
137
|
+
unsigned pbMask = ((unsigned)1 << (p->prop.pb)) - 1;
|
138
|
+
unsigned lpMask = ((unsigned)1 << (p->prop.lp)) - 1;
|
139
|
+
unsigned lc = p->prop.lc;
|
140
|
+
|
141
|
+
Byte *dic = p->dic;
|
142
|
+
SizeT dicBufSize = p->dicBufSize;
|
143
|
+
SizeT dicPos = p->dicPos;
|
144
|
+
|
145
|
+
UInt32 processedPos = p->processedPos;
|
146
|
+
UInt32 checkDicSize = p->checkDicSize;
|
147
|
+
unsigned len = 0;
|
148
|
+
|
149
|
+
const Byte *buf = p->buf;
|
150
|
+
UInt32 range = p->range;
|
151
|
+
UInt32 code = p->code;
|
152
|
+
|
153
|
+
do
|
154
|
+
{
|
155
|
+
CLzmaProb *prob;
|
156
|
+
UInt32 bound;
|
157
|
+
unsigned ttt;
|
158
|
+
unsigned posState = processedPos & pbMask;
|
159
|
+
|
160
|
+
prob = probs + IsMatch + (state << kNumPosBitsMax) + posState;
|
161
|
+
IF_BIT_0(prob)
|
162
|
+
{
|
163
|
+
unsigned symbol;
|
164
|
+
UPDATE_0(prob);
|
165
|
+
prob = probs + Literal;
|
166
|
+
if (checkDicSize != 0 || processedPos != 0)
|
167
|
+
prob += (LZMA_LIT_SIZE * (((processedPos & lpMask) << lc) +
|
168
|
+
(dic[(dicPos == 0 ? dicBufSize : dicPos) - 1] >> (8 - lc))));
|
169
|
+
|
170
|
+
if (state < kNumLitStates)
|
171
|
+
{
|
172
|
+
state -= (state < 4) ? state : 3;
|
173
|
+
symbol = 1;
|
174
|
+
do { GET_BIT(prob + symbol, symbol) } while (symbol < 0x100);
|
175
|
+
}
|
176
|
+
else
|
177
|
+
{
|
178
|
+
unsigned matchByte = p->dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
|
179
|
+
unsigned offs = 0x100;
|
180
|
+
state -= (state < 10) ? 3 : 6;
|
181
|
+
symbol = 1;
|
182
|
+
do
|
183
|
+
{
|
184
|
+
unsigned bit;
|
185
|
+
CLzmaProb *probLit;
|
186
|
+
matchByte <<= 1;
|
187
|
+
bit = (matchByte & offs);
|
188
|
+
probLit = prob + offs + bit + symbol;
|
189
|
+
GET_BIT2(probLit, symbol, offs &= ~bit, offs &= bit)
|
190
|
+
}
|
191
|
+
while (symbol < 0x100);
|
192
|
+
}
|
193
|
+
dic[dicPos++] = (Byte)symbol;
|
194
|
+
processedPos++;
|
195
|
+
continue;
|
196
|
+
}
|
197
|
+
else
|
198
|
+
{
|
199
|
+
UPDATE_1(prob);
|
200
|
+
prob = probs + IsRep + state;
|
201
|
+
IF_BIT_0(prob)
|
202
|
+
{
|
203
|
+
UPDATE_0(prob);
|
204
|
+
state += kNumStates;
|
205
|
+
prob = probs + LenCoder;
|
206
|
+
}
|
207
|
+
else
|
208
|
+
{
|
209
|
+
UPDATE_1(prob);
|
210
|
+
if (checkDicSize == 0 && processedPos == 0)
|
211
|
+
return SZ_ERROR_DATA;
|
212
|
+
prob = probs + IsRepG0 + state;
|
213
|
+
IF_BIT_0(prob)
|
214
|
+
{
|
215
|
+
UPDATE_0(prob);
|
216
|
+
prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState;
|
217
|
+
IF_BIT_0(prob)
|
218
|
+
{
|
219
|
+
UPDATE_0(prob);
|
220
|
+
dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
|
221
|
+
dicPos++;
|
222
|
+
processedPos++;
|
223
|
+
state = state < kNumLitStates ? 9 : 11;
|
224
|
+
continue;
|
225
|
+
}
|
226
|
+
UPDATE_1(prob);
|
227
|
+
}
|
228
|
+
else
|
229
|
+
{
|
230
|
+
UInt32 distance;
|
231
|
+
UPDATE_1(prob);
|
232
|
+
prob = probs + IsRepG1 + state;
|
233
|
+
IF_BIT_0(prob)
|
234
|
+
{
|
235
|
+
UPDATE_0(prob);
|
236
|
+
distance = rep1;
|
237
|
+
}
|
238
|
+
else
|
239
|
+
{
|
240
|
+
UPDATE_1(prob);
|
241
|
+
prob = probs + IsRepG2 + state;
|
242
|
+
IF_BIT_0(prob)
|
243
|
+
{
|
244
|
+
UPDATE_0(prob);
|
245
|
+
distance = rep2;
|
246
|
+
}
|
247
|
+
else
|
248
|
+
{
|
249
|
+
UPDATE_1(prob);
|
250
|
+
distance = rep3;
|
251
|
+
rep3 = rep2;
|
252
|
+
}
|
253
|
+
rep2 = rep1;
|
254
|
+
}
|
255
|
+
rep1 = rep0;
|
256
|
+
rep0 = distance;
|
257
|
+
}
|
258
|
+
state = state < kNumLitStates ? 8 : 11;
|
259
|
+
prob = probs + RepLenCoder;
|
260
|
+
}
|
261
|
+
{
|
262
|
+
unsigned limit, offset;
|
263
|
+
CLzmaProb *probLen = prob + LenChoice;
|
264
|
+
IF_BIT_0(probLen)
|
265
|
+
{
|
266
|
+
UPDATE_0(probLen);
|
267
|
+
probLen = prob + LenLow + (posState << kLenNumLowBits);
|
268
|
+
offset = 0;
|
269
|
+
limit = (1 << kLenNumLowBits);
|
270
|
+
}
|
271
|
+
else
|
272
|
+
{
|
273
|
+
UPDATE_1(probLen);
|
274
|
+
probLen = prob + LenChoice2;
|
275
|
+
IF_BIT_0(probLen)
|
276
|
+
{
|
277
|
+
UPDATE_0(probLen);
|
278
|
+
probLen = prob + LenMid + (posState << kLenNumMidBits);
|
279
|
+
offset = kLenNumLowSymbols;
|
280
|
+
limit = (1 << kLenNumMidBits);
|
281
|
+
}
|
282
|
+
else
|
283
|
+
{
|
284
|
+
UPDATE_1(probLen);
|
285
|
+
probLen = prob + LenHigh;
|
286
|
+
offset = kLenNumLowSymbols + kLenNumMidSymbols;
|
287
|
+
limit = (1 << kLenNumHighBits);
|
288
|
+
}
|
289
|
+
}
|
290
|
+
TREE_DECODE(probLen, limit, len);
|
291
|
+
len += offset;
|
292
|
+
}
|
293
|
+
|
294
|
+
if (state >= kNumStates)
|
295
|
+
{
|
296
|
+
UInt32 distance;
|
297
|
+
prob = probs + PosSlot +
|
298
|
+
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits);
|
299
|
+
TREE_6_DECODE(prob, distance);
|
300
|
+
if (distance >= kStartPosModelIndex)
|
301
|
+
{
|
302
|
+
unsigned posSlot = (unsigned)distance;
|
303
|
+
int numDirectBits = (int)(((distance >> 1) - 1));
|
304
|
+
distance = (2 | (distance & 1));
|
305
|
+
if (posSlot < kEndPosModelIndex)
|
306
|
+
{
|
307
|
+
distance <<= numDirectBits;
|
308
|
+
prob = probs + SpecPos + distance - posSlot - 1;
|
309
|
+
{
|
310
|
+
UInt32 mask = 1;
|
311
|
+
unsigned i = 1;
|
312
|
+
do
|
313
|
+
{
|
314
|
+
GET_BIT2(prob + i, i, ; , distance |= mask);
|
315
|
+
mask <<= 1;
|
316
|
+
}
|
317
|
+
while (--numDirectBits != 0);
|
318
|
+
}
|
319
|
+
}
|
320
|
+
else
|
321
|
+
{
|
322
|
+
numDirectBits -= kNumAlignBits;
|
323
|
+
do
|
324
|
+
{
|
325
|
+
NORMALIZE
|
326
|
+
range >>= 1;
|
327
|
+
|
328
|
+
{
|
329
|
+
UInt32 t;
|
330
|
+
code -= range;
|
331
|
+
t = (0 - ((UInt32)code >> 31)); /* (UInt32)((Int32)code >> 31) */
|
332
|
+
distance = (distance << 1) + (t + 1);
|
333
|
+
code += range & t;
|
334
|
+
}
|
335
|
+
/*
|
336
|
+
distance <<= 1;
|
337
|
+
if (code >= range)
|
338
|
+
{
|
339
|
+
code -= range;
|
340
|
+
distance |= 1;
|
341
|
+
}
|
342
|
+
*/
|
343
|
+
}
|
344
|
+
while (--numDirectBits != 0);
|
345
|
+
prob = probs + Align;
|
346
|
+
distance <<= kNumAlignBits;
|
347
|
+
{
|
348
|
+
unsigned i = 1;
|
349
|
+
GET_BIT2(prob + i, i, ; , distance |= 1);
|
350
|
+
GET_BIT2(prob + i, i, ; , distance |= 2);
|
351
|
+
GET_BIT2(prob + i, i, ; , distance |= 4);
|
352
|
+
GET_BIT2(prob + i, i, ; , distance |= 8);
|
353
|
+
}
|
354
|
+
if (distance == (UInt32)0xFFFFFFFF)
|
355
|
+
{
|
356
|
+
len += kMatchSpecLenStart;
|
357
|
+
state -= kNumStates;
|
358
|
+
break;
|
359
|
+
}
|
360
|
+
}
|
361
|
+
}
|
362
|
+
rep3 = rep2;
|
363
|
+
rep2 = rep1;
|
364
|
+
rep1 = rep0;
|
365
|
+
rep0 = distance + 1;
|
366
|
+
if (checkDicSize == 0)
|
367
|
+
{
|
368
|
+
if (distance >= processedPos)
|
369
|
+
return SZ_ERROR_DATA;
|
370
|
+
}
|
371
|
+
else if (distance >= checkDicSize)
|
372
|
+
return SZ_ERROR_DATA;
|
373
|
+
state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3;
|
374
|
+
}
|
375
|
+
|
376
|
+
len += kMatchMinLen;
|
377
|
+
|
378
|
+
if (limit == dicPos)
|
379
|
+
return SZ_ERROR_DATA;
|
380
|
+
{
|
381
|
+
SizeT rem = limit - dicPos;
|
382
|
+
unsigned curLen = ((rem < len) ? (unsigned)rem : len);
|
383
|
+
SizeT pos = (dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0);
|
384
|
+
|
385
|
+
processedPos += curLen;
|
386
|
+
|
387
|
+
len -= curLen;
|
388
|
+
if (pos + curLen <= dicBufSize)
|
389
|
+
{
|
390
|
+
Byte *dest = dic + dicPos;
|
391
|
+
ptrdiff_t src = (ptrdiff_t)pos - (ptrdiff_t)dicPos;
|
392
|
+
const Byte *lim = dest + curLen;
|
393
|
+
dicPos += curLen;
|
394
|
+
do
|
395
|
+
*(dest) = (Byte)*(dest + src);
|
396
|
+
while (++dest != lim);
|
397
|
+
}
|
398
|
+
else
|
399
|
+
{
|
400
|
+
do
|
401
|
+
{
|
402
|
+
dic[dicPos++] = dic[pos];
|
403
|
+
if (++pos == dicBufSize)
|
404
|
+
pos = 0;
|
405
|
+
}
|
406
|
+
while (--curLen != 0);
|
407
|
+
}
|
408
|
+
}
|
409
|
+
}
|
410
|
+
}
|
411
|
+
while (dicPos < limit && buf < bufLimit);
|
412
|
+
NORMALIZE;
|
413
|
+
p->buf = buf;
|
414
|
+
p->range = range;
|
415
|
+
p->code = code;
|
416
|
+
p->remainLen = len;
|
417
|
+
p->dicPos = dicPos;
|
418
|
+
p->processedPos = processedPos;
|
419
|
+
p->reps[0] = rep0;
|
420
|
+
p->reps[1] = rep1;
|
421
|
+
p->reps[2] = rep2;
|
422
|
+
p->reps[3] = rep3;
|
423
|
+
p->state = state;
|
424
|
+
|
425
|
+
return SZ_OK;
|
426
|
+
}
|
427
|
+
|
428
|
+
static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit)
|
429
|
+
{
|
430
|
+
if (p->remainLen != 0 && p->remainLen < kMatchSpecLenStart)
|
431
|
+
{
|
432
|
+
Byte *dic = p->dic;
|
433
|
+
SizeT dicPos = p->dicPos;
|
434
|
+
SizeT dicBufSize = p->dicBufSize;
|
435
|
+
unsigned len = p->remainLen;
|
436
|
+
UInt32 rep0 = p->reps[0];
|
437
|
+
if (limit - dicPos < len)
|
438
|
+
len = (unsigned)(limit - dicPos);
|
439
|
+
|
440
|
+
if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= len)
|
441
|
+
p->checkDicSize = p->prop.dicSize;
|
442
|
+
|
443
|
+
p->processedPos += len;
|
444
|
+
p->remainLen -= len;
|
445
|
+
while (len-- != 0)
|
446
|
+
{
|
447
|
+
dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
|
448
|
+
dicPos++;
|
449
|
+
}
|
450
|
+
p->dicPos = dicPos;
|
451
|
+
}
|
452
|
+
}
|
453
|
+
|
454
|
+
static int MY_FAST_CALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
|
455
|
+
{
|
456
|
+
do
|
457
|
+
{
|
458
|
+
SizeT limit2 = limit;
|
459
|
+
if (p->checkDicSize == 0)
|
460
|
+
{
|
461
|
+
UInt32 rem = p->prop.dicSize - p->processedPos;
|
462
|
+
if (limit - p->dicPos > rem)
|
463
|
+
limit2 = p->dicPos + rem;
|
464
|
+
}
|
465
|
+
RINOK(LzmaDec_DecodeReal(p, limit2, bufLimit));
|
466
|
+
if (p->processedPos >= p->prop.dicSize)
|
467
|
+
p->checkDicSize = p->prop.dicSize;
|
468
|
+
LzmaDec_WriteRem(p, limit);
|
469
|
+
}
|
470
|
+
while (p->dicPos < limit && p->buf < bufLimit && p->remainLen < kMatchSpecLenStart);
|
471
|
+
|
472
|
+
if (p->remainLen > kMatchSpecLenStart)
|
473
|
+
{
|
474
|
+
p->remainLen = kMatchSpecLenStart;
|
475
|
+
}
|
476
|
+
return 0;
|
477
|
+
}
|
478
|
+
|
479
|
+
typedef enum
|
480
|
+
{
|
481
|
+
DUMMY_ERROR, /* unexpected end of input stream */
|
482
|
+
DUMMY_LIT,
|
483
|
+
DUMMY_MATCH,
|
484
|
+
DUMMY_REP
|
485
|
+
} ELzmaDummy;
|
486
|
+
|
487
|
+
static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inSize)
|
488
|
+
{
|
489
|
+
UInt32 range = p->range;
|
490
|
+
UInt32 code = p->code;
|
491
|
+
const Byte *bufLimit = buf + inSize;
|
492
|
+
CLzmaProb *probs = p->probs;
|
493
|
+
unsigned state = p->state;
|
494
|
+
ELzmaDummy res;
|
495
|
+
|
496
|
+
{
|
497
|
+
CLzmaProb *prob;
|
498
|
+
UInt32 bound;
|
499
|
+
unsigned ttt;
|
500
|
+
unsigned posState = (p->processedPos) & ((1 << p->prop.pb) - 1);
|
501
|
+
|
502
|
+
prob = probs + IsMatch + (state << kNumPosBitsMax) + posState;
|
503
|
+
IF_BIT_0_CHECK(prob)
|
504
|
+
{
|
505
|
+
UPDATE_0_CHECK
|
506
|
+
|
507
|
+
/* if (bufLimit - buf >= 7) return DUMMY_LIT; */
|
508
|
+
|
509
|
+
prob = probs + Literal;
|
510
|
+
if (p->checkDicSize != 0 || p->processedPos != 0)
|
511
|
+
prob += (LZMA_LIT_SIZE *
|
512
|
+
((((p->processedPos) & ((1 << (p->prop.lp)) - 1)) << p->prop.lc) +
|
513
|
+
(p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc))));
|
514
|
+
|
515
|
+
if (state < kNumLitStates)
|
516
|
+
{
|
517
|
+
unsigned symbol = 1;
|
518
|
+
do { GET_BIT_CHECK(prob + symbol, symbol) } while (symbol < 0x100);
|
519
|
+
}
|
520
|
+
else
|
521
|
+
{
|
522
|
+
unsigned matchByte = p->dic[p->dicPos - p->reps[0] +
|
523
|
+
((p->dicPos < p->reps[0]) ? p->dicBufSize : 0)];
|
524
|
+
unsigned offs = 0x100;
|
525
|
+
unsigned symbol = 1;
|
526
|
+
do
|
527
|
+
{
|
528
|
+
unsigned bit;
|
529
|
+
CLzmaProb *probLit;
|
530
|
+
matchByte <<= 1;
|
531
|
+
bit = (matchByte & offs);
|
532
|
+
probLit = prob + offs + bit + symbol;
|
533
|
+
GET_BIT2_CHECK(probLit, symbol, offs &= ~bit, offs &= bit)
|
534
|
+
}
|
535
|
+
while (symbol < 0x100);
|
536
|
+
}
|
537
|
+
res = DUMMY_LIT;
|
538
|
+
}
|
539
|
+
else
|
540
|
+
{
|
541
|
+
unsigned len;
|
542
|
+
UPDATE_1_CHECK;
|
543
|
+
|
544
|
+
prob = probs + IsRep + state;
|
545
|
+
IF_BIT_0_CHECK(prob)
|
546
|
+
{
|
547
|
+
UPDATE_0_CHECK;
|
548
|
+
state = 0;
|
549
|
+
prob = probs + LenCoder;
|
550
|
+
res = DUMMY_MATCH;
|
551
|
+
}
|
552
|
+
else
|
553
|
+
{
|
554
|
+
UPDATE_1_CHECK;
|
555
|
+
res = DUMMY_REP;
|
556
|
+
prob = probs + IsRepG0 + state;
|
557
|
+
IF_BIT_0_CHECK(prob)
|
558
|
+
{
|
559
|
+
UPDATE_0_CHECK;
|
560
|
+
prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState;
|
561
|
+
IF_BIT_0_CHECK(prob)
|
562
|
+
{
|
563
|
+
UPDATE_0_CHECK;
|
564
|
+
NORMALIZE_CHECK;
|
565
|
+
return DUMMY_REP;
|
566
|
+
}
|
567
|
+
else
|
568
|
+
{
|
569
|
+
UPDATE_1_CHECK;
|
570
|
+
}
|
571
|
+
}
|
572
|
+
else
|
573
|
+
{
|
574
|
+
UPDATE_1_CHECK;
|
575
|
+
prob = probs + IsRepG1 + state;
|
576
|
+
IF_BIT_0_CHECK(prob)
|
577
|
+
{
|
578
|
+
UPDATE_0_CHECK;
|
579
|
+
}
|
580
|
+
else
|
581
|
+
{
|
582
|
+
UPDATE_1_CHECK;
|
583
|
+
prob = probs + IsRepG2 + state;
|
584
|
+
IF_BIT_0_CHECK(prob)
|
585
|
+
{
|
586
|
+
UPDATE_0_CHECK;
|
587
|
+
}
|
588
|
+
else
|
589
|
+
{
|
590
|
+
UPDATE_1_CHECK;
|
591
|
+
}
|
592
|
+
}
|
593
|
+
}
|
594
|
+
state = kNumStates;
|
595
|
+
prob = probs + RepLenCoder;
|
596
|
+
}
|
597
|
+
{
|
598
|
+
unsigned limit, offset;
|
599
|
+
CLzmaProb *probLen = prob + LenChoice;
|
600
|
+
IF_BIT_0_CHECK(probLen)
|
601
|
+
{
|
602
|
+
UPDATE_0_CHECK;
|
603
|
+
probLen = prob + LenLow + (posState << kLenNumLowBits);
|
604
|
+
offset = 0;
|
605
|
+
limit = 1 << kLenNumLowBits;
|
606
|
+
}
|
607
|
+
else
|
608
|
+
{
|
609
|
+
UPDATE_1_CHECK;
|
610
|
+
probLen = prob + LenChoice2;
|
611
|
+
IF_BIT_0_CHECK(probLen)
|
612
|
+
{
|
613
|
+
UPDATE_0_CHECK;
|
614
|
+
probLen = prob + LenMid + (posState << kLenNumMidBits);
|
615
|
+
offset = kLenNumLowSymbols;
|
616
|
+
limit = 1 << kLenNumMidBits;
|
617
|
+
}
|
618
|
+
else
|
619
|
+
{
|
620
|
+
UPDATE_1_CHECK;
|
621
|
+
probLen = prob + LenHigh;
|
622
|
+
offset = kLenNumLowSymbols + kLenNumMidSymbols;
|
623
|
+
limit = 1 << kLenNumHighBits;
|
624
|
+
}
|
625
|
+
}
|
626
|
+
TREE_DECODE_CHECK(probLen, limit, len);
|
627
|
+
len += offset;
|
628
|
+
}
|
629
|
+
|
630
|
+
if (state < 4)
|
631
|
+
{
|
632
|
+
unsigned posSlot;
|
633
|
+
prob = probs + PosSlot +
|
634
|
+
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
|
635
|
+
kNumPosSlotBits);
|
636
|
+
TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot);
|
637
|
+
if (posSlot >= kStartPosModelIndex)
|
638
|
+
{
|
639
|
+
int numDirectBits = ((posSlot >> 1) - 1);
|
640
|
+
|
641
|
+
/* if (bufLimit - buf >= 8) return DUMMY_MATCH; */
|
642
|
+
|
643
|
+
if (posSlot < kEndPosModelIndex)
|
644
|
+
{
|
645
|
+
prob = probs + SpecPos + ((2 | (posSlot & 1)) << numDirectBits) - posSlot - 1;
|
646
|
+
}
|
647
|
+
else
|
648
|
+
{
|
649
|
+
numDirectBits -= kNumAlignBits;
|
650
|
+
do
|
651
|
+
{
|
652
|
+
NORMALIZE_CHECK
|
653
|
+
range >>= 1;
|
654
|
+
code -= range & (((code - range) >> 31) - 1);
|
655
|
+
/* if (code >= range) code -= range; */
|
656
|
+
}
|
657
|
+
while (--numDirectBits != 0);
|
658
|
+
prob = probs + Align;
|
659
|
+
numDirectBits = kNumAlignBits;
|
660
|
+
}
|
661
|
+
{
|
662
|
+
unsigned i = 1;
|
663
|
+
do
|
664
|
+
{
|
665
|
+
GET_BIT_CHECK(prob + i, i);
|
666
|
+
}
|
667
|
+
while (--numDirectBits != 0);
|
668
|
+
}
|
669
|
+
}
|
670
|
+
}
|
671
|
+
}
|
672
|
+
}
|
673
|
+
NORMALIZE_CHECK;
|
674
|
+
return res;
|
675
|
+
}
|
676
|
+
|
677
|
+
|
678
|
+
static void LzmaDec_InitRc(CLzmaDec *p, const Byte *data)
|
679
|
+
{
|
680
|
+
p->code = ((UInt32)data[1] << 24) | ((UInt32)data[2] << 16) | ((UInt32)data[3] << 8) | ((UInt32)data[4]);
|
681
|
+
p->range = 0xFFFFFFFF;
|
682
|
+
p->needFlush = 0;
|
683
|
+
}
|
684
|
+
|
685
|
+
void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState)
|
686
|
+
{
|
687
|
+
p->needFlush = 1;
|
688
|
+
p->remainLen = 0;
|
689
|
+
p->tempBufSize = 0;
|
690
|
+
|
691
|
+
if (initDic)
|
692
|
+
{
|
693
|
+
p->processedPos = 0;
|
694
|
+
p->checkDicSize = 0;
|
695
|
+
p->needInitState = 1;
|
696
|
+
}
|
697
|
+
if (initState)
|
698
|
+
p->needInitState = 1;
|
699
|
+
}
|
700
|
+
|
701
|
+
void LzmaDec_Init(CLzmaDec *p)
|
702
|
+
{
|
703
|
+
p->dicPos = 0;
|
704
|
+
LzmaDec_InitDicAndState(p, True, True);
|
705
|
+
}
|
706
|
+
|
707
|
+
static void LzmaDec_InitStateReal(CLzmaDec *p)
|
708
|
+
{
|
709
|
+
UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (p->prop.lc + p->prop.lp));
|
710
|
+
UInt32 i;
|
711
|
+
CLzmaProb *probs = p->probs;
|
712
|
+
for (i = 0; i < numProbs; i++)
|
713
|
+
probs[i] = kBitModelTotal >> 1;
|
714
|
+
p->reps[0] = p->reps[1] = p->reps[2] = p->reps[3] = 1;
|
715
|
+
p->state = 0;
|
716
|
+
p->needInitState = 0;
|
717
|
+
}
|
718
|
+
|
719
|
+
SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen,
|
720
|
+
ELzmaFinishMode finishMode, ELzmaStatus *status)
|
721
|
+
{
|
722
|
+
SizeT inSize = *srcLen;
|
723
|
+
(*srcLen) = 0;
|
724
|
+
LzmaDec_WriteRem(p, dicLimit);
|
725
|
+
|
726
|
+
*status = LZMA_STATUS_NOT_SPECIFIED;
|
727
|
+
|
728
|
+
while (p->remainLen != kMatchSpecLenStart)
|
729
|
+
{
|
730
|
+
int checkEndMarkNow;
|
731
|
+
|
732
|
+
if (p->needFlush != 0)
|
733
|
+
{
|
734
|
+
for (; inSize > 0 && p->tempBufSize < RC_INIT_SIZE; (*srcLen)++, inSize--)
|
735
|
+
p->tempBuf[p->tempBufSize++] = *src++;
|
736
|
+
if (p->tempBufSize < RC_INIT_SIZE)
|
737
|
+
{
|
738
|
+
*status = LZMA_STATUS_NEEDS_MORE_INPUT;
|
739
|
+
return SZ_OK;
|
740
|
+
}
|
741
|
+
if (p->tempBuf[0] != 0)
|
742
|
+
return SZ_ERROR_DATA;
|
743
|
+
|
744
|
+
LzmaDec_InitRc(p, p->tempBuf);
|
745
|
+
p->tempBufSize = 0;
|
746
|
+
}
|
747
|
+
|
748
|
+
checkEndMarkNow = 0;
|
749
|
+
if (p->dicPos >= dicLimit)
|
750
|
+
{
|
751
|
+
if (p->remainLen == 0 && p->code == 0)
|
752
|
+
{
|
753
|
+
*status = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK;
|
754
|
+
return SZ_OK;
|
755
|
+
}
|
756
|
+
if (finishMode == LZMA_FINISH_ANY)
|
757
|
+
{
|
758
|
+
*status = LZMA_STATUS_NOT_FINISHED;
|
759
|
+
return SZ_OK;
|
760
|
+
}
|
761
|
+
if (p->remainLen != 0)
|
762
|
+
{
|
763
|
+
*status = LZMA_STATUS_NOT_FINISHED;
|
764
|
+
return SZ_ERROR_DATA;
|
765
|
+
}
|
766
|
+
checkEndMarkNow = 1;
|
767
|
+
}
|
768
|
+
|
769
|
+
if (p->needInitState)
|
770
|
+
LzmaDec_InitStateReal(p);
|
771
|
+
|
772
|
+
if (p->tempBufSize == 0)
|
773
|
+
{
|
774
|
+
SizeT processed;
|
775
|
+
const Byte *bufLimit;
|
776
|
+
if (inSize < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)
|
777
|
+
{
|
778
|
+
int dummyRes = LzmaDec_TryDummy(p, src, inSize);
|
779
|
+
if (dummyRes == DUMMY_ERROR)
|
780
|
+
{
|
781
|
+
memcpy(p->tempBuf, src, inSize);
|
782
|
+
p->tempBufSize = (unsigned)inSize;
|
783
|
+
(*srcLen) += inSize;
|
784
|
+
*status = LZMA_STATUS_NEEDS_MORE_INPUT;
|
785
|
+
return SZ_OK;
|
786
|
+
}
|
787
|
+
if (checkEndMarkNow && dummyRes != DUMMY_MATCH)
|
788
|
+
{
|
789
|
+
*status = LZMA_STATUS_NOT_FINISHED;
|
790
|
+
return SZ_ERROR_DATA;
|
791
|
+
}
|
792
|
+
bufLimit = src;
|
793
|
+
}
|
794
|
+
else
|
795
|
+
bufLimit = src + inSize - LZMA_REQUIRED_INPUT_MAX;
|
796
|
+
p->buf = src;
|
797
|
+
if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0)
|
798
|
+
return SZ_ERROR_DATA;
|
799
|
+
processed = (SizeT)(p->buf - src);
|
800
|
+
(*srcLen) += processed;
|
801
|
+
src += processed;
|
802
|
+
inSize -= processed;
|
803
|
+
}
|
804
|
+
else
|
805
|
+
{
|
806
|
+
unsigned rem = p->tempBufSize, lookAhead = 0;
|
807
|
+
while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize)
|
808
|
+
p->tempBuf[rem++] = src[lookAhead++];
|
809
|
+
p->tempBufSize = rem;
|
810
|
+
if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)
|
811
|
+
{
|
812
|
+
int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, rem);
|
813
|
+
if (dummyRes == DUMMY_ERROR)
|
814
|
+
{
|
815
|
+
(*srcLen) += lookAhead;
|
816
|
+
*status = LZMA_STATUS_NEEDS_MORE_INPUT;
|
817
|
+
return SZ_OK;
|
818
|
+
}
|
819
|
+
if (checkEndMarkNow && dummyRes != DUMMY_MATCH)
|
820
|
+
{
|
821
|
+
*status = LZMA_STATUS_NOT_FINISHED;
|
822
|
+
return SZ_ERROR_DATA;
|
823
|
+
}
|
824
|
+
}
|
825
|
+
p->buf = p->tempBuf;
|
826
|
+
if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0)
|
827
|
+
return SZ_ERROR_DATA;
|
828
|
+
lookAhead -= (rem - (unsigned)(p->buf - p->tempBuf));
|
829
|
+
(*srcLen) += lookAhead;
|
830
|
+
src += lookAhead;
|
831
|
+
inSize -= lookAhead;
|
832
|
+
p->tempBufSize = 0;
|
833
|
+
}
|
834
|
+
}
|
835
|
+
if (p->code == 0)
|
836
|
+
*status = LZMA_STATUS_FINISHED_WITH_MARK;
|
837
|
+
return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA;
|
838
|
+
}
|
839
|
+
|
840
|
+
SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status)
|
841
|
+
{
|
842
|
+
SizeT outSize = *destLen;
|
843
|
+
SizeT inSize = *srcLen;
|
844
|
+
*srcLen = *destLen = 0;
|
845
|
+
for (;;)
|
846
|
+
{
|
847
|
+
SizeT inSizeCur = inSize, outSizeCur, dicPos;
|
848
|
+
ELzmaFinishMode curFinishMode;
|
849
|
+
SRes res;
|
850
|
+
if (p->dicPos == p->dicBufSize)
|
851
|
+
p->dicPos = 0;
|
852
|
+
dicPos = p->dicPos;
|
853
|
+
if (outSize > p->dicBufSize - dicPos)
|
854
|
+
{
|
855
|
+
outSizeCur = p->dicBufSize;
|
856
|
+
curFinishMode = LZMA_FINISH_ANY;
|
857
|
+
}
|
858
|
+
else
|
859
|
+
{
|
860
|
+
outSizeCur = dicPos + outSize;
|
861
|
+
curFinishMode = finishMode;
|
862
|
+
}
|
863
|
+
|
864
|
+
res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status);
|
865
|
+
src += inSizeCur;
|
866
|
+
inSize -= inSizeCur;
|
867
|
+
*srcLen += inSizeCur;
|
868
|
+
outSizeCur = p->dicPos - dicPos;
|
869
|
+
memcpy(dest, p->dic + dicPos, outSizeCur);
|
870
|
+
dest += outSizeCur;
|
871
|
+
outSize -= outSizeCur;
|
872
|
+
*destLen += outSizeCur;
|
873
|
+
if (res != 0)
|
874
|
+
return res;
|
875
|
+
if (outSizeCur == 0 || outSize == 0)
|
876
|
+
return SZ_OK;
|
877
|
+
}
|
878
|
+
}
|
879
|
+
|
880
|
+
void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc)
|
881
|
+
{
|
882
|
+
alloc->Free(alloc, p->probs);
|
883
|
+
p->probs = 0;
|
884
|
+
}
|
885
|
+
|
886
|
+
static void LzmaDec_FreeDict(CLzmaDec *p, ISzAlloc *alloc)
|
887
|
+
{
|
888
|
+
alloc->Free(alloc, p->dic);
|
889
|
+
p->dic = 0;
|
890
|
+
}
|
891
|
+
|
892
|
+
void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc)
|
893
|
+
{
|
894
|
+
LzmaDec_FreeProbs(p, alloc);
|
895
|
+
LzmaDec_FreeDict(p, alloc);
|
896
|
+
}
|
897
|
+
|
898
|
+
SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size)
|
899
|
+
{
|
900
|
+
UInt32 dicSize;
|
901
|
+
Byte d;
|
902
|
+
|
903
|
+
if (size < LZMA_PROPS_SIZE)
|
904
|
+
return SZ_ERROR_UNSUPPORTED;
|
905
|
+
else
|
906
|
+
dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24);
|
907
|
+
|
908
|
+
if (dicSize < LZMA_DIC_MIN)
|
909
|
+
dicSize = LZMA_DIC_MIN;
|
910
|
+
p->dicSize = dicSize;
|
911
|
+
|
912
|
+
d = data[0];
|
913
|
+
if (d >= (9 * 5 * 5))
|
914
|
+
return SZ_ERROR_UNSUPPORTED;
|
915
|
+
|
916
|
+
p->lc = d % 9;
|
917
|
+
d /= 9;
|
918
|
+
p->pb = d / 5;
|
919
|
+
p->lp = d % 5;
|
920
|
+
|
921
|
+
return SZ_OK;
|
922
|
+
}
|
923
|
+
|
924
|
+
static SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc)
|
925
|
+
{
|
926
|
+
UInt32 numProbs = LzmaProps_GetNumProbs(propNew);
|
927
|
+
if (p->probs == 0 || numProbs != p->numProbs)
|
928
|
+
{
|
929
|
+
LzmaDec_FreeProbs(p, alloc);
|
930
|
+
p->probs = (CLzmaProb *)alloc->Alloc(alloc, numProbs * sizeof(CLzmaProb));
|
931
|
+
p->numProbs = numProbs;
|
932
|
+
if (p->probs == 0)
|
933
|
+
return SZ_ERROR_MEM;
|
934
|
+
}
|
935
|
+
return SZ_OK;
|
936
|
+
}
|
937
|
+
|
938
|
+
SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
|
939
|
+
{
|
940
|
+
CLzmaProps propNew;
|
941
|
+
RINOK(LzmaProps_Decode(&propNew, props, propsSize));
|
942
|
+
RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc));
|
943
|
+
p->prop = propNew;
|
944
|
+
return SZ_OK;
|
945
|
+
}
|
946
|
+
|
947
|
+
SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
|
948
|
+
{
|
949
|
+
CLzmaProps propNew;
|
950
|
+
SizeT dicBufSize;
|
951
|
+
RINOK(LzmaProps_Decode(&propNew, props, propsSize));
|
952
|
+
RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc));
|
953
|
+
dicBufSize = propNew.dicSize;
|
954
|
+
if (p->dic == 0 || dicBufSize != p->dicBufSize)
|
955
|
+
{
|
956
|
+
LzmaDec_FreeDict(p, alloc);
|
957
|
+
p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize);
|
958
|
+
if (p->dic == 0)
|
959
|
+
{
|
960
|
+
LzmaDec_FreeProbs(p, alloc);
|
961
|
+
return SZ_ERROR_MEM;
|
962
|
+
}
|
963
|
+
}
|
964
|
+
p->dicBufSize = dicBufSize;
|
965
|
+
p->prop = propNew;
|
966
|
+
return SZ_OK;
|
967
|
+
}
|
968
|
+
|
969
|
+
SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
|
970
|
+
const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
|
971
|
+
ELzmaStatus *status, ISzAlloc *alloc)
|
972
|
+
{
|
973
|
+
CLzmaDec p;
|
974
|
+
SRes res;
|
975
|
+
SizeT inSize = *srcLen;
|
976
|
+
SizeT outSize = *destLen;
|
977
|
+
*srcLen = *destLen = 0;
|
978
|
+
if (inSize < RC_INIT_SIZE)
|
979
|
+
return SZ_ERROR_INPUT_EOF;
|
980
|
+
|
981
|
+
LzmaDec_Construct(&p);
|
982
|
+
res = LzmaDec_AllocateProbs(&p, propData, propSize, alloc);
|
983
|
+
if (res != 0)
|
984
|
+
return res;
|
985
|
+
p.dic = dest;
|
986
|
+
p.dicBufSize = outSize;
|
987
|
+
|
988
|
+
LzmaDec_Init(&p);
|
989
|
+
|
990
|
+
*srcLen = inSize;
|
991
|
+
res = LzmaDec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status);
|
992
|
+
|
993
|
+
if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT)
|
994
|
+
res = SZ_ERROR_INPUT_EOF;
|
995
|
+
|
996
|
+
(*destLen) = p.dicPos;
|
997
|
+
LzmaDec_FreeProbs(&p, alloc);
|
998
|
+
return res;
|
999
|
+
}
|