From d9666cf046a8453b33b3e2fbf4d82295a9f87df3 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Sat, 20 Jan 2007 00:00:00 +0000 Subject: 4.44 beta --- 7zip/Archive/7z/7z.dsp | 593 ----- 7zip/Archive/7z/7z.dsw | 29 - 7zip/Archive/7z/7z.ico | Bin 4710 -> 0 bytes 7zip/Archive/7z/7zCompressionMode.cpp | 3 - 7zip/Archive/7z/7zCompressionMode.h | 64 - 7zip/Archive/7z/7zDecode.cpp | 444 ---- 7zip/Archive/7z/7zDecode.h | 71 - 7zip/Archive/7z/7zEncode.cpp | 614 ------ 7zip/Archive/7z/7zEncode.h | 56 - 7zip/Archive/7z/7zExtract.cpp | 265 --- 7zip/Archive/7z/7zFolderInStream.cpp | 129 -- 7zip/Archive/7z/7zFolderInStream.h | 66 - 7zip/Archive/7z/7zFolderOutStream.cpp | 162 -- 7zip/Archive/7z/7zFolderOutStream.h | 57 - 7zip/Archive/7z/7zHandler.cpp | 794 ------- 7zip/Archive/7z/7zHandler.h | 249 --- 7zip/Archive/7z/7zHandlerOut.cpp | 1155 ---------- 7zip/Archive/7z/7zHeader.cpp | 19 - 7zip/Archive/7z/7zHeader.h | 96 - 7zip/Archive/7z/7zIn.cpp | 1335 ------------ 7zip/Archive/7z/7zIn.h | 288 --- 7zip/Archive/7z/7zItem.h | 181 -- 7zip/Archive/7z/7zMethodID.cpp | 76 - 7zip/Archive/7z/7zMethodID.h | 29 - 7zip/Archive/7z/7zMethods.cpp | 174 -- 7zip/Archive/7z/7zMethods.h | 36 - 7zip/Archive/7z/7zOut.cpp | 1136 ---------- 7zip/Archive/7z/7zOut.h | 192 -- 7zip/Archive/7z/7zProperties.cpp | 166 -- 7zip/Archive/7z/7zProperties.h | 22 - 7zip/Archive/7z/7zSpecStream.cpp | 24 - 7zip/Archive/7z/7zSpecStream.h | 35 - 7zip/Archive/7z/7zUpdate.cpp | 1099 ---------- 7zip/Archive/7z/7zUpdate.h | 79 - 7zip/Archive/7z/DllExports.cpp | 115 - 7zip/Archive/7z/StdAfx.cpp | 3 - 7zip/Archive/7z/StdAfx.h | 9 - 7zip/Archive/7z/makefile | 89 - 7zip/Archive/7z/resource.rc | 5 - 7zip/Archive/7z_C/7zAlloc.c | 70 - 7zip/Archive/7z_C/7zAlloc.h | 20 - 7zip/Archive/7z_C/7zBuffer.c | 29 - 7zip/Archive/7z_C/7zBuffer.h | 19 - 7zip/Archive/7z_C/7zCrc.c | 76 - 7zip/Archive/7z_C/7zCrc.h | 24 - 7zip/Archive/7z_C/7zDecode.c | 150 -- 7zip/Archive/7z_C/7zDecode.h | 21 - 7zip/Archive/7z_C/7zExtract.c | 118 - 7zip/Archive/7z_C/7zExtract.h | 40 - 7zip/Archive/7z_C/7zHeader.c | 5 - 7zip/Archive/7z_C/7zHeader.h | 55 - 7zip/Archive/7z_C/7zIn.c | 1282 ----------- 7zip/Archive/7z_C/7zIn.h | 55 - 7zip/Archive/7z_C/7zItem.c | 133 -- 7zip/Archive/7z_C/7zItem.h | 90 - 7zip/Archive/7z_C/7zMain.c | 356 --- 7zip/Archive/7z_C/7zMethodID.c | 14 - 7zip/Archive/7z_C/7zMethodID.h | 18 - 7zip/Archive/7z_C/7zTypes.h | 67 - 7zip/Archive/7z_C/7z_C.dsp | 182 -- 7zip/Archive/7z_C/7z_C.dsw | 29 - 7zip/Archive/7z_C/makefile | 55 - 7zip/Archive/7z_C/makefile.gcc | 50 - 7zip/Archive/Archive.def | 3 - 7zip/Archive/Arj/Arj.dsp | 329 --- 7zip/Archive/Arj/Arj.dsw | 29 - 7zip/Archive/Arj/ArjHandler.cpp | 485 ----- 7zip/Archive/Arj/ArjHandler.h | 47 - 7zip/Archive/Arj/ArjHeader.h | 121 - 7zip/Archive/Arj/ArjIn.cpp | 283 --- 7zip/Archive/Arj/ArjIn.h | 75 - 7zip/Archive/Arj/ArjItem.h | 75 - 7zip/Archive/Arj/DllExports.cpp | 75 - 7zip/Archive/Arj/StdAfx.cpp | 3 - 7zip/Archive/Arj/StdAfx.h | 8 - 7zip/Archive/Arj/arj.ico | Bin 3638 -> 0 bytes 7zip/Archive/Arj/makefile | 66 - 7zip/Archive/Arj/resource.rc | 5 - 7zip/Archive/BZip2/BZip2.dsp | 281 --- 7zip/Archive/BZip2/BZip2.dsw | 29 - 7zip/Archive/BZip2/BZip2Handler.cpp | 285 --- 7zip/Archive/BZip2/BZip2Handler.h | 83 - 7zip/Archive/BZip2/BZip2HandlerOut.cpp | 156 -- 7zip/Archive/BZip2/BZip2Item.h | 20 - 7zip/Archive/BZip2/BZip2Update.cpp | 84 - 7zip/Archive/BZip2/BZip2Update.h | 24 - 7zip/Archive/BZip2/DllExports.cpp | 127 -- 7zip/Archive/BZip2/StdAfx.cpp | 3 - 7zip/Archive/BZip2/StdAfx.h | 8 - 7zip/Archive/BZip2/bz2.ico | Bin 3638 -> 0 bytes 7zip/Archive/BZip2/makefile | 55 - 7zip/Archive/BZip2/resource.rc | 5 - 7zip/Archive/Cab/Cab.dsp | 395 ---- 7zip/Archive/Cab/Cab.dsw | 29 - 7zip/Archive/Cab/CabBlockInStream.cpp | 194 -- 7zip/Archive/Cab/CabBlockInStream.h | 56 - 7zip/Archive/Cab/CabHandler.cpp | 812 ------- 7zip/Archive/Cab/CabHandler.h | 45 - 7zip/Archive/Cab/CabHeader.cpp | 19 - 7zip/Archive/Cab/CabHeader.h | 42 - 7zip/Archive/Cab/CabIn.cpp | 343 --- 7zip/Archive/Cab/CabIn.h | 166 -- 7zip/Archive/Cab/CabItem.h | 62 - 7zip/Archive/Cab/DllExports.cpp | 72 - 7zip/Archive/Cab/StdAfx.cpp | 3 - 7zip/Archive/Cab/StdAfx.h | 8 - 7zip/Archive/Cab/cab.ico | Bin 3638 -> 0 bytes 7zip/Archive/Cab/makefile | 70 - 7zip/Archive/Cab/resource.rc | 5 - 7zip/Archive/Chm/Chm.dsp | 337 --- 7zip/Archive/Chm/Chm.dsw | 29 - 7zip/Archive/Chm/ChmHandler.cpp | 731 ------- 7zip/Archive/Chm/ChmHandler.h | 46 - 7zip/Archive/Chm/ChmHeader.cpp | 24 - 7zip/Archive/Chm/ChmHeader.h | 28 - 7zip/Archive/Chm/ChmIn.cpp | 925 -------- 7zip/Archive/Chm/ChmIn.h | 242 -- 7zip/Archive/Chm/DllExports.cpp | 77 - 7zip/Archive/Chm/StdAfx.cpp | 3 - 7zip/Archive/Chm/StdAfx.h | 8 - 7zip/Archive/Chm/makefile | 68 - 7zip/Archive/Chm/resource.rc | 3 - 7zip/Archive/Common/CodecsPath.cpp | 34 - 7zip/Archive/Common/CodecsPath.h | 12 - 7zip/Archive/Common/CoderLoader.cpp | 31 - 7zip/Archive/Common/CoderLoader.h | 147 -- 7zip/Archive/Common/CoderMixer2.cpp | 121 - 7zip/Archive/Common/CoderMixer2.h | 168 -- 7zip/Archive/Common/CoderMixer2MT.cpp | 359 --- 7zip/Archive/Common/CoderMixer2MT.h | 121 - 7zip/Archive/Common/CoderMixer2ST.cpp | 238 -- 7zip/Archive/Common/CoderMixer2ST.h | 88 - 7zip/Archive/Common/CrossThreadProgress.cpp | 15 - 7zip/Archive/Common/CrossThreadProgress.h | 31 - 7zip/Archive/Common/DummyOutStream.cpp | 20 - 7zip/Archive/Common/DummyOutStream.h | 23 - 7zip/Archive/Common/FilterCoder.cpp | 243 --- 7zip/Archive/Common/FilterCoder.h | 130 -- 7zip/Archive/Common/InStreamWithCRC.cpp | 41 - 7zip/Archive/Common/InStreamWithCRC.h | 65 - 7zip/Archive/Common/ItemNameUtils.cpp | 59 - 7zip/Archive/Common/ItemNameUtils.h | 24 - 7zip/Archive/Common/MultiStream.cpp | 201 -- 7zip/Archive/Common/MultiStream.h | 76 - 7zip/Archive/Common/OutStreamWithCRC.cpp | 24 - 7zip/Archive/Common/OutStreamWithCRC.h | 37 - 7zip/Archive/Common/ParseProperties.cpp | 171 -- 7zip/Archive/Common/ParseProperties.h | 17 - 7zip/Archive/Common/StdAfx.h | 9 - 7zip/Archive/Cpio/makefile | 55 - 7zip/Archive/Deb/Deb.dsp | 269 --- 7zip/Archive/Deb/Deb.dsw | 29 - 7zip/Archive/Deb/DebHandler.cpp | 255 --- 7zip/Archive/Deb/DebHandler.h | 47 - 7zip/Archive/Deb/DebHeader.cpp | 13 - 7zip/Archive/Deb/DebHeader.h | 38 - 7zip/Archive/Deb/DebIn.cpp | 165 -- 7zip/Archive/Deb/DebIn.h | 29 - 7zip/Archive/Deb/DebItem.h | 32 - 7zip/Archive/Deb/DllExports.cpp | 73 - 7zip/Archive/Deb/StdAfx.cpp | 3 - 7zip/Archive/Deb/StdAfx.h | 8 - 7zip/Archive/Deb/deb.ico | Bin 3638 -> 0 bytes 7zip/Archive/Deb/makefile | 54 - 7zip/Archive/Deb/resource.rc | 5 - 7zip/Archive/GZip/DllExports.cpp | 125 -- 7zip/Archive/GZip/GZip.dsp | 321 --- 7zip/Archive/GZip/GZip.dsw | 29 - 7zip/Archive/GZip/GZipHandler.cpp | 361 --- 7zip/Archive/GZip/GZipHandler.h | 79 - 7zip/Archive/GZip/GZipHandlerOut.cpp | 200 -- 7zip/Archive/GZip/GZipHeader.cpp | 20 - 7zip/Archive/GZip/GZipHeader.h | 85 - 7zip/Archive/GZip/GZipIn.cpp | 121 - 7zip/Archive/GZip/GZipIn.h | 31 - 7zip/Archive/GZip/GZipItem.h | 59 - 7zip/Archive/GZip/GZipOut.cpp | 69 - 7zip/Archive/GZip/GZipOut.h | 29 - 7zip/Archive/GZip/GZipUpdate.cpp | 120 - 7zip/Archive/GZip/GZipUpdate.h | 32 - 7zip/Archive/GZip/StdAfx.cpp | 3 - 7zip/Archive/GZip/StdAfx.h | 8 - 7zip/Archive/GZip/gz.ico | Bin 3638 -> 0 bytes 7zip/Archive/GZip/makefile | 60 - 7zip/Archive/GZip/resource.rc | 5 - 7zip/Archive/IArchive.h | 173 -- 7zip/Archive/Iso/DllExports.cpp | 88 - 7zip/Archive/Iso/Iso.dsp | 273 --- 7zip/Archive/Iso/Iso.dsw | 29 - 7zip/Archive/Iso/Iso.ico | Bin 3638 -> 0 bytes 7zip/Archive/Iso/IsoHandler.cpp | 301 --- 7zip/Archive/Iso/IsoHandler.h | 59 - 7zip/Archive/Iso/IsoHeader.cpp | 21 - 7zip/Archive/Iso/IsoHeader.h | 61 - 7zip/Archive/Iso/IsoIn.cpp | 438 ---- 7zip/Archive/Iso/IsoIn.h | 301 --- 7zip/Archive/Iso/IsoItem.h | 145 -- 7zip/Archive/Iso/StdAfx.cpp | 3 - 7zip/Archive/Iso/StdAfx.h | 9 - 7zip/Archive/Iso/makefile | 55 - 7zip/Archive/Iso/resource.rc | 5 - 7zip/Archive/Lzh/DllExports.cpp | 72 - 7zip/Archive/Lzh/Lzh.def | 7 - 7zip/Archive/Lzh/Lzh.dsp | 333 --- 7zip/Archive/Lzh/Lzh.dsw | 29 - 7zip/Archive/Lzh/LzhCRC.cpp | 43 - 7zip/Archive/Lzh/LzhCRC.h | 27 - 7zip/Archive/Lzh/LzhHandler.cpp | 464 ---- 7zip/Archive/Lzh/LzhHandler.h | 47 - 7zip/Archive/Lzh/LzhHeader.h | 19 - 7zip/Archive/Lzh/LzhIn.cpp | 171 -- 7zip/Archive/Lzh/LzhIn.h | 29 - 7zip/Archive/Lzh/LzhItem.h | 172 -- 7zip/Archive/Lzh/LzhOutStreamWithCRC.cpp | 27 - 7zip/Archive/Lzh/LzhOutStreamWithCRC.h | 38 - 7zip/Archive/Lzh/StdAfx.cpp | 3 - 7zip/Archive/Lzh/StdAfx.h | 8 - 7zip/Archive/Lzh/lzh.ico | Bin 3638 -> 0 bytes 7zip/Archive/Lzh/makefile | 65 - 7zip/Archive/Lzh/resource.rc | 5 - 7zip/Archive/Nsis/DllExports.cpp | 110 - 7zip/Archive/Nsis/Nsis.dsp | 337 --- 7zip/Archive/Nsis/Nsis.dsw | 29 - 7zip/Archive/Nsis/NsisDecode.cpp | 150 -- 7zip/Archive/Nsis/NsisDecode.h | 47 - 7zip/Archive/Nsis/NsisHandler.cpp | 484 ---- 7zip/Archive/Nsis/NsisHandler.h | 41 - 7zip/Archive/Nsis/NsisIn.cpp | 1169 ---------- 7zip/Archive/Nsis/NsisIn.h | 166 -- 7zip/Archive/Nsis/StdAfx.cpp | 3 - 7zip/Archive/Nsis/StdAfx.h | 9 - 7zip/Archive/Nsis/makefile | 67 - 7zip/Archive/Nsis/resource.rc | 3 - 7zip/Archive/RPM/DllExports.cpp | 68 - 7zip/Archive/RPM/Rpm.dsp | 205 -- 7zip/Archive/RPM/Rpm.dsw | 29 - 7zip/Archive/RPM/RpmHandler.cpp | 194 -- 7zip/Archive/RPM/RpmHandler.h | 46 - 7zip/Archive/RPM/RpmHeader.h | 63 - 7zip/Archive/RPM/RpmIn.cpp | 112 - 7zip/Archive/RPM/RpmIn.h | 15 - 7zip/Archive/RPM/StdAfx.cpp | 3 - 7zip/Archive/RPM/StdAfx.h | 8 - 7zip/Archive/RPM/makefile | 42 - 7zip/Archive/RPM/resource.rc | 5 - 7zip/Archive/RPM/rpm.ico | Bin 3638 -> 0 bytes 7zip/Archive/Rar/DllExports.cpp | 142 -- 7zip/Archive/Rar/Rar.dsp | 459 ---- 7zip/Archive/Rar/Rar.dsw | 29 - 7zip/Archive/Rar/RarHandler.cpp | 941 -------- 7zip/Archive/Rar/RarHandler.h | 63 - 7zip/Archive/Rar/RarHeader.cpp | 21 - 7zip/Archive/Rar/RarHeader.h | 224 -- 7zip/Archive/Rar/RarIn.cpp | 535 ----- 7zip/Archive/Rar/RarIn.h | 124 -- 7zip/Archive/Rar/RarItem.cpp | 118 - 7zip/Archive/Rar/RarItem.h | 91 - 7zip/Archive/Rar/RarVolumeInStream.cpp | 79 - 7zip/Archive/Rar/RarVolumeInStream.h | 50 - 7zip/Archive/Rar/StdAfx.cpp | 3 - 7zip/Archive/Rar/StdAfx.h | 8 - 7zip/Archive/Rar/makefile | 90 - 7zip/Archive/Rar/rar.ico | Bin 3638 -> 0 bytes 7zip/Archive/Rar/resource.rc | 5 - 7zip/Archive/Split/DllExports.cpp | 65 - 7zip/Archive/Split/Split.dsp | 237 -- 7zip/Archive/Split/Split.dsw | 29 - 7zip/Archive/Split/Split.ico | Bin 3638 -> 0 bytes 7zip/Archive/Split/SplitHandler.cpp | 415 ---- 7zip/Archive/Split/SplitHandler.h | 62 - 7zip/Archive/Split/SplitHandlerOut.cpp | 102 - 7zip/Archive/Split/StdAfx.cpp | 3 - 7zip/Archive/Split/StdAfx.h | 8 - 7zip/Archive/Split/makefile | 51 - 7zip/Archive/Split/resource.rc | 5 - 7zip/Archive/Tar/DllExports.cpp | 86 - 7zip/Archive/Tar/StdAfx.cpp | 3 - 7zip/Archive/Tar/StdAfx.h | 9 - 7zip/Archive/Tar/Tar.dsp | 297 --- 7zip/Archive/Tar/Tar.dsw | 29 - 7zip/Archive/Tar/TarHandler.cpp | 282 --- 7zip/Archive/Tar/TarHandler.h | 56 - 7zip/Archive/Tar/TarHandlerOut.cpp | 126 -- 7zip/Archive/Tar/TarHeader.cpp | 25 - 7zip/Archive/Tar/TarHeader.h | 99 - 7zip/Archive/Tar/TarIn.cpp | 248 --- 7zip/Archive/Tar/TarIn.h | 30 - 7zip/Archive/Tar/TarItem.h | 69 - 7zip/Archive/Tar/TarOut.cpp | 191 -- 7zip/Archive/Tar/TarOut.h | 28 - 7zip/Archive/Tar/TarUpdate.cpp | 162 -- 7zip/Archive/Tar/TarUpdate.h | 36 - 7zip/Archive/Tar/makefile | 59 - 7zip/Archive/Tar/resource.rc | 5 - 7zip/Archive/Tar/tar.ico | Bin 3638 -> 0 bytes 7zip/Archive/Z/DllExports.cpp | 91 - 7zip/Archive/Z/StdAfx.cpp | 3 - 7zip/Archive/Z/StdAfx.h | 8 - 7zip/Archive/Z/Z.dsp | 237 -- 7zip/Archive/Z/Z.dsw | 29 - 7zip/Archive/Z/Z.ico | Bin 3638 -> 0 bytes 7zip/Archive/Z/ZHandler.cpp | 202 -- 7zip/Archive/Z/ZHandler.h | 47 - 7zip/Archive/Z/makefile | 52 - 7zip/Archive/Z/resource.rc | 5 - 7zip/Archive/Zip/DllExports.cpp | 152 -- 7zip/Archive/Zip/StdAfx.cpp | 3 - 7zip/Archive/Zip/StdAfx.h | 8 - 7zip/Archive/Zip/Zip.dsp | 651 ------ 7zip/Archive/Zip/Zip.dsw | 29 - 7zip/Archive/Zip/ZipAddCommon.cpp | 309 --- 7zip/Archive/Zip/ZipAddCommon.h | 58 - 7zip/Archive/Zip/ZipCompressionMode.h | 39 - 7zip/Archive/Zip/ZipHandler.cpp | 766 ------- 7zip/Archive/Zip/ZipHandler.h | 100 - 7zip/Archive/Zip/ZipHandlerOut.cpp | 393 ---- 7zip/Archive/Zip/ZipHeader.cpp | 36 - 7zip/Archive/Zip/ZipHeader.h | 248 --- 7zip/Archive/Zip/ZipIn.cpp | 797 ------- 7zip/Archive/Zip/ZipIn.h | 111 - 7zip/Archive/Zip/ZipItem.cpp | 137 -- 7zip/Archive/Zip/ZipItem.h | 191 -- 7zip/Archive/Zip/ZipItemEx.h | 29 - 7zip/Archive/Zip/ZipOut.cpp | 259 --- 7zip/Archive/Zip/ZipOut.h | 51 - 7zip/Archive/Zip/ZipUpdate.cpp | 718 ------ 7zip/Archive/Zip/ZipUpdate.h | 52 - 7zip/Archive/Zip/makefile | 124 -- 7zip/Archive/Zip/resource.rc | 5 - 7zip/Archive/Zip/zip.ico | Bin 3638 -> 0 bytes 7zip/Archive/cpio/CpioHandler.cpp | 289 --- 7zip/Archive/cpio/CpioHandler.h | 47 - 7zip/Archive/cpio/CpioHeader.cpp | 23 - 7zip/Archive/cpio/CpioHeader.h | 70 - 7zip/Archive/cpio/CpioIn.cpp | 271 --- 7zip/Archive/cpio/CpioIn.h | 41 - 7zip/Archive/cpio/CpioItem.h | 55 - 7zip/Archive/cpio/DllExports.cpp | 65 - 7zip/Archive/cpio/StdAfx.cpp | 3 - 7zip/Archive/cpio/StdAfx.h | 8 - 7zip/Archive/cpio/cpio.dsp | 265 --- 7zip/Archive/cpio/cpio.dsw | 29 - 7zip/Archive/cpio/cpio.ico | Bin 3638 -> 0 bytes 7zip/Archive/cpio/resource.rc | 5 - 7zip/Archive/makefile | 23 - 7zip/Bundles/Alone/Alone.dsp | 2201 ------------------- 7zip/Bundles/Alone/Alone.dsw | 29 - 7zip/Bundles/Alone/StdAfx.cpp | 3 - 7zip/Bundles/Alone/StdAfx.h | 9 - 7zip/Bundles/Alone/afxres.h | 1 - 7zip/Bundles/Alone/makefile | 357 --- 7zip/Bundles/Alone/resource.rc | 3 - 7zip/Bundles/Alone7z/Alone.dsp | 1366 ------------ 7zip/Bundles/Alone7z/Alone.dsw | 29 - 7zip/Bundles/Alone7z/StdAfx.cpp | 3 - 7zip/Bundles/Alone7z/StdAfx.h | 9 - 7zip/Bundles/Alone7z/makefile | 183 -- 7zip/Bundles/Alone7z/resource.rc | 3 - 7zip/Bundles/Format7z/Format7z.dsp | 957 -------- 7zip/Bundles/Format7z/Format7z.dsw | 29 - 7zip/Bundles/Format7z/StdAfx.cpp | 3 - 7zip/Bundles/Format7z/StdAfx.h | 9 - 7zip/Bundles/Format7z/makefile | 190 -- 7zip/Bundles/Format7z/resource.rc | 5 - 7zip/Bundles/Format7zExtract/Format7z.dsp | 813 ------- 7zip/Bundles/Format7zExtract/Format7z.dsw | 29 - 7zip/Bundles/Format7zExtract/StdAfx.cpp | 3 - 7zip/Bundles/Format7zExtract/StdAfx.h | 9 - 7zip/Bundles/Format7zExtract/makefile | 175 -- 7zip/Bundles/Format7zExtract/resource.rc | 5 - 7zip/Bundles/SFXCon/7z.ico | Bin 1078 -> 0 bytes 7zip/Bundles/SFXCon/Main.cpp | 416 ---- 7zip/Bundles/SFXCon/SFXCon.dsp | 759 ------- 7zip/Bundles/SFXCon/SFXCon.dsw | 29 - 7zip/Bundles/SFXCon/StdAfx.cpp | 3 - 7zip/Bundles/SFXCon/StdAfx.h | 9 - 7zip/Bundles/SFXCon/makefile | 180 -- 7zip/Bundles/SFXCon/resource.rc | 5 - 7zip/Bundles/SFXSetup/ExtractCallback.cpp | 249 --- 7zip/Bundles/SFXSetup/ExtractCallback.h | 96 - 7zip/Bundles/SFXSetup/ExtractEngine.cpp | 139 -- 7zip/Bundles/SFXSetup/ExtractEngine.h | 17 - 7zip/Bundles/SFXSetup/Main.cpp | 335 --- 7zip/Bundles/SFXSetup/SFXSetup.dsp | 696 ------ 7zip/Bundles/SFXSetup/SFXSetup.dsw | 29 - 7zip/Bundles/SFXSetup/StdAfx.cpp | 3 - 7zip/Bundles/SFXSetup/StdAfx.h | 10 - 7zip/Bundles/SFXSetup/makefile | 156 -- 7zip/Bundles/SFXSetup/resource.h | 6 - 7zip/Bundles/SFXSetup/resource.rc | 16 - 7zip/Bundles/SFXSetup/setup.ico | Bin 1078 -> 0 bytes 7zip/Bundles/SFXWin/7z.ico | Bin 1078 -> 0 bytes 7zip/Bundles/SFXWin/Main.cpp | 115 - 7zip/Bundles/SFXWin/SFXWin.dsp | 847 ------- 7zip/Bundles/SFXWin/SFXWin.dsw | 29 - 7zip/Bundles/SFXWin/StdAfx.cpp | 3 - 7zip/Bundles/SFXWin/StdAfx.h | 12 - 7zip/Bundles/SFXWin/makefile | 207 -- 7zip/Bundles/SFXWin/resource.h | 7 - 7zip/Bundles/SFXWin/resource.rc | 34 - 7zip/Bundles/makefile | 13 - 7zip/Common/FilePathAutoRename.cpp | 57 - 7zip/Common/FilePathAutoRename.h | 10 - 7zip/Common/FileStreams.cpp | 251 --- 7zip/Common/FileStreams.h | 98 - 7zip/Common/InBuffer.cpp | 80 - 7zip/Common/InBuffer.h | 76 - 7zip/Common/InMemStream.cpp | 222 -- 7zip/Common/InMemStream.h | 282 --- 7zip/Common/InOutTempBuffer.cpp | 122 -- 7zip/Common/InOutTempBuffer.h | 55 - 7zip/Common/LSBFDecoder.cpp | 34 - 7zip/Common/LSBFDecoder.h | 127 -- 7zip/Common/LSBFEncoder.cpp | 29 - 7zip/Common/LSBFEncoder.h | 51 - 7zip/Common/LimitedStreams.cpp | 24 - 7zip/Common/LimitedStreams.h | 33 - 7zip/Common/LockedStream.cpp | 23 - 7zip/Common/LockedStream.h | 38 - 7zip/Common/MSBFDecoder.h | 69 - 7zip/Common/MSBFEncoder.h | 59 - 7zip/Common/MemBlocks.cpp | 184 -- 7zip/Common/MemBlocks.h | 73 - 7zip/Common/OffsetStream.cpp | 35 - 7zip/Common/OffsetStream.h | 25 - 7zip/Common/OutBuffer.cpp | 116 - 7zip/Common/OutBuffer.h | 64 - 7zip/Common/OutMemStream.cpp | 137 -- 7zip/Common/OutMemStream.h | 88 - 7zip/Common/ProgressMt.cpp | 53 - 7zip/Common/ProgressMt.h | 47 - 7zip/Common/ProgressUtils.cpp | 55 - 7zip/Common/ProgressUtils.h | 43 - 7zip/Common/StdAfx.h | 9 - 7zip/Common/StreamBinder.cpp | 162 -- 7zip/Common/StreamBinder.h | 37 - 7zip/Common/StreamObjects.cpp | 68 - 7zip/Common/StreamObjects.h | 117 - 7zip/Common/StreamUtils.cpp | 44 - 7zip/Common/StreamUtils.h | 11 - 7zip/Compress/Arj/ArjDecoder1.cpp | 319 --- 7zip/Compress/Arj/ArjDecoder1.h | 105 - 7zip/Compress/Arj/ArjDecoder2.cpp | 93 - 7zip/Compress/Arj/ArjDecoder2.h | 65 - 7zip/Compress/Arj/StdAfx.h | 8 - 7zip/Compress/BWT/BlockSort.cpp | 288 --- 7zip/Compress/BWT/BlockSort.h | 29 - 7zip/Compress/BWT/Mtf8.h | 140 -- 7zip/Compress/BWT/StdAfx.h | 6 - 7zip/Compress/BZip2/BZip2.dsp | 281 --- 7zip/Compress/BZip2/BZip2.dsw | 29 - 7zip/Compress/BZip2/BZip2CRC.cpp | 26 - 7zip/Compress/BZip2/BZip2CRC.h | 30 - 7zip/Compress/BZip2/BZip2Const.h | 54 - 7zip/Compress/BZip2/BZip2Decoder.cpp | 648 ------ 7zip/Compress/BZip2/BZip2Decoder.h | 162 -- 7zip/Compress/BZip2/BZip2Encoder.cpp | 876 -------- 7zip/Compress/BZip2/BZip2Encoder.h | 247 --- 7zip/Compress/BZip2/DllExports.cpp | 93 - 7zip/Compress/BZip2/StdAfx.cpp | 3 - 7zip/Compress/BZip2/StdAfx.h | 8 - 7zip/Compress/BZip2/makefile | 50 - 7zip/Compress/BZip2/resource.rc | 3 - 7zip/Compress/BZip2Original/BZip2Decoder.cpp | 131 -- 7zip/Compress/BZip2Original/BZip2Decoder.h | 38 - 7zip/Compress/BZip2Original/BZip2Encoder.cpp | 120 - 7zip/Compress/BZip2Original/BZip2Encoder.h | 30 - 7zip/Compress/BZip2Original/BZip2Error.cpp | 10 - 7zip/Compress/BZip2Original/DllExports.cpp | 86 - 7zip/Compress/BZip2Original/StdAfx.cpp | 3 - 7zip/Compress/BZip2Original/StdAfx.h | 8 - 7zip/Compress/Branch/ARM.cpp | 16 - 7zip/Compress/Branch/ARM.h | 10 - 7zip/Compress/Branch/ARMThumb.cpp | 16 - 7zip/Compress/Branch/ARMThumb.h | 10 - 7zip/Compress/Branch/Branch.dsp | 298 --- 7zip/Compress/Branch/Branch.dsw | 29 - 7zip/Compress/Branch/BranchARM.c | 26 - 7zip/Compress/Branch/BranchARM.h | 10 - 7zip/Compress/Branch/BranchARMThumb.c | 35 - 7zip/Compress/Branch/BranchARMThumb.h | 10 - 7zip/Compress/Branch/BranchCoder.cpp | 18 - 7zip/Compress/Branch/BranchCoder.h | 54 - 7zip/Compress/Branch/BranchIA64.c | 63 - 7zip/Compress/Branch/BranchIA64.h | 10 - 7zip/Compress/Branch/BranchPPC.c | 36 - 7zip/Compress/Branch/BranchPPC.h | 10 - 7zip/Compress/Branch/BranchSPARC.c | 36 - 7zip/Compress/Branch/BranchSPARC.h | 10 - 7zip/Compress/Branch/BranchTypes.h | 25 - 7zip/Compress/Branch/BranchX86.c | 101 - 7zip/Compress/Branch/BranchX86.h | 13 - 7zip/Compress/Branch/DllExports.cpp | 152 -- 7zip/Compress/Branch/IA64.cpp | 16 - 7zip/Compress/Branch/IA64.h | 10 - 7zip/Compress/Branch/PPC.cpp | 17 - 7zip/Compress/Branch/PPC.h | 10 - 7zip/Compress/Branch/SPARC.cpp | 17 - 7zip/Compress/Branch/SPARC.h | 10 - 7zip/Compress/Branch/StdAfx.cpp | 3 - 7zip/Compress/Branch/StdAfx.h | 8 - 7zip/Compress/Branch/makefile | 48 - 7zip/Compress/Branch/resource.rc | 3 - 7zip/Compress/Branch/x86.cpp | 18 - 7zip/Compress/Branch/x86.h | 19 - 7zip/Compress/Branch/x86_2.cpp | 412 ---- 7zip/Compress/Branch/x86_2.h | 133 -- 7zip/Compress/ByteSwap/ByteSwap.cpp | 38 - 7zip/Compress/ByteSwap/ByteSwap.dsp | 125 -- 7zip/Compress/ByteSwap/ByteSwap.dsw | 29 - 7zip/Compress/ByteSwap/ByteSwap.h | 37 - 7zip/Compress/ByteSwap/DllExports.cpp | 91 - 7zip/Compress/ByteSwap/StdAfx.cpp | 3 - 7zip/Compress/ByteSwap/StdAfx.h | 8 - 7zip/Compress/ByteSwap/makefile | 23 - 7zip/Compress/ByteSwap/resource.rc | 3 - 7zip/Compress/Codec.def | 4 - 7zip/Compress/Copy/Copy.dsp | 149 -- 7zip/Compress/Copy/Copy.dsw | 29 - 7zip/Compress/Copy/CopyCoder.cpp | 52 - 7zip/Compress/Copy/CopyCoder.h | 31 - 7zip/Compress/Copy/DllExports.cpp | 70 - 7zip/Compress/Copy/StdAfx.cpp | 3 - 7zip/Compress/Copy/StdAfx.h | 8 - 7zip/Compress/Copy/makefile | 30 - 7zip/Compress/Copy/resource.rc | 3 - 7zip/Compress/Deflate/Deflate.dsp | 295 --- 7zip/Compress/Deflate/Deflate.dsw | 29 - 7zip/Compress/Deflate/DeflateConst.h | 134 -- 7zip/Compress/Deflate/DeflateDecoder.cpp | 339 --- 7zip/Compress/Deflate/DeflateDecoder.h | 134 -- 7zip/Compress/Deflate/DeflateEncoder.cpp | 885 -------- 7zip/Compress/Deflate/DeflateEncoder.h | 210 -- 7zip/Compress/Deflate/DllExports.cpp | 145 -- 7zip/Compress/Deflate/StdAfx.cpp | 3 - 7zip/Compress/Deflate/StdAfx.h | 8 - 7zip/Compress/Deflate/makefile | 51 - 7zip/Compress/Deflate/resource.rc | 3 - 7zip/Compress/Huffman/HuffmanDecoder.h | 88 - 7zip/Compress/Huffman/HuffmanEncoder.cpp | 325 --- 7zip/Compress/Huffman/HuffmanEncoder.h | 82 - 7zip/Compress/Huffman/StdAfx.h | 6 - 7zip/Compress/Implode/DllExports.cpp | 65 - 7zip/Compress/Implode/ImplodeDecoder.cpp | 222 -- 7zip/Compress/Implode/ImplodeDecoder.h | 60 - 7zip/Compress/Implode/ImplodeHuffmanDecoder.cpp | 89 - 7zip/Compress/Implode/ImplodeHuffmanDecoder.h | 33 - 7zip/Compress/Implode/StdAfx.cpp | 3 - 7zip/Compress/Implode/StdAfx.h | 8 - 7zip/Compress/LZ/BinTree/BinTree.h | 54 - 7zip/Compress/LZ/BinTree/BinTree2.h | 12 - 7zip/Compress/LZ/BinTree/BinTree3.h | 16 - 7zip/Compress/LZ/BinTree/BinTree3Z.h | 16 - 7zip/Compress/LZ/BinTree/BinTree4.h | 18 - 7zip/Compress/LZ/BinTree/BinTreeMain.h | 531 ----- 7zip/Compress/LZ/HashChain/HC2.h | 13 - 7zip/Compress/LZ/HashChain/HC3.h | 16 - 7zip/Compress/LZ/HashChain/HC4.h | 19 - 7zip/Compress/LZ/HashChain/HCMain.h | 6 - 7zip/Compress/LZ/IMatchFinder.h | 32 - 7zip/Compress/LZ/LZInWindow.cpp | 105 - 7zip/Compress/LZ/LZInWindow.h | 87 - 7zip/Compress/LZ/LZOutWindow.cpp | 17 - 7zip/Compress/LZ/LZOutWindow.h | 56 - 7zip/Compress/LZ/MT/MT.cpp | 295 --- 7zip/Compress/LZ/MT/MT.h | 79 - 7zip/Compress/LZ/MT/StdAfx.h | 8 - 7zip/Compress/LZ/StdAfx.h | 6 - 7zip/Compress/LZMA/DllExports.cpp | 101 - 7zip/Compress/LZMA/LZMA.dsp | 387 ---- 7zip/Compress/LZMA/LZMA.dsw | 29 - 7zip/Compress/LZMA/LZMA.h | 82 - 7zip/Compress/LZMA/LZMADecoder.cpp | 338 --- 7zip/Compress/LZMA/LZMADecoder.h | 251 --- 7zip/Compress/LZMA/LZMAEncoder.cpp | 1565 ------------- 7zip/Compress/LZMA/LZMAEncoder.h | 411 ---- 7zip/Compress/LZMA/StdAfx.cpp | 3 - 7zip/Compress/LZMA/StdAfx.h | 8 - 7zip/Compress/LZMA/makefile | 59 - 7zip/Compress/LZMA/resource.rc | 3 - 7zip/Compress/LZMA_Alone/AloneLZMA.dsp | 475 ---- 7zip/Compress/LZMA_Alone/AloneLZMA.dsw | 29 - 7zip/Compress/LZMA_Alone/LzmaAlone.cpp | 526 ----- 7zip/Compress/LZMA_Alone/LzmaBench.cpp | 506 ----- 7zip/Compress/LZMA_Alone/LzmaBench.h | 11 - 7zip/Compress/LZMA_Alone/LzmaRam.cpp | 227 -- 7zip/Compress/LZMA_Alone/LzmaRam.h | 46 - 7zip/Compress/LZMA_Alone/LzmaRamDecode.c | 79 - 7zip/Compress/LZMA_Alone/LzmaRamDecode.h | 55 - 7zip/Compress/LZMA_Alone/StdAfx.cpp | 3 - 7zip/Compress/LZMA_Alone/StdAfx.h | 8 - 7zip/Compress/LZMA_Alone/makefile | 114 - 7zip/Compress/LZMA_Alone/makefile.gcc | 113 - 7zip/Compress/LZMA_C/LzmaDecode.c | 584 ----- 7zip/Compress/LZMA_C/LzmaDecode.h | 113 - 7zip/Compress/LZMA_C/LzmaDecodeSize.c | 712 ------ 7zip/Compress/LZMA_C/LzmaStateDecode.c | 521 ----- 7zip/Compress/LZMA_C/LzmaStateDecode.h | 96 - 7zip/Compress/LZMA_C/LzmaStateTest.c | 195 -- 7zip/Compress/LZMA_C/LzmaTest.c | 342 --- 7zip/Compress/LZMA_C/LzmaTypes.h | 45 - 7zip/Compress/Lzh/LzhDecoder.cpp | 216 -- 7zip/Compress/Lzh/LzhDecoder.h | 103 - 7zip/Compress/Lzx/Lzx.h | 61 - 7zip/Compress/Lzx/Lzx86Converter.cpp | 90 - 7zip/Compress/Lzx/Lzx86Converter.h | 45 - 7zip/Compress/Lzx/LzxDecoder.cpp | 382 ---- 7zip/Compress/Lzx/LzxDecoder.h | 181 -- 7zip/Compress/Lzx/StdAfx.h | 8 - 7zip/Compress/PPMD/DllExports.cpp | 93 - 7zip/Compress/PPMD/PPMD.dsp | 229 -- 7zip/Compress/PPMD/PPMD.dsw | 29 - 7zip/Compress/PPMD/PPMDContext.h | 489 ----- 7zip/Compress/PPMD/PPMDDecode.h | 137 -- 7zip/Compress/PPMD/PPMDDecoder.cpp | 183 -- 7zip/Compress/PPMD/PPMDDecoder.h | 89 - 7zip/Compress/PPMD/PPMDEncode.h | 142 -- 7zip/Compress/PPMD/PPMDEncoder.cpp | 155 -- 7zip/Compress/PPMD/PPMDEncoder.h | 81 - 7zip/Compress/PPMD/PPMDSubAlloc.h | 290 --- 7zip/Compress/PPMD/PPMDType.h | 19 - 7zip/Compress/PPMD/StdAfx.cpp | 3 - 7zip/Compress/PPMD/StdAfx.h | 8 - 7zip/Compress/PPMD/makefile | 41 - 7zip/Compress/PPMD/resource.rc | 3 - 7zip/Compress/Quantum/QuantumDecoder.cpp | 173 -- 7zip/Compress/Quantum/QuantumDecoder.h | 287 --- 7zip/Compress/RangeCoder/RangeCoder.h | 205 -- 7zip/Compress/RangeCoder/RangeCoderBit.cpp | 80 - 7zip/Compress/RangeCoder/RangeCoderBit.h | 120 - 7zip/Compress/RangeCoder/RangeCoderBitTree.h | 161 -- 7zip/Compress/RangeCoder/RangeCoderOpt.h | 31 - 7zip/Compress/RangeCoder/StdAfx.h | 6 - 7zip/Compress/Rar20/DllExports.cpp | 66 - 7zip/Compress/Rar20/Rar20Const.h | 65 - 7zip/Compress/Rar20/Rar20Decoder.cpp | 322 --- 7zip/Compress/Rar20/Rar20Decoder.h | 85 - 7zip/Compress/Rar20/Rar20ExtConst.h | 21 - 7zip/Compress/Rar20/Rar20Multimedia.cpp | 128 -- 7zip/Compress/Rar20/Rar20Multimedia.h | 43 - 7zip/Compress/Rar20/StdAfx.cpp | 3 - 7zip/Compress/Rar20/StdAfx.h | 8 - 7zip/Compress/Rar29/DllExports.cpp | 105 - 7zip/Compress/Rar29/Original/archive.hpp | 128 -- 7zip/Compress/Rar29/Original/array.hpp | 121 - 7zip/Compress/Rar29/Original/cmddata.hpp | 56 - 7zip/Compress/Rar29/Original/coder.cpp | 47 - 7zip/Compress/Rar29/Original/coder.hpp | 24 - 7zip/Compress/Rar29/Original/compress.hpp | 36 - 7zip/Compress/Rar29/Original/consio.hpp | 42 - 7zip/Compress/Rar29/Original/crc.cpp | 61 - 7zip/Compress/Rar29/Original/crc.hpp | 10 - 7zip/Compress/Rar29/Original/crypt.hpp | 60 - 7zip/Compress/Rar29/Original/encname.hpp | 20 - 7zip/Compress/Rar29/Original/errhnd.cpp | 356 --- 7zip/Compress/Rar29/Original/errhnd.hpp | 61 - 7zip/Compress/Rar29/Original/extinfo.hpp | 8 - 7zip/Compress/Rar29/Original/extract.hpp | 40 - 7zip/Compress/Rar29/Original/filcreat.hpp | 12 - 7zip/Compress/Rar29/Original/file.hpp | 100 - 7zip/Compress/Rar29/Original/filefn.hpp | 39 - 7zip/Compress/Rar29/Original/filestr.hpp | 8 - 7zip/Compress/Rar29/Original/find.hpp | 48 - 7zip/Compress/Rar29/Original/getbits.cpp | 24 - 7zip/Compress/Rar29/Original/getbits.hpp | 37 - 7zip/Compress/Rar29/Original/global.hpp | 14 - 7zip/Compress/Rar29/Original/headers.hpp | 304 --- 7zip/Compress/Rar29/Original/int64.cpp | 274 --- 7zip/Compress/Rar29/Original/int64.hpp | 86 - 7zip/Compress/Rar29/Original/isnt.hpp | 6 - 7zip/Compress/Rar29/Original/list.hpp | 6 - 7zip/Compress/Rar29/Original/loclang.hpp | 340 --- 7zip/Compress/Rar29/Original/log.hpp | 18 - 7zip/Compress/Rar29/Original/match.hpp | 16 - 7zip/Compress/Rar29/Original/model.cpp | 600 ----- 7zip/Compress/Rar29/Original/model.hpp | 126 -- 7zip/Compress/Rar29/Original/options.hpp | 129 -- 7zip/Compress/Rar29/Original/os.hpp | 235 -- 7zip/Compress/Rar29/Original/pathfn.hpp | 44 - 7zip/Compress/Rar29/Original/rar.hpp | 80 - 7zip/Compress/Rar29/Original/rardefs.hpp | 21 - 7zip/Compress/Rar29/Original/rarfn.hpp | 7 - 7zip/Compress/Rar29/Original/rarlang.hpp | 10 - 7zip/Compress/Rar29/Original/raros.hpp | 41 - 7zip/Compress/Rar29/Original/rartypes.hpp | 21 - 7zip/Compress/Rar29/Original/rarvm.cpp | 1050 --------- 7zip/Compress/Rar29/Original/rarvm.hpp | 110 - 7zip/Compress/Rar29/Original/rarvmtbl.cpp | 53 - 7zip/Compress/Rar29/Original/rawread.hpp | 32 - 7zip/Compress/Rar29/Original/rdwrfn.cpp | 306 --- 7zip/Compress/Rar29/Original/rdwrfn.hpp | 104 - 7zip/Compress/Rar29/Original/recvol.hpp | 16 - 7zip/Compress/Rar29/Original/resource.cpp | 12 - 7zip/Compress/Rar29/Original/resource.hpp | 14 - 7zip/Compress/Rar29/Original/rijndael.hpp | 37 - 7zip/Compress/Rar29/Original/rs.hpp | 32 - 7zip/Compress/Rar29/Original/savepos.hpp | 15 - 7zip/Compress/Rar29/Original/scantree.hpp | 52 - 7zip/Compress/Rar29/Original/sha1.hpp | 16 - 7zip/Compress/Rar29/Original/smallfn.cpp | 17 - 7zip/Compress/Rar29/Original/smallfn.hpp | 7 - 7zip/Compress/Rar29/Original/strfn.hpp | 24 - 7zip/Compress/Rar29/Original/strlist.hpp | 39 - 7zip/Compress/Rar29/Original/suballoc.cpp | 241 -- 7zip/Compress/Rar29/Original/suballoc.hpp | 81 - 7zip/Compress/Rar29/Original/system.cpp | 79 - 7zip/Compress/Rar29/Original/system.hpp | 10 - 7zip/Compress/Rar29/Original/timefn.hpp | 57 - 7zip/Compress/Rar29/Original/ulinks.hpp | 9 - 7zip/Compress/Rar29/Original/unicode.hpp | 82 - 7zip/Compress/Rar29/Original/unpack.cpp | 939 -------- 7zip/Compress/Rar29/Original/unpack.hpp | 205 -- 7zip/Compress/Rar29/Original/unpack15.cpp | 507 ----- 7zip/Compress/Rar29/Original/version.hpp | 6 - 7zip/Compress/Rar29/Original/volume.hpp | 11 - 7zip/Compress/Rar29/Rar29.dsp | 415 ---- 7zip/Compress/Rar29/Rar29.dsw | 29 - 7zip/Compress/Rar29/Rar29Decoder.cpp | 153 -- 7zip/Compress/Rar29/Rar29Decoder.h | 97 - 7zip/Compress/Rar29/StdAfx.cpp | 3 - 7zip/Compress/Rar29/StdAfx.h | 8 - 7zip/Compress/Rar29/makefile | 62 - 7zip/Compress/Rar29/resource.rc | 3 - 7zip/Compress/Shrink/DllExports.cpp | 64 - 7zip/Compress/Shrink/ShrinkDecoder.cpp | 149 -- 7zip/Compress/Shrink/ShrinkDecoder.h | 39 - 7zip/Compress/Shrink/StdAfx.cpp | 3 - 7zip/Compress/Shrink/StdAfx.h | 8 - 7zip/Compress/Z/StdAfx.cpp | 3 - 7zip/Compress/Z/StdAfx.h | 8 - 7zip/Compress/Z/ZDecoder.cpp | 172 -- 7zip/Compress/Z/ZDecoder.h | 44 - 7zip/Compress/makefile | 14 - 7zip/Crypto/7zAES/7zAES.cpp | 305 --- 7zip/Crypto/7zAES/7zAES.dsp | 245 --- 7zip/Crypto/7zAES/7zAES.dsw | 29 - 7zip/Crypto/7zAES/7zAES.h | 122 -- 7zip/Crypto/7zAES/DllExports.cpp | 111 - 7zip/Crypto/7zAES/StdAfx.cpp | 3 - 7zip/Crypto/7zAES/StdAfx.h | 8 - 7zip/Crypto/7zAES/makefile | 52 - 7zip/Crypto/7zAES/resource.rc | 3 - 7zip/Crypto/AES/AES.dsp | 203 -- 7zip/Crypto/AES/AES.dsw | 29 - 7zip/Crypto/AES/AES_CBC.h | 39 - 7zip/Crypto/AES/DllExports.cpp | 100 - 7zip/Crypto/AES/MyAES.cpp | 94 - 7zip/Crypto/AES/MyAES.h | 106 - 7zip/Crypto/AES/StdAfx.cpp | 3 - 7zip/Crypto/AES/StdAfx.h | 8 - 7zip/Crypto/AES/aes.h | 103 - 7zip/Crypto/AES/aescpp.h | 55 - 7zip/Crypto/AES/aescrypt.c | 421 ---- 7zip/Crypto/AES/aeskey.c | 363 --- 7zip/Crypto/AES/aesopt.h | 839 ------- 7zip/Crypto/AES/aestab.c | 494 ----- 7zip/Crypto/AES/makefile | 31 - 7zip/Crypto/AES/resource.rc | 3 - 7zip/Crypto/Codec.def | 4 - 7zip/Crypto/Hash/HmacSha1.cpp | 109 - 7zip/Crypto/Hash/HmacSha1.h | 39 - 7zip/Crypto/Hash/Pbkdf2HmacSha1.cpp | 83 - 7zip/Crypto/Hash/Pbkdf2HmacSha1.h | 21 - 7zip/Crypto/Hash/RandGen.cpp | 78 - 7zip/Crypto/Hash/RandGen.h | 21 - 7zip/Crypto/Hash/RotateDefs.h | 19 - 7zip/Crypto/Hash/Sha1.cpp | 210 -- 7zip/Crypto/Hash/Sha1.h | 68 - 7zip/Crypto/Hash/Sha256.cpp | 210 -- 7zip/Crypto/Hash/Sha256.h | 30 - 7zip/Crypto/Hash/StdAfx.h | 8 - 7zip/Crypto/Rar20/Rar20Cipher.cpp | 76 - 7zip/Crypto/Rar20/Rar20Cipher.h | 35 - 7zip/Crypto/Rar20/Rar20Crypto.cpp | 124 -- 7zip/Crypto/Rar20/Rar20Crypto.h | 33 - 7zip/Crypto/Rar20/StdAfx.h | 8 - 7zip/Crypto/RarAES/RarAES.cpp | 187 -- 7zip/Crypto/RarAES/RarAES.h | 61 - 7zip/Crypto/RarAES/StdAfx.h | 8 - 7zip/Crypto/WzAES/StdAfx.cpp | 3 - 7zip/Crypto/WzAES/StdAfx.h | 8 - 7zip/Crypto/WzAES/WzAES.cpp | 246 --- 7zip/Crypto/WzAES/WzAES.h | 126 -- 7zip/Crypto/Zip/StdAfx.h | 8 - 7zip/Crypto/Zip/ZipCipher.cpp | 85 - 7zip/Crypto/Zip/ZipCipher.h | 59 - 7zip/Crypto/Zip/ZipCrypto.cpp | 65 - 7zip/Crypto/Zip/ZipCrypto.h | 26 - 7zip/Crypto/makefile | 8 - 7zip/FileManager/7zFM.exe.manifest | 1 - 7zip/FileManager/7zipLogo.ico | Bin 9150 -> 0 bytes 7zip/FileManager/Add.bmp | Bin 982 -> 0 bytes 7zip/FileManager/Add2.bmp | Bin 406 -> 0 bytes 7zip/FileManager/App.cpp | 751 ------- 7zip/FileManager/App.h | 332 --- 7zip/FileManager/AppState.h | 114 - 7zip/FileManager/ClassDefs.cpp | 15 - 7zip/FileManager/Copy.bmp | Bin 982 -> 0 bytes 7zip/FileManager/Copy2.bmp | Bin 406 -> 0 bytes 7zip/FileManager/Delete.bmp | Bin 982 -> 0 bytes 7zip/FileManager/Delete2.bmp | Bin 406 -> 0 bytes 7zip/FileManager/EnumFormatEtc.cpp | 108 - 7zip/FileManager/EnumFormatEtc.h | 10 - 7zip/FileManager/Extract.bmp | Bin 982 -> 0 bytes 7zip/FileManager/Extract2.bmp | Bin 406 -> 0 bytes 7zip/FileManager/ExtractCallback.cpp | 377 ---- 7zip/FileManager/ExtractCallback.h | 124 -- 7zip/FileManager/FM.cpp | 729 ------- 7zip/FileManager/FM.dsp | 1230 ----------- 7zip/FileManager/FM.dsw | 29 - 7zip/FileManager/FM.ico | Bin 4846 -> 0 bytes 7zip/FileManager/FSDrives.cpp | 240 -- 7zip/FileManager/FSDrives.h | 66 - 7zip/FileManager/FSFolder.cpp | 634 ------ 7zip/FileManager/FSFolder.h | 143 -- 7zip/FileManager/FSFolderCopy.cpp | 472 ---- 7zip/FileManager/FileFolderPluginOpen.cpp | 108 - 7zip/FileManager/FileFolderPluginOpen.h | 9 - 7zip/FileManager/FilePlugins.cpp | 113 - 7zip/FileManager/FilePlugins.h | 54 - 7zip/FileManager/FormatUtils.cpp | 40 - 7zip/FileManager/FormatUtils.h | 18 - 7zip/FileManager/HelpUtils.cpp | 23 - 7zip/FileManager/HelpUtils.h | 10 - 7zip/FileManager/IFolder.h | 190 -- 7zip/FileManager/Info.bmp | Bin 982 -> 0 bytes 7zip/FileManager/Info2.bmp | Bin 406 -> 0 bytes 7zip/FileManager/LangUtils.cpp | 185 -- 7zip/FileManager/LangUtils.h | 41 - 7zip/FileManager/Move.bmp | Bin 982 -> 0 bytes 7zip/FileManager/Move2.bmp | Bin 406 -> 0 bytes 7zip/FileManager/MyCom2.h | 48 - 7zip/FileManager/MyLoadMenu.cpp | 694 ------ 7zip/FileManager/MyLoadMenu.h | 16 - 7zip/FileManager/NetFolder.cpp | 315 --- 7zip/FileManager/NetFolder.h | 66 - 7zip/FileManager/OpenCallback.cpp | 112 - 7zip/FileManager/OpenCallback.h | 82 - 7zip/FileManager/OptionsDialog.cpp | 65 - 7zip/FileManager/Panel.cpp | 848 -------- 7zip/FileManager/Panel.h | 509 ----- 7zip/FileManager/PanelCopy.cpp | 210 -- 7zip/FileManager/PanelCrc.cpp | 361 --- 7zip/FileManager/PanelDrag.cpp | 796 ------- 7zip/FileManager/PanelFolderChange.cpp | 406 ---- 7zip/FileManager/PanelItemOpen.cpp | 539 ----- 7zip/FileManager/PanelItems.cpp | 817 ------- 7zip/FileManager/PanelKey.cpp | 297 --- 7zip/FileManager/PanelListNotify.cpp | 388 ---- 7zip/FileManager/PanelMenu.cpp | 422 ---- 7zip/FileManager/PanelOperations.cpp | 382 ---- 7zip/FileManager/PanelSelect.cpp | 297 --- 7zip/FileManager/PanelSort.cpp | 163 -- 7zip/FileManager/PanelSplitFile.cpp | 471 ---- 7zip/FileManager/PhysDriveFolder.cpp | 274 --- 7zip/FileManager/PhysDriveFolder.h | 89 - 7zip/FileManager/PluginInterface.h | 42 - 7zip/FileManager/PluginLoader.h | 32 - 7zip/FileManager/ProgramLocation.cpp | 24 - 7zip/FileManager/ProgramLocation.h | 10 - 7zip/FileManager/PropertyName.cpp | 74 - 7zip/FileManager/PropertyName.h | 10 - 7zip/FileManager/RegistryAssociations.cpp | 270 --- 7zip/FileManager/RegistryAssociations.h | 45 - 7zip/FileManager/RegistryPlugins.cpp | 130 -- 7zip/FileManager/RegistryPlugins.h | 32 - 7zip/FileManager/RegistryUtils.cpp | 150 -- 7zip/FileManager/RegistryUtils.h | 46 - 7zip/FileManager/Resource/AboutDialog/7zipLogo.ico | Bin 9150 -> 0 bytes .../Resource/AboutDialog/AboutDialog.cpp | 60 - .../FileManager/Resource/AboutDialog/AboutDialog.h | 18 - 7zip/FileManager/Resource/AboutDialog/StdAfx.h | 16 - 7zip/FileManager/Resource/AboutDialog/resource.h | 6 - 7zip/FileManager/Resource/AboutDialog/resource.rc | 41 - .../Resource/BenchmarkDialog/BenchmarkDialog.cpp | 976 --------- .../Resource/BenchmarkDialog/BenchmarkDialog.h | 136 -- 7zip/FileManager/Resource/BenchmarkDialog/StdAfx.h | 16 - .../Resource/BenchmarkDialog/resource.h | 34 - .../Resource/BenchmarkDialog/resource.rc | 87 - .../Resource/ComboDialog/ComboDialog.cpp | 53 - .../FileManager/Resource/ComboDialog/ComboDialog.h | 25 - 7zip/FileManager/Resource/ComboDialog/StdAfx.h | 16 - 7zip/FileManager/Resource/ComboDialog/resource.h | 4 - 7zip/FileManager/Resource/ComboDialog/resource.rc | 24 - .../FileManager/Resource/CopyDialog/CopyDialog.cpp | 80 - 7zip/FileManager/Resource/CopyDialog/CopyDialog.h | 26 - 7zip/FileManager/Resource/CopyDialog/StdAfx.h | 16 - 7zip/FileManager/Resource/CopyDialog/resource.h | 5 - 7zip/FileManager/Resource/CopyDialog/resource.rc | 23 - 7zip/FileManager/Resource/EditPage/EditPage.cpp | 91 - 7zip/FileManager/Resource/EditPage/EditPage.h | 21 - 7zip/FileManager/Resource/EditPage/StdAfx.h | 16 - 7zip/FileManager/Resource/EditPage/resource.h | 4 - 7zip/FileManager/Resource/EditPage/resource.rc | 16 - 7zip/FileManager/Resource/LangPage/LangPage.cpp | 90 - 7zip/FileManager/Resource/LangPage/LangPage.h | 21 - 7zip/FileManager/Resource/LangPage/StdAfx.h | 16 - 7zip/FileManager/Resource/LangPage/resource.h | 6 - 7zip/FileManager/Resource/LangPage/resource.rc | 21 - 7zip/FileManager/Resource/ListBoxDialog/StdAfx.h | 16 - 7zip/FileManager/Resource/ListBoxDialog/resource.h | 3 - .../FileManager/Resource/ListBoxDialog/resource.rc | 22 - .../Resource/ListViewDialog/ListViewDialog.cpp | 102 - .../Resource/ListViewDialog/ListViewDialog.h | 30 - 7zip/FileManager/Resource/ListViewDialog/StdAfx.h | 16 - .../FileManager/Resource/ListViewDialog/resource.h | 3 - .../Resource/ListViewDialog/resource.rc | 26 - .../Resource/MessagesDialog/MessagesDialog.cpp | 100 - .../Resource/MessagesDialog/MessagesDialog.h | 22 - 7zip/FileManager/Resource/MessagesDialog/StdAfx.h | 16 - .../FileManager/Resource/MessagesDialog/resource.h | 3 - .../Resource/MessagesDialog/resource.rc | 25 - .../Resource/OverwriteDialog/OverwriteDialog.cpp | 124 -- .../Resource/OverwriteDialog/OverwriteDialog.h | 34 - 7zip/FileManager/Resource/OverwriteDialog/StdAfx.h | 16 - .../Resource/OverwriteDialog/resource.h | 19 - .../Resource/OverwriteDialog/resource.rc | 47 - .../Resource/PasswordDialog/PasswordDialog.cpp | 50 - .../Resource/PasswordDialog/PasswordDialog.h | 21 - 7zip/FileManager/Resource/PasswordDialog/StdAfx.h | 16 - .../FileManager/Resource/PasswordDialog/resource.h | 4 - .../Resource/PasswordDialog/resource.rc | 26 - .../Resource/PluginsPage/PluginsPage.cpp | 220 -- .../FileManager/Resource/PluginsPage/PluginsPage.h | 26 - 7zip/FileManager/Resource/PluginsPage/StdAfx.h | 16 - 7zip/FileManager/Resource/PluginsPage/resource.h | 4 - 7zip/FileManager/Resource/PluginsPage/resource.rc | 19 - .../Resource/ProgressDialog/ProgressDialog.cpp | 175 -- .../Resource/ProgressDialog/ProgressDialog.h | 129 -- 7zip/FileManager/Resource/ProgressDialog/StdAfx.h | 16 - .../FileManager/Resource/ProgressDialog/resource.h | 3 - .../Resource/ProgressDialog/resource.rc | 20 - .../Resource/ProgressDialog2/ProgressDialog.cpp | 432 ---- .../Resource/ProgressDialog2/ProgressDialog.h | 184 -- 7zip/FileManager/Resource/ProgressDialog2/StdAfx.h | 16 - .../Resource/ProgressDialog2/resource.h | 17 - .../Resource/ProgressDialog2/resource.rc | 57 - 7zip/FileManager/Resource/PropertyName/resource.h | 28 - 7zip/FileManager/Resource/PropertyName/resource.rc | 35 - .../Resource/SettingsPage/SettingsPage.cpp | 113 - .../Resource/SettingsPage/SettingsPage.h | 19 - 7zip/FileManager/Resource/SettingsPage/StdAfx.h | 16 - 7zip/FileManager/Resource/SettingsPage/resource.h | 11 - 7zip/FileManager/Resource/SettingsPage/resource.rc | 35 - .../Resource/SplitDialog/SplitDialog.cpp | 85 - .../FileManager/Resource/SplitDialog/SplitDialog.h | 27 - 7zip/FileManager/Resource/SplitDialog/StdAfx.h | 18 - 7zip/FileManager/Resource/SplitDialog/resource.h | 6 - 7zip/FileManager/Resource/SplitDialog/resource.rc | 27 - 7zip/FileManager/Resource/SystemPage/StdAfx.h | 16 - .../FileManager/Resource/SystemPage/SystemPage.cpp | 435 ---- 7zip/FileManager/Resource/SystemPage/SystemPage.h | 40 - 7zip/FileManager/Resource/SystemPage/resource.h | 7 - 7zip/FileManager/Resource/SystemPage/resource.rc | 31 - 7zip/FileManager/RootFolder.cpp | 204 -- 7zip/FileManager/RootFolder.h | 49 - 7zip/FileManager/SplitUtils.cpp | 66 - 7zip/FileManager/SplitUtils.h | 13 - 7zip/FileManager/StdAfx.cpp | 8 - 7zip/FileManager/StdAfx.h | 23 - 7zip/FileManager/StringUtils.cpp | 68 - 7zip/FileManager/StringUtils.h | 13 - 7zip/FileManager/SysIconUtils.cpp | 157 -- 7zip/FileManager/SysIconUtils.h | 51 - 7zip/FileManager/Test.bmp | Bin 982 -> 0 bytes 7zip/FileManager/Test2.bmp | Bin 406 -> 0 bytes 7zip/FileManager/TextPairs.cpp | 216 -- 7zip/FileManager/TextPairs.h | 32 - 7zip/FileManager/UpdateCallback100.cpp | 92 - 7zip/FileManager/UpdateCallback100.h | 67 - 7zip/FileManager/ViewSettings.cpp | 429 ---- 7zip/FileManager/ViewSettings.h | 99 - 7zip/FileManager/makefile | 180 -- 7zip/FileManager/resource.h | 150 -- 7zip/FileManager/resource.rc | 226 -- 7zip/GuiCommon.rc | 37 - 7zip/Guid.txt | 157 -- 7zip/ICoder.h | 163 -- 7zip/IPassword.h | 26 - 7zip/IProgress.h | 32 - 7zip/IStream.h | 62 - 7zip/MyVersion.h | 8 - 7zip/MyVersionInfo.rc | 41 - 7zip/PropID.h | 51 - 7zip/SubBuild.mak | 3 - 7zip/UI/Agent/Agent.cpp | 572 ----- 7zip/UI/Agent/Agent.h | 314 --- 7zip/UI/Agent/AgentOut.cpp | 518 ----- 7zip/UI/Agent/AgentProxy.cpp | 198 -- 7zip/UI/Agent/AgentProxy.h | 56 - 7zip/UI/Agent/ArchiveFolder.cpp | 72 - 7zip/UI/Agent/ArchiveFolderOpen.cpp | 98 - 7zip/UI/Agent/ArchiveFolderOut.cpp | 215 -- 7zip/UI/Agent/IFolderArchive.h | 90 - 7zip/UI/Agent/UpdateCallbackAgent.cpp | 80 - 7zip/UI/Agent/UpdateCallbackAgent.h | 24 - 7zip/UI/Client7z/Client7z.cpp | 850 -------- 7zip/UI/Client7z/Client7z.dsp | 226 -- 7zip/UI/Client7z/Client7z.dsw | 29 - 7zip/UI/Client7z/StdAfx.cpp | 3 - 7zip/UI/Client7z/StdAfx.h | 9 - 7zip/UI/Client7z/makefile | 45 - 7zip/UI/Common/ArchiveCommandLine.cpp | 984 --------- 7zip/UI/Common/ArchiveCommandLine.h | 95 - 7zip/UI/Common/ArchiveExtractCallback.cpp | 449 ---- 7zip/UI/Common/ArchiveExtractCallback.h | 111 - 7zip/UI/Common/ArchiveName.cpp | 46 - 7zip/UI/Common/ArchiveName.h | 10 - 7zip/UI/Common/ArchiveOpenCallback.cpp | 127 -- 7zip/UI/Common/ArchiveOpenCallback.h | 87 - 7zip/UI/Common/ArchiverInfo.cpp | 359 --- 7zip/UI/Common/ArchiverInfo.h | 66 - 7zip/UI/Common/CompressCall.cpp | 367 ---- 7zip/UI/Common/CompressCall.h | 28 - 7zip/UI/Common/DefaultName.cpp | 23 - 7zip/UI/Common/DefaultName.h | 11 - 7zip/UI/Common/DirItem.h | 34 - 7zip/UI/Common/EnumDirItems.cpp | 281 --- 7zip/UI/Common/EnumDirItems.h | 39 - 7zip/UI/Common/ExitCode.h | 27 - 7zip/UI/Common/Extract.cpp | 142 -- 7zip/UI/Common/Extract.h | 59 - 7zip/UI/Common/ExtractMode.h | 31 - 7zip/UI/Common/ExtractingFilePath.cpp | 75 - 7zip/UI/Common/ExtractingFilePath.h | 12 - 7zip/UI/Common/HandlerLoader.h | 38 - 7zip/UI/Common/IFileExtractCallback.h | 46 - 7zip/UI/Common/OpenArchive.cpp | 522 ----- 7zip/UI/Common/OpenArchive.h | 134 -- 7zip/UI/Common/PropIDUtils.cpp | 90 - 7zip/UI/Common/PropIDUtils.h | 11 - 7zip/UI/Common/Property.h | 14 - 7zip/UI/Common/SetProperties.cpp | 65 - 7zip/UI/Common/SetProperties.h | 10 - 7zip/UI/Common/SortUtils.cpp | 33 - 7zip/UI/Common/SortUtils.h | 11 - 7zip/UI/Common/StdAfx.h | 9 - 7zip/UI/Common/TempFiles.cpp | 22 - 7zip/UI/Common/TempFiles.h | 16 - 7zip/UI/Common/Update.cpp | 818 ------- 7zip/UI/Common/Update.h | 158 -- 7zip/UI/Common/UpdateAction.cpp | 64 - 7zip/UI/Common/UpdateAction.h | 57 - 7zip/UI/Common/UpdateCallback.cpp | 258 --- 7zip/UI/Common/UpdateCallback.h | 70 - 7zip/UI/Common/UpdatePair.cpp | 175 -- 7zip/UI/Common/UpdatePair.h | 24 - 7zip/UI/Common/UpdateProduce.cpp | 63 - 7zip/UI/Common/UpdateProduce.h | 31 - 7zip/UI/Common/WorkDir.cpp | 64 - 7zip/UI/Common/WorkDir.h | 10 - 7zip/UI/Common/ZipRegistry.cpp | 420 ---- 7zip/UI/Common/ZipRegistry.h | 99 - 7zip/UI/Console/Console.dsp | 667 ------ 7zip/UI/Console/Console.dsw | 29 - 7zip/UI/Console/ConsoleClose.cpp | 65 - 7zip/UI/Console/ConsoleClose.h | 24 - 7zip/UI/Console/ExtractCallbackConsole.cpp | 228 -- 7zip/UI/Console/ExtractCallbackConsole.h | 65 - 7zip/UI/Console/List.cpp | 532 ----- 7zip/UI/Console/List.h | 13 - 7zip/UI/Console/Main.cpp | 369 ---- 7zip/UI/Console/MainAr.cpp | 159 -- 7zip/UI/Console/OpenCallbackConsole.cpp | 47 - 7zip/UI/Console/OpenCallbackConsole.h | 24 - 7zip/UI/Console/PercentPrinter.cpp | 88 - 7zip/UI/Console/PercentPrinter.h | 40 - 7zip/UI/Console/StdAfx.cpp | 3 - 7zip/UI/Console/StdAfx.h | 9 - 7zip/UI/Console/UpdateCallbackConsole.cpp | 189 -- 7zip/UI/Console/UpdateCallbackConsole.h | 75 - 7zip/UI/Console/UserInputUtils.cpp | 58 - 7zip/UI/Console/UserInputUtils.h | 24 - 7zip/UI/Console/afxres.h | 1 - 7zip/UI/Console/makefile | 93 - 7zip/UI/Console/resource.rc | 3 - 7zip/UI/Explorer/7-zip.dll.manifest | 1 - 7zip/UI/Explorer/ContextMenu.cpp | 682 ------ 7zip/UI/Explorer/ContextMenu.h | 86 - 7zip/UI/Explorer/ContextMenuFlags.h | 34 - 7zip/UI/Explorer/DllExports.cpp | 315 --- 7zip/UI/Explorer/Explorer.def | 12 - 7zip/UI/Explorer/Explorer.dsp | 805 ------- 7zip/UI/Explorer/Explorer.dsw | 29 - 7zip/UI/Explorer/FoldersPage/FoldersPage.cpp | 157 -- 7zip/UI/Explorer/FoldersPage/FoldersPage.h | 30 - 7zip/UI/Explorer/FoldersPage/resource.h | 12 - 7zip/UI/Explorer/FoldersPage/resource.rc | 36 - 7zip/UI/Explorer/MyMessages.cpp | 58 - 7zip/UI/Explorer/MyMessages.h | 30 - 7zip/UI/Explorer/OptionsDialog.cpp | 71 - 7zip/UI/Explorer/OptionsDialog.h | 23 - 7zip/UI/Explorer/RegistryContextMenu.cpp | 128 -- 7zip/UI/Explorer/RegistryContextMenu.h | 13 - 7zip/UI/Explorer/StdAfx.cpp | 3 - 7zip/UI/Explorer/StdAfx.h | 26 - 7zip/UI/Explorer/SystemPage/SystemPage.cpp | 212 -- 7zip/UI/Explorer/SystemPage/SystemPage.h | 25 - 7zip/UI/Explorer/SystemPage/resource.h | 6 - 7zip/UI/Explorer/SystemPage/resource.rc | 24 - 7zip/UI/Explorer/makefile | 130 -- 7zip/UI/Explorer/resource.h | 31 - 7zip/UI/Explorer/resource.rc | 38 - 7zip/UI/Far/CLSIDConst.cpp | 8 - 7zip/UI/Far/ExtractEngine.cpp | 168 -- 7zip/UI/Far/ExtractEngine.h | 68 - 7zip/UI/Far/Far.def | 20 - 7zip/UI/Far/Far.dsp | 561 ----- 7zip/UI/Far/Far.dsw | 29 - 7zip/UI/Far/FarPlugin.h | 577 ----- 7zip/UI/Far/FarUtils.cpp | 416 ---- 7zip/UI/Far/FarUtils.h | 185 -- 7zip/UI/Far/Main.cpp | 622 ------ 7zip/UI/Far/Messages.h | 152 -- 7zip/UI/Far/OverwriteDialog.cpp | 109 - 7zip/UI/Far/OverwriteDialog.h | 33 - 7zip/UI/Far/Plugin.cpp | 693 ------ 7zip/UI/Far/Plugin.h | 99 - 7zip/UI/Far/PluginCommon.cpp | 50 - 7zip/UI/Far/PluginDelete.cpp | 169 -- 7zip/UI/Far/PluginRead.cpp | 278 --- 7zip/UI/Far/PluginWrite.cpp | 696 ------ 7zip/UI/Far/ProgressBox.cpp | 103 - 7zip/UI/Far/ProgressBox.h | 35 - 7zip/UI/Far/StdAfx.cpp | 3 - 7zip/UI/Far/StdAfx.h | 12 - 7zip/UI/Far/UpdateCallback100.cpp | 54 - 7zip/UI/Far/UpdateCallback100.h | 45 - 7zip/UI/Far/makefile | 96 - 7zip/UI/Far/resource.rc | 3 - 7zip/UI/GUI/7zG.exe.manifest | 1 - 7zip/UI/GUI/CompressDialog.cpp | 1357 ------------ 7zip/UI/GUI/CompressDialog.h | 172 -- 7zip/UI/GUI/ExtractDialog.cpp | 371 ---- 7zip/UI/GUI/ExtractDialog.h | 77 - 7zip/UI/GUI/ExtractGUI.cpp | 172 -- 7zip/UI/GUI/ExtractGUI.h | 20 - 7zip/UI/GUI/FM.ico | Bin 4846 -> 0 bytes 7zip/UI/GUI/GUI.cpp | 260 --- 7zip/UI/GUI/GUI.dsp | 904 -------- 7zip/UI/GUI/GUI.dsw | 29 - 7zip/UI/GUI/OpenCallbackGUI.cpp | 53 - 7zip/UI/GUI/OpenCallbackGUI.h | 30 - 7zip/UI/GUI/StdAfx.cpp | 8 - 7zip/UI/GUI/StdAfx.h | 13 - 7zip/UI/GUI/UpdateCallbackGUI.cpp | 167 -- 7zip/UI/GUI/UpdateCallbackGUI.h | 63 - 7zip/UI/GUI/UpdateGUI.cpp | 397 ---- 7zip/UI/GUI/UpdateGUI.h | 20 - 7zip/UI/GUI/makefile | 135 -- 7zip/UI/GUI/resource.h | 44 - 7zip/UI/GUI/resource.rc | 56 - 7zip/UI/Resource/CompressDialog/resource.h | 40 - 7zip/UI/Resource/CompressDialog/resource.rc | 117 - 7zip/UI/Resource/Extract/resource.h | 12 - 7zip/UI/Resource/Extract/resource.rc | 17 - 7zip/UI/Resource/ExtractDialog/resource.h | 26 - 7zip/UI/Resource/ExtractDialog/resource.rc | 80 - 7zip/UI/makefile | 10 - 7zip/makefile | 16 - Build.mak | 62 - C/7zCrc.c | 137 ++ C/7zCrc.h | 31 + C/Archive/7z/7zAlloc.c | 70 + C/Archive/7z/7zBuffer.c | 29 + C/Archive/7z/7zDecode.c | 150 ++ C/Archive/7z/7zExtract.c | 118 + C/Archive/7z/7zHeader.c | 5 + C/Archive/7z/7zIn.c | 1284 +++++++++++ C/Archive/7z/7zItem.c | 133 ++ C/Archive/7z/7zMain.c | 358 +++ C/Archive/7z/7zMethodID.c | 14 + C/Archive/7z/7z_C.dsp | 186 ++ C/Archive/7z/7z_C.dsw | 29 + C/Archive/7z/makefile | 55 + C/Archive/7z/makefile.gcc | 50 + C/Compress/Branch/BranchARM.c | 26 + C/Compress/Branch/BranchARM.h | 10 + C/Compress/Branch/BranchARMThumb.c | 35 + C/Compress/Branch/BranchARMThumb.h | 10 + C/Compress/Branch/BranchIA64.c | 63 + C/Compress/Branch/BranchIA64.h | 10 + C/Compress/Branch/BranchPPC.c | 36 + C/Compress/Branch/BranchPPC.h | 10 + C/Compress/Branch/BranchSPARC.c | 36 + C/Compress/Branch/BranchSPARC.h | 10 + C/Compress/Branch/BranchTypes.h | 25 + C/Compress/Branch/BranchX86.c | 101 + C/Compress/Branch/BranchX86.h | 13 + C/Compress/Huffman/HuffmanEncode.c | 146 ++ C/Compress/Huffman/HuffmanEncode.h | 20 + C/Compress/Lz/LzHash.h | 53 + C/Compress/Lz/MatchFinder.c | 725 ++++++ C/Compress/Lz/MatchFinder.h | 103 + C/Compress/Lz/MatchFinderMt.c | 792 +++++++ C/Compress/Lz/MatchFinderMt.h | 97 + C/Compress/Lzma/LzmaDecode.c | 584 +++++ C/Compress/Lzma/LzmaDecode.h | 113 + C/Compress/Lzma/LzmaDecodeSize.c | 712 ++++++ C/Compress/Lzma/LzmaStateDecode.c | 521 +++++ C/Compress/Lzma/LzmaStateDecode.h | 96 + C/Compress/Lzma/LzmaStateTest.c | 195 ++ C/Compress/Lzma/LzmaTest.c | 342 +++ C/Compress/Lzma/LzmaTypes.h | 45 + C/IStream.h | 19 + C/Sort.c | 92 + C/Sort.h | 11 + C/Threads.c | 97 + C/Threads.h | 60 + C/Types.h | 92 + CPP/7zip/Archive/7z/7z.dsp | 593 +++++ CPP/7zip/Archive/7z/7z.dsw | 29 + CPP/7zip/Archive/7z/7z.ico | Bin 0 -> 4710 bytes CPP/7zip/Archive/7z/7zCompressionMode.cpp | 3 + CPP/7zip/Archive/7z/7zCompressionMode.h | 64 + CPP/7zip/Archive/7z/7zDecode.cpp | 444 ++++ CPP/7zip/Archive/7z/7zDecode.h | 71 + CPP/7zip/Archive/7z/7zEncode.cpp | 614 ++++++ CPP/7zip/Archive/7z/7zEncode.h | 58 + CPP/7zip/Archive/7z/7zExtract.cpp | 265 +++ CPP/7zip/Archive/7z/7zFolderInStream.cpp | 129 ++ CPP/7zip/Archive/7z/7zFolderInStream.h | 66 + CPP/7zip/Archive/7z/7zFolderOutStream.cpp | 162 ++ CPP/7zip/Archive/7z/7zFolderOutStream.h | 57 + CPP/7zip/Archive/7z/7zHandler.cpp | 794 +++++++ CPP/7zip/Archive/7z/7zHandler.h | 249 +++ CPP/7zip/Archive/7z/7zHandlerOut.cpp | 1148 ++++++++++ CPP/7zip/Archive/7z/7zHeader.cpp | 19 + CPP/7zip/Archive/7z/7zHeader.h | 96 + CPP/7zip/Archive/7z/7zIn.cpp | 1335 ++++++++++++ CPP/7zip/Archive/7z/7zIn.h | 288 +++ CPP/7zip/Archive/7z/7zItem.h | 181 ++ CPP/7zip/Archive/7z/7zMethodID.cpp | 76 + CPP/7zip/Archive/7z/7zMethodID.h | 29 + CPP/7zip/Archive/7z/7zMethods.cpp | 174 ++ CPP/7zip/Archive/7z/7zMethods.h | 36 + CPP/7zip/Archive/7z/7zOut.cpp | 1136 ++++++++++ CPP/7zip/Archive/7z/7zOut.h | 192 ++ CPP/7zip/Archive/7z/7zProperties.cpp | 166 ++ CPP/7zip/Archive/7z/7zProperties.h | 22 + CPP/7zip/Archive/7z/7zSpecStream.cpp | 24 + CPP/7zip/Archive/7z/7zSpecStream.h | 35 + CPP/7zip/Archive/7z/7zUpdate.cpp | 1099 ++++++++++ CPP/7zip/Archive/7z/7zUpdate.h | 79 + CPP/7zip/Archive/7z/DllExports.cpp | 113 + CPP/7zip/Archive/7z/StdAfx.cpp | 3 + CPP/7zip/Archive/7z/StdAfx.h | 9 + CPP/7zip/Archive/7z/makefile | 89 + CPP/7zip/Archive/7z/resource.rc | 5 + CPP/7zip/Archive/Archive.def | 3 + CPP/7zip/Archive/Arj/Arj.dsp | 329 +++ CPP/7zip/Archive/Arj/Arj.dsw | 29 + CPP/7zip/Archive/Arj/ArjHandler.cpp | 485 +++++ CPP/7zip/Archive/Arj/ArjHandler.h | 47 + CPP/7zip/Archive/Arj/ArjHeader.h | 121 + CPP/7zip/Archive/Arj/ArjIn.cpp | 283 +++ CPP/7zip/Archive/Arj/ArjIn.h | 75 + CPP/7zip/Archive/Arj/ArjItem.h | 75 + CPP/7zip/Archive/Arj/DllExports.cpp | 72 + CPP/7zip/Archive/Arj/StdAfx.cpp | 3 + CPP/7zip/Archive/Arj/StdAfx.h | 8 + CPP/7zip/Archive/Arj/arj.ico | Bin 0 -> 3638 bytes CPP/7zip/Archive/Arj/makefile | 66 + CPP/7zip/Archive/Arj/resource.rc | 5 + CPP/7zip/Archive/BZip2/BZip2.dsp | 281 +++ CPP/7zip/Archive/BZip2/BZip2.dsw | 29 + CPP/7zip/Archive/BZip2/BZip2Handler.cpp | 287 +++ CPP/7zip/Archive/BZip2/BZip2Handler.h | 83 + CPP/7zip/Archive/BZip2/BZip2HandlerOut.cpp | 156 ++ CPP/7zip/Archive/BZip2/BZip2Item.h | 20 + CPP/7zip/Archive/BZip2/BZip2Update.cpp | 84 + CPP/7zip/Archive/BZip2/BZip2Update.h | 24 + CPP/7zip/Archive/BZip2/DllExports.cpp | 127 ++ CPP/7zip/Archive/BZip2/StdAfx.cpp | 3 + CPP/7zip/Archive/BZip2/StdAfx.h | 8 + CPP/7zip/Archive/BZip2/bz2.ico | Bin 0 -> 3638 bytes CPP/7zip/Archive/BZip2/makefile | 55 + CPP/7zip/Archive/BZip2/resource.rc | 5 + CPP/7zip/Archive/Cab/Cab.dsp | 395 ++++ CPP/7zip/Archive/Cab/Cab.dsw | 29 + CPP/7zip/Archive/Cab/CabBlockInStream.cpp | 194 ++ CPP/7zip/Archive/Cab/CabBlockInStream.h | 56 + CPP/7zip/Archive/Cab/CabHandler.cpp | 812 +++++++ CPP/7zip/Archive/Cab/CabHandler.h | 45 + CPP/7zip/Archive/Cab/CabHeader.cpp | 19 + CPP/7zip/Archive/Cab/CabHeader.h | 42 + CPP/7zip/Archive/Cab/CabIn.cpp | 343 +++ CPP/7zip/Archive/Cab/CabIn.h | 166 ++ CPP/7zip/Archive/Cab/CabItem.h | 62 + CPP/7zip/Archive/Cab/DllExports.cpp | 72 + CPP/7zip/Archive/Cab/StdAfx.cpp | 3 + CPP/7zip/Archive/Cab/StdAfx.h | 8 + CPP/7zip/Archive/Cab/cab.ico | Bin 0 -> 3638 bytes CPP/7zip/Archive/Cab/makefile | 70 + CPP/7zip/Archive/Cab/resource.rc | 5 + CPP/7zip/Archive/Chm/Chm.dsp | 337 +++ CPP/7zip/Archive/Chm/Chm.dsw | 29 + CPP/7zip/Archive/Chm/ChmHandler.cpp | 731 +++++++ CPP/7zip/Archive/Chm/ChmHandler.h | 46 + CPP/7zip/Archive/Chm/ChmHeader.cpp | 24 + CPP/7zip/Archive/Chm/ChmHeader.h | 28 + CPP/7zip/Archive/Chm/ChmIn.cpp | 925 ++++++++ CPP/7zip/Archive/Chm/ChmIn.h | 242 ++ CPP/7zip/Archive/Chm/DllExports.cpp | 77 + CPP/7zip/Archive/Chm/StdAfx.cpp | 3 + CPP/7zip/Archive/Chm/StdAfx.h | 8 + CPP/7zip/Archive/Chm/makefile | 68 + CPP/7zip/Archive/Chm/resource.rc | 3 + CPP/7zip/Archive/Common/CodecsPath.cpp | 34 + CPP/7zip/Archive/Common/CodecsPath.h | 12 + CPP/7zip/Archive/Common/CoderLoader.cpp | 31 + CPP/7zip/Archive/Common/CoderLoader.h | 147 ++ CPP/7zip/Archive/Common/CoderMixer2.cpp | 121 + CPP/7zip/Archive/Common/CoderMixer2.h | 168 ++ CPP/7zip/Archive/Common/CoderMixer2MT.cpp | 359 +++ CPP/7zip/Archive/Common/CoderMixer2MT.h | 121 + CPP/7zip/Archive/Common/CoderMixer2ST.cpp | 238 ++ CPP/7zip/Archive/Common/CoderMixer2ST.h | 88 + CPP/7zip/Archive/Common/CrossThreadProgress.cpp | 15 + CPP/7zip/Archive/Common/CrossThreadProgress.h | 31 + CPP/7zip/Archive/Common/DummyOutStream.cpp | 20 + CPP/7zip/Archive/Common/DummyOutStream.h | 23 + CPP/7zip/Archive/Common/FilterCoder.cpp | 243 +++ CPP/7zip/Archive/Common/FilterCoder.h | 130 ++ CPP/7zip/Archive/Common/InStreamWithCRC.cpp | 41 + CPP/7zip/Archive/Common/InStreamWithCRC.h | 65 + CPP/7zip/Archive/Common/ItemNameUtils.cpp | 59 + CPP/7zip/Archive/Common/ItemNameUtils.h | 24 + CPP/7zip/Archive/Common/MultiStream.cpp | 201 ++ CPP/7zip/Archive/Common/MultiStream.h | 76 + CPP/7zip/Archive/Common/OutStreamWithCRC.cpp | 24 + CPP/7zip/Archive/Common/OutStreamWithCRC.h | 37 + CPP/7zip/Archive/Common/ParseProperties.cpp | 171 ++ CPP/7zip/Archive/Common/ParseProperties.h | 17 + CPP/7zip/Archive/Common/StdAfx.h | 9 + CPP/7zip/Archive/Cpio/CpioHandler.cpp | 289 +++ CPP/7zip/Archive/Cpio/CpioHandler.h | 47 + CPP/7zip/Archive/Cpio/CpioHeader.cpp | 23 + CPP/7zip/Archive/Cpio/CpioHeader.h | 70 + CPP/7zip/Archive/Cpio/CpioIn.cpp | 271 +++ CPP/7zip/Archive/Cpio/CpioIn.h | 41 + CPP/7zip/Archive/Cpio/CpioItem.h | 55 + CPP/7zip/Archive/Cpio/DllExports.cpp | 65 + CPP/7zip/Archive/Cpio/StdAfx.cpp | 3 + CPP/7zip/Archive/Cpio/StdAfx.h | 8 + CPP/7zip/Archive/Cpio/cpio.dsp | 265 +++ CPP/7zip/Archive/Cpio/cpio.dsw | 29 + CPP/7zip/Archive/Cpio/cpio.ico | Bin 0 -> 3638 bytes CPP/7zip/Archive/Cpio/makefile | 55 + CPP/7zip/Archive/Cpio/resource.rc | 5 + CPP/7zip/Archive/Deb/Deb.dsp | 269 +++ CPP/7zip/Archive/Deb/Deb.dsw | 29 + CPP/7zip/Archive/Deb/DebHandler.cpp | 255 +++ CPP/7zip/Archive/Deb/DebHandler.h | 47 + CPP/7zip/Archive/Deb/DebHeader.cpp | 13 + CPP/7zip/Archive/Deb/DebHeader.h | 38 + CPP/7zip/Archive/Deb/DebIn.cpp | 165 ++ CPP/7zip/Archive/Deb/DebIn.h | 29 + CPP/7zip/Archive/Deb/DebItem.h | 32 + CPP/7zip/Archive/Deb/DllExports.cpp | 73 + CPP/7zip/Archive/Deb/StdAfx.cpp | 3 + CPP/7zip/Archive/Deb/StdAfx.h | 8 + CPP/7zip/Archive/Deb/deb.ico | Bin 0 -> 3638 bytes CPP/7zip/Archive/Deb/makefile | 54 + CPP/7zip/Archive/Deb/resource.rc | 5 + CPP/7zip/Archive/GZip/DllExports.cpp | 125 ++ CPP/7zip/Archive/GZip/GZip.dsp | 321 +++ CPP/7zip/Archive/GZip/GZip.dsw | 29 + CPP/7zip/Archive/GZip/GZipHandler.cpp | 361 +++ CPP/7zip/Archive/GZip/GZipHandler.h | 79 + CPP/7zip/Archive/GZip/GZipHandlerOut.cpp | 200 ++ CPP/7zip/Archive/GZip/GZipHeader.cpp | 20 + CPP/7zip/Archive/GZip/GZipHeader.h | 85 + CPP/7zip/Archive/GZip/GZipIn.cpp | 121 + CPP/7zip/Archive/GZip/GZipIn.h | 31 + CPP/7zip/Archive/GZip/GZipItem.h | 59 + CPP/7zip/Archive/GZip/GZipOut.cpp | 69 + CPP/7zip/Archive/GZip/GZipOut.h | 29 + CPP/7zip/Archive/GZip/GZipUpdate.cpp | 120 + CPP/7zip/Archive/GZip/GZipUpdate.h | 32 + CPP/7zip/Archive/GZip/StdAfx.cpp | 3 + CPP/7zip/Archive/GZip/StdAfx.h | 8 + CPP/7zip/Archive/GZip/gz.ico | Bin 0 -> 3638 bytes CPP/7zip/Archive/GZip/makefile | 60 + CPP/7zip/Archive/GZip/resource.rc | 5 + CPP/7zip/Archive/IArchive.h | 173 ++ CPP/7zip/Archive/Iso/DllExports.cpp | 88 + CPP/7zip/Archive/Iso/Iso.dsp | 273 +++ CPP/7zip/Archive/Iso/Iso.dsw | 29 + CPP/7zip/Archive/Iso/Iso.ico | Bin 0 -> 3638 bytes CPP/7zip/Archive/Iso/IsoHandler.cpp | 301 +++ CPP/7zip/Archive/Iso/IsoHandler.h | 59 + CPP/7zip/Archive/Iso/IsoHeader.cpp | 21 + CPP/7zip/Archive/Iso/IsoHeader.h | 61 + CPP/7zip/Archive/Iso/IsoIn.cpp | 438 ++++ CPP/7zip/Archive/Iso/IsoIn.h | 301 +++ CPP/7zip/Archive/Iso/IsoItem.h | 145 ++ CPP/7zip/Archive/Iso/StdAfx.cpp | 3 + CPP/7zip/Archive/Iso/StdAfx.h | 9 + CPP/7zip/Archive/Iso/makefile | 55 + CPP/7zip/Archive/Iso/resource.rc | 5 + CPP/7zip/Archive/Lzh/DllExports.cpp | 72 + CPP/7zip/Archive/Lzh/Lzh.def | 7 + CPP/7zip/Archive/Lzh/Lzh.dsp | 333 +++ CPP/7zip/Archive/Lzh/Lzh.dsw | 29 + CPP/7zip/Archive/Lzh/LzhCRC.cpp | 43 + CPP/7zip/Archive/Lzh/LzhCRC.h | 27 + CPP/7zip/Archive/Lzh/LzhHandler.cpp | 464 ++++ CPP/7zip/Archive/Lzh/LzhHandler.h | 47 + CPP/7zip/Archive/Lzh/LzhHeader.h | 19 + CPP/7zip/Archive/Lzh/LzhIn.cpp | 171 ++ CPP/7zip/Archive/Lzh/LzhIn.h | 29 + CPP/7zip/Archive/Lzh/LzhItem.h | 172 ++ CPP/7zip/Archive/Lzh/LzhOutStreamWithCRC.cpp | 27 + CPP/7zip/Archive/Lzh/LzhOutStreamWithCRC.h | 38 + CPP/7zip/Archive/Lzh/StdAfx.cpp | 3 + CPP/7zip/Archive/Lzh/StdAfx.h | 8 + CPP/7zip/Archive/Lzh/lzh.ico | Bin 0 -> 3638 bytes CPP/7zip/Archive/Lzh/makefile | 65 + CPP/7zip/Archive/Lzh/resource.rc | 5 + CPP/7zip/Archive/Nsis/DllExports.cpp | 110 + CPP/7zip/Archive/Nsis/Nsis.dsp | 337 +++ CPP/7zip/Archive/Nsis/Nsis.dsw | 29 + CPP/7zip/Archive/Nsis/NsisDecode.cpp | 150 ++ CPP/7zip/Archive/Nsis/NsisDecode.h | 47 + CPP/7zip/Archive/Nsis/NsisHandler.cpp | 484 ++++ CPP/7zip/Archive/Nsis/NsisHandler.h | 41 + CPP/7zip/Archive/Nsis/NsisIn.cpp | 1169 ++++++++++ CPP/7zip/Archive/Nsis/NsisIn.h | 166 ++ CPP/7zip/Archive/Nsis/StdAfx.cpp | 3 + CPP/7zip/Archive/Nsis/StdAfx.h | 9 + CPP/7zip/Archive/Nsis/makefile | 67 + CPP/7zip/Archive/Nsis/resource.rc | 3 + CPP/7zip/Archive/RPM/DllExports.cpp | 68 + CPP/7zip/Archive/RPM/Rpm.dsp | 205 ++ CPP/7zip/Archive/RPM/Rpm.dsw | 29 + CPP/7zip/Archive/RPM/RpmHandler.cpp | 194 ++ CPP/7zip/Archive/RPM/RpmHandler.h | 46 + CPP/7zip/Archive/RPM/RpmHeader.h | 63 + CPP/7zip/Archive/RPM/RpmIn.cpp | 112 + CPP/7zip/Archive/RPM/RpmIn.h | 15 + CPP/7zip/Archive/RPM/StdAfx.cpp | 3 + CPP/7zip/Archive/RPM/StdAfx.h | 8 + CPP/7zip/Archive/RPM/makefile | 42 + CPP/7zip/Archive/RPM/resource.rc | 5 + CPP/7zip/Archive/RPM/rpm.ico | Bin 0 -> 3638 bytes CPP/7zip/Archive/Rar/DllExports.cpp | 142 ++ CPP/7zip/Archive/Rar/Rar.dsp | 459 ++++ CPP/7zip/Archive/Rar/Rar.dsw | 29 + CPP/7zip/Archive/Rar/RarHandler.cpp | 941 ++++++++ CPP/7zip/Archive/Rar/RarHandler.h | 63 + CPP/7zip/Archive/Rar/RarHeader.cpp | 21 + CPP/7zip/Archive/Rar/RarHeader.h | 224 ++ CPP/7zip/Archive/Rar/RarIn.cpp | 535 +++++ CPP/7zip/Archive/Rar/RarIn.h | 124 ++ CPP/7zip/Archive/Rar/RarItem.cpp | 118 + CPP/7zip/Archive/Rar/RarItem.h | 91 + CPP/7zip/Archive/Rar/RarVolumeInStream.cpp | 79 + CPP/7zip/Archive/Rar/RarVolumeInStream.h | 50 + CPP/7zip/Archive/Rar/StdAfx.cpp | 3 + CPP/7zip/Archive/Rar/StdAfx.h | 8 + CPP/7zip/Archive/Rar/makefile | 90 + CPP/7zip/Archive/Rar/rar.ico | Bin 0 -> 3638 bytes CPP/7zip/Archive/Rar/resource.rc | 5 + CPP/7zip/Archive/Split/DllExports.cpp | 65 + CPP/7zip/Archive/Split/Split.dsp | 237 ++ CPP/7zip/Archive/Split/Split.dsw | 29 + CPP/7zip/Archive/Split/Split.ico | Bin 0 -> 3638 bytes CPP/7zip/Archive/Split/SplitHandler.cpp | 415 ++++ CPP/7zip/Archive/Split/SplitHandler.h | 62 + CPP/7zip/Archive/Split/SplitHandlerOut.cpp | 102 + CPP/7zip/Archive/Split/StdAfx.cpp | 3 + CPP/7zip/Archive/Split/StdAfx.h | 8 + CPP/7zip/Archive/Split/makefile | 51 + CPP/7zip/Archive/Split/resource.rc | 5 + CPP/7zip/Archive/Tar/DllExports.cpp | 86 + CPP/7zip/Archive/Tar/StdAfx.cpp | 3 + CPP/7zip/Archive/Tar/StdAfx.h | 9 + CPP/7zip/Archive/Tar/Tar.dsp | 297 +++ CPP/7zip/Archive/Tar/Tar.dsw | 29 + CPP/7zip/Archive/Tar/TarHandler.cpp | 282 +++ CPP/7zip/Archive/Tar/TarHandler.h | 56 + CPP/7zip/Archive/Tar/TarHandlerOut.cpp | 126 ++ CPP/7zip/Archive/Tar/TarHeader.cpp | 25 + CPP/7zip/Archive/Tar/TarHeader.h | 99 + CPP/7zip/Archive/Tar/TarIn.cpp | 248 +++ CPP/7zip/Archive/Tar/TarIn.h | 30 + CPP/7zip/Archive/Tar/TarItem.h | 69 + CPP/7zip/Archive/Tar/TarOut.cpp | 191 ++ CPP/7zip/Archive/Tar/TarOut.h | 28 + CPP/7zip/Archive/Tar/TarUpdate.cpp | 162 ++ CPP/7zip/Archive/Tar/TarUpdate.h | 36 + CPP/7zip/Archive/Tar/makefile | 59 + CPP/7zip/Archive/Tar/resource.rc | 5 + CPP/7zip/Archive/Tar/tar.ico | Bin 0 -> 3638 bytes CPP/7zip/Archive/Z/DllExports.cpp | 91 + CPP/7zip/Archive/Z/StdAfx.cpp | 3 + CPP/7zip/Archive/Z/StdAfx.h | 8 + CPP/7zip/Archive/Z/Z.dsp | 237 ++ CPP/7zip/Archive/Z/Z.dsw | 29 + CPP/7zip/Archive/Z/Z.ico | Bin 0 -> 3638 bytes CPP/7zip/Archive/Z/ZHandler.cpp | 202 ++ CPP/7zip/Archive/Z/ZHandler.h | 47 + CPP/7zip/Archive/Z/makefile | 52 + CPP/7zip/Archive/Z/resource.rc | 5 + CPP/7zip/Archive/Zip/DllExports.cpp | 152 ++ CPP/7zip/Archive/Zip/StdAfx.cpp | 3 + CPP/7zip/Archive/Zip/StdAfx.h | 8 + CPP/7zip/Archive/Zip/Zip.dsp | 651 ++++++ CPP/7zip/Archive/Zip/Zip.dsw | 29 + CPP/7zip/Archive/Zip/ZipAddCommon.cpp | 309 +++ CPP/7zip/Archive/Zip/ZipAddCommon.h | 58 + CPP/7zip/Archive/Zip/ZipCompressionMode.h | 39 + CPP/7zip/Archive/Zip/ZipHandler.cpp | 766 +++++++ CPP/7zip/Archive/Zip/ZipHandler.h | 100 + CPP/7zip/Archive/Zip/ZipHandlerOut.cpp | 393 ++++ CPP/7zip/Archive/Zip/ZipHeader.cpp | 36 + CPP/7zip/Archive/Zip/ZipHeader.h | 248 +++ CPP/7zip/Archive/Zip/ZipIn.cpp | 797 +++++++ CPP/7zip/Archive/Zip/ZipIn.h | 111 + CPP/7zip/Archive/Zip/ZipItem.cpp | 137 ++ CPP/7zip/Archive/Zip/ZipItem.h | 191 ++ CPP/7zip/Archive/Zip/ZipItemEx.h | 29 + CPP/7zip/Archive/Zip/ZipOut.cpp | 259 +++ CPP/7zip/Archive/Zip/ZipOut.h | 51 + CPP/7zip/Archive/Zip/ZipUpdate.cpp | 734 +++++++ CPP/7zip/Archive/Zip/ZipUpdate.h | 52 + CPP/7zip/Archive/Zip/makefile | 124 ++ CPP/7zip/Archive/Zip/resource.rc | 5 + CPP/7zip/Archive/Zip/zip.ico | Bin 0 -> 3638 bytes CPP/7zip/Archive/makefile | 23 + CPP/7zip/Bundles/Alone/Alone.dsp | 2301 ++++++++++++++++++++ CPP/7zip/Bundles/Alone/Alone.dsw | 29 + CPP/7zip/Bundles/Alone/StdAfx.cpp | 3 + CPP/7zip/Bundles/Alone/StdAfx.h | 9 + CPP/7zip/Bundles/Alone/afxres.h | 1 + CPP/7zip/Bundles/Alone/makefile | 390 ++++ CPP/7zip/Bundles/Alone/resource.rc | 3 + CPP/7zip/Bundles/Alone7z/Alone.dsp | 1358 ++++++++++++ CPP/7zip/Bundles/Alone7z/Alone.dsw | 29 + CPP/7zip/Bundles/Alone7z/StdAfx.cpp | 3 + CPP/7zip/Bundles/Alone7z/StdAfx.h | 9 + CPP/7zip/Bundles/Alone7z/makefile | 196 ++ CPP/7zip/Bundles/Alone7z/resource.rc | 3 + CPP/7zip/Bundles/Format7z/Format7z.dsp | 1006 +++++++++ CPP/7zip/Bundles/Format7z/Format7z.dsw | 29 + CPP/7zip/Bundles/Format7z/StdAfx.cpp | 3 + CPP/7zip/Bundles/Format7z/StdAfx.h | 9 + CPP/7zip/Bundles/Format7z/makefile | 201 ++ CPP/7zip/Bundles/Format7z/resource.rc | 5 + CPP/7zip/Bundles/Format7zExtract/Format7z.dsp | 813 +++++++ CPP/7zip/Bundles/Format7zExtract/Format7z.dsw | 29 + CPP/7zip/Bundles/Format7zExtract/StdAfx.cpp | 3 + CPP/7zip/Bundles/Format7zExtract/StdAfx.h | 9 + CPP/7zip/Bundles/Format7zExtract/makefile | 174 ++ CPP/7zip/Bundles/Format7zExtract/resource.rc | 5 + CPP/7zip/Bundles/Format7zExtractR/StdAfx.cpp | 3 + CPP/7zip/Bundles/Format7zExtractR/StdAfx.h | 9 + CPP/7zip/Bundles/Format7zExtractR/makefile | 117 + CPP/7zip/Bundles/Format7zExtractR/resource.rc | 5 + CPP/7zip/Bundles/Format7zR/StdAfx.cpp | 3 + CPP/7zip/Bundles/Format7zR/StdAfx.h | 9 + CPP/7zip/Bundles/Format7zR/makefile | 150 ++ CPP/7zip/Bundles/Format7zR/resource.rc | 5 + CPP/7zip/Bundles/SFXCon/7z.ico | Bin 0 -> 1078 bytes CPP/7zip/Bundles/SFXCon/Main.cpp | 416 ++++ CPP/7zip/Bundles/SFXCon/SFXCon.dsp | 759 +++++++ CPP/7zip/Bundles/SFXCon/SFXCon.dsw | 29 + CPP/7zip/Bundles/SFXCon/StdAfx.cpp | 3 + CPP/7zip/Bundles/SFXCon/StdAfx.h | 9 + CPP/7zip/Bundles/SFXCon/makefile | 180 ++ CPP/7zip/Bundles/SFXCon/resource.rc | 5 + CPP/7zip/Bundles/SFXSetup/ExtractCallback.cpp | 249 +++ CPP/7zip/Bundles/SFXSetup/ExtractCallback.h | 96 + CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp | 139 ++ CPP/7zip/Bundles/SFXSetup/ExtractEngine.h | 17 + CPP/7zip/Bundles/SFXSetup/Main.cpp | 335 +++ CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp | 696 ++++++ CPP/7zip/Bundles/SFXSetup/SFXSetup.dsw | 29 + CPP/7zip/Bundles/SFXSetup/StdAfx.cpp | 3 + CPP/7zip/Bundles/SFXSetup/StdAfx.h | 10 + CPP/7zip/Bundles/SFXSetup/makefile | 156 ++ CPP/7zip/Bundles/SFXSetup/resource.h | 6 + CPP/7zip/Bundles/SFXSetup/resource.rc | 16 + CPP/7zip/Bundles/SFXSetup/setup.ico | Bin 0 -> 1078 bytes CPP/7zip/Bundles/SFXWin/7z.ico | Bin 0 -> 1078 bytes CPP/7zip/Bundles/SFXWin/Main.cpp | 115 + CPP/7zip/Bundles/SFXWin/SFXWin.dsp | 847 +++++++ CPP/7zip/Bundles/SFXWin/SFXWin.dsw | 29 + CPP/7zip/Bundles/SFXWin/StdAfx.cpp | 3 + CPP/7zip/Bundles/SFXWin/StdAfx.h | 12 + CPP/7zip/Bundles/SFXWin/makefile | 207 ++ CPP/7zip/Bundles/SFXWin/resource.h | 7 + CPP/7zip/Bundles/SFXWin/resource.rc | 34 + CPP/7zip/Bundles/makefile | 15 + CPP/7zip/Common/FilePathAutoRename.cpp | 57 + CPP/7zip/Common/FilePathAutoRename.h | 10 + CPP/7zip/Common/FileStreams.cpp | 251 +++ CPP/7zip/Common/FileStreams.h | 98 + CPP/7zip/Common/InBuffer.cpp | 80 + CPP/7zip/Common/InBuffer.h | 76 + CPP/7zip/Common/InMemStream.cpp | 222 ++ CPP/7zip/Common/InMemStream.h | 282 +++ CPP/7zip/Common/InOutTempBuffer.cpp | 122 ++ CPP/7zip/Common/InOutTempBuffer.h | 55 + CPP/7zip/Common/LSBFDecoder.cpp | 27 + CPP/7zip/Common/LSBFDecoder.h | 127 ++ CPP/7zip/Common/LSBFEncoder.cpp | 29 + CPP/7zip/Common/LSBFEncoder.h | 51 + CPP/7zip/Common/LimitedStreams.cpp | 24 + CPP/7zip/Common/LimitedStreams.h | 33 + CPP/7zip/Common/LockedStream.cpp | 23 + CPP/7zip/Common/LockedStream.h | 38 + CPP/7zip/Common/MSBFDecoder.h | 69 + CPP/7zip/Common/MSBFEncoder.h | 59 + CPP/7zip/Common/MemBlocks.cpp | 184 ++ CPP/7zip/Common/MemBlocks.h | 73 + CPP/7zip/Common/OffsetStream.cpp | 35 + CPP/7zip/Common/OffsetStream.h | 25 + CPP/7zip/Common/OutBuffer.cpp | 116 + CPP/7zip/Common/OutBuffer.h | 64 + CPP/7zip/Common/OutMemStream.cpp | 137 ++ CPP/7zip/Common/OutMemStream.h | 88 + CPP/7zip/Common/ProgressMt.cpp | 53 + CPP/7zip/Common/ProgressMt.h | 47 + CPP/7zip/Common/ProgressUtils.cpp | 55 + CPP/7zip/Common/ProgressUtils.h | 43 + CPP/7zip/Common/StdAfx.h | 9 + CPP/7zip/Common/StreamBinder.cpp | 162 ++ CPP/7zip/Common/StreamBinder.h | 37 + CPP/7zip/Common/StreamObjects.cpp | 68 + CPP/7zip/Common/StreamObjects.h | 117 + CPP/7zip/Common/StreamUtils.cpp | 44 + CPP/7zip/Common/StreamUtils.h | 11 + CPP/7zip/Compress/Arj/ArjDecoder1.cpp | 319 +++ CPP/7zip/Compress/Arj/ArjDecoder1.h | 105 + CPP/7zip/Compress/Arj/ArjDecoder2.cpp | 93 + CPP/7zip/Compress/Arj/ArjDecoder2.h | 65 + CPP/7zip/Compress/Arj/StdAfx.h | 8 + CPP/7zip/Compress/BWT/BlockSort.cpp | 487 +++++ CPP/7zip/Compress/BWT/BlockSort.h | 21 + CPP/7zip/Compress/BWT/Mtf8.h | 195 ++ CPP/7zip/Compress/BWT/StdAfx.h | 6 + CPP/7zip/Compress/BZip2/BZip2.dsp | 303 +++ CPP/7zip/Compress/BZip2/BZip2.dsw | 29 + CPP/7zip/Compress/BZip2/BZip2CRC.cpp | 26 + CPP/7zip/Compress/BZip2/BZip2CRC.h | 31 + CPP/7zip/Compress/BZip2/BZip2Const.h | 54 + CPP/7zip/Compress/BZip2/BZip2Decoder.cpp | 770 +++++++ CPP/7zip/Compress/BZip2/BZip2Decoder.h | 164 ++ CPP/7zip/Compress/BZip2/BZip2Encoder.cpp | 883 ++++++++ CPP/7zip/Compress/BZip2/BZip2Encoder.h | 246 +++ CPP/7zip/Compress/BZip2/DllExports.cpp | 93 + CPP/7zip/Compress/BZip2/StdAfx.cpp | 3 + CPP/7zip/Compress/BZip2/StdAfx.h | 8 + CPP/7zip/Compress/BZip2/makefile | 56 + CPP/7zip/Compress/BZip2/resource.rc | 3 + CPP/7zip/Compress/BZip2Original/BZip2Decoder.cpp | 131 ++ CPP/7zip/Compress/BZip2Original/BZip2Decoder.h | 38 + CPP/7zip/Compress/BZip2Original/BZip2Encoder.cpp | 120 + CPP/7zip/Compress/BZip2Original/BZip2Encoder.h | 30 + CPP/7zip/Compress/BZip2Original/BZip2Error.cpp | 10 + CPP/7zip/Compress/BZip2Original/DllExports.cpp | 86 + CPP/7zip/Compress/BZip2Original/StdAfx.cpp | 3 + CPP/7zip/Compress/BZip2Original/StdAfx.h | 8 + CPP/7zip/Compress/Branch/ARM.cpp | 16 + CPP/7zip/Compress/Branch/ARM.h | 10 + CPP/7zip/Compress/Branch/ARMThumb.cpp | 16 + CPP/7zip/Compress/Branch/ARMThumb.h | 10 + CPP/7zip/Compress/Branch/Branch.dsp | 298 +++ CPP/7zip/Compress/Branch/Branch.dsw | 29 + CPP/7zip/Compress/Branch/BranchCoder.cpp | 18 + CPP/7zip/Compress/Branch/BranchCoder.h | 54 + CPP/7zip/Compress/Branch/DllExports.cpp | 152 ++ CPP/7zip/Compress/Branch/IA64.cpp | 16 + CPP/7zip/Compress/Branch/IA64.h | 10 + CPP/7zip/Compress/Branch/PPC.cpp | 17 + CPP/7zip/Compress/Branch/PPC.h | 10 + CPP/7zip/Compress/Branch/SPARC.cpp | 17 + CPP/7zip/Compress/Branch/SPARC.h | 10 + CPP/7zip/Compress/Branch/StdAfx.cpp | 3 + CPP/7zip/Compress/Branch/StdAfx.h | 8 + CPP/7zip/Compress/Branch/makefile | 48 + CPP/7zip/Compress/Branch/resource.rc | 3 + CPP/7zip/Compress/Branch/x86.cpp | 18 + CPP/7zip/Compress/Branch/x86.h | 19 + CPP/7zip/Compress/Branch/x86_2.cpp | 412 ++++ CPP/7zip/Compress/Branch/x86_2.h | 133 ++ CPP/7zip/Compress/ByteSwap/ByteSwap.cpp | 38 + CPP/7zip/Compress/ByteSwap/ByteSwap.dsp | 125 ++ CPP/7zip/Compress/ByteSwap/ByteSwap.dsw | 29 + CPP/7zip/Compress/ByteSwap/ByteSwap.h | 37 + CPP/7zip/Compress/ByteSwap/DllExports.cpp | 91 + CPP/7zip/Compress/ByteSwap/StdAfx.cpp | 3 + CPP/7zip/Compress/ByteSwap/StdAfx.h | 8 + CPP/7zip/Compress/ByteSwap/makefile | 23 + CPP/7zip/Compress/ByteSwap/resource.rc | 3 + CPP/7zip/Compress/Codec.def | 4 + CPP/7zip/Compress/Copy/Copy.dsp | 149 ++ CPP/7zip/Compress/Copy/Copy.dsw | 29 + CPP/7zip/Compress/Copy/CopyCoder.cpp | 52 + CPP/7zip/Compress/Copy/CopyCoder.h | 31 + CPP/7zip/Compress/Copy/DllExports.cpp | 70 + CPP/7zip/Compress/Copy/StdAfx.cpp | 3 + CPP/7zip/Compress/Copy/StdAfx.h | 8 + CPP/7zip/Compress/Copy/makefile | 30 + CPP/7zip/Compress/Copy/resource.rc | 3 + CPP/7zip/Compress/Deflate/Deflate.dsp | 341 +++ CPP/7zip/Compress/Deflate/Deflate.dsw | 29 + CPP/7zip/Compress/Deflate/DeflateConst.h | 134 ++ CPP/7zip/Compress/Deflate/DeflateDecoder.cpp | 339 +++ CPP/7zip/Compress/Deflate/DeflateDecoder.h | 134 ++ CPP/7zip/Compress/Deflate/DeflateEncoder.cpp | 963 ++++++++ CPP/7zip/Compress/Deflate/DeflateEncoder.h | 221 ++ CPP/7zip/Compress/Deflate/DllExports.cpp | 157 ++ CPP/7zip/Compress/Deflate/StdAfx.cpp | 3 + CPP/7zip/Compress/Deflate/StdAfx.h | 8 + CPP/7zip/Compress/Deflate/makefile | 63 + CPP/7zip/Compress/Deflate/resource.rc | 3 + CPP/7zip/Compress/Huffman/HuffmanDecoder.h | 88 + CPP/7zip/Compress/Huffman/StdAfx.h | 6 + CPP/7zip/Compress/Implode/DllExports.cpp | 65 + CPP/7zip/Compress/Implode/ImplodeDecoder.cpp | 222 ++ CPP/7zip/Compress/Implode/ImplodeDecoder.h | 60 + .../Compress/Implode/ImplodeHuffmanDecoder.cpp | 89 + CPP/7zip/Compress/Implode/ImplodeHuffmanDecoder.h | 33 + CPP/7zip/Compress/Implode/StdAfx.cpp | 3 + CPP/7zip/Compress/Implode/StdAfx.h | 8 + CPP/7zip/Compress/LZ/LZOutWindow.cpp | 17 + CPP/7zip/Compress/LZ/LZOutWindow.h | 56 + CPP/7zip/Compress/LZ/StdAfx.h | 6 + CPP/7zip/Compress/LZMA/DllExports.cpp | 109 + CPP/7zip/Compress/LZMA/LZMA.dsp | 478 ++++ CPP/7zip/Compress/LZMA/LZMA.dsw | 29 + CPP/7zip/Compress/LZMA/LZMA.h | 82 + CPP/7zip/Compress/LZMA/LZMADecoder.cpp | 338 +++ CPP/7zip/Compress/LZMA/LZMADecoder.h | 251 +++ CPP/7zip/Compress/LZMA/LZMAEncoder.cpp | 1530 +++++++++++++ CPP/7zip/Compress/LZMA/LZMAEncoder.h | 435 ++++ CPP/7zip/Compress/LZMA/StdAfx.cpp | 3 + CPP/7zip/Compress/LZMA/StdAfx.h | 8 + CPP/7zip/Compress/LZMA/makefile | 69 + CPP/7zip/Compress/LZMA/resource.rc | 3 + CPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsp | 449 ++++ CPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsw | 29 + CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp | 526 +++++ CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp | 506 +++++ CPP/7zip/Compress/LZMA_Alone/LzmaBench.h | 11 + CPP/7zip/Compress/LZMA_Alone/LzmaRam.cpp | 227 ++ CPP/7zip/Compress/LZMA_Alone/LzmaRam.h | 46 + CPP/7zip/Compress/LZMA_Alone/LzmaRamDecode.c | 79 + CPP/7zip/Compress/LZMA_Alone/LzmaRamDecode.h | 55 + CPP/7zip/Compress/LZMA_Alone/StdAfx.cpp | 3 + CPP/7zip/Compress/LZMA_Alone/StdAfx.h | 8 + CPP/7zip/Compress/LZMA_Alone/makefile | 124 ++ CPP/7zip/Compress/LZMA_Alone/makefile.gcc | 117 + CPP/7zip/Compress/Lzh/LzhDecoder.cpp | 216 ++ CPP/7zip/Compress/Lzh/LzhDecoder.h | 103 + CPP/7zip/Compress/Lzx/Lzx.h | 61 + CPP/7zip/Compress/Lzx/Lzx86Converter.cpp | 90 + CPP/7zip/Compress/Lzx/Lzx86Converter.h | 45 + CPP/7zip/Compress/Lzx/LzxDecoder.cpp | 382 ++++ CPP/7zip/Compress/Lzx/LzxDecoder.h | 181 ++ CPP/7zip/Compress/Lzx/StdAfx.h | 8 + CPP/7zip/Compress/PPMD/DllExports.cpp | 93 + CPP/7zip/Compress/PPMD/PPMD.dsp | 229 ++ CPP/7zip/Compress/PPMD/PPMD.dsw | 29 + CPP/7zip/Compress/PPMD/PPMDContext.h | 489 +++++ CPP/7zip/Compress/PPMD/PPMDDecode.h | 154 ++ CPP/7zip/Compress/PPMD/PPMDDecoder.cpp | 184 ++ CPP/7zip/Compress/PPMD/PPMDDecoder.h | 89 + CPP/7zip/Compress/PPMD/PPMDEncode.h | 142 ++ CPP/7zip/Compress/PPMD/PPMDEncoder.cpp | 155 ++ CPP/7zip/Compress/PPMD/PPMDEncoder.h | 81 + CPP/7zip/Compress/PPMD/PPMDSubAlloc.h | 292 +++ CPP/7zip/Compress/PPMD/PPMDType.h | 19 + CPP/7zip/Compress/PPMD/StdAfx.cpp | 3 + CPP/7zip/Compress/PPMD/StdAfx.h | 8 + CPP/7zip/Compress/PPMD/makefile | 41 + CPP/7zip/Compress/PPMD/resource.rc | 3 + CPP/7zip/Compress/Quantum/QuantumDecoder.cpp | 173 ++ CPP/7zip/Compress/Quantum/QuantumDecoder.h | 287 +++ CPP/7zip/Compress/RangeCoder/RangeCoder.h | 205 ++ CPP/7zip/Compress/RangeCoder/RangeCoderBit.cpp | 80 + CPP/7zip/Compress/RangeCoder/RangeCoderBit.h | 120 + CPP/7zip/Compress/RangeCoder/RangeCoderBitTree.h | 161 ++ CPP/7zip/Compress/RangeCoder/RangeCoderOpt.h | 31 + CPP/7zip/Compress/RangeCoder/StdAfx.h | 6 + CPP/7zip/Compress/Rar/DllExports.cpp | 91 + CPP/7zip/Compress/Rar/Rar1Decoder.cpp | 485 +++++ CPP/7zip/Compress/Rar/Rar1Decoder.h | 90 + CPP/7zip/Compress/Rar/Rar29.dsp | 297 +++ CPP/7zip/Compress/Rar/Rar29.dsw | 29 + CPP/7zip/Compress/Rar/Rar2Decoder.cpp | 401 ++++ CPP/7zip/Compress/Rar/Rar2Decoder.h | 176 ++ CPP/7zip/Compress/Rar/Rar3Decoder.cpp | 832 +++++++ CPP/7zip/Compress/Rar/Rar3Decoder.h | 294 +++ CPP/7zip/Compress/Rar/Rar3Vm.cpp | 1089 +++++++++ CPP/7zip/Compress/Rar/Rar3Vm.h | 219 ++ CPP/7zip/Compress/Rar/StdAfx.cpp | 3 + CPP/7zip/Compress/Rar/StdAfx.h | 8 + CPP/7zip/Compress/Rar/makefile | 49 + CPP/7zip/Compress/Rar/resource.rc | 3 + CPP/7zip/Compress/Shrink/DllExports.cpp | 64 + CPP/7zip/Compress/Shrink/ShrinkDecoder.cpp | 149 ++ CPP/7zip/Compress/Shrink/ShrinkDecoder.h | 39 + CPP/7zip/Compress/Shrink/StdAfx.cpp | 3 + CPP/7zip/Compress/Shrink/StdAfx.h | 8 + CPP/7zip/Compress/Z/StdAfx.cpp | 3 + CPP/7zip/Compress/Z/StdAfx.h | 8 + CPP/7zip/Compress/Z/ZDecoder.cpp | 172 ++ CPP/7zip/Compress/Z/ZDecoder.h | 44 + CPP/7zip/Compress/makefile | 14 + CPP/7zip/Crypto/7zAES/7zAES.cpp | 305 +++ CPP/7zip/Crypto/7zAES/7zAES.dsp | 245 +++ CPP/7zip/Crypto/7zAES/7zAES.dsw | 29 + CPP/7zip/Crypto/7zAES/7zAES.h | 122 ++ CPP/7zip/Crypto/7zAES/DllExports.cpp | 111 + CPP/7zip/Crypto/7zAES/StdAfx.cpp | 3 + CPP/7zip/Crypto/7zAES/StdAfx.h | 8 + CPP/7zip/Crypto/7zAES/makefile | 52 + CPP/7zip/Crypto/7zAES/resource.rc | 3 + CPP/7zip/Crypto/AES/AES.dsp | 203 ++ CPP/7zip/Crypto/AES/AES.dsw | 29 + CPP/7zip/Crypto/AES/AES_CBC.h | 39 + CPP/7zip/Crypto/AES/DllExports.cpp | 100 + CPP/7zip/Crypto/AES/MyAES.cpp | 94 + CPP/7zip/Crypto/AES/MyAES.h | 106 + CPP/7zip/Crypto/AES/StdAfx.cpp | 3 + CPP/7zip/Crypto/AES/StdAfx.h | 8 + CPP/7zip/Crypto/AES/aes.h | 103 + CPP/7zip/Crypto/AES/aescpp.h | 55 + CPP/7zip/Crypto/AES/aescrypt.c | 421 ++++ CPP/7zip/Crypto/AES/aeskey.c | 363 +++ CPP/7zip/Crypto/AES/aesopt.h | 839 +++++++ CPP/7zip/Crypto/AES/aestab.c | 494 +++++ CPP/7zip/Crypto/AES/makefile | 31 + CPP/7zip/Crypto/AES/resource.rc | 3 + CPP/7zip/Crypto/Codec.def | 4 + CPP/7zip/Crypto/Hash/HmacSha1.cpp | 109 + CPP/7zip/Crypto/Hash/HmacSha1.h | 39 + CPP/7zip/Crypto/Hash/Pbkdf2HmacSha1.cpp | 83 + CPP/7zip/Crypto/Hash/Pbkdf2HmacSha1.h | 21 + CPP/7zip/Crypto/Hash/RandGen.cpp | 78 + CPP/7zip/Crypto/Hash/RandGen.h | 21 + CPP/7zip/Crypto/Hash/RotateDefs.h | 19 + CPP/7zip/Crypto/Hash/Sha1.cpp | 210 ++ CPP/7zip/Crypto/Hash/Sha1.h | 68 + CPP/7zip/Crypto/Hash/Sha256.cpp | 210 ++ CPP/7zip/Crypto/Hash/Sha256.h | 30 + CPP/7zip/Crypto/Hash/StdAfx.h | 8 + CPP/7zip/Crypto/Rar20/Rar20Cipher.cpp | 76 + CPP/7zip/Crypto/Rar20/Rar20Cipher.h | 35 + CPP/7zip/Crypto/Rar20/Rar20Crypto.cpp | 124 ++ CPP/7zip/Crypto/Rar20/Rar20Crypto.h | 33 + CPP/7zip/Crypto/Rar20/StdAfx.h | 8 + CPP/7zip/Crypto/RarAES/RarAES.cpp | 187 ++ CPP/7zip/Crypto/RarAES/RarAES.h | 61 + CPP/7zip/Crypto/RarAES/StdAfx.h | 8 + CPP/7zip/Crypto/WzAES/StdAfx.cpp | 3 + CPP/7zip/Crypto/WzAES/StdAfx.h | 8 + CPP/7zip/Crypto/WzAES/WzAES.cpp | 246 +++ CPP/7zip/Crypto/WzAES/WzAES.h | 126 ++ CPP/7zip/Crypto/Zip/StdAfx.h | 8 + CPP/7zip/Crypto/Zip/ZipCipher.cpp | 85 + CPP/7zip/Crypto/Zip/ZipCipher.h | 59 + CPP/7zip/Crypto/Zip/ZipCrypto.cpp | 65 + CPP/7zip/Crypto/Zip/ZipCrypto.h | 26 + CPP/7zip/Crypto/makefile | 8 + CPP/7zip/FileManager/7zFM.exe.manifest | 1 + CPP/7zip/FileManager/7zipLogo.ico | Bin 0 -> 9150 bytes CPP/7zip/FileManager/Add.bmp | Bin 0 -> 982 bytes CPP/7zip/FileManager/Add2.bmp | Bin 0 -> 406 bytes CPP/7zip/FileManager/App.cpp | 759 +++++++ CPP/7zip/FileManager/App.h | 332 +++ CPP/7zip/FileManager/AppState.h | 114 + CPP/7zip/FileManager/ClassDefs.cpp | 15 + CPP/7zip/FileManager/Copy.bmp | Bin 0 -> 982 bytes CPP/7zip/FileManager/Copy2.bmp | Bin 0 -> 406 bytes CPP/7zip/FileManager/Delete.bmp | Bin 0 -> 982 bytes CPP/7zip/FileManager/Delete2.bmp | Bin 0 -> 406 bytes CPP/7zip/FileManager/EnumFormatEtc.cpp | 108 + CPP/7zip/FileManager/EnumFormatEtc.h | 10 + CPP/7zip/FileManager/Extract.bmp | Bin 0 -> 982 bytes CPP/7zip/FileManager/Extract2.bmp | Bin 0 -> 406 bytes CPP/7zip/FileManager/ExtractCallback.cpp | 382 ++++ CPP/7zip/FileManager/ExtractCallback.h | 124 ++ CPP/7zip/FileManager/FM.cpp | 788 +++++++ CPP/7zip/FileManager/FM.dsp | 1251 +++++++++++ CPP/7zip/FileManager/FM.dsw | 29 + CPP/7zip/FileManager/FM.ico | Bin 0 -> 4846 bytes CPP/7zip/FileManager/FSDrives.cpp | 240 ++ CPP/7zip/FileManager/FSDrives.h | 66 + CPP/7zip/FileManager/FSFolder.cpp | 655 ++++++ CPP/7zip/FileManager/FSFolder.h | 141 ++ CPP/7zip/FileManager/FSFolderCopy.cpp | 490 +++++ CPP/7zip/FileManager/FileFolderPluginOpen.cpp | 111 + CPP/7zip/FileManager/FileFolderPluginOpen.h | 9 + CPP/7zip/FileManager/FilePlugins.cpp | 113 + CPP/7zip/FileManager/FilePlugins.h | 54 + CPP/7zip/FileManager/FormatUtils.cpp | 40 + CPP/7zip/FileManager/FormatUtils.h | 18 + CPP/7zip/FileManager/HelpUtils.cpp | 23 + CPP/7zip/FileManager/HelpUtils.h | 10 + CPP/7zip/FileManager/IFolder.h | 190 ++ CPP/7zip/FileManager/Info.bmp | Bin 0 -> 982 bytes CPP/7zip/FileManager/Info2.bmp | Bin 0 -> 406 bytes CPP/7zip/FileManager/LangUtils.cpp | 185 ++ CPP/7zip/FileManager/LangUtils.h | 41 + CPP/7zip/FileManager/Move.bmp | Bin 0 -> 982 bytes CPP/7zip/FileManager/Move2.bmp | Bin 0 -> 406 bytes CPP/7zip/FileManager/MyCom2.h | 48 + CPP/7zip/FileManager/MyLoadMenu.cpp | 694 ++++++ CPP/7zip/FileManager/MyLoadMenu.h | 16 + CPP/7zip/FileManager/NetFolder.cpp | 315 +++ CPP/7zip/FileManager/NetFolder.h | 66 + CPP/7zip/FileManager/OpenCallback.cpp | 113 + CPP/7zip/FileManager/OpenCallback.h | 85 + CPP/7zip/FileManager/OptionsDialog.cpp | 65 + CPP/7zip/FileManager/Panel.cpp | 856 ++++++++ CPP/7zip/FileManager/Panel.h | 510 +++++ CPP/7zip/FileManager/PanelCopy.cpp | 208 ++ CPP/7zip/FileManager/PanelCrc.cpp | 361 +++ CPP/7zip/FileManager/PanelDrag.cpp | 796 +++++++ CPP/7zip/FileManager/PanelFolderChange.cpp | 414 ++++ CPP/7zip/FileManager/PanelItemOpen.cpp | 546 +++++ CPP/7zip/FileManager/PanelItems.cpp | 822 +++++++ CPP/7zip/FileManager/PanelKey.cpp | 297 +++ CPP/7zip/FileManager/PanelListNotify.cpp | 388 ++++ CPP/7zip/FileManager/PanelMenu.cpp | 422 ++++ CPP/7zip/FileManager/PanelOperations.cpp | 396 ++++ CPP/7zip/FileManager/PanelSelect.cpp | 297 +++ CPP/7zip/FileManager/PanelSort.cpp | 163 ++ CPP/7zip/FileManager/PanelSplitFile.cpp | 477 ++++ CPP/7zip/FileManager/PhysDriveFolder.cpp | 274 +++ CPP/7zip/FileManager/PhysDriveFolder.h | 89 + CPP/7zip/FileManager/PluginInterface.h | 42 + CPP/7zip/FileManager/PluginLoader.h | 32 + CPP/7zip/FileManager/ProgramLocation.cpp | 24 + CPP/7zip/FileManager/ProgramLocation.h | 10 + CPP/7zip/FileManager/PropertyName.cpp | 74 + CPP/7zip/FileManager/PropertyName.h | 10 + CPP/7zip/FileManager/RegistryAssociations.cpp | 270 +++ CPP/7zip/FileManager/RegistryAssociations.h | 45 + CPP/7zip/FileManager/RegistryPlugins.cpp | 130 ++ CPP/7zip/FileManager/RegistryPlugins.h | 32 + CPP/7zip/FileManager/RegistryUtils.cpp | 150 ++ CPP/7zip/FileManager/RegistryUtils.h | 46 + .../FileManager/Resource/AboutDialog/7zipLogo.ico | Bin 0 -> 9150 bytes .../Resource/AboutDialog/AboutDialog.cpp | 60 + .../FileManager/Resource/AboutDialog/AboutDialog.h | 18 + CPP/7zip/FileManager/Resource/AboutDialog/StdAfx.h | 16 + .../FileManager/Resource/AboutDialog/resource.h | 6 + .../FileManager/Resource/AboutDialog/resource.rc | 41 + .../Resource/BenchmarkDialog/BenchmarkDialog.cpp | 976 +++++++++ .../Resource/BenchmarkDialog/BenchmarkDialog.h | 136 ++ .../FileManager/Resource/BenchmarkDialog/StdAfx.h | 16 + .../Resource/BenchmarkDialog/resource.h | 34 + .../Resource/BenchmarkDialog/resource.rc | 87 + .../Resource/ComboDialog/ComboDialog.cpp | 53 + .../FileManager/Resource/ComboDialog/ComboDialog.h | 25 + CPP/7zip/FileManager/Resource/ComboDialog/StdAfx.h | 16 + .../FileManager/Resource/ComboDialog/resource.h | 4 + .../FileManager/Resource/ComboDialog/resource.rc | 24 + .../FileManager/Resource/CopyDialog/CopyDialog.cpp | 81 + .../FileManager/Resource/CopyDialog/CopyDialog.h | 26 + CPP/7zip/FileManager/Resource/CopyDialog/StdAfx.h | 16 + .../FileManager/Resource/CopyDialog/resource.h | 7 + .../FileManager/Resource/CopyDialog/resource.rc | 28 + .../FileManager/Resource/EditPage/EditPage.cpp | 91 + CPP/7zip/FileManager/Resource/EditPage/EditPage.h | 21 + CPP/7zip/FileManager/Resource/EditPage/StdAfx.h | 16 + CPP/7zip/FileManager/Resource/EditPage/resource.h | 4 + CPP/7zip/FileManager/Resource/EditPage/resource.rc | 16 + .../FileManager/Resource/LangPage/LangPage.cpp | 90 + CPP/7zip/FileManager/Resource/LangPage/LangPage.h | 21 + CPP/7zip/FileManager/Resource/LangPage/StdAfx.h | 16 + CPP/7zip/FileManager/Resource/LangPage/resource.h | 6 + CPP/7zip/FileManager/Resource/LangPage/resource.rc | 21 + .../FileManager/Resource/ListBoxDialog/StdAfx.h | 16 + .../FileManager/Resource/ListBoxDialog/resource.h | 3 + .../FileManager/Resource/ListBoxDialog/resource.rc | 22 + .../Resource/ListViewDialog/ListViewDialog.cpp | 102 + .../Resource/ListViewDialog/ListViewDialog.h | 30 + .../FileManager/Resource/ListViewDialog/StdAfx.h | 16 + .../FileManager/Resource/ListViewDialog/resource.h | 3 + .../Resource/ListViewDialog/resource.rc | 26 + .../Resource/MessagesDialog/MessagesDialog.cpp | 100 + .../Resource/MessagesDialog/MessagesDialog.h | 22 + .../FileManager/Resource/MessagesDialog/StdAfx.h | 16 + .../FileManager/Resource/MessagesDialog/resource.h | 3 + .../Resource/MessagesDialog/resource.rc | 25 + .../Resource/OverwriteDialog/OverwriteDialog.cpp | 124 ++ .../Resource/OverwriteDialog/OverwriteDialog.h | 34 + .../FileManager/Resource/OverwriteDialog/StdAfx.h | 16 + .../Resource/OverwriteDialog/resource.h | 19 + .../Resource/OverwriteDialog/resource.rc | 47 + .../Resource/PasswordDialog/PasswordDialog.cpp | 50 + .../Resource/PasswordDialog/PasswordDialog.h | 21 + .../FileManager/Resource/PasswordDialog/StdAfx.h | 16 + .../FileManager/Resource/PasswordDialog/resource.h | 4 + .../Resource/PasswordDialog/resource.rc | 26 + .../Resource/PluginsPage/PluginsPage.cpp | 220 ++ .../FileManager/Resource/PluginsPage/PluginsPage.h | 26 + CPP/7zip/FileManager/Resource/PluginsPage/StdAfx.h | 16 + .../FileManager/Resource/PluginsPage/resource.h | 4 + .../FileManager/Resource/PluginsPage/resource.rc | 19 + .../Resource/ProgressDialog/ProgressDialog.cpp | 175 ++ .../Resource/ProgressDialog/ProgressDialog.h | 129 ++ .../FileManager/Resource/ProgressDialog/StdAfx.h | 16 + .../FileManager/Resource/ProgressDialog/resource.h | 3 + .../Resource/ProgressDialog/resource.rc | 20 + .../Resource/ProgressDialog2/ProgressDialog.cpp | 432 ++++ .../Resource/ProgressDialog2/ProgressDialog.h | 184 ++ .../FileManager/Resource/ProgressDialog2/StdAfx.h | 16 + .../Resource/ProgressDialog2/resource.h | 17 + .../Resource/ProgressDialog2/resource.rc | 56 + .../FileManager/Resource/PropertyName/resource.h | 28 + .../FileManager/Resource/PropertyName/resource.rc | 35 + .../Resource/SettingsPage/SettingsPage.cpp | 113 + .../Resource/SettingsPage/SettingsPage.h | 19 + .../FileManager/Resource/SettingsPage/StdAfx.h | 16 + .../FileManager/Resource/SettingsPage/resource.h | 11 + .../FileManager/Resource/SettingsPage/resource.rc | 35 + .../Resource/SplitDialog/SplitDialog.cpp | 89 + .../FileManager/Resource/SplitDialog/SplitDialog.h | 27 + CPP/7zip/FileManager/Resource/SplitDialog/StdAfx.h | 18 + .../FileManager/Resource/SplitDialog/resource.h | 8 + .../FileManager/Resource/SplitDialog/resource.rc | 32 + CPP/7zip/FileManager/Resource/SystemPage/StdAfx.h | 16 + .../FileManager/Resource/SystemPage/SystemPage.cpp | 435 ++++ .../FileManager/Resource/SystemPage/SystemPage.h | 40 + .../FileManager/Resource/SystemPage/resource.h | 7 + .../FileManager/Resource/SystemPage/resource.rc | 31 + CPP/7zip/FileManager/RootFolder.cpp | 204 ++ CPP/7zip/FileManager/RootFolder.h | 49 + CPP/7zip/FileManager/SplitUtils.cpp | 85 + CPP/7zip/FileManager/SplitUtils.h | 15 + CPP/7zip/FileManager/StdAfx.cpp | 3 + CPP/7zip/FileManager/StdAfx.h | 23 + CPP/7zip/FileManager/StringUtils.cpp | 68 + CPP/7zip/FileManager/StringUtils.h | 13 + CPP/7zip/FileManager/SysIconUtils.cpp | 157 ++ CPP/7zip/FileManager/SysIconUtils.h | 51 + CPP/7zip/FileManager/Test.bmp | Bin 0 -> 982 bytes CPP/7zip/FileManager/Test2.bmp | Bin 0 -> 406 bytes CPP/7zip/FileManager/TextPairs.cpp | 216 ++ CPP/7zip/FileManager/TextPairs.h | 32 + CPP/7zip/FileManager/UpdateCallback100.cpp | 92 + CPP/7zip/FileManager/UpdateCallback100.h | 67 + CPP/7zip/FileManager/ViewSettings.cpp | 429 ++++ CPP/7zip/FileManager/ViewSettings.h | 99 + CPP/7zip/FileManager/makefile | 187 ++ CPP/7zip/FileManager/resource.h | 154 ++ CPP/7zip/FileManager/resource.rc | 232 ++ CPP/7zip/GuiCommon.rc | 37 + CPP/7zip/Guid.txt | 157 ++ CPP/7zip/ICoder.h | 163 ++ CPP/7zip/IPassword.h | 26 + CPP/7zip/IProgress.h | 32 + CPP/7zip/IStream.h | 62 + CPP/7zip/MyVersion.h | 8 + CPP/7zip/MyVersionInfo.rc | 41 + CPP/7zip/PropID.h | 51 + CPP/7zip/SubBuild.mak | 3 + CPP/7zip/UI/Agent/Agent.cpp | 578 +++++ CPP/7zip/UI/Agent/Agent.h | 314 +++ CPP/7zip/UI/Agent/AgentOut.cpp | 518 +++++ CPP/7zip/UI/Agent/AgentProxy.cpp | 203 ++ CPP/7zip/UI/Agent/AgentProxy.h | 56 + CPP/7zip/UI/Agent/ArchiveFolder.cpp | 72 + CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp | 98 + CPP/7zip/UI/Agent/ArchiveFolderOut.cpp | 215 ++ CPP/7zip/UI/Agent/IFolderArchive.h | 90 + CPP/7zip/UI/Agent/UpdateCallbackAgent.cpp | 80 + CPP/7zip/UI/Agent/UpdateCallbackAgent.h | 24 + CPP/7zip/UI/Client7z/Client7z.cpp | 850 ++++++++ CPP/7zip/UI/Client7z/Client7z.dsp | 226 ++ CPP/7zip/UI/Client7z/Client7z.dsw | 29 + CPP/7zip/UI/Client7z/StdAfx.cpp | 3 + CPP/7zip/UI/Client7z/StdAfx.h | 9 + CPP/7zip/UI/Client7z/makefile | 45 + CPP/7zip/UI/Common/ArchiveCommandLine.cpp | 985 +++++++++ CPP/7zip/UI/Common/ArchiveCommandLine.h | 95 + CPP/7zip/UI/Common/ArchiveExtractCallback.cpp | 448 ++++ CPP/7zip/UI/Common/ArchiveExtractCallback.h | 111 + CPP/7zip/UI/Common/ArchiveName.cpp | 46 + CPP/7zip/UI/Common/ArchiveName.h | 10 + CPP/7zip/UI/Common/ArchiveOpenCallback.cpp | 127 ++ CPP/7zip/UI/Common/ArchiveOpenCallback.h | 89 + CPP/7zip/UI/Common/ArchiverInfo.cpp | 372 ++++ CPP/7zip/UI/Common/ArchiverInfo.h | 66 + CPP/7zip/UI/Common/CompressCall.cpp | 367 ++++ CPP/7zip/UI/Common/CompressCall.h | 28 + CPP/7zip/UI/Common/DefaultName.cpp | 26 + CPP/7zip/UI/Common/DefaultName.h | 11 + CPP/7zip/UI/Common/DirItem.h | 34 + CPP/7zip/UI/Common/EnumDirItems.cpp | 281 +++ CPP/7zip/UI/Common/EnumDirItems.h | 39 + CPP/7zip/UI/Common/ExitCode.h | 27 + CPP/7zip/UI/Common/Extract.cpp | 152 ++ CPP/7zip/UI/Common/Extract.h | 59 + CPP/7zip/UI/Common/ExtractMode.h | 31 + CPP/7zip/UI/Common/ExtractingFilePath.cpp | 75 + CPP/7zip/UI/Common/ExtractingFilePath.h | 12 + CPP/7zip/UI/Common/HandlerLoader.h | 38 + CPP/7zip/UI/Common/IFileExtractCallback.h | 46 + CPP/7zip/UI/Common/OpenArchive.cpp | 531 +++++ CPP/7zip/UI/Common/OpenArchive.h | 134 ++ CPP/7zip/UI/Common/PropIDUtils.cpp | 90 + CPP/7zip/UI/Common/PropIDUtils.h | 11 + CPP/7zip/UI/Common/Property.h | 14 + CPP/7zip/UI/Common/SetProperties.cpp | 65 + CPP/7zip/UI/Common/SetProperties.h | 10 + CPP/7zip/UI/Common/SortUtils.cpp | 78 + CPP/7zip/UI/Common/SortUtils.h | 11 + CPP/7zip/UI/Common/StdAfx.h | 9 + CPP/7zip/UI/Common/TempFiles.cpp | 22 + CPP/7zip/UI/Common/TempFiles.h | 16 + CPP/7zip/UI/Common/Update.cpp | 818 +++++++ CPP/7zip/UI/Common/Update.h | 158 ++ CPP/7zip/UI/Common/UpdateAction.cpp | 64 + CPP/7zip/UI/Common/UpdateAction.h | 57 + CPP/7zip/UI/Common/UpdateCallback.cpp | 258 +++ CPP/7zip/UI/Common/UpdateCallback.h | 70 + CPP/7zip/UI/Common/UpdatePair.cpp | 175 ++ CPP/7zip/UI/Common/UpdatePair.h | 24 + CPP/7zip/UI/Common/UpdateProduce.cpp | 63 + CPP/7zip/UI/Common/UpdateProduce.h | 31 + CPP/7zip/UI/Common/WorkDir.cpp | 64 + CPP/7zip/UI/Common/WorkDir.h | 10 + CPP/7zip/UI/Common/ZipRegistry.cpp | 420 ++++ CPP/7zip/UI/Common/ZipRegistry.h | 99 + CPP/7zip/UI/Console/Console.dsp | 667 ++++++ CPP/7zip/UI/Console/Console.dsw | 29 + CPP/7zip/UI/Console/ConsoleClose.cpp | 65 + CPP/7zip/UI/Console/ConsoleClose.h | 24 + CPP/7zip/UI/Console/ExtractCallbackConsole.cpp | 235 ++ CPP/7zip/UI/Console/ExtractCallbackConsole.h | 65 + CPP/7zip/UI/Console/List.cpp | 532 +++++ CPP/7zip/UI/Console/List.h | 13 + CPP/7zip/UI/Console/Main.cpp | 382 ++++ CPP/7zip/UI/Console/MainAr.cpp | 169 ++ CPP/7zip/UI/Console/OpenCallbackConsole.cpp | 58 + CPP/7zip/UI/Console/OpenCallbackConsole.h | 27 + CPP/7zip/UI/Console/PercentPrinter.cpp | 90 + CPP/7zip/UI/Console/PercentPrinter.h | 31 + CPP/7zip/UI/Console/StdAfx.cpp | 3 + CPP/7zip/UI/Console/StdAfx.h | 9 + CPP/7zip/UI/Console/UpdateCallbackConsole.cpp | 196 ++ CPP/7zip/UI/Console/UpdateCallbackConsole.h | 75 + CPP/7zip/UI/Console/UserInputUtils.cpp | 58 + CPP/7zip/UI/Console/UserInputUtils.h | 24 + CPP/7zip/UI/Console/afxres.h | 1 + CPP/7zip/UI/Console/makefile | 93 + CPP/7zip/UI/Console/resource.rc | 3 + CPP/7zip/UI/Explorer/7-zip.dll.manifest | 1 + CPP/7zip/UI/Explorer/ContextMenu.cpp | 682 ++++++ CPP/7zip/UI/Explorer/ContextMenu.h | 86 + CPP/7zip/UI/Explorer/ContextMenuFlags.h | 34 + CPP/7zip/UI/Explorer/DllExports.cpp | 315 +++ CPP/7zip/UI/Explorer/Explorer.def | 12 + CPP/7zip/UI/Explorer/Explorer.dsp | 818 +++++++ CPP/7zip/UI/Explorer/Explorer.dsw | 29 + CPP/7zip/UI/Explorer/FoldersPage/FoldersPage.cpp | 157 ++ CPP/7zip/UI/Explorer/FoldersPage/FoldersPage.h | 30 + CPP/7zip/UI/Explorer/FoldersPage/resource.h | 12 + CPP/7zip/UI/Explorer/FoldersPage/resource.rc | 36 + CPP/7zip/UI/Explorer/MyMessages.cpp | 58 + CPP/7zip/UI/Explorer/MyMessages.h | 30 + CPP/7zip/UI/Explorer/OptionsDialog.cpp | 71 + CPP/7zip/UI/Explorer/OptionsDialog.h | 23 + CPP/7zip/UI/Explorer/RegistryContextMenu.cpp | 128 ++ CPP/7zip/UI/Explorer/RegistryContextMenu.h | 13 + CPP/7zip/UI/Explorer/StdAfx.cpp | 3 + CPP/7zip/UI/Explorer/StdAfx.h | 26 + CPP/7zip/UI/Explorer/SystemPage/SystemPage.cpp | 212 ++ CPP/7zip/UI/Explorer/SystemPage/SystemPage.h | 25 + CPP/7zip/UI/Explorer/SystemPage/resource.h | 6 + CPP/7zip/UI/Explorer/SystemPage/resource.rc | 24 + CPP/7zip/UI/Explorer/makefile | 137 ++ CPP/7zip/UI/Explorer/resource.h | 31 + CPP/7zip/UI/Explorer/resource.rc | 38 + CPP/7zip/UI/Far/CLSIDConst.cpp | 8 + CPP/7zip/UI/Far/ExtractEngine.cpp | 168 ++ CPP/7zip/UI/Far/ExtractEngine.h | 68 + CPP/7zip/UI/Far/Far.def | 20 + CPP/7zip/UI/Far/Far.dsp | 561 +++++ CPP/7zip/UI/Far/Far.dsw | 29 + CPP/7zip/UI/Far/FarPlugin.h | 577 +++++ CPP/7zip/UI/Far/FarUtils.cpp | 416 ++++ CPP/7zip/UI/Far/FarUtils.h | 185 ++ CPP/7zip/UI/Far/Main.cpp | 622 ++++++ CPP/7zip/UI/Far/Messages.h | 152 ++ CPP/7zip/UI/Far/OverwriteDialog.cpp | 109 + CPP/7zip/UI/Far/OverwriteDialog.h | 33 + CPP/7zip/UI/Far/Plugin.cpp | 693 ++++++ CPP/7zip/UI/Far/Plugin.h | 99 + CPP/7zip/UI/Far/PluginCommon.cpp | 50 + CPP/7zip/UI/Far/PluginDelete.cpp | 169 ++ CPP/7zip/UI/Far/PluginRead.cpp | 278 +++ CPP/7zip/UI/Far/PluginWrite.cpp | 696 ++++++ CPP/7zip/UI/Far/ProgressBox.cpp | 103 + CPP/7zip/UI/Far/ProgressBox.h | 35 + CPP/7zip/UI/Far/StdAfx.cpp | 3 + CPP/7zip/UI/Far/StdAfx.h | 12 + CPP/7zip/UI/Far/UpdateCallback100.cpp | 54 + CPP/7zip/UI/Far/UpdateCallback100.h | 45 + CPP/7zip/UI/Far/makefile | 102 + CPP/7zip/UI/Far/resource.rc | 3 + CPP/7zip/UI/GUI/7zG.exe.manifest | 1 + CPP/7zip/UI/GUI/CompressDialog.cpp | 1373 ++++++++++++ CPP/7zip/UI/GUI/CompressDialog.h | 171 ++ CPP/7zip/UI/GUI/ExtractDialog.cpp | 371 ++++ CPP/7zip/UI/GUI/ExtractDialog.h | 77 + CPP/7zip/UI/GUI/ExtractGUI.cpp | 172 ++ CPP/7zip/UI/GUI/ExtractGUI.h | 20 + CPP/7zip/UI/GUI/FM.ico | Bin 0 -> 4846 bytes CPP/7zip/UI/GUI/GUI.cpp | 260 +++ CPP/7zip/UI/GUI/GUI.dsp | 904 ++++++++ CPP/7zip/UI/GUI/GUI.dsw | 29 + CPP/7zip/UI/GUI/OpenCallbackGUI.cpp | 65 + CPP/7zip/UI/GUI/OpenCallbackGUI.h | 35 + CPP/7zip/UI/GUI/StdAfx.cpp | 3 + CPP/7zip/UI/GUI/StdAfx.h | 13 + CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp | 167 ++ CPP/7zip/UI/GUI/UpdateCallbackGUI.h | 63 + CPP/7zip/UI/GUI/UpdateGUI.cpp | 397 ++++ CPP/7zip/UI/GUI/UpdateGUI.h | 20 + CPP/7zip/UI/GUI/makefile | 135 ++ CPP/7zip/UI/GUI/resource.h | 45 + CPP/7zip/UI/GUI/resource.rc | 57 + CPP/7zip/UI/Resource/CompressDialog/resource.h | 40 + CPP/7zip/UI/Resource/CompressDialog/resource.rc | 117 + CPP/7zip/UI/Resource/Extract/resource.h | 15 + CPP/7zip/UI/Resource/Extract/resource.rc | 19 + CPP/7zip/UI/Resource/ExtractDialog/resource.h | 26 + CPP/7zip/UI/Resource/ExtractDialog/resource.rc | 80 + CPP/7zip/UI/makefile | 10 + CPP/7zip/makefile | 16 + CPP/Build.mak | 62 + CPP/Common/AlignedBuffer.cpp | 22 + CPP/Common/AlignedBuffer.h | 18 + CPP/Common/Alloc.cpp | 133 ++ CPP/Common/Alloc.h | 29 + CPP/Common/AutoPtr.h | 35 + CPP/Common/Buffer.h | 77 + CPP/Common/CRC.cpp | 61 + CPP/Common/CRC.h | 36 + CPP/Common/C_FileIO.cpp | 78 + CPP/Common/C_FileIO.h | 45 + CPP/Common/ComTry.h | 17 + CPP/Common/CommandLineParser.cpp | 232 ++ CPP/Common/CommandLineParser.h | 72 + CPP/Common/Defs.h | 20 + CPP/Common/DynamicBuffer.h | 47 + CPP/Common/Exception.h | 13 + CPP/Common/IntToString.cpp | 63 + CPP/Common/IntToString.h | 15 + CPP/Common/Lang.cpp | 142 ++ CPP/Common/Lang.h | 28 + CPP/Common/ListFileUtils.cpp | 60 + CPP/Common/ListFileUtils.h | 12 + CPP/Common/MyCom.h | 203 ++ CPP/Common/MyGuidDef.h | 54 + CPP/Common/MyInitGuid.h | 13 + CPP/Common/MyUnknown.h | 24 + CPP/Common/MyWindows.cpp | 113 + CPP/Common/MyWindows.h | 203 ++ CPP/Common/NewHandler.cpp | 116 + CPP/Common/NewHandler.h | 16 + CPP/Common/Random.cpp | 17 + CPP/Common/Random.h | 16 + CPP/Common/StdAfx.h | 9 + CPP/Common/StdInStream.cpp | 84 + CPP/Common/StdInStream.h | 31 + CPP/Common/StdOutStream.cpp | 93 + CPP/Common/StdOutStream.h | 35 + CPP/Common/String.cpp | 198 ++ CPP/Common/String.h | 631 ++++++ CPP/Common/StringConvert.cpp | 94 + CPP/Common/StringConvert.h | 71 + CPP/Common/StringToInt.cpp | 68 + CPP/Common/StringToInt.h | 17 + CPP/Common/TextConfig.cpp | 138 ++ CPP/Common/TextConfig.h | 22 + CPP/Common/Types.h | 57 + CPP/Common/UTFConvert.cpp | 91 + CPP/Common/UTFConvert.h | 11 + CPP/Common/Vector.cpp | 83 + CPP/Common/Vector.h | 237 ++ CPP/Common/Wildcard.cpp | 462 ++++ CPP/Common/Wildcard.h | 78 + CPP/Windows/COM.cpp | 37 + CPP/Windows/COM.h | 57 + CPP/Windows/CommonDialog.cpp | 164 ++ CPP/Windows/CommonDialog.h | 17 + CPP/Windows/Console.cpp | 10 + CPP/Windows/Console.h | 52 + CPP/Windows/Control/ComboBox.cpp | 63 + CPP/Windows/Control/ComboBox.h | 54 + CPP/Windows/Control/Dialog.cpp | 145 ++ CPP/Windows/Control/Dialog.h | 144 ++ CPP/Windows/Control/Edit.h | 21 + CPP/Windows/Control/ImageList.cpp | 11 + CPP/Windows/Control/ImageList.h | 86 + CPP/Windows/Control/ListView.cpp | 58 + CPP/Windows/Control/ListView.h | 138 ++ CPP/Windows/Control/ProgressBar.h | 41 + CPP/Windows/Control/PropertyPage.cpp | 163 ++ CPP/Windows/Control/PropertyPage.h | 47 + CPP/Windows/Control/ReBar.h | 35 + CPP/Windows/Control/Static.h | 27 + CPP/Windows/Control/StatusBar.h | 43 + CPP/Windows/Control/StdAfx.h | 9 + CPP/Windows/Control/ToolBar.h | 34 + CPP/Windows/Control/Trackbar.h | 28 + CPP/Windows/Control/Window2.cpp | 203 ++ CPP/Windows/Control/Window2.h | 59 + CPP/Windows/DLL.cpp | 115 + CPP/Windows/DLL.h | 54 + CPP/Windows/Defs.h | 21 + CPP/Windows/Error.cpp | 50 + CPP/Windows/Error.h | 33 + CPP/Windows/FileDevice.cpp | 49 + CPP/Windows/FileDevice.h | 123 ++ CPP/Windows/FileDir.cpp | 835 +++++++ CPP/Windows/FileDir.h | 178 ++ CPP/Windows/FileFind.cpp | 408 ++++ CPP/Windows/FileFind.h | 153 ++ CPP/Windows/FileIO.cpp | 305 +++ CPP/Windows/FileIO.h | 97 + CPP/Windows/FileMapping.cpp | 14 + CPP/Windows/FileMapping.h | 50 + CPP/Windows/FileName.cpp | 111 + CPP/Windows/FileName.h | 43 + CPP/Windows/FileSystem.cpp | 126 ++ CPP/Windows/FileSystem.h | 51 + CPP/Windows/Handle.h | 37 + CPP/Windows/Memory.cpp | 64 + CPP/Windows/Memory.h | 45 + CPP/Windows/MemoryLock.cpp | 78 + CPP/Windows/MemoryLock.h | 13 + CPP/Windows/Menu.cpp | 178 ++ CPP/Windows/Menu.h | 137 ++ CPP/Windows/NationalTime.cpp | 37 + CPP/Windows/NationalTime.h | 20 + CPP/Windows/Net.cpp | 380 ++++ CPP/Windows/Net.h | 87 + CPP/Windows/ProcessMessages.cpp | 22 + CPP/Windows/ProcessMessages.h | 14 + CPP/Windows/PropVariant.cpp | 312 +++ CPP/Windows/PropVariant.h | 57 + CPP/Windows/PropVariantConversions.cpp | 150 ++ CPP/Windows/PropVariantConversions.h | 14 + CPP/Windows/Registry.cpp | 324 +++ CPP/Windows/Registry.h | 77 + CPP/Windows/ResourceString.cpp | 53 + CPP/Windows/ResourceString.h | 20 + CPP/Windows/Security.cpp | 181 ++ CPP/Windows/Security.h | 168 ++ CPP/Windows/Shell.cpp | 292 +++ CPP/Windows/Shell.h | 92 + CPP/Windows/StdAfx.h | 9 + CPP/Windows/Synchronization.cpp | 17 + CPP/Windows/Synchronization.h | 133 ++ CPP/Windows/System.h | 21 + CPP/Windows/Thread.h | 51 + CPP/Windows/Time.h | 66 + CPP/Windows/Window.cpp | 169 ++ CPP/Windows/Window.h | 219 ++ Common/AlignedBuffer.cpp | 22 - Common/AlignedBuffer.h | 18 - Common/Alloc.cpp | 133 -- Common/Alloc.h | 29 - Common/AutoPtr.h | 35 - Common/Buffer.h | 77 - Common/CRC.cpp | 61 - Common/CRC.h | 36 - Common/C_FileIO.cpp | 78 - Common/C_FileIO.h | 45 - Common/ComTry.h | 17 - Common/CommandLineParser.cpp | 232 -- Common/CommandLineParser.h | 72 - Common/Defs.h | 20 - Common/DynamicBuffer.h | 47 - Common/Exception.h | 13 - Common/IntToString.cpp | 63 - Common/IntToString.h | 15 - Common/Lang.cpp | 144 -- Common/Lang.h | 28 - Common/ListFileUtils.cpp | 60 - Common/ListFileUtils.h | 12 - Common/MyCom.h | 203 -- Common/MyGuidDef.h | 54 - Common/MyInitGuid.h | 13 - Common/MyUnknown.h | 24 - Common/MyWindows.cpp | 113 - Common/MyWindows.h | 200 -- Common/NewHandler.cpp | 116 - Common/NewHandler.h | 16 - Common/Random.cpp | 17 - Common/Random.h | 16 - Common/StdAfx.h | 9 - Common/StdInStream.cpp | 84 - Common/StdInStream.h | 31 - Common/StdOutStream.cpp | 93 - Common/StdOutStream.h | 35 - Common/String.cpp | 198 -- Common/String.h | 631 ------ Common/StringConvert.cpp | 93 - Common/StringConvert.h | 71 - Common/StringToInt.cpp | 68 - Common/StringToInt.h | 17 - Common/TextConfig.cpp | 138 -- Common/TextConfig.h | 22 - Common/Types.h | 57 - Common/UTFConvert.cpp | 91 - Common/UTFConvert.h | 11 - Common/Vector.cpp | 83 - Common/Vector.h | 229 -- Common/Wildcard.cpp | 462 ---- Common/Wildcard.h | 78 - DOC/7zip.nsi | 8 +- DOC/7zip.wxs | 7 +- DOC/License.txt | 79 + DOC/lzma.txt | 74 +- DOC/readme.txt | 76 +- Windows/COM.cpp | 37 - Windows/COM.h | 57 - Windows/CommonDialog.cpp | 164 -- Windows/CommonDialog.h | 17 - Windows/Console.cpp | 10 - Windows/Console.h | 52 - Windows/Control/ComboBox.cpp | 63 - Windows/Control/ComboBox.h | 54 - Windows/Control/Dialog.cpp | 145 -- Windows/Control/Dialog.h | 144 -- Windows/Control/Edit.h | 21 - Windows/Control/ImageList.cpp | 11 - Windows/Control/ImageList.h | 86 - Windows/Control/ListView.cpp | 58 - Windows/Control/ListView.h | 138 -- Windows/Control/ProgressBar.h | 41 - Windows/Control/PropertyPage.cpp | 163 -- Windows/Control/PropertyPage.h | 47 - Windows/Control/ReBar.h | 35 - Windows/Control/Static.h | 27 - Windows/Control/StatusBar.h | 43 - Windows/Control/StdAfx.h | 9 - Windows/Control/ToolBar.h | 34 - Windows/Control/Trackbar.h | 28 - Windows/Control/Window2.cpp | 203 -- Windows/Control/Window2.h | 59 - Windows/DLL.cpp | 115 - Windows/DLL.h | 54 - Windows/Defs.h | 21 - Windows/Error.cpp | 50 - Windows/Error.h | 33 - Windows/FileDevice.cpp | 49 - Windows/FileDevice.h | 123 -- Windows/FileDir.cpp | 693 ------ Windows/FileDir.h | 191 -- Windows/FileFind.cpp | 368 ---- Windows/FileFind.h | 176 -- Windows/FileIO.cpp | 245 --- Windows/FileIO.h | 98 - Windows/FileMapping.cpp | 14 - Windows/FileMapping.h | 50 - Windows/FileName.cpp | 111 - Windows/FileName.h | 43 - Windows/FileSystem.cpp | 126 -- Windows/FileSystem.h | 51 - Windows/Handle.h | 37 - Windows/Memory.cpp | 64 - Windows/Memory.h | 45 - Windows/MemoryLock.cpp | 78 - Windows/MemoryLock.h | 13 - Windows/Menu.cpp | 178 -- Windows/Menu.h | 137 -- Windows/NationalTime.cpp | 37 - Windows/NationalTime.h | 20 - Windows/Net.cpp | 380 ---- Windows/Net.h | 87 - Windows/ProcessMessages.cpp | 22 - Windows/ProcessMessages.h | 14 - Windows/PropVariant.cpp | 310 --- Windows/PropVariant.h | 57 - Windows/PropVariantConversions.cpp | 150 -- Windows/PropVariantConversions.h | 14 - Windows/Registry.cpp | 324 --- Windows/Registry.h | 77 - Windows/ResourceString.cpp | 53 - Windows/ResourceString.h | 20 - Windows/Security.cpp | 181 -- Windows/Security.h | 168 -- Windows/Shell.cpp | 292 --- Windows/Shell.h | 92 - Windows/StdAfx.h | 9 - Windows/Synchronization.cpp | 17 - Windows/Synchronization.h | 133 -- Windows/System.h | 21 - Windows/Thread.h | 52 - Windows/Time.h | 66 - Windows/Window.cpp | 169 -- Windows/Window.h | 219 -- 2506 files changed, 157412 insertions(+), 160668 deletions(-) delete mode 100755 7zip/Archive/7z/7z.dsp delete mode 100755 7zip/Archive/7z/7z.dsw delete mode 100755 7zip/Archive/7z/7z.ico delete mode 100755 7zip/Archive/7z/7zCompressionMode.cpp delete mode 100755 7zip/Archive/7z/7zCompressionMode.h delete mode 100755 7zip/Archive/7z/7zDecode.cpp delete mode 100755 7zip/Archive/7z/7zDecode.h delete mode 100755 7zip/Archive/7z/7zEncode.cpp delete mode 100755 7zip/Archive/7z/7zEncode.h delete mode 100755 7zip/Archive/7z/7zExtract.cpp delete mode 100755 7zip/Archive/7z/7zFolderInStream.cpp delete mode 100755 7zip/Archive/7z/7zFolderInStream.h delete mode 100755 7zip/Archive/7z/7zFolderOutStream.cpp delete mode 100755 7zip/Archive/7z/7zFolderOutStream.h delete mode 100755 7zip/Archive/7z/7zHandler.cpp delete mode 100755 7zip/Archive/7z/7zHandler.h delete mode 100755 7zip/Archive/7z/7zHandlerOut.cpp delete mode 100755 7zip/Archive/7z/7zHeader.cpp delete mode 100755 7zip/Archive/7z/7zHeader.h delete mode 100755 7zip/Archive/7z/7zIn.cpp delete mode 100755 7zip/Archive/7z/7zIn.h delete mode 100755 7zip/Archive/7z/7zItem.h delete mode 100755 7zip/Archive/7z/7zMethodID.cpp delete mode 100755 7zip/Archive/7z/7zMethodID.h delete mode 100755 7zip/Archive/7z/7zMethods.cpp delete mode 100755 7zip/Archive/7z/7zMethods.h delete mode 100755 7zip/Archive/7z/7zOut.cpp delete mode 100755 7zip/Archive/7z/7zOut.h delete mode 100755 7zip/Archive/7z/7zProperties.cpp delete mode 100755 7zip/Archive/7z/7zProperties.h delete mode 100755 7zip/Archive/7z/7zSpecStream.cpp delete mode 100755 7zip/Archive/7z/7zSpecStream.h delete mode 100755 7zip/Archive/7z/7zUpdate.cpp delete mode 100755 7zip/Archive/7z/7zUpdate.h delete mode 100755 7zip/Archive/7z/DllExports.cpp delete mode 100755 7zip/Archive/7z/StdAfx.cpp delete mode 100755 7zip/Archive/7z/StdAfx.h delete mode 100755 7zip/Archive/7z/makefile delete mode 100755 7zip/Archive/7z/resource.rc delete mode 100755 7zip/Archive/7z_C/7zAlloc.c delete mode 100755 7zip/Archive/7z_C/7zAlloc.h delete mode 100755 7zip/Archive/7z_C/7zBuffer.c delete mode 100755 7zip/Archive/7z_C/7zBuffer.h delete mode 100755 7zip/Archive/7z_C/7zCrc.c delete mode 100755 7zip/Archive/7z_C/7zCrc.h delete mode 100755 7zip/Archive/7z_C/7zDecode.c delete mode 100755 7zip/Archive/7z_C/7zDecode.h delete mode 100755 7zip/Archive/7z_C/7zExtract.c delete mode 100755 7zip/Archive/7z_C/7zExtract.h delete mode 100755 7zip/Archive/7z_C/7zHeader.c delete mode 100755 7zip/Archive/7z_C/7zHeader.h delete mode 100755 7zip/Archive/7z_C/7zIn.c delete mode 100755 7zip/Archive/7z_C/7zIn.h delete mode 100755 7zip/Archive/7z_C/7zItem.c delete mode 100755 7zip/Archive/7z_C/7zItem.h delete mode 100755 7zip/Archive/7z_C/7zMain.c delete mode 100755 7zip/Archive/7z_C/7zMethodID.c delete mode 100755 7zip/Archive/7z_C/7zMethodID.h delete mode 100755 7zip/Archive/7z_C/7zTypes.h delete mode 100755 7zip/Archive/7z_C/7z_C.dsp delete mode 100755 7zip/Archive/7z_C/7z_C.dsw delete mode 100755 7zip/Archive/7z_C/makefile delete mode 100755 7zip/Archive/7z_C/makefile.gcc delete mode 100755 7zip/Archive/Archive.def delete mode 100755 7zip/Archive/Arj/Arj.dsp delete mode 100755 7zip/Archive/Arj/Arj.dsw delete mode 100755 7zip/Archive/Arj/ArjHandler.cpp delete mode 100755 7zip/Archive/Arj/ArjHandler.h delete mode 100755 7zip/Archive/Arj/ArjHeader.h delete mode 100755 7zip/Archive/Arj/ArjIn.cpp delete mode 100755 7zip/Archive/Arj/ArjIn.h delete mode 100755 7zip/Archive/Arj/ArjItem.h delete mode 100755 7zip/Archive/Arj/DllExports.cpp delete mode 100755 7zip/Archive/Arj/StdAfx.cpp delete mode 100755 7zip/Archive/Arj/StdAfx.h delete mode 100755 7zip/Archive/Arj/arj.ico delete mode 100755 7zip/Archive/Arj/makefile delete mode 100755 7zip/Archive/Arj/resource.rc delete mode 100755 7zip/Archive/BZip2/BZip2.dsp delete mode 100755 7zip/Archive/BZip2/BZip2.dsw delete mode 100755 7zip/Archive/BZip2/BZip2Handler.cpp delete mode 100755 7zip/Archive/BZip2/BZip2Handler.h delete mode 100755 7zip/Archive/BZip2/BZip2HandlerOut.cpp delete mode 100755 7zip/Archive/BZip2/BZip2Item.h delete mode 100755 7zip/Archive/BZip2/BZip2Update.cpp delete mode 100755 7zip/Archive/BZip2/BZip2Update.h delete mode 100755 7zip/Archive/BZip2/DllExports.cpp delete mode 100755 7zip/Archive/BZip2/StdAfx.cpp delete mode 100755 7zip/Archive/BZip2/StdAfx.h delete mode 100755 7zip/Archive/BZip2/bz2.ico delete mode 100755 7zip/Archive/BZip2/makefile delete mode 100755 7zip/Archive/BZip2/resource.rc delete mode 100755 7zip/Archive/Cab/Cab.dsp delete mode 100755 7zip/Archive/Cab/Cab.dsw delete mode 100755 7zip/Archive/Cab/CabBlockInStream.cpp delete mode 100755 7zip/Archive/Cab/CabBlockInStream.h delete mode 100755 7zip/Archive/Cab/CabHandler.cpp delete mode 100755 7zip/Archive/Cab/CabHandler.h delete mode 100755 7zip/Archive/Cab/CabHeader.cpp delete mode 100755 7zip/Archive/Cab/CabHeader.h delete mode 100755 7zip/Archive/Cab/CabIn.cpp delete mode 100755 7zip/Archive/Cab/CabIn.h delete mode 100755 7zip/Archive/Cab/CabItem.h delete mode 100755 7zip/Archive/Cab/DllExports.cpp delete mode 100755 7zip/Archive/Cab/StdAfx.cpp delete mode 100755 7zip/Archive/Cab/StdAfx.h delete mode 100755 7zip/Archive/Cab/cab.ico delete mode 100755 7zip/Archive/Cab/makefile delete mode 100755 7zip/Archive/Cab/resource.rc delete mode 100755 7zip/Archive/Chm/Chm.dsp delete mode 100755 7zip/Archive/Chm/Chm.dsw delete mode 100755 7zip/Archive/Chm/ChmHandler.cpp delete mode 100755 7zip/Archive/Chm/ChmHandler.h delete mode 100755 7zip/Archive/Chm/ChmHeader.cpp delete mode 100755 7zip/Archive/Chm/ChmHeader.h delete mode 100755 7zip/Archive/Chm/ChmIn.cpp delete mode 100755 7zip/Archive/Chm/ChmIn.h delete mode 100755 7zip/Archive/Chm/DllExports.cpp delete mode 100755 7zip/Archive/Chm/StdAfx.cpp delete mode 100755 7zip/Archive/Chm/StdAfx.h delete mode 100755 7zip/Archive/Chm/makefile delete mode 100755 7zip/Archive/Chm/resource.rc delete mode 100755 7zip/Archive/Common/CodecsPath.cpp delete mode 100755 7zip/Archive/Common/CodecsPath.h delete mode 100755 7zip/Archive/Common/CoderLoader.cpp delete mode 100755 7zip/Archive/Common/CoderLoader.h delete mode 100755 7zip/Archive/Common/CoderMixer2.cpp delete mode 100755 7zip/Archive/Common/CoderMixer2.h delete mode 100755 7zip/Archive/Common/CoderMixer2MT.cpp delete mode 100755 7zip/Archive/Common/CoderMixer2MT.h delete mode 100755 7zip/Archive/Common/CoderMixer2ST.cpp delete mode 100755 7zip/Archive/Common/CoderMixer2ST.h delete mode 100755 7zip/Archive/Common/CrossThreadProgress.cpp delete mode 100755 7zip/Archive/Common/CrossThreadProgress.h delete mode 100755 7zip/Archive/Common/DummyOutStream.cpp delete mode 100755 7zip/Archive/Common/DummyOutStream.h delete mode 100755 7zip/Archive/Common/FilterCoder.cpp delete mode 100755 7zip/Archive/Common/FilterCoder.h delete mode 100755 7zip/Archive/Common/InStreamWithCRC.cpp delete mode 100755 7zip/Archive/Common/InStreamWithCRC.h delete mode 100755 7zip/Archive/Common/ItemNameUtils.cpp delete mode 100755 7zip/Archive/Common/ItemNameUtils.h delete mode 100755 7zip/Archive/Common/MultiStream.cpp delete mode 100755 7zip/Archive/Common/MultiStream.h delete mode 100755 7zip/Archive/Common/OutStreamWithCRC.cpp delete mode 100755 7zip/Archive/Common/OutStreamWithCRC.h delete mode 100755 7zip/Archive/Common/ParseProperties.cpp delete mode 100755 7zip/Archive/Common/ParseProperties.h delete mode 100755 7zip/Archive/Common/StdAfx.h delete mode 100755 7zip/Archive/Cpio/makefile delete mode 100755 7zip/Archive/Deb/Deb.dsp delete mode 100755 7zip/Archive/Deb/Deb.dsw delete mode 100755 7zip/Archive/Deb/DebHandler.cpp delete mode 100755 7zip/Archive/Deb/DebHandler.h delete mode 100755 7zip/Archive/Deb/DebHeader.cpp delete mode 100755 7zip/Archive/Deb/DebHeader.h delete mode 100755 7zip/Archive/Deb/DebIn.cpp delete mode 100755 7zip/Archive/Deb/DebIn.h delete mode 100755 7zip/Archive/Deb/DebItem.h delete mode 100755 7zip/Archive/Deb/DllExports.cpp delete mode 100755 7zip/Archive/Deb/StdAfx.cpp delete mode 100755 7zip/Archive/Deb/StdAfx.h delete mode 100755 7zip/Archive/Deb/deb.ico delete mode 100755 7zip/Archive/Deb/makefile delete mode 100755 7zip/Archive/Deb/resource.rc delete mode 100755 7zip/Archive/GZip/DllExports.cpp delete mode 100755 7zip/Archive/GZip/GZip.dsp delete mode 100755 7zip/Archive/GZip/GZip.dsw delete mode 100755 7zip/Archive/GZip/GZipHandler.cpp delete mode 100755 7zip/Archive/GZip/GZipHandler.h delete mode 100755 7zip/Archive/GZip/GZipHandlerOut.cpp delete mode 100755 7zip/Archive/GZip/GZipHeader.cpp delete mode 100755 7zip/Archive/GZip/GZipHeader.h delete mode 100755 7zip/Archive/GZip/GZipIn.cpp delete mode 100755 7zip/Archive/GZip/GZipIn.h delete mode 100755 7zip/Archive/GZip/GZipItem.h delete mode 100755 7zip/Archive/GZip/GZipOut.cpp delete mode 100755 7zip/Archive/GZip/GZipOut.h delete mode 100755 7zip/Archive/GZip/GZipUpdate.cpp delete mode 100755 7zip/Archive/GZip/GZipUpdate.h delete mode 100755 7zip/Archive/GZip/StdAfx.cpp delete mode 100755 7zip/Archive/GZip/StdAfx.h delete mode 100755 7zip/Archive/GZip/gz.ico delete mode 100755 7zip/Archive/GZip/makefile delete mode 100755 7zip/Archive/GZip/resource.rc delete mode 100755 7zip/Archive/IArchive.h delete mode 100755 7zip/Archive/Iso/DllExports.cpp delete mode 100755 7zip/Archive/Iso/Iso.dsp delete mode 100755 7zip/Archive/Iso/Iso.dsw delete mode 100755 7zip/Archive/Iso/Iso.ico delete mode 100755 7zip/Archive/Iso/IsoHandler.cpp delete mode 100755 7zip/Archive/Iso/IsoHandler.h delete mode 100755 7zip/Archive/Iso/IsoHeader.cpp delete mode 100755 7zip/Archive/Iso/IsoHeader.h delete mode 100755 7zip/Archive/Iso/IsoIn.cpp delete mode 100755 7zip/Archive/Iso/IsoIn.h delete mode 100755 7zip/Archive/Iso/IsoItem.h delete mode 100755 7zip/Archive/Iso/StdAfx.cpp delete mode 100755 7zip/Archive/Iso/StdAfx.h delete mode 100755 7zip/Archive/Iso/makefile delete mode 100755 7zip/Archive/Iso/resource.rc delete mode 100755 7zip/Archive/Lzh/DllExports.cpp delete mode 100755 7zip/Archive/Lzh/Lzh.def delete mode 100755 7zip/Archive/Lzh/Lzh.dsp delete mode 100755 7zip/Archive/Lzh/Lzh.dsw delete mode 100755 7zip/Archive/Lzh/LzhCRC.cpp delete mode 100755 7zip/Archive/Lzh/LzhCRC.h delete mode 100755 7zip/Archive/Lzh/LzhHandler.cpp delete mode 100755 7zip/Archive/Lzh/LzhHandler.h delete mode 100755 7zip/Archive/Lzh/LzhHeader.h delete mode 100755 7zip/Archive/Lzh/LzhIn.cpp delete mode 100755 7zip/Archive/Lzh/LzhIn.h delete mode 100755 7zip/Archive/Lzh/LzhItem.h delete mode 100755 7zip/Archive/Lzh/LzhOutStreamWithCRC.cpp delete mode 100755 7zip/Archive/Lzh/LzhOutStreamWithCRC.h delete mode 100755 7zip/Archive/Lzh/StdAfx.cpp delete mode 100755 7zip/Archive/Lzh/StdAfx.h delete mode 100755 7zip/Archive/Lzh/lzh.ico delete mode 100755 7zip/Archive/Lzh/makefile delete mode 100755 7zip/Archive/Lzh/resource.rc delete mode 100755 7zip/Archive/Nsis/DllExports.cpp delete mode 100755 7zip/Archive/Nsis/Nsis.dsp delete mode 100755 7zip/Archive/Nsis/Nsis.dsw delete mode 100755 7zip/Archive/Nsis/NsisDecode.cpp delete mode 100755 7zip/Archive/Nsis/NsisDecode.h delete mode 100755 7zip/Archive/Nsis/NsisHandler.cpp delete mode 100755 7zip/Archive/Nsis/NsisHandler.h delete mode 100755 7zip/Archive/Nsis/NsisIn.cpp delete mode 100755 7zip/Archive/Nsis/NsisIn.h delete mode 100755 7zip/Archive/Nsis/StdAfx.cpp delete mode 100755 7zip/Archive/Nsis/StdAfx.h delete mode 100755 7zip/Archive/Nsis/makefile delete mode 100755 7zip/Archive/Nsis/resource.rc delete mode 100755 7zip/Archive/RPM/DllExports.cpp delete mode 100755 7zip/Archive/RPM/Rpm.dsp delete mode 100755 7zip/Archive/RPM/Rpm.dsw delete mode 100755 7zip/Archive/RPM/RpmHandler.cpp delete mode 100755 7zip/Archive/RPM/RpmHandler.h delete mode 100755 7zip/Archive/RPM/RpmHeader.h delete mode 100755 7zip/Archive/RPM/RpmIn.cpp delete mode 100755 7zip/Archive/RPM/RpmIn.h delete mode 100755 7zip/Archive/RPM/StdAfx.cpp delete mode 100755 7zip/Archive/RPM/StdAfx.h delete mode 100755 7zip/Archive/RPM/makefile delete mode 100755 7zip/Archive/RPM/resource.rc delete mode 100755 7zip/Archive/RPM/rpm.ico delete mode 100755 7zip/Archive/Rar/DllExports.cpp delete mode 100755 7zip/Archive/Rar/Rar.dsp delete mode 100755 7zip/Archive/Rar/Rar.dsw delete mode 100755 7zip/Archive/Rar/RarHandler.cpp delete mode 100755 7zip/Archive/Rar/RarHandler.h delete mode 100755 7zip/Archive/Rar/RarHeader.cpp delete mode 100755 7zip/Archive/Rar/RarHeader.h delete mode 100755 7zip/Archive/Rar/RarIn.cpp delete mode 100755 7zip/Archive/Rar/RarIn.h delete mode 100755 7zip/Archive/Rar/RarItem.cpp delete mode 100755 7zip/Archive/Rar/RarItem.h delete mode 100755 7zip/Archive/Rar/RarVolumeInStream.cpp delete mode 100755 7zip/Archive/Rar/RarVolumeInStream.h delete mode 100755 7zip/Archive/Rar/StdAfx.cpp delete mode 100755 7zip/Archive/Rar/StdAfx.h delete mode 100755 7zip/Archive/Rar/makefile delete mode 100755 7zip/Archive/Rar/rar.ico delete mode 100755 7zip/Archive/Rar/resource.rc delete mode 100755 7zip/Archive/Split/DllExports.cpp delete mode 100755 7zip/Archive/Split/Split.dsp delete mode 100755 7zip/Archive/Split/Split.dsw delete mode 100755 7zip/Archive/Split/Split.ico delete mode 100755 7zip/Archive/Split/SplitHandler.cpp delete mode 100755 7zip/Archive/Split/SplitHandler.h delete mode 100755 7zip/Archive/Split/SplitHandlerOut.cpp delete mode 100755 7zip/Archive/Split/StdAfx.cpp delete mode 100755 7zip/Archive/Split/StdAfx.h delete mode 100755 7zip/Archive/Split/makefile delete mode 100755 7zip/Archive/Split/resource.rc delete mode 100755 7zip/Archive/Tar/DllExports.cpp delete mode 100755 7zip/Archive/Tar/StdAfx.cpp delete mode 100755 7zip/Archive/Tar/StdAfx.h delete mode 100755 7zip/Archive/Tar/Tar.dsp delete mode 100755 7zip/Archive/Tar/Tar.dsw delete mode 100755 7zip/Archive/Tar/TarHandler.cpp delete mode 100755 7zip/Archive/Tar/TarHandler.h delete mode 100755 7zip/Archive/Tar/TarHandlerOut.cpp delete mode 100755 7zip/Archive/Tar/TarHeader.cpp delete mode 100755 7zip/Archive/Tar/TarHeader.h delete mode 100755 7zip/Archive/Tar/TarIn.cpp delete mode 100755 7zip/Archive/Tar/TarIn.h delete mode 100755 7zip/Archive/Tar/TarItem.h delete mode 100755 7zip/Archive/Tar/TarOut.cpp delete mode 100755 7zip/Archive/Tar/TarOut.h delete mode 100755 7zip/Archive/Tar/TarUpdate.cpp delete mode 100755 7zip/Archive/Tar/TarUpdate.h delete mode 100755 7zip/Archive/Tar/makefile delete mode 100755 7zip/Archive/Tar/resource.rc delete mode 100755 7zip/Archive/Tar/tar.ico delete mode 100755 7zip/Archive/Z/DllExports.cpp delete mode 100755 7zip/Archive/Z/StdAfx.cpp delete mode 100755 7zip/Archive/Z/StdAfx.h delete mode 100755 7zip/Archive/Z/Z.dsp delete mode 100755 7zip/Archive/Z/Z.dsw delete mode 100755 7zip/Archive/Z/Z.ico delete mode 100755 7zip/Archive/Z/ZHandler.cpp delete mode 100755 7zip/Archive/Z/ZHandler.h delete mode 100755 7zip/Archive/Z/makefile delete mode 100755 7zip/Archive/Z/resource.rc delete mode 100755 7zip/Archive/Zip/DllExports.cpp delete mode 100755 7zip/Archive/Zip/StdAfx.cpp delete mode 100755 7zip/Archive/Zip/StdAfx.h delete mode 100755 7zip/Archive/Zip/Zip.dsp delete mode 100755 7zip/Archive/Zip/Zip.dsw delete mode 100755 7zip/Archive/Zip/ZipAddCommon.cpp delete mode 100755 7zip/Archive/Zip/ZipAddCommon.h delete mode 100755 7zip/Archive/Zip/ZipCompressionMode.h delete mode 100755 7zip/Archive/Zip/ZipHandler.cpp delete mode 100755 7zip/Archive/Zip/ZipHandler.h delete mode 100755 7zip/Archive/Zip/ZipHandlerOut.cpp delete mode 100755 7zip/Archive/Zip/ZipHeader.cpp delete mode 100755 7zip/Archive/Zip/ZipHeader.h delete mode 100755 7zip/Archive/Zip/ZipIn.cpp delete mode 100755 7zip/Archive/Zip/ZipIn.h delete mode 100755 7zip/Archive/Zip/ZipItem.cpp delete mode 100755 7zip/Archive/Zip/ZipItem.h delete mode 100755 7zip/Archive/Zip/ZipItemEx.h delete mode 100755 7zip/Archive/Zip/ZipOut.cpp delete mode 100755 7zip/Archive/Zip/ZipOut.h delete mode 100755 7zip/Archive/Zip/ZipUpdate.cpp delete mode 100755 7zip/Archive/Zip/ZipUpdate.h delete mode 100755 7zip/Archive/Zip/makefile delete mode 100755 7zip/Archive/Zip/resource.rc delete mode 100755 7zip/Archive/Zip/zip.ico delete mode 100755 7zip/Archive/cpio/CpioHandler.cpp delete mode 100755 7zip/Archive/cpio/CpioHandler.h delete mode 100755 7zip/Archive/cpio/CpioHeader.cpp delete mode 100755 7zip/Archive/cpio/CpioHeader.h delete mode 100755 7zip/Archive/cpio/CpioIn.cpp delete mode 100755 7zip/Archive/cpio/CpioIn.h delete mode 100755 7zip/Archive/cpio/CpioItem.h delete mode 100755 7zip/Archive/cpio/DllExports.cpp delete mode 100755 7zip/Archive/cpio/StdAfx.cpp delete mode 100755 7zip/Archive/cpio/StdAfx.h delete mode 100755 7zip/Archive/cpio/cpio.dsp delete mode 100755 7zip/Archive/cpio/cpio.dsw delete mode 100755 7zip/Archive/cpio/cpio.ico delete mode 100755 7zip/Archive/cpio/resource.rc delete mode 100755 7zip/Archive/makefile delete mode 100755 7zip/Bundles/Alone/Alone.dsp delete mode 100755 7zip/Bundles/Alone/Alone.dsw delete mode 100755 7zip/Bundles/Alone/StdAfx.cpp delete mode 100755 7zip/Bundles/Alone/StdAfx.h delete mode 100755 7zip/Bundles/Alone/afxres.h delete mode 100755 7zip/Bundles/Alone/makefile delete mode 100755 7zip/Bundles/Alone/resource.rc delete mode 100755 7zip/Bundles/Alone7z/Alone.dsp delete mode 100755 7zip/Bundles/Alone7z/Alone.dsw delete mode 100755 7zip/Bundles/Alone7z/StdAfx.cpp delete mode 100755 7zip/Bundles/Alone7z/StdAfx.h delete mode 100755 7zip/Bundles/Alone7z/makefile delete mode 100755 7zip/Bundles/Alone7z/resource.rc delete mode 100755 7zip/Bundles/Format7z/Format7z.dsp delete mode 100755 7zip/Bundles/Format7z/Format7z.dsw delete mode 100755 7zip/Bundles/Format7z/StdAfx.cpp delete mode 100755 7zip/Bundles/Format7z/StdAfx.h delete mode 100755 7zip/Bundles/Format7z/makefile delete mode 100755 7zip/Bundles/Format7z/resource.rc delete mode 100755 7zip/Bundles/Format7zExtract/Format7z.dsp delete mode 100755 7zip/Bundles/Format7zExtract/Format7z.dsw delete mode 100755 7zip/Bundles/Format7zExtract/StdAfx.cpp delete mode 100755 7zip/Bundles/Format7zExtract/StdAfx.h delete mode 100755 7zip/Bundles/Format7zExtract/makefile delete mode 100755 7zip/Bundles/Format7zExtract/resource.rc delete mode 100755 7zip/Bundles/SFXCon/7z.ico delete mode 100755 7zip/Bundles/SFXCon/Main.cpp delete mode 100755 7zip/Bundles/SFXCon/SFXCon.dsp delete mode 100755 7zip/Bundles/SFXCon/SFXCon.dsw delete mode 100755 7zip/Bundles/SFXCon/StdAfx.cpp delete mode 100755 7zip/Bundles/SFXCon/StdAfx.h delete mode 100755 7zip/Bundles/SFXCon/makefile delete mode 100755 7zip/Bundles/SFXCon/resource.rc delete mode 100755 7zip/Bundles/SFXSetup/ExtractCallback.cpp delete mode 100755 7zip/Bundles/SFXSetup/ExtractCallback.h delete mode 100755 7zip/Bundles/SFXSetup/ExtractEngine.cpp delete mode 100755 7zip/Bundles/SFXSetup/ExtractEngine.h delete mode 100755 7zip/Bundles/SFXSetup/Main.cpp delete mode 100755 7zip/Bundles/SFXSetup/SFXSetup.dsp delete mode 100755 7zip/Bundles/SFXSetup/SFXSetup.dsw delete mode 100755 7zip/Bundles/SFXSetup/StdAfx.cpp delete mode 100755 7zip/Bundles/SFXSetup/StdAfx.h delete mode 100755 7zip/Bundles/SFXSetup/makefile delete mode 100755 7zip/Bundles/SFXSetup/resource.h delete mode 100755 7zip/Bundles/SFXSetup/resource.rc delete mode 100755 7zip/Bundles/SFXSetup/setup.ico delete mode 100755 7zip/Bundles/SFXWin/7z.ico delete mode 100755 7zip/Bundles/SFXWin/Main.cpp delete mode 100755 7zip/Bundles/SFXWin/SFXWin.dsp delete mode 100755 7zip/Bundles/SFXWin/SFXWin.dsw delete mode 100755 7zip/Bundles/SFXWin/StdAfx.cpp delete mode 100755 7zip/Bundles/SFXWin/StdAfx.h delete mode 100755 7zip/Bundles/SFXWin/makefile delete mode 100755 7zip/Bundles/SFXWin/resource.h delete mode 100755 7zip/Bundles/SFXWin/resource.rc delete mode 100755 7zip/Bundles/makefile delete mode 100755 7zip/Common/FilePathAutoRename.cpp delete mode 100755 7zip/Common/FilePathAutoRename.h delete mode 100755 7zip/Common/FileStreams.cpp delete mode 100755 7zip/Common/FileStreams.h delete mode 100755 7zip/Common/InBuffer.cpp delete mode 100755 7zip/Common/InBuffer.h delete mode 100755 7zip/Common/InMemStream.cpp delete mode 100755 7zip/Common/InMemStream.h delete mode 100755 7zip/Common/InOutTempBuffer.cpp delete mode 100755 7zip/Common/InOutTempBuffer.h delete mode 100755 7zip/Common/LSBFDecoder.cpp delete mode 100755 7zip/Common/LSBFDecoder.h delete mode 100755 7zip/Common/LSBFEncoder.cpp delete mode 100755 7zip/Common/LSBFEncoder.h delete mode 100755 7zip/Common/LimitedStreams.cpp delete mode 100755 7zip/Common/LimitedStreams.h delete mode 100755 7zip/Common/LockedStream.cpp delete mode 100755 7zip/Common/LockedStream.h delete mode 100755 7zip/Common/MSBFDecoder.h delete mode 100755 7zip/Common/MSBFEncoder.h delete mode 100755 7zip/Common/MemBlocks.cpp delete mode 100755 7zip/Common/MemBlocks.h delete mode 100755 7zip/Common/OffsetStream.cpp delete mode 100755 7zip/Common/OffsetStream.h delete mode 100755 7zip/Common/OutBuffer.cpp delete mode 100755 7zip/Common/OutBuffer.h delete mode 100755 7zip/Common/OutMemStream.cpp delete mode 100755 7zip/Common/OutMemStream.h delete mode 100755 7zip/Common/ProgressMt.cpp delete mode 100755 7zip/Common/ProgressMt.h delete mode 100755 7zip/Common/ProgressUtils.cpp delete mode 100755 7zip/Common/ProgressUtils.h delete mode 100755 7zip/Common/StdAfx.h delete mode 100755 7zip/Common/StreamBinder.cpp delete mode 100755 7zip/Common/StreamBinder.h delete mode 100755 7zip/Common/StreamObjects.cpp delete mode 100755 7zip/Common/StreamObjects.h delete mode 100755 7zip/Common/StreamUtils.cpp delete mode 100755 7zip/Common/StreamUtils.h delete mode 100755 7zip/Compress/Arj/ArjDecoder1.cpp delete mode 100755 7zip/Compress/Arj/ArjDecoder1.h delete mode 100755 7zip/Compress/Arj/ArjDecoder2.cpp delete mode 100755 7zip/Compress/Arj/ArjDecoder2.h delete mode 100755 7zip/Compress/Arj/StdAfx.h delete mode 100755 7zip/Compress/BWT/BlockSort.cpp delete mode 100755 7zip/Compress/BWT/BlockSort.h delete mode 100755 7zip/Compress/BWT/Mtf8.h delete mode 100755 7zip/Compress/BWT/StdAfx.h delete mode 100755 7zip/Compress/BZip2/BZip2.dsp delete mode 100755 7zip/Compress/BZip2/BZip2.dsw delete mode 100755 7zip/Compress/BZip2/BZip2CRC.cpp delete mode 100755 7zip/Compress/BZip2/BZip2CRC.h delete mode 100755 7zip/Compress/BZip2/BZip2Const.h delete mode 100755 7zip/Compress/BZip2/BZip2Decoder.cpp delete mode 100755 7zip/Compress/BZip2/BZip2Decoder.h delete mode 100755 7zip/Compress/BZip2/BZip2Encoder.cpp delete mode 100755 7zip/Compress/BZip2/BZip2Encoder.h delete mode 100755 7zip/Compress/BZip2/DllExports.cpp delete mode 100755 7zip/Compress/BZip2/StdAfx.cpp delete mode 100755 7zip/Compress/BZip2/StdAfx.h delete mode 100755 7zip/Compress/BZip2/makefile delete mode 100755 7zip/Compress/BZip2/resource.rc delete mode 100755 7zip/Compress/BZip2Original/BZip2Decoder.cpp delete mode 100755 7zip/Compress/BZip2Original/BZip2Decoder.h delete mode 100755 7zip/Compress/BZip2Original/BZip2Encoder.cpp delete mode 100755 7zip/Compress/BZip2Original/BZip2Encoder.h delete mode 100755 7zip/Compress/BZip2Original/BZip2Error.cpp delete mode 100755 7zip/Compress/BZip2Original/DllExports.cpp delete mode 100755 7zip/Compress/BZip2Original/StdAfx.cpp delete mode 100755 7zip/Compress/BZip2Original/StdAfx.h delete mode 100755 7zip/Compress/Branch/ARM.cpp delete mode 100755 7zip/Compress/Branch/ARM.h delete mode 100755 7zip/Compress/Branch/ARMThumb.cpp delete mode 100755 7zip/Compress/Branch/ARMThumb.h delete mode 100755 7zip/Compress/Branch/Branch.dsp delete mode 100755 7zip/Compress/Branch/Branch.dsw delete mode 100755 7zip/Compress/Branch/BranchARM.c delete mode 100755 7zip/Compress/Branch/BranchARM.h delete mode 100755 7zip/Compress/Branch/BranchARMThumb.c delete mode 100755 7zip/Compress/Branch/BranchARMThumb.h delete mode 100755 7zip/Compress/Branch/BranchCoder.cpp delete mode 100755 7zip/Compress/Branch/BranchCoder.h delete mode 100755 7zip/Compress/Branch/BranchIA64.c delete mode 100755 7zip/Compress/Branch/BranchIA64.h delete mode 100755 7zip/Compress/Branch/BranchPPC.c delete mode 100755 7zip/Compress/Branch/BranchPPC.h delete mode 100755 7zip/Compress/Branch/BranchSPARC.c delete mode 100755 7zip/Compress/Branch/BranchSPARC.h delete mode 100755 7zip/Compress/Branch/BranchTypes.h delete mode 100755 7zip/Compress/Branch/BranchX86.c delete mode 100755 7zip/Compress/Branch/BranchX86.h delete mode 100755 7zip/Compress/Branch/DllExports.cpp delete mode 100755 7zip/Compress/Branch/IA64.cpp delete mode 100755 7zip/Compress/Branch/IA64.h delete mode 100755 7zip/Compress/Branch/PPC.cpp delete mode 100755 7zip/Compress/Branch/PPC.h delete mode 100755 7zip/Compress/Branch/SPARC.cpp delete mode 100755 7zip/Compress/Branch/SPARC.h delete mode 100755 7zip/Compress/Branch/StdAfx.cpp delete mode 100755 7zip/Compress/Branch/StdAfx.h delete mode 100755 7zip/Compress/Branch/makefile delete mode 100755 7zip/Compress/Branch/resource.rc delete mode 100755 7zip/Compress/Branch/x86.cpp delete mode 100755 7zip/Compress/Branch/x86.h delete mode 100755 7zip/Compress/Branch/x86_2.cpp delete mode 100755 7zip/Compress/Branch/x86_2.h delete mode 100755 7zip/Compress/ByteSwap/ByteSwap.cpp delete mode 100755 7zip/Compress/ByteSwap/ByteSwap.dsp delete mode 100755 7zip/Compress/ByteSwap/ByteSwap.dsw delete mode 100755 7zip/Compress/ByteSwap/ByteSwap.h delete mode 100755 7zip/Compress/ByteSwap/DllExports.cpp delete mode 100755 7zip/Compress/ByteSwap/StdAfx.cpp delete mode 100755 7zip/Compress/ByteSwap/StdAfx.h delete mode 100755 7zip/Compress/ByteSwap/makefile delete mode 100755 7zip/Compress/ByteSwap/resource.rc delete mode 100755 7zip/Compress/Codec.def delete mode 100755 7zip/Compress/Copy/Copy.dsp delete mode 100755 7zip/Compress/Copy/Copy.dsw delete mode 100755 7zip/Compress/Copy/CopyCoder.cpp delete mode 100755 7zip/Compress/Copy/CopyCoder.h delete mode 100755 7zip/Compress/Copy/DllExports.cpp delete mode 100755 7zip/Compress/Copy/StdAfx.cpp delete mode 100755 7zip/Compress/Copy/StdAfx.h delete mode 100755 7zip/Compress/Copy/makefile delete mode 100755 7zip/Compress/Copy/resource.rc delete mode 100755 7zip/Compress/Deflate/Deflate.dsp delete mode 100755 7zip/Compress/Deflate/Deflate.dsw delete mode 100755 7zip/Compress/Deflate/DeflateConst.h delete mode 100755 7zip/Compress/Deflate/DeflateDecoder.cpp delete mode 100755 7zip/Compress/Deflate/DeflateDecoder.h delete mode 100755 7zip/Compress/Deflate/DeflateEncoder.cpp delete mode 100755 7zip/Compress/Deflate/DeflateEncoder.h delete mode 100755 7zip/Compress/Deflate/DllExports.cpp delete mode 100755 7zip/Compress/Deflate/StdAfx.cpp delete mode 100755 7zip/Compress/Deflate/StdAfx.h delete mode 100755 7zip/Compress/Deflate/makefile delete mode 100755 7zip/Compress/Deflate/resource.rc delete mode 100755 7zip/Compress/Huffman/HuffmanDecoder.h delete mode 100755 7zip/Compress/Huffman/HuffmanEncoder.cpp delete mode 100755 7zip/Compress/Huffman/HuffmanEncoder.h delete mode 100755 7zip/Compress/Huffman/StdAfx.h delete mode 100755 7zip/Compress/Implode/DllExports.cpp delete mode 100755 7zip/Compress/Implode/ImplodeDecoder.cpp delete mode 100755 7zip/Compress/Implode/ImplodeDecoder.h delete mode 100755 7zip/Compress/Implode/ImplodeHuffmanDecoder.cpp delete mode 100755 7zip/Compress/Implode/ImplodeHuffmanDecoder.h delete mode 100755 7zip/Compress/Implode/StdAfx.cpp delete mode 100755 7zip/Compress/Implode/StdAfx.h delete mode 100755 7zip/Compress/LZ/BinTree/BinTree.h delete mode 100755 7zip/Compress/LZ/BinTree/BinTree2.h delete mode 100755 7zip/Compress/LZ/BinTree/BinTree3.h delete mode 100755 7zip/Compress/LZ/BinTree/BinTree3Z.h delete mode 100755 7zip/Compress/LZ/BinTree/BinTree4.h delete mode 100755 7zip/Compress/LZ/BinTree/BinTreeMain.h delete mode 100755 7zip/Compress/LZ/HashChain/HC2.h delete mode 100755 7zip/Compress/LZ/HashChain/HC3.h delete mode 100755 7zip/Compress/LZ/HashChain/HC4.h delete mode 100755 7zip/Compress/LZ/HashChain/HCMain.h delete mode 100755 7zip/Compress/LZ/IMatchFinder.h delete mode 100755 7zip/Compress/LZ/LZInWindow.cpp delete mode 100755 7zip/Compress/LZ/LZInWindow.h delete mode 100755 7zip/Compress/LZ/LZOutWindow.cpp delete mode 100755 7zip/Compress/LZ/LZOutWindow.h delete mode 100755 7zip/Compress/LZ/MT/MT.cpp delete mode 100755 7zip/Compress/LZ/MT/MT.h delete mode 100755 7zip/Compress/LZ/MT/StdAfx.h delete mode 100755 7zip/Compress/LZ/StdAfx.h delete mode 100755 7zip/Compress/LZMA/DllExports.cpp delete mode 100755 7zip/Compress/LZMA/LZMA.dsp delete mode 100755 7zip/Compress/LZMA/LZMA.dsw delete mode 100755 7zip/Compress/LZMA/LZMA.h delete mode 100755 7zip/Compress/LZMA/LZMADecoder.cpp delete mode 100755 7zip/Compress/LZMA/LZMADecoder.h delete mode 100755 7zip/Compress/LZMA/LZMAEncoder.cpp delete mode 100755 7zip/Compress/LZMA/LZMAEncoder.h delete mode 100755 7zip/Compress/LZMA/StdAfx.cpp delete mode 100755 7zip/Compress/LZMA/StdAfx.h delete mode 100755 7zip/Compress/LZMA/makefile delete mode 100755 7zip/Compress/LZMA/resource.rc delete mode 100755 7zip/Compress/LZMA_Alone/AloneLZMA.dsp delete mode 100755 7zip/Compress/LZMA_Alone/AloneLZMA.dsw delete mode 100755 7zip/Compress/LZMA_Alone/LzmaAlone.cpp delete mode 100755 7zip/Compress/LZMA_Alone/LzmaBench.cpp delete mode 100755 7zip/Compress/LZMA_Alone/LzmaBench.h delete mode 100755 7zip/Compress/LZMA_Alone/LzmaRam.cpp delete mode 100755 7zip/Compress/LZMA_Alone/LzmaRam.h delete mode 100755 7zip/Compress/LZMA_Alone/LzmaRamDecode.c delete mode 100755 7zip/Compress/LZMA_Alone/LzmaRamDecode.h delete mode 100755 7zip/Compress/LZMA_Alone/StdAfx.cpp delete mode 100755 7zip/Compress/LZMA_Alone/StdAfx.h delete mode 100755 7zip/Compress/LZMA_Alone/makefile delete mode 100755 7zip/Compress/LZMA_Alone/makefile.gcc delete mode 100755 7zip/Compress/LZMA_C/LzmaDecode.c delete mode 100755 7zip/Compress/LZMA_C/LzmaDecode.h delete mode 100755 7zip/Compress/LZMA_C/LzmaDecodeSize.c delete mode 100755 7zip/Compress/LZMA_C/LzmaStateDecode.c delete mode 100755 7zip/Compress/LZMA_C/LzmaStateDecode.h delete mode 100755 7zip/Compress/LZMA_C/LzmaStateTest.c delete mode 100755 7zip/Compress/LZMA_C/LzmaTest.c delete mode 100755 7zip/Compress/LZMA_C/LzmaTypes.h delete mode 100755 7zip/Compress/Lzh/LzhDecoder.cpp delete mode 100755 7zip/Compress/Lzh/LzhDecoder.h delete mode 100755 7zip/Compress/Lzx/Lzx.h delete mode 100755 7zip/Compress/Lzx/Lzx86Converter.cpp delete mode 100755 7zip/Compress/Lzx/Lzx86Converter.h delete mode 100755 7zip/Compress/Lzx/LzxDecoder.cpp delete mode 100755 7zip/Compress/Lzx/LzxDecoder.h delete mode 100755 7zip/Compress/Lzx/StdAfx.h delete mode 100755 7zip/Compress/PPMD/DllExports.cpp delete mode 100755 7zip/Compress/PPMD/PPMD.dsp delete mode 100755 7zip/Compress/PPMD/PPMD.dsw delete mode 100755 7zip/Compress/PPMD/PPMDContext.h delete mode 100755 7zip/Compress/PPMD/PPMDDecode.h delete mode 100755 7zip/Compress/PPMD/PPMDDecoder.cpp delete mode 100755 7zip/Compress/PPMD/PPMDDecoder.h delete mode 100755 7zip/Compress/PPMD/PPMDEncode.h delete mode 100755 7zip/Compress/PPMD/PPMDEncoder.cpp delete mode 100755 7zip/Compress/PPMD/PPMDEncoder.h delete mode 100755 7zip/Compress/PPMD/PPMDSubAlloc.h delete mode 100755 7zip/Compress/PPMD/PPMDType.h delete mode 100755 7zip/Compress/PPMD/StdAfx.cpp delete mode 100755 7zip/Compress/PPMD/StdAfx.h delete mode 100755 7zip/Compress/PPMD/makefile delete mode 100755 7zip/Compress/PPMD/resource.rc delete mode 100755 7zip/Compress/Quantum/QuantumDecoder.cpp delete mode 100755 7zip/Compress/Quantum/QuantumDecoder.h delete mode 100755 7zip/Compress/RangeCoder/RangeCoder.h delete mode 100755 7zip/Compress/RangeCoder/RangeCoderBit.cpp delete mode 100755 7zip/Compress/RangeCoder/RangeCoderBit.h delete mode 100755 7zip/Compress/RangeCoder/RangeCoderBitTree.h delete mode 100755 7zip/Compress/RangeCoder/RangeCoderOpt.h delete mode 100755 7zip/Compress/RangeCoder/StdAfx.h delete mode 100755 7zip/Compress/Rar20/DllExports.cpp delete mode 100755 7zip/Compress/Rar20/Rar20Const.h delete mode 100755 7zip/Compress/Rar20/Rar20Decoder.cpp delete mode 100755 7zip/Compress/Rar20/Rar20Decoder.h delete mode 100755 7zip/Compress/Rar20/Rar20ExtConst.h delete mode 100755 7zip/Compress/Rar20/Rar20Multimedia.cpp delete mode 100755 7zip/Compress/Rar20/Rar20Multimedia.h delete mode 100755 7zip/Compress/Rar20/StdAfx.cpp delete mode 100755 7zip/Compress/Rar20/StdAfx.h delete mode 100755 7zip/Compress/Rar29/DllExports.cpp delete mode 100755 7zip/Compress/Rar29/Original/archive.hpp delete mode 100755 7zip/Compress/Rar29/Original/array.hpp delete mode 100755 7zip/Compress/Rar29/Original/cmddata.hpp delete mode 100755 7zip/Compress/Rar29/Original/coder.cpp delete mode 100755 7zip/Compress/Rar29/Original/coder.hpp delete mode 100755 7zip/Compress/Rar29/Original/compress.hpp delete mode 100755 7zip/Compress/Rar29/Original/consio.hpp delete mode 100755 7zip/Compress/Rar29/Original/crc.cpp delete mode 100755 7zip/Compress/Rar29/Original/crc.hpp delete mode 100755 7zip/Compress/Rar29/Original/crypt.hpp delete mode 100755 7zip/Compress/Rar29/Original/encname.hpp delete mode 100755 7zip/Compress/Rar29/Original/errhnd.cpp delete mode 100755 7zip/Compress/Rar29/Original/errhnd.hpp delete mode 100755 7zip/Compress/Rar29/Original/extinfo.hpp delete mode 100755 7zip/Compress/Rar29/Original/extract.hpp delete mode 100755 7zip/Compress/Rar29/Original/filcreat.hpp delete mode 100755 7zip/Compress/Rar29/Original/file.hpp delete mode 100755 7zip/Compress/Rar29/Original/filefn.hpp delete mode 100755 7zip/Compress/Rar29/Original/filestr.hpp delete mode 100755 7zip/Compress/Rar29/Original/find.hpp delete mode 100755 7zip/Compress/Rar29/Original/getbits.cpp delete mode 100755 7zip/Compress/Rar29/Original/getbits.hpp delete mode 100755 7zip/Compress/Rar29/Original/global.hpp delete mode 100755 7zip/Compress/Rar29/Original/headers.hpp delete mode 100755 7zip/Compress/Rar29/Original/int64.cpp delete mode 100755 7zip/Compress/Rar29/Original/int64.hpp delete mode 100755 7zip/Compress/Rar29/Original/isnt.hpp delete mode 100755 7zip/Compress/Rar29/Original/list.hpp delete mode 100755 7zip/Compress/Rar29/Original/loclang.hpp delete mode 100755 7zip/Compress/Rar29/Original/log.hpp delete mode 100755 7zip/Compress/Rar29/Original/match.hpp delete mode 100755 7zip/Compress/Rar29/Original/model.cpp delete mode 100755 7zip/Compress/Rar29/Original/model.hpp delete mode 100755 7zip/Compress/Rar29/Original/options.hpp delete mode 100755 7zip/Compress/Rar29/Original/os.hpp delete mode 100755 7zip/Compress/Rar29/Original/pathfn.hpp delete mode 100755 7zip/Compress/Rar29/Original/rar.hpp delete mode 100755 7zip/Compress/Rar29/Original/rardefs.hpp delete mode 100755 7zip/Compress/Rar29/Original/rarfn.hpp delete mode 100755 7zip/Compress/Rar29/Original/rarlang.hpp delete mode 100755 7zip/Compress/Rar29/Original/raros.hpp delete mode 100755 7zip/Compress/Rar29/Original/rartypes.hpp delete mode 100755 7zip/Compress/Rar29/Original/rarvm.cpp delete mode 100755 7zip/Compress/Rar29/Original/rarvm.hpp delete mode 100755 7zip/Compress/Rar29/Original/rarvmtbl.cpp delete mode 100755 7zip/Compress/Rar29/Original/rawread.hpp delete mode 100755 7zip/Compress/Rar29/Original/rdwrfn.cpp delete mode 100755 7zip/Compress/Rar29/Original/rdwrfn.hpp delete mode 100755 7zip/Compress/Rar29/Original/recvol.hpp delete mode 100755 7zip/Compress/Rar29/Original/resource.cpp delete mode 100755 7zip/Compress/Rar29/Original/resource.hpp delete mode 100755 7zip/Compress/Rar29/Original/rijndael.hpp delete mode 100755 7zip/Compress/Rar29/Original/rs.hpp delete mode 100755 7zip/Compress/Rar29/Original/savepos.hpp delete mode 100755 7zip/Compress/Rar29/Original/scantree.hpp delete mode 100755 7zip/Compress/Rar29/Original/sha1.hpp delete mode 100755 7zip/Compress/Rar29/Original/smallfn.cpp delete mode 100755 7zip/Compress/Rar29/Original/smallfn.hpp delete mode 100755 7zip/Compress/Rar29/Original/strfn.hpp delete mode 100755 7zip/Compress/Rar29/Original/strlist.hpp delete mode 100755 7zip/Compress/Rar29/Original/suballoc.cpp delete mode 100755 7zip/Compress/Rar29/Original/suballoc.hpp delete mode 100755 7zip/Compress/Rar29/Original/system.cpp delete mode 100755 7zip/Compress/Rar29/Original/system.hpp delete mode 100755 7zip/Compress/Rar29/Original/timefn.hpp delete mode 100755 7zip/Compress/Rar29/Original/ulinks.hpp delete mode 100755 7zip/Compress/Rar29/Original/unicode.hpp delete mode 100755 7zip/Compress/Rar29/Original/unpack.cpp delete mode 100755 7zip/Compress/Rar29/Original/unpack.hpp delete mode 100755 7zip/Compress/Rar29/Original/unpack15.cpp delete mode 100755 7zip/Compress/Rar29/Original/version.hpp delete mode 100755 7zip/Compress/Rar29/Original/volume.hpp delete mode 100755 7zip/Compress/Rar29/Rar29.dsp delete mode 100755 7zip/Compress/Rar29/Rar29.dsw delete mode 100755 7zip/Compress/Rar29/Rar29Decoder.cpp delete mode 100755 7zip/Compress/Rar29/Rar29Decoder.h delete mode 100755 7zip/Compress/Rar29/StdAfx.cpp delete mode 100755 7zip/Compress/Rar29/StdAfx.h delete mode 100755 7zip/Compress/Rar29/makefile delete mode 100755 7zip/Compress/Rar29/resource.rc delete mode 100755 7zip/Compress/Shrink/DllExports.cpp delete mode 100755 7zip/Compress/Shrink/ShrinkDecoder.cpp delete mode 100755 7zip/Compress/Shrink/ShrinkDecoder.h delete mode 100755 7zip/Compress/Shrink/StdAfx.cpp delete mode 100755 7zip/Compress/Shrink/StdAfx.h delete mode 100755 7zip/Compress/Z/StdAfx.cpp delete mode 100755 7zip/Compress/Z/StdAfx.h delete mode 100755 7zip/Compress/Z/ZDecoder.cpp delete mode 100755 7zip/Compress/Z/ZDecoder.h delete mode 100755 7zip/Compress/makefile delete mode 100755 7zip/Crypto/7zAES/7zAES.cpp delete mode 100755 7zip/Crypto/7zAES/7zAES.dsp delete mode 100755 7zip/Crypto/7zAES/7zAES.dsw delete mode 100755 7zip/Crypto/7zAES/7zAES.h delete mode 100755 7zip/Crypto/7zAES/DllExports.cpp delete mode 100755 7zip/Crypto/7zAES/StdAfx.cpp delete mode 100755 7zip/Crypto/7zAES/StdAfx.h delete mode 100755 7zip/Crypto/7zAES/makefile delete mode 100755 7zip/Crypto/7zAES/resource.rc delete mode 100755 7zip/Crypto/AES/AES.dsp delete mode 100755 7zip/Crypto/AES/AES.dsw delete mode 100755 7zip/Crypto/AES/AES_CBC.h delete mode 100755 7zip/Crypto/AES/DllExports.cpp delete mode 100755 7zip/Crypto/AES/MyAES.cpp delete mode 100755 7zip/Crypto/AES/MyAES.h delete mode 100755 7zip/Crypto/AES/StdAfx.cpp delete mode 100755 7zip/Crypto/AES/StdAfx.h delete mode 100755 7zip/Crypto/AES/aes.h delete mode 100755 7zip/Crypto/AES/aescpp.h delete mode 100755 7zip/Crypto/AES/aescrypt.c delete mode 100755 7zip/Crypto/AES/aeskey.c delete mode 100755 7zip/Crypto/AES/aesopt.h delete mode 100755 7zip/Crypto/AES/aestab.c delete mode 100755 7zip/Crypto/AES/makefile delete mode 100755 7zip/Crypto/AES/resource.rc delete mode 100755 7zip/Crypto/Codec.def delete mode 100755 7zip/Crypto/Hash/HmacSha1.cpp delete mode 100755 7zip/Crypto/Hash/HmacSha1.h delete mode 100755 7zip/Crypto/Hash/Pbkdf2HmacSha1.cpp delete mode 100755 7zip/Crypto/Hash/Pbkdf2HmacSha1.h delete mode 100755 7zip/Crypto/Hash/RandGen.cpp delete mode 100755 7zip/Crypto/Hash/RandGen.h delete mode 100755 7zip/Crypto/Hash/RotateDefs.h delete mode 100755 7zip/Crypto/Hash/Sha1.cpp delete mode 100755 7zip/Crypto/Hash/Sha1.h delete mode 100755 7zip/Crypto/Hash/Sha256.cpp delete mode 100755 7zip/Crypto/Hash/Sha256.h delete mode 100755 7zip/Crypto/Hash/StdAfx.h delete mode 100755 7zip/Crypto/Rar20/Rar20Cipher.cpp delete mode 100755 7zip/Crypto/Rar20/Rar20Cipher.h delete mode 100755 7zip/Crypto/Rar20/Rar20Crypto.cpp delete mode 100755 7zip/Crypto/Rar20/Rar20Crypto.h delete mode 100755 7zip/Crypto/Rar20/StdAfx.h delete mode 100755 7zip/Crypto/RarAES/RarAES.cpp delete mode 100755 7zip/Crypto/RarAES/RarAES.h delete mode 100755 7zip/Crypto/RarAES/StdAfx.h delete mode 100755 7zip/Crypto/WzAES/StdAfx.cpp delete mode 100755 7zip/Crypto/WzAES/StdAfx.h delete mode 100755 7zip/Crypto/WzAES/WzAES.cpp delete mode 100755 7zip/Crypto/WzAES/WzAES.h delete mode 100755 7zip/Crypto/Zip/StdAfx.h delete mode 100755 7zip/Crypto/Zip/ZipCipher.cpp delete mode 100755 7zip/Crypto/Zip/ZipCipher.h delete mode 100755 7zip/Crypto/Zip/ZipCrypto.cpp delete mode 100755 7zip/Crypto/Zip/ZipCrypto.h delete mode 100755 7zip/Crypto/makefile delete mode 100755 7zip/FileManager/7zFM.exe.manifest delete mode 100755 7zip/FileManager/7zipLogo.ico delete mode 100755 7zip/FileManager/Add.bmp delete mode 100755 7zip/FileManager/Add2.bmp delete mode 100755 7zip/FileManager/App.cpp delete mode 100755 7zip/FileManager/App.h delete mode 100755 7zip/FileManager/AppState.h delete mode 100755 7zip/FileManager/ClassDefs.cpp delete mode 100755 7zip/FileManager/Copy.bmp delete mode 100755 7zip/FileManager/Copy2.bmp delete mode 100755 7zip/FileManager/Delete.bmp delete mode 100755 7zip/FileManager/Delete2.bmp delete mode 100755 7zip/FileManager/EnumFormatEtc.cpp delete mode 100755 7zip/FileManager/EnumFormatEtc.h delete mode 100755 7zip/FileManager/Extract.bmp delete mode 100755 7zip/FileManager/Extract2.bmp delete mode 100755 7zip/FileManager/ExtractCallback.cpp delete mode 100755 7zip/FileManager/ExtractCallback.h delete mode 100755 7zip/FileManager/FM.cpp delete mode 100755 7zip/FileManager/FM.dsp delete mode 100755 7zip/FileManager/FM.dsw delete mode 100755 7zip/FileManager/FM.ico delete mode 100755 7zip/FileManager/FSDrives.cpp delete mode 100755 7zip/FileManager/FSDrives.h delete mode 100755 7zip/FileManager/FSFolder.cpp delete mode 100755 7zip/FileManager/FSFolder.h delete mode 100755 7zip/FileManager/FSFolderCopy.cpp delete mode 100755 7zip/FileManager/FileFolderPluginOpen.cpp delete mode 100755 7zip/FileManager/FileFolderPluginOpen.h delete mode 100755 7zip/FileManager/FilePlugins.cpp delete mode 100755 7zip/FileManager/FilePlugins.h delete mode 100755 7zip/FileManager/FormatUtils.cpp delete mode 100755 7zip/FileManager/FormatUtils.h delete mode 100755 7zip/FileManager/HelpUtils.cpp delete mode 100755 7zip/FileManager/HelpUtils.h delete mode 100755 7zip/FileManager/IFolder.h delete mode 100755 7zip/FileManager/Info.bmp delete mode 100755 7zip/FileManager/Info2.bmp delete mode 100755 7zip/FileManager/LangUtils.cpp delete mode 100755 7zip/FileManager/LangUtils.h delete mode 100755 7zip/FileManager/Move.bmp delete mode 100755 7zip/FileManager/Move2.bmp delete mode 100755 7zip/FileManager/MyCom2.h delete mode 100755 7zip/FileManager/MyLoadMenu.cpp delete mode 100755 7zip/FileManager/MyLoadMenu.h delete mode 100755 7zip/FileManager/NetFolder.cpp delete mode 100755 7zip/FileManager/NetFolder.h delete mode 100755 7zip/FileManager/OpenCallback.cpp delete mode 100755 7zip/FileManager/OpenCallback.h delete mode 100755 7zip/FileManager/OptionsDialog.cpp delete mode 100755 7zip/FileManager/Panel.cpp delete mode 100755 7zip/FileManager/Panel.h delete mode 100755 7zip/FileManager/PanelCopy.cpp delete mode 100755 7zip/FileManager/PanelCrc.cpp delete mode 100755 7zip/FileManager/PanelDrag.cpp delete mode 100755 7zip/FileManager/PanelFolderChange.cpp delete mode 100755 7zip/FileManager/PanelItemOpen.cpp delete mode 100755 7zip/FileManager/PanelItems.cpp delete mode 100755 7zip/FileManager/PanelKey.cpp delete mode 100755 7zip/FileManager/PanelListNotify.cpp delete mode 100755 7zip/FileManager/PanelMenu.cpp delete mode 100755 7zip/FileManager/PanelOperations.cpp delete mode 100755 7zip/FileManager/PanelSelect.cpp delete mode 100755 7zip/FileManager/PanelSort.cpp delete mode 100755 7zip/FileManager/PanelSplitFile.cpp delete mode 100755 7zip/FileManager/PhysDriveFolder.cpp delete mode 100755 7zip/FileManager/PhysDriveFolder.h delete mode 100755 7zip/FileManager/PluginInterface.h delete mode 100755 7zip/FileManager/PluginLoader.h delete mode 100755 7zip/FileManager/ProgramLocation.cpp delete mode 100755 7zip/FileManager/ProgramLocation.h delete mode 100755 7zip/FileManager/PropertyName.cpp delete mode 100755 7zip/FileManager/PropertyName.h delete mode 100755 7zip/FileManager/RegistryAssociations.cpp delete mode 100755 7zip/FileManager/RegistryAssociations.h delete mode 100755 7zip/FileManager/RegistryPlugins.cpp delete mode 100755 7zip/FileManager/RegistryPlugins.h delete mode 100755 7zip/FileManager/RegistryUtils.cpp delete mode 100755 7zip/FileManager/RegistryUtils.h delete mode 100755 7zip/FileManager/Resource/AboutDialog/7zipLogo.ico delete mode 100755 7zip/FileManager/Resource/AboutDialog/AboutDialog.cpp delete mode 100755 7zip/FileManager/Resource/AboutDialog/AboutDialog.h delete mode 100755 7zip/FileManager/Resource/AboutDialog/StdAfx.h delete mode 100755 7zip/FileManager/Resource/AboutDialog/resource.h delete mode 100755 7zip/FileManager/Resource/AboutDialog/resource.rc delete mode 100755 7zip/FileManager/Resource/BenchmarkDialog/BenchmarkDialog.cpp delete mode 100755 7zip/FileManager/Resource/BenchmarkDialog/BenchmarkDialog.h delete mode 100755 7zip/FileManager/Resource/BenchmarkDialog/StdAfx.h delete mode 100755 7zip/FileManager/Resource/BenchmarkDialog/resource.h delete mode 100755 7zip/FileManager/Resource/BenchmarkDialog/resource.rc delete mode 100755 7zip/FileManager/Resource/ComboDialog/ComboDialog.cpp delete mode 100755 7zip/FileManager/Resource/ComboDialog/ComboDialog.h delete mode 100755 7zip/FileManager/Resource/ComboDialog/StdAfx.h delete mode 100755 7zip/FileManager/Resource/ComboDialog/resource.h delete mode 100755 7zip/FileManager/Resource/ComboDialog/resource.rc delete mode 100755 7zip/FileManager/Resource/CopyDialog/CopyDialog.cpp delete mode 100755 7zip/FileManager/Resource/CopyDialog/CopyDialog.h delete mode 100755 7zip/FileManager/Resource/CopyDialog/StdAfx.h delete mode 100755 7zip/FileManager/Resource/CopyDialog/resource.h delete mode 100755 7zip/FileManager/Resource/CopyDialog/resource.rc delete mode 100755 7zip/FileManager/Resource/EditPage/EditPage.cpp delete mode 100755 7zip/FileManager/Resource/EditPage/EditPage.h delete mode 100755 7zip/FileManager/Resource/EditPage/StdAfx.h delete mode 100755 7zip/FileManager/Resource/EditPage/resource.h delete mode 100755 7zip/FileManager/Resource/EditPage/resource.rc delete mode 100755 7zip/FileManager/Resource/LangPage/LangPage.cpp delete mode 100755 7zip/FileManager/Resource/LangPage/LangPage.h delete mode 100755 7zip/FileManager/Resource/LangPage/StdAfx.h delete mode 100755 7zip/FileManager/Resource/LangPage/resource.h delete mode 100755 7zip/FileManager/Resource/LangPage/resource.rc delete mode 100755 7zip/FileManager/Resource/ListBoxDialog/StdAfx.h delete mode 100755 7zip/FileManager/Resource/ListBoxDialog/resource.h delete mode 100755 7zip/FileManager/Resource/ListBoxDialog/resource.rc delete mode 100755 7zip/FileManager/Resource/ListViewDialog/ListViewDialog.cpp delete mode 100755 7zip/FileManager/Resource/ListViewDialog/ListViewDialog.h delete mode 100755 7zip/FileManager/Resource/ListViewDialog/StdAfx.h delete mode 100755 7zip/FileManager/Resource/ListViewDialog/resource.h delete mode 100755 7zip/FileManager/Resource/ListViewDialog/resource.rc delete mode 100755 7zip/FileManager/Resource/MessagesDialog/MessagesDialog.cpp delete mode 100755 7zip/FileManager/Resource/MessagesDialog/MessagesDialog.h delete mode 100755 7zip/FileManager/Resource/MessagesDialog/StdAfx.h delete mode 100755 7zip/FileManager/Resource/MessagesDialog/resource.h delete mode 100755 7zip/FileManager/Resource/MessagesDialog/resource.rc delete mode 100755 7zip/FileManager/Resource/OverwriteDialog/OverwriteDialog.cpp delete mode 100755 7zip/FileManager/Resource/OverwriteDialog/OverwriteDialog.h delete mode 100755 7zip/FileManager/Resource/OverwriteDialog/StdAfx.h delete mode 100755 7zip/FileManager/Resource/OverwriteDialog/resource.h delete mode 100755 7zip/FileManager/Resource/OverwriteDialog/resource.rc delete mode 100755 7zip/FileManager/Resource/PasswordDialog/PasswordDialog.cpp delete mode 100755 7zip/FileManager/Resource/PasswordDialog/PasswordDialog.h delete mode 100755 7zip/FileManager/Resource/PasswordDialog/StdAfx.h delete mode 100755 7zip/FileManager/Resource/PasswordDialog/resource.h delete mode 100755 7zip/FileManager/Resource/PasswordDialog/resource.rc delete mode 100755 7zip/FileManager/Resource/PluginsPage/PluginsPage.cpp delete mode 100755 7zip/FileManager/Resource/PluginsPage/PluginsPage.h delete mode 100755 7zip/FileManager/Resource/PluginsPage/StdAfx.h delete mode 100755 7zip/FileManager/Resource/PluginsPage/resource.h delete mode 100755 7zip/FileManager/Resource/PluginsPage/resource.rc delete mode 100755 7zip/FileManager/Resource/ProgressDialog/ProgressDialog.cpp delete mode 100755 7zip/FileManager/Resource/ProgressDialog/ProgressDialog.h delete mode 100755 7zip/FileManager/Resource/ProgressDialog/StdAfx.h delete mode 100755 7zip/FileManager/Resource/ProgressDialog/resource.h delete mode 100755 7zip/FileManager/Resource/ProgressDialog/resource.rc delete mode 100755 7zip/FileManager/Resource/ProgressDialog2/ProgressDialog.cpp delete mode 100755 7zip/FileManager/Resource/ProgressDialog2/ProgressDialog.h delete mode 100755 7zip/FileManager/Resource/ProgressDialog2/StdAfx.h delete mode 100755 7zip/FileManager/Resource/ProgressDialog2/resource.h delete mode 100755 7zip/FileManager/Resource/ProgressDialog2/resource.rc delete mode 100755 7zip/FileManager/Resource/PropertyName/resource.h delete mode 100755 7zip/FileManager/Resource/PropertyName/resource.rc delete mode 100755 7zip/FileManager/Resource/SettingsPage/SettingsPage.cpp delete mode 100755 7zip/FileManager/Resource/SettingsPage/SettingsPage.h delete mode 100755 7zip/FileManager/Resource/SettingsPage/StdAfx.h delete mode 100755 7zip/FileManager/Resource/SettingsPage/resource.h delete mode 100755 7zip/FileManager/Resource/SettingsPage/resource.rc delete mode 100755 7zip/FileManager/Resource/SplitDialog/SplitDialog.cpp delete mode 100755 7zip/FileManager/Resource/SplitDialog/SplitDialog.h delete mode 100755 7zip/FileManager/Resource/SplitDialog/StdAfx.h delete mode 100755 7zip/FileManager/Resource/SplitDialog/resource.h delete mode 100755 7zip/FileManager/Resource/SplitDialog/resource.rc delete mode 100755 7zip/FileManager/Resource/SystemPage/StdAfx.h delete mode 100755 7zip/FileManager/Resource/SystemPage/SystemPage.cpp delete mode 100755 7zip/FileManager/Resource/SystemPage/SystemPage.h delete mode 100755 7zip/FileManager/Resource/SystemPage/resource.h delete mode 100755 7zip/FileManager/Resource/SystemPage/resource.rc delete mode 100755 7zip/FileManager/RootFolder.cpp delete mode 100755 7zip/FileManager/RootFolder.h delete mode 100755 7zip/FileManager/SplitUtils.cpp delete mode 100755 7zip/FileManager/SplitUtils.h delete mode 100755 7zip/FileManager/StdAfx.cpp delete mode 100755 7zip/FileManager/StdAfx.h delete mode 100755 7zip/FileManager/StringUtils.cpp delete mode 100755 7zip/FileManager/StringUtils.h delete mode 100755 7zip/FileManager/SysIconUtils.cpp delete mode 100755 7zip/FileManager/SysIconUtils.h delete mode 100755 7zip/FileManager/Test.bmp delete mode 100755 7zip/FileManager/Test2.bmp delete mode 100755 7zip/FileManager/TextPairs.cpp delete mode 100755 7zip/FileManager/TextPairs.h delete mode 100755 7zip/FileManager/UpdateCallback100.cpp delete mode 100755 7zip/FileManager/UpdateCallback100.h delete mode 100755 7zip/FileManager/ViewSettings.cpp delete mode 100755 7zip/FileManager/ViewSettings.h delete mode 100755 7zip/FileManager/makefile delete mode 100755 7zip/FileManager/resource.h delete mode 100755 7zip/FileManager/resource.rc delete mode 100755 7zip/GuiCommon.rc delete mode 100755 7zip/Guid.txt delete mode 100755 7zip/ICoder.h delete mode 100755 7zip/IPassword.h delete mode 100755 7zip/IProgress.h delete mode 100755 7zip/IStream.h delete mode 100755 7zip/MyVersion.h delete mode 100755 7zip/MyVersionInfo.rc delete mode 100755 7zip/PropID.h delete mode 100755 7zip/SubBuild.mak delete mode 100755 7zip/UI/Agent/Agent.cpp delete mode 100755 7zip/UI/Agent/Agent.h delete mode 100755 7zip/UI/Agent/AgentOut.cpp delete mode 100755 7zip/UI/Agent/AgentProxy.cpp delete mode 100755 7zip/UI/Agent/AgentProxy.h delete mode 100755 7zip/UI/Agent/ArchiveFolder.cpp delete mode 100755 7zip/UI/Agent/ArchiveFolderOpen.cpp delete mode 100755 7zip/UI/Agent/ArchiveFolderOut.cpp delete mode 100755 7zip/UI/Agent/IFolderArchive.h delete mode 100755 7zip/UI/Agent/UpdateCallbackAgent.cpp delete mode 100755 7zip/UI/Agent/UpdateCallbackAgent.h delete mode 100755 7zip/UI/Client7z/Client7z.cpp delete mode 100755 7zip/UI/Client7z/Client7z.dsp delete mode 100755 7zip/UI/Client7z/Client7z.dsw delete mode 100755 7zip/UI/Client7z/StdAfx.cpp delete mode 100755 7zip/UI/Client7z/StdAfx.h delete mode 100755 7zip/UI/Client7z/makefile delete mode 100755 7zip/UI/Common/ArchiveCommandLine.cpp delete mode 100755 7zip/UI/Common/ArchiveCommandLine.h delete mode 100755 7zip/UI/Common/ArchiveExtractCallback.cpp delete mode 100755 7zip/UI/Common/ArchiveExtractCallback.h delete mode 100755 7zip/UI/Common/ArchiveName.cpp delete mode 100755 7zip/UI/Common/ArchiveName.h delete mode 100755 7zip/UI/Common/ArchiveOpenCallback.cpp delete mode 100755 7zip/UI/Common/ArchiveOpenCallback.h delete mode 100755 7zip/UI/Common/ArchiverInfo.cpp delete mode 100755 7zip/UI/Common/ArchiverInfo.h delete mode 100755 7zip/UI/Common/CompressCall.cpp delete mode 100755 7zip/UI/Common/CompressCall.h delete mode 100755 7zip/UI/Common/DefaultName.cpp delete mode 100755 7zip/UI/Common/DefaultName.h delete mode 100755 7zip/UI/Common/DirItem.h delete mode 100755 7zip/UI/Common/EnumDirItems.cpp delete mode 100755 7zip/UI/Common/EnumDirItems.h delete mode 100755 7zip/UI/Common/ExitCode.h delete mode 100755 7zip/UI/Common/Extract.cpp delete mode 100755 7zip/UI/Common/Extract.h delete mode 100755 7zip/UI/Common/ExtractMode.h delete mode 100755 7zip/UI/Common/ExtractingFilePath.cpp delete mode 100755 7zip/UI/Common/ExtractingFilePath.h delete mode 100755 7zip/UI/Common/HandlerLoader.h delete mode 100755 7zip/UI/Common/IFileExtractCallback.h delete mode 100755 7zip/UI/Common/OpenArchive.cpp delete mode 100755 7zip/UI/Common/OpenArchive.h delete mode 100755 7zip/UI/Common/PropIDUtils.cpp delete mode 100755 7zip/UI/Common/PropIDUtils.h delete mode 100755 7zip/UI/Common/Property.h delete mode 100755 7zip/UI/Common/SetProperties.cpp delete mode 100755 7zip/UI/Common/SetProperties.h delete mode 100755 7zip/UI/Common/SortUtils.cpp delete mode 100755 7zip/UI/Common/SortUtils.h delete mode 100755 7zip/UI/Common/StdAfx.h delete mode 100755 7zip/UI/Common/TempFiles.cpp delete mode 100755 7zip/UI/Common/TempFiles.h delete mode 100755 7zip/UI/Common/Update.cpp delete mode 100755 7zip/UI/Common/Update.h delete mode 100755 7zip/UI/Common/UpdateAction.cpp delete mode 100755 7zip/UI/Common/UpdateAction.h delete mode 100755 7zip/UI/Common/UpdateCallback.cpp delete mode 100755 7zip/UI/Common/UpdateCallback.h delete mode 100755 7zip/UI/Common/UpdatePair.cpp delete mode 100755 7zip/UI/Common/UpdatePair.h delete mode 100755 7zip/UI/Common/UpdateProduce.cpp delete mode 100755 7zip/UI/Common/UpdateProduce.h delete mode 100755 7zip/UI/Common/WorkDir.cpp delete mode 100755 7zip/UI/Common/WorkDir.h delete mode 100755 7zip/UI/Common/ZipRegistry.cpp delete mode 100755 7zip/UI/Common/ZipRegistry.h delete mode 100755 7zip/UI/Console/Console.dsp delete mode 100755 7zip/UI/Console/Console.dsw delete mode 100755 7zip/UI/Console/ConsoleClose.cpp delete mode 100755 7zip/UI/Console/ConsoleClose.h delete mode 100755 7zip/UI/Console/ExtractCallbackConsole.cpp delete mode 100755 7zip/UI/Console/ExtractCallbackConsole.h delete mode 100755 7zip/UI/Console/List.cpp delete mode 100755 7zip/UI/Console/List.h delete mode 100755 7zip/UI/Console/Main.cpp delete mode 100755 7zip/UI/Console/MainAr.cpp delete mode 100755 7zip/UI/Console/OpenCallbackConsole.cpp delete mode 100755 7zip/UI/Console/OpenCallbackConsole.h delete mode 100755 7zip/UI/Console/PercentPrinter.cpp delete mode 100755 7zip/UI/Console/PercentPrinter.h delete mode 100755 7zip/UI/Console/StdAfx.cpp delete mode 100755 7zip/UI/Console/StdAfx.h delete mode 100755 7zip/UI/Console/UpdateCallbackConsole.cpp delete mode 100755 7zip/UI/Console/UpdateCallbackConsole.h delete mode 100755 7zip/UI/Console/UserInputUtils.cpp delete mode 100755 7zip/UI/Console/UserInputUtils.h delete mode 100755 7zip/UI/Console/afxres.h delete mode 100755 7zip/UI/Console/makefile delete mode 100755 7zip/UI/Console/resource.rc delete mode 100755 7zip/UI/Explorer/7-zip.dll.manifest delete mode 100755 7zip/UI/Explorer/ContextMenu.cpp delete mode 100755 7zip/UI/Explorer/ContextMenu.h delete mode 100755 7zip/UI/Explorer/ContextMenuFlags.h delete mode 100755 7zip/UI/Explorer/DllExports.cpp delete mode 100755 7zip/UI/Explorer/Explorer.def delete mode 100755 7zip/UI/Explorer/Explorer.dsp delete mode 100755 7zip/UI/Explorer/Explorer.dsw delete mode 100755 7zip/UI/Explorer/FoldersPage/FoldersPage.cpp delete mode 100755 7zip/UI/Explorer/FoldersPage/FoldersPage.h delete mode 100755 7zip/UI/Explorer/FoldersPage/resource.h delete mode 100755 7zip/UI/Explorer/FoldersPage/resource.rc delete mode 100755 7zip/UI/Explorer/MyMessages.cpp delete mode 100755 7zip/UI/Explorer/MyMessages.h delete mode 100755 7zip/UI/Explorer/OptionsDialog.cpp delete mode 100755 7zip/UI/Explorer/OptionsDialog.h delete mode 100755 7zip/UI/Explorer/RegistryContextMenu.cpp delete mode 100755 7zip/UI/Explorer/RegistryContextMenu.h delete mode 100755 7zip/UI/Explorer/StdAfx.cpp delete mode 100755 7zip/UI/Explorer/StdAfx.h delete mode 100755 7zip/UI/Explorer/SystemPage/SystemPage.cpp delete mode 100755 7zip/UI/Explorer/SystemPage/SystemPage.h delete mode 100755 7zip/UI/Explorer/SystemPage/resource.h delete mode 100755 7zip/UI/Explorer/SystemPage/resource.rc delete mode 100755 7zip/UI/Explorer/makefile delete mode 100755 7zip/UI/Explorer/resource.h delete mode 100755 7zip/UI/Explorer/resource.rc delete mode 100755 7zip/UI/Far/CLSIDConst.cpp delete mode 100755 7zip/UI/Far/ExtractEngine.cpp delete mode 100755 7zip/UI/Far/ExtractEngine.h delete mode 100755 7zip/UI/Far/Far.def delete mode 100755 7zip/UI/Far/Far.dsp delete mode 100755 7zip/UI/Far/Far.dsw delete mode 100755 7zip/UI/Far/FarPlugin.h delete mode 100755 7zip/UI/Far/FarUtils.cpp delete mode 100755 7zip/UI/Far/FarUtils.h delete mode 100755 7zip/UI/Far/Main.cpp delete mode 100755 7zip/UI/Far/Messages.h delete mode 100755 7zip/UI/Far/OverwriteDialog.cpp delete mode 100755 7zip/UI/Far/OverwriteDialog.h delete mode 100755 7zip/UI/Far/Plugin.cpp delete mode 100755 7zip/UI/Far/Plugin.h delete mode 100755 7zip/UI/Far/PluginCommon.cpp delete mode 100755 7zip/UI/Far/PluginDelete.cpp delete mode 100755 7zip/UI/Far/PluginRead.cpp delete mode 100755 7zip/UI/Far/PluginWrite.cpp delete mode 100755 7zip/UI/Far/ProgressBox.cpp delete mode 100755 7zip/UI/Far/ProgressBox.h delete mode 100755 7zip/UI/Far/StdAfx.cpp delete mode 100755 7zip/UI/Far/StdAfx.h delete mode 100755 7zip/UI/Far/UpdateCallback100.cpp delete mode 100755 7zip/UI/Far/UpdateCallback100.h delete mode 100755 7zip/UI/Far/makefile delete mode 100755 7zip/UI/Far/resource.rc delete mode 100755 7zip/UI/GUI/7zG.exe.manifest delete mode 100755 7zip/UI/GUI/CompressDialog.cpp delete mode 100755 7zip/UI/GUI/CompressDialog.h delete mode 100755 7zip/UI/GUI/ExtractDialog.cpp delete mode 100755 7zip/UI/GUI/ExtractDialog.h delete mode 100755 7zip/UI/GUI/ExtractGUI.cpp delete mode 100755 7zip/UI/GUI/ExtractGUI.h delete mode 100755 7zip/UI/GUI/FM.ico delete mode 100755 7zip/UI/GUI/GUI.cpp delete mode 100755 7zip/UI/GUI/GUI.dsp delete mode 100755 7zip/UI/GUI/GUI.dsw delete mode 100755 7zip/UI/GUI/OpenCallbackGUI.cpp delete mode 100755 7zip/UI/GUI/OpenCallbackGUI.h delete mode 100755 7zip/UI/GUI/StdAfx.cpp delete mode 100755 7zip/UI/GUI/StdAfx.h delete mode 100755 7zip/UI/GUI/UpdateCallbackGUI.cpp delete mode 100755 7zip/UI/GUI/UpdateCallbackGUI.h delete mode 100755 7zip/UI/GUI/UpdateGUI.cpp delete mode 100755 7zip/UI/GUI/UpdateGUI.h delete mode 100755 7zip/UI/GUI/makefile delete mode 100755 7zip/UI/GUI/resource.h delete mode 100755 7zip/UI/GUI/resource.rc delete mode 100755 7zip/UI/Resource/CompressDialog/resource.h delete mode 100755 7zip/UI/Resource/CompressDialog/resource.rc delete mode 100755 7zip/UI/Resource/Extract/resource.h delete mode 100755 7zip/UI/Resource/Extract/resource.rc delete mode 100755 7zip/UI/Resource/ExtractDialog/resource.h delete mode 100755 7zip/UI/Resource/ExtractDialog/resource.rc delete mode 100755 7zip/UI/makefile delete mode 100755 7zip/makefile delete mode 100755 Build.mak create mode 100755 C/7zCrc.c create mode 100755 C/7zCrc.h create mode 100755 C/Archive/7z/7zAlloc.c create mode 100755 C/Archive/7z/7zBuffer.c create mode 100755 C/Archive/7z/7zDecode.c create mode 100755 C/Archive/7z/7zExtract.c create mode 100755 C/Archive/7z/7zHeader.c create mode 100755 C/Archive/7z/7zIn.c create mode 100755 C/Archive/7z/7zItem.c create mode 100755 C/Archive/7z/7zMain.c create mode 100755 C/Archive/7z/7zMethodID.c create mode 100755 C/Archive/7z/7z_C.dsp create mode 100755 C/Archive/7z/7z_C.dsw create mode 100755 C/Archive/7z/makefile create mode 100755 C/Archive/7z/makefile.gcc create mode 100755 C/Compress/Branch/BranchARM.c create mode 100755 C/Compress/Branch/BranchARM.h create mode 100755 C/Compress/Branch/BranchARMThumb.c create mode 100755 C/Compress/Branch/BranchARMThumb.h create mode 100755 C/Compress/Branch/BranchIA64.c create mode 100755 C/Compress/Branch/BranchIA64.h create mode 100755 C/Compress/Branch/BranchPPC.c create mode 100755 C/Compress/Branch/BranchPPC.h create mode 100755 C/Compress/Branch/BranchSPARC.c create mode 100755 C/Compress/Branch/BranchSPARC.h create mode 100755 C/Compress/Branch/BranchTypes.h create mode 100755 C/Compress/Branch/BranchX86.c create mode 100755 C/Compress/Branch/BranchX86.h create mode 100755 C/Compress/Huffman/HuffmanEncode.c create mode 100755 C/Compress/Huffman/HuffmanEncode.h create mode 100755 C/Compress/Lz/LzHash.h create mode 100755 C/Compress/Lz/MatchFinder.c create mode 100755 C/Compress/Lz/MatchFinder.h create mode 100755 C/Compress/Lz/MatchFinderMt.c create mode 100755 C/Compress/Lz/MatchFinderMt.h create mode 100755 C/Compress/Lzma/LzmaDecode.c create mode 100755 C/Compress/Lzma/LzmaDecode.h create mode 100755 C/Compress/Lzma/LzmaDecodeSize.c create mode 100755 C/Compress/Lzma/LzmaStateDecode.c create mode 100755 C/Compress/Lzma/LzmaStateDecode.h create mode 100755 C/Compress/Lzma/LzmaStateTest.c create mode 100755 C/Compress/Lzma/LzmaTest.c create mode 100755 C/Compress/Lzma/LzmaTypes.h create mode 100755 C/IStream.h create mode 100755 C/Sort.c create mode 100755 C/Sort.h create mode 100755 C/Threads.c create mode 100755 C/Threads.h create mode 100755 C/Types.h create mode 100755 CPP/7zip/Archive/7z/7z.dsp create mode 100755 CPP/7zip/Archive/7z/7z.dsw create mode 100755 CPP/7zip/Archive/7z/7z.ico create mode 100755 CPP/7zip/Archive/7z/7zCompressionMode.cpp create mode 100755 CPP/7zip/Archive/7z/7zCompressionMode.h create mode 100755 CPP/7zip/Archive/7z/7zDecode.cpp create mode 100755 CPP/7zip/Archive/7z/7zDecode.h create mode 100755 CPP/7zip/Archive/7z/7zEncode.cpp create mode 100755 CPP/7zip/Archive/7z/7zEncode.h create mode 100755 CPP/7zip/Archive/7z/7zExtract.cpp create mode 100755 CPP/7zip/Archive/7z/7zFolderInStream.cpp create mode 100755 CPP/7zip/Archive/7z/7zFolderInStream.h create mode 100755 CPP/7zip/Archive/7z/7zFolderOutStream.cpp create mode 100755 CPP/7zip/Archive/7z/7zFolderOutStream.h create mode 100755 CPP/7zip/Archive/7z/7zHandler.cpp create mode 100755 CPP/7zip/Archive/7z/7zHandler.h create mode 100755 CPP/7zip/Archive/7z/7zHandlerOut.cpp create mode 100755 CPP/7zip/Archive/7z/7zHeader.cpp create mode 100755 CPP/7zip/Archive/7z/7zHeader.h create mode 100755 CPP/7zip/Archive/7z/7zIn.cpp create mode 100755 CPP/7zip/Archive/7z/7zIn.h create mode 100755 CPP/7zip/Archive/7z/7zItem.h create mode 100755 CPP/7zip/Archive/7z/7zMethodID.cpp create mode 100755 CPP/7zip/Archive/7z/7zMethodID.h create mode 100755 CPP/7zip/Archive/7z/7zMethods.cpp create mode 100755 CPP/7zip/Archive/7z/7zMethods.h create mode 100755 CPP/7zip/Archive/7z/7zOut.cpp create mode 100755 CPP/7zip/Archive/7z/7zOut.h create mode 100755 CPP/7zip/Archive/7z/7zProperties.cpp create mode 100755 CPP/7zip/Archive/7z/7zProperties.h create mode 100755 CPP/7zip/Archive/7z/7zSpecStream.cpp create mode 100755 CPP/7zip/Archive/7z/7zSpecStream.h create mode 100755 CPP/7zip/Archive/7z/7zUpdate.cpp create mode 100755 CPP/7zip/Archive/7z/7zUpdate.h create mode 100755 CPP/7zip/Archive/7z/DllExports.cpp create mode 100755 CPP/7zip/Archive/7z/StdAfx.cpp create mode 100755 CPP/7zip/Archive/7z/StdAfx.h create mode 100755 CPP/7zip/Archive/7z/makefile create mode 100755 CPP/7zip/Archive/7z/resource.rc create mode 100755 CPP/7zip/Archive/Archive.def create mode 100755 CPP/7zip/Archive/Arj/Arj.dsp create mode 100755 CPP/7zip/Archive/Arj/Arj.dsw create mode 100755 CPP/7zip/Archive/Arj/ArjHandler.cpp create mode 100755 CPP/7zip/Archive/Arj/ArjHandler.h create mode 100755 CPP/7zip/Archive/Arj/ArjHeader.h create mode 100755 CPP/7zip/Archive/Arj/ArjIn.cpp create mode 100755 CPP/7zip/Archive/Arj/ArjIn.h create mode 100755 CPP/7zip/Archive/Arj/ArjItem.h create mode 100755 CPP/7zip/Archive/Arj/DllExports.cpp create mode 100755 CPP/7zip/Archive/Arj/StdAfx.cpp create mode 100755 CPP/7zip/Archive/Arj/StdAfx.h create mode 100755 CPP/7zip/Archive/Arj/arj.ico create mode 100755 CPP/7zip/Archive/Arj/makefile create mode 100755 CPP/7zip/Archive/Arj/resource.rc create mode 100755 CPP/7zip/Archive/BZip2/BZip2.dsp create mode 100755 CPP/7zip/Archive/BZip2/BZip2.dsw create mode 100755 CPP/7zip/Archive/BZip2/BZip2Handler.cpp create mode 100755 CPP/7zip/Archive/BZip2/BZip2Handler.h create mode 100755 CPP/7zip/Archive/BZip2/BZip2HandlerOut.cpp create mode 100755 CPP/7zip/Archive/BZip2/BZip2Item.h create mode 100755 CPP/7zip/Archive/BZip2/BZip2Update.cpp create mode 100755 CPP/7zip/Archive/BZip2/BZip2Update.h create mode 100755 CPP/7zip/Archive/BZip2/DllExports.cpp create mode 100755 CPP/7zip/Archive/BZip2/StdAfx.cpp create mode 100755 CPP/7zip/Archive/BZip2/StdAfx.h create mode 100755 CPP/7zip/Archive/BZip2/bz2.ico create mode 100755 CPP/7zip/Archive/BZip2/makefile create mode 100755 CPP/7zip/Archive/BZip2/resource.rc create mode 100755 CPP/7zip/Archive/Cab/Cab.dsp create mode 100755 CPP/7zip/Archive/Cab/Cab.dsw create mode 100755 CPP/7zip/Archive/Cab/CabBlockInStream.cpp create mode 100755 CPP/7zip/Archive/Cab/CabBlockInStream.h create mode 100755 CPP/7zip/Archive/Cab/CabHandler.cpp create mode 100755 CPP/7zip/Archive/Cab/CabHandler.h create mode 100755 CPP/7zip/Archive/Cab/CabHeader.cpp create mode 100755 CPP/7zip/Archive/Cab/CabHeader.h create mode 100755 CPP/7zip/Archive/Cab/CabIn.cpp create mode 100755 CPP/7zip/Archive/Cab/CabIn.h create mode 100755 CPP/7zip/Archive/Cab/CabItem.h create mode 100755 CPP/7zip/Archive/Cab/DllExports.cpp create mode 100755 CPP/7zip/Archive/Cab/StdAfx.cpp create mode 100755 CPP/7zip/Archive/Cab/StdAfx.h create mode 100755 CPP/7zip/Archive/Cab/cab.ico create mode 100755 CPP/7zip/Archive/Cab/makefile create mode 100755 CPP/7zip/Archive/Cab/resource.rc create mode 100755 CPP/7zip/Archive/Chm/Chm.dsp create mode 100755 CPP/7zip/Archive/Chm/Chm.dsw create mode 100755 CPP/7zip/Archive/Chm/ChmHandler.cpp create mode 100755 CPP/7zip/Archive/Chm/ChmHandler.h create mode 100755 CPP/7zip/Archive/Chm/ChmHeader.cpp create mode 100755 CPP/7zip/Archive/Chm/ChmHeader.h create mode 100755 CPP/7zip/Archive/Chm/ChmIn.cpp create mode 100755 CPP/7zip/Archive/Chm/ChmIn.h create mode 100755 CPP/7zip/Archive/Chm/DllExports.cpp create mode 100755 CPP/7zip/Archive/Chm/StdAfx.cpp create mode 100755 CPP/7zip/Archive/Chm/StdAfx.h create mode 100755 CPP/7zip/Archive/Chm/makefile create mode 100755 CPP/7zip/Archive/Chm/resource.rc create mode 100755 CPP/7zip/Archive/Common/CodecsPath.cpp create mode 100755 CPP/7zip/Archive/Common/CodecsPath.h create mode 100755 CPP/7zip/Archive/Common/CoderLoader.cpp create mode 100755 CPP/7zip/Archive/Common/CoderLoader.h create mode 100755 CPP/7zip/Archive/Common/CoderMixer2.cpp create mode 100755 CPP/7zip/Archive/Common/CoderMixer2.h create mode 100755 CPP/7zip/Archive/Common/CoderMixer2MT.cpp create mode 100755 CPP/7zip/Archive/Common/CoderMixer2MT.h create mode 100755 CPP/7zip/Archive/Common/CoderMixer2ST.cpp create mode 100755 CPP/7zip/Archive/Common/CoderMixer2ST.h create mode 100755 CPP/7zip/Archive/Common/CrossThreadProgress.cpp create mode 100755 CPP/7zip/Archive/Common/CrossThreadProgress.h create mode 100755 CPP/7zip/Archive/Common/DummyOutStream.cpp create mode 100755 CPP/7zip/Archive/Common/DummyOutStream.h create mode 100755 CPP/7zip/Archive/Common/FilterCoder.cpp create mode 100755 CPP/7zip/Archive/Common/FilterCoder.h create mode 100755 CPP/7zip/Archive/Common/InStreamWithCRC.cpp create mode 100755 CPP/7zip/Archive/Common/InStreamWithCRC.h create mode 100755 CPP/7zip/Archive/Common/ItemNameUtils.cpp create mode 100755 CPP/7zip/Archive/Common/ItemNameUtils.h create mode 100755 CPP/7zip/Archive/Common/MultiStream.cpp create mode 100755 CPP/7zip/Archive/Common/MultiStream.h create mode 100755 CPP/7zip/Archive/Common/OutStreamWithCRC.cpp create mode 100755 CPP/7zip/Archive/Common/OutStreamWithCRC.h create mode 100755 CPP/7zip/Archive/Common/ParseProperties.cpp create mode 100755 CPP/7zip/Archive/Common/ParseProperties.h create mode 100755 CPP/7zip/Archive/Common/StdAfx.h create mode 100755 CPP/7zip/Archive/Cpio/CpioHandler.cpp create mode 100755 CPP/7zip/Archive/Cpio/CpioHandler.h create mode 100755 CPP/7zip/Archive/Cpio/CpioHeader.cpp create mode 100755 CPP/7zip/Archive/Cpio/CpioHeader.h create mode 100755 CPP/7zip/Archive/Cpio/CpioIn.cpp create mode 100755 CPP/7zip/Archive/Cpio/CpioIn.h create mode 100755 CPP/7zip/Archive/Cpio/CpioItem.h create mode 100755 CPP/7zip/Archive/Cpio/DllExports.cpp create mode 100755 CPP/7zip/Archive/Cpio/StdAfx.cpp create mode 100755 CPP/7zip/Archive/Cpio/StdAfx.h create mode 100755 CPP/7zip/Archive/Cpio/cpio.dsp create mode 100755 CPP/7zip/Archive/Cpio/cpio.dsw create mode 100755 CPP/7zip/Archive/Cpio/cpio.ico create mode 100755 CPP/7zip/Archive/Cpio/makefile create mode 100755 CPP/7zip/Archive/Cpio/resource.rc create mode 100755 CPP/7zip/Archive/Deb/Deb.dsp create mode 100755 CPP/7zip/Archive/Deb/Deb.dsw create mode 100755 CPP/7zip/Archive/Deb/DebHandler.cpp create mode 100755 CPP/7zip/Archive/Deb/DebHandler.h create mode 100755 CPP/7zip/Archive/Deb/DebHeader.cpp create mode 100755 CPP/7zip/Archive/Deb/DebHeader.h create mode 100755 CPP/7zip/Archive/Deb/DebIn.cpp create mode 100755 CPP/7zip/Archive/Deb/DebIn.h create mode 100755 CPP/7zip/Archive/Deb/DebItem.h create mode 100755 CPP/7zip/Archive/Deb/DllExports.cpp create mode 100755 CPP/7zip/Archive/Deb/StdAfx.cpp create mode 100755 CPP/7zip/Archive/Deb/StdAfx.h create mode 100755 CPP/7zip/Archive/Deb/deb.ico create mode 100755 CPP/7zip/Archive/Deb/makefile create mode 100755 CPP/7zip/Archive/Deb/resource.rc create mode 100755 CPP/7zip/Archive/GZip/DllExports.cpp create mode 100755 CPP/7zip/Archive/GZip/GZip.dsp create mode 100755 CPP/7zip/Archive/GZip/GZip.dsw create mode 100755 CPP/7zip/Archive/GZip/GZipHandler.cpp create mode 100755 CPP/7zip/Archive/GZip/GZipHandler.h create mode 100755 CPP/7zip/Archive/GZip/GZipHandlerOut.cpp create mode 100755 CPP/7zip/Archive/GZip/GZipHeader.cpp create mode 100755 CPP/7zip/Archive/GZip/GZipHeader.h create mode 100755 CPP/7zip/Archive/GZip/GZipIn.cpp create mode 100755 CPP/7zip/Archive/GZip/GZipIn.h create mode 100755 CPP/7zip/Archive/GZip/GZipItem.h create mode 100755 CPP/7zip/Archive/GZip/GZipOut.cpp create mode 100755 CPP/7zip/Archive/GZip/GZipOut.h create mode 100755 CPP/7zip/Archive/GZip/GZipUpdate.cpp create mode 100755 CPP/7zip/Archive/GZip/GZipUpdate.h create mode 100755 CPP/7zip/Archive/GZip/StdAfx.cpp create mode 100755 CPP/7zip/Archive/GZip/StdAfx.h create mode 100755 CPP/7zip/Archive/GZip/gz.ico create mode 100755 CPP/7zip/Archive/GZip/makefile create mode 100755 CPP/7zip/Archive/GZip/resource.rc create mode 100755 CPP/7zip/Archive/IArchive.h create mode 100755 CPP/7zip/Archive/Iso/DllExports.cpp create mode 100755 CPP/7zip/Archive/Iso/Iso.dsp create mode 100755 CPP/7zip/Archive/Iso/Iso.dsw create mode 100755 CPP/7zip/Archive/Iso/Iso.ico create mode 100755 CPP/7zip/Archive/Iso/IsoHandler.cpp create mode 100755 CPP/7zip/Archive/Iso/IsoHandler.h create mode 100755 CPP/7zip/Archive/Iso/IsoHeader.cpp create mode 100755 CPP/7zip/Archive/Iso/IsoHeader.h create mode 100755 CPP/7zip/Archive/Iso/IsoIn.cpp create mode 100755 CPP/7zip/Archive/Iso/IsoIn.h create mode 100755 CPP/7zip/Archive/Iso/IsoItem.h create mode 100755 CPP/7zip/Archive/Iso/StdAfx.cpp create mode 100755 CPP/7zip/Archive/Iso/StdAfx.h create mode 100755 CPP/7zip/Archive/Iso/makefile create mode 100755 CPP/7zip/Archive/Iso/resource.rc create mode 100755 CPP/7zip/Archive/Lzh/DllExports.cpp create mode 100755 CPP/7zip/Archive/Lzh/Lzh.def create mode 100755 CPP/7zip/Archive/Lzh/Lzh.dsp create mode 100755 CPP/7zip/Archive/Lzh/Lzh.dsw create mode 100755 CPP/7zip/Archive/Lzh/LzhCRC.cpp create mode 100755 CPP/7zip/Archive/Lzh/LzhCRC.h create mode 100755 CPP/7zip/Archive/Lzh/LzhHandler.cpp create mode 100755 CPP/7zip/Archive/Lzh/LzhHandler.h create mode 100755 CPP/7zip/Archive/Lzh/LzhHeader.h create mode 100755 CPP/7zip/Archive/Lzh/LzhIn.cpp create mode 100755 CPP/7zip/Archive/Lzh/LzhIn.h create mode 100755 CPP/7zip/Archive/Lzh/LzhItem.h create mode 100755 CPP/7zip/Archive/Lzh/LzhOutStreamWithCRC.cpp create mode 100755 CPP/7zip/Archive/Lzh/LzhOutStreamWithCRC.h create mode 100755 CPP/7zip/Archive/Lzh/StdAfx.cpp create mode 100755 CPP/7zip/Archive/Lzh/StdAfx.h create mode 100755 CPP/7zip/Archive/Lzh/lzh.ico create mode 100755 CPP/7zip/Archive/Lzh/makefile create mode 100755 CPP/7zip/Archive/Lzh/resource.rc create mode 100755 CPP/7zip/Archive/Nsis/DllExports.cpp create mode 100755 CPP/7zip/Archive/Nsis/Nsis.dsp create mode 100755 CPP/7zip/Archive/Nsis/Nsis.dsw create mode 100755 CPP/7zip/Archive/Nsis/NsisDecode.cpp create mode 100755 CPP/7zip/Archive/Nsis/NsisDecode.h create mode 100755 CPP/7zip/Archive/Nsis/NsisHandler.cpp create mode 100755 CPP/7zip/Archive/Nsis/NsisHandler.h create mode 100755 CPP/7zip/Archive/Nsis/NsisIn.cpp create mode 100755 CPP/7zip/Archive/Nsis/NsisIn.h create mode 100755 CPP/7zip/Archive/Nsis/StdAfx.cpp create mode 100755 CPP/7zip/Archive/Nsis/StdAfx.h create mode 100755 CPP/7zip/Archive/Nsis/makefile create mode 100755 CPP/7zip/Archive/Nsis/resource.rc create mode 100755 CPP/7zip/Archive/RPM/DllExports.cpp create mode 100755 CPP/7zip/Archive/RPM/Rpm.dsp create mode 100755 CPP/7zip/Archive/RPM/Rpm.dsw create mode 100755 CPP/7zip/Archive/RPM/RpmHandler.cpp create mode 100755 CPP/7zip/Archive/RPM/RpmHandler.h create mode 100755 CPP/7zip/Archive/RPM/RpmHeader.h create mode 100755 CPP/7zip/Archive/RPM/RpmIn.cpp create mode 100755 CPP/7zip/Archive/RPM/RpmIn.h create mode 100755 CPP/7zip/Archive/RPM/StdAfx.cpp create mode 100755 CPP/7zip/Archive/RPM/StdAfx.h create mode 100755 CPP/7zip/Archive/RPM/makefile create mode 100755 CPP/7zip/Archive/RPM/resource.rc create mode 100755 CPP/7zip/Archive/RPM/rpm.ico create mode 100755 CPP/7zip/Archive/Rar/DllExports.cpp create mode 100755 CPP/7zip/Archive/Rar/Rar.dsp create mode 100755 CPP/7zip/Archive/Rar/Rar.dsw create mode 100755 CPP/7zip/Archive/Rar/RarHandler.cpp create mode 100755 CPP/7zip/Archive/Rar/RarHandler.h create mode 100755 CPP/7zip/Archive/Rar/RarHeader.cpp create mode 100755 CPP/7zip/Archive/Rar/RarHeader.h create mode 100755 CPP/7zip/Archive/Rar/RarIn.cpp create mode 100755 CPP/7zip/Archive/Rar/RarIn.h create mode 100755 CPP/7zip/Archive/Rar/RarItem.cpp create mode 100755 CPP/7zip/Archive/Rar/RarItem.h create mode 100755 CPP/7zip/Archive/Rar/RarVolumeInStream.cpp create mode 100755 CPP/7zip/Archive/Rar/RarVolumeInStream.h create mode 100755 CPP/7zip/Archive/Rar/StdAfx.cpp create mode 100755 CPP/7zip/Archive/Rar/StdAfx.h create mode 100755 CPP/7zip/Archive/Rar/makefile create mode 100755 CPP/7zip/Archive/Rar/rar.ico create mode 100755 CPP/7zip/Archive/Rar/resource.rc create mode 100755 CPP/7zip/Archive/Split/DllExports.cpp create mode 100755 CPP/7zip/Archive/Split/Split.dsp create mode 100755 CPP/7zip/Archive/Split/Split.dsw create mode 100755 CPP/7zip/Archive/Split/Split.ico create mode 100755 CPP/7zip/Archive/Split/SplitHandler.cpp create mode 100755 CPP/7zip/Archive/Split/SplitHandler.h create mode 100755 CPP/7zip/Archive/Split/SplitHandlerOut.cpp create mode 100755 CPP/7zip/Archive/Split/StdAfx.cpp create mode 100755 CPP/7zip/Archive/Split/StdAfx.h create mode 100755 CPP/7zip/Archive/Split/makefile create mode 100755 CPP/7zip/Archive/Split/resource.rc create mode 100755 CPP/7zip/Archive/Tar/DllExports.cpp create mode 100755 CPP/7zip/Archive/Tar/StdAfx.cpp create mode 100755 CPP/7zip/Archive/Tar/StdAfx.h create mode 100755 CPP/7zip/Archive/Tar/Tar.dsp create mode 100755 CPP/7zip/Archive/Tar/Tar.dsw create mode 100755 CPP/7zip/Archive/Tar/TarHandler.cpp create mode 100755 CPP/7zip/Archive/Tar/TarHandler.h create mode 100755 CPP/7zip/Archive/Tar/TarHandlerOut.cpp create mode 100755 CPP/7zip/Archive/Tar/TarHeader.cpp create mode 100755 CPP/7zip/Archive/Tar/TarHeader.h create mode 100755 CPP/7zip/Archive/Tar/TarIn.cpp create mode 100755 CPP/7zip/Archive/Tar/TarIn.h create mode 100755 CPP/7zip/Archive/Tar/TarItem.h create mode 100755 CPP/7zip/Archive/Tar/TarOut.cpp create mode 100755 CPP/7zip/Archive/Tar/TarOut.h create mode 100755 CPP/7zip/Archive/Tar/TarUpdate.cpp create mode 100755 CPP/7zip/Archive/Tar/TarUpdate.h create mode 100755 CPP/7zip/Archive/Tar/makefile create mode 100755 CPP/7zip/Archive/Tar/resource.rc create mode 100755 CPP/7zip/Archive/Tar/tar.ico create mode 100755 CPP/7zip/Archive/Z/DllExports.cpp create mode 100755 CPP/7zip/Archive/Z/StdAfx.cpp create mode 100755 CPP/7zip/Archive/Z/StdAfx.h create mode 100755 CPP/7zip/Archive/Z/Z.dsp create mode 100755 CPP/7zip/Archive/Z/Z.dsw create mode 100755 CPP/7zip/Archive/Z/Z.ico create mode 100755 CPP/7zip/Archive/Z/ZHandler.cpp create mode 100755 CPP/7zip/Archive/Z/ZHandler.h create mode 100755 CPP/7zip/Archive/Z/makefile create mode 100755 CPP/7zip/Archive/Z/resource.rc create mode 100755 CPP/7zip/Archive/Zip/DllExports.cpp create mode 100755 CPP/7zip/Archive/Zip/StdAfx.cpp create mode 100755 CPP/7zip/Archive/Zip/StdAfx.h create mode 100755 CPP/7zip/Archive/Zip/Zip.dsp create mode 100755 CPP/7zip/Archive/Zip/Zip.dsw create mode 100755 CPP/7zip/Archive/Zip/ZipAddCommon.cpp create mode 100755 CPP/7zip/Archive/Zip/ZipAddCommon.h create mode 100755 CPP/7zip/Archive/Zip/ZipCompressionMode.h create mode 100755 CPP/7zip/Archive/Zip/ZipHandler.cpp create mode 100755 CPP/7zip/Archive/Zip/ZipHandler.h create mode 100755 CPP/7zip/Archive/Zip/ZipHandlerOut.cpp create mode 100755 CPP/7zip/Archive/Zip/ZipHeader.cpp create mode 100755 CPP/7zip/Archive/Zip/ZipHeader.h create mode 100755 CPP/7zip/Archive/Zip/ZipIn.cpp create mode 100755 CPP/7zip/Archive/Zip/ZipIn.h create mode 100755 CPP/7zip/Archive/Zip/ZipItem.cpp create mode 100755 CPP/7zip/Archive/Zip/ZipItem.h create mode 100755 CPP/7zip/Archive/Zip/ZipItemEx.h create mode 100755 CPP/7zip/Archive/Zip/ZipOut.cpp create mode 100755 CPP/7zip/Archive/Zip/ZipOut.h create mode 100755 CPP/7zip/Archive/Zip/ZipUpdate.cpp create mode 100755 CPP/7zip/Archive/Zip/ZipUpdate.h create mode 100755 CPP/7zip/Archive/Zip/makefile create mode 100755 CPP/7zip/Archive/Zip/resource.rc create mode 100755 CPP/7zip/Archive/Zip/zip.ico create mode 100755 CPP/7zip/Archive/makefile create mode 100755 CPP/7zip/Bundles/Alone/Alone.dsp create mode 100755 CPP/7zip/Bundles/Alone/Alone.dsw create mode 100755 CPP/7zip/Bundles/Alone/StdAfx.cpp create mode 100755 CPP/7zip/Bundles/Alone/StdAfx.h create mode 100755 CPP/7zip/Bundles/Alone/afxres.h create mode 100755 CPP/7zip/Bundles/Alone/makefile create mode 100755 CPP/7zip/Bundles/Alone/resource.rc create mode 100755 CPP/7zip/Bundles/Alone7z/Alone.dsp create mode 100755 CPP/7zip/Bundles/Alone7z/Alone.dsw create mode 100755 CPP/7zip/Bundles/Alone7z/StdAfx.cpp create mode 100755 CPP/7zip/Bundles/Alone7z/StdAfx.h create mode 100755 CPP/7zip/Bundles/Alone7z/makefile create mode 100755 CPP/7zip/Bundles/Alone7z/resource.rc create mode 100755 CPP/7zip/Bundles/Format7z/Format7z.dsp create mode 100755 CPP/7zip/Bundles/Format7z/Format7z.dsw create mode 100755 CPP/7zip/Bundles/Format7z/StdAfx.cpp create mode 100755 CPP/7zip/Bundles/Format7z/StdAfx.h create mode 100755 CPP/7zip/Bundles/Format7z/makefile create mode 100755 CPP/7zip/Bundles/Format7z/resource.rc create mode 100755 CPP/7zip/Bundles/Format7zExtract/Format7z.dsp create mode 100755 CPP/7zip/Bundles/Format7zExtract/Format7z.dsw create mode 100755 CPP/7zip/Bundles/Format7zExtract/StdAfx.cpp create mode 100755 CPP/7zip/Bundles/Format7zExtract/StdAfx.h create mode 100755 CPP/7zip/Bundles/Format7zExtract/makefile create mode 100755 CPP/7zip/Bundles/Format7zExtract/resource.rc create mode 100755 CPP/7zip/Bundles/Format7zExtractR/StdAfx.cpp create mode 100755 CPP/7zip/Bundles/Format7zExtractR/StdAfx.h create mode 100755 CPP/7zip/Bundles/Format7zExtractR/makefile create mode 100755 CPP/7zip/Bundles/Format7zExtractR/resource.rc create mode 100755 CPP/7zip/Bundles/Format7zR/StdAfx.cpp create mode 100755 CPP/7zip/Bundles/Format7zR/StdAfx.h create mode 100755 CPP/7zip/Bundles/Format7zR/makefile create mode 100755 CPP/7zip/Bundles/Format7zR/resource.rc create mode 100755 CPP/7zip/Bundles/SFXCon/7z.ico create mode 100755 CPP/7zip/Bundles/SFXCon/Main.cpp create mode 100755 CPP/7zip/Bundles/SFXCon/SFXCon.dsp create mode 100755 CPP/7zip/Bundles/SFXCon/SFXCon.dsw create mode 100755 CPP/7zip/Bundles/SFXCon/StdAfx.cpp create mode 100755 CPP/7zip/Bundles/SFXCon/StdAfx.h create mode 100755 CPP/7zip/Bundles/SFXCon/makefile create mode 100755 CPP/7zip/Bundles/SFXCon/resource.rc create mode 100755 CPP/7zip/Bundles/SFXSetup/ExtractCallback.cpp create mode 100755 CPP/7zip/Bundles/SFXSetup/ExtractCallback.h create mode 100755 CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp create mode 100755 CPP/7zip/Bundles/SFXSetup/ExtractEngine.h create mode 100755 CPP/7zip/Bundles/SFXSetup/Main.cpp create mode 100755 CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp create mode 100755 CPP/7zip/Bundles/SFXSetup/SFXSetup.dsw create mode 100755 CPP/7zip/Bundles/SFXSetup/StdAfx.cpp create mode 100755 CPP/7zip/Bundles/SFXSetup/StdAfx.h create mode 100755 CPP/7zip/Bundles/SFXSetup/makefile create mode 100755 CPP/7zip/Bundles/SFXSetup/resource.h create mode 100755 CPP/7zip/Bundles/SFXSetup/resource.rc create mode 100755 CPP/7zip/Bundles/SFXSetup/setup.ico create mode 100755 CPP/7zip/Bundles/SFXWin/7z.ico create mode 100755 CPP/7zip/Bundles/SFXWin/Main.cpp create mode 100755 CPP/7zip/Bundles/SFXWin/SFXWin.dsp create mode 100755 CPP/7zip/Bundles/SFXWin/SFXWin.dsw create mode 100755 CPP/7zip/Bundles/SFXWin/StdAfx.cpp create mode 100755 CPP/7zip/Bundles/SFXWin/StdAfx.h create mode 100755 CPP/7zip/Bundles/SFXWin/makefile create mode 100755 CPP/7zip/Bundles/SFXWin/resource.h create mode 100755 CPP/7zip/Bundles/SFXWin/resource.rc create mode 100755 CPP/7zip/Bundles/makefile create mode 100755 CPP/7zip/Common/FilePathAutoRename.cpp create mode 100755 CPP/7zip/Common/FilePathAutoRename.h create mode 100755 CPP/7zip/Common/FileStreams.cpp create mode 100755 CPP/7zip/Common/FileStreams.h create mode 100755 CPP/7zip/Common/InBuffer.cpp create mode 100755 CPP/7zip/Common/InBuffer.h create mode 100755 CPP/7zip/Common/InMemStream.cpp create mode 100755 CPP/7zip/Common/InMemStream.h create mode 100755 CPP/7zip/Common/InOutTempBuffer.cpp create mode 100755 CPP/7zip/Common/InOutTempBuffer.h create mode 100755 CPP/7zip/Common/LSBFDecoder.cpp create mode 100755 CPP/7zip/Common/LSBFDecoder.h create mode 100755 CPP/7zip/Common/LSBFEncoder.cpp create mode 100755 CPP/7zip/Common/LSBFEncoder.h create mode 100755 CPP/7zip/Common/LimitedStreams.cpp create mode 100755 CPP/7zip/Common/LimitedStreams.h create mode 100755 CPP/7zip/Common/LockedStream.cpp create mode 100755 CPP/7zip/Common/LockedStream.h create mode 100755 CPP/7zip/Common/MSBFDecoder.h create mode 100755 CPP/7zip/Common/MSBFEncoder.h create mode 100755 CPP/7zip/Common/MemBlocks.cpp create mode 100755 CPP/7zip/Common/MemBlocks.h create mode 100755 CPP/7zip/Common/OffsetStream.cpp create mode 100755 CPP/7zip/Common/OffsetStream.h create mode 100755 CPP/7zip/Common/OutBuffer.cpp create mode 100755 CPP/7zip/Common/OutBuffer.h create mode 100755 CPP/7zip/Common/OutMemStream.cpp create mode 100755 CPP/7zip/Common/OutMemStream.h create mode 100755 CPP/7zip/Common/ProgressMt.cpp create mode 100755 CPP/7zip/Common/ProgressMt.h create mode 100755 CPP/7zip/Common/ProgressUtils.cpp create mode 100755 CPP/7zip/Common/ProgressUtils.h create mode 100755 CPP/7zip/Common/StdAfx.h create mode 100755 CPP/7zip/Common/StreamBinder.cpp create mode 100755 CPP/7zip/Common/StreamBinder.h create mode 100755 CPP/7zip/Common/StreamObjects.cpp create mode 100755 CPP/7zip/Common/StreamObjects.h create mode 100755 CPP/7zip/Common/StreamUtils.cpp create mode 100755 CPP/7zip/Common/StreamUtils.h create mode 100755 CPP/7zip/Compress/Arj/ArjDecoder1.cpp create mode 100755 CPP/7zip/Compress/Arj/ArjDecoder1.h create mode 100755 CPP/7zip/Compress/Arj/ArjDecoder2.cpp create mode 100755 CPP/7zip/Compress/Arj/ArjDecoder2.h create mode 100755 CPP/7zip/Compress/Arj/StdAfx.h create mode 100755 CPP/7zip/Compress/BWT/BlockSort.cpp create mode 100755 CPP/7zip/Compress/BWT/BlockSort.h create mode 100755 CPP/7zip/Compress/BWT/Mtf8.h create mode 100755 CPP/7zip/Compress/BWT/StdAfx.h create mode 100755 CPP/7zip/Compress/BZip2/BZip2.dsp create mode 100755 CPP/7zip/Compress/BZip2/BZip2.dsw create mode 100755 CPP/7zip/Compress/BZip2/BZip2CRC.cpp create mode 100755 CPP/7zip/Compress/BZip2/BZip2CRC.h create mode 100755 CPP/7zip/Compress/BZip2/BZip2Const.h create mode 100755 CPP/7zip/Compress/BZip2/BZip2Decoder.cpp create mode 100755 CPP/7zip/Compress/BZip2/BZip2Decoder.h create mode 100755 CPP/7zip/Compress/BZip2/BZip2Encoder.cpp create mode 100755 CPP/7zip/Compress/BZip2/BZip2Encoder.h create mode 100755 CPP/7zip/Compress/BZip2/DllExports.cpp create mode 100755 CPP/7zip/Compress/BZip2/StdAfx.cpp create mode 100755 CPP/7zip/Compress/BZip2/StdAfx.h create mode 100755 CPP/7zip/Compress/BZip2/makefile create mode 100755 CPP/7zip/Compress/BZip2/resource.rc create mode 100755 CPP/7zip/Compress/BZip2Original/BZip2Decoder.cpp create mode 100755 CPP/7zip/Compress/BZip2Original/BZip2Decoder.h create mode 100755 CPP/7zip/Compress/BZip2Original/BZip2Encoder.cpp create mode 100755 CPP/7zip/Compress/BZip2Original/BZip2Encoder.h create mode 100755 CPP/7zip/Compress/BZip2Original/BZip2Error.cpp create mode 100755 CPP/7zip/Compress/BZip2Original/DllExports.cpp create mode 100755 CPP/7zip/Compress/BZip2Original/StdAfx.cpp create mode 100755 CPP/7zip/Compress/BZip2Original/StdAfx.h create mode 100755 CPP/7zip/Compress/Branch/ARM.cpp create mode 100755 CPP/7zip/Compress/Branch/ARM.h create mode 100755 CPP/7zip/Compress/Branch/ARMThumb.cpp create mode 100755 CPP/7zip/Compress/Branch/ARMThumb.h create mode 100755 CPP/7zip/Compress/Branch/Branch.dsp create mode 100755 CPP/7zip/Compress/Branch/Branch.dsw create mode 100755 CPP/7zip/Compress/Branch/BranchCoder.cpp create mode 100755 CPP/7zip/Compress/Branch/BranchCoder.h create mode 100755 CPP/7zip/Compress/Branch/DllExports.cpp create mode 100755 CPP/7zip/Compress/Branch/IA64.cpp create mode 100755 CPP/7zip/Compress/Branch/IA64.h create mode 100755 CPP/7zip/Compress/Branch/PPC.cpp create mode 100755 CPP/7zip/Compress/Branch/PPC.h create mode 100755 CPP/7zip/Compress/Branch/SPARC.cpp create mode 100755 CPP/7zip/Compress/Branch/SPARC.h create mode 100755 CPP/7zip/Compress/Branch/StdAfx.cpp create mode 100755 CPP/7zip/Compress/Branch/StdAfx.h create mode 100755 CPP/7zip/Compress/Branch/makefile create mode 100755 CPP/7zip/Compress/Branch/resource.rc create mode 100755 CPP/7zip/Compress/Branch/x86.cpp create mode 100755 CPP/7zip/Compress/Branch/x86.h create mode 100755 CPP/7zip/Compress/Branch/x86_2.cpp create mode 100755 CPP/7zip/Compress/Branch/x86_2.h create mode 100755 CPP/7zip/Compress/ByteSwap/ByteSwap.cpp create mode 100755 CPP/7zip/Compress/ByteSwap/ByteSwap.dsp create mode 100755 CPP/7zip/Compress/ByteSwap/ByteSwap.dsw create mode 100755 CPP/7zip/Compress/ByteSwap/ByteSwap.h create mode 100755 CPP/7zip/Compress/ByteSwap/DllExports.cpp create mode 100755 CPP/7zip/Compress/ByteSwap/StdAfx.cpp create mode 100755 CPP/7zip/Compress/ByteSwap/StdAfx.h create mode 100755 CPP/7zip/Compress/ByteSwap/makefile create mode 100755 CPP/7zip/Compress/ByteSwap/resource.rc create mode 100755 CPP/7zip/Compress/Codec.def create mode 100755 CPP/7zip/Compress/Copy/Copy.dsp create mode 100755 CPP/7zip/Compress/Copy/Copy.dsw create mode 100755 CPP/7zip/Compress/Copy/CopyCoder.cpp create mode 100755 CPP/7zip/Compress/Copy/CopyCoder.h create mode 100755 CPP/7zip/Compress/Copy/DllExports.cpp create mode 100755 CPP/7zip/Compress/Copy/StdAfx.cpp create mode 100755 CPP/7zip/Compress/Copy/StdAfx.h create mode 100755 CPP/7zip/Compress/Copy/makefile create mode 100755 CPP/7zip/Compress/Copy/resource.rc create mode 100755 CPP/7zip/Compress/Deflate/Deflate.dsp create mode 100755 CPP/7zip/Compress/Deflate/Deflate.dsw create mode 100755 CPP/7zip/Compress/Deflate/DeflateConst.h create mode 100755 CPP/7zip/Compress/Deflate/DeflateDecoder.cpp create mode 100755 CPP/7zip/Compress/Deflate/DeflateDecoder.h create mode 100755 CPP/7zip/Compress/Deflate/DeflateEncoder.cpp create mode 100755 CPP/7zip/Compress/Deflate/DeflateEncoder.h create mode 100755 CPP/7zip/Compress/Deflate/DllExports.cpp create mode 100755 CPP/7zip/Compress/Deflate/StdAfx.cpp create mode 100755 CPP/7zip/Compress/Deflate/StdAfx.h create mode 100755 CPP/7zip/Compress/Deflate/makefile create mode 100755 CPP/7zip/Compress/Deflate/resource.rc create mode 100755 CPP/7zip/Compress/Huffman/HuffmanDecoder.h create mode 100755 CPP/7zip/Compress/Huffman/StdAfx.h create mode 100755 CPP/7zip/Compress/Implode/DllExports.cpp create mode 100755 CPP/7zip/Compress/Implode/ImplodeDecoder.cpp create mode 100755 CPP/7zip/Compress/Implode/ImplodeDecoder.h create mode 100755 CPP/7zip/Compress/Implode/ImplodeHuffmanDecoder.cpp create mode 100755 CPP/7zip/Compress/Implode/ImplodeHuffmanDecoder.h create mode 100755 CPP/7zip/Compress/Implode/StdAfx.cpp create mode 100755 CPP/7zip/Compress/Implode/StdAfx.h create mode 100755 CPP/7zip/Compress/LZ/LZOutWindow.cpp create mode 100755 CPP/7zip/Compress/LZ/LZOutWindow.h create mode 100755 CPP/7zip/Compress/LZ/StdAfx.h create mode 100755 CPP/7zip/Compress/LZMA/DllExports.cpp create mode 100755 CPP/7zip/Compress/LZMA/LZMA.dsp create mode 100755 CPP/7zip/Compress/LZMA/LZMA.dsw create mode 100755 CPP/7zip/Compress/LZMA/LZMA.h create mode 100755 CPP/7zip/Compress/LZMA/LZMADecoder.cpp create mode 100755 CPP/7zip/Compress/LZMA/LZMADecoder.h create mode 100755 CPP/7zip/Compress/LZMA/LZMAEncoder.cpp create mode 100755 CPP/7zip/Compress/LZMA/LZMAEncoder.h create mode 100755 CPP/7zip/Compress/LZMA/StdAfx.cpp create mode 100755 CPP/7zip/Compress/LZMA/StdAfx.h create mode 100755 CPP/7zip/Compress/LZMA/makefile create mode 100755 CPP/7zip/Compress/LZMA/resource.rc create mode 100755 CPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsp create mode 100755 CPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsw create mode 100755 CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp create mode 100755 CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp create mode 100755 CPP/7zip/Compress/LZMA_Alone/LzmaBench.h create mode 100755 CPP/7zip/Compress/LZMA_Alone/LzmaRam.cpp create mode 100755 CPP/7zip/Compress/LZMA_Alone/LzmaRam.h create mode 100755 CPP/7zip/Compress/LZMA_Alone/LzmaRamDecode.c create mode 100755 CPP/7zip/Compress/LZMA_Alone/LzmaRamDecode.h create mode 100755 CPP/7zip/Compress/LZMA_Alone/StdAfx.cpp create mode 100755 CPP/7zip/Compress/LZMA_Alone/StdAfx.h create mode 100755 CPP/7zip/Compress/LZMA_Alone/makefile create mode 100755 CPP/7zip/Compress/LZMA_Alone/makefile.gcc create mode 100755 CPP/7zip/Compress/Lzh/LzhDecoder.cpp create mode 100755 CPP/7zip/Compress/Lzh/LzhDecoder.h create mode 100755 CPP/7zip/Compress/Lzx/Lzx.h create mode 100755 CPP/7zip/Compress/Lzx/Lzx86Converter.cpp create mode 100755 CPP/7zip/Compress/Lzx/Lzx86Converter.h create mode 100755 CPP/7zip/Compress/Lzx/LzxDecoder.cpp create mode 100755 CPP/7zip/Compress/Lzx/LzxDecoder.h create mode 100755 CPP/7zip/Compress/Lzx/StdAfx.h create mode 100755 CPP/7zip/Compress/PPMD/DllExports.cpp create mode 100755 CPP/7zip/Compress/PPMD/PPMD.dsp create mode 100755 CPP/7zip/Compress/PPMD/PPMD.dsw create mode 100755 CPP/7zip/Compress/PPMD/PPMDContext.h create mode 100755 CPP/7zip/Compress/PPMD/PPMDDecode.h create mode 100755 CPP/7zip/Compress/PPMD/PPMDDecoder.cpp create mode 100755 CPP/7zip/Compress/PPMD/PPMDDecoder.h create mode 100755 CPP/7zip/Compress/PPMD/PPMDEncode.h create mode 100755 CPP/7zip/Compress/PPMD/PPMDEncoder.cpp create mode 100755 CPP/7zip/Compress/PPMD/PPMDEncoder.h create mode 100755 CPP/7zip/Compress/PPMD/PPMDSubAlloc.h create mode 100755 CPP/7zip/Compress/PPMD/PPMDType.h create mode 100755 CPP/7zip/Compress/PPMD/StdAfx.cpp create mode 100755 CPP/7zip/Compress/PPMD/StdAfx.h create mode 100755 CPP/7zip/Compress/PPMD/makefile create mode 100755 CPP/7zip/Compress/PPMD/resource.rc create mode 100755 CPP/7zip/Compress/Quantum/QuantumDecoder.cpp create mode 100755 CPP/7zip/Compress/Quantum/QuantumDecoder.h create mode 100755 CPP/7zip/Compress/RangeCoder/RangeCoder.h create mode 100755 CPP/7zip/Compress/RangeCoder/RangeCoderBit.cpp create mode 100755 CPP/7zip/Compress/RangeCoder/RangeCoderBit.h create mode 100755 CPP/7zip/Compress/RangeCoder/RangeCoderBitTree.h create mode 100755 CPP/7zip/Compress/RangeCoder/RangeCoderOpt.h create mode 100755 CPP/7zip/Compress/RangeCoder/StdAfx.h create mode 100755 CPP/7zip/Compress/Rar/DllExports.cpp create mode 100755 CPP/7zip/Compress/Rar/Rar1Decoder.cpp create mode 100755 CPP/7zip/Compress/Rar/Rar1Decoder.h create mode 100755 CPP/7zip/Compress/Rar/Rar29.dsp create mode 100755 CPP/7zip/Compress/Rar/Rar29.dsw create mode 100755 CPP/7zip/Compress/Rar/Rar2Decoder.cpp create mode 100755 CPP/7zip/Compress/Rar/Rar2Decoder.h create mode 100755 CPP/7zip/Compress/Rar/Rar3Decoder.cpp create mode 100755 CPP/7zip/Compress/Rar/Rar3Decoder.h create mode 100755 CPP/7zip/Compress/Rar/Rar3Vm.cpp create mode 100755 CPP/7zip/Compress/Rar/Rar3Vm.h create mode 100755 CPP/7zip/Compress/Rar/StdAfx.cpp create mode 100755 CPP/7zip/Compress/Rar/StdAfx.h create mode 100755 CPP/7zip/Compress/Rar/makefile create mode 100755 CPP/7zip/Compress/Rar/resource.rc create mode 100755 CPP/7zip/Compress/Shrink/DllExports.cpp create mode 100755 CPP/7zip/Compress/Shrink/ShrinkDecoder.cpp create mode 100755 CPP/7zip/Compress/Shrink/ShrinkDecoder.h create mode 100755 CPP/7zip/Compress/Shrink/StdAfx.cpp create mode 100755 CPP/7zip/Compress/Shrink/StdAfx.h create mode 100755 CPP/7zip/Compress/Z/StdAfx.cpp create mode 100755 CPP/7zip/Compress/Z/StdAfx.h create mode 100755 CPP/7zip/Compress/Z/ZDecoder.cpp create mode 100755 CPP/7zip/Compress/Z/ZDecoder.h create mode 100755 CPP/7zip/Compress/makefile create mode 100755 CPP/7zip/Crypto/7zAES/7zAES.cpp create mode 100755 CPP/7zip/Crypto/7zAES/7zAES.dsp create mode 100755 CPP/7zip/Crypto/7zAES/7zAES.dsw create mode 100755 CPP/7zip/Crypto/7zAES/7zAES.h create mode 100755 CPP/7zip/Crypto/7zAES/DllExports.cpp create mode 100755 CPP/7zip/Crypto/7zAES/StdAfx.cpp create mode 100755 CPP/7zip/Crypto/7zAES/StdAfx.h create mode 100755 CPP/7zip/Crypto/7zAES/makefile create mode 100755 CPP/7zip/Crypto/7zAES/resource.rc create mode 100755 CPP/7zip/Crypto/AES/AES.dsp create mode 100755 CPP/7zip/Crypto/AES/AES.dsw create mode 100755 CPP/7zip/Crypto/AES/AES_CBC.h create mode 100755 CPP/7zip/Crypto/AES/DllExports.cpp create mode 100755 CPP/7zip/Crypto/AES/MyAES.cpp create mode 100755 CPP/7zip/Crypto/AES/MyAES.h create mode 100755 CPP/7zip/Crypto/AES/StdAfx.cpp create mode 100755 CPP/7zip/Crypto/AES/StdAfx.h create mode 100755 CPP/7zip/Crypto/AES/aes.h create mode 100755 CPP/7zip/Crypto/AES/aescpp.h create mode 100755 CPP/7zip/Crypto/AES/aescrypt.c create mode 100755 CPP/7zip/Crypto/AES/aeskey.c create mode 100755 CPP/7zip/Crypto/AES/aesopt.h create mode 100755 CPP/7zip/Crypto/AES/aestab.c create mode 100755 CPP/7zip/Crypto/AES/makefile create mode 100755 CPP/7zip/Crypto/AES/resource.rc create mode 100755 CPP/7zip/Crypto/Codec.def create mode 100755 CPP/7zip/Crypto/Hash/HmacSha1.cpp create mode 100755 CPP/7zip/Crypto/Hash/HmacSha1.h create mode 100755 CPP/7zip/Crypto/Hash/Pbkdf2HmacSha1.cpp create mode 100755 CPP/7zip/Crypto/Hash/Pbkdf2HmacSha1.h create mode 100755 CPP/7zip/Crypto/Hash/RandGen.cpp create mode 100755 CPP/7zip/Crypto/Hash/RandGen.h create mode 100755 CPP/7zip/Crypto/Hash/RotateDefs.h create mode 100755 CPP/7zip/Crypto/Hash/Sha1.cpp create mode 100755 CPP/7zip/Crypto/Hash/Sha1.h create mode 100755 CPP/7zip/Crypto/Hash/Sha256.cpp create mode 100755 CPP/7zip/Crypto/Hash/Sha256.h create mode 100755 CPP/7zip/Crypto/Hash/StdAfx.h create mode 100755 CPP/7zip/Crypto/Rar20/Rar20Cipher.cpp create mode 100755 CPP/7zip/Crypto/Rar20/Rar20Cipher.h create mode 100755 CPP/7zip/Crypto/Rar20/Rar20Crypto.cpp create mode 100755 CPP/7zip/Crypto/Rar20/Rar20Crypto.h create mode 100755 CPP/7zip/Crypto/Rar20/StdAfx.h create mode 100755 CPP/7zip/Crypto/RarAES/RarAES.cpp create mode 100755 CPP/7zip/Crypto/RarAES/RarAES.h create mode 100755 CPP/7zip/Crypto/RarAES/StdAfx.h create mode 100755 CPP/7zip/Crypto/WzAES/StdAfx.cpp create mode 100755 CPP/7zip/Crypto/WzAES/StdAfx.h create mode 100755 CPP/7zip/Crypto/WzAES/WzAES.cpp create mode 100755 CPP/7zip/Crypto/WzAES/WzAES.h create mode 100755 CPP/7zip/Crypto/Zip/StdAfx.h create mode 100755 CPP/7zip/Crypto/Zip/ZipCipher.cpp create mode 100755 CPP/7zip/Crypto/Zip/ZipCipher.h create mode 100755 CPP/7zip/Crypto/Zip/ZipCrypto.cpp create mode 100755 CPP/7zip/Crypto/Zip/ZipCrypto.h create mode 100755 CPP/7zip/Crypto/makefile create mode 100755 CPP/7zip/FileManager/7zFM.exe.manifest create mode 100755 CPP/7zip/FileManager/7zipLogo.ico create mode 100755 CPP/7zip/FileManager/Add.bmp create mode 100755 CPP/7zip/FileManager/Add2.bmp create mode 100755 CPP/7zip/FileManager/App.cpp create mode 100755 CPP/7zip/FileManager/App.h create mode 100755 CPP/7zip/FileManager/AppState.h create mode 100755 CPP/7zip/FileManager/ClassDefs.cpp create mode 100755 CPP/7zip/FileManager/Copy.bmp create mode 100755 CPP/7zip/FileManager/Copy2.bmp create mode 100755 CPP/7zip/FileManager/Delete.bmp create mode 100755 CPP/7zip/FileManager/Delete2.bmp create mode 100755 CPP/7zip/FileManager/EnumFormatEtc.cpp create mode 100755 CPP/7zip/FileManager/EnumFormatEtc.h create mode 100755 CPP/7zip/FileManager/Extract.bmp create mode 100755 CPP/7zip/FileManager/Extract2.bmp create mode 100755 CPP/7zip/FileManager/ExtractCallback.cpp create mode 100755 CPP/7zip/FileManager/ExtractCallback.h create mode 100755 CPP/7zip/FileManager/FM.cpp create mode 100755 CPP/7zip/FileManager/FM.dsp create mode 100755 CPP/7zip/FileManager/FM.dsw create mode 100755 CPP/7zip/FileManager/FM.ico create mode 100755 CPP/7zip/FileManager/FSDrives.cpp create mode 100755 CPP/7zip/FileManager/FSDrives.h create mode 100755 CPP/7zip/FileManager/FSFolder.cpp create mode 100755 CPP/7zip/FileManager/FSFolder.h create mode 100755 CPP/7zip/FileManager/FSFolderCopy.cpp create mode 100755 CPP/7zip/FileManager/FileFolderPluginOpen.cpp create mode 100755 CPP/7zip/FileManager/FileFolderPluginOpen.h create mode 100755 CPP/7zip/FileManager/FilePlugins.cpp create mode 100755 CPP/7zip/FileManager/FilePlugins.h create mode 100755 CPP/7zip/FileManager/FormatUtils.cpp create mode 100755 CPP/7zip/FileManager/FormatUtils.h create mode 100755 CPP/7zip/FileManager/HelpUtils.cpp create mode 100755 CPP/7zip/FileManager/HelpUtils.h create mode 100755 CPP/7zip/FileManager/IFolder.h create mode 100755 CPP/7zip/FileManager/Info.bmp create mode 100755 CPP/7zip/FileManager/Info2.bmp create mode 100755 CPP/7zip/FileManager/LangUtils.cpp create mode 100755 CPP/7zip/FileManager/LangUtils.h create mode 100755 CPP/7zip/FileManager/Move.bmp create mode 100755 CPP/7zip/FileManager/Move2.bmp create mode 100755 CPP/7zip/FileManager/MyCom2.h create mode 100755 CPP/7zip/FileManager/MyLoadMenu.cpp create mode 100755 CPP/7zip/FileManager/MyLoadMenu.h create mode 100755 CPP/7zip/FileManager/NetFolder.cpp create mode 100755 CPP/7zip/FileManager/NetFolder.h create mode 100755 CPP/7zip/FileManager/OpenCallback.cpp create mode 100755 CPP/7zip/FileManager/OpenCallback.h create mode 100755 CPP/7zip/FileManager/OptionsDialog.cpp create mode 100755 CPP/7zip/FileManager/Panel.cpp create mode 100755 CPP/7zip/FileManager/Panel.h create mode 100755 CPP/7zip/FileManager/PanelCopy.cpp create mode 100755 CPP/7zip/FileManager/PanelCrc.cpp create mode 100755 CPP/7zip/FileManager/PanelDrag.cpp create mode 100755 CPP/7zip/FileManager/PanelFolderChange.cpp create mode 100755 CPP/7zip/FileManager/PanelItemOpen.cpp create mode 100755 CPP/7zip/FileManager/PanelItems.cpp create mode 100755 CPP/7zip/FileManager/PanelKey.cpp create mode 100755 CPP/7zip/FileManager/PanelListNotify.cpp create mode 100755 CPP/7zip/FileManager/PanelMenu.cpp create mode 100755 CPP/7zip/FileManager/PanelOperations.cpp create mode 100755 CPP/7zip/FileManager/PanelSelect.cpp create mode 100755 CPP/7zip/FileManager/PanelSort.cpp create mode 100755 CPP/7zip/FileManager/PanelSplitFile.cpp create mode 100755 CPP/7zip/FileManager/PhysDriveFolder.cpp create mode 100755 CPP/7zip/FileManager/PhysDriveFolder.h create mode 100755 CPP/7zip/FileManager/PluginInterface.h create mode 100755 CPP/7zip/FileManager/PluginLoader.h create mode 100755 CPP/7zip/FileManager/ProgramLocation.cpp create mode 100755 CPP/7zip/FileManager/ProgramLocation.h create mode 100755 CPP/7zip/FileManager/PropertyName.cpp create mode 100755 CPP/7zip/FileManager/PropertyName.h create mode 100755 CPP/7zip/FileManager/RegistryAssociations.cpp create mode 100755 CPP/7zip/FileManager/RegistryAssociations.h create mode 100755 CPP/7zip/FileManager/RegistryPlugins.cpp create mode 100755 CPP/7zip/FileManager/RegistryPlugins.h create mode 100755 CPP/7zip/FileManager/RegistryUtils.cpp create mode 100755 CPP/7zip/FileManager/RegistryUtils.h create mode 100755 CPP/7zip/FileManager/Resource/AboutDialog/7zipLogo.ico create mode 100755 CPP/7zip/FileManager/Resource/AboutDialog/AboutDialog.cpp create mode 100755 CPP/7zip/FileManager/Resource/AboutDialog/AboutDialog.h create mode 100755 CPP/7zip/FileManager/Resource/AboutDialog/StdAfx.h create mode 100755 CPP/7zip/FileManager/Resource/AboutDialog/resource.h create mode 100755 CPP/7zip/FileManager/Resource/AboutDialog/resource.rc create mode 100755 CPP/7zip/FileManager/Resource/BenchmarkDialog/BenchmarkDialog.cpp create mode 100755 CPP/7zip/FileManager/Resource/BenchmarkDialog/BenchmarkDialog.h create mode 100755 CPP/7zip/FileManager/Resource/BenchmarkDialog/StdAfx.h create mode 100755 CPP/7zip/FileManager/Resource/BenchmarkDialog/resource.h create mode 100755 CPP/7zip/FileManager/Resource/BenchmarkDialog/resource.rc create mode 100755 CPP/7zip/FileManager/Resource/ComboDialog/ComboDialog.cpp create mode 100755 CPP/7zip/FileManager/Resource/ComboDialog/ComboDialog.h create mode 100755 CPP/7zip/FileManager/Resource/ComboDialog/StdAfx.h create mode 100755 CPP/7zip/FileManager/Resource/ComboDialog/resource.h create mode 100755 CPP/7zip/FileManager/Resource/ComboDialog/resource.rc create mode 100755 CPP/7zip/FileManager/Resource/CopyDialog/CopyDialog.cpp create mode 100755 CPP/7zip/FileManager/Resource/CopyDialog/CopyDialog.h create mode 100755 CPP/7zip/FileManager/Resource/CopyDialog/StdAfx.h create mode 100755 CPP/7zip/FileManager/Resource/CopyDialog/resource.h create mode 100755 CPP/7zip/FileManager/Resource/CopyDialog/resource.rc create mode 100755 CPP/7zip/FileManager/Resource/EditPage/EditPage.cpp create mode 100755 CPP/7zip/FileManager/Resource/EditPage/EditPage.h create mode 100755 CPP/7zip/FileManager/Resource/EditPage/StdAfx.h create mode 100755 CPP/7zip/FileManager/Resource/EditPage/resource.h create mode 100755 CPP/7zip/FileManager/Resource/EditPage/resource.rc create mode 100755 CPP/7zip/FileManager/Resource/LangPage/LangPage.cpp create mode 100755 CPP/7zip/FileManager/Resource/LangPage/LangPage.h create mode 100755 CPP/7zip/FileManager/Resource/LangPage/StdAfx.h create mode 100755 CPP/7zip/FileManager/Resource/LangPage/resource.h create mode 100755 CPP/7zip/FileManager/Resource/LangPage/resource.rc create mode 100755 CPP/7zip/FileManager/Resource/ListBoxDialog/StdAfx.h create mode 100755 CPP/7zip/FileManager/Resource/ListBoxDialog/resource.h create mode 100755 CPP/7zip/FileManager/Resource/ListBoxDialog/resource.rc create mode 100755 CPP/7zip/FileManager/Resource/ListViewDialog/ListViewDialog.cpp create mode 100755 CPP/7zip/FileManager/Resource/ListViewDialog/ListViewDialog.h create mode 100755 CPP/7zip/FileManager/Resource/ListViewDialog/StdAfx.h create mode 100755 CPP/7zip/FileManager/Resource/ListViewDialog/resource.h create mode 100755 CPP/7zip/FileManager/Resource/ListViewDialog/resource.rc create mode 100755 CPP/7zip/FileManager/Resource/MessagesDialog/MessagesDialog.cpp create mode 100755 CPP/7zip/FileManager/Resource/MessagesDialog/MessagesDialog.h create mode 100755 CPP/7zip/FileManager/Resource/MessagesDialog/StdAfx.h create mode 100755 CPP/7zip/FileManager/Resource/MessagesDialog/resource.h create mode 100755 CPP/7zip/FileManager/Resource/MessagesDialog/resource.rc create mode 100755 CPP/7zip/FileManager/Resource/OverwriteDialog/OverwriteDialog.cpp create mode 100755 CPP/7zip/FileManager/Resource/OverwriteDialog/OverwriteDialog.h create mode 100755 CPP/7zip/FileManager/Resource/OverwriteDialog/StdAfx.h create mode 100755 CPP/7zip/FileManager/Resource/OverwriteDialog/resource.h create mode 100755 CPP/7zip/FileManager/Resource/OverwriteDialog/resource.rc create mode 100755 CPP/7zip/FileManager/Resource/PasswordDialog/PasswordDialog.cpp create mode 100755 CPP/7zip/FileManager/Resource/PasswordDialog/PasswordDialog.h create mode 100755 CPP/7zip/FileManager/Resource/PasswordDialog/StdAfx.h create mode 100755 CPP/7zip/FileManager/Resource/PasswordDialog/resource.h create mode 100755 CPP/7zip/FileManager/Resource/PasswordDialog/resource.rc create mode 100755 CPP/7zip/FileManager/Resource/PluginsPage/PluginsPage.cpp create mode 100755 CPP/7zip/FileManager/Resource/PluginsPage/PluginsPage.h create mode 100755 CPP/7zip/FileManager/Resource/PluginsPage/StdAfx.h create mode 100755 CPP/7zip/FileManager/Resource/PluginsPage/resource.h create mode 100755 CPP/7zip/FileManager/Resource/PluginsPage/resource.rc create mode 100755 CPP/7zip/FileManager/Resource/ProgressDialog/ProgressDialog.cpp create mode 100755 CPP/7zip/FileManager/Resource/ProgressDialog/ProgressDialog.h create mode 100755 CPP/7zip/FileManager/Resource/ProgressDialog/StdAfx.h create mode 100755 CPP/7zip/FileManager/Resource/ProgressDialog/resource.h create mode 100755 CPP/7zip/FileManager/Resource/ProgressDialog/resource.rc create mode 100755 CPP/7zip/FileManager/Resource/ProgressDialog2/ProgressDialog.cpp create mode 100755 CPP/7zip/FileManager/Resource/ProgressDialog2/ProgressDialog.h create mode 100755 CPP/7zip/FileManager/Resource/ProgressDialog2/StdAfx.h create mode 100755 CPP/7zip/FileManager/Resource/ProgressDialog2/resource.h create mode 100755 CPP/7zip/FileManager/Resource/ProgressDialog2/resource.rc create mode 100755 CPP/7zip/FileManager/Resource/PropertyName/resource.h create mode 100755 CPP/7zip/FileManager/Resource/PropertyName/resource.rc create mode 100755 CPP/7zip/FileManager/Resource/SettingsPage/SettingsPage.cpp create mode 100755 CPP/7zip/FileManager/Resource/SettingsPage/SettingsPage.h create mode 100755 CPP/7zip/FileManager/Resource/SettingsPage/StdAfx.h create mode 100755 CPP/7zip/FileManager/Resource/SettingsPage/resource.h create mode 100755 CPP/7zip/FileManager/Resource/SettingsPage/resource.rc create mode 100755 CPP/7zip/FileManager/Resource/SplitDialog/SplitDialog.cpp create mode 100755 CPP/7zip/FileManager/Resource/SplitDialog/SplitDialog.h create mode 100755 CPP/7zip/FileManager/Resource/SplitDialog/StdAfx.h create mode 100755 CPP/7zip/FileManager/Resource/SplitDialog/resource.h create mode 100755 CPP/7zip/FileManager/Resource/SplitDialog/resource.rc create mode 100755 CPP/7zip/FileManager/Resource/SystemPage/StdAfx.h create mode 100755 CPP/7zip/FileManager/Resource/SystemPage/SystemPage.cpp create mode 100755 CPP/7zip/FileManager/Resource/SystemPage/SystemPage.h create mode 100755 CPP/7zip/FileManager/Resource/SystemPage/resource.h create mode 100755 CPP/7zip/FileManager/Resource/SystemPage/resource.rc create mode 100755 CPP/7zip/FileManager/RootFolder.cpp create mode 100755 CPP/7zip/FileManager/RootFolder.h create mode 100755 CPP/7zip/FileManager/SplitUtils.cpp create mode 100755 CPP/7zip/FileManager/SplitUtils.h create mode 100755 CPP/7zip/FileManager/StdAfx.cpp create mode 100755 CPP/7zip/FileManager/StdAfx.h create mode 100755 CPP/7zip/FileManager/StringUtils.cpp create mode 100755 CPP/7zip/FileManager/StringUtils.h create mode 100755 CPP/7zip/FileManager/SysIconUtils.cpp create mode 100755 CPP/7zip/FileManager/SysIconUtils.h create mode 100755 CPP/7zip/FileManager/Test.bmp create mode 100755 CPP/7zip/FileManager/Test2.bmp create mode 100755 CPP/7zip/FileManager/TextPairs.cpp create mode 100755 CPP/7zip/FileManager/TextPairs.h create mode 100755 CPP/7zip/FileManager/UpdateCallback100.cpp create mode 100755 CPP/7zip/FileManager/UpdateCallback100.h create mode 100755 CPP/7zip/FileManager/ViewSettings.cpp create mode 100755 CPP/7zip/FileManager/ViewSettings.h create mode 100755 CPP/7zip/FileManager/makefile create mode 100755 CPP/7zip/FileManager/resource.h create mode 100755 CPP/7zip/FileManager/resource.rc create mode 100755 CPP/7zip/GuiCommon.rc create mode 100755 CPP/7zip/Guid.txt create mode 100755 CPP/7zip/ICoder.h create mode 100755 CPP/7zip/IPassword.h create mode 100755 CPP/7zip/IProgress.h create mode 100755 CPP/7zip/IStream.h create mode 100755 CPP/7zip/MyVersion.h create mode 100755 CPP/7zip/MyVersionInfo.rc create mode 100755 CPP/7zip/PropID.h create mode 100755 CPP/7zip/SubBuild.mak create mode 100755 CPP/7zip/UI/Agent/Agent.cpp create mode 100755 CPP/7zip/UI/Agent/Agent.h create mode 100755 CPP/7zip/UI/Agent/AgentOut.cpp create mode 100755 CPP/7zip/UI/Agent/AgentProxy.cpp create mode 100755 CPP/7zip/UI/Agent/AgentProxy.h create mode 100755 CPP/7zip/UI/Agent/ArchiveFolder.cpp create mode 100755 CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp create mode 100755 CPP/7zip/UI/Agent/ArchiveFolderOut.cpp create mode 100755 CPP/7zip/UI/Agent/IFolderArchive.h create mode 100755 CPP/7zip/UI/Agent/UpdateCallbackAgent.cpp create mode 100755 CPP/7zip/UI/Agent/UpdateCallbackAgent.h create mode 100755 CPP/7zip/UI/Client7z/Client7z.cpp create mode 100755 CPP/7zip/UI/Client7z/Client7z.dsp create mode 100755 CPP/7zip/UI/Client7z/Client7z.dsw create mode 100755 CPP/7zip/UI/Client7z/StdAfx.cpp create mode 100755 CPP/7zip/UI/Client7z/StdAfx.h create mode 100755 CPP/7zip/UI/Client7z/makefile create mode 100755 CPP/7zip/UI/Common/ArchiveCommandLine.cpp create mode 100755 CPP/7zip/UI/Common/ArchiveCommandLine.h create mode 100755 CPP/7zip/UI/Common/ArchiveExtractCallback.cpp create mode 100755 CPP/7zip/UI/Common/ArchiveExtractCallback.h create mode 100755 CPP/7zip/UI/Common/ArchiveName.cpp create mode 100755 CPP/7zip/UI/Common/ArchiveName.h create mode 100755 CPP/7zip/UI/Common/ArchiveOpenCallback.cpp create mode 100755 CPP/7zip/UI/Common/ArchiveOpenCallback.h create mode 100755 CPP/7zip/UI/Common/ArchiverInfo.cpp create mode 100755 CPP/7zip/UI/Common/ArchiverInfo.h create mode 100755 CPP/7zip/UI/Common/CompressCall.cpp create mode 100755 CPP/7zip/UI/Common/CompressCall.h create mode 100755 CPP/7zip/UI/Common/DefaultName.cpp create mode 100755 CPP/7zip/UI/Common/DefaultName.h create mode 100755 CPP/7zip/UI/Common/DirItem.h create mode 100755 CPP/7zip/UI/Common/EnumDirItems.cpp create mode 100755 CPP/7zip/UI/Common/EnumDirItems.h create mode 100755 CPP/7zip/UI/Common/ExitCode.h create mode 100755 CPP/7zip/UI/Common/Extract.cpp create mode 100755 CPP/7zip/UI/Common/Extract.h create mode 100755 CPP/7zip/UI/Common/ExtractMode.h create mode 100755 CPP/7zip/UI/Common/ExtractingFilePath.cpp create mode 100755 CPP/7zip/UI/Common/ExtractingFilePath.h create mode 100755 CPP/7zip/UI/Common/HandlerLoader.h create mode 100755 CPP/7zip/UI/Common/IFileExtractCallback.h create mode 100755 CPP/7zip/UI/Common/OpenArchive.cpp create mode 100755 CPP/7zip/UI/Common/OpenArchive.h create mode 100755 CPP/7zip/UI/Common/PropIDUtils.cpp create mode 100755 CPP/7zip/UI/Common/PropIDUtils.h create mode 100755 CPP/7zip/UI/Common/Property.h create mode 100755 CPP/7zip/UI/Common/SetProperties.cpp create mode 100755 CPP/7zip/UI/Common/SetProperties.h create mode 100755 CPP/7zip/UI/Common/SortUtils.cpp create mode 100755 CPP/7zip/UI/Common/SortUtils.h create mode 100755 CPP/7zip/UI/Common/StdAfx.h create mode 100755 CPP/7zip/UI/Common/TempFiles.cpp create mode 100755 CPP/7zip/UI/Common/TempFiles.h create mode 100755 CPP/7zip/UI/Common/Update.cpp create mode 100755 CPP/7zip/UI/Common/Update.h create mode 100755 CPP/7zip/UI/Common/UpdateAction.cpp create mode 100755 CPP/7zip/UI/Common/UpdateAction.h create mode 100755 CPP/7zip/UI/Common/UpdateCallback.cpp create mode 100755 CPP/7zip/UI/Common/UpdateCallback.h create mode 100755 CPP/7zip/UI/Common/UpdatePair.cpp create mode 100755 CPP/7zip/UI/Common/UpdatePair.h create mode 100755 CPP/7zip/UI/Common/UpdateProduce.cpp create mode 100755 CPP/7zip/UI/Common/UpdateProduce.h create mode 100755 CPP/7zip/UI/Common/WorkDir.cpp create mode 100755 CPP/7zip/UI/Common/WorkDir.h create mode 100755 CPP/7zip/UI/Common/ZipRegistry.cpp create mode 100755 CPP/7zip/UI/Common/ZipRegistry.h create mode 100755 CPP/7zip/UI/Console/Console.dsp create mode 100755 CPP/7zip/UI/Console/Console.dsw create mode 100755 CPP/7zip/UI/Console/ConsoleClose.cpp create mode 100755 CPP/7zip/UI/Console/ConsoleClose.h create mode 100755 CPP/7zip/UI/Console/ExtractCallbackConsole.cpp create mode 100755 CPP/7zip/UI/Console/ExtractCallbackConsole.h create mode 100755 CPP/7zip/UI/Console/List.cpp create mode 100755 CPP/7zip/UI/Console/List.h create mode 100755 CPP/7zip/UI/Console/Main.cpp create mode 100755 CPP/7zip/UI/Console/MainAr.cpp create mode 100755 CPP/7zip/UI/Console/OpenCallbackConsole.cpp create mode 100755 CPP/7zip/UI/Console/OpenCallbackConsole.h create mode 100755 CPP/7zip/UI/Console/PercentPrinter.cpp create mode 100755 CPP/7zip/UI/Console/PercentPrinter.h create mode 100755 CPP/7zip/UI/Console/StdAfx.cpp create mode 100755 CPP/7zip/UI/Console/StdAfx.h create mode 100755 CPP/7zip/UI/Console/UpdateCallbackConsole.cpp create mode 100755 CPP/7zip/UI/Console/UpdateCallbackConsole.h create mode 100755 CPP/7zip/UI/Console/UserInputUtils.cpp create mode 100755 CPP/7zip/UI/Console/UserInputUtils.h create mode 100755 CPP/7zip/UI/Console/afxres.h create mode 100755 CPP/7zip/UI/Console/makefile create mode 100755 CPP/7zip/UI/Console/resource.rc create mode 100755 CPP/7zip/UI/Explorer/7-zip.dll.manifest create mode 100755 CPP/7zip/UI/Explorer/ContextMenu.cpp create mode 100755 CPP/7zip/UI/Explorer/ContextMenu.h create mode 100755 CPP/7zip/UI/Explorer/ContextMenuFlags.h create mode 100755 CPP/7zip/UI/Explorer/DllExports.cpp create mode 100755 CPP/7zip/UI/Explorer/Explorer.def create mode 100755 CPP/7zip/UI/Explorer/Explorer.dsp create mode 100755 CPP/7zip/UI/Explorer/Explorer.dsw create mode 100755 CPP/7zip/UI/Explorer/FoldersPage/FoldersPage.cpp create mode 100755 CPP/7zip/UI/Explorer/FoldersPage/FoldersPage.h create mode 100755 CPP/7zip/UI/Explorer/FoldersPage/resource.h create mode 100755 CPP/7zip/UI/Explorer/FoldersPage/resource.rc create mode 100755 CPP/7zip/UI/Explorer/MyMessages.cpp create mode 100755 CPP/7zip/UI/Explorer/MyMessages.h create mode 100755 CPP/7zip/UI/Explorer/OptionsDialog.cpp create mode 100755 CPP/7zip/UI/Explorer/OptionsDialog.h create mode 100755 CPP/7zip/UI/Explorer/RegistryContextMenu.cpp create mode 100755 CPP/7zip/UI/Explorer/RegistryContextMenu.h create mode 100755 CPP/7zip/UI/Explorer/StdAfx.cpp create mode 100755 CPP/7zip/UI/Explorer/StdAfx.h create mode 100755 CPP/7zip/UI/Explorer/SystemPage/SystemPage.cpp create mode 100755 CPP/7zip/UI/Explorer/SystemPage/SystemPage.h create mode 100755 CPP/7zip/UI/Explorer/SystemPage/resource.h create mode 100755 CPP/7zip/UI/Explorer/SystemPage/resource.rc create mode 100755 CPP/7zip/UI/Explorer/makefile create mode 100755 CPP/7zip/UI/Explorer/resource.h create mode 100755 CPP/7zip/UI/Explorer/resource.rc create mode 100755 CPP/7zip/UI/Far/CLSIDConst.cpp create mode 100755 CPP/7zip/UI/Far/ExtractEngine.cpp create mode 100755 CPP/7zip/UI/Far/ExtractEngine.h create mode 100755 CPP/7zip/UI/Far/Far.def create mode 100755 CPP/7zip/UI/Far/Far.dsp create mode 100755 CPP/7zip/UI/Far/Far.dsw create mode 100755 CPP/7zip/UI/Far/FarPlugin.h create mode 100755 CPP/7zip/UI/Far/FarUtils.cpp create mode 100755 CPP/7zip/UI/Far/FarUtils.h create mode 100755 CPP/7zip/UI/Far/Main.cpp create mode 100755 CPP/7zip/UI/Far/Messages.h create mode 100755 CPP/7zip/UI/Far/OverwriteDialog.cpp create mode 100755 CPP/7zip/UI/Far/OverwriteDialog.h create mode 100755 CPP/7zip/UI/Far/Plugin.cpp create mode 100755 CPP/7zip/UI/Far/Plugin.h create mode 100755 CPP/7zip/UI/Far/PluginCommon.cpp create mode 100755 CPP/7zip/UI/Far/PluginDelete.cpp create mode 100755 CPP/7zip/UI/Far/PluginRead.cpp create mode 100755 CPP/7zip/UI/Far/PluginWrite.cpp create mode 100755 CPP/7zip/UI/Far/ProgressBox.cpp create mode 100755 CPP/7zip/UI/Far/ProgressBox.h create mode 100755 CPP/7zip/UI/Far/StdAfx.cpp create mode 100755 CPP/7zip/UI/Far/StdAfx.h create mode 100755 CPP/7zip/UI/Far/UpdateCallback100.cpp create mode 100755 CPP/7zip/UI/Far/UpdateCallback100.h create mode 100755 CPP/7zip/UI/Far/makefile create mode 100755 CPP/7zip/UI/Far/resource.rc create mode 100755 CPP/7zip/UI/GUI/7zG.exe.manifest create mode 100755 CPP/7zip/UI/GUI/CompressDialog.cpp create mode 100755 CPP/7zip/UI/GUI/CompressDialog.h create mode 100755 CPP/7zip/UI/GUI/ExtractDialog.cpp create mode 100755 CPP/7zip/UI/GUI/ExtractDialog.h create mode 100755 CPP/7zip/UI/GUI/ExtractGUI.cpp create mode 100755 CPP/7zip/UI/GUI/ExtractGUI.h create mode 100755 CPP/7zip/UI/GUI/FM.ico create mode 100755 CPP/7zip/UI/GUI/GUI.cpp create mode 100755 CPP/7zip/UI/GUI/GUI.dsp create mode 100755 CPP/7zip/UI/GUI/GUI.dsw create mode 100755 CPP/7zip/UI/GUI/OpenCallbackGUI.cpp create mode 100755 CPP/7zip/UI/GUI/OpenCallbackGUI.h create mode 100755 CPP/7zip/UI/GUI/StdAfx.cpp create mode 100755 CPP/7zip/UI/GUI/StdAfx.h create mode 100755 CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp create mode 100755 CPP/7zip/UI/GUI/UpdateCallbackGUI.h create mode 100755 CPP/7zip/UI/GUI/UpdateGUI.cpp create mode 100755 CPP/7zip/UI/GUI/UpdateGUI.h create mode 100755 CPP/7zip/UI/GUI/makefile create mode 100755 CPP/7zip/UI/GUI/resource.h create mode 100755 CPP/7zip/UI/GUI/resource.rc create mode 100755 CPP/7zip/UI/Resource/CompressDialog/resource.h create mode 100755 CPP/7zip/UI/Resource/CompressDialog/resource.rc create mode 100755 CPP/7zip/UI/Resource/Extract/resource.h create mode 100755 CPP/7zip/UI/Resource/Extract/resource.rc create mode 100755 CPP/7zip/UI/Resource/ExtractDialog/resource.h create mode 100755 CPP/7zip/UI/Resource/ExtractDialog/resource.rc create mode 100755 CPP/7zip/UI/makefile create mode 100755 CPP/7zip/makefile create mode 100755 CPP/Build.mak create mode 100755 CPP/Common/AlignedBuffer.cpp create mode 100755 CPP/Common/AlignedBuffer.h create mode 100755 CPP/Common/Alloc.cpp create mode 100755 CPP/Common/Alloc.h create mode 100755 CPP/Common/AutoPtr.h create mode 100755 CPP/Common/Buffer.h create mode 100755 CPP/Common/CRC.cpp create mode 100755 CPP/Common/CRC.h create mode 100755 CPP/Common/C_FileIO.cpp create mode 100755 CPP/Common/C_FileIO.h create mode 100755 CPP/Common/ComTry.h create mode 100755 CPP/Common/CommandLineParser.cpp create mode 100755 CPP/Common/CommandLineParser.h create mode 100755 CPP/Common/Defs.h create mode 100755 CPP/Common/DynamicBuffer.h create mode 100755 CPP/Common/Exception.h create mode 100755 CPP/Common/IntToString.cpp create mode 100755 CPP/Common/IntToString.h create mode 100755 CPP/Common/Lang.cpp create mode 100755 CPP/Common/Lang.h create mode 100755 CPP/Common/ListFileUtils.cpp create mode 100755 CPP/Common/ListFileUtils.h create mode 100755 CPP/Common/MyCom.h create mode 100755 CPP/Common/MyGuidDef.h create mode 100755 CPP/Common/MyInitGuid.h create mode 100755 CPP/Common/MyUnknown.h create mode 100755 CPP/Common/MyWindows.cpp create mode 100755 CPP/Common/MyWindows.h create mode 100755 CPP/Common/NewHandler.cpp create mode 100755 CPP/Common/NewHandler.h create mode 100755 CPP/Common/Random.cpp create mode 100755 CPP/Common/Random.h create mode 100755 CPP/Common/StdAfx.h create mode 100755 CPP/Common/StdInStream.cpp create mode 100755 CPP/Common/StdInStream.h create mode 100755 CPP/Common/StdOutStream.cpp create mode 100755 CPP/Common/StdOutStream.h create mode 100755 CPP/Common/String.cpp create mode 100755 CPP/Common/String.h create mode 100755 CPP/Common/StringConvert.cpp create mode 100755 CPP/Common/StringConvert.h create mode 100755 CPP/Common/StringToInt.cpp create mode 100755 CPP/Common/StringToInt.h create mode 100755 CPP/Common/TextConfig.cpp create mode 100755 CPP/Common/TextConfig.h create mode 100755 CPP/Common/Types.h create mode 100755 CPP/Common/UTFConvert.cpp create mode 100755 CPP/Common/UTFConvert.h create mode 100755 CPP/Common/Vector.cpp create mode 100755 CPP/Common/Vector.h create mode 100755 CPP/Common/Wildcard.cpp create mode 100755 CPP/Common/Wildcard.h create mode 100755 CPP/Windows/COM.cpp create mode 100755 CPP/Windows/COM.h create mode 100755 CPP/Windows/CommonDialog.cpp create mode 100755 CPP/Windows/CommonDialog.h create mode 100755 CPP/Windows/Console.cpp create mode 100755 CPP/Windows/Console.h create mode 100755 CPP/Windows/Control/ComboBox.cpp create mode 100755 CPP/Windows/Control/ComboBox.h create mode 100755 CPP/Windows/Control/Dialog.cpp create mode 100755 CPP/Windows/Control/Dialog.h create mode 100755 CPP/Windows/Control/Edit.h create mode 100755 CPP/Windows/Control/ImageList.cpp create mode 100755 CPP/Windows/Control/ImageList.h create mode 100755 CPP/Windows/Control/ListView.cpp create mode 100755 CPP/Windows/Control/ListView.h create mode 100755 CPP/Windows/Control/ProgressBar.h create mode 100755 CPP/Windows/Control/PropertyPage.cpp create mode 100755 CPP/Windows/Control/PropertyPage.h create mode 100755 CPP/Windows/Control/ReBar.h create mode 100755 CPP/Windows/Control/Static.h create mode 100755 CPP/Windows/Control/StatusBar.h create mode 100755 CPP/Windows/Control/StdAfx.h create mode 100755 CPP/Windows/Control/ToolBar.h create mode 100755 CPP/Windows/Control/Trackbar.h create mode 100755 CPP/Windows/Control/Window2.cpp create mode 100755 CPP/Windows/Control/Window2.h create mode 100755 CPP/Windows/DLL.cpp create mode 100755 CPP/Windows/DLL.h create mode 100755 CPP/Windows/Defs.h create mode 100755 CPP/Windows/Error.cpp create mode 100755 CPP/Windows/Error.h create mode 100755 CPP/Windows/FileDevice.cpp create mode 100755 CPP/Windows/FileDevice.h create mode 100755 CPP/Windows/FileDir.cpp create mode 100755 CPP/Windows/FileDir.h create mode 100755 CPP/Windows/FileFind.cpp create mode 100755 CPP/Windows/FileFind.h create mode 100755 CPP/Windows/FileIO.cpp create mode 100755 CPP/Windows/FileIO.h create mode 100755 CPP/Windows/FileMapping.cpp create mode 100755 CPP/Windows/FileMapping.h create mode 100755 CPP/Windows/FileName.cpp create mode 100755 CPP/Windows/FileName.h create mode 100755 CPP/Windows/FileSystem.cpp create mode 100755 CPP/Windows/FileSystem.h create mode 100755 CPP/Windows/Handle.h create mode 100755 CPP/Windows/Memory.cpp create mode 100755 CPP/Windows/Memory.h create mode 100755 CPP/Windows/MemoryLock.cpp create mode 100755 CPP/Windows/MemoryLock.h create mode 100755 CPP/Windows/Menu.cpp create mode 100755 CPP/Windows/Menu.h create mode 100755 CPP/Windows/NationalTime.cpp create mode 100755 CPP/Windows/NationalTime.h create mode 100755 CPP/Windows/Net.cpp create mode 100755 CPP/Windows/Net.h create mode 100755 CPP/Windows/ProcessMessages.cpp create mode 100755 CPP/Windows/ProcessMessages.h create mode 100755 CPP/Windows/PropVariant.cpp create mode 100755 CPP/Windows/PropVariant.h create mode 100755 CPP/Windows/PropVariantConversions.cpp create mode 100755 CPP/Windows/PropVariantConversions.h create mode 100755 CPP/Windows/Registry.cpp create mode 100755 CPP/Windows/Registry.h create mode 100755 CPP/Windows/ResourceString.cpp create mode 100755 CPP/Windows/ResourceString.h create mode 100755 CPP/Windows/Security.cpp create mode 100755 CPP/Windows/Security.h create mode 100755 CPP/Windows/Shell.cpp create mode 100755 CPP/Windows/Shell.h create mode 100755 CPP/Windows/StdAfx.h create mode 100755 CPP/Windows/Synchronization.cpp create mode 100755 CPP/Windows/Synchronization.h create mode 100755 CPP/Windows/System.h create mode 100755 CPP/Windows/Thread.h create mode 100755 CPP/Windows/Time.h create mode 100755 CPP/Windows/Window.cpp create mode 100755 CPP/Windows/Window.h delete mode 100755 Common/AlignedBuffer.cpp delete mode 100755 Common/AlignedBuffer.h delete mode 100755 Common/Alloc.cpp delete mode 100755 Common/Alloc.h delete mode 100755 Common/AutoPtr.h delete mode 100755 Common/Buffer.h delete mode 100755 Common/CRC.cpp delete mode 100755 Common/CRC.h delete mode 100755 Common/C_FileIO.cpp delete mode 100755 Common/C_FileIO.h delete mode 100755 Common/ComTry.h delete mode 100755 Common/CommandLineParser.cpp delete mode 100755 Common/CommandLineParser.h delete mode 100755 Common/Defs.h delete mode 100755 Common/DynamicBuffer.h delete mode 100755 Common/Exception.h delete mode 100755 Common/IntToString.cpp delete mode 100755 Common/IntToString.h delete mode 100755 Common/Lang.cpp delete mode 100755 Common/Lang.h delete mode 100755 Common/ListFileUtils.cpp delete mode 100755 Common/ListFileUtils.h delete mode 100755 Common/MyCom.h delete mode 100755 Common/MyGuidDef.h delete mode 100755 Common/MyInitGuid.h delete mode 100755 Common/MyUnknown.h delete mode 100755 Common/MyWindows.cpp delete mode 100755 Common/MyWindows.h delete mode 100755 Common/NewHandler.cpp delete mode 100755 Common/NewHandler.h delete mode 100755 Common/Random.cpp delete mode 100755 Common/Random.h delete mode 100755 Common/StdAfx.h delete mode 100755 Common/StdInStream.cpp delete mode 100755 Common/StdInStream.h delete mode 100755 Common/StdOutStream.cpp delete mode 100755 Common/StdOutStream.h delete mode 100755 Common/String.cpp delete mode 100755 Common/String.h delete mode 100755 Common/StringConvert.cpp delete mode 100755 Common/StringConvert.h delete mode 100755 Common/StringToInt.cpp delete mode 100755 Common/StringToInt.h delete mode 100755 Common/TextConfig.cpp delete mode 100755 Common/TextConfig.h delete mode 100755 Common/Types.h delete mode 100755 Common/UTFConvert.cpp delete mode 100755 Common/UTFConvert.h delete mode 100755 Common/Vector.cpp delete mode 100755 Common/Vector.h delete mode 100755 Common/Wildcard.cpp delete mode 100755 Common/Wildcard.h create mode 100755 DOC/License.txt delete mode 100755 Windows/COM.cpp delete mode 100755 Windows/COM.h delete mode 100755 Windows/CommonDialog.cpp delete mode 100755 Windows/CommonDialog.h delete mode 100755 Windows/Console.cpp delete mode 100755 Windows/Console.h delete mode 100755 Windows/Control/ComboBox.cpp delete mode 100755 Windows/Control/ComboBox.h delete mode 100755 Windows/Control/Dialog.cpp delete mode 100755 Windows/Control/Dialog.h delete mode 100755 Windows/Control/Edit.h delete mode 100755 Windows/Control/ImageList.cpp delete mode 100755 Windows/Control/ImageList.h delete mode 100755 Windows/Control/ListView.cpp delete mode 100755 Windows/Control/ListView.h delete mode 100755 Windows/Control/ProgressBar.h delete mode 100755 Windows/Control/PropertyPage.cpp delete mode 100755 Windows/Control/PropertyPage.h delete mode 100755 Windows/Control/ReBar.h delete mode 100755 Windows/Control/Static.h delete mode 100755 Windows/Control/StatusBar.h delete mode 100755 Windows/Control/StdAfx.h delete mode 100755 Windows/Control/ToolBar.h delete mode 100755 Windows/Control/Trackbar.h delete mode 100755 Windows/Control/Window2.cpp delete mode 100755 Windows/Control/Window2.h delete mode 100755 Windows/DLL.cpp delete mode 100755 Windows/DLL.h delete mode 100755 Windows/Defs.h delete mode 100755 Windows/Error.cpp delete mode 100755 Windows/Error.h delete mode 100755 Windows/FileDevice.cpp delete mode 100755 Windows/FileDevice.h delete mode 100755 Windows/FileDir.cpp delete mode 100755 Windows/FileDir.h delete mode 100755 Windows/FileFind.cpp delete mode 100755 Windows/FileFind.h delete mode 100755 Windows/FileIO.cpp delete mode 100755 Windows/FileIO.h delete mode 100755 Windows/FileMapping.cpp delete mode 100755 Windows/FileMapping.h delete mode 100755 Windows/FileName.cpp delete mode 100755 Windows/FileName.h delete mode 100755 Windows/FileSystem.cpp delete mode 100755 Windows/FileSystem.h delete mode 100755 Windows/Handle.h delete mode 100755 Windows/Memory.cpp delete mode 100755 Windows/Memory.h delete mode 100755 Windows/MemoryLock.cpp delete mode 100755 Windows/MemoryLock.h delete mode 100755 Windows/Menu.cpp delete mode 100755 Windows/Menu.h delete mode 100755 Windows/NationalTime.cpp delete mode 100755 Windows/NationalTime.h delete mode 100755 Windows/Net.cpp delete mode 100755 Windows/Net.h delete mode 100755 Windows/ProcessMessages.cpp delete mode 100755 Windows/ProcessMessages.h delete mode 100755 Windows/PropVariant.cpp delete mode 100755 Windows/PropVariant.h delete mode 100755 Windows/PropVariantConversions.cpp delete mode 100755 Windows/PropVariantConversions.h delete mode 100755 Windows/Registry.cpp delete mode 100755 Windows/Registry.h delete mode 100755 Windows/ResourceString.cpp delete mode 100755 Windows/ResourceString.h delete mode 100755 Windows/Security.cpp delete mode 100755 Windows/Security.h delete mode 100755 Windows/Shell.cpp delete mode 100755 Windows/Shell.h delete mode 100755 Windows/StdAfx.h delete mode 100755 Windows/Synchronization.cpp delete mode 100755 Windows/Synchronization.h delete mode 100755 Windows/System.h delete mode 100755 Windows/Thread.h delete mode 100755 Windows/Time.h delete mode 100755 Windows/Window.cpp delete mode 100755 Windows/Window.h diff --git a/7zip/Archive/7z/7z.dsp b/7zip/Archive/7z/7z.dsp deleted file mode 100755 index e57115ef..00000000 --- a/7zip/Archive/7z/7z.dsp +++ /dev/null @@ -1,593 +0,0 @@ -# Microsoft Developer Studio Project File - Name="7z" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=7z - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "7z.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "7z.mak" CFG="7z - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "7z - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "7z - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "7z - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-zip\Formats\7z.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-zip\Formats\7z.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "7z - Win32 Release" -# Name "7z - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\7zCompressionMode.cpp -# End Source File -# Begin Source File - -SOURCE=.\7zCompressionMode.h -# End Source File -# Begin Source File - -SOURCE=.\7zDecode.cpp -# End Source File -# Begin Source File - -SOURCE=.\7zDecode.h -# End Source File -# Begin Source File - -SOURCE=.\7zEncode.cpp -# End Source File -# Begin Source File - -SOURCE=.\7zEncode.h -# End Source File -# Begin Source File - -SOURCE=.\7zExtract.cpp -# End Source File -# Begin Source File - -SOURCE=.\7zFolderInStream.cpp -# End Source File -# Begin Source File - -SOURCE=.\7zFolderInStream.h -# End Source File -# Begin Source File - -SOURCE=.\7zFolderOutStream.cpp -# End Source File -# Begin Source File - -SOURCE=.\7zFolderOutStream.h -# End Source File -# Begin Source File - -SOURCE=.\7zHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\7zHandler.h -# End Source File -# Begin Source File - -SOURCE=.\7zHandlerOut.cpp -# End Source File -# Begin Source File - -SOURCE=.\7zHeader.cpp -# End Source File -# Begin Source File - -SOURCE=.\7zHeader.h -# End Source File -# Begin Source File - -SOURCE=.\7zIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\7zIn.h -# End Source File -# Begin Source File - -SOURCE=.\7zItem.h -# End Source File -# Begin Source File - -SOURCE=.\7zMethodID.cpp -# End Source File -# Begin Source File - -SOURCE=.\7zMethodID.h -# End Source File -# Begin Source File - -SOURCE=.\7zMethods.cpp -# End Source File -# Begin Source File - -SOURCE=.\7zMethods.h -# End Source File -# Begin Source File - -SOURCE=.\7zOut.cpp -# End Source File -# Begin Source File - -SOURCE=.\7zOut.h -# End Source File -# Begin Source File - -SOURCE=.\7zProperties.cpp -# End Source File -# Begin Source File - -SOURCE=.\7zProperties.h -# End Source File -# Begin Source File - -SOURCE=.\7zSpecStream.cpp -# End Source File -# Begin Source File - -SOURCE=.\7zSpecStream.h -# End Source File -# Begin Source File - -SOURCE=.\7zUpdate.cpp -# End Source File -# Begin Source File - -SOURCE=.\7zUpdate.h -# End Source File -# End Group -# Begin Group "Interface" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\IArchive.h -# End Source File -# Begin Source File - -SOURCE=..\..\ICoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\IMyUnknown.h -# End Source File -# Begin Source File - -SOURCE=..\..\IPassword.h -# End Source File -# Begin Source File - -SOURCE=..\..\IProgress.h -# End Source File -# Begin Source File - -SOURCE=..\..\IStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\PropID.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\DynamicBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\CodecsPath.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\CodecsPath.h -# End Source File -# Begin Source File - -SOURCE=..\Common\CoderLoader.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\CoderLoader.h -# End Source File -# Begin Source File - -SOURCE=..\Common\CoderMixer2.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\CoderMixer2.h -# End Source File -# Begin Source File - -SOURCE=..\Common\CoderMixer2MT.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\CoderMixer2MT.h -# End Source File -# Begin Source File - -SOURCE=..\Common\CrossThreadProgress.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\CrossThreadProgress.h -# End Source File -# Begin Source File - -SOURCE=..\Common\FilterCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\FilterCoder.h -# End Source File -# Begin Source File - -SOURCE=..\Common\InStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\InStreamWithCRC.h -# End Source File -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.h -# End Source File -# Begin Source File - -SOURCE=..\Common\MultiStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\MultiStream.h -# End Source File -# Begin Source File - -SOURCE=..\Common\OutStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\OutStreamWithCRC.h -# End Source File -# Begin Source File - -SOURCE=..\Common\ParseProperties.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ParseProperties.h -# End Source File -# End Group -# Begin Group "7-Zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\InOutTempBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InOutTempBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LockedStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LockedStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamBinder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamBinder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileDir.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileDir.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileIO.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileIO.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileName.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Handle.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Thread.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\7z.ico -# End Source File -# End Target -# End Project diff --git a/7zip/Archive/7z/7z.dsw b/7zip/Archive/7z/7z.dsw deleted file mode 100755 index 702a86c7..00000000 --- a/7zip/Archive/7z/7z.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "7z"=".\7z.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Archive/7z/7z.ico b/7zip/Archive/7z/7z.ico deleted file mode 100755 index 319753a1..00000000 Binary files a/7zip/Archive/7z/7z.ico and /dev/null differ diff --git a/7zip/Archive/7z/7zCompressionMode.cpp b/7zip/Archive/7z/7zCompressionMode.cpp deleted file mode 100755 index 6774fc48..00000000 --- a/7zip/Archive/7z/7zCompressionMode.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// CompressionMethod.cpp - -#include "StdAfx.h" diff --git a/7zip/Archive/7z/7zCompressionMode.h b/7zip/Archive/7z/7zCompressionMode.h deleted file mode 100755 index fe54e8a6..00000000 --- a/7zip/Archive/7z/7zCompressionMode.h +++ /dev/null @@ -1,64 +0,0 @@ -// 7zCompressionMode.h - -#ifndef __7Z_COMPRESSION_MODE_H -#define __7Z_COMPRESSION_MODE_H - -#include "../../../Windows/PropVariant.h" - -#include "7zMethodID.h" - -namespace NArchive { -namespace N7z { - -struct CProperty -{ - PROPID PropID; - NWindows::NCOM::CPropVariant Value; -}; - -struct CMethodFull -{ - CMethodID MethodID; - UInt32 NumInStreams; - UInt32 NumOutStreams; - bool IsSimpleCoder() const - { return (NumInStreams == 1) && (NumOutStreams == 1); } - - #ifdef EXCLUDE_COM - #else - CLSID EncoderClassID; - CSysString FilePath; - #endif - - CObjectVector CoderProperties; -}; - -struct CBind -{ - UInt32 InCoder; - UInt32 InStream; - UInt32 OutCoder; - UInt32 OutStream; -}; - -struct CCompressionMethodMode -{ - CObjectVector Methods; - CRecordVector Binds; - #ifdef COMPRESS_MT - UInt32 NumThreads; - #endif - bool PasswordIsDefined; - UString Password; - - bool IsEmpty() const { return (Methods.IsEmpty() && !PasswordIsDefined); } - CCompressionMethodMode(): PasswordIsDefined(false) - #ifdef COMPRESS_MT - , NumThreads(1) - #endif - {} -}; - -}} - -#endif diff --git a/7zip/Archive/7z/7zDecode.cpp b/7zip/Archive/7z/7zDecode.cpp deleted file mode 100755 index 5c58f817..00000000 --- a/7zip/Archive/7z/7zDecode.cpp +++ /dev/null @@ -1,444 +0,0 @@ -// 7zDecode.cpp - -#include "StdAfx.h" - -#include "7zDecode.h" - -#include "../../IPassword.h" -#include "../../Common/LockedStream.h" -#include "../../Common/StreamObjects.h" -#include "../../Common/ProgressUtils.h" -#include "../../Common/LimitedStreams.h" -#include "../Common/FilterCoder.h" - -#include "7zMethods.h" - -#ifdef COMPRESS_LZMA -#include "../../Compress/LZMA/LZMADecoder.h" -static NArchive::N7z::CMethodID k_LZMA = { { 0x3, 0x1, 0x1 }, 3 }; -#endif - -#ifdef COMPRESS_PPMD -#include "../../Compress/PPMD/PPMDDecoder.h" -static NArchive::N7z::CMethodID k_PPMD = { { 0x3, 0x4, 0x1 }, 3 }; -#endif - -#ifdef COMPRESS_BCJ_X86 -#include "../../Compress/Branch/x86.h" -static NArchive::N7z::CMethodID k_BCJ_X86 = { { 0x3, 0x3, 0x1, 0x3 }, 4 }; -#endif - -#ifdef COMPRESS_BCJ2 -#include "../../Compress/Branch/x86_2.h" -static NArchive::N7z::CMethodID k_BCJ2 = { { 0x3, 0x3, 0x1, 0x1B }, 4 }; -#endif - -#ifdef COMPRESS_DEFLATE -#ifndef COMPRESS_DEFLATE_DECODER -#define COMPRESS_DEFLATE_DECODER -#endif -#endif - -#ifdef COMPRESS_DEFLATE_DECODER -#include "../../Compress/Deflate/DeflateDecoder.h" -static NArchive::N7z::CMethodID k_Deflate = { { 0x4, 0x1, 0x8 }, 3 }; -#endif - -#ifdef COMPRESS_BZIP2 -#ifndef COMPRESS_BZIP2_DECODER -#define COMPRESS_BZIP2_DECODER -#endif -#endif - -#ifdef COMPRESS_BZIP2_DECODER -#include "../../Compress/BZip2/BZip2Decoder.h" -static NArchive::N7z::CMethodID k_BZip2 = { { 0x4, 0x2, 0x2 }, 3 }; -#endif - -#ifdef COMPRESS_COPY -#include "../../Compress/Copy/CopyCoder.h" -static NArchive::N7z::CMethodID k_Copy = { { 0x0 }, 1 }; -#endif - -#ifdef CRYPTO_7ZAES -#include "../../Crypto/7zAES/7zAES.h" -static NArchive::N7z::CMethodID k_7zAES = { { 0x6, 0xF1, 0x07, 0x01 }, 4 }; -#endif - -namespace NArchive { -namespace N7z { - -static void ConvertFolderItemInfoToBindInfo(const CFolder &folder, - CBindInfoEx &bindInfo) -{ - bindInfo.Clear(); - int i; - for (i = 0; i < folder.BindPairs.Size(); i++) - { - NCoderMixer2::CBindPair bindPair; - bindPair.InIndex = (UInt32)folder.BindPairs[i].InIndex; - bindPair.OutIndex = (UInt32)folder.BindPairs[i].OutIndex; - bindInfo.BindPairs.Add(bindPair); - } - UInt32 outStreamIndex = 0; - for (i = 0; i < folder.Coders.Size(); i++) - { - NCoderMixer2::CCoderStreamsInfo coderStreamsInfo; - const CCoderInfo &coderInfo = folder.Coders[i]; - coderStreamsInfo.NumInStreams = (UInt32)coderInfo.NumInStreams; - coderStreamsInfo.NumOutStreams = (UInt32)coderInfo.NumOutStreams; - bindInfo.Coders.Add(coderStreamsInfo); - const CAltCoderInfo &altCoderInfo = coderInfo.AltCoders.Front(); - bindInfo.CoderMethodIDs.Add(altCoderInfo.MethodID); - for (UInt32 j = 0; j < coderStreamsInfo.NumOutStreams; j++, outStreamIndex++) - if (folder.FindBindPairForOutStream(outStreamIndex) < 0) - bindInfo.OutStreams.Add(outStreamIndex); - } - for (i = 0; i < folder.PackStreams.Size(); i++) - bindInfo.InStreams.Add((UInt32)folder.PackStreams[i]); -} - -static bool AreCodersEqual(const NCoderMixer2::CCoderStreamsInfo &a1, - const NCoderMixer2::CCoderStreamsInfo &a2) -{ - return (a1.NumInStreams == a2.NumInStreams) && - (a1.NumOutStreams == a2.NumOutStreams); -} - -static bool AreBindPairsEqual(const NCoderMixer2::CBindPair &a1, const NCoderMixer2::CBindPair &a2) -{ - return (a1.InIndex == a2.InIndex) && - (a1.OutIndex == a2.OutIndex); -} - -static bool AreBindInfoExEqual(const CBindInfoEx &a1, const CBindInfoEx &a2) -{ - if (a1.Coders.Size() != a2.Coders.Size()) - return false; - int i; - for (i = 0; i < a1.Coders.Size(); i++) - if (!AreCodersEqual(a1.Coders[i], a2.Coders[i])) - return false; - if (a1.BindPairs.Size() != a2.BindPairs.Size()) - return false; - for (i = 0; i < a1.BindPairs.Size(); i++) - if (!AreBindPairsEqual(a1.BindPairs[i], a2.BindPairs[i])) - return false; - for (i = 0; i < a1.CoderMethodIDs.Size(); i++) - if (a1.CoderMethodIDs[i] != a2.CoderMethodIDs[i]) - return false; - if (a1.InStreams.Size() != a2.InStreams.Size()) - return false; - if (a1.OutStreams.Size() != a2.OutStreams.Size()) - return false; - return true; -} - -CDecoder::CDecoder(bool multiThread) -{ - #ifndef _ST_MODE - multiThread = true; - #endif - _multiThread = multiThread; - _bindInfoExPrevIsDefined = false; - #ifndef EXCLUDE_COM - LoadMethodMap(); - #endif -} - -HRESULT CDecoder::Decode(IInStream *inStream, - UInt64 startPos, - const UInt64 *packSizes, - const CFolder &folderInfo, - ISequentialOutStream *outStream, - ICompressProgressInfo *compressProgress - #ifndef _NO_CRYPTO - , ICryptoGetTextPassword *getTextPassword - #endif - #ifdef COMPRESS_MT - , bool mtMode, UInt32 numThreads - #endif - ) -{ - CObjectVector< CMyComPtr > inStreams; - - CLockedInStream lockedInStream; - lockedInStream.Init(inStream); - - for (int j = 0; j < folderInfo.PackStreams.Size(); j++) - { - CLockedSequentialInStreamImp *lockedStreamImpSpec = new - CLockedSequentialInStreamImp; - CMyComPtr lockedStreamImp = lockedStreamImpSpec; - lockedStreamImpSpec->Init(&lockedInStream, startPos); - startPos += packSizes[j]; - - CLimitedSequentialInStream *streamSpec = new - CLimitedSequentialInStream; - CMyComPtr inStream = streamSpec; - streamSpec->SetStream(lockedStreamImp); - streamSpec->Init(packSizes[j]); - inStreams.Add(inStream); - } - - int numCoders = folderInfo.Coders.Size(); - - CBindInfoEx bindInfo; - ConvertFolderItemInfoToBindInfo(folderInfo, bindInfo); - bool createNewCoders; - if (!_bindInfoExPrevIsDefined) - createNewCoders = true; - else - createNewCoders = !AreBindInfoExEqual(bindInfo, _bindInfoExPrev); - if (createNewCoders) - { - int i; - _decoders.Clear(); - // _decoders2.Clear(); - - _mixerCoder.Release(); - - if (_multiThread) - { - _mixerCoderMTSpec = new NCoderMixer2::CCoderMixer2MT; - _mixerCoder = _mixerCoderMTSpec; - _mixerCoderCommon = _mixerCoderMTSpec; - } - else - { - #ifdef _ST_MODE - _mixerCoderSTSpec = new NCoderMixer2::CCoderMixer2ST; - _mixerCoder = _mixerCoderSTSpec; - _mixerCoderCommon = _mixerCoderSTSpec; - #endif - } - _mixerCoderCommon->SetBindInfo(bindInfo); - - for (i = 0; i < numCoders; i++) - { - const CCoderInfo &coderInfo = folderInfo.Coders[i]; - const CAltCoderInfo &altCoderInfo = coderInfo.AltCoders.Front(); - #ifndef EXCLUDE_COM - CMethodInfo methodInfo; - if (!GetMethodInfo(altCoderInfo.MethodID, methodInfo)) - return E_NOTIMPL; - #endif - - if (coderInfo.IsSimpleCoder()) - { - CMyComPtr decoder; - CMyComPtr filter; - - #ifdef COMPRESS_LZMA - if (altCoderInfo.MethodID == k_LZMA) - decoder = new NCompress::NLZMA::CDecoder; - #endif - - #ifdef COMPRESS_PPMD - if (altCoderInfo.MethodID == k_PPMD) - decoder = new NCompress::NPPMD::CDecoder; - #endif - - #ifdef COMPRESS_BCJ_X86 - if (altCoderInfo.MethodID == k_BCJ_X86) - filter = new CBCJ_x86_Decoder; - #endif - - #ifdef COMPRESS_DEFLATE_DECODER - if (altCoderInfo.MethodID == k_Deflate) - decoder = new NCompress::NDeflate::NDecoder::CCOMCoder; - #endif - - #ifdef COMPRESS_BZIP2_DECODER - if (altCoderInfo.MethodID == k_BZip2) - decoder = new NCompress::NBZip2::CDecoder; - #endif - - #ifdef COMPRESS_COPY - if (altCoderInfo.MethodID == k_Copy) - decoder = new NCompress::CCopyCoder; - #endif - - #ifdef CRYPTO_7ZAES - if (altCoderInfo.MethodID == k_7zAES) - filter = new NCrypto::NSevenZ::CDecoder; - #endif - - if (filter) - { - CFilterCoder *coderSpec = new CFilterCoder; - decoder = coderSpec; - coderSpec->Filter = filter; - } - #ifndef EXCLUDE_COM - if (decoder == 0) - { - RINOK(_libraries.CreateCoderSpec(methodInfo.FilePath, - methodInfo.Decoder, &decoder)); - } - #endif - - if (decoder == 0) - return E_NOTIMPL; - - _decoders.Add((IUnknown *)decoder); - - if (_multiThread) - _mixerCoderMTSpec->AddCoder(decoder); - #ifdef _ST_MODE - else - _mixerCoderSTSpec->AddCoder(decoder, false); - #endif - } - else - { - CMyComPtr decoder; - - #ifdef COMPRESS_BCJ2 - if (altCoderInfo.MethodID == k_BCJ2) - decoder = new CBCJ2_x86_Decoder; - #endif - - #ifndef EXCLUDE_COM - if (decoder == 0) - { - RINOK(_libraries.CreateCoder2(methodInfo.FilePath, - methodInfo.Decoder, &decoder)); - } - #endif - - if (decoder == 0) - return E_NOTIMPL; - - _decoders.Add((IUnknown *)decoder); - if (_multiThread) - _mixerCoderMTSpec->AddCoder2(decoder); - #ifdef _ST_MODE - else - _mixerCoderSTSpec->AddCoder2(decoder, false); - #endif - } - } - _bindInfoExPrev = bindInfo; - _bindInfoExPrevIsDefined = true; - } - int i; - _mixerCoderCommon->ReInit(); - - UInt32 packStreamIndex = 0, unPackStreamIndex = 0; - UInt32 coderIndex = 0; - // UInt32 coder2Index = 0; - - for (i = 0; i < numCoders; i++) - { - const CCoderInfo &coderInfo = folderInfo.Coders[i]; - const CAltCoderInfo &altCoderInfo = coderInfo.AltCoders.Front(); - CMyComPtr &decoder = _decoders[coderIndex]; - - { - CMyComPtr setDecoderProperties; - decoder.QueryInterface(IID_ICompressSetDecoderProperties2, &setDecoderProperties); - if (setDecoderProperties) - { - const CByteBuffer &properties = altCoderInfo.Properties; - size_t size = properties.GetCapacity(); - if (size > 0xFFFFFFFF) - return E_NOTIMPL; - if (size > 0) - { - RINOK(setDecoderProperties->SetDecoderProperties2((const Byte *)properties, (UInt32)size)); - } - } - } - - #ifdef COMPRESS_MT - if (mtMode) - { - CMyComPtr setCoderMt; - decoder.QueryInterface(IID_ICompressSetCoderMt, &setCoderMt); - if (setCoderMt) - { - RINOK(setCoderMt->SetNumberOfThreads(numThreads)); - } - } - #endif - - #ifndef _NO_CRYPTO - { - CMyComPtr cryptoSetPassword; - decoder.QueryInterface(IID_ICryptoSetPassword, &cryptoSetPassword); - if (cryptoSetPassword) - { - if (getTextPassword == 0) - return E_FAIL; - CMyComBSTR password; - RINOK(getTextPassword->CryptoGetTextPassword(&password)); - CByteBuffer buffer; - UString unicodePassword(password); - const UInt32 sizeInBytes = unicodePassword.Length() * 2; - buffer.SetCapacity(sizeInBytes); - for (int i = 0; i < unicodePassword.Length(); i++) - { - wchar_t c = unicodePassword[i]; - ((Byte *)buffer)[i * 2] = (Byte)c; - ((Byte *)buffer)[i * 2 + 1] = (Byte)(c >> 8); - } - RINOK(cryptoSetPassword->CryptoSetPassword( - (const Byte *)buffer, sizeInBytes)); - } - } - #endif - - coderIndex++; - - UInt32 numInStreams = (UInt32)coderInfo.NumInStreams; - UInt32 numOutStreams = (UInt32)coderInfo.NumOutStreams; - CRecordVector packSizesPointers; - CRecordVector unPackSizesPointers; - packSizesPointers.Reserve(numInStreams); - unPackSizesPointers.Reserve(numOutStreams); - UInt32 j; - for (j = 0; j < numOutStreams; j++, unPackStreamIndex++) - unPackSizesPointers.Add(&folderInfo.UnPackSizes[unPackStreamIndex]); - - for (j = 0; j < numInStreams; j++, packStreamIndex++) - { - int bindPairIndex = folderInfo.FindBindPairForInStream(packStreamIndex); - if (bindPairIndex >= 0) - packSizesPointers.Add( - &folderInfo.UnPackSizes[(UInt32)folderInfo.BindPairs[bindPairIndex].OutIndex]); - else - { - int index = folderInfo.FindPackStreamArrayIndex(packStreamIndex); - if (index < 0) - return E_FAIL; - packSizesPointers.Add(&packSizes[index]); - } - } - - _mixerCoderCommon->SetCoderInfo(i, - &packSizesPointers.Front(), - &unPackSizesPointers.Front()); - } - UInt32 mainCoder, temp; - bindInfo.FindOutStream(bindInfo.OutStreams[0], mainCoder, temp); - - if (_multiThread) - _mixerCoderMTSpec->SetProgressCoderIndex(mainCoder); - /* - else - _mixerCoderSTSpec->SetProgressCoderIndex(mainCoder);; - */ - - if (numCoders == 0) - return 0; - CRecordVector inStreamPointers; - inStreamPointers.Reserve(inStreams.Size()); - for (i = 0; i < inStreams.Size(); i++) - inStreamPointers.Add(inStreams[i]); - ISequentialOutStream *outStreamPointer = outStream; - return _mixerCoder->Code(&inStreamPointers.Front(), NULL, - inStreams.Size(), &outStreamPointer, NULL, 1, compressProgress); -} - -}} diff --git a/7zip/Archive/7z/7zDecode.h b/7zip/Archive/7z/7zDecode.h deleted file mode 100755 index 50f80d4c..00000000 --- a/7zip/Archive/7z/7zDecode.h +++ /dev/null @@ -1,71 +0,0 @@ -// 7zDecode.h - -#ifndef __7Z_DECODE_H -#define __7Z_DECODE_H - -#include "../../IStream.h" -#include "../../IPassword.h" - -#include "../Common/CoderMixer2.h" -#include "../Common/CoderMixer2MT.h" -#ifdef _ST_MODE -#include "../Common/CoderMixer2ST.h" -#endif -#ifndef EXCLUDE_COM -#include "../Common/CoderLoader.h" -#endif - -#include "7zItem.h" - -namespace NArchive { -namespace N7z { - -struct CBindInfoEx: public NCoderMixer2::CBindInfo -{ - CRecordVector CoderMethodIDs; - void Clear() - { - CBindInfo::Clear(); - CoderMethodIDs.Clear(); - } -}; - -class CDecoder -{ - #ifndef EXCLUDE_COM - CCoderLibraries _libraries; - #endif - - bool _bindInfoExPrevIsDefined; - CBindInfoEx _bindInfoExPrev; - - bool _multiThread; - #ifdef _ST_MODE - NCoderMixer2::CCoderMixer2ST *_mixerCoderSTSpec; - #endif - NCoderMixer2::CCoderMixer2MT *_mixerCoderMTSpec; - NCoderMixer2::CCoderMixer2 *_mixerCoderCommon; - - CMyComPtr _mixerCoder; - CObjectVector > _decoders; - // CObjectVector > _decoders2; -public: - CDecoder(bool multiThread); - HRESULT Decode(IInStream *inStream, - UInt64 startPos, - const UInt64 *packSizes, - const CFolder &folder, - ISequentialOutStream *outStream, - ICompressProgressInfo *compressProgress - #ifndef _NO_CRYPTO - , ICryptoGetTextPassword *getTextPasswordSpec - #endif - #ifdef COMPRESS_MT - , bool mtMode, UInt32 numThreads - #endif - ); -}; - -}} - -#endif diff --git a/7zip/Archive/7z/7zEncode.cpp b/7zip/Archive/7z/7zEncode.cpp deleted file mode 100755 index a9fe2d0a..00000000 --- a/7zip/Archive/7z/7zEncode.cpp +++ /dev/null @@ -1,614 +0,0 @@ -// Encode.cpp - -#include "StdAfx.h" - -#include "7zEncode.h" -#include "7zSpecStream.h" -#include "7zMethods.h" - -#include "../../IPassword.h" -#include "../../Common/ProgressUtils.h" -#include "../../Common/LimitedStreams.h" -#include "../../Common/InOutTempBuffer.h" -#include "../../Common/StreamObjects.h" -#include "../Common/FilterCoder.h" - -#ifdef COMPRESS_COPY -static NArchive::N7z::CMethodID k_Copy = { { 0x0 }, 1 }; -#include "../../Compress/Copy/CopyCoder.h" -#endif - -static NArchive::N7z::CMethodID k_LZMA = { { 0x3, 0x1, 0x1 }, 3 }; -static NArchive::N7z::CMethodID k_LZMA2 = { { 0x3, 0x1, 0x2 }, 3 }; - -#ifdef COMPRESS_LZMA -#include "../../Compress/LZMA/LZMAEncoder.h" -#endif - -#ifdef COMPRESS_PPMD -#include "../../Compress/PPMD/PPMDEncoder.h" -static NArchive::N7z::CMethodID k_PPMD = { { 0x3, 0x4, 0x1 }, 3 }; -#endif - -#ifdef COMPRESS_BCJ_X86 -static NArchive::N7z::CMethodID k_BCJ_X86 = { { 0x3, 0x3, 0x1, 0x3 }, 4 }; -#include "../../Compress/Branch/x86.h" -#endif - -#ifdef COMPRESS_BCJ2 -static NArchive::N7z::CMethodID k_BCJ2 = { { 0x3, 0x3, 0x1, 0x1B }, 4 }; -#include "../../Compress/Branch/x86_2.h" -#endif - -#ifdef COMPRESS_DEFLATE -#ifndef COMPRESS_DEFLATE_ENCODER -#define COMPRESS_DEFLATE_ENCODER -#endif -#endif - -#ifdef COMPRESS_DEFLATE_ENCODER -#include "../../Compress/Deflate/DeflateEncoder.h" -static NArchive::N7z::CMethodID k_Deflate = { { 0x4, 0x1, 0x8 }, 3 }; -#endif - -#ifdef COMPRESS_BZIP2 -#ifndef COMPRESS_BZIP2_ENCODER -#define COMPRESS_BZIP2_ENCODER -#endif -#endif - -#ifdef COMPRESS_BZIP2_ENCODER -#include "../../Compress/BZip2/BZip2Encoder.h" -static NArchive::N7z::CMethodID k_BZip2 = { { 0x4, 0x2, 0x2 }, 3 }; -#endif - -static NArchive::N7z::CMethodID k_AES = { { 0x6, 0xF1, 0x7, 0x1}, 4 }; - -#ifndef EXCLUDE_COM -static const wchar_t *kCryproMethod = L"7zAES"; -/* -// {23170F69-40C1-278B-06F1-070100000100} -DEFINE_GUID(CLSID_CCrypto7zAESEncoder, -0x23170F69, 0x40C1, 0x278B, 0x06, 0xF1, 0x07, 0x01, 0x00, 0x00, 0x01, 0x00); -*/ -#endif - -#ifdef CRYPTO_7ZAES -#include "../../Crypto/7zAES/7zAES.h" -#endif - -namespace NArchive { -namespace N7z { - -static void ConvertBindInfoToFolderItemInfo(const NCoderMixer2::CBindInfo &bindInfo, - const CRecordVector decompressionMethods, - CFolder &folder) -{ - folder.Coders.Clear(); - // bindInfo.CoderMethodIDs.Clear(); - // folder.OutStreams.Clear(); - folder.PackStreams.Clear(); - folder.BindPairs.Clear(); - int i; - for (i = 0; i < bindInfo.BindPairs.Size(); i++) - { - CBindPair bindPair; - bindPair.InIndex = bindInfo.BindPairs[i].InIndex; - bindPair.OutIndex = bindInfo.BindPairs[i].OutIndex; - folder.BindPairs.Add(bindPair); - } - for (i = 0; i < bindInfo.Coders.Size(); i++) - { - CCoderInfo coderInfo; - const NCoderMixer2::CCoderStreamsInfo &coderStreamsInfo = bindInfo.Coders[i]; - coderInfo.NumInStreams = coderStreamsInfo.NumInStreams; - coderInfo.NumOutStreams = coderStreamsInfo.NumOutStreams; - - // coderInfo.MethodID = decompressionMethods[i]; - // if (coderInfo.AltCoders.Size() == 0) - coderInfo.AltCoders.Add(CAltCoderInfo()); - CAltCoderInfo &altCoderInfo = coderInfo.AltCoders.Front(); - altCoderInfo.MethodID = decompressionMethods[i]; - - folder.Coders.Add(coderInfo); - } - for (i = 0; i < bindInfo.InStreams.Size(); i++) - folder.PackStreams.Add(bindInfo.InStreams[i]); -} - -HRESULT CEncoder::CreateMixerCoder(const UInt64 *inSizeForReduce) -{ - _mixerCoderSpec = new NCoderMixer2::CCoderMixer2MT; - _mixerCoder = _mixerCoderSpec; - _mixerCoderSpec->SetBindInfo(_bindInfo); - for (int i = 0; i < _options.Methods.Size(); i++) - { - const CMethodFull &methodFull = _options.Methods[i]; - _codersInfo.Add(CCoderInfo()); - CCoderInfo &encodingInfo = _codersInfo.Back(); - CMyComPtr encoder; - CMyComPtr filter; - CMyComPtr encoder2; - - if (methodFull.IsSimpleCoder()) - { - #ifdef COMPRESS_LZMA - if (methodFull.MethodID == k_LZMA) - encoder = new NCompress::NLZMA::CEncoder; - #endif - - #ifdef COMPRESS_PPMD - if (methodFull.MethodID == k_PPMD) - encoder = new NCompress::NPPMD::CEncoder; - #endif - - #ifdef COMPRESS_BCJ_X86 - if (methodFull.MethodID == k_BCJ_X86) - filter = new CBCJ_x86_Encoder; - #endif - - #ifdef COMPRESS_COPY - if (methodFull.MethodID == k_Copy) - encoder = new NCompress::CCopyCoder; - #endif - - #ifdef COMPRESS_BZIP2_ENCODER - if (methodFull.MethodID == k_BZip2) - encoder = new NCompress::NBZip2::CEncoder; - #endif - - #ifdef COMPRESS_DEFLATE_ENCODER - if (methodFull.MethodID == k_Deflate) - encoder = new NCompress::NDeflate::NEncoder::CCOMCoder; - #endif - - #ifdef CRYPTO_7ZAES - if (methodFull.MethodID == k_AES) - filter = new NCrypto::NSevenZ::CEncoder; - #endif - - if (filter) - { - CFilterCoder *coderSpec = new CFilterCoder; - encoder = coderSpec; - coderSpec->Filter = filter; - } - - #ifndef EXCLUDE_COM - if (encoder == 0) - { - RINOK(_libraries.CreateCoderSpec(methodFull.FilePath, - methodFull.EncoderClassID, &encoder)); - } - #endif - - if (encoder == 0) - return E_FAIL; - - } - else - { - #ifdef COMPRESS_BCJ2 - if (methodFull.MethodID == k_BCJ2) - encoder2 = new CBCJ2_x86_Encoder; - #endif - - #ifndef EXCLUDE_COM - if (encoder2 == 0) - { - RINOK(_libraries.CreateCoder2(methodFull.FilePath, - methodFull.EncoderClassID, &encoder2)); - } - #else - - if (encoder2 == 0) - return E_FAIL; - #endif - } - - bool tryReduce = false; - UInt32 reducedDictionarySize = 1 << 10; - if (inSizeForReduce != 0 && (methodFull.MethodID == k_LZMA || methodFull.MethodID == k_LZMA2)) - { - for (;;) - { - const UInt32 step = (reducedDictionarySize >> 1); - if (reducedDictionarySize >= *inSizeForReduce) - { - tryReduce = true; - break; - } - reducedDictionarySize += step; - if (reducedDictionarySize >= *inSizeForReduce) - { - tryReduce = true; - break; - } - if (reducedDictionarySize >= ((UInt32)11 << 30)) - break; - reducedDictionarySize += step; - } - } - - CMyComPtr encoderCommon = methodFull.IsSimpleCoder() ? (IUnknown *)encoder : (IUnknown *)encoder2; - - #ifdef COMPRESS_MT - { - CMyComPtr setCoderMt; - encoderCommon.QueryInterface(IID_ICompressSetCoderMt, &setCoderMt); - if (setCoderMt) - { - RINOK(setCoderMt->SetNumberOfThreads(_options.NumThreads)); - } - } - #endif - - if (methodFull.CoderProperties.Size() > 0) - { - CRecordVector propIDs; - int numProperties = methodFull.CoderProperties.Size(); - NWindows::NCOM::CPropVariant *values = new NWindows::NCOM::CPropVariant[numProperties]; - try - { - for (int i = 0; i < numProperties; i++) - { - const CProperty &property = methodFull.CoderProperties[i]; - propIDs.Add(property.PropID); - NWindows::NCOM::CPropVariant value = property.Value; - if (tryReduce && property.PropID == NCoderPropID::kDictionarySize && value.vt == VT_UI4 && reducedDictionarySize < value.ulVal) - value.ulVal = reducedDictionarySize; - values[i] = value; - } - CMyComPtr setCoderProperties; - RINOK(encoderCommon.QueryInterface(IID_ICompressSetCoderProperties, &setCoderProperties)); - RINOK(setCoderProperties->SetCoderProperties(&propIDs.Front(), values, numProperties)); - } - catch(...) - { - delete []values; - throw; - } - delete []values; - } - - CMyComPtr writeCoderProperties; - - encoderCommon.QueryInterface(IID_ICompressWriteCoderProperties, &writeCoderProperties); - - if (writeCoderProperties != NULL) - { - CSequentialOutStreamImp *outStreamSpec = new CSequentialOutStreamImp; - CMyComPtr outStream(outStreamSpec); - outStreamSpec->Init(); - writeCoderProperties->WriteCoderProperties(outStream); - - size_t size = outStreamSpec->GetSize(); - - // encodingInfo.Properties.SetCapacity(size); - if (encodingInfo.AltCoders.Size() == 0) - encodingInfo.AltCoders.Add(CAltCoderInfo()); - CAltCoderInfo &altCoderInfo = encodingInfo.AltCoders.Front(); - altCoderInfo.Properties.SetCapacity(size); - - memmove(altCoderInfo.Properties, outStreamSpec->GetBuffer(), size); - } - - CMyComPtr cryptoSetPassword; - encoderCommon.QueryInterface(IID_ICryptoSetPassword, &cryptoSetPassword); - - if (cryptoSetPassword) - { - CByteBuffer buffer; - const UInt32 sizeInBytes = _options.Password.Length() * 2; - buffer.SetCapacity(sizeInBytes); - for (int i = 0; i < _options.Password.Length(); i++) - { - wchar_t c = _options.Password[i]; - ((Byte *)buffer)[i * 2] = (Byte)c; - ((Byte *)buffer)[i * 2 + 1] = (Byte)(c >> 8); - } - RINOK(cryptoSetPassword->CryptoSetPassword((const Byte *)buffer, sizeInBytes)); - } - - if (methodFull.IsSimpleCoder()) - _mixerCoderSpec->AddCoder(encoder); - else - _mixerCoderSpec->AddCoder2(encoder2); - } - return S_OK; -} - -HRESULT CEncoder::Encode(ISequentialInStream *inStream, - const UInt64 *inStreamSize, const UInt64 *inSizeForReduce, - CFolder &folderItem, - ISequentialOutStream *outStream, - CRecordVector &packSizes, - ICompressProgressInfo *compressProgress) -{ - if (_mixerCoderSpec == NULL) - { - RINOK(CreateMixerCoder(inSizeForReduce)); - } - _mixerCoderSpec->ReInit(); - // _mixerCoderSpec->SetCoderInfo(0, NULL, NULL, progress); - - CObjectVector inOutTempBuffers; - CObjectVector tempBufferSpecs; - CObjectVector > tempBuffers; - int numMethods = _bindInfo.Coders.Size(); - int i; - for (i = 1; i < _bindInfo.OutStreams.Size(); i++) - { - inOutTempBuffers.Add(CInOutTempBuffer()); - inOutTempBuffers.Back().Create(); - inOutTempBuffers.Back().InitWriting(); - } - for (i = 1; i < _bindInfo.OutStreams.Size(); i++) - { - CSequentialOutTempBufferImp *tempBufferSpec = - new CSequentialOutTempBufferImp; - CMyComPtr tempBuffer = tempBufferSpec; - tempBufferSpec->Init(&inOutTempBuffers[i - 1]); - tempBuffers.Add(tempBuffer); - tempBufferSpecs.Add(tempBufferSpec); - } - - for (i = 0; i < numMethods; i++) - _mixerCoderSpec->SetCoderInfo(i, NULL, NULL); - - if (_bindInfo.InStreams.IsEmpty()) - return E_FAIL; - UInt32 mainCoderIndex, mainStreamIndex; - _bindInfo.FindInStream(_bindInfo.InStreams[0], mainCoderIndex, mainStreamIndex); - _mixerCoderSpec->SetProgressCoderIndex(mainCoderIndex); - if (inStreamSize != NULL) - { - CRecordVector sizePointers; - for (UInt32 i = 0; i < _bindInfo.Coders[mainCoderIndex].NumInStreams; i++) - if (i == mainStreamIndex) - sizePointers.Add(inStreamSize); - else - sizePointers.Add(NULL); - _mixerCoderSpec->SetCoderInfo(mainCoderIndex, &sizePointers.Front(), NULL); - } - - - // UInt64 outStreamStartPos; - // RINOK(stream->Seek(0, STREAM_SEEK_CUR, &outStreamStartPos)); - - CSequentialInStreamSizeCount2 *inStreamSizeCountSpec = - new CSequentialInStreamSizeCount2; - CMyComPtr inStreamSizeCount = inStreamSizeCountSpec; - CSequentialOutStreamSizeCount *outStreamSizeCountSpec = - new CSequentialOutStreamSizeCount; - CMyComPtr outStreamSizeCount = outStreamSizeCountSpec; - - inStreamSizeCountSpec->Init(inStream); - outStreamSizeCountSpec->SetStream(outStream); - outStreamSizeCountSpec->Init(); - - CRecordVector inStreamPointers; - CRecordVector outStreamPointers; - inStreamPointers.Add(inStreamSizeCount); - outStreamPointers.Add(outStreamSizeCount); - for (i = 1; i < _bindInfo.OutStreams.Size(); i++) - outStreamPointers.Add(tempBuffers[i - 1]); - - RINOK(_mixerCoder->Code(&inStreamPointers.Front(), NULL, 1, - &outStreamPointers.Front(), NULL, outStreamPointers.Size(), compressProgress)); - - ConvertBindInfoToFolderItemInfo(_decompressBindInfo, _decompressionMethods, - folderItem); - - packSizes.Add(outStreamSizeCountSpec->GetSize()); - - for (i = 1; i < _bindInfo.OutStreams.Size(); i++) - { - CInOutTempBuffer &inOutTempBuffer = inOutTempBuffers[i - 1]; - inOutTempBuffer.FlushWrite(); - inOutTempBuffer.InitReading(); - inOutTempBuffer.WriteToStream(outStream); - packSizes.Add(inOutTempBuffer.GetDataSize()); - } - - for (i = 0; i < (int)_bindReverseConverter->NumSrcInStreams; i++) - { - int binder = _bindInfo.FindBinderForInStream( - _bindReverseConverter->DestOutToSrcInMap[i]); - UInt64 streamSize; - if (binder < 0) - streamSize = inStreamSizeCountSpec->GetSize(); - else - streamSize = _mixerCoderSpec->GetWriteProcessedSize(binder); - folderItem.UnPackSizes.Add(streamSize); - } - for (i = numMethods - 1; i >= 0; i--) - { - // folderItem.Coders[numMethods - 1 - i].Properties = _codersInfo[i].Properties; - for (int j = 0; j < _codersInfo[i].AltCoders.Size(); j++) - folderItem.Coders[numMethods - 1 - i].AltCoders[j].Properties - = _codersInfo[i].AltCoders[j].Properties; - } - return S_OK; -} - - -CEncoder::CEncoder(const CCompressionMethodMode &options): - _bindReverseConverter(0) -{ - if (options.IsEmpty()) - throw 1; - - _options = options; - _mixerCoderSpec = NULL; - - if (options.Methods.IsEmpty()) - { - // it has only password method; - if (!options.PasswordIsDefined) - throw 1; - if (!options.Binds.IsEmpty()) - throw 1; - NCoderMixer2::CCoderStreamsInfo coderStreamsInfo; - CMethodFull method; - - method.NumInStreams = 1; - method.NumOutStreams = 1; - coderStreamsInfo.NumInStreams = method.NumOutStreams; - coderStreamsInfo.NumOutStreams = method.NumInStreams; - method.MethodID = k_AES; - - - #ifndef EXCLUDE_COM - CMethodInfo2 methodInfo; - if (!GetMethodInfo(kCryproMethod, methodInfo)) - throw 2; - method.FilePath = methodInfo.FilePath; - method.EncoderClassID = methodInfo.Encoder; - // method.EncoderClassID = CLSID_CCrypto7zAESEncoder; - #endif - - _options.Methods.Add(method); - _bindInfo.Coders.Add(coderStreamsInfo); - - _bindInfo.InStreams.Add(0); - _bindInfo.OutStreams.Add(0); - } - else - { - - UInt32 numInStreams = 0, numOutStreams = 0; - int i; - for (i = 0; i < options.Methods.Size(); i++) - { - const CMethodFull &methodFull = options.Methods[i]; - NCoderMixer2::CCoderStreamsInfo coderStreamsInfo; - coderStreamsInfo.NumInStreams = methodFull.NumOutStreams; - coderStreamsInfo.NumOutStreams = methodFull.NumInStreams; - if (options.Binds.IsEmpty()) - { - if (i < options.Methods.Size() - 1) - { - NCoderMixer2::CBindPair bindPair; - bindPair.InIndex = numInStreams + coderStreamsInfo.NumInStreams; - bindPair.OutIndex = numOutStreams; - _bindInfo.BindPairs.Add(bindPair); - } - else - _bindInfo.OutStreams.Insert(0, numOutStreams); - for (UInt32 j = 1; j < coderStreamsInfo.NumOutStreams; j++) - _bindInfo.OutStreams.Add(numOutStreams + j); - } - - numInStreams += coderStreamsInfo.NumInStreams; - numOutStreams += coderStreamsInfo.NumOutStreams; - - _bindInfo.Coders.Add(coderStreamsInfo); - } - - if (!options.Binds.IsEmpty()) - { - for (i = 0; i < options.Binds.Size(); i++) - { - NCoderMixer2::CBindPair bindPair; - const CBind &bind = options.Binds[i]; - bindPair.InIndex = _bindInfo.GetCoderInStreamIndex(bind.InCoder) + bind.InStream; - bindPair.OutIndex = _bindInfo.GetCoderOutStreamIndex(bind.OutCoder) + bind.OutStream; - _bindInfo.BindPairs.Add(bindPair); - } - for (i = 0; i < (int)numOutStreams; i++) - if (_bindInfo.FindBinderForOutStream(i) == -1) - _bindInfo.OutStreams.Add(i); - } - - for (i = 0; i < (int)numInStreams; i++) - if (_bindInfo.FindBinderForInStream(i) == -1) - _bindInfo.InStreams.Add(i); - - if (_bindInfo.InStreams.IsEmpty()) - throw 1; // this is error - - // Make main stream first in list - int inIndex = _bindInfo.InStreams[0]; - for (;;) - { - UInt32 coderIndex, coderStreamIndex; - _bindInfo.FindInStream(inIndex, coderIndex, coderStreamIndex); - UInt32 outIndex = _bindInfo.GetCoderOutStreamIndex(coderIndex); - int binder = _bindInfo.FindBinderForOutStream(outIndex); - if (binder >= 0) - { - inIndex = _bindInfo.BindPairs[binder].InIndex; - continue; - } - for (i = 0; i < _bindInfo.OutStreams.Size(); i++) - if (_bindInfo.OutStreams[i] == outIndex) - { - _bindInfo.OutStreams.Delete(i); - _bindInfo.OutStreams.Insert(0, outIndex); - break; - } - break; - } - - if (_options.PasswordIsDefined) - { - int numCryptoStreams = _bindInfo.OutStreams.Size(); - - for (i = 0; i < numCryptoStreams; i++) - { - NCoderMixer2::CBindPair bindPair; - bindPair.InIndex = numInStreams + i; - bindPair.OutIndex = _bindInfo.OutStreams[i]; - _bindInfo.BindPairs.Add(bindPair); - } - _bindInfo.OutStreams.Clear(); - - /* - if (numCryptoStreams == 0) - numCryptoStreams = 1; - */ - - for (i = 0; i < numCryptoStreams; i++) - { - NCoderMixer2::CCoderStreamsInfo coderStreamsInfo; - CMethodFull method; - method.NumInStreams = 1; - method.NumOutStreams = 1; - coderStreamsInfo.NumInStreams = method.NumOutStreams; - coderStreamsInfo.NumOutStreams = method.NumInStreams; - method.MethodID = k_AES; - - #ifndef EXCLUDE_COM - CMethodInfo2 methodInfo; - if (!GetMethodInfo(kCryproMethod, methodInfo)) - throw 2; - method.FilePath = methodInfo.FilePath; - method.EncoderClassID = methodInfo.Encoder; - // method.EncoderClassID = CLSID_CCrypto7zAESEncoder; - #endif - - _options.Methods.Add(method); - _bindInfo.Coders.Add(coderStreamsInfo); - _bindInfo.OutStreams.Add(numOutStreams + i); - } - } - - } - - for (int i = _options.Methods.Size() - 1; i >= 0; i--) - { - const CMethodFull &methodFull = _options.Methods[i]; - _decompressionMethods.Add(methodFull.MethodID); - } - - _bindReverseConverter = new NCoderMixer2::CBindReverseConverter(_bindInfo); - _bindReverseConverter->CreateReverseBindInfo(_decompressBindInfo); -} - -CEncoder::~CEncoder() -{ - delete _bindReverseConverter; -} - -}} diff --git a/7zip/Archive/7z/7zEncode.h b/7zip/Archive/7z/7zEncode.h deleted file mode 100755 index 04a8c37b..00000000 --- a/7zip/Archive/7z/7zEncode.h +++ /dev/null @@ -1,56 +0,0 @@ -// 7zEncode.h - -#ifndef __7Z_ENCODE_H -#define __7Z_ENCODE_H - -// #include "../../Common/StreamObjects.h" - -#include "7zCompressionMode.h" - -#include "../Common/CoderMixer2.h" -#include "../Common/CoderMixer2MT.h" -#include "../Common/CoderMixer2ST.h" -#ifndef EXCLUDE_COM -#include "../Common/CoderLoader.h" -#endif -#include "7zMethods.h" -#include "7zItem.h" - -namespace NArchive { -namespace N7z { - -class CEncoder -{ - #ifndef EXCLUDE_COM - // CMethodMap _methodMap; - // it must be in top of objects - CCoderLibraries _libraries; - #endif - - NCoderMixer2::CCoderMixer2MT *_mixerCoderSpec; - CMyComPtr _mixerCoder; - - CObjectVector _codersInfo; - - CCompressionMethodMode _options; - NCoderMixer2::CBindInfo _bindInfo; - NCoderMixer2::CBindInfo _decompressBindInfo; - NCoderMixer2::CBindReverseConverter *_bindReverseConverter; - CRecordVector _decompressionMethods; - - HRESULT CreateMixerCoder(const UInt64 *inSizeForReduce); - -public: - CEncoder(const CCompressionMethodMode &options); - ~CEncoder(); - HRESULT Encode(ISequentialInStream *inStream, - const UInt64 *inStreamSize, const UInt64 *inSizeForReduce, - CFolder &folderItem, - ISequentialOutStream *outStream, - CRecordVector &packSizes, - ICompressProgressInfo *compressProgress); -}; - -}} - -#endif diff --git a/7zip/Archive/7z/7zExtract.cpp b/7zip/Archive/7z/7zExtract.cpp deleted file mode 100755 index 540241f7..00000000 --- a/7zip/Archive/7z/7zExtract.cpp +++ /dev/null @@ -1,265 +0,0 @@ -// 7zExtract.cpp - -#include "StdAfx.h" - -#include "7zHandler.h" -#include "7zFolderOutStream.h" -#include "7zMethods.h" -#include "7zDecode.h" -// #include "7z1Decode.h" - -#include "../../../Common/ComTry.h" -#include "../../Common/StreamObjects.h" -#include "../../Common/ProgressUtils.h" -#include "../../Common/LimitedStreams.h" - -namespace NArchive { -namespace N7z { - -struct CExtractFolderInfo -{ - #ifdef _7Z_VOL - int VolumeIndex; - #endif - CNum FileIndex; - CNum FolderIndex; - CBoolVector ExtractStatuses; - UInt64 UnPackSize; - CExtractFolderInfo( - #ifdef _7Z_VOL - int volumeIndex, - #endif - CNum fileIndex, CNum folderIndex): - #ifdef _7Z_VOL - VolumeIndex(volumeIndex), - #endif - FileIndex(fileIndex), - FolderIndex(folderIndex), - UnPackSize(0) - { - if (fileIndex != kNumNoIndex) - { - ExtractStatuses.Reserve(1); - ExtractStatuses.Add(true); - } - }; -}; - -STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, - Int32 testModeSpec, IArchiveExtractCallback *extractCallbackSpec) -{ - COM_TRY_BEGIN - bool testMode = (testModeSpec != 0); - CMyComPtr extractCallback = extractCallbackSpec; - UInt64 importantTotalUnPacked = 0; - - bool allFilesMode = (numItems == UInt32(-1)); - if (allFilesMode) - numItems = - #ifdef _7Z_VOL - _refs.Size(); - #else - _database.Files.Size(); - #endif - - if(numItems == 0) - return S_OK; - - /* - if(_volumes.Size() != 1) - return E_FAIL; - const CVolume &volume = _volumes.Front(); - const CArchiveDatabaseEx &_database = volume.Database; - IInStream *_inStream = volume.Stream; - */ - - CObjectVector extractFolderInfoVector; - for(UInt32 ii = 0; ii < numItems; ii++) - { - // UInt32 fileIndex = allFilesMode ? indexIndex : indices[indexIndex]; - UInt32 ref2Index = allFilesMode ? ii : indices[ii]; - // const CRef2 &ref2 = _refs[ref2Index]; - - // for(UInt32 ri = 0; ri < ref2.Refs.Size(); ri++) - { - #ifdef _7Z_VOL - // const CRef &ref = ref2.Refs[ri]; - const CRef &ref = _refs[ref2Index]; - - int volumeIndex = ref.VolumeIndex; - const CVolume &volume = _volumes[volumeIndex]; - const CArchiveDatabaseEx &database = volume.Database; - UInt32 fileIndex = ref.ItemIndex; - #else - const CArchiveDatabaseEx &database = _database; - UInt32 fileIndex = ref2Index; - #endif - - CNum folderIndex = database.FileIndexToFolderIndexMap[fileIndex]; - if (folderIndex == kNumNoIndex) - { - extractFolderInfoVector.Add(CExtractFolderInfo( - #ifdef _7Z_VOL - volumeIndex, - #endif - fileIndex, kNumNoIndex)); - continue; - } - if (extractFolderInfoVector.IsEmpty() || - folderIndex != extractFolderInfoVector.Back().FolderIndex - #ifdef _7Z_VOL - || volumeIndex != extractFolderInfoVector.Back().VolumeIndex - #endif - ) - { - extractFolderInfoVector.Add(CExtractFolderInfo( - #ifdef _7Z_VOL - volumeIndex, - #endif - kNumNoIndex, folderIndex)); - const CFolder &folderInfo = database.Folders[folderIndex]; - UInt64 unPackSize = folderInfo.GetUnPackSize(); - importantTotalUnPacked += unPackSize; - extractFolderInfoVector.Back().UnPackSize = unPackSize; - } - - CExtractFolderInfo &efi = extractFolderInfoVector.Back(); - - // const CFolderInfo &folderInfo = m_dam_Folders[folderIndex]; - CNum startIndex = database.FolderStartFileIndex[folderIndex]; - for (CNum index = efi.ExtractStatuses.Size(); - index <= fileIndex - startIndex; index++) - { - // UInt64 unPackSize = _database.Files[startIndex + index].UnPackSize; - // Count partial_folder_size - // efi.UnPackSize += unPackSize; - // importantTotalUnPacked += unPackSize; - efi.ExtractStatuses.Add(index == fileIndex - startIndex); - } - } - } - - extractCallback->SetTotal(importantTotalUnPacked); - - CDecoder decoder( - #ifdef _ST_MODE - false - #else - true - #endif - ); - // CDecoder1 decoder; - - UInt64 currentImportantTotalUnPacked = 0; - UInt64 totalFolderUnPacked; - - for(int i = 0; i < extractFolderInfoVector.Size(); i++, - currentImportantTotalUnPacked += totalFolderUnPacked) - { - const CExtractFolderInfo &efi = extractFolderInfoVector[i]; - totalFolderUnPacked = efi.UnPackSize; - - RINOK(extractCallback->SetCompleted(¤tImportantTotalUnPacked)); - - CFolderOutStream *folderOutStream = new CFolderOutStream; - CMyComPtr outStream(folderOutStream); - - #ifdef _7Z_VOL - const CVolume &volume = _volumes[efi.VolumeIndex]; - const CArchiveDatabaseEx &database = volume.Database; - #else - const CArchiveDatabaseEx &database = _database; - #endif - - CNum startIndex; - if (efi.FileIndex != kNumNoIndex) - startIndex = efi.FileIndex; - else - startIndex = database.FolderStartFileIndex[efi.FolderIndex]; - - - HRESULT result = folderOutStream->Init(&database, - #ifdef _7Z_VOL - volume.StartRef2Index, - #else - 0, - #endif - startIndex, - &efi.ExtractStatuses, extractCallback, testMode); - - RINOK(result); - - if (efi.FileIndex != kNumNoIndex) - continue; - - CNum folderIndex = efi.FolderIndex; - const CFolder &folderInfo = database.Folders[folderIndex]; - - CLocalProgress *localProgressSpec = new CLocalProgress; - CMyComPtr progress = localProgressSpec; - localProgressSpec->Init(extractCallback, false); - - CLocalCompressProgressInfo *localCompressProgressSpec = - new CLocalCompressProgressInfo; - CMyComPtr compressProgress = localCompressProgressSpec; - localCompressProgressSpec->Init(progress, NULL, ¤tImportantTotalUnPacked); - - CNum packStreamIndex = database.FolderStartPackStreamIndex[folderIndex]; - UInt64 folderStartPackPos = database.GetFolderStreamPos(folderIndex, 0); - - #ifndef _NO_CRYPTO - CMyComPtr getTextPassword; - if (extractCallback) - extractCallback.QueryInterface(IID_ICryptoGetTextPassword, &getTextPassword); - #endif - - try - { - HRESULT result = decoder.Decode( - #ifdef _7Z_VOL - volume.Stream, - #else - _inStream, - #endif - folderStartPackPos, - &database.PackSizes[packStreamIndex], - folderInfo, - outStream, - compressProgress - #ifndef _NO_CRYPTO - , getTextPassword - #endif - #ifdef COMPRESS_MT - , true, _numThreads - #endif - ); - - if (result == S_FALSE) - { - RINOK(folderOutStream->FlushCorrupted(NArchive::NExtract::NOperationResult::kDataError)); - continue; - } - if (result == E_NOTIMPL) - { - RINOK(folderOutStream->FlushCorrupted(NArchive::NExtract::NOperationResult::kUnSupportedMethod)); - continue; - } - if (result != S_OK) - return result; - if (folderOutStream->WasWritingFinished() != S_OK) - { - RINOK(folderOutStream->FlushCorrupted(NArchive::NExtract::NOperationResult::kDataError)); - continue; - } - } - catch(...) - { - RINOK(folderOutStream->FlushCorrupted(NArchive::NExtract::NOperationResult::kDataError)); - continue; - } - } - return S_OK; - COM_TRY_END -} - -}} diff --git a/7zip/Archive/7z/7zFolderInStream.cpp b/7zip/Archive/7z/7zFolderInStream.cpp deleted file mode 100755 index fb1cfd3a..00000000 --- a/7zip/Archive/7z/7zFolderInStream.cpp +++ /dev/null @@ -1,129 +0,0 @@ -// 7zFolderInStream.cpp - -#include "StdAfx.h" - -#include "7zFolderInStream.h" - -namespace NArchive { -namespace N7z { - -CFolderInStream::CFolderInStream() -{ - _inStreamWithHashSpec = new CSequentialInStreamWithCRC; - _inStreamWithHash = _inStreamWithHashSpec; -} - -void CFolderInStream::Init(IArchiveUpdateCallback *updateCallback, - const UInt32 *fileIndices, UInt32 numFiles) -{ - _updateCallback = updateCallback; - _numFiles = numFiles; - _fileIndex = 0; - _fileIndices = fileIndices; - Processed.Clear(); - CRCs.Clear(); - Sizes.Clear(); - _fileIsOpen = false; - _currentSizeIsDefined = false; -} - -HRESULT CFolderInStream::OpenStream() -{ - _filePos = 0; - while (_fileIndex < _numFiles) - { - _currentSizeIsDefined = false; - CMyComPtr stream; - HRESULT result = _updateCallback->GetStream(_fileIndices[_fileIndex], &stream); - if (result != S_OK && result != S_FALSE) - return result; - _fileIndex++; - _inStreamWithHashSpec->SetStream(stream); - _inStreamWithHashSpec->Init(); - if (!stream) - { - RINOK(_updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK)); - Sizes.Add(0); - Processed.Add(result == S_OK); - AddDigest(); - continue; - } - CMyComPtr streamGetSize; - if (stream.QueryInterface(IID_IStreamGetSize, &streamGetSize) == S_OK) - { - if(streamGetSize) - { - _currentSizeIsDefined = true; - RINOK(streamGetSize->GetSize(&_currentSize)); - } - } - - _fileIsOpen = true; - return S_OK; - } - return S_OK; -} - -void CFolderInStream::AddDigest() -{ - CRCs.Add(_inStreamWithHashSpec->GetCRC()); -} - -HRESULT CFolderInStream::CloseStream() -{ - RINOK(_updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK)); - _inStreamWithHashSpec->ReleaseStream(); - _fileIsOpen = false; - Processed.Add(true); - Sizes.Add(_filePos); - AddDigest(); - return S_OK; -} - -STDMETHODIMP CFolderInStream::Read(void *data, UInt32 size, UInt32 *processedSize) -{ - UInt32 realProcessedSize = 0; - while ((_fileIndex < _numFiles || _fileIsOpen) && size > 0) - { - if (_fileIsOpen) - { - UInt32 localProcessedSize; - RINOK(_inStreamWithHash->Read( - ((Byte *)data) + realProcessedSize, size, &localProcessedSize)); - if (localProcessedSize == 0) - { - RINOK(CloseStream()); - continue; - } - realProcessedSize += localProcessedSize; - _filePos += localProcessedSize; - size -= localProcessedSize; - break; - } - else - { - RINOK(OpenStream()); - } - } - if (processedSize != 0) - *processedSize = realProcessedSize; - return S_OK; -} - -STDMETHODIMP CFolderInStream::GetSubStreamSize(UInt64 subStream, UInt64 *value) -{ - *value = 0; - if (subStream < Sizes.Size()) - { - *value= Sizes[(int)(size_t)subStream]; - return S_OK; - } - if (subStream > Sizes.Size()) - return E_FAIL; - if (!_currentSizeIsDefined) - return S_FALSE; - *value = _currentSize; - return S_OK; -} - -}} diff --git a/7zip/Archive/7z/7zFolderInStream.h b/7zip/Archive/7z/7zFolderInStream.h deleted file mode 100755 index 9a720c8b..00000000 --- a/7zip/Archive/7z/7zFolderInStream.h +++ /dev/null @@ -1,66 +0,0 @@ -// 7z/FolderInStream.h - -#ifndef __7Z_FOLDERINSTREAM_H -#define __7Z_FOLDERINSTREAM_H - -#include "7zItem.h" -#include "7zHeader.h" - -#include "../IArchive.h" -#include "../Common/InStreamWithCRC.h" -#include "../../IStream.h" -#include "../../ICoder.h" - -namespace NArchive { -namespace N7z { - -class CFolderInStream: - public ISequentialInStream, - public ICompressGetSubStreamSize, - public CMyUnknownImp -{ -public: - - MY_UNKNOWN_IMP1(ICompressGetSubStreamSize) - - CFolderInStream(); - - STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); - - STDMETHOD(GetSubStreamSize)(UInt64 subStream, UInt64 *value); -private: - CSequentialInStreamWithCRC *_inStreamWithHashSpec; - CMyComPtr _inStreamWithHash; - CMyComPtr _updateCallback; - - bool _currentSizeIsDefined; - UInt64 _currentSize; - - bool _fileIsOpen; - UInt64 _filePos; - - const UInt32 *_fileIndices; - UInt32 _numFiles; - UInt32 _fileIndex; - - HRESULT OpenStream(); - HRESULT CloseStream(); - void AddDigest(); -public: - void Init(IArchiveUpdateCallback *updateCallback, - const UInt32 *fileIndices, UInt32 numFiles); - CRecordVector Processed; - CRecordVector CRCs; - CRecordVector Sizes; - UInt64 GetFullSize() const - { - UInt64 size = 0; - for (int i = 0; i < Sizes.Size(); i++) - size += Sizes[i]; - return size; - } -}; - -}} - -#endif diff --git a/7zip/Archive/7z/7zFolderOutStream.cpp b/7zip/Archive/7z/7zFolderOutStream.cpp deleted file mode 100755 index 93bed3d9..00000000 --- a/7zip/Archive/7z/7zFolderOutStream.cpp +++ /dev/null @@ -1,162 +0,0 @@ -// 7zFolderOutStream.cpp - -#include "StdAfx.h" - -#include "7zFolderOutStream.h" - -namespace NArchive { -namespace N7z { - -CFolderOutStream::CFolderOutStream() -{ - _outStreamWithHashSpec = new COutStreamWithCRC; - _outStreamWithHash = _outStreamWithHashSpec; -} - -HRESULT CFolderOutStream::Init( - const CArchiveDatabaseEx *archiveDatabase, - UInt32 ref2Offset, - UInt32 startIndex, - const CBoolVector *extractStatuses, - IArchiveExtractCallback *extractCallback, - bool testMode) -{ - _archiveDatabase = archiveDatabase; - _ref2Offset = ref2Offset; - _startIndex = startIndex; - - _extractStatuses = extractStatuses; - _extractCallback = extractCallback; - _testMode = testMode; - - _currentIndex = 0; - _fileIsOpen = false; - return WriteEmptyFiles(); -} - -HRESULT CFolderOutStream::OpenFile() -{ - Int32 askMode; - if((*_extractStatuses)[_currentIndex]) - askMode = _testMode ? - NArchive::NExtract::NAskMode::kTest : - NArchive::NExtract::NAskMode::kExtract; - else - askMode = NArchive::NExtract::NAskMode::kSkip; - CMyComPtr realOutStream; - - UInt32 index = _startIndex + _currentIndex; - RINOK(_extractCallback->GetStream(_ref2Offset + index, &realOutStream, askMode)); - - _outStreamWithHashSpec->SetStream(realOutStream); - _outStreamWithHashSpec->Init(); - if (askMode == NArchive::NExtract::NAskMode::kExtract && - (!realOutStream)) - { - const CFileItem &fileInfo = _archiveDatabase->Files[index]; - if (!fileInfo.IsAnti && !fileInfo.IsDirectory) - askMode = NArchive::NExtract::NAskMode::kSkip; - } - return _extractCallback->PrepareOperation(askMode); -} - -HRESULT CFolderOutStream::WriteEmptyFiles() -{ - for(;_currentIndex < _extractStatuses->Size(); _currentIndex++) - { - UInt32 index = _startIndex + _currentIndex; - const CFileItem &fileInfo = _archiveDatabase->Files[index]; - if (!fileInfo.IsAnti && !fileInfo.IsDirectory && fileInfo.UnPackSize != 0) - return S_OK; - RINOK(OpenFile()); - RINOK(_extractCallback->SetOperationResult( - NArchive::NExtract::NOperationResult::kOK)); - _outStreamWithHashSpec->ReleaseStream(); - } - return S_OK; -} - -STDMETHODIMP CFolderOutStream::Write(const void *data, - UInt32 size, UInt32 *processedSize) -{ - UInt32 realProcessedSize = 0; - while(_currentIndex < _extractStatuses->Size()) - { - if (_fileIsOpen) - { - UInt32 index = _startIndex + _currentIndex; - const CFileItem &fileInfo = _archiveDatabase->Files[index]; - UInt64 fileSize = fileInfo.UnPackSize; - - UInt32 numBytesToWrite = (UInt32)MyMin(fileSize - _filePos, - UInt64(size - realProcessedSize)); - - UInt32 processedSizeLocal; - RINOK(_outStreamWithHash->Write((const Byte *)data + realProcessedSize, - numBytesToWrite, &processedSizeLocal)); - - _filePos += processedSizeLocal; - realProcessedSize += processedSizeLocal; - if (_filePos == fileSize) - { - bool digestsAreEqual; - if (fileInfo.IsFileCRCDefined) - digestsAreEqual = fileInfo.FileCRC == _outStreamWithHashSpec->GetCRC(); - else - digestsAreEqual = true; - - RINOK(_extractCallback->SetOperationResult( - digestsAreEqual ? - NArchive::NExtract::NOperationResult::kOK : - NArchive::NExtract::NOperationResult::kCRCError)); - _outStreamWithHashSpec->ReleaseStream(); - _fileIsOpen = false; - _currentIndex++; - } - if (realProcessedSize == size) - { - if (processedSize != NULL) - *processedSize = realProcessedSize; - return WriteEmptyFiles(); - } - } - else - { - RINOK(OpenFile()); - _fileIsOpen = true; - _filePos = 0; - } - } - if (processedSize != NULL) - *processedSize = size; - return S_OK; -} - -HRESULT CFolderOutStream::FlushCorrupted(Int32 resultEOperationResult) -{ - while(_currentIndex < _extractStatuses->Size()) - { - if (_fileIsOpen) - { - RINOK(_extractCallback->SetOperationResult(resultEOperationResult)); - _outStreamWithHashSpec->ReleaseStream(); - _fileIsOpen = false; - _currentIndex++; - } - else - { - RINOK(OpenFile()); - _fileIsOpen = true; - } - } - return S_OK; -} - -HRESULT CFolderOutStream::WasWritingFinished() -{ - if (_currentIndex == _extractStatuses->Size()) - return S_OK; - return E_FAIL; -} - -}} diff --git a/7zip/Archive/7z/7zFolderOutStream.h b/7zip/Archive/7z/7zFolderOutStream.h deleted file mode 100755 index c132c79a..00000000 --- a/7zip/Archive/7z/7zFolderOutStream.h +++ /dev/null @@ -1,57 +0,0 @@ -// 7zFolderOutStream.h - -#ifndef __7Z_FOLDEROUTSTREAM_H -#define __7Z_FOLDEROUTSTREAM_H - -#include "7zIn.h" - -#include "../../IStream.h" -#include "../IArchive.h" -#include "../Common/OutStreamWithCRC.h" - -namespace NArchive { -namespace N7z { - -class CFolderOutStream: - public ISequentialOutStream, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP - - CFolderOutStream(); - - STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); -private: - - COutStreamWithCRC *_outStreamWithHashSpec; - CMyComPtr _outStreamWithHash; - const CArchiveDatabaseEx *_archiveDatabase; - const CBoolVector *_extractStatuses; - UInt32 _startIndex; - UInt32 _ref2Offset; - int _currentIndex; - // UInt64 _currentDataPos; - CMyComPtr _extractCallback; - bool _testMode; - - bool _fileIsOpen; - UInt64 _filePos; - - HRESULT OpenFile(); - HRESULT WriteEmptyFiles(); -public: - HRESULT Init( - const CArchiveDatabaseEx *archiveDatabase, - UInt32 ref2Offset, - UInt32 startIndex, - const CBoolVector *extractStatuses, - IArchiveExtractCallback *extractCallback, - bool testMode); - HRESULT FlushCorrupted(Int32 resultEOperationResult); - HRESULT WasWritingFinished(); -}; - -}} - -#endif diff --git a/7zip/Archive/7z/7zHandler.cpp b/7zip/Archive/7z/7zHandler.cpp deleted file mode 100755 index 3321fd71..00000000 --- a/7zip/Archive/7z/7zHandler.cpp +++ /dev/null @@ -1,794 +0,0 @@ -// 7zHandler.cpp - -#include "StdAfx.h" - -#include "7zHandler.h" -#include "7zProperties.h" - -#include "../../../Common/IntToString.h" -#include "../../../Common/ComTry.h" -#include "../../../Windows/Defs.h" - -#include "../Common/ItemNameUtils.h" -#ifdef _7Z_VOL -#include "../Common/MultiStream.h" -#endif - -#ifdef __7Z_SET_PROPERTIES -#ifdef EXTRACT_ONLY -#include "../Common/ParseProperties.h" -#endif -#endif - -using namespace NWindows; - -namespace NArchive { -namespace N7z { - -CHandler::CHandler() -{ - #ifdef COMPRESS_MT - _numThreads = NWindows::NSystem::GetNumberOfProcessors(); - #endif - #ifndef EXTRACT_ONLY - Init(); - #endif - #ifndef EXCLUDE_COM - LoadMethodMap(); - #endif -} - -STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems) -{ - *numItems = - #ifdef _7Z_VOL - _refs.Size(); - #else - *numItems = _database.Files.Size(); - #endif - return S_OK; -} - -STDMETHODIMP CHandler::GetArchiveProperty(PROPID /* propID */, PROPVARIANT *value) -{ - value->vt = VT_EMPTY; - return S_OK; -} - -#ifdef _SFX - -STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 * /* numProperties */) -{ - return E_NOTIMPL; -} - -STDMETHODIMP CHandler::GetPropertyInfo(UInt32 /* index */, - BSTR * /* name */, PROPID * /* propID */, VARTYPE * /* varType */) -{ - return E_NOTIMPL; -} - -#endif - - -STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) -{ - *numProperties = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetArchivePropertyInfo(UInt32 /* index */, - BSTR * /* name */, PROPID * /* propID */, VARTYPE * /* varType */) -{ - return E_NOTIMPL; -} - - -static void MySetFileTime(bool timeDefined, FILETIME unixTime, - NWindows::NCOM::CPropVariant &propVariant) -{ - if (timeDefined) - propVariant = unixTime; -} - -#ifndef _SFX - -static UString ConvertUInt32ToString(UInt32 value) -{ - wchar_t buffer[32]; - ConvertUInt64ToString(value, buffer); - return buffer; -} - -static UString GetStringForSizeValue(UInt32 value) -{ - for (int i = 31; i >= 0; i--) - if ((UInt32(1) << i) == value) - return ConvertUInt32ToString(i); - UString result; - if (value % (1 << 20) == 0) - { - result += ConvertUInt32ToString(value >> 20); - result += L"m"; - } - else if (value % (1 << 10) == 0) - { - result += ConvertUInt32ToString(value >> 10); - result += L"k"; - } - else - { - result += ConvertUInt32ToString(value); - result += L"b"; - } - return result; -} - -static CMethodID k_Copy = { { 0x0 }, 1 }; -static CMethodID k_LZMA = { { 0x3, 0x1, 0x1 }, 3 }; -static CMethodID k_BCJ = { { 0x3, 0x3, 0x1, 0x3 }, 4 }; -static CMethodID k_BCJ2 = { { 0x3, 0x3, 0x1, 0x1B }, 4 }; -static CMethodID k_PPMD = { { 0x3, 0x4, 0x1 }, 3 }; -static CMethodID k_Deflate = { { 0x4, 0x1, 0x8 }, 3 }; -static CMethodID k_Deflate64 = { { 0x4, 0x1, 0x9 }, 3 }; -static CMethodID k_BZip2 = { { 0x4, 0x2, 0x2 }, 3 }; - -static wchar_t GetHex(Byte value) -{ - return (wchar_t)((value < 10) ? (L'0' + value) : (L'A' + (value - 10))); -} -static inline UString GetHex2(Byte value) -{ - UString result; - result += GetHex((Byte)(value >> 4)); - result += GetHex((Byte)(value & 0xF)); - return result; -} - -#endif - -static CMethodID k_AES = { { 0x6, 0xF1, 0x7, 0x1}, 4 }; - -static inline UInt32 GetUInt32FromMemLE(const Byte *p) -{ - return p[0] | (((UInt32)p[1]) << 8) | (((UInt32)p[2]) << 16) | (((UInt32)p[3]) << 24); -} - -bool CHandler::IsEncrypted(UInt32 index2) const -{ - CNum folderIndex = _database.FileIndexToFolderIndexMap[index2]; - if (folderIndex != kNumNoIndex) - { - const CFolder &folderInfo = _database.Folders[folderIndex]; - for (int i = folderInfo.Coders.Size() - 1; i >= 0; i--) - { - const CCoderInfo &coderInfo = folderInfo.Coders[i]; - for (int j = 0; j < coderInfo.AltCoders.Size(); j++) - if (coderInfo.AltCoders[j].MethodID == k_AES) - return true; - } - } - return false; -} - -STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) -{ - COM_TRY_BEGIN - NWindows::NCOM::CPropVariant propVariant; - - /* - const CRef2 &ref2 = _refs[index]; - if (ref2.Refs.IsEmpty()) - return E_FAIL; - const CRef &ref = ref2.Refs.Front(); - */ - - #ifdef _7Z_VOL - const CRef &ref = _refs[index]; - const CVolume &volume = _volumes[ref.VolumeIndex]; - const CArchiveDatabaseEx &_database = volume.Database; - UInt32 index2 = ref.ItemIndex; - const CFileItem &item = _database.Files[index2]; - #else - const CFileItem &item = _database.Files[index]; - UInt32 index2 = index; - #endif - - switch(propID) - { - case kpidPath: - { - if (!item.Name.IsEmpty()) - propVariant = NItemName::GetOSName(item.Name); - break; - } - case kpidIsFolder: - propVariant = item.IsDirectory; - break; - case kpidSize: - { - propVariant = item.UnPackSize; - // propVariant = ref2.UnPackSize; - break; - } - case kpidPosition: - { - /* - if (ref2.Refs.Size() > 1) - propVariant = ref2.StartPos; - else - */ - if (item.IsStartPosDefined) - propVariant = item.StartPos; - break; - } - case kpidPackedSize: - { - // propVariant = ref2.PackSize; - { - CNum folderIndex = _database.FileIndexToFolderIndexMap[index2]; - if (folderIndex != kNumNoIndex) - { - if (_database.FolderStartFileIndex[folderIndex] == (CNum)index2) - propVariant = _database.GetFolderFullPackSize(folderIndex); - /* - else - propVariant = UInt64(0); - */ - } - else - propVariant = UInt64(0); - } - break; - } - case kpidLastAccessTime: - MySetFileTime(item.IsLastAccessTimeDefined, item.LastAccessTime, propVariant); - break; - case kpidCreationTime: - MySetFileTime(item.IsCreationTimeDefined, item.CreationTime, propVariant); - break; - case kpidLastWriteTime: - MySetFileTime(item.IsLastWriteTimeDefined, item.LastWriteTime, propVariant); - break; - case kpidAttributes: - if (item.AreAttributesDefined) - propVariant = item.Attributes; - break; - case kpidCRC: - if (item.IsFileCRCDefined) - propVariant = item.FileCRC; - break; - case kpidEncrypted: - { - propVariant = IsEncrypted(index2); - break; - } - #ifndef _SFX - case kpidMethod: - { - CNum folderIndex = _database.FileIndexToFolderIndexMap[index2]; - if (folderIndex != kNumNoIndex) - { - const CFolder &folderInfo = _database.Folders[folderIndex]; - UString methodsString; - for (int i = folderInfo.Coders.Size() - 1; i >= 0; i--) - { - const CCoderInfo &coderInfo = folderInfo.Coders[i]; - if (!methodsString.IsEmpty()) - methodsString += L' '; - CMethodInfo methodInfo; - - bool methodIsKnown; - - for (int j = 0; j < coderInfo.AltCoders.Size(); j++) - { - if (j > 0) - methodsString += L"|"; - const CAltCoderInfo &altCoderInfo = coderInfo.AltCoders[j]; - - UString methodName; - #ifdef NO_REGISTRY - - methodIsKnown = true; - if (altCoderInfo.MethodID == k_Copy) - methodName = L"Copy"; - else if (altCoderInfo.MethodID == k_LZMA) - methodName = L"LZMA"; - else if (altCoderInfo.MethodID == k_BCJ) - methodName = L"BCJ"; - else if (altCoderInfo.MethodID == k_BCJ2) - methodName = L"BCJ2"; - else if (altCoderInfo.MethodID == k_PPMD) - methodName = L"PPMD"; - else if (altCoderInfo.MethodID == k_Deflate) - methodName = L"Deflate"; - else if (altCoderInfo.MethodID == k_Deflate64) - methodName = L"Deflate64"; - else if (altCoderInfo.MethodID == k_BZip2) - methodName = L"BZip2"; - else if (altCoderInfo.MethodID == k_AES) - methodName = L"7zAES"; - else - methodIsKnown = false; - - #else - - methodIsKnown = GetMethodInfo( - altCoderInfo.MethodID, methodInfo); - methodName = methodInfo.Name; - - #endif - - if (methodIsKnown) - { - methodsString += methodName; - if (altCoderInfo.MethodID == k_LZMA) - { - if (altCoderInfo.Properties.GetCapacity() >= 5) - { - methodsString += L":"; - UInt32 dicSize = GetUInt32FromMemLE( - ((const Byte *)altCoderInfo.Properties + 1)); - methodsString += GetStringForSizeValue(dicSize); - } - } - else if (altCoderInfo.MethodID == k_PPMD) - { - if (altCoderInfo.Properties.GetCapacity() >= 5) - { - Byte order = *(const Byte *)altCoderInfo.Properties; - methodsString += L":o"; - methodsString += ConvertUInt32ToString(order); - methodsString += L":mem"; - UInt32 dicSize = GetUInt32FromMemLE( - ((const Byte *)altCoderInfo.Properties + 1)); - methodsString += GetStringForSizeValue(dicSize); - } - } - else if (altCoderInfo.MethodID == k_AES) - { - if (altCoderInfo.Properties.GetCapacity() >= 1) - { - methodsString += L":"; - const Byte *data = (const Byte *)altCoderInfo.Properties; - Byte firstByte = *data++; - UInt32 numCyclesPower = firstByte & 0x3F; - methodsString += ConvertUInt32ToString(numCyclesPower); - /* - if ((firstByte & 0xC0) != 0) - { - methodsString += L":"; - return S_OK; - UInt32 saltSize = (firstByte >> 7) & 1; - UInt32 ivSize = (firstByte >> 6) & 1; - if (altCoderInfo.Properties.GetCapacity() >= 2) - { - Byte secondByte = *data++; - saltSize += (secondByte >> 4); - ivSize += (secondByte & 0x0F); - } - } - */ - } - } - else - { - if (altCoderInfo.Properties.GetCapacity() > 0) - { - methodsString += L":["; - for (size_t bi = 0; bi < altCoderInfo.Properties.GetCapacity(); bi++) - { - if (bi > 5 && bi + 1 < altCoderInfo.Properties.GetCapacity()) - { - methodsString += L".."; - break; - } - else - methodsString += GetHex2(altCoderInfo.Properties[bi]); - } - methodsString += L"]"; - } - } - } - else - { - methodsString += altCoderInfo.MethodID.ConvertToString(); - } - } - } - propVariant = methodsString; - } - } - break; - case kpidBlock: - { - CNum folderIndex = _database.FileIndexToFolderIndexMap[index2]; - if (folderIndex != kNumNoIndex) - propVariant = (UInt32)folderIndex; - } - break; - case kpidPackedSize0: - case kpidPackedSize1: - case kpidPackedSize2: - case kpidPackedSize3: - case kpidPackedSize4: - { - CNum folderIndex = _database.FileIndexToFolderIndexMap[index2]; - if (folderIndex != kNumNoIndex) - { - const CFolder &folderInfo = _database.Folders[folderIndex]; - if (_database.FolderStartFileIndex[folderIndex] == (CNum)index2 && - folderInfo.PackStreams.Size() > (int)(propID - kpidPackedSize0)) - { - propVariant = _database.GetFolderPackStreamSize(folderIndex, propID - kpidPackedSize0); - } - else - propVariant = UInt64(0); - } - else - propVariant = UInt64(0); - } - break; - #endif - case kpidIsAnti: - propVariant = item.IsAnti; - break; - } - propVariant.Detach(value); - return S_OK; - COM_TRY_END -} - -static const wchar_t *kExt = L"7z"; -static const wchar_t *kAfterPart = L".7z"; - -#ifdef _7Z_VOL - -class CVolumeName -{ - bool _first; - UString _unchangedPart; - UString _changedPart; - UString _afterPart; -public: - bool InitName(const UString &name) - { - _first = true; - int dotPos = name.ReverseFind('.'); - UString basePart = name; - if (dotPos >= 0) - { - UString ext = name.Mid(dotPos + 1); - if (ext.CompareNoCase(kExt)==0 || - ext.CompareNoCase(L"EXE") == 0) - { - _afterPart = kAfterPart; - basePart = name.Left(dotPos); - } - } - - int numLetters = 1; - bool splitStyle = false; - if (basePart.Right(numLetters) == L"1") - { - while (numLetters < basePart.Length()) - { - if (basePart[basePart.Length() - numLetters - 1] != '0') - break; - numLetters++; - } - } - else - return false; - _unchangedPart = basePart.Left(basePart.Length() - numLetters); - _changedPart = basePart.Right(numLetters); - return true; - } - - UString GetNextName() - { - UString newName; - // if (_newStyle || !_first) - { - int i; - int numLetters = _changedPart.Length(); - for (i = numLetters - 1; i >= 0; i--) - { - wchar_t c = _changedPart[i]; - if (c == L'9') - { - c = L'0'; - newName = c + newName; - if (i == 0) - newName = UString(L'1') + newName; - continue; - } - c++; - newName = UString(c) + newName; - i--; - for (; i >= 0; i--) - newName = _changedPart[i] + newName; - break; - } - _changedPart = newName; - } - _first = false; - return _unchangedPart + _changedPart + _afterPart; - } -}; - -#endif - -STDMETHODIMP CHandler::Open(IInStream *stream, - const UInt64 *maxCheckStartPosition, - IArchiveOpenCallback *openArchiveCallback) -{ - COM_TRY_BEGIN - Close(); - #ifndef _SFX - _fileInfoPopIDs.Clear(); - #endif - try - { - CMyComPtr openArchiveCallbackTemp = openArchiveCallback; - #ifdef _7Z_VOL - CVolumeName seqName; - - CMyComPtr openVolumeCallback; - #endif - - #ifndef _NO_CRYPTO - CMyComPtr getTextPassword; - if (openArchiveCallback) - { - openArchiveCallbackTemp.QueryInterface( - IID_ICryptoGetTextPassword, &getTextPassword); - } - #endif - #ifdef _7Z_VOL - if (openArchiveCallback) - { - openArchiveCallbackTemp.QueryInterface(IID_IArchiveOpenVolumeCallback, &openVolumeCallback); - } - for (;;) - { - CMyComPtr inStream; - if (!_volumes.IsEmpty()) - { - if (!openVolumeCallback) - break; - if(_volumes.Size() == 1) - { - UString baseName; - { - NCOM::CPropVariant propVariant; - RINOK(openVolumeCallback->GetProperty(kpidName, &propVariant)); - if (propVariant.vt != VT_BSTR) - break; - baseName = propVariant.bstrVal; - } - seqName.InitName(baseName); - } - - UString fullName = seqName.GetNextName(); - HRESULT result = openVolumeCallback->GetStream(fullName, &inStream); - if (result == S_FALSE) - break; - if (result != S_OK) - return result; - if (!stream) - break; - } - else - inStream = stream; - - CInArchive archive; - RINOK(archive.Open(inStream, maxCheckStartPosition)); - - _volumes.Add(CVolume()); - CVolume &volume = _volumes.Back(); - CArchiveDatabaseEx &database = volume.Database; - volume.Stream = inStream; - volume.StartRef2Index = _refs.Size(); - - HRESULT result = archive.ReadDatabase(database - #ifndef _NO_CRYPTO - , getTextPassword - #endif - ); - if (result != S_OK) - { - _volumes.Clear(); - return result; - } - database.Fill(); - for(int i = 0; i < database.Files.Size(); i++) - { - CRef refNew; - refNew.VolumeIndex = _volumes.Size() - 1; - refNew.ItemIndex = i; - _refs.Add(refNew); - /* - const CFileItem &file = database.Files[i]; - int j; - */ - /* - for (j = _refs.Size() - 1; j >= 0; j--) - { - CRef2 &ref2 = _refs[j]; - const CRef &ref = ref2.Refs.Back(); - const CVolume &volume2 = _volumes[ref.VolumeIndex]; - const CArchiveDatabaseEx &database2 = volume2.Database; - const CFileItem &file2 = database2.Files[ref.ItemIndex]; - if (file2.Name.CompareNoCase(file.Name) == 0) - { - if (!file.IsStartPosDefined) - continue; - if (file.StartPos != ref2.StartPos + ref2.UnPackSize) - continue; - ref2.Refs.Add(refNew); - break; - } - } - */ - /* - j = -1; - if (j < 0) - { - CRef2 ref2New; - ref2New.Refs.Add(refNew); - j = _refs.Add(ref2New); - } - CRef2 &ref2 = _refs[j]; - ref2.UnPackSize += file.UnPackSize; - ref2.PackSize += database.GetFilePackSize(i); - if (ref2.Refs.Size() == 1 && file.IsStartPosDefined) - ref2.StartPos = file.StartPos; - */ - } - if (database.Files.Size() != 1) - break; - const CFileItem &file = database.Files.Front(); - if (!file.IsStartPosDefined) - break; - } - #else - CInArchive archive; - RINOK(archive.Open(stream, maxCheckStartPosition)); - HRESULT result = archive.ReadDatabase(_database - #ifndef _NO_CRYPTO - , getTextPassword - #endif - ); - RINOK(result); - _database.Fill(); - _inStream = stream; - #endif - } - catch(...) - { - Close(); - return S_FALSE; - } - // _inStream = stream; - #ifndef _SFX - FillPopIDs(); - #endif - return S_OK; - COM_TRY_END -} - -STDMETHODIMP CHandler::Close() -{ - COM_TRY_BEGIN - #ifdef _7Z_VOL - _volumes.Clear(); - _refs.Clear(); - #else - _inStream.Release(); - _database.Clear(); - #endif - return S_OK; - COM_TRY_END -} - -#ifdef _7Z_VOL -STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream) -{ - if (index != 0) - return E_INVALIDARG; - *stream = 0; - CMultiStream *streamSpec = new CMultiStream; - CMyComPtr streamTemp = streamSpec; - - UInt64 pos = 0; - const UString *fileName; - for (int i = 0; i < _refs.Size(); i++) - { - const CRef &ref = _refs[i]; - const CVolume &volume = _volumes[ref.VolumeIndex]; - const CArchiveDatabaseEx &database = volume.Database; - const CFileItem &file = database.Files[ref.ItemIndex]; - if (i == 0) - fileName = &file.Name; - else - if (fileName->Compare(file.Name) != 0) - return S_FALSE; - if (!file.IsStartPosDefined) - return S_FALSE; - if (file.StartPos != pos) - return S_FALSE; - CNum folderIndex = database.FileIndexToFolderIndexMap[ref.ItemIndex]; - if (folderIndex == kNumNoIndex) - { - if (file.UnPackSize != 0) - return E_FAIL; - continue; - } - if (database.NumUnPackStreamsVector[folderIndex] != 1) - return S_FALSE; - const CFolder &folder = database.Folders[folderIndex]; - if (folder.Coders.Size() != 1) - return S_FALSE; - const CCoderInfo &coder = folder.Coders.Front(); - if (coder.NumInStreams != 1 || coder.NumOutStreams != 1) - return S_FALSE; - const CAltCoderInfo &altCoder = coder.AltCoders.Front(); - if (altCoder.MethodID.IDSize != 1 || altCoder.MethodID.ID[0] != 0) - return S_FALSE; - - pos += file.UnPackSize; - CMultiStream::CSubStreamInfo subStreamInfo; - subStreamInfo.Stream = volume.Stream; - subStreamInfo.Pos = database.GetFolderStreamPos(folderIndex, 0); - subStreamInfo.Size = file.UnPackSize; - streamSpec->Streams.Add(subStreamInfo); - } - streamSpec->Init(); - *stream = streamTemp.Detach(); - return S_OK; -} -#endif - - -#ifdef __7Z_SET_PROPERTIES -#ifdef EXTRACT_ONLY - -STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties) -{ - COM_TRY_BEGIN - #ifdef COMPRESS_MT - const UInt32 numProcessors = NSystem::GetNumberOfProcessors(); - _numThreads = numProcessors; - #endif - - for (int i = 0; i < numProperties; i++) - { - UString name = names[i]; - name.MakeUpper(); - if (name.IsEmpty()) - return E_INVALIDARG; - const PROPVARIANT &value = values[i]; - UInt32 number; - int index = ParseStringToUInt32(name, number); - if (index == 0) - { - if(name.Left(2).CompareNoCase(L"MT") == 0) - { - #ifdef COMPRESS_MT - RINOK(ParseMtProp(name.Mid(2), value, numProcessors, _numThreads)); - #endif - continue; - } - else - return E_INVALIDARG; - } - } - return S_OK; - COM_TRY_END -} - -#endif -#endif - -}} diff --git a/7zip/Archive/7z/7zHandler.h b/7zip/Archive/7z/7zHandler.h deleted file mode 100755 index 8be9f398..00000000 --- a/7zip/Archive/7z/7zHandler.h +++ /dev/null @@ -1,249 +0,0 @@ -// 7z/Handler.h - -#ifndef __7Z_HANDLER_H -#define __7Z_HANDLER_H - -#include "../IArchive.h" -#include "7zIn.h" - -#include "7zCompressionMode.h" - -#ifndef _SFX -#include "7zMethods.h" -#endif - -#ifdef COMPRESS_MT -#include "../../../Windows/System.h" -#endif - -namespace NArchive { -namespace N7z { - -#ifdef _7Z_VOL -struct CRef -{ - int VolumeIndex; - int ItemIndex; -}; - -/* -struct CRef2 -{ - CRecordVector Refs; - UInt64 UnPackSize; - UInt64 PackSize; - UInt64 StartPos; - CRef2(): UnPackSize(0), PackSize(0), StartPos(0) {} -}; -*/ - -struct CVolume -{ - int StartRef2Index; - CMyComPtr Stream; - CArchiveDatabaseEx Database; -}; -#endif - -#ifndef EXTRACT_ONLY - -struct COneMethodInfo -{ - CObjectVector CoderProperties; - UString MethodName; -}; -#endif - -// {23170F69-40C1-278A-1000-000110070000} -DEFINE_GUID(CLSID_CFormat7z, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x07, 0x00, 0x00); - -#ifndef __7Z_SET_PROPERTIES - -#ifdef EXTRACT_ONLY -#ifdef COMPRESS_MT -#define __7Z_SET_PROPERTIES -#endif -#else -#define __7Z_SET_PROPERTIES -#endif - -#endif - - -class CHandler: - public IInArchive, - #ifdef _7Z_VOL - public IInArchiveGetStream, - #endif - #ifdef __7Z_SET_PROPERTIES - public ISetProperties, - #endif - #ifndef EXTRACT_ONLY - public IOutArchive, - #endif - public CMyUnknownImp -{ -public: - #if !defined(_7Z_VOL) && !defined(__7Z_SET_PROPERTIES) && defined(EXTRACT_ONLY) - MY_UNKNOWN_IMP - #else - MY_QUERYINTERFACE_BEGIN - #ifdef _7Z_VOL - MY_QUERYINTERFACE_ENTRY(IInArchiveGetStream) - #endif - #ifdef __7Z_SET_PROPERTIES - MY_QUERYINTERFACE_ENTRY(ISetProperties) - #endif - #ifndef EXTRACT_ONLY - MY_QUERYINTERFACE_ENTRY(IOutArchive) - #endif - MY_QUERYINTERFACE_END - MY_ADDREF_RELEASE - #endif - - - STDMETHOD(Open)(IInStream *stream, - const UInt64 *maxCheckStartPosition, - IArchiveOpenCallback *openArchiveCallback); - STDMETHOD(Close)(); - - STDMETHOD(GetNumberOfItems)(UInt32 *numItems); - STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value); - STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems, - Int32 testMode, IArchiveExtractCallback *extractCallback); - - STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value); - - STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties); - STDMETHOD(GetPropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - - STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties); - STDMETHOD(GetArchivePropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - - #ifdef _7Z_VOL - STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream); - #endif - - #ifdef __7Z_SET_PROPERTIES - STDMETHOD(SetProperties)(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties); - #endif - - #ifndef EXTRACT_ONLY - // IOutArchiveHandler - STDMETHOD(UpdateItems)(ISequentialOutStream *outStream, UInt32 numItems, - IArchiveUpdateCallback *updateCallback); - - STDMETHOD(GetFileTimeType)(UInt32 *type); - - // ISetProperties - - HRESULT SetSolidSettings(const UString &s); - HRESULT SetSolidSettings(const PROPVARIANT &value); - #endif - - CHandler(); - -private: - #ifdef _7Z_VOL - CObjectVector _volumes; - CObjectVector _refs; - #else - CMyComPtr _inStream; - NArchive::N7z::CArchiveDatabaseEx _database; - #endif - - #ifdef COMPRESS_MT - UInt32 _numThreads; - #endif - - #ifndef EXTRACT_ONLY - CObjectVector _methods; - CRecordVector _binds; - bool _removeSfxBlock; - UInt64 _numSolidFiles; - UInt64 _numSolidBytes; - bool _numSolidBytesDefined; - bool _solidExtension; - - bool _compressHeaders; - bool _compressHeadersFull; - bool _encryptHeaders; - - bool WriteModified; - bool WriteCreated; - bool WriteAccessed; - - - bool _autoFilter; - UInt32 _level; - - bool _volumeMode; - - - HRESULT SetParam(COneMethodInfo &oneMethodInfo, const UString &name, const UString &value); - HRESULT SetParams(COneMethodInfo &oneMethodInfo, const UString &srcString); - - HRESULT SetPassword(CCompressionMethodMode &methodMode, IArchiveUpdateCallback *updateCallback); - - HRESULT SetCompressionMethod(CCompressionMethodMode &method, - CObjectVector &methodsInfo - #ifdef COMPRESS_MT - , UInt32 numThreads - #endif - ); - - HRESULT SetCompressionMethod( - CCompressionMethodMode &method, - CCompressionMethodMode &headerMethod); - - #endif - - bool IsEncrypted(UInt32 index2) const; - #ifndef _SFX - - CRecordVector _fileInfoPopIDs; - void FillPopIDs(); - - #endif - - #ifndef EXTRACT_ONLY - - void InitSolidFiles() { _numSolidFiles = UInt64(Int64(-1)); } - void InitSolidSize() { _numSolidBytes = UInt64(Int64(-1)); } - void InitSolid() - { - InitSolidFiles(); - InitSolidSize(); - _solidExtension = false; - _numSolidBytesDefined = false; - } - - void Init() - { - _removeSfxBlock = false; - _compressHeaders = true; - _compressHeadersFull = true; - _encryptHeaders = false; - - WriteModified = true; - WriteCreated = false; - WriteAccessed = false; - - #ifdef COMPRESS_MT - _numThreads = NWindows::NSystem::GetNumberOfProcessors(); - #endif - - _level = 5; - _autoFilter = true; - _volumeMode = false; - InitSolid(); - } - #endif -}; - -}} - -#endif diff --git a/7zip/Archive/7z/7zHandlerOut.cpp b/7zip/Archive/7z/7zHandlerOut.cpp deleted file mode 100755 index fdd336ea..00000000 --- a/7zip/Archive/7z/7zHandlerOut.cpp +++ /dev/null @@ -1,1155 +0,0 @@ -// 7z/OutHandler.cpp - -#include "StdAfx.h" - -#include "7zHandler.h" -#include "7zOut.h" -#include "7zUpdate.h" -#include "7zMethods.h" - -#include "../../../Windows/PropVariant.h" - -#include "../../../Common/ComTry.h" -#include "../../../Common/StringToInt.h" -#include "../../IPassword.h" -#include "../../ICoder.h" - -#include "../Common/ItemNameUtils.h" -#include "../Common/ParseProperties.h" - -using namespace NWindows; - -namespace NArchive { -namespace N7z { - -#ifdef COMPRESS_LZMA -static CMethodID k_LZMA = { { 0x3, 0x1, 0x1 }, 3 }; -static CMethodID k_LZMA2 = { { 0x3, 0x1, 0x2 }, 3 }; -#endif - -#ifdef COMPRESS_PPMD -static CMethodID k_PPMD = { { 0x3, 0x4, 0x1 }, 3 }; -#endif - -#ifdef COMPRESS_BCJ_X86 -static CMethodID k_BCJ_X86 = { { 0x3, 0x3, 0x1, 0x3 }, 4 }; -#endif - -#ifdef COMPRESS_BCJ2 -static CMethodID k_BCJ2 = { { 0x3, 0x3, 0x1, 0x1B }, 4 }; -#endif - -#ifdef COMPRESS_COPY -static CMethodID k_Copy = { { 0x0 }, 1 }; -#endif - -#ifdef COMPRESS_DEFLATE -#ifndef COMPRESS_DEFLATE_ENCODER -#define COMPRESS_DEFLATE_ENCODER -#endif -#endif - -#ifdef COMPRESS_DEFLATE_ENCODER -static CMethodID k_Deflate = { { 0x4, 0x1, 0x8 }, 3 }; -#endif - -#ifdef COMPRESS_BZIP2 -#ifndef COMPRESS_BZIP2_ENCODER -#define COMPRESS_BZIP2_ENCODER -#endif -#endif - -#ifdef COMPRESS_BZIP2_ENCODER -static CMethodID k_BZip2 = { { 0x4, 0x2, 0x2 }, 3 }; -#endif - -const wchar_t *kCopyMethod = L"Copy"; -const wchar_t *kLZMAMethodName = L"LZMA"; -const wchar_t *kLZMA2MethodName = L"LZMA2"; -const wchar_t *kBZip2MethodName = L"BZip2"; -const wchar_t *kPpmdMethodName = L"PPMd"; -const wchar_t *kDeflateMethodName = L"Deflate"; -const wchar_t *kDeflate64MethodName = L"Deflate64"; - -static const wchar_t *kLzmaMatchFinderX1 = L"HC4"; -static const wchar_t *kLzmaMatchFinderX5 = L"BT4"; - -static const UInt32 kLzmaAlgorithmX1 = 0; -static const UInt32 kLzmaAlgorithmX5 = 1; - -static const UInt32 kLzmaDicSizeX1 = 1 << 16; -static const UInt32 kLzmaDicSizeX3 = 1 << 20; -static const UInt32 kLzmaDicSizeX5 = 1 << 22; -static const UInt32 kLzmaDicSizeX7 = 1 << 24; -static const UInt32 kLzmaDicSizeX9 = 1 << 26; - -static const UInt32 kLzmaFastBytesX1 = 32; -static const UInt32 kLzmaFastBytesX7 = 64; - -static const UInt32 kPpmdMemSizeX1 = (1 << 22); -static const UInt32 kPpmdMemSizeX5 = (1 << 24); -static const UInt32 kPpmdMemSizeX7 = (1 << 26); -static const UInt32 kPpmdMemSizeX9 = (192 << 20); - -static const UInt32 kPpmdOrderX1 = 4; -static const UInt32 kPpmdOrderX5 = 6; -static const UInt32 kPpmdOrderX7 = 16; -static const UInt32 kPpmdOrderX9 = 32; - -static const UInt32 kDeflateFastBytesX1 = 32; -static const UInt32 kDeflateFastBytesX7 = 64; -static const UInt32 kDeflateFastBytesX9 = 128; - -static const UInt32 kDeflatePassesX1 = 1; -static const UInt32 kDeflatePassesX7 = 3; -static const UInt32 kDeflatePassesX9 = 10; - -static const UInt32 kBZip2NumPassesX1 = 1; -static const UInt32 kBZip2NumPassesX7 = 2; -static const UInt32 kBZip2NumPassesX9 = 7; - -static const UInt32 kBZip2DicSizeX1 = 100000; -static const UInt32 kBZip2DicSizeX3 = 500000; -static const UInt32 kBZip2DicSizeX5 = 900000; - -const wchar_t *kDefaultMethodName = kLZMAMethodName; - -static const wchar_t *kLzmaMatchFinderForHeaders = L"BT2"; -static const UInt32 kDictionaryForHeaders = 1 << 20; -static const UInt32 kNumFastBytesForHeaders = 273; -static const UInt32 kAlgorithmForHeaders = kLzmaAlgorithmX5; - -static bool IsCopyMethod(const UString &methodName) - { return (methodName.CompareNoCase(kCopyMethod) == 0); } - -static bool IsLZMAMethod(const UString &methodName) -{ - return - (methodName.CompareNoCase(kLZMAMethodName) == 0) || - (methodName.CompareNoCase(kLZMA2MethodName) == 0); -} - -/* -static bool IsLZMethod(const UString &methodName) - { return IsLZMAMethod(methodName); } -*/ - -static bool IsBZip2Method(const UString &methodName) - { return (methodName.CompareNoCase(kBZip2MethodName) == 0); } - -static bool IsPpmdMethod(const UString &methodName) - { return (methodName.CompareNoCase(kPpmdMethodName) == 0); } - -static bool IsDeflateMethod(const UString &methodName) - { return (methodName.CompareNoCase(kDeflateMethodName) == 0) || - (methodName.CompareNoCase(kDeflate64MethodName) == 0); } - -STDMETHODIMP CHandler::GetFileTimeType(UInt32 *type) -{ - *type = NFileTimeType::kWindows; - return S_OK; -} - -HRESULT CHandler::SetPassword(CCompressionMethodMode &methodMode, - IArchiveUpdateCallback *updateCallback) -{ - CMyComPtr getTextPassword; - if (!getTextPassword) - { - CMyComPtr udateCallback2(updateCallback); - udateCallback2.QueryInterface(IID_ICryptoGetTextPassword2, &getTextPassword); - } - - if (getTextPassword) - { - CMyComBSTR password; - Int32 passwordIsDefined; - RINOK(getTextPassword->CryptoGetTextPassword2( - &passwordIsDefined, &password)); - methodMode.PasswordIsDefined = IntToBool(passwordIsDefined); - if (methodMode.PasswordIsDefined) - methodMode.Password = password; - } - else - methodMode.PasswordIsDefined = false; - return S_OK; -} - -struct CNameToPropID -{ - PROPID PropID; - VARTYPE VarType; - const wchar_t *Name; -}; - -CNameToPropID g_NameToPropID[] = -{ - { NCoderPropID::kOrder, VT_UI4, L"O" }, - { NCoderPropID::kPosStateBits, VT_UI4, L"PB" }, - { NCoderPropID::kLitContextBits, VT_UI4, L"LC" }, - { NCoderPropID::kLitPosBits, VT_UI4, L"LP" }, - - { NCoderPropID::kNumPasses, VT_UI4, L"Pass" }, - { NCoderPropID::kNumFastBytes, VT_UI4, L"fb" }, - { NCoderPropID::kMatchFinderCycles, VT_UI4, L"mc" }, - { NCoderPropID::kAlgorithm, VT_UI4, L"a" }, - { NCoderPropID::kMatchFinder, VT_BSTR, L"mf" }, - { NCoderPropID::kNumThreads, VT_UI4, L"mt" } -}; - -bool ConvertProperty(PROPVARIANT srcProp, VARTYPE varType, - NCOM::CPropVariant &destProp) -{ - if (varType == srcProp.vt) - { - destProp = srcProp; - return true; - } - if (varType == VT_UI1) - { - if(srcProp.vt == VT_UI4) - { - UInt32 value = srcProp.ulVal; - if (value > 0xFF) - return false; - destProp = Byte(value); - return true; - } - } - return false; -} - -const int kNumNameToPropIDItems = sizeof(g_NameToPropID) / sizeof(g_NameToPropID[0]); - -int FindPropIdFromStringName(const UString &name) -{ - for (int i = 0; i < kNumNameToPropIDItems; i++) - if (name.CompareNoCase(g_NameToPropID[i].Name) == 0) - return i; - return -1; -} - -HRESULT CHandler::SetCompressionMethod( - CCompressionMethodMode &methodMode, - CCompressionMethodMode &headerMethod) -{ - HRESULT res = SetCompressionMethod(methodMode, _methods - #ifdef COMPRESS_MT - , _numThreads - #endif - ); - RINOK(res); - methodMode.Binds = _binds; - if (_compressHeadersFull) - _compressHeaders = true; - - if (_compressHeaders) - { - // headerMethod.Methods.Add(methodMode.Methods.Back()); - - CObjectVector headerMethodInfoVector; - COneMethodInfo oneMethodInfo; - oneMethodInfo.MethodName = kLZMAMethodName; - { - CProperty property; - property.PropID = NCoderPropID::kMatchFinder; - property.Value = kLzmaMatchFinderForHeaders; - oneMethodInfo.CoderProperties.Add(property); - } - { - CProperty property; - property.PropID = NCoderPropID::kAlgorithm; - property.Value = kAlgorithmForHeaders; - oneMethodInfo.CoderProperties.Add(property); - } - { - CProperty property; - property.PropID = NCoderPropID::kNumFastBytes; - property.Value = UInt32(kNumFastBytesForHeaders); - oneMethodInfo.CoderProperties.Add(property); - } - { - CProperty property; - property.PropID = NCoderPropID::kDictionarySize; - property.Value = UInt32(kDictionaryForHeaders); - oneMethodInfo.CoderProperties.Add(property); - } - headerMethodInfoVector.Add(oneMethodInfo); - HRESULT res = SetCompressionMethod(headerMethod, headerMethodInfoVector - #ifdef COMPRESS_MT - ,1 - #endif - ); - RINOK(res); - } - return S_OK; -} - -static void SetOneMethodProp(COneMethodInfo &oneMethodInfo, PROPID propID, - const NWindows::NCOM::CPropVariant &value) -{ - int j; - for (j = 0; j < oneMethodInfo.CoderProperties.Size(); j++) - if (oneMethodInfo.CoderProperties[j].PropID == propID) - break; - if (j != oneMethodInfo.CoderProperties.Size()) - return; - CProperty property; - property.PropID = propID; - property.Value = value; - oneMethodInfo.CoderProperties.Add(property); -} - -HRESULT CHandler::SetCompressionMethod( - CCompressionMethodMode &methodMode, - CObjectVector &methodsInfo - #ifdef COMPRESS_MT - , UInt32 numThreads - #endif - ) -{ - #ifndef EXCLUDE_COM - /* - CObjectVector methodInfoVector; - if (!NRegistryInfo::EnumerateAllMethods(methodInfoVector)) - return E_FAIL; - */ - #endif - - - UInt32 level = _level; - - if (methodsInfo.IsEmpty()) - { - COneMethodInfo oneMethodInfo; - oneMethodInfo.MethodName = ((level == 0) ? kCopyMethod : kDefaultMethodName); - methodsInfo.Add(oneMethodInfo); - } - - bool needSolid = false; - for(int i = 0; i < methodsInfo.Size(); i++) - { - COneMethodInfo &oneMethodInfo = methodsInfo[i]; - if (oneMethodInfo.MethodName.IsEmpty()) - oneMethodInfo.MethodName = kDefaultMethodName; - - if (!IsCopyMethod(oneMethodInfo.MethodName)) - needSolid = true; - - if (IsLZMAMethod(oneMethodInfo.MethodName)) - { - UInt32 dicSize = - (level >= 9 ? kLzmaDicSizeX9 : - (level >= 7 ? kLzmaDicSizeX7 : - (level >= 5 ? kLzmaDicSizeX5 : - (level >= 3 ? kLzmaDicSizeX3 : - kLzmaDicSizeX1)))); - - UInt32 algorithm = - (level >= 5 ? kLzmaAlgorithmX5 : - kLzmaAlgorithmX1); - - UInt32 fastBytes = - (level >= 7 ? kLzmaFastBytesX7 : - kLzmaFastBytesX1); - - const wchar_t *matchFinder = - (level >= 5 ? kLzmaMatchFinderX5 : - kLzmaMatchFinderX1); - - SetOneMethodProp(oneMethodInfo, NCoderPropID::kDictionarySize, dicSize); - SetOneMethodProp(oneMethodInfo, NCoderPropID::kAlgorithm, algorithm); - SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumFastBytes, fastBytes); - SetOneMethodProp(oneMethodInfo, NCoderPropID::kMatchFinder, matchFinder); - #ifdef COMPRESS_MT - SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumThreads, numThreads); - #endif - } - else if (IsDeflateMethod(oneMethodInfo.MethodName)) - { - UInt32 fastBytes = - (level >= 9 ? kDeflateFastBytesX9 : - (level >= 7 ? kDeflateFastBytesX7 : - kDeflateFastBytesX1)); - - UInt32 numPasses = - (level >= 9 ? kDeflatePassesX9 : - (level >= 7 ? kDeflatePassesX7 : - kDeflatePassesX1)); - - SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumFastBytes, fastBytes); - SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumPasses, numPasses); - } - else if (IsBZip2Method(oneMethodInfo.MethodName)) - { - UInt32 numPasses = - (level >= 9 ? kBZip2NumPassesX9 : - (level >= 7 ? kBZip2NumPassesX7 : - kBZip2NumPassesX1)); - - UInt32 dicSize = - (level >= 5 ? kBZip2DicSizeX5 : - (level >= 3 ? kBZip2DicSizeX3 : - kBZip2DicSizeX1)); - - SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumPasses, numPasses); - SetOneMethodProp(oneMethodInfo, NCoderPropID::kDictionarySize, dicSize); - #ifdef COMPRESS_MT - SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumThreads, numThreads); - #endif - } - else if (IsPpmdMethod(oneMethodInfo.MethodName)) - { - UInt32 useMemSize = - (level >= 9 ? kPpmdMemSizeX9 : - (level >= 7 ? kPpmdMemSizeX7 : - (level >= 5 ? kPpmdMemSizeX5 : - kPpmdMemSizeX1))); - - UInt32 order = - (level >= 9 ? kPpmdOrderX9 : - (level >= 7 ? kPpmdOrderX7 : - (level >= 5 ? kPpmdOrderX5 : - kPpmdOrderX1))); - - SetOneMethodProp(oneMethodInfo, NCoderPropID::kUsedMemorySize, useMemSize); - SetOneMethodProp(oneMethodInfo, NCoderPropID::kOrder, order); - } - - - CMethodFull methodFull; - methodFull.NumInStreams = 1; - methodFull.NumOutStreams = 1; - - bool defined = false; - - #ifdef COMPRESS_LZMA - if (oneMethodInfo.MethodName.CompareNoCase(L"LZMA") == 0) - { - defined = true; - methodFull.MethodID = k_LZMA; - } - #endif - - #ifdef COMPRESS_PPMD - if (oneMethodInfo.MethodName.CompareNoCase(L"PPMD") == 0) - { - defined = true; - methodFull.MethodID = k_PPMD; - } - #endif - - #ifdef COMPRESS_BCJ_X86 - if (oneMethodInfo.MethodName.CompareNoCase(L"BCJ") == 0) - { - defined = true; - methodFull.MethodID = k_BCJ_X86; - } - #endif - - #ifdef COMPRESS_BCJ2 - if (oneMethodInfo.MethodName.CompareNoCase(L"BCJ2") == 0) - { - defined = true; - methodFull.MethodID = k_BCJ2; - methodFull.NumInStreams = 4; - methodFull.NumOutStreams = 1; - } - #endif - - #ifdef COMPRESS_DEFLATE_ENCODER - if (oneMethodInfo.MethodName.CompareNoCase(L"Deflate") == 0) - { - defined = true; - methodFull.MethodID = k_Deflate; - } - #endif - - #ifdef COMPRESS_BZIP2_ENCODER - if (oneMethodInfo.MethodName.CompareNoCase(L"BZip2") == 0) - { - defined = true; - methodFull.MethodID = k_BZip2; - } - #endif - - #ifdef COMPRESS_COPY - if (oneMethodInfo.MethodName.CompareNoCase(L"Copy") == 0) - { - defined = true; - methodFull.MethodID = k_Copy; - } - - #endif - - #ifdef EXCLUDE_COM - - if (defined) - { - - methodFull.CoderProperties = oneMethodInfo.CoderProperties; - methodMode.Methods.Add(methodFull); - continue; - } - - #else - - CMethodInfo2 methodInfo; - if (!GetMethodInfo(oneMethodInfo.MethodName, methodInfo)) - return E_FAIL; - if (!methodInfo.EncoderIsAssigned) - return E_FAIL; - - methodFull.MethodID = methodInfo.MethodID; - methodFull.NumInStreams = methodInfo.NumInStreams; - methodFull.NumOutStreams = methodInfo.NumOutStreams; - - methodFull.EncoderClassID = methodInfo.Encoder; - methodFull.FilePath = methodInfo.FilePath; - methodFull.CoderProperties = oneMethodInfo.CoderProperties; - defined = true; - - #endif - if (!defined) - return E_FAIL; - - methodMode.Methods.Add(methodFull); - - if (!_numSolidBytesDefined) - { - for (int j = 0; j < methodFull.CoderProperties.Size(); j++) - { - const CProperty &prop = methodFull.CoderProperties[j]; - if ((prop.PropID == NCoderPropID::kDictionarySize || - prop.PropID == NCoderPropID::kUsedMemorySize) && prop.Value.vt == VT_UI4) - { - _numSolidBytes = ((UInt64)prop.Value.ulVal) << 7; - const UInt64 kMinSize = (1 << 24); - if (_numSolidBytes < kMinSize) - _numSolidBytes = kMinSize; - _numSolidBytesDefined = true; - break; - } - } - } - } - - if (!needSolid && !_numSolidBytesDefined) - { - _numSolidBytesDefined = true; - _numSolidBytes = 0; - } - return S_OK; -} - -static HRESULT GetTime(IArchiveUpdateCallback *updateCallback, int index, PROPID propID, CArchiveFileTime &filetime, bool &filetimeIsDefined) -{ - filetimeIsDefined = false; - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(index, propID, &propVariant)); - if (propVariant.vt == VT_FILETIME) - { - filetime = propVariant.filetime; - filetimeIsDefined = true; - } - else if (propVariant.vt != VT_EMPTY) - return E_INVALIDARG; - return S_OK; -} - -STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numItems, - IArchiveUpdateCallback *updateCallback) -{ - COM_TRY_BEGIN - - const CArchiveDatabaseEx *database = 0; - #ifdef _7Z_VOL - if(_volumes.Size() > 1) - return E_FAIL; - const CVolume *volume = 0; - if (_volumes.Size() == 1) - { - volume = &_volumes.Front(); - database = &volume->Database; - } - #else - if (_inStream != 0) - database = &_database; - #endif - - // CRecordVector compressStatuses; - CObjectVector updateItems; - // CRecordVector copyIndices; - - // CMyComPtr updateCallback2; - // updateCallback->QueryInterface(&updateCallback2); - - for(UInt32 i = 0; i < numItems; i++) - { - Int32 newData; - Int32 newProperties; - UInt32 indexInArchive; - if (!updateCallback) - return E_FAIL; - RINOK(updateCallback->GetUpdateItemInfo(i, - &newData, &newProperties, &indexInArchive)); - CUpdateItem updateItem; - updateItem.NewProperties = IntToBool(newProperties); - updateItem.NewData = IntToBool(newData); - updateItem.IndexInArchive = indexInArchive; - updateItem.IndexInClient = i; - updateItem.IsAnti = false; - updateItem.Size = 0; - - if (updateItem.IndexInArchive != -1) - { - const CFileItem &fileItem = database->Files[updateItem.IndexInArchive]; - updateItem.Name = fileItem.Name; - updateItem.IsDirectory = fileItem.IsDirectory; - updateItem.Size = fileItem.UnPackSize; - updateItem.IsAnti = fileItem.IsAnti; - - updateItem.CreationTime = fileItem.CreationTime; - updateItem.IsCreationTimeDefined = fileItem.IsCreationTimeDefined; - updateItem.LastWriteTime = fileItem.LastWriteTime; - updateItem.IsLastWriteTimeDefined = fileItem.IsLastWriteTimeDefined; - updateItem.LastAccessTime = fileItem.LastAccessTime; - updateItem.IsLastAccessTimeDefined = fileItem.IsLastAccessTimeDefined; - } - - if (updateItem.NewProperties) - { - bool nameIsDefined; - bool folderStatusIsDefined; - { - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(i, kpidAttributes, &propVariant)); - if (propVariant.vt == VT_EMPTY) - updateItem.AttributesAreDefined = false; - else if (propVariant.vt != VT_UI4) - return E_INVALIDARG; - else - { - updateItem.Attributes = propVariant.ulVal; - updateItem.AttributesAreDefined = true; - } - } - - RINOK(GetTime(updateCallback, i, kpidCreationTime, updateItem.CreationTime, updateItem.IsCreationTimeDefined)); - RINOK(GetTime(updateCallback, i, kpidLastWriteTime, updateItem.LastWriteTime , updateItem.IsLastWriteTimeDefined)); - RINOK(GetTime(updateCallback, i, kpidLastAccessTime, updateItem.LastAccessTime, updateItem.IsLastAccessTimeDefined)); - - { - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(i, kpidPath, &propVariant)); - if (propVariant.vt == VT_EMPTY) - nameIsDefined = false; - else if (propVariant.vt != VT_BSTR) - return E_INVALIDARG; - else - { - updateItem.Name = NItemName::MakeLegalName(propVariant.bstrVal); - nameIsDefined = true; - } - } - { - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(i, kpidIsFolder, &propVariant)); - if (propVariant.vt == VT_EMPTY) - folderStatusIsDefined = false; - else if (propVariant.vt != VT_BOOL) - return E_INVALIDARG; - else - { - updateItem.IsDirectory = (propVariant.boolVal != VARIANT_FALSE); - folderStatusIsDefined = true; - } - } - - { - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(i, kpidIsAnti, &propVariant)); - if (propVariant.vt == VT_EMPTY) - updateItem.IsAnti = false; - else if (propVariant.vt != VT_BOOL) - return E_INVALIDARG; - else - updateItem.IsAnti = (propVariant.boolVal != VARIANT_FALSE); - } - - if (updateItem.IsAnti) - { - updateItem.AttributesAreDefined = false; - - updateItem.IsCreationTimeDefined = false; - updateItem.IsLastWriteTimeDefined = false; - updateItem.IsLastAccessTimeDefined = false; - - updateItem.Size = 0; - } - - if (!folderStatusIsDefined && updateItem.AttributesAreDefined) - updateItem.SetDirectoryStatusFromAttributes(); - } - - if (updateItem.NewData) - { - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(i, kpidSize, &propVariant)); - if (propVariant.vt != VT_UI8) - return E_INVALIDARG; - updateItem.Size = (UInt64)propVariant.uhVal.QuadPart; - if (updateItem.Size != 0 && updateItem.IsAnti) - return E_INVALIDARG; - } - updateItems.Add(updateItem); - } - - CCompressionMethodMode methodMode, headerMethod; - RINOK(SetCompressionMethod(methodMode, headerMethod)); - #ifdef COMPRESS_MT - methodMode.NumThreads = _numThreads; - headerMethod.NumThreads = 1; - #endif - - RINOK(SetPassword(methodMode, updateCallback)); - - bool useAdditionalHeaderStreams = true; - bool compressMainHeader = false; - - if (_compressHeadersFull) - { - useAdditionalHeaderStreams = false; - compressMainHeader = true; - } - if (methodMode.PasswordIsDefined) - { - useAdditionalHeaderStreams = false; - compressMainHeader = true; - if(_encryptHeaders) - RINOK(SetPassword(headerMethod, updateCallback)); - } - - if (numItems < 2) - compressMainHeader = false; - - CUpdateOptions options; - options.Method = &methodMode; - options.HeaderMethod = (_compressHeaders || - (methodMode.PasswordIsDefined && _encryptHeaders)) ? - &headerMethod : 0; - options.UseFilters = _level != 0 && _autoFilter; - options.MaxFilter = _level >= 8; - - options.HeaderOptions.UseAdditionalHeaderStreams = useAdditionalHeaderStreams; - options.HeaderOptions.CompressMainHeader = compressMainHeader; - options.HeaderOptions.WriteModified = WriteModified; - options.HeaderOptions.WriteCreated = WriteCreated; - options.HeaderOptions.WriteAccessed = WriteAccessed; - - options.NumSolidFiles = _numSolidFiles; - options.NumSolidBytes = _numSolidBytes; - options.SolidExtension = _solidExtension; - options.RemoveSfxBlock = _removeSfxBlock; - options.VolumeMode = _volumeMode; - return Update( - #ifdef _7Z_VOL - volume ? volume->Stream: 0, - volume ? database: 0, - #else - _inStream, - database, - #endif - updateItems, outStream, updateCallback, options); - COM_TRY_END -} - -static HRESULT GetBindInfoPart(UString &srcString, UInt32 &coder, UInt32 &stream) -{ - stream = 0; - int index = ParseStringToUInt32(srcString, coder); - if (index == 0) - return E_INVALIDARG; - srcString.Delete(0, index); - if (srcString[0] == 'S') - { - srcString.Delete(0); - int index = ParseStringToUInt32(srcString, stream); - if (index == 0) - return E_INVALIDARG; - srcString.Delete(0, index); - } - return S_OK; -} - -static HRESULT GetBindInfo(UString &srcString, CBind &bind) -{ - RINOK(GetBindInfoPart(srcString, bind.OutCoder, bind.OutStream)); - if (srcString[0] != ':') - return E_INVALIDARG; - srcString.Delete(0); - RINOK(GetBindInfoPart(srcString, bind.InCoder, bind.InStream)); - if (!srcString.IsEmpty()) - return E_INVALIDARG; - return S_OK; -} - -static void SplitParams(const UString &srcString, UStringVector &subStrings) -{ - subStrings.Clear(); - UString name; - int len = srcString.Length(); - if (len == 0) - return; - for (int i = 0; i < len; i++) - { - wchar_t c = srcString[i]; - if (c == L':') - { - subStrings.Add(name); - name.Empty(); - } - else - name += c; - } - subStrings.Add(name); -} - -static void SplitParam(const UString ¶m, UString &name, UString &value) -{ - int eqPos = param.Find(L'='); - if (eqPos >= 0) - { - name = param.Left(eqPos); - value = param.Mid(eqPos + 1); - return; - } - for(int i = 0; i < param.Length(); i++) - { - wchar_t c = param[i]; - if (c >= L'0' && c <= L'9') - { - name = param.Left(i); - value = param.Mid(i); - return; - } - } - name = param; -} - -HRESULT CHandler::SetParam(COneMethodInfo &oneMethodInfo, const UString &name, const UString &value) -{ - CProperty property; - if (name.CompareNoCase(L"D") == 0 || name.CompareNoCase(L"MEM") == 0) - { - UInt32 dicSize; - RINOK(ParsePropDictionaryValue(value, dicSize)); - if (name.CompareNoCase(L"D") == 0) - property.PropID = NCoderPropID::kDictionarySize; - else - property.PropID = NCoderPropID::kUsedMemorySize; - property.Value = dicSize; - oneMethodInfo.CoderProperties.Add(property); - } - else - { - int index = FindPropIdFromStringName(name); - if (index < 0) - return E_INVALIDARG; - - const CNameToPropID &nameToPropID = g_NameToPropID[index]; - property.PropID = nameToPropID.PropID; - - NCOM::CPropVariant propValue; - - - if (nameToPropID.VarType == VT_BSTR) - propValue = value; - else - { - UInt32 number; - if (ParseStringToUInt32(value, number) == value.Length()) - propValue = number; - else - propValue = value; - } - - if (!ConvertProperty(propValue, nameToPropID.VarType, property.Value)) - return E_INVALIDARG; - - oneMethodInfo.CoderProperties.Add(property); - } - return S_OK; -} - -HRESULT CHandler::SetParams(COneMethodInfo &oneMethodInfo, const UString &srcString) -{ - UStringVector params; - SplitParams(srcString, params); - if (params.Size() > 0) - oneMethodInfo.MethodName = params[0]; - for (int i = 1; i < params.Size(); i++) - { - const UString ¶m = params[i]; - UString name, value; - SplitParam(param, name, value); - RINOK(SetParam(oneMethodInfo, name, value)); - } - return S_OK; -} - -HRESULT CHandler::SetSolidSettings(const UString &s) -{ - UString s2 = s; - s2.MakeUpper(); - if (s2.IsEmpty() || s2.Compare(L"ON") == 0) - { - InitSolid(); - return S_OK; - } - if (s2.Compare(L"OFF") == 0) - { - _numSolidFiles = 1; - return S_OK; - } - for (int i = 0; i < s2.Length();) - { - const wchar_t *start = ((const wchar_t *)s2) + i; - const wchar_t *end; - UInt64 v = ConvertStringToUInt64(start, &end); - if (start == end) - { - if (s2[i++] != 'E') - return E_INVALIDARG; - _solidExtension = true; - continue; - } - i += (int)(end - start); - if (i == s2.Length()) - return E_INVALIDARG; - wchar_t c = s2[i++]; - switch(c) - { - case 'F': - if (v < 1) - v = 1; - _numSolidFiles = v; - break; - case 'B': - _numSolidBytes = v; - _numSolidBytesDefined = true; - break; - case 'K': - _numSolidBytes = (v << 10); - _numSolidBytesDefined = true; - break; - case 'M': - _numSolidBytes = (v << 20); - _numSolidBytesDefined = true; - break; - case 'G': - _numSolidBytes = (v << 30); - _numSolidBytesDefined = true; - break; - default: - return E_INVALIDARG; - } - } - return S_OK; -} - -HRESULT CHandler::SetSolidSettings(const PROPVARIANT &value) -{ - switch(value.vt) - { - case VT_EMPTY: - InitSolid(); - return S_OK; - case VT_BSTR: - return SetSolidSettings(value.bstrVal); - default: - return E_INVALIDARG; - } -} - -STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties) -{ - COM_TRY_BEGIN - _methods.Clear(); - _binds.Clear(); - Init(); - #ifdef COMPRESS_MT - const UInt32 numProcessors = NSystem::GetNumberOfProcessors(); - #endif - - UInt32 mainDicSize = 0xFFFFFFFF; - UInt32 mainDicMethodIndex = 0xFFFFFFFF; - - UInt32 minNumber = 0; - - for (int i = 0; i < numProperties; i++) - { - UString name = names[i]; - name.MakeUpper(); - if (name.IsEmpty()) - return E_INVALIDARG; - - const PROPVARIANT &value = values[i]; - - if (name[0] == 'X') - { - name.Delete(0); - _level = 9; - RINOK(ParsePropValue(name, value, _level)); - continue; - } - - if (name[0] == 'B') - { - name.Delete(0); - CBind bind; - RINOK(GetBindInfo(name, bind)); - _binds.Add(bind); - continue; - } - - if (name[0] == L'S') - { - name.Delete(0); - if (name.IsEmpty()) - { - RINOK(SetSolidSettings(value)); - } - else - { - RINOK(SetSolidSettings(name)); - } - continue; - } - - - UInt32 number; - int index = ParseStringToUInt32(name, number); - UString realName = name.Mid(index); - if (index == 0) - { - if(name.Left(2).CompareNoCase(L"MT") == 0) - { - #ifdef COMPRESS_MT - RINOK(ParseMtProp(name.Mid(2), value, numProcessors, _numThreads)); - #endif - continue; - } - else if (name.CompareNoCase(L"RSFX") == 0) - { - RINOK(SetBoolProperty(_removeSfxBlock, value)); - continue; - } - else if (name.CompareNoCase(L"F") == 0) - { - RINOK(SetBoolProperty(_autoFilter, value)); - continue; - } - else if (name.CompareNoCase(L"HC") == 0) - { - RINOK(SetBoolProperty(_compressHeaders, value)); - continue; - } - else if (name.CompareNoCase(L"HCF") == 0) - { - RINOK(SetBoolProperty(_compressHeadersFull, value)); - continue; - } - else if (name.CompareNoCase(L"HE") == 0) - { - RINOK(SetBoolProperty(_encryptHeaders, value)); - continue; - } - else if (name.CompareNoCase(L"TM") == 0) - { - RINOK(SetBoolProperty(WriteModified, value)); - continue; - } - else if (name.CompareNoCase(L"TC") == 0) - { - RINOK(SetBoolProperty(WriteCreated, value)); - continue; - } - else if (name.CompareNoCase(L"TA") == 0) - { - RINOK(SetBoolProperty(WriteAccessed, value)); - continue; - } - else if (name.CompareNoCase(L"V") == 0) - { - RINOK(SetBoolProperty(_volumeMode, value)); - continue; - } - number = 0; - } - if (number > 10000) - return E_FAIL; - if (number < minNumber) - return E_INVALIDARG; - number -= minNumber; - for(int j = _methods.Size(); j <= (int)number; j++) - { - COneMethodInfo oneMethodInfo; - _methods.Add(oneMethodInfo); - } - - COneMethodInfo &oneMethodInfo = _methods[number]; - - if (realName.Length() == 0) - { - if (value.vt != VT_BSTR) - return E_INVALIDARG; - - // oneMethodInfo.MethodName = UnicodeStringToMultiByte(UString(value.bstrVal)); - RINOK(SetParams(oneMethodInfo, value.bstrVal)); - } - else - { - CProperty property; - if (realName.Left(1).CompareNoCase(L"D") == 0) - { - UInt32 dicSize; - RINOK(ParsePropDictionaryValue(realName.Mid(1), value, dicSize)); - property.PropID = NCoderPropID::kDictionarySize; - property.Value = dicSize; - oneMethodInfo.CoderProperties.Add(property); - if (number <= mainDicMethodIndex) - mainDicSize = dicSize; - } - else if (realName.Left(3).CompareNoCase(L"MEM") == 0) - { - UInt32 dicSize; - RINOK(ParsePropDictionaryValue(realName.Mid(3), value, dicSize)); - property.PropID = NCoderPropID::kUsedMemorySize; - property.Value = dicSize; - oneMethodInfo.CoderProperties.Add(property); - if (number <= mainDicMethodIndex) - mainDicSize = dicSize; - } - else - { - int index = FindPropIdFromStringName(realName); - if (index < 0) - return E_INVALIDARG; - - const CNameToPropID &nameToPropID = g_NameToPropID[index]; - property.PropID = nameToPropID.PropID; - - if (!ConvertProperty(value, nameToPropID.VarType, property.Value)) - return E_INVALIDARG; - - oneMethodInfo.CoderProperties.Add(property); - } - } - } - - return S_OK; - COM_TRY_END -} - -}} diff --git a/7zip/Archive/7z/7zHeader.cpp b/7zip/Archive/7z/7zHeader.cpp deleted file mode 100755 index cff4d121..00000000 --- a/7zip/Archive/7z/7zHeader.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// 7z/Header.cpp - -#include "StdAfx.h" -#include "7zHeader.h" - -namespace NArchive { -namespace N7z { - -Byte kSignature[kSignatureSize] = {'7' + 1, 'z', 0xBC, 0xAF, 0x27, 0x1C}; -Byte kFinishSignature[kSignatureSize] = {'7' + 1, 'z', 0xBC, 0xAF, 0x27, 0x1C + 1}; - -class SignatureInitializer -{ -public: - SignatureInitializer() { kSignature[0]--; kFinishSignature[0]--;}; -} g_SignatureInitializer; - -}} - diff --git a/7zip/Archive/7z/7zHeader.h b/7zip/Archive/7z/7zHeader.h deleted file mode 100755 index 59bc7fe5..00000000 --- a/7zip/Archive/7z/7zHeader.h +++ /dev/null @@ -1,96 +0,0 @@ -// 7z/7zHeader.h - -#ifndef __7Z_HEADER_H -#define __7Z_HEADER_H - -#include "7zMethodID.h" - -namespace NArchive { -namespace N7z { - -const int kSignatureSize = 6; -extern Byte kSignature[kSignatureSize]; - -// #define _7Z_VOL -// 7z-MultiVolume is not finished yet. -// It can work already, but I still do not like some -// things of that new multivolume format. -// So please keep it commented. - -#ifdef _7Z_VOL -extern Byte kFinishSignature[kSignatureSize]; -#endif - -struct CArchiveVersion -{ - Byte Major; - Byte Minor; -}; - -const Byte kMajorVersion = 0; - -struct CStartHeader -{ - UInt64 NextHeaderOffset; - UInt64 NextHeaderSize; - UInt32 NextHeaderCRC; -}; - -const UInt32 kStartHeaderSize = 20; - -#ifdef _7Z_VOL -struct CFinishHeader: public CStartHeader -{ - UInt64 ArchiveStartOffset; // data offset from end if that struct - UInt64 AdditionalStartBlockSize; // start signature & start header size -}; - -const UInt32 kFinishHeaderSize = kStartHeaderSize + 16; -#endif - -namespace NID -{ - enum EEnum - { - kEnd, - - kHeader, - - kArchiveProperties, - - kAdditionalStreamsInfo, - kMainStreamsInfo, - kFilesInfo, - - kPackInfo, - kUnPackInfo, - kSubStreamsInfo, - - kSize, - kCRC, - - kFolder, - - kCodersUnPackSize, - kNumUnPackStream, - - kEmptyStream, - kEmptyFile, - kAnti, - - kName, - kCreationTime, - kLastAccessTime, - kLastWriteTime, - kWinAttributes, - kComment, - - kEncodedHeader, - - kStartPos - }; -} - -}} - -#endif diff --git a/7zip/Archive/7z/7zIn.cpp b/7zip/Archive/7z/7zIn.cpp deleted file mode 100755 index 53d78b1a..00000000 --- a/7zip/Archive/7z/7zIn.cpp +++ /dev/null @@ -1,1335 +0,0 @@ -// 7zIn.cpp - -#include "StdAfx.h" - -#include "7zIn.h" -#include "7zMethods.h" -#include "7zDecode.h" -#include "../../Common/StreamObjects.h" -#include "../../Common/StreamUtils.h" -#include "../../../Common/CRC.h" - -// define FORMAT_7Z_RECOVERY if you want to recover multivolume archives with empty StartHeader -// #define FORMAT_7Z_RECOVERY - -namespace NArchive { -namespace N7z { - -class CStreamSwitch -{ - CInArchive *_archive; - bool _needRemove; -public: - CStreamSwitch(): _needRemove(false) {} - ~CStreamSwitch() { Remove(); } - void Remove(); - void Set(CInArchive *archive, const Byte *data, size_t size); - void Set(CInArchive *archive, const CByteBuffer &byteBuffer); - HRESULT Set(CInArchive *archive, const CObjectVector *dataVector); -}; - -void CStreamSwitch::Remove() -{ - if (_needRemove) - { - _archive->DeleteByteStream(); - _needRemove = false; - } -} - -void CStreamSwitch::Set(CInArchive *archive, const Byte *data, size_t size) -{ - Remove(); - _archive = archive; - _archive->AddByteStream(data, size); - _needRemove = true; -} - -void CStreamSwitch::Set(CInArchive *archive, const CByteBuffer &byteBuffer) -{ - Set(archive, byteBuffer, byteBuffer.GetCapacity()); -} - -HRESULT CStreamSwitch::Set(CInArchive *archive, const CObjectVector *dataVector) -{ - Remove(); - Byte external; - RINOK(archive->ReadByte(external)); - if (external != 0) - { - CNum dataIndex; - RINOK(archive->ReadNum(dataIndex)); - Set(archive, (*dataVector)[dataIndex]); - } - return S_OK; -} - - -CInArchiveException::CInArchiveException(CCauseType cause): - Cause(cause) -{} - -HRESULT CInArchive::ReadDirect(IInStream *stream, void *data, UInt32 size, - UInt32 *processedSize) -{ - UInt32 realProcessedSize; - HRESULT result = ReadStream(stream, data, size, &realProcessedSize); - if(processedSize != NULL) - *processedSize = realProcessedSize; - _position += realProcessedSize; - return result; -} - -HRESULT CInArchive::ReadDirect(void *data, UInt32 size, UInt32 *processedSize) -{ - return ReadDirect(_stream, data, size, processedSize); -} - -HRESULT CInArchive::SafeReadDirect(void *data, UInt32 size) -{ - UInt32 realProcessedSize; - RINOK(ReadDirect(data, size, &realProcessedSize)); - if (realProcessedSize != size) - throw CInArchiveException(CInArchiveException::kUnexpectedEndOfArchive); - return S_OK; -} - -HRESULT CInArchive::SafeReadDirectByte(Byte &b) -{ - return SafeReadDirect(&b, 1); -} - -HRESULT CInArchive::SafeReadDirectUInt32(UInt32 &value) -{ - value = 0; - for (int i = 0; i < 4; i++) - { - Byte b; - RINOK(SafeReadDirectByte(b)); - value |= (UInt32(b) << (8 * i)); - } - return S_OK; -} - -HRESULT CInArchive::SafeReadDirectUInt64(UInt64 &value) -{ - value = 0; - for (int i = 0; i < 8; i++) - { - Byte b; - RINOK(SafeReadDirectByte(b)); - value |= (UInt64(b) << (8 * i)); - } - return S_OK; -} - -HRESULT CInArchive::ReadNumber(UInt64 &value) -{ - Byte firstByte; - RINOK(ReadByte(firstByte)); - Byte mask = 0x80; - value = 0; - for (int i = 0; i < 8; i++) - { - if ((firstByte & mask) == 0) - { - UInt64 highPart = firstByte & (mask - 1); - value += (highPart << (i * 8)); - return S_OK; - } - Byte b; - RINOK(ReadByte(b)); - value |= (UInt64(b) << (8 * i)); - mask >>= 1; - } - return S_OK; -} - -HRESULT CInArchive::ReadNum(CNum &value) -{ - UInt64 value64; - RINOK(ReadNumber(value64)); - if (value64 > kNumMax) - return E_FAIL; - value = (CNum)value64; - return S_OK; -} - -HRESULT CInArchive::ReadUInt32(UInt32 &value) -{ - value = 0; - for (int i = 0; i < 4; i++) - { - Byte b; - RINOK(ReadByte(b)); - value |= (UInt32(b) << (8 * i)); - } - return S_OK; -} - -HRESULT CInArchive::ReadUInt64(UInt64 &value) -{ - value = 0; - for (int i = 0; i < 8; i++) - { - Byte b; - RINOK(ReadByte(b)); - value |= (UInt64(b) << (8 * i)); - } - return S_OK; -} - -static inline bool TestSignatureCandidate(const void *testBytes) -{ - for (int i = 0; i < kSignatureSize; i++) - if (((const Byte *)testBytes)[i] != kSignature[i]) - return false; - return true; -} - -#ifdef _7Z_VOL -static inline bool TestFinishSignatureCandidate(const void *testBytes) -{ - for (int i = 0; i < kSignatureSize; i++) - if (((const Byte *)testBytes)[i] != kFinishSignature[i]) - return false; - return true; -} -#endif - -HRESULT CInArchive::FindAndReadSignature(IInStream *stream, const UInt64 *searchHeaderSizeLimit) -{ - _position = _arhiveBeginStreamPosition; - RINOK(stream->Seek(_arhiveBeginStreamPosition, STREAM_SEEK_SET, NULL)); - - Byte signature[kSignatureSize]; - UInt32 processedSize; - RINOK(ReadDirect(stream, signature, kSignatureSize, &processedSize)); - if(processedSize != kSignatureSize) - return S_FALSE; - if (TestSignatureCandidate(signature)) - return S_OK; - - CByteBuffer byteBuffer; - const UInt32 kBufferSize = (1 << 16); - byteBuffer.SetCapacity(kBufferSize); - Byte *buffer = byteBuffer; - UInt32 numPrevBytes = kSignatureSize - 1; - memmove(buffer, signature + 1, numPrevBytes); - UInt64 curTestPos = _arhiveBeginStreamPosition + 1; - for (;;) - { - if (searchHeaderSizeLimit != NULL) - if (curTestPos - _arhiveBeginStreamPosition > *searchHeaderSizeLimit) - break; - UInt32 numReadBytes = kBufferSize - numPrevBytes; - RINOK(ReadDirect(stream, buffer + numPrevBytes, numReadBytes, &processedSize)); - UInt32 numBytesInBuffer = numPrevBytes + processedSize; - if (numBytesInBuffer < kSignatureSize) - break; - UInt32 numTests = numBytesInBuffer - kSignatureSize + 1; - for(UInt32 pos = 0; pos < numTests; pos++, curTestPos++) - { - if (TestSignatureCandidate(buffer + pos)) - { - _arhiveBeginStreamPosition = curTestPos; - _position = curTestPos + kSignatureSize; - return stream->Seek(_position, STREAM_SEEK_SET, NULL); - } - } - numPrevBytes = numBytesInBuffer - numTests; - memmove(buffer, buffer + numTests, numPrevBytes); - } - return S_FALSE; -} - -// Out: _position must point to end of signature - -#ifdef _7Z_VOL -HRESULT CInArchive::FindFinishSignature(IInStream *stream, const UInt64 *searchHeaderSizeLimit) -{ - RINOK(stream->Seek(0, STREAM_SEEK_END, &_position)); - if (_position < kSignatureSize) - return S_FALSE; - - CByteBuffer byteBuffer; - const UInt32 kBufferSize = (1 << 18); - byteBuffer.SetCapacity(kBufferSize); - Byte *buffer = byteBuffer; - UInt32 numPrevBytes = 0; - UInt64 limitPos = 0; - if (searchHeaderSizeLimit != NULL) - if (*searchHeaderSizeLimit < _position) - limitPos = _position - *searchHeaderSizeLimit; - - while(_position >= limitPos) - { - UInt32 numReadBytes = kBufferSize - numPrevBytes; - if (numReadBytes > _position) - numReadBytes = (UInt32)_position; - UInt32 numBytesInBuffer = numPrevBytes + numReadBytes; - if (numBytesInBuffer < kSignatureSize) - return S_FALSE; - _position -= numReadBytes; - RINOK(stream->Seek(_position, STREAM_SEEK_SET, &_position)); - UInt32 startPos = kBufferSize - numBytesInBuffer; - UInt32 processedSize; - RINOK(ReadDirect(stream, buffer + startPos, numReadBytes, &processedSize)); - if (processedSize != numReadBytes) - return S_FALSE; - _position -= processedSize; - for(UInt32 pos = kBufferSize; pos >= startPos + kSignatureSize; pos--) - { - if (TestFinishSignatureCandidate(buffer + pos - kSignatureSize)) - { - _position += pos - startPos; - return stream->Seek(_position, STREAM_SEEK_SET, NULL); - } - } - numPrevBytes = kSignatureSize - 1; - memmove(buffer + kBufferSize - numPrevBytes, buffer + startPos + 1, numPrevBytes); - } - return S_FALSE; -} -#endif - -// S_FALSE means that file is not archive -HRESULT CInArchive::Open(IInStream *stream, const UInt64 *searchHeaderSizeLimit) -{ - Close(); - RINOK(stream->Seek(0, STREAM_SEEK_CUR, &_arhiveBeginStreamPosition)) - _position = _arhiveBeginStreamPosition; - #ifdef _7Z_VOL - HRESULT result = FindFinishSignature(stream, searchHeaderSizeLimit); - if (result == S_OK) - _finishSignature = true; - else - { - if (result != S_FALSE) - return result; - _finishSignature = false; - RINOK(FindAndReadSignature(stream, searchHeaderSizeLimit)); - } - #else - RINOK(FindAndReadSignature(stream, searchHeaderSizeLimit)); - #endif - _stream = stream; - return S_OK; -} - -void CInArchive::Close() -{ - _stream.Release(); -} - -HRESULT CInArchive::SkeepData(UInt64 size) -{ - for (UInt64 i = 0; i < size; i++) - { - Byte temp; - RINOK(ReadByte(temp)); - } - return S_OK; -} - -HRESULT CInArchive::SkeepData() -{ - UInt64 size; - RINOK(ReadNumber(size)); - return SkeepData(size); -} - -HRESULT CInArchive::ReadArchiveProperties(CInArchiveInfo & /* archiveInfo */) -{ - for (;;) - { - UInt64 type; - RINOK(ReadID(type)); - if (type == NID::kEnd) - break; - SkeepData(); - } - return S_OK; -} - -HRESULT CInArchive::GetNextFolderItem(CFolder &folder) -{ - CNum numCoders; - RINOK(ReadNum(numCoders)); - - folder.Coders.Clear(); - folder.Coders.Reserve((int)numCoders); - CNum numInStreams = 0; - CNum numOutStreams = 0; - CNum i; - for (i = 0; i < numCoders; i++) - { - folder.Coders.Add(CCoderInfo()); - CCoderInfo &coder = folder.Coders.Back(); - - for (;;) - { - coder.AltCoders.Add(CAltCoderInfo()); - CAltCoderInfo &altCoder = coder.AltCoders.Back(); - Byte mainByte = 0; - RINOK(ReadByte(mainByte)); - altCoder.MethodID.IDSize = (Byte)(mainByte & 0xF); - RINOK(ReadBytes(altCoder.MethodID.ID, altCoder.MethodID.IDSize)); - if ((mainByte & 0x10) != 0) - { - RINOK(ReadNum(coder.NumInStreams)); - RINOK(ReadNum(coder.NumOutStreams)); - } - else - { - coder.NumInStreams = 1; - coder.NumOutStreams = 1; - } - if ((mainByte & 0x20) != 0) - { - CNum propertiesSize = 0; - RINOK(ReadNum(propertiesSize)); - altCoder.Properties.SetCapacity((size_t)propertiesSize); - RINOK(ReadBytes((Byte *)altCoder.Properties, (size_t)propertiesSize)); - } - if ((mainByte & 0x80) == 0) - break; - } - numInStreams += coder.NumInStreams; - numOutStreams += coder.NumOutStreams; - } - - CNum numBindPairs; - // RINOK(ReadNumber(numBindPairs)); - numBindPairs = numOutStreams - 1; - folder.BindPairs.Clear(); - folder.BindPairs.Reserve(numBindPairs); - for (i = 0; i < numBindPairs; i++) - { - CBindPair bindPair; - RINOK(ReadNum(bindPair.InIndex)); - RINOK(ReadNum(bindPair.OutIndex)); - folder.BindPairs.Add(bindPair); - } - - CNum numPackedStreams = numInStreams - numBindPairs; - folder.PackStreams.Reserve(numPackedStreams); - if (numPackedStreams == 1) - { - for (CNum j = 0; j < numInStreams; j++) - if (folder.FindBindPairForInStream(j) < 0) - { - folder.PackStreams.Add(j); - break; - } - } - else - for(i = 0; i < numPackedStreams; i++) - { - CNum packStreamInfo; - RINOK(ReadNum(packStreamInfo)); - folder.PackStreams.Add(packStreamInfo); - } - - return S_OK; -} - -HRESULT CInArchive::WaitAttribute(UInt64 attribute) -{ - for (;;) - { - UInt64 type; - RINOK(ReadID(type)); - if (type == attribute) - return S_OK; - if (type == NID::kEnd) - return S_FALSE; - RINOK(SkeepData()); - } -} - -HRESULT CInArchive::ReadHashDigests(int numItems, - CRecordVector &digestsDefined, - CRecordVector &digests) -{ - RINOK(ReadBoolVector2(numItems, digestsDefined)); - digests.Clear(); - digests.Reserve(numItems); - for(int i = 0; i < numItems; i++) - { - UInt32 crc = 0; - if (digestsDefined[i]) - RINOK(ReadUInt32(crc)); - digests.Add(crc); - } - return S_OK; -} - -HRESULT CInArchive::ReadPackInfo( - UInt64 &dataOffset, - CRecordVector &packSizes, - CRecordVector &packCRCsDefined, - CRecordVector &packCRCs) -{ - RINOK(ReadNumber(dataOffset)); - CNum numPackStreams; - RINOK(ReadNum(numPackStreams)); - - RINOK(WaitAttribute(NID::kSize)); - packSizes.Clear(); - packSizes.Reserve(numPackStreams); - for(CNum i = 0; i < numPackStreams; i++) - { - UInt64 size; - RINOK(ReadNumber(size)); - packSizes.Add(size); - } - - UInt64 type; - for (;;) - { - RINOK(ReadID(type)); - if (type == NID::kEnd) - break; - if (type == NID::kCRC) - { - RINOK(ReadHashDigests(numPackStreams, packCRCsDefined, packCRCs)); - continue; - } - RINOK(SkeepData()); - } - if (packCRCsDefined.IsEmpty()) - { - packCRCsDefined.Reserve(numPackStreams); - packCRCsDefined.Clear(); - packCRCs.Reserve(numPackStreams); - packCRCs.Clear(); - for(CNum i = 0; i < numPackStreams; i++) - { - packCRCsDefined.Add(false); - packCRCs.Add(0); - } - } - return S_OK; -} - -HRESULT CInArchive::ReadUnPackInfo( - const CObjectVector *dataVector, - CObjectVector &folders) -{ - RINOK(WaitAttribute(NID::kFolder)); - CNum numFolders; - RINOK(ReadNum(numFolders)); - - { - CStreamSwitch streamSwitch; - RINOK(streamSwitch.Set(this, dataVector)); - folders.Clear(); - folders.Reserve((UInt32)numFolders); - for(CNum i = 0; i < numFolders; i++) - { - folders.Add(CFolder()); - RINOK(GetNextFolderItem(folders.Back())); - } - } - - RINOK(WaitAttribute(NID::kCodersUnPackSize)); - - CNum i; - for(i = 0; i < numFolders; i++) - { - CFolder &folder = folders[i]; - CNum numOutStreams = folder.GetNumOutStreams(); - folder.UnPackSizes.Reserve(numOutStreams); - for(CNum j = 0; j < numOutStreams; j++) - { - UInt64 unPackSize; - RINOK(ReadNumber(unPackSize)); - folder.UnPackSizes.Add(unPackSize); - } - } - - for (;;) - { - UInt64 type; - RINOK(ReadID(type)); - if (type == NID::kEnd) - return S_OK; - if (type == NID::kCRC) - { - CRecordVector crcsDefined; - CRecordVector crcs; - RINOK(ReadHashDigests(numFolders, crcsDefined, crcs)); - for(i = 0; i < numFolders; i++) - { - CFolder &folder = folders[i]; - folder.UnPackCRCDefined = crcsDefined[i]; - folder.UnPackCRC = crcs[i]; - } - continue; - } - RINOK(SkeepData()); - } -} - -HRESULT CInArchive::ReadSubStreamsInfo( - const CObjectVector &folders, - CRecordVector &numUnPackStreamsInFolders, - CRecordVector &unPackSizes, - CRecordVector &digestsDefined, - CRecordVector &digests) -{ - numUnPackStreamsInFolders.Clear(); - numUnPackStreamsInFolders.Reserve(folders.Size()); - UInt64 type; - for (;;) - { - RINOK(ReadID(type)); - if (type == NID::kNumUnPackStream) - { - for(int i = 0; i < folders.Size(); i++) - { - CNum value; - RINOK(ReadNum(value)); - numUnPackStreamsInFolders.Add(value); - } - continue; - } - if (type == NID::kCRC || type == NID::kSize) - break; - if (type == NID::kEnd) - break; - RINOK(SkeepData()); - } - - if (numUnPackStreamsInFolders.IsEmpty()) - for(int i = 0; i < folders.Size(); i++) - numUnPackStreamsInFolders.Add(1); - - int i; - for(i = 0; i < numUnPackStreamsInFolders.Size(); i++) - { - // v3.13 incorrectly worked with empty folders - // v4.07: we check that folder is empty - CNum numSubstreams = numUnPackStreamsInFolders[i]; - if (numSubstreams == 0) - continue; - UInt64 sum = 0; - for (CNum j = 1; j < numSubstreams; j++) - { - UInt64 size; - if (type == NID::kSize) - { - RINOK(ReadNumber(size)); - unPackSizes.Add(size); - sum += size; - } - } - unPackSizes.Add(folders[i].GetUnPackSize() - sum); - } - if (type == NID::kSize) - { - RINOK(ReadID(type)); - } - - int numDigests = 0; - int numDigestsTotal = 0; - for(i = 0; i < folders.Size(); i++) - { - CNum numSubstreams = numUnPackStreamsInFolders[i]; - if (numSubstreams != 1 || !folders[i].UnPackCRCDefined) - numDigests += numSubstreams; - numDigestsTotal += numSubstreams; - } - - for (;;) - { - if (type == NID::kCRC) - { - CRecordVector digestsDefined2; - CRecordVector digests2; - RINOK(ReadHashDigests(numDigests, digestsDefined2, digests2)); - int digestIndex = 0; - for (i = 0; i < folders.Size(); i++) - { - CNum numSubstreams = numUnPackStreamsInFolders[i]; - const CFolder &folder = folders[i]; - if (numSubstreams == 1 && folder.UnPackCRCDefined) - { - digestsDefined.Add(true); - digests.Add(folder.UnPackCRC); - } - else - for (CNum j = 0; j < numSubstreams; j++, digestIndex++) - { - digestsDefined.Add(digestsDefined2[digestIndex]); - digests.Add(digests2[digestIndex]); - } - } - } - else if (type == NID::kEnd) - { - if (digestsDefined.IsEmpty()) - { - digestsDefined.Clear(); - digests.Clear(); - for (int i = 0; i < numDigestsTotal; i++) - { - digestsDefined.Add(false); - digests.Add(0); - } - } - return S_OK; - } - else - { - RINOK(SkeepData()); - } - RINOK(ReadID(type)); - } -} - -HRESULT CInArchive::ReadStreamsInfo( - const CObjectVector *dataVector, - UInt64 &dataOffset, - CRecordVector &packSizes, - CRecordVector &packCRCsDefined, - CRecordVector &packCRCs, - CObjectVector &folders, - CRecordVector &numUnPackStreamsInFolders, - CRecordVector &unPackSizes, - CRecordVector &digestsDefined, - CRecordVector &digests) -{ - for (;;) - { - UInt64 type; - RINOK(ReadID(type)); - switch(type) - { - case NID::kEnd: - return S_OK; - case NID::kPackInfo: - { - RINOK(ReadPackInfo(dataOffset, packSizes, - packCRCsDefined, packCRCs)); - break; - } - case NID::kUnPackInfo: - { - RINOK(ReadUnPackInfo(dataVector, folders)); - break; - } - case NID::kSubStreamsInfo: - { - RINOK(ReadSubStreamsInfo(folders, numUnPackStreamsInFolders, - unPackSizes, digestsDefined, digests)); - break; - } - } - } -} - -HRESULT CInArchive::ReadFileNames(CObjectVector &files) -{ - for(int i = 0; i < files.Size(); i++) - { - UString &name = files[i].Name; - name.Empty(); - for (;;) - { - wchar_t c; - RINOK(ReadWideCharLE(c)); - if (c == L'\0') - break; - name += c; - } - } - return S_OK; -} - -HRESULT CInArchive::ReadBoolVector(int numItems, CBoolVector &v) -{ - v.Clear(); - v.Reserve(numItems); - Byte b = 0; - Byte mask = 0; - for(int i = 0; i < numItems; i++) - { - if (mask == 0) - { - RINOK(ReadByte(b)); - mask = 0x80; - } - v.Add((b & mask) != 0); - mask >>= 1; - } - return S_OK; -} - -HRESULT CInArchive::ReadBoolVector2(int numItems, CBoolVector &v) -{ - Byte allAreDefined; - RINOK(ReadByte(allAreDefined)); - if (allAreDefined == 0) - return ReadBoolVector(numItems, v); - v.Clear(); - v.Reserve(numItems); - for (int i = 0; i < numItems; i++) - v.Add(true); - return S_OK; -} - -HRESULT CInArchive::ReadTime(const CObjectVector &dataVector, - CObjectVector &files, UInt64 type) -{ - CBoolVector boolVector; - RINOK(ReadBoolVector2(files.Size(), boolVector)) - - CStreamSwitch streamSwitch; - RINOK(streamSwitch.Set(this, &dataVector)); - - for(int i = 0; i < files.Size(); i++) - { - CFileItem &file = files[i]; - CArchiveFileTime fileTime; - fileTime.dwLowDateTime = 0; - fileTime.dwHighDateTime = 0; - bool defined = boolVector[i]; - if (defined) - { - UInt32 low, high; - RINOK(ReadUInt32(low)); - RINOK(ReadUInt32(high)); - fileTime.dwLowDateTime = low; - fileTime.dwHighDateTime = high; - } - switch(type) - { - case NID::kCreationTime: - file.IsCreationTimeDefined = defined; - if (defined) - file.CreationTime = fileTime; - break; - case NID::kLastWriteTime: - file.IsLastWriteTimeDefined = defined; - if (defined) - file.LastWriteTime = fileTime; - break; - case NID::kLastAccessTime: - file.IsLastAccessTimeDefined = defined; - if (defined) - file.LastAccessTime = fileTime; - break; - } - } - return S_OK; -} - -HRESULT CInArchive::ReadAndDecodePackedStreams(UInt64 baseOffset, - UInt64 &dataOffset, CObjectVector &dataVector - #ifndef _NO_CRYPTO - , ICryptoGetTextPassword *getTextPassword - #endif - ) -{ - CRecordVector packSizes; - CRecordVector packCRCsDefined; - CRecordVector packCRCs; - CObjectVector folders; - - CRecordVector numUnPackStreamsInFolders; - CRecordVector unPackSizes; - CRecordVector digestsDefined; - CRecordVector digests; - - RINOK(ReadStreamsInfo(NULL, - dataOffset, - packSizes, - packCRCsDefined, - packCRCs, - folders, - numUnPackStreamsInFolders, - unPackSizes, - digestsDefined, - digests)); - - // database.ArchiveInfo.DataStartPosition2 += database.ArchiveInfo.StartPositionAfterHeader; - - CNum packIndex = 0; - CDecoder decoder( - #ifdef _ST_MODE - false - #else - true - #endif - ); - UInt64 dataStartPos = baseOffset + dataOffset; - for(int i = 0; i < folders.Size(); i++) - { - const CFolder &folder = folders[i]; - dataVector.Add(CByteBuffer()); - CByteBuffer &data = dataVector.Back(); - UInt64 unPackSize = folder.GetUnPackSize(); - if (unPackSize > kNumMax) - return E_FAIL; - if (unPackSize > 0xFFFFFFFF) - return E_FAIL; - data.SetCapacity((size_t)unPackSize); - - CSequentialOutStreamImp2 *outStreamSpec = new CSequentialOutStreamImp2; - CMyComPtr outStream = outStreamSpec; - outStreamSpec->Init(data, (size_t)unPackSize); - - HRESULT result = decoder.Decode(_stream, dataStartPos, - &packSizes[packIndex], folder, outStream, NULL - #ifndef _NO_CRYPTO - , getTextPassword - #endif - #ifdef COMPRESS_MT - , false, 1 - #endif - ); - RINOK(result); - - if (folder.UnPackCRCDefined) - if (!CCRC::VerifyDigest(folder.UnPackCRC, data, (UInt32)unPackSize)) - throw CInArchiveException(CInArchiveException::kIncorrectHeader); - for (int j = 0; j < folder.PackStreams.Size(); j++) - dataStartPos += packSizes[packIndex++]; - } - return S_OK; -} - -HRESULT CInArchive::ReadHeader(CArchiveDatabaseEx &database - #ifndef _NO_CRYPTO - , ICryptoGetTextPassword *getTextPassword - #endif - ) -{ - UInt64 type; - RINOK(ReadID(type)); - - if (type == NID::kArchiveProperties) - { - RINOK(ReadArchiveProperties(database.ArchiveInfo)); - RINOK(ReadID(type)); - } - - CObjectVector dataVector; - - if (type == NID::kAdditionalStreamsInfo) - { - HRESULT result = ReadAndDecodePackedStreams( - database.ArchiveInfo.StartPositionAfterHeader, - database.ArchiveInfo.DataStartPosition2, - dataVector - #ifndef _NO_CRYPTO - , getTextPassword - #endif - ); - RINOK(result); - database.ArchiveInfo.DataStartPosition2 += database.ArchiveInfo.StartPositionAfterHeader; - RINOK(ReadID(type)); - } - - CRecordVector unPackSizes; - CRecordVector digestsDefined; - CRecordVector digests; - - if (type == NID::kMainStreamsInfo) - { - RINOK(ReadStreamsInfo(&dataVector, - database.ArchiveInfo.DataStartPosition, - database.PackSizes, - database.PackCRCsDefined, - database.PackCRCs, - database.Folders, - database.NumUnPackStreamsVector, - unPackSizes, - digestsDefined, - digests)); - database.ArchiveInfo.DataStartPosition += database.ArchiveInfo.StartPositionAfterHeader; - RINOK(ReadID(type)); - } - else - { - for(int i = 0; i < database.Folders.Size(); i++) - { - database.NumUnPackStreamsVector.Add(1); - CFolder &folder = database.Folders[i]; - unPackSizes.Add(folder.GetUnPackSize()); - digestsDefined.Add(folder.UnPackCRCDefined); - digests.Add(folder.UnPackCRC); - } - } - - database.Files.Clear(); - - if (type == NID::kEnd) - return S_OK; - if (type != NID::kFilesInfo) - throw CInArchiveException(CInArchiveException::kIncorrectHeader); - - CNum numFiles; - RINOK(ReadNum(numFiles)); - database.Files.Reserve(numFiles); - CNum i; - for(i = 0; i < numFiles; i++) - database.Files.Add(CFileItem()); - - database.ArchiveInfo.FileInfoPopIDs.Add(NID::kSize); - if (!database.PackSizes.IsEmpty()) - database.ArchiveInfo.FileInfoPopIDs.Add(NID::kPackInfo); - if (numFiles > 0 && !digests.IsEmpty()) - database.ArchiveInfo.FileInfoPopIDs.Add(NID::kCRC); - - CBoolVector emptyStreamVector; - emptyStreamVector.Reserve((int)numFiles); - for(i = 0; i < numFiles; i++) - emptyStreamVector.Add(false); - CBoolVector emptyFileVector; - CBoolVector antiFileVector; - CNum numEmptyStreams = 0; - - // int sizePrev = -1; - // int posPrev = 0; - - for (;;) - { - /* - if (sizePrev >= 0) - if (sizePrev != _inByteBack->GetProcessedSize() - posPrev) - throw 2; - */ - UInt64 type; - RINOK(ReadID(type)); - if (type == NID::kEnd) - break; - UInt64 size; - RINOK(ReadNumber(size)); - - // sizePrev = size; - // posPrev = _inByteBack->GetProcessedSize(); - - database.ArchiveInfo.FileInfoPopIDs.Add(type); - switch(type) - { - case NID::kName: - { - CStreamSwitch streamSwitch; - RINOK(streamSwitch.Set(this, &dataVector)); - RINOK(ReadFileNames(database.Files)) - break; - } - case NID::kWinAttributes: - { - CBoolVector boolVector; - RINOK(ReadBoolVector2(database.Files.Size(), boolVector)) - CStreamSwitch streamSwitch; - RINOK(streamSwitch.Set(this, &dataVector)); - for(i = 0; i < numFiles; i++) - { - CFileItem &file = database.Files[i]; - file.AreAttributesDefined = boolVector[i]; - if (file.AreAttributesDefined) - { - RINOK(ReadUInt32(file.Attributes)); - } - } - break; - } - case NID::kStartPos: - { - CBoolVector boolVector; - RINOK(ReadBoolVector2(database.Files.Size(), boolVector)) - CStreamSwitch streamSwitch; - RINOK(streamSwitch.Set(this, &dataVector)); - for(i = 0; i < numFiles; i++) - { - CFileItem &file = database.Files[i]; - file.IsStartPosDefined = boolVector[i]; - if (file.IsStartPosDefined) - { - RINOK(ReadUInt64(file.StartPos)); - } - } - break; - } - case NID::kEmptyStream: - { - RINOK(ReadBoolVector(numFiles, emptyStreamVector)) - for (i = 0; i < (CNum)emptyStreamVector.Size(); i++) - if (emptyStreamVector[i]) - numEmptyStreams++; - emptyFileVector.Reserve(numEmptyStreams); - antiFileVector.Reserve(numEmptyStreams); - for (i = 0; i < numEmptyStreams; i++) - { - emptyFileVector.Add(false); - antiFileVector.Add(false); - } - break; - } - case NID::kEmptyFile: - { - RINOK(ReadBoolVector(numEmptyStreams, emptyFileVector)) - break; - } - case NID::kAnti: - { - RINOK(ReadBoolVector(numEmptyStreams, antiFileVector)) - break; - } - case NID::kCreationTime: - case NID::kLastWriteTime: - case NID::kLastAccessTime: - { - RINOK(ReadTime(dataVector, database.Files, type)) - break; - } - default: - { - database.ArchiveInfo.FileInfoPopIDs.DeleteBack(); - RINOK(SkeepData(size)); - } - } - } - - CNum emptyFileIndex = 0; - CNum sizeIndex = 0; - for(i = 0; i < numFiles; i++) - { - CFileItem &file = database.Files[i]; - file.HasStream = !emptyStreamVector[i]; - if(file.HasStream) - { - file.IsDirectory = false; - file.IsAnti = false; - file.UnPackSize = unPackSizes[sizeIndex]; - file.FileCRC = digests[sizeIndex]; - file.IsFileCRCDefined = digestsDefined[sizeIndex]; - sizeIndex++; - } - else - { - file.IsDirectory = !emptyFileVector[emptyFileIndex]; - file.IsAnti = antiFileVector[emptyFileIndex]; - emptyFileIndex++; - file.UnPackSize = 0; - file.IsFileCRCDefined = false; - } - } - return S_OK; -} - - -void CArchiveDatabaseEx::FillFolderStartPackStream() -{ - FolderStartPackStreamIndex.Clear(); - FolderStartPackStreamIndex.Reserve(Folders.Size()); - CNum startPos = 0; - for(int i = 0; i < Folders.Size(); i++) - { - FolderStartPackStreamIndex.Add(startPos); - startPos += (CNum)Folders[i].PackStreams.Size(); - } -} - -void CArchiveDatabaseEx::FillStartPos() -{ - PackStreamStartPositions.Clear(); - PackStreamStartPositions.Reserve(PackSizes.Size()); - UInt64 startPos = 0; - for(int i = 0; i < PackSizes.Size(); i++) - { - PackStreamStartPositions.Add(startPos); - startPos += PackSizes[i]; - } -} - -void CArchiveDatabaseEx::FillFolderStartFileIndex() -{ - FolderStartFileIndex.Clear(); - FolderStartFileIndex.Reserve(Folders.Size()); - FileIndexToFolderIndexMap.Clear(); - FileIndexToFolderIndexMap.Reserve(Files.Size()); - - int folderIndex = 0; - CNum indexInFolder = 0; - for (int i = 0; i < Files.Size(); i++) - { - const CFileItem &file = Files[i]; - bool emptyStream = !file.HasStream; - if (emptyStream && indexInFolder == 0) - { - FileIndexToFolderIndexMap.Add(kNumNoIndex); - continue; - } - if (indexInFolder == 0) - { - // v3.13 incorrectly worked with empty folders - // v4.07: Loop for skipping empty folders - for (;;) - { - if (folderIndex >= Folders.Size()) - throw CInArchiveException(CInArchiveException::kIncorrectHeader); - FolderStartFileIndex.Add(i); // check it - if (NumUnPackStreamsVector[folderIndex] != 0) - break; - folderIndex++; - } - } - FileIndexToFolderIndexMap.Add(folderIndex); - if (emptyStream) - continue; - indexInFolder++; - if (indexInFolder >= NumUnPackStreamsVector[folderIndex]) - { - folderIndex++; - indexInFolder = 0; - } - } -} - -HRESULT CInArchive::ReadDatabase(CArchiveDatabaseEx &database - #ifndef _NO_CRYPTO - , ICryptoGetTextPassword *getTextPassword - #endif - ) -{ - database.Clear(); - database.ArchiveInfo.StartPosition = _arhiveBeginStreamPosition; - - - RINOK(SafeReadDirect(&database.ArchiveInfo.Version.Major, 1)); - RINOK(SafeReadDirect(&database.ArchiveInfo.Version.Minor, 1)); - if (database.ArchiveInfo.Version.Major != kMajorVersion) - throw CInArchiveException(CInArchiveException::kUnsupportedVersion); - - #ifdef _7Z_VOL - if (_finishSignature) - { - RINOK(_stream->Seek(_position - (4 + kFinishHeaderSize) - - (kSignatureSize + 2), STREAM_SEEK_SET, &_position)); - } - #endif - - UInt32 crcFromArchive; - UInt64 nextHeaderOffset; - UInt64 nextHeaderSize; - UInt32 nextHeaderCRC; - CCRC crc; - RINOK(SafeReadDirectUInt32(crcFromArchive)); - RINOK(SafeReadDirectUInt64(nextHeaderOffset)); - RINOK(SafeReadDirectUInt64(nextHeaderSize)); - RINOK(SafeReadDirectUInt32(nextHeaderCRC)); - - #ifdef FORMAT_7Z_RECOVERY - if (crcFromArchive == 0 && nextHeaderOffset == 0 && nextHeaderSize == 0 && nextHeaderCRC == 0) - { - UInt64 cur, cur2; - RINOK(_stream->Seek(0, STREAM_SEEK_CUR, &cur)); - const int kCheckSize = 500; - Byte buf[kCheckSize]; - RINOK(_stream->Seek(0, STREAM_SEEK_END, &cur2)); - int checkSize = kCheckSize; - if (cur2 - cur < kCheckSize) - checkSize = (int)(cur2 - cur); - RINOK(_stream->Seek(-checkSize, STREAM_SEEK_END, &cur2)); - - UInt32 realProcessedSize; - RINOK(ReadDirect(buf, (UInt32)kCheckSize, &realProcessedSize)); - - int i; - for (i = (int)realProcessedSize - 2; i >= 0; i--) - if (buf[i] == 0x17 && buf[i + 1] == 0x6 || buf[i] == 0x01 && buf[i + 1] == 0x04) - break; - if (i < 0) - return S_FALSE; - nextHeaderSize = realProcessedSize - i; - nextHeaderOffset = cur2 - cur + i; - nextHeaderCRC = CCRC::CalculateDigest(buf + i, (size_t)nextHeaderSize); - RINOK(_stream->Seek(cur, STREAM_SEEK_SET, &_position)); - } - #endif - - crc.UpdateUInt64(nextHeaderOffset); - crc.UpdateUInt64(nextHeaderSize); - crc.UpdateUInt32(nextHeaderCRC); - - #ifdef FORMAT_7Z_RECOVERY - crcFromArchive = crc.GetDigest(); - #endif - - #ifdef _7Z_VOL - UInt64 archiveStartOffset; // data offset from end if that struct - UInt64 additionalStartBlockSize; // start signature & start header size - if (_finishSignature) - { - RINOK(SafeReadDirectUInt64(archiveStartOffset)); - crc.UpdateUInt64(archiveStartOffset); - RINOK(SafeReadDirectUInt64(additionalStartBlockSize)); - crc.UpdateUInt64(additionalStartBlockSize); - database.ArchiveInfo.StartPositionAfterHeader = _position + archiveStartOffset; - } - else - #endif - { - database.ArchiveInfo.StartPositionAfterHeader = _position; - } - if (crc.GetDigest() != crcFromArchive) - throw CInArchiveException(CInArchiveException::kIncorrectHeader); - - if (nextHeaderSize == 0) - return S_OK; - - if (nextHeaderSize >= 0xFFFFFFFF) - return E_FAIL; - - RINOK(_stream->Seek(nextHeaderOffset, STREAM_SEEK_CUR, &_position)); - - CByteBuffer buffer2; - buffer2.SetCapacity((size_t)nextHeaderSize); - RINOK(SafeReadDirect(buffer2, (UInt32)nextHeaderSize)); - if (!CCRC::VerifyDigest(nextHeaderCRC, buffer2, (UInt32)nextHeaderSize)) - throw CInArchiveException(CInArchiveException::kIncorrectHeader); - - CStreamSwitch streamSwitch; - streamSwitch.Set(this, buffer2); - - CObjectVector dataVector; - - for (;;) - { - UInt64 type; - RINOK(ReadID(type)); - if (type == NID::kHeader) - break; - if (type != NID::kEncodedHeader) - throw CInArchiveException(CInArchiveException::kIncorrectHeader); - HRESULT result = ReadAndDecodePackedStreams( - database.ArchiveInfo.StartPositionAfterHeader, - database.ArchiveInfo.DataStartPosition2, - dataVector - #ifndef _NO_CRYPTO - , getTextPassword - #endif - ); - RINOK(result); - if (dataVector.Size() == 0) - return S_OK; - if (dataVector.Size() > 1) - throw CInArchiveException(CInArchiveException::kIncorrectHeader); - streamSwitch.Remove(); - streamSwitch.Set(this, dataVector.Front()); - } - - return ReadHeader(database - #ifndef _NO_CRYPTO - , getTextPassword - #endif - ); -} - -}} diff --git a/7zip/Archive/7z/7zIn.h b/7zip/Archive/7z/7zIn.h deleted file mode 100755 index 4f27aa75..00000000 --- a/7zip/Archive/7z/7zIn.h +++ /dev/null @@ -1,288 +0,0 @@ -// 7zIn.h - -#ifndef __7Z_IN_H -#define __7Z_IN_H - -#include "../../IStream.h" -#include "../../IPassword.h" -#include "../../../Common/MyCom.h" -#include "../../Common/InBuffer.h" - -#include "7zHeader.h" -#include "7zItem.h" - -namespace NArchive { -namespace N7z { - -class CInArchiveException -{ -public: - enum CCauseType - { - kUnsupportedVersion = 0, - kUnexpectedEndOfArchive = 0, - kIncorrectHeader, - } Cause; - CInArchiveException(CCauseType cause); -}; - -struct CInArchiveInfo -{ - CArchiveVersion Version; - UInt64 StartPosition; - UInt64 StartPositionAfterHeader; - UInt64 DataStartPosition; - UInt64 DataStartPosition2; - CRecordVector FileInfoPopIDs; - void Clear() - { - FileInfoPopIDs.Clear(); - } -}; - - -struct CArchiveDatabaseEx: public CArchiveDatabase -{ - CInArchiveInfo ArchiveInfo; - CRecordVector PackStreamStartPositions; - CRecordVector FolderStartPackStreamIndex; - CRecordVector FolderStartFileIndex; - CRecordVector FileIndexToFolderIndexMap; - - void Clear() - { - CArchiveDatabase::Clear(); - ArchiveInfo.Clear(); - PackStreamStartPositions.Clear(); - FolderStartPackStreamIndex.Clear(); - FolderStartFileIndex.Clear(); - FileIndexToFolderIndexMap.Clear(); - } - - void FillFolderStartPackStream(); - void FillStartPos(); - void FillFolderStartFileIndex(); - - void Fill() - { - FillFolderStartPackStream(); - FillStartPos(); - FillFolderStartFileIndex(); - } - - UInt64 GetFolderStreamPos(int folderIndex, int indexInFolder) const - { - return ArchiveInfo.DataStartPosition + - PackStreamStartPositions[FolderStartPackStreamIndex[folderIndex] + - indexInFolder]; - } - - UInt64 GetFolderFullPackSize(int folderIndex) const - { - CNum packStreamIndex = FolderStartPackStreamIndex[folderIndex]; - const CFolder &folder = Folders[folderIndex]; - UInt64 size = 0; - for (int i = 0; i < folder.PackStreams.Size(); i++) - size += PackSizes[packStreamIndex + i]; - return size; - } - - UInt64 GetFolderPackStreamSize(int folderIndex, int streamIndex) const - { - return PackSizes[FolderStartPackStreamIndex[folderIndex] + streamIndex]; - } - - UInt64 GetFilePackSize(CNum fileIndex) const - { - CNum folderIndex = FileIndexToFolderIndexMap[fileIndex]; - if (folderIndex >= 0) - { - if (FolderStartFileIndex[folderIndex] == fileIndex) - return GetFolderFullPackSize(folderIndex); - } - return 0; - } -}; - -class CInByte2 -{ - const Byte *_buffer; - size_t _size; - size_t _pos; -public: - void Init(const Byte *buffer, size_t size) - { - _buffer = buffer; - _size = size; - _pos = 0; - } - bool ReadByte(Byte &b) - { - if(_pos >= _size) - return false; - b = _buffer[_pos++]; - return true; - } - void ReadBytes(void *data, size_t size, size_t &processedSize) - { - for(processedSize = 0; processedSize < size && _pos < _size; processedSize++) - ((Byte *)data)[processedSize] = _buffer[_pos++]; - } - - bool ReadBytes(void *data, size_t size) - { - size_t processedSize; - ReadBytes(data, size, processedSize); - return (processedSize == size); - } - - size_t GetProcessedSize() const { return _pos; } -}; - -class CStreamSwitch; -class CInArchive -{ - friend class CStreamSwitch; - - CMyComPtr _stream; - #ifdef _7Z_VOL - bool _finishSignature; - #endif - - CObjectVector _inByteVector; - CInByte2 *_inByteBack; - - UInt64 _arhiveBeginStreamPosition; - UInt64 _position; - - void AddByteStream(const Byte *buffer, size_t size) - { - _inByteVector.Add(CInByte2()); - _inByteBack = &_inByteVector.Back(); - _inByteBack->Init(buffer, size); - } - - void DeleteByteStream() - { - _inByteVector.DeleteBack(); - if (!_inByteVector.IsEmpty()) - _inByteBack = &_inByteVector.Back(); - } - -private: - HRESULT FindAndReadSignature(IInStream *stream, const UInt64 *searchHeaderSizeLimit); // S_FALSE means is not archive - #ifdef _7Z_VOL - HRESULT FindFinishSignature(IInStream *stream, const UInt64 *searchHeaderSizeLimit); // S_FALSE means is not archive - #endif - - HRESULT ReadFileNames(CObjectVector &files); - - HRESULT ReadDirect(IInStream *stream, void *data, UInt32 size, - UInt32 *processedSize); - HRESULT ReadDirect(void *data, UInt32 size, UInt32 *processedSize); - HRESULT SafeReadDirect(void *data, UInt32 size); - HRESULT SafeReadDirectByte(Byte &b); - HRESULT SafeReadDirectUInt32(UInt32 &value); - HRESULT SafeReadDirectUInt64(UInt64 &value); - - HRESULT ReadBytes(void *data, size_t size) - { - if (!_inByteBack->ReadBytes(data, size)) - return E_FAIL; - return S_OK; - } - - HRESULT ReadByte(Byte &b) - { - if (!_inByteBack->ReadByte(b)) - return E_FAIL; - return S_OK; - } - - HRESULT ReadWideCharLE(wchar_t &c) - { - Byte b1 = 0; - if (!_inByteBack->ReadByte(b1)) - return E_FAIL; - Byte b2 = 0; - if (!_inByteBack->ReadByte(b2)) - return E_FAIL; - c = (wchar_t)(((wchar_t)(b2) << 8) + b1); - return S_OK; - } - - HRESULT ReadNumber(UInt64 &value); - HRESULT ReadNum(CNum &value); - HRESULT ReadID(UInt64 &value) { return ReadNumber(value); } - HRESULT ReadUInt32(UInt32 &value); - HRESULT ReadUInt64(UInt64 &value); - - HRESULT SkeepData(UInt64 size); - HRESULT SkeepData(); - HRESULT WaitAttribute(UInt64 attribute); - - HRESULT ReadArchiveProperties(CInArchiveInfo &archiveInfo); - HRESULT GetNextFolderItem(CFolder &itemInfo); - HRESULT ReadHashDigests(int numItems, - CRecordVector &digestsDefined, CRecordVector &digests); - - HRESULT ReadPackInfo( - UInt64 &dataOffset, - CRecordVector &packSizes, - CRecordVector &packCRCsDefined, - CRecordVector &packCRCs); - - HRESULT ReadUnPackInfo( - const CObjectVector *dataVector, - CObjectVector &folders); - - HRESULT ReadSubStreamsInfo( - const CObjectVector &folders, - CRecordVector &numUnPackStreamsInFolders, - CRecordVector &unPackSizes, - CRecordVector &digestsDefined, - CRecordVector &digests); - - HRESULT ReadStreamsInfo( - const CObjectVector *dataVector, - UInt64 &dataOffset, - CRecordVector &packSizes, - CRecordVector &packCRCsDefined, - CRecordVector &packCRCs, - CObjectVector &folders, - CRecordVector &numUnPackStreamsInFolders, - CRecordVector &unPackSizes, - CRecordVector &digestsDefined, - CRecordVector &digests); - - - HRESULT GetNextFileItem(CFileItem &itemInfo); - HRESULT ReadBoolVector(int numItems, CBoolVector &v); - HRESULT ReadBoolVector2(int numItems, CBoolVector &v); - HRESULT ReadTime(const CObjectVector &dataVector, - CObjectVector &files, UInt64 type); - HRESULT ReadAndDecodePackedStreams(UInt64 baseOffset, UInt64 &dataOffset, - CObjectVector &dataVector - #ifndef _NO_CRYPTO - , ICryptoGetTextPassword *getTextPassword - #endif - ); - HRESULT ReadHeader(CArchiveDatabaseEx &database - #ifndef _NO_CRYPTO - ,ICryptoGetTextPassword *getTextPassword - #endif - ); -public: - HRESULT Open(IInStream *stream, const UInt64 *searchHeaderSizeLimit); // S_FALSE means is not archive - void Close(); - - HRESULT ReadDatabase(CArchiveDatabaseEx &database - #ifndef _NO_CRYPTO - ,ICryptoGetTextPassword *getTextPassword - #endif - ); -}; - -}} - -#endif diff --git a/7zip/Archive/7z/7zItem.h b/7zip/Archive/7z/7zItem.h deleted file mode 100755 index 08ea61f4..00000000 --- a/7zip/Archive/7z/7zItem.h +++ /dev/null @@ -1,181 +0,0 @@ -// 7zItem.h - -#ifndef __7Z_ITEM_H -#define __7Z_ITEM_H - -#include "../../../Common/Buffer.h" -#include "7zMethodID.h" -#include "7zHeader.h" - -namespace NArchive { -namespace N7z { - -struct CAltCoderInfo -{ - CMethodID MethodID; - CByteBuffer Properties; -}; - -typedef UInt32 CNum; -const CNum kNumMax = 0x7FFFFFFF; -const CNum kNumNoIndex = 0xFFFFFFFF; - -struct CCoderInfo -{ - CNum NumInStreams; - CNum NumOutStreams; - CObjectVector AltCoders; - bool IsSimpleCoder() const { return (NumInStreams == 1) && (NumOutStreams == 1); } -}; - -struct CBindPair -{ - CNum InIndex; - CNum OutIndex; -}; - -struct CFolder -{ - CObjectVector Coders; - CRecordVector BindPairs; - CRecordVector PackStreams; - CRecordVector UnPackSizes; - UInt32 UnPackCRC; - bool UnPackCRCDefined; - - CFolder(): UnPackCRCDefined(false) {} - - UInt64 GetUnPackSize() const // test it - { - if (UnPackSizes.IsEmpty()) - return 0; - for (int i = UnPackSizes.Size() - 1; i >= 0; i--) - if (FindBindPairForOutStream(i) < 0) - return UnPackSizes[i]; - throw 1; - } - - CNum GetNumOutStreams() const - { - CNum result = 0; - for (int i = 0; i < Coders.Size(); i++) - result += Coders[i].NumOutStreams; - return result; - } - - int FindBindPairForInStream(CNum inStreamIndex) const - { - for(int i = 0; i < BindPairs.Size(); i++) - if (BindPairs[i].InIndex == inStreamIndex) - return i; - return -1; - } - int FindBindPairForOutStream(CNum outStreamIndex) const - { - for(int i = 0; i < BindPairs.Size(); i++) - if (BindPairs[i].OutIndex == outStreamIndex) - return i; - return -1; - } - int FindPackStreamArrayIndex(CNum inStreamIndex) const - { - for(int i = 0; i < PackStreams.Size(); i++) - if (PackStreams[i] == inStreamIndex) - return i; - return -1; - } -}; - -typedef FILETIME CArchiveFileTime; - -class CFileItem -{ -public: - CArchiveFileTime CreationTime; - CArchiveFileTime LastWriteTime; - CArchiveFileTime LastAccessTime; - UInt64 UnPackSize; - UInt64 StartPos; - UInt32 Attributes; - UInt32 FileCRC; - UString Name; - - bool HasStream; // Test it !!! it means that there is - // stream in some folder. It can be empty stream - bool IsDirectory; - bool IsAnti; - bool IsFileCRCDefined; - bool AreAttributesDefined; - bool IsCreationTimeDefined; - bool IsLastWriteTimeDefined; - bool IsLastAccessTimeDefined; - bool IsStartPosDefined; - - /* - const bool HasStream() const { - return !IsDirectory && !IsAnti && UnPackSize != 0; } - */ - CFileItem(): - HasStream(true), - IsDirectory(false), - IsAnti(false), - IsFileCRCDefined(false), - AreAttributesDefined(false), - IsCreationTimeDefined(false), - IsLastWriteTimeDefined(false), - IsLastAccessTimeDefined(false), - IsStartPosDefined(false) - {} - void SetAttributes(UInt32 attributes) - { - AreAttributesDefined = true; - Attributes = attributes; - } - void SetCreationTime(const CArchiveFileTime &creationTime) - { - IsCreationTimeDefined = true; - CreationTime = creationTime; - } - void SetLastWriteTime(const CArchiveFileTime &lastWriteTime) - { - IsLastWriteTimeDefined = true; - LastWriteTime = lastWriteTime; - } - void SetLastAccessTime(const CArchiveFileTime &lastAccessTime) - { - IsLastAccessTimeDefined = true; - LastAccessTime = lastAccessTime; - } -}; - -struct CArchiveDatabase -{ - CRecordVector PackSizes; - CRecordVector PackCRCsDefined; - CRecordVector PackCRCs; - CObjectVector Folders; - CRecordVector NumUnPackStreamsVector; - CObjectVector Files; - void Clear() - { - PackSizes.Clear(); - PackCRCsDefined.Clear(); - PackCRCs.Clear(); - Folders.Clear(); - NumUnPackStreamsVector.Clear(); - Files.Clear(); - } - bool IsEmpty() const - { - return (PackSizes.IsEmpty() && - PackCRCsDefined.IsEmpty() && - PackCRCs.IsEmpty() && - Folders.IsEmpty() && - NumUnPackStreamsVector.IsEmpty() && - Files.IsEmpty()); - } -}; - -}} - -#endif diff --git a/7zip/Archive/7z/7zMethodID.cpp b/7zip/Archive/7z/7zMethodID.cpp deleted file mode 100755 index 0d45b732..00000000 --- a/7zip/Archive/7z/7zMethodID.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// 7zMethodID.cpp - -#include "StdAfx.h" - -#include "7zMethodID.h" - -namespace NArchive { -namespace N7z { - -static wchar_t GetHex(Byte value) -{ - return (wchar_t)((value < 10) ? ('0' + value) : ('A' + (value - 10))); -} - -static bool HexCharToInt(wchar_t value, Byte &result) -{ - if (value >= '0' && value <= '9') - result = (Byte)(value - '0'); - else if (value >= 'a' && value <= 'f') - result = (Byte)(10 + value - 'a'); - else if (value >= 'A' && value <= 'F') - result = (Byte)(10 + value - 'A'); - else - return false; - return true; -} - -static bool TwoHexCharsToInt(wchar_t valueHigh, wchar_t valueLow, Byte &result) -{ - Byte resultHigh, resultLow; - if (!HexCharToInt(valueHigh, resultHigh)) - return false; - if (!HexCharToInt(valueLow, resultLow)) - return false; - result = (Byte)((resultHigh << 4) + resultLow); - return true; -} - -UString CMethodID::ConvertToString() const -{ - UString result; - for (int i = 0; i < IDSize; i++) - { - Byte b = ID[i]; - result += GetHex((Byte)(b >> 4)); - result += GetHex((Byte)(b & 0xF)); - } - return result; -} - -bool CMethodID::ConvertFromString(const UString &srcString) -{ - int length = srcString.Length(); - if ((length & 1) != 0 || (length >> 1) > kMethodIDSize) - return false; - IDSize = (Byte)(length / 2); - UInt32 i; - for(i = 0; i < IDSize; i++) - if (!TwoHexCharsToInt(srcString[i * 2], srcString[i * 2 + 1], ID[i])) - return false; - for(; i < kMethodIDSize; i++) - ID[i] = 0; - return true; -} - -bool operator==(const CMethodID &a1, const CMethodID &a2) -{ - if (a1.IDSize != a2.IDSize) - return false; - for (UInt32 i = 0; i < a1.IDSize; i++) - if (a1.ID[i] != a2.ID[i]) - return false; - return true; -} - -}} diff --git a/7zip/Archive/7z/7zMethodID.h b/7zip/Archive/7z/7zMethodID.h deleted file mode 100755 index 54561054..00000000 --- a/7zip/Archive/7z/7zMethodID.h +++ /dev/null @@ -1,29 +0,0 @@ -// 7zMethodID.h - -#ifndef __7Z_METHOD_ID_H -#define __7Z_METHOD_ID_H - -#include "../../../Common/String.h" -#include "../../../Common/Types.h" - -namespace NArchive { -namespace N7z { - -const int kMethodIDSize = 15; - -struct CMethodID -{ - Byte ID[kMethodIDSize]; - Byte IDSize; - UString ConvertToString() const; - bool ConvertFromString(const UString &srcString); -}; - -bool operator==(const CMethodID &a1, const CMethodID &a2); - -inline bool operator!=(const CMethodID &a1, const CMethodID &a2) - { return !(a1 == a2); } - -}} - -#endif diff --git a/7zip/Archive/7z/7zMethods.cpp b/7zip/Archive/7z/7zMethods.cpp deleted file mode 100755 index 19270aa4..00000000 --- a/7zip/Archive/7z/7zMethods.cpp +++ /dev/null @@ -1,174 +0,0 @@ -// 7zMethods.cpp - -#include "StdAfx.h" - -#include "7zMethods.h" - -#include "../../../Windows/FileFind.h" -#include "../../../Windows/DLL.h" -#include "../../../Windows/PropVariant.h" -#include "../../../Windows/Synchronization.h" - -#include "../../ICoder.h" -#include "../Common/CodecsPath.h" - -using namespace NWindows; - -namespace NArchive { -namespace N7z { - -static CObjectVector g_Methods; -static bool g_Loaded = false; - -typedef UInt32 (WINAPI *GetNumberOfMethodsFunc)(UInt32 *numMethods); - -typedef UInt32 (WINAPI *GetMethodPropertyFunc)( - UInt32 index, PROPID propID, PROPVARIANT *value); - -static void Load(const CSysString &folderPrefix) -{ - NFile::NFind::CEnumerator enumerator(folderPrefix + CSysString(TEXT("*"))); - NFile::NFind::CFileInfo fileInfo; - while (enumerator.Next(fileInfo)) - { - if (fileInfo.IsDirectory()) - continue; - CSysString filePath = folderPrefix + fileInfo.Name; - { - NDLL::CLibrary library; - if (!library.LoadEx(filePath, LOAD_LIBRARY_AS_DATAFILE)) - continue; - } - NDLL::CLibrary library; - if (!library.Load(filePath)) - continue; - GetMethodPropertyFunc getMethodProperty = (GetMethodPropertyFunc) - library.GetProcAddress("GetMethodProperty"); - if (getMethodProperty == NULL) - continue; - - UInt32 numMethods = 1; - GetNumberOfMethodsFunc getNumberOfMethodsFunc = (GetNumberOfMethodsFunc) - library.GetProcAddress("GetNumberOfMethods"); - if (getNumberOfMethodsFunc != NULL) - if (getNumberOfMethodsFunc(&numMethods) != S_OK) - continue; - - for(UInt32 i = 0; i < numMethods; i++) - { - CMethodInfo2 info; - info.FilePath = filePath; - - NWindows::NCOM::CPropVariant propVariant; - if (getMethodProperty(i, NMethodPropID::kID, &propVariant) != S_OK) - continue; - if (propVariant.vt != VT_BSTR) - continue; - info.MethodID.IDSize = (Byte)SysStringByteLen(propVariant.bstrVal); - memmove(info.MethodID.ID, propVariant.bstrVal, info.MethodID.IDSize); - propVariant.Clear(); - - if (getMethodProperty(i, NMethodPropID::kName, &propVariant) != S_OK) - continue; - if (propVariant.vt == VT_EMPTY) - { - } - else if (propVariant.vt == VT_BSTR) - info.Name = propVariant.bstrVal; - else - continue; - propVariant.Clear(); - - if (getMethodProperty (i, NMethodPropID::kEncoder, &propVariant) != S_OK) - continue; - if (propVariant.vt == VT_EMPTY) - info.EncoderIsAssigned = false; - else if (propVariant.vt == VT_BSTR) - { - info.EncoderIsAssigned = true; - info.Encoder = *(const GUID *)propVariant.bstrVal; - } - else - continue; - propVariant.Clear(); - - if (getMethodProperty (i, NMethodPropID::kDecoder, &propVariant) != S_OK) - continue; - if (propVariant.vt == VT_EMPTY) - info.DecoderIsAssigned = false; - else if (propVariant.vt == VT_BSTR) - { - info.DecoderIsAssigned = true; - info.Decoder = *(const GUID *)propVariant.bstrVal; - } - else - continue; - propVariant.Clear(); - - if (getMethodProperty (i, NMethodPropID::kInStreams, &propVariant) != S_OK) - continue; - if (propVariant.vt == VT_EMPTY) - info.NumInStreams = 1; - else if (propVariant.vt == VT_UI4) - info.NumInStreams = propVariant.ulVal; - else - continue; - propVariant.Clear(); - - if (getMethodProperty (i, NMethodPropID::kOutStreams, &propVariant) != S_OK) - continue; - if (propVariant.vt == VT_EMPTY) - info.NumOutStreams = 1; - else if (propVariant.vt == VT_UI4) - info.NumOutStreams = propVariant.ulVal; - else - continue; - propVariant.Clear(); - - g_Methods.Add(info); - } - } -} - -static NSynchronization::CCriticalSection g_CriticalSection; - -void LoadMethodMap() -{ - NSynchronization::CCriticalSectionLock lock(g_CriticalSection); - if (g_Loaded) - return; - g_Loaded = true; - Load(GetCodecsFolderPrefix()); -} - -bool GetMethodInfo(const CMethodID &methodID, CMethodInfo &methodInfo) -{ - for(int i = 0; i < g_Methods.Size(); i++) - { - const CMethodInfo2 &method = g_Methods[i]; - if (method.MethodID == methodID) - { - methodInfo = (CMethodInfo)method; - return true; - } - } - return false; -} - -bool GetMethodInfo(const UString &name, CMethodInfo2 &methodInfo) -{ - for(int i = 0; i < g_Methods.Size(); i++) - { - const CMethodInfo2 &method = g_Methods[i]; - if (method.Name.CompareNoCase(name) == 0) - { - methodInfo = method; - return true; - } - } - return false; -} - -}} - - diff --git a/7zip/Archive/7z/7zMethods.h b/7zip/Archive/7z/7zMethods.h deleted file mode 100755 index 231f3183..00000000 --- a/7zip/Archive/7z/7zMethods.h +++ /dev/null @@ -1,36 +0,0 @@ -// 7zMethods.h - -#ifndef __7Z_METHODS_H -#define __7Z_METHODS_H - -#include "7zMethodID.h" - -namespace NArchive { -namespace N7z { - -struct CMethodInfo -{ - UString Name; - bool EncoderIsAssigned; - bool DecoderIsAssigned; - UInt32 NumInStreams; - UInt32 NumOutStreams; - CLSID Encoder; - CLSID Decoder; - // UString Description; - CSysString FilePath; -}; - -struct CMethodInfo2: public CMethodInfo -{ - CMethodID MethodID; -}; - -void LoadMethodMap(); -bool GetMethodInfo(const CMethodID &methodID, CMethodInfo &methodInfo); -bool GetMethodInfo(const UString &name, CMethodInfo2 &methodInfo); - -}} - -#endif - diff --git a/7zip/Archive/7z/7zOut.cpp b/7zip/Archive/7z/7zOut.cpp deleted file mode 100755 index 5a81a0d5..00000000 --- a/7zip/Archive/7z/7zOut.cpp +++ /dev/null @@ -1,1136 +0,0 @@ -// 7zOut.cpp - -#include "StdAfx.h" - -#include "../../../Common/AutoPtr.h" -#include "../../Common/StreamObjects.h" - -#include "7zOut.h" - -static HRESULT WriteBytes(ISequentialOutStream *stream, const void *data, size_t size) -{ - while (size > 0) - { - UInt32 curSize = (UInt32)MyMin(size, (size_t)0xFFFFFFFF); - UInt32 processedSize; - RINOK(stream->Write(data, curSize, &processedSize)); - if(processedSize == 0) - return E_FAIL; - data = (const void *)((const Byte *)data + processedSize); - size -= processedSize; - } - return S_OK; -} - -namespace NArchive { -namespace N7z { - -HRESULT COutArchive::WriteDirect(const void *data, UInt32 size) -{ - return ::WriteBytes(SeqStream, data, size); -} - -HRESULT COutArchive::WriteDirectUInt32(UInt32 value) -{ - for (int i = 0; i < 4; i++) - { - RINOK(WriteDirectByte((Byte)value)); - value >>= 8; - } - return S_OK; -} - -HRESULT COutArchive::WriteDirectUInt64(UInt64 value) -{ - for (int i = 0; i < 8; i++) - { - RINOK(WriteDirectByte((Byte)value)); - value >>= 8; - } - return S_OK; -} - -HRESULT COutArchive::WriteSignature() -{ - RINOK(WriteDirect(kSignature, kSignatureSize)); - RINOK(WriteDirectByte(kMajorVersion)); - return WriteDirectByte(2); -} - -#ifdef _7Z_VOL -HRESULT COutArchive::WriteFinishSignature() -{ - RINOK(WriteDirect(kFinishSignature, kSignatureSize)); - CArchiveVersion av; - av.Major = kMajorVersion; - av.Minor = 2; - RINOK(WriteDirectByte(av.Major)); - return WriteDirectByte(av.Minor); -} -#endif - -HRESULT COutArchive::WriteStartHeader(const CStartHeader &h) -{ - CCRC crc; - crc.UpdateUInt64(h.NextHeaderOffset); - crc.UpdateUInt64(h.NextHeaderSize); - crc.UpdateUInt32(h.NextHeaderCRC); - RINOK(WriteDirectUInt32(crc.GetDigest())); - RINOK(WriteDirectUInt64(h.NextHeaderOffset)); - RINOK(WriteDirectUInt64(h.NextHeaderSize)); - return WriteDirectUInt32(h.NextHeaderCRC); -} - -#ifdef _7Z_VOL -HRESULT COutArchive::WriteFinishHeader(const CFinishHeader &h) -{ - CCRC crc; - crc.UpdateUInt64(h.NextHeaderOffset); - crc.UpdateUInt64(h.NextHeaderSize); - crc.UpdateUInt32(h.NextHeaderCRC); - crc.UpdateUInt64(h.ArchiveStartOffset); - crc.UpdateUInt64(h.AdditionalStartBlockSize); - RINOK(WriteDirectUInt32(crc.GetDigest())); - RINOK(WriteDirectUInt64(h.NextHeaderOffset)); - RINOK(WriteDirectUInt64(h.NextHeaderSize)); - RINOK(WriteDirectUInt32(h.NextHeaderCRC)); - RINOK(WriteDirectUInt64(h.ArchiveStartOffset)); - return WriteDirectUInt64(h.AdditionalStartBlockSize); -} -#endif - -HRESULT COutArchive::Create(ISequentialOutStream *stream, bool endMarker) -{ - Close(); - #ifdef _7Z_VOL - // endMarker = false; - _endMarker = endMarker; - #endif - SeqStream = stream; - if (!endMarker) - { - SeqStream.QueryInterface(IID_IOutStream, &Stream); - if (!Stream) - { - return E_NOTIMPL; - // endMarker = true; - } - } - #ifdef _7Z_VOL - if (endMarker) - { - /* - CStartHeader sh; - sh.NextHeaderOffset = (UInt32)(Int32)-1; - sh.NextHeaderSize = (UInt32)(Int32)-1; - sh.NextHeaderCRC = 0; - WriteStartHeader(sh); - */ - } - else - #endif - { - if (!Stream) - return E_FAIL; - WriteSignature(); - RINOK(Stream->Seek(0, STREAM_SEEK_CUR, &_prefixHeaderPos)); - } - return S_OK; -} - -void COutArchive::Close() -{ - SeqStream.Release(); - Stream.Release(); -} - -HRESULT COutArchive::SkeepPrefixArchiveHeader() -{ - #ifdef _7Z_VOL - if (_endMarker) - return S_OK; - #endif - return Stream->Seek(24, STREAM_SEEK_CUR, NULL); -} - -HRESULT COutArchive::WriteBytes(const void *data, size_t size) -{ - if (_mainMode) - { - if (_dynamicMode) - _dynamicBuffer.Write(data, size); - else - _outByte.WriteBytes(data, size); - _crc.Update(data, size); - } - else - { - if (_countMode) - _countSize += size; - else - RINOK(_outByte2.Write(data, size)); - } - return S_OK; -} - -HRESULT COutArchive::WriteBytes(const CByteBuffer &data) -{ - return WriteBytes(data, data.GetCapacity()); -} - -HRESULT COutArchive::WriteByte(Byte b) -{ - return WriteBytes(&b, 1); -} - -HRESULT COutArchive::WriteUInt32(UInt32 value) -{ - for (int i = 0; i < 4; i++) - { - RINOK(WriteByte((Byte)value)); - value >>= 8; - } - return S_OK; -} - -HRESULT COutArchive::WriteNumber(UInt64 value) -{ - Byte firstByte = 0; - Byte mask = 0x80; - int i; - for (i = 0; i < 8; i++) - { - if (value < ((UInt64(1) << ( 7 * (i + 1))))) - { - firstByte |= Byte(value >> (8 * i)); - break; - } - firstByte |= mask; - mask >>= 1; - } - RINOK(WriteByte(firstByte)); - for (;i > 0; i--) - { - RINOK(WriteByte((Byte)value)); - value >>= 8; - } - return S_OK; -} - -static UInt32 GetBigNumberSize(UInt64 value) -{ - int i; - for (i = 0; i < 8; i++) - if (value < ((UInt64(1) << ( 7 * (i + 1))))) - break; - return 1 + i; -} - -#ifdef _7Z_VOL -UInt32 COutArchive::GetVolHeadersSize(UInt64 dataSize, int nameLength, bool props) -{ - UInt32 result = GetBigNumberSize(dataSize) * 2 + 41; - if (nameLength != 0) - { - nameLength = (nameLength + 1) * 2; - result += nameLength + GetBigNumberSize(nameLength) + 2; - } - if (props) - { - result += 20; - } - if (result >= 128) - result++; - result += kSignatureSize + 2 + kFinishHeaderSize; - return result; -} - -UInt64 COutArchive::GetVolPureSize(UInt64 volSize, int nameLength, bool props) -{ - UInt32 headersSizeBase = COutArchive::GetVolHeadersSize(1, nameLength, props); - int testSize; - if (volSize > headersSizeBase) - testSize = volSize - headersSizeBase; - else - testSize = 1; - UInt32 headersSize = COutArchive::GetVolHeadersSize(testSize, nameLength, props); - UInt64 pureSize = 1; - if (volSize > headersSize) - pureSize = volSize - headersSize; - return pureSize; -} -#endif - -HRESULT COutArchive::WriteFolder(const CFolder &folder) -{ - RINOK(WriteNumber(folder.Coders.Size())); - int i; - for (i = 0; i < folder.Coders.Size(); i++) - { - const CCoderInfo &coder = folder.Coders[i]; - for (int j = 0; j < coder.AltCoders.Size(); j++) - { - const CAltCoderInfo &altCoder = coder.AltCoders[j]; - size_t propertiesSize = altCoder.Properties.GetCapacity(); - - Byte b; - b = (Byte)(altCoder.MethodID.IDSize & 0xF); - bool isComplex = !coder.IsSimpleCoder(); - b |= (isComplex ? 0x10 : 0); - b |= ((propertiesSize != 0) ? 0x20 : 0 ); - b |= ((j == coder.AltCoders.Size() - 1) ? 0 : 0x80 ); - RINOK(WriteByte(b)); - RINOK(WriteBytes(altCoder.MethodID.ID, altCoder.MethodID.IDSize)); - if (isComplex) - { - RINOK(WriteNumber(coder.NumInStreams)); - RINOK(WriteNumber(coder.NumOutStreams)); - } - if (propertiesSize == 0) - continue; - RINOK(WriteNumber(propertiesSize)); - RINOK(WriteBytes(altCoder.Properties, propertiesSize)); - } - } - for (i = 0; i < folder.BindPairs.Size(); i++) - { - const CBindPair &bindPair = folder.BindPairs[i]; - RINOK(WriteNumber(bindPair.InIndex)); - RINOK(WriteNumber(bindPair.OutIndex)); - } - if (folder.PackStreams.Size() > 1) - for (i = 0; i < folder.PackStreams.Size(); i++) - { - RINOK(WriteNumber(folder.PackStreams[i])); - } - return S_OK; -} - -HRESULT COutArchive::WriteBoolVector(const CBoolVector &boolVector) -{ - Byte b = 0; - Byte mask = 0x80; - for(int i = 0; i < boolVector.Size(); i++) - { - if (boolVector[i]) - b |= mask; - mask >>= 1; - if (mask == 0) - { - RINOK(WriteByte(b)); - mask = 0x80; - b = 0; - } - } - if (mask != 0x80) - { - RINOK(WriteByte(b)); - } - return S_OK; -} - - -HRESULT COutArchive::WriteHashDigests( - const CRecordVector &digestsDefined, - const CRecordVector &digests) -{ - int numDefined = 0; - int i; - for(i = 0; i < digestsDefined.Size(); i++) - if (digestsDefined[i]) - numDefined++; - if (numDefined == 0) - return S_OK; - - RINOK(WriteByte(NID::kCRC)); - if (numDefined == digestsDefined.Size()) - { - RINOK(WriteByte(1)); - } - else - { - RINOK(WriteByte(0)); - RINOK(WriteBoolVector(digestsDefined)); - } - for(i = 0; i < digests.Size(); i++) - { - if(digestsDefined[i]) - RINOK(WriteUInt32(digests[i])); - } - return S_OK; -} - -HRESULT COutArchive::WritePackInfo( - UInt64 dataOffset, - const CRecordVector &packSizes, - const CRecordVector &packCRCsDefined, - const CRecordVector &packCRCs) -{ - if (packSizes.IsEmpty()) - return S_OK; - RINOK(WriteByte(NID::kPackInfo)); - RINOK(WriteNumber(dataOffset)); - RINOK(WriteNumber(packSizes.Size())); - RINOK(WriteByte(NID::kSize)); - for(int i = 0; i < packSizes.Size(); i++) - RINOK(WriteNumber(packSizes[i])); - - RINOK(WriteHashDigests(packCRCsDefined, packCRCs)); - - return WriteByte(NID::kEnd); -} - -HRESULT COutArchive::WriteUnPackInfo( - bool externalFolders, - CNum externalFoldersStreamIndex, - const CObjectVector &folders) -{ - if (folders.IsEmpty()) - return S_OK; - - RINOK(WriteByte(NID::kUnPackInfo)); - - RINOK(WriteByte(NID::kFolder)); - RINOK(WriteNumber(folders.Size())); - if (externalFolders) - { - RINOK(WriteByte(1)); - RINOK(WriteNumber(externalFoldersStreamIndex)); - } - else - { - RINOK(WriteByte(0)); - for(int i = 0; i < folders.Size(); i++) - RINOK(WriteFolder(folders[i])); - } - - RINOK(WriteByte(NID::kCodersUnPackSize)); - int i; - for(i = 0; i < folders.Size(); i++) - { - const CFolder &folder = folders[i]; - for (int j = 0; j < folder.UnPackSizes.Size(); j++) - RINOK(WriteNumber(folder.UnPackSizes[j])); - } - - CRecordVector unPackCRCsDefined; - CRecordVector unPackCRCs; - for(i = 0; i < folders.Size(); i++) - { - const CFolder &folder = folders[i]; - unPackCRCsDefined.Add(folder.UnPackCRCDefined); - unPackCRCs.Add(folder.UnPackCRC); - } - RINOK(WriteHashDigests(unPackCRCsDefined, unPackCRCs)); - - return WriteByte(NID::kEnd); -} - -HRESULT COutArchive::WriteSubStreamsInfo( - const CObjectVector &folders, - const CRecordVector &numUnPackStreamsInFolders, - const CRecordVector &unPackSizes, - const CRecordVector &digestsDefined, - const CRecordVector &digests) -{ - RINOK(WriteByte(NID::kSubStreamsInfo)); - - int i; - for(i = 0; i < numUnPackStreamsInFolders.Size(); i++) - { - if (numUnPackStreamsInFolders[i] != 1) - { - RINOK(WriteByte(NID::kNumUnPackStream)); - for(i = 0; i < numUnPackStreamsInFolders.Size(); i++) - RINOK(WriteNumber(numUnPackStreamsInFolders[i])); - break; - } - } - - - bool needFlag = true; - CNum index = 0; - for(i = 0; i < numUnPackStreamsInFolders.Size(); i++) - for (CNum j = 0; j < numUnPackStreamsInFolders[i]; j++) - { - if (j + 1 != numUnPackStreamsInFolders[i]) - { - if (needFlag) - RINOK(WriteByte(NID::kSize)); - needFlag = false; - RINOK(WriteNumber(unPackSizes[index])); - } - index++; - } - - CRecordVector digestsDefined2; - CRecordVector digests2; - - int digestIndex = 0; - for (i = 0; i < folders.Size(); i++) - { - int numSubStreams = (int)numUnPackStreamsInFolders[i]; - if (numSubStreams == 1 && folders[i].UnPackCRCDefined) - digestIndex++; - else - for (int j = 0; j < numSubStreams; j++, digestIndex++) - { - digestsDefined2.Add(digestsDefined[digestIndex]); - digests2.Add(digests[digestIndex]); - } - } - RINOK(WriteHashDigests(digestsDefined2, digests2)); - return WriteByte(NID::kEnd); -} - -HRESULT COutArchive::WriteTime( - const CObjectVector &files, Byte type, - bool isExternal, CNum externalDataIndex) -{ - ///////////////////////////////////////////////// - // CreationTime - CBoolVector boolVector; - boolVector.Reserve(files.Size()); - bool thereAreDefined = false; - bool allDefined = true; - int i; - for(i = 0; i < files.Size(); i++) - { - const CFileItem &item = files[i]; - bool defined; - switch(type) - { - case NID::kCreationTime: - defined = item.IsCreationTimeDefined; - break; - case NID::kLastWriteTime: - defined = item.IsLastWriteTimeDefined; - break; - case NID::kLastAccessTime: - defined = item.IsLastAccessTimeDefined; - break; - default: - throw 1; - } - boolVector.Add(defined); - thereAreDefined = (thereAreDefined || defined); - allDefined = (allDefined && defined); - } - if (!thereAreDefined) - return S_OK; - RINOK(WriteByte(type)); - size_t dataSize = 1 + 1; - if (isExternal) - dataSize += GetBigNumberSize(externalDataIndex); - else - dataSize += files.Size() * 8; - if (allDefined) - { - RINOK(WriteNumber(dataSize)); - WriteByte(1); - } - else - { - RINOK(WriteNumber(1 + (boolVector.Size() + 7) / 8 + dataSize)); - WriteByte(0); - RINOK(WriteBoolVector(boolVector)); - } - if (isExternal) - { - RINOK(WriteByte(1)); - RINOK(WriteNumber(externalDataIndex)); - return S_OK; - } - RINOK(WriteByte(0)); - for(i = 0; i < files.Size(); i++) - { - if (boolVector[i]) - { - const CFileItem &item = files[i]; - CArchiveFileTime timeValue; - timeValue.dwLowDateTime = 0; - timeValue.dwHighDateTime = 0; - switch(type) - { - case NID::kCreationTime: - timeValue = item.CreationTime; - break; - case NID::kLastWriteTime: - timeValue = item.LastWriteTime; - break; - case NID::kLastAccessTime: - timeValue = item.LastAccessTime; - break; - } - RINOK(WriteUInt32(timeValue.dwLowDateTime)); - RINOK(WriteUInt32(timeValue.dwHighDateTime)); - } - } - return S_OK; -} - -HRESULT COutArchive::EncodeStream(CEncoder &encoder, const Byte *data, size_t dataSize, - CRecordVector &packSizes, CObjectVector &folders) -{ - CSequentialInStreamImp *streamSpec = new CSequentialInStreamImp; - CMyComPtr stream = streamSpec; - streamSpec->Init(data, dataSize); - CFolder folderItem; - folderItem.UnPackCRCDefined = true; - folderItem.UnPackCRC = CCRC::CalculateDigest(data, dataSize); - UInt64 dataSize64 = dataSize; - RINOK(encoder.Encode(stream, NULL, &dataSize64, folderItem, SeqStream, packSizes, NULL)); - folders.Add(folderItem); - return S_OK; -} - -HRESULT COutArchive::EncodeStream(CEncoder &encoder, const CByteBuffer &data, - CRecordVector &packSizes, CObjectVector &folders) -{ - return EncodeStream(encoder, data, data.GetCapacity(), packSizes, folders); -} - -static void WriteUInt32ToBuffer(Byte *data, UInt32 value) -{ - for (int i = 0; i < 4; i++) - { - *data++ = (Byte)value; - value >>= 8; - } -} - -static void WriteUInt64ToBuffer(Byte *data, UInt64 value) -{ - for (int i = 0; i < 8; i++) - { - *data++ = (Byte)value; - value >>= 8; - } -} - - -HRESULT COutArchive::WriteHeader(const CArchiveDatabase &database, - const CCompressionMethodMode *options, - const CHeaderOptions &headerOptions, - UInt64 &headerOffset) -{ - CObjectVector folders; - - bool compressHeaders = (options != NULL); - CMyAutoPtr encoder; - if (compressHeaders) - { - // it's for gcc2.95.2 - CMyAutoPtr tmp(new CEncoder(*options)); - encoder = tmp; - } - - CRecordVector packSizes; - - CNum dataIndex = 0; - - ////////////////////////// - // Folders - - CNum externalFoldersStreamIndex = 0; - bool externalFolders = (compressHeaders && database.Folders.Size() > 8); - if (externalFolders) - { - _mainMode = false; - _countMode = true; - _countSize = 0; - int i; - for(i = 0; i < database.Folders.Size(); i++) - { - RINOK(WriteFolder(database.Folders[i])); - } - - _countMode = false; - - CByteBuffer foldersData; - foldersData.SetCapacity(_countSize); - _outByte2.Init(foldersData, foldersData.GetCapacity()); - - for(i = 0; i < database.Folders.Size(); i++) - { - RINOK(WriteFolder(database.Folders[i])); - } - - { - externalFoldersStreamIndex = dataIndex++; - RINOK(EncodeStream(*encoder, foldersData, packSizes, folders)); - } - } - - - int i; - - ///////////////////////////////// - // Names - - CNum numDefinedNames = 0; - size_t namesDataSize = 0; - for(i = 0; i < database.Files.Size(); i++) - { - const UString &name = database.Files[i].Name; - if (!name.IsEmpty()) - numDefinedNames++; - namesDataSize += (name.Length() + 1) * 2; - } - - CByteBuffer namesData; - CNum externalNamesStreamIndex = 0; - bool externalNames = (compressHeaders && database.Files.Size() > 8); - if (numDefinedNames > 0) - { - namesData.SetCapacity((size_t)namesDataSize); - size_t pos = 0; - for(int i = 0; i < database.Files.Size(); i++) - { - const UString &name = database.Files[i].Name; - for (int t = 0; t < name.Length(); t++) - { - wchar_t c = name[t]; - namesData[pos++] = Byte(c); - namesData[pos++] = Byte(c >> 8); - } - namesData[pos++] = 0; - namesData[pos++] = 0; - } - - if (externalNames) - { - externalNamesStreamIndex = dataIndex++; - RINOK(EncodeStream(*encoder, namesData, packSizes, folders)); - } - } - - ///////////////////////////////// - // Write Attributes - CBoolVector attributesBoolVector; - attributesBoolVector.Reserve(database.Files.Size()); - int numDefinedAttributes = 0; - for(i = 0; i < database.Files.Size(); i++) - { - bool defined = database.Files[i].AreAttributesDefined; - attributesBoolVector.Add(defined); - if (defined) - numDefinedAttributes++; - } - - CByteBuffer attributesData; - CNum externalAttributesStreamIndex = 0; - bool externalAttributes = (compressHeaders && numDefinedAttributes > 8); - if (numDefinedAttributes > 0) - { - attributesData.SetCapacity(numDefinedAttributes * 4); - size_t pos = 0; - for(i = 0; i < database.Files.Size(); i++) - { - const CFileItem &file = database.Files[i]; - if (file.AreAttributesDefined) - { - WriteUInt32ToBuffer(attributesData + pos, file.Attributes); - pos += 4; - } - } - if (externalAttributes) - { - externalAttributesStreamIndex = dataIndex++; - RINOK(EncodeStream(*encoder, attributesData, packSizes, folders)); - } - } - - ///////////////////////////////// - // Write StartPos - CBoolVector startsBoolVector; - startsBoolVector.Reserve(database.Files.Size()); - int numDefinedStarts = 0; - for(i = 0; i < database.Files.Size(); i++) - { - bool defined = database.Files[i].IsStartPosDefined; - startsBoolVector.Add(defined); - if (defined) - numDefinedStarts++; - } - - CByteBuffer startsData; - CNum externalStartStreamIndex = 0; - bool externalStarts = (compressHeaders && numDefinedStarts > 8); - if (numDefinedStarts > 0) - { - startsData.SetCapacity(numDefinedStarts * 8); - size_t pos = 0; - for(i = 0; i < database.Files.Size(); i++) - { - const CFileItem &file = database.Files[i]; - if (file.IsStartPosDefined) - { - WriteUInt64ToBuffer(startsData + pos, file.StartPos); - pos += 8; - } - } - if (externalStarts) - { - externalStartStreamIndex = dataIndex++; - RINOK(EncodeStream(*encoder, startsData, packSizes, folders)); - } - } - - ///////////////////////////////// - // Write Last Write Time - CNum externalLastWriteTimeStreamIndex = 0; - bool externalLastWriteTime = false; - // /* - CNum numDefinedLastWriteTimes = 0; - for(i = 0; i < database.Files.Size(); i++) - if (database.Files[i].IsLastWriteTimeDefined) - numDefinedLastWriteTimes++; - - externalLastWriteTime = (compressHeaders && numDefinedLastWriteTimes > 64); - if (numDefinedLastWriteTimes > 0) - { - CByteBuffer lastWriteTimeData; - lastWriteTimeData.SetCapacity(numDefinedLastWriteTimes * 8); - size_t pos = 0; - for(i = 0; i < database.Files.Size(); i++) - { - const CFileItem &file = database.Files[i]; - if (file.IsLastWriteTimeDefined) - { - WriteUInt32ToBuffer(lastWriteTimeData + pos, file.LastWriteTime.dwLowDateTime); - pos += 4; - WriteUInt32ToBuffer(lastWriteTimeData + pos, file.LastWriteTime.dwHighDateTime); - pos += 4; - } - } - if (externalLastWriteTime) - { - externalLastWriteTimeStreamIndex = dataIndex++; - RINOK(EncodeStream(*encoder, lastWriteTimeData, packSizes, folders)); - } - } - // */ - - - UInt64 packedSize = 0; - for(i = 0; i < database.PackSizes.Size(); i++) - packedSize += database.PackSizes[i]; - UInt64 headerPackSize = 0; - for (i = 0; i < packSizes.Size(); i++) - headerPackSize += packSizes[i]; - - headerOffset = packedSize + headerPackSize; - - _mainMode = true; - - _outByte.SetStream(SeqStream); - _outByte.Init(); - _crc.Init(); - - - RINOK(WriteByte(NID::kHeader)); - - // Archive Properties - - if (folders.Size() > 0) - { - RINOK(WriteByte(NID::kAdditionalStreamsInfo)); - RINOK(WritePackInfo(packedSize, packSizes, - CRecordVector(), CRecordVector())); - RINOK(WriteUnPackInfo(false, 0, folders)); - RINOK(WriteByte(NID::kEnd)); - } - - //////////////////////////////////////////////////// - - if (database.Folders.Size() > 0) - { - RINOK(WriteByte(NID::kMainStreamsInfo)); - RINOK(WritePackInfo(0, database.PackSizes, - database.PackCRCsDefined, - database.PackCRCs)); - - RINOK(WriteUnPackInfo(externalFolders, externalFoldersStreamIndex, database.Folders)); - - CRecordVector unPackSizes; - CRecordVector digestsDefined; - CRecordVector digests; - for (i = 0; i < database.Files.Size(); i++) - { - const CFileItem &file = database.Files[i]; - if (!file.HasStream) - continue; - unPackSizes.Add(file.UnPackSize); - digestsDefined.Add(file.IsFileCRCDefined); - digests.Add(file.FileCRC); - } - - RINOK(WriteSubStreamsInfo( - database.Folders, - database.NumUnPackStreamsVector, - unPackSizes, - digestsDefined, - digests)); - RINOK(WriteByte(NID::kEnd)); - } - - if (database.Files.IsEmpty()) - { - RINOK(WriteByte(NID::kEnd)); - return _outByte.Flush(); - } - - RINOK(WriteByte(NID::kFilesInfo)); - RINOK(WriteNumber(database.Files.Size())); - - CBoolVector emptyStreamVector; - emptyStreamVector.Reserve(database.Files.Size()); - int numEmptyStreams = 0; - for(i = 0; i < database.Files.Size(); i++) - if (database.Files[i].HasStream) - emptyStreamVector.Add(false); - else - { - emptyStreamVector.Add(true); - numEmptyStreams++; - } - if (numEmptyStreams > 0) - { - RINOK(WriteByte(NID::kEmptyStream)); - RINOK(WriteNumber((emptyStreamVector.Size() + 7) / 8)); - RINOK(WriteBoolVector(emptyStreamVector)); - - CBoolVector emptyFileVector, antiVector; - emptyFileVector.Reserve(numEmptyStreams); - antiVector.Reserve(numEmptyStreams); - CNum numEmptyFiles = 0, numAntiItems = 0; - for(i = 0; i < database.Files.Size(); i++) - { - const CFileItem &file = database.Files[i]; - if (!file.HasStream) - { - emptyFileVector.Add(!file.IsDirectory); - if (!file.IsDirectory) - numEmptyFiles++; - antiVector.Add(file.IsAnti); - if (file.IsAnti) - numAntiItems++; - } - } - - if (numEmptyFiles > 0) - { - RINOK(WriteByte(NID::kEmptyFile)); - RINOK(WriteNumber((emptyFileVector.Size() + 7) / 8)); - RINOK(WriteBoolVector(emptyFileVector)); - } - - if (numAntiItems > 0) - { - RINOK(WriteByte(NID::kAnti)); - RINOK(WriteNumber((antiVector.Size() + 7) / 8)); - RINOK(WriteBoolVector(antiVector)); - } - } - - if (numDefinedNames > 0) - { - ///////////////////////////////////////////////// - RINOK(WriteByte(NID::kName)); - if (externalNames) - { - RINOK(WriteNumber(1 + GetBigNumberSize(externalNamesStreamIndex))); - RINOK(WriteByte(1)); - RINOK(WriteNumber(externalNamesStreamIndex)); - } - else - { - RINOK(WriteNumber(1 + namesData.GetCapacity())); - RINOK(WriteByte(0)); - RINOK(WriteBytes(namesData)); - } - - } - - if (headerOptions.WriteCreated) - { - RINOK(WriteTime(database.Files, NID::kCreationTime, false, 0)); - } - if (headerOptions.WriteModified) - { - RINOK(WriteTime(database.Files, NID::kLastWriteTime, - // false, 0)); - externalLastWriteTime, externalLastWriteTimeStreamIndex)); - } - if (headerOptions.WriteAccessed) - { - RINOK(WriteTime(database.Files, NID::kLastAccessTime, false, 0)); - } - - if (numDefinedAttributes > 0) - { - RINOK(WriteByte(NID::kWinAttributes)); - size_t size = 2; - if (numDefinedAttributes != database.Files.Size()) - size += (attributesBoolVector.Size() + 7) / 8 + 1; - if (externalAttributes) - size += GetBigNumberSize(externalAttributesStreamIndex); - else - size += attributesData.GetCapacity(); - - RINOK(WriteNumber(size)); - if (numDefinedAttributes == database.Files.Size()) - { - RINOK(WriteByte(1)); - } - else - { - RINOK(WriteByte(0)); - RINOK(WriteBoolVector(attributesBoolVector)); - } - - if (externalAttributes) - { - RINOK(WriteByte(1)); - RINOK(WriteNumber(externalAttributesStreamIndex)); - } - else - { - RINOK(WriteByte(0)); - RINOK(WriteBytes(attributesData)); - } - } - - if (numDefinedStarts > 0) - { - RINOK(WriteByte(NID::kStartPos)); - size_t size = 2; - if (numDefinedStarts != database.Files.Size()) - size += (startsBoolVector.Size() + 7) / 8 + 1; - if (externalStarts) - size += GetBigNumberSize(externalStartStreamIndex); - else - size += startsData.GetCapacity(); - - RINOK(WriteNumber(size)); - if (numDefinedStarts == database.Files.Size()) - { - RINOK(WriteByte(1)); - } - else - { - RINOK(WriteByte(0)); - RINOK(WriteBoolVector(startsBoolVector)); - } - - if (externalAttributes) - { - RINOK(WriteByte(1)); - RINOK(WriteNumber(externalStartStreamIndex)); - } - else - { - RINOK(WriteByte(0)); - RINOK(WriteBytes(startsData)); - } - } - - RINOK(WriteByte(NID::kEnd)); // for files - RINOK(WriteByte(NID::kEnd)); // for headers - - return _outByte.Flush(); -} - -HRESULT COutArchive::WriteDatabase(const CArchiveDatabase &database, - const CCompressionMethodMode *options, - const CHeaderOptions &headerOptions) -{ - UInt64 headerOffset; - UInt32 headerCRC; - UInt64 headerSize; - if (database.IsEmpty()) - { - headerSize = 0; - headerOffset = 0; - headerCRC = CCRC::CalculateDigest(0, 0); - } - else - { - _dynamicBuffer.Init(); - _dynamicMode = false; - - if (options != 0) - if (options->IsEmpty()) - options = 0; - const CCompressionMethodMode *additionalStreamsOptions = options; - if (!headerOptions.UseAdditionalHeaderStreams) - additionalStreamsOptions = 0; - /* - if (database.Files.Size() < 2) - compressMainHeader = false; - */ - if (options != 0) - if (options->PasswordIsDefined || headerOptions.CompressMainHeader) - _dynamicMode = true; - RINOK(WriteHeader(database, additionalStreamsOptions, headerOptions, headerOffset)); - - if (_dynamicMode) - { - CCompressionMethodMode encryptOptions; - encryptOptions.PasswordIsDefined = options->PasswordIsDefined; - encryptOptions.Password = options->Password; - CEncoder encoder(headerOptions.CompressMainHeader ? *options : encryptOptions); - CRecordVector packSizes; - CObjectVector folders; - RINOK(EncodeStream(encoder, _dynamicBuffer, - _dynamicBuffer.GetSize(), packSizes, folders)); - _dynamicMode = false; - _mainMode = true; - - _outByte.SetStream(SeqStream); - _outByte.Init(); - _crc.Init(); - - if (folders.Size() == 0) - throw 1; - - RINOK(WriteID(NID::kEncodedHeader)); - RINOK(WritePackInfo(headerOffset, packSizes, - CRecordVector(), CRecordVector())); - RINOK(WriteUnPackInfo(false, 0, folders)); - RINOK(WriteByte(NID::kEnd)); - for (int i = 0; i < packSizes.Size(); i++) - headerOffset += packSizes[i]; - RINOK(_outByte.Flush()); - } - headerCRC = _crc.GetDigest(); - headerSize = _outByte.GetProcessedSize(); - } - #ifdef _7Z_VOL - if (_endMarker) - { - CFinishHeader h; - h.NextHeaderSize = headerSize; - h.NextHeaderCRC = headerCRC; - h.NextHeaderOffset = - UInt64(0) - (headerSize + - 4 + kFinishHeaderSize); - h.ArchiveStartOffset = h.NextHeaderOffset - headerOffset; - h.AdditionalStartBlockSize = 0; - RINOK(WriteFinishHeader(h)); - return WriteFinishSignature(); - } - else - #endif - { - CStartHeader h; - h.NextHeaderSize = headerSize; - h.NextHeaderCRC = headerCRC; - h.NextHeaderOffset = headerOffset; - RINOK(Stream->Seek(_prefixHeaderPos, STREAM_SEEK_SET, NULL)); - return WriteStartHeader(h); - } -} - -}} diff --git a/7zip/Archive/7z/7zOut.h b/7zip/Archive/7z/7zOut.h deleted file mode 100755 index cccc813a..00000000 --- a/7zip/Archive/7z/7zOut.h +++ /dev/null @@ -1,192 +0,0 @@ -// 7z/Out.h - -#ifndef __7Z_OUT_H -#define __7Z_OUT_H - -#include "7zHeader.h" -#include "7zItem.h" -#include "7zCompressionMode.h" -#include "7zEncode.h" - -#include "../../Common/OutBuffer.h" -#include "../../../Common/DynamicBuffer.h" -#include "../../../Common/CRC.h" - -namespace NArchive { -namespace N7z { - -class CWriteBufferLoc -{ - Byte *_data; - size_t _size; - size_t _pos; -public: - CWriteBufferLoc(): _size(0), _pos(0) {} - void Init(Byte *data, size_t size) - { - _pos = 0; - _data = data; - _size = size; - } - HRESULT Write(const void *data, size_t size) - { - if (_pos + size > _size) - return E_FAIL; - memmove(_data + _pos, data, size); - _pos += size; - return S_OK; - } -}; - -class CWriteDynamicBuffer -{ - CByteDynamicBuffer _buffer; - size_t _pos; -public: - CWriteDynamicBuffer(): _pos(0) {} - void Init() - { - _pos = 0; - } - void Write(const void *data, size_t size) - { - if (_pos + size > _buffer.GetCapacity()) - _buffer.EnsureCapacity(_pos + size); - memmove(((Byte *)_buffer) +_pos, data, size); - _pos += size; - } - operator Byte *() { return (Byte *)_buffer; }; - operator const Byte *() const { return (const Byte *)_buffer; }; - size_t GetSize() const { return _pos; } -}; - -struct CHeaderOptions -{ - bool UseAdditionalHeaderStreams; - bool CompressMainHeader; - bool WriteModified; - bool WriteCreated; - bool WriteAccessed; - - CHeaderOptions(): - UseAdditionalHeaderStreams(false), - CompressMainHeader(true), - WriteModified(true), - WriteCreated(false), - WriteAccessed(false) {} -}; - -class COutArchive -{ - UInt64 _prefixHeaderPos; - - HRESULT WriteDirect(const void *data, UInt32 size); - HRESULT WriteDirectByte(Byte b) { return WriteDirect(&b, 1); } - HRESULT WriteDirectUInt32(UInt32 value); - HRESULT WriteDirectUInt64(UInt64 value); - - HRESULT WriteBytes(const void *data, size_t size); - HRESULT WriteBytes(const CByteBuffer &data); - HRESULT WriteByte(Byte b); - HRESULT WriteUInt32(UInt32 value); - HRESULT WriteNumber(UInt64 value); - HRESULT WriteID(UInt64 value) { return WriteNumber(value); } - - HRESULT WriteFolder(const CFolder &folder); - HRESULT WriteFileHeader(const CFileItem &itemInfo); - HRESULT WriteBoolVector(const CBoolVector &boolVector); - HRESULT WriteHashDigests( - const CRecordVector &digestsDefined, - const CRecordVector &hashDigests); - - HRESULT WritePackInfo( - UInt64 dataOffset, - const CRecordVector &packSizes, - const CRecordVector &packCRCsDefined, - const CRecordVector &packCRCs); - - HRESULT WriteUnPackInfo( - bool externalFolders, - CNum externalFoldersStreamIndex, - const CObjectVector &folders); - - HRESULT WriteSubStreamsInfo( - const CObjectVector &folders, - const CRecordVector &numUnPackStreamsInFolders, - const CRecordVector &unPackSizes, - const CRecordVector &digestsDefined, - const CRecordVector &hashDigests); - - /* - HRESULT WriteStreamsInfo( - UInt64 dataOffset, - const CRecordVector &packSizes, - const CRecordVector &packCRCsDefined, - const CRecordVector &packCRCs, - bool externalFolders, - UInt64 externalFoldersStreamIndex, - const CObjectVector &folders, - const CRecordVector &numUnPackStreamsInFolders, - const CRecordVector &unPackSizes, - const CRecordVector &digestsDefined, - const CRecordVector &hashDigests); - */ - - - HRESULT WriteTime(const CObjectVector &files, Byte type, - bool isExternal, CNum externalDataIndex); - - HRESULT EncodeStream(CEncoder &encoder, const Byte *data, size_t dataSize, - CRecordVector &packSizes, CObjectVector &folders); - HRESULT EncodeStream(CEncoder &encoder, const CByteBuffer &data, - CRecordVector &packSizes, CObjectVector &folders); - HRESULT WriteHeader(const CArchiveDatabase &database, - const CCompressionMethodMode *options, - const CHeaderOptions &headerOptions, - UInt64 &headerOffset); - - bool _mainMode; - - bool _dynamicMode; - - bool _countMode; - size_t _countSize; - COutBuffer _outByte; - CWriteBufferLoc _outByte2; - CWriteDynamicBuffer _dynamicBuffer; - CCRC _crc; - - #ifdef _7Z_VOL - bool _endMarker; - #endif - - HRESULT WriteSignature(); - #ifdef _7Z_VOL - HRESULT WriteFinishSignature(); - #endif - HRESULT WriteStartHeader(const CStartHeader &h); - #ifdef _7Z_VOL - HRESULT WriteFinishHeader(const CFinishHeader &h); - #endif - CMyComPtr Stream; -public: - - COutArchive() { _outByte.Create(1 << 16); } - CMyComPtr SeqStream; - HRESULT Create(ISequentialOutStream *stream, bool endMarker); - void Close(); - HRESULT SkeepPrefixArchiveHeader(); - HRESULT WriteDatabase(const CArchiveDatabase &database, - const CCompressionMethodMode *options, - const CHeaderOptions &headerOptions); - - #ifdef _7Z_VOL - static UInt32 GetVolHeadersSize(UInt64 dataSize, int nameLength = 0, bool props = false); - static UInt64 GetVolPureSize(UInt64 volSize, int nameLength = 0, bool props = false); - #endif - -}; - -}} - -#endif diff --git a/7zip/Archive/7z/7zProperties.cpp b/7zip/Archive/7z/7zProperties.cpp deleted file mode 100755 index 316f4f09..00000000 --- a/7zip/Archive/7z/7zProperties.cpp +++ /dev/null @@ -1,166 +0,0 @@ -// 7zProperties.cpp - -#include "StdAfx.h" - -#include "7zProperties.h" -#include "7zHeader.h" -#include "7zHandler.h" - -// #define _MULTI_PACK - -namespace NArchive { -namespace N7z { - -struct CPropMap -{ - UInt64 FilePropID; - STATPROPSTG StatPROPSTG; -}; - -CPropMap kPropMap[] = -{ - { NID::kName, NULL, kpidPath, VT_BSTR}, - { NID::kSize, NULL, kpidSize, VT_UI8}, - { NID::kPackInfo, NULL, kpidPackedSize, VT_UI8}, - - #ifdef _MULTI_PACK - { 100, L"Pack0", kpidPackedSize0, VT_UI8}, - { 101, L"Pack1", kpidPackedSize1, VT_UI8}, - { 102, L"Pack2", kpidPackedSize2, VT_UI8}, - { 103, L"Pack3", kpidPackedSize3, VT_UI8}, - { 104, L"Pack4", kpidPackedSize4, VT_UI8}, - #endif - - { NID::kCreationTime, NULL, kpidCreationTime, VT_FILETIME}, - { NID::kLastWriteTime, NULL, kpidLastWriteTime, VT_FILETIME}, - { NID::kLastAccessTime, NULL, kpidLastAccessTime, VT_FILETIME}, - { NID::kWinAttributes, NULL, kpidAttributes, VT_UI4}, - { NID::kStartPos, NULL, kpidPosition, VT_UI4}, - - - { NID::kCRC, NULL, kpidCRC, VT_UI4}, - - { NID::kAnti, L"Anti", kpidIsAnti, VT_BOOL}, - // { 97, NULL, kpidSolid, VT_BOOL}, - #ifndef _SFX - { 98, NULL, kpidMethod, VT_BSTR}, - { 99, L"Block", kpidBlock, VT_UI4} - #endif - // { L"ID", kpidID, VT_BSTR}, - // { L"UnPack Version", kpidUnPackVersion, VT_UI1}, - // { L"Host OS", kpidHostOS, VT_BSTR} -}; - -static const int kPropMapSize = sizeof(kPropMap) / sizeof(kPropMap[0]); - -static int FindPropInMap(UInt64 filePropID) -{ - for (int i = 0; i < kPropMapSize; i++) - if (kPropMap[i].FilePropID == filePropID) - return i; - return -1; -} - -static void CopyOneItem(CRecordVector &src, - CRecordVector &dest, UInt32 item) -{ - for (int i = 0; i < src.Size(); i++) - if (src[i] == item) - { - dest.Add(item); - src.Delete(i); - return; - } -} - -static void RemoveOneItem(CRecordVector &src, UInt32 item) -{ - for (int i = 0; i < src.Size(); i++) - if (src[i] == item) - { - src.Delete(i); - return; - } -} - -static void InsertToHead(CRecordVector &dest, UInt32 item) -{ - for (int i = 0; i < dest.Size(); i++) - if (dest[i] == item) - { - dest.Delete(i); - break; - } - dest.Insert(0, item); -} - -void CHandler::FillPopIDs() -{ - _fileInfoPopIDs.Clear(); - - #ifdef _7Z_VOL - if(_volumes.Size() < 1) - return; - const CVolume &volume = _volumes.Front(); - const CArchiveDatabaseEx &_database = volume.Database; - #endif - - CRecordVector fileInfoPopIDs = _database.ArchiveInfo.FileInfoPopIDs; - - RemoveOneItem(fileInfoPopIDs, NID::kEmptyStream); - RemoveOneItem(fileInfoPopIDs, NID::kEmptyFile); - - CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kName); - CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kAnti); - CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kSize); - CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kPackInfo); - CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kCreationTime); - CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kLastWriteTime); - CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kLastAccessTime); - CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kWinAttributes); - CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kCRC); - CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kComment); - _fileInfoPopIDs += fileInfoPopIDs; - - #ifndef _SFX - _fileInfoPopIDs.Add(98); - _fileInfoPopIDs.Add(99); - #endif - #ifdef _MULTI_PACK - _fileInfoPopIDs.Add(100); - _fileInfoPopIDs.Add(101); - _fileInfoPopIDs.Add(102); - _fileInfoPopIDs.Add(103); - _fileInfoPopIDs.Add(104); - #endif - - #ifndef _SFX - InsertToHead(_fileInfoPopIDs, NID::kLastWriteTime); - InsertToHead(_fileInfoPopIDs, NID::kPackInfo); - InsertToHead(_fileInfoPopIDs, NID::kSize); - InsertToHead(_fileInfoPopIDs, NID::kName); - #endif -} - -STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties) -{ - *numProperties = _fileInfoPopIDs.Size(); - return S_OK; -} - -STDMETHODIMP CHandler::GetPropertyInfo(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) -{ - if((int)index >= _fileInfoPopIDs.Size()) - return E_INVALIDARG; - int indexInMap = FindPropInMap(_fileInfoPopIDs[index]); - if (indexInMap == -1) - return E_INVALIDARG; - const STATPROPSTG &srcItem = kPropMap[indexInMap].StatPROPSTG; - *propID = srcItem.propid; - *varType = srcItem.vt; - *name = 0; - return S_OK; -} - -}} diff --git a/7zip/Archive/7z/7zProperties.h b/7zip/Archive/7z/7zProperties.h deleted file mode 100755 index a09839bb..00000000 --- a/7zip/Archive/7z/7zProperties.h +++ /dev/null @@ -1,22 +0,0 @@ -// 7zProperties.h - -#ifndef __7Z_PROPERTIES_H -#define __7Z_PROPERTIES_H - -#include "../../PropID.h" - -namespace NArchive { -namespace N7z { - -enum // PropID -{ - kpidPackedSize0 = kpidUserDefined, - kpidPackedSize1, - kpidPackedSize2, - kpidPackedSize3, - kpidPackedSize4, -}; - -}} - -#endif diff --git a/7zip/Archive/7z/7zSpecStream.cpp b/7zip/Archive/7z/7zSpecStream.cpp deleted file mode 100755 index 80d303a4..00000000 --- a/7zip/Archive/7z/7zSpecStream.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// 7zSpecStream.cpp - -#include "StdAfx.h" - -#include "7zSpecStream.h" - -STDMETHODIMP CSequentialInStreamSizeCount2::Read(void *data, UInt32 size, UInt32 *processedSize) -{ - UInt32 realProcessedSize; - HRESULT result = _stream->Read(data, size, &realProcessedSize); - _size += realProcessedSize; - if (processedSize != 0) - *processedSize = realProcessedSize; - return result; -} - -STDMETHODIMP CSequentialInStreamSizeCount2::GetSubStreamSize( - UInt64 subStream, UInt64 *value) -{ - if (_getSubStreamSize == NULL) - return E_NOTIMPL; - return _getSubStreamSize->GetSubStreamSize(subStream, value); -} - diff --git a/7zip/Archive/7z/7zSpecStream.h b/7zip/Archive/7z/7zSpecStream.h deleted file mode 100755 index 0253c421..00000000 --- a/7zip/Archive/7z/7zSpecStream.h +++ /dev/null @@ -1,35 +0,0 @@ -// 7zSpecStream.h - -#ifndef __7Z_SPEC_STREAM_H -#define __7Z_SPEC_STREAM_H - -#include "../../IStream.h" -#include "../../ICoder.h" -#include "../../../Common/MyCom.h" - -class CSequentialInStreamSizeCount2: - public ISequentialInStream, - public ICompressGetSubStreamSize, - public CMyUnknownImp -{ - CMyComPtr _stream; - CMyComPtr _getSubStreamSize; - UInt64 _size; -public: - void Init(ISequentialInStream *stream) - { - _stream = stream; - _getSubStreamSize = 0; - _stream.QueryInterface(IID_ICompressGetSubStreamSize, &_getSubStreamSize); - _size = 0; - } - UInt64 GetSize() const { return _size; } - - MY_UNKNOWN_IMP1(ICompressGetSubStreamSize) - - STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); - - STDMETHOD(GetSubStreamSize)(UInt64 subStream, UInt64 *value); -}; - -#endif diff --git a/7zip/Archive/7z/7zUpdate.cpp b/7zip/Archive/7z/7zUpdate.cpp deleted file mode 100755 index 0b4866d8..00000000 --- a/7zip/Archive/7z/7zUpdate.cpp +++ /dev/null @@ -1,1099 +0,0 @@ -// UpdateMain.cpp - -#include "StdAfx.h" - -#include "7zUpdate.h" -#include "7zFolderInStream.h" -#include "7zEncode.h" -#include "7zHandler.h" -#include "7zOut.h" - -#ifndef EXCLUDE_COM -#include "7zMethods.h" -#endif - -#include "../../Compress/Copy/CopyCoder.h" -#include "../../Common/ProgressUtils.h" -#include "../../Common/LimitedStreams.h" -#include "../../Common/LimitedStreams.h" -#include "../Common/ItemNameUtils.h" - -namespace NArchive { -namespace N7z { - -static const wchar_t *kMatchFinderForBCJ2_LZMA = L"BT2"; -static const UInt32 kDictionaryForBCJ2_LZMA = 1 << 20; -static const UInt32 kAlgorithmForBCJ2_LZMA = 2; -static const UInt32 kNumFastBytesForBCJ2_LZMA = 64; - -static HRESULT CopyBlock(ISequentialInStream *inStream, - ISequentialOutStream *outStream, ICompressProgressInfo *progress) -{ - CMyComPtr copyCoder = new NCompress::CCopyCoder; - return copyCoder->Code(inStream, outStream, NULL, NULL, progress); -} - -static HRESULT WriteRange( - ISequentialInStream *inStream, - ISequentialOutStream *outStream, - UInt64 size, - IProgress *progress, - UInt64 ¤tComplexity) -{ - CLimitedSequentialInStream *streamSpec = new - CLimitedSequentialInStream; - CMyComPtr inStreamLimited(streamSpec); - streamSpec->SetStream(inStream); - streamSpec->Init(size); - - CLocalProgress *localProgressSpec = new CLocalProgress; - CMyComPtr localProgress = localProgressSpec; - localProgressSpec->Init(progress, true); - - CLocalCompressProgressInfo *localCompressProgressSpec = - new CLocalCompressProgressInfo; - CMyComPtr compressProgress = localCompressProgressSpec; - - localCompressProgressSpec->Init(localProgress, ¤tComplexity, ¤tComplexity); - - HRESULT result = CopyBlock(inStreamLimited, outStream, compressProgress); - currentComplexity += size; - return result; -} - - -static HRESULT WriteRange(IInStream *inStream, - ISequentialOutStream *outStream, - UInt64 position, - UInt64 size, - IProgress *progress, - UInt64 ¤tComplexity) -{ - inStream->Seek(position, STREAM_SEEK_SET, 0); - return WriteRange(inStream, outStream, - size, progress, currentComplexity); -} - -static int GetReverseSlashPos(const UString &name) -{ - int slashPos = name.ReverseFind(L'/'); - #ifdef _WIN32 - int slash1Pos = name.ReverseFind(L'\\'); - slashPos = MyMax(slashPos, slash1Pos); - #endif - return slashPos; -} - -int CUpdateItem::GetExtensionPos() const -{ - int slashPos = GetReverseSlashPos(Name); - int dotPos = Name.ReverseFind(L'.'); - if (dotPos < 0 || (dotPos < slashPos && slashPos >= 0)) - return Name.Length(); - return dotPos + 1; -} - -UString CUpdateItem::GetExtension() const -{ - return Name.Mid(GetExtensionPos()); -} - -/* -struct CFolderRef -{ - const CArchiveDatabaseEx *Database; - int FolderIndex; -}; -*/ - -#define RINOZ(x) { int __tt = (x); if (__tt != 0) return __tt; } - -static int CompareMethodIDs(const CMethodID &a1, const CMethodID &a2) -{ - for (int i = 0; i < a1.IDSize && i < a2.IDSize; i++) - RINOZ(MyCompare(a1.ID[i], a2.ID[i])); - return MyCompare(a1.IDSize, a2.IDSize); -} - -static int CompareBuffers(const CByteBuffer &a1, const CByteBuffer &a2) -{ - size_t c1 = a1.GetCapacity(); - size_t c2 = a2.GetCapacity(); - RINOZ(MyCompare(c1, c2)); - for (size_t i = 0; i < c1; i++) - RINOZ(MyCompare(a1[i], a2[i])); - return 0; -} - -static int CompareAltCoders(const CAltCoderInfo &a1, const CAltCoderInfo &a2) -{ - RINOZ(CompareMethodIDs(a1.MethodID, a2.MethodID)); - return CompareBuffers(a1.Properties, a2.Properties); -} - -static int CompareCoders(const CCoderInfo &c1, const CCoderInfo &c2) -{ - RINOZ(MyCompare(c1.NumInStreams, c2.NumInStreams)); - RINOZ(MyCompare(c1.NumOutStreams, c2.NumOutStreams)); - int s1 = c1.AltCoders.Size(); - int s2 = c2.AltCoders.Size(); - RINOZ(MyCompare(s1, s2)); - for (int i = 0; i < s1; i++) - RINOZ(CompareAltCoders(c1.AltCoders[i], c2.AltCoders[i])); - return 0; -} - -static int CompareBindPairs(const CBindPair &b1, const CBindPair &b2) -{ - RINOZ(MyCompare(b1.InIndex, b2.InIndex)); - return MyCompare(b1.OutIndex, b2.OutIndex); -} - -static int CompareFolders(const CFolder &f1, const CFolder &f2) -{ - int s1 = f1.Coders.Size(); - int s2 = f2.Coders.Size(); - RINOZ(MyCompare(s1, s2)); - int i; - for (i = 0; i < s1; i++) - RINOZ(CompareCoders(f1.Coders[i], f2.Coders[i])); - s1 = f1.BindPairs.Size(); - s2 = f2.BindPairs.Size(); - RINOZ(MyCompare(s1, s2)); - for (i = 0; i < s1; i++) - RINOZ(CompareBindPairs(f1.BindPairs[i], f2.BindPairs[i])); - return 0; -} - -static int CompareFiles(const CFileItem &f1, const CFileItem &f2) -{ - return MyStringCompareNoCase(f1.Name, f2.Name); -} - -static int CompareFolderRefs(const int *p1, const int *p2, void *param) -{ - int i1 = *p1; - int i2 = *p2; - const CArchiveDatabaseEx &db = *(const CArchiveDatabaseEx *)param; - RINOZ(CompareFolders( - db.Folders[i1], - db.Folders[i2])); - RINOZ(MyCompare( - db.NumUnPackStreamsVector[i1], - db.NumUnPackStreamsVector[i2])); - if (db.NumUnPackStreamsVector[i1] == 0) - return 0; - return CompareFiles( - db.Files[db.FolderStartFileIndex[i1]], - db.Files[db.FolderStartFileIndex[i2]]); -} - -//////////////////////////////////////////////////////////// - -static int CompareEmptyItems(const int *p1, const int *p2, void *param) -{ - const CObjectVector &updateItems = *(const CObjectVector *)param; - const CUpdateItem &u1 = updateItems[*p1]; - const CUpdateItem &u2 = updateItems[*p2]; - if (u1.IsDirectory != u2.IsDirectory) - return (u1.IsDirectory) ? 1 : -1; - if (u1.IsDirectory) - { - if (u1.IsAnti != u2.IsAnti) - return (u1.IsAnti ? 1 : -1); - int n = MyStringCompareNoCase(u1.Name, u2.Name); - return -n; - } - if (u1.IsAnti != u2.IsAnti) - return (u1.IsAnti ? 1 : -1); - return MyStringCompareNoCase(u1.Name, u2.Name); -} - -static const char *g_Exts = - " lzma 7z ace arc arj bz bz2 deb lzo lzx gz pak rpm sit tgz tbz tbz2 tgz cab ha lha lzh rar zoo" - " zip jar ear war msi" - " 3gp avi mov mpeg mpg mpe wmv" - " aac ape fla flac la mp3 m4a mp4 ofr ogg pac ra rm rka shn swa tta wv wma wav" - " swf " - " chm hxi hxs" - " gif jpeg jpg jp2 png tiff bmp ico psd psp" - " awg ps eps cgm dxf svg vrml wmf emf ai md" - " cad dwg pps key sxi" - " max 3ds" - " iso bin nrg mdf img pdi tar cpio xpi" - " vfd vhd vud vmc vsv" - " vmdk dsk nvram vmem vmsd vmsn vmss vmtm" - " inl inc idl acf asa h hpp hxx c cpp cxx rc java cs pas bas vb cls ctl frm dlg def" - " f77 f f90 f95" - " asm sql manifest dep " - " mak clw csproj vcproj sln dsp dsw " - " class " - " bat cmd" - " xml xsd xsl xslt hxk hxc htm html xhtml xht mht mhtml htw asp aspx css cgi jsp shtml" - " awk sed hta js php php3 php4 php5 phptml pl pm py pyo rb sh tcl vbs" - " text txt tex ans asc srt reg ini doc docx mcw dot rtf hlp xls xlr xlt xlw ppt pdf" - " sxc sxd sxi sxg sxw stc sti stw stm odt ott odg otg odp otp ods ots odf" - " abw afp cwk lwp wpd wps wpt wrf wri" - " abf afm bdf fon mgf otf pcf pfa snf ttf" - " dbf mdb nsf ntf wdb db fdb gdb" - " exe dll ocx vbx sfx sys tlb awx com obj lib out o so " - " pdb pch idb ncb opt"; - -int GetExtIndex(const char *ext) -{ - int extIndex = 1; - const char *p = g_Exts; - for (;;) - { - char c = *p++; - if (c == 0) - return extIndex; - if (c == ' ') - continue; - int pos = 0; - for (;;) - { - char c2 = ext[pos++]; - if (c2 == 0 && (c == 0 || c == ' ')) - return extIndex; - if (c != c2) - break; - c = *p++; - } - extIndex++; - for (;;) - { - if (c == 0) - return extIndex; - if (c == ' ') - break; - c = *p++; - } - } -} - -struct CRefItem -{ - UInt32 Index; - const CUpdateItem *UpdateItem; - UInt32 ExtensionPos; - UInt32 NamePos; - int ExtensionIndex; - CRefItem(UInt32 index, const CUpdateItem &updateItem, bool sortByType): - Index(index), - UpdateItem(&updateItem), - ExtensionPos(0), - NamePos(0), - ExtensionIndex(0) - { - if (sortByType) - { - int slashPos = GetReverseSlashPos(updateItem.Name); - NamePos = ((slashPos >= 0) ? (slashPos + 1) : 0); - int dotPos = updateItem.Name.ReverseFind(L'.'); - if (dotPos < 0 || (dotPos < slashPos && slashPos >= 0)) - ExtensionPos = updateItem.Name.Length(); - else - { - ExtensionPos = dotPos + 1; - UString us = updateItem.Name.Mid(ExtensionPos); - if (!us.IsEmpty()) - { - us.MakeLower(); - int i; - AString s; - for (i = 0; i < us.Length(); i++) - { - wchar_t c = us[i]; - if (c >= 0x80) - break; - s += (char)c; - } - if (i == us.Length()) - ExtensionIndex = GetExtIndex(s); - else - ExtensionIndex = 0; - } - } - } - } -}; - -static int CompareUpdateItems(const CRefItem *p1, const CRefItem *p2, void *param) -{ - const CRefItem &a1 = *p1; - const CRefItem &a2 = *p2; - const CUpdateItem &u1 = *a1.UpdateItem; - const CUpdateItem &u2 = *a2.UpdateItem; - int n; - if (u1.IsDirectory != u2.IsDirectory) - return (u1.IsDirectory) ? 1 : -1; - if (u1.IsDirectory) - { - if (u1.IsAnti != u2.IsAnti) - return (u1.IsAnti ? 1 : -1); - n = MyStringCompareNoCase(u1.Name, u2.Name); - return -n; - } - bool sortByType = *(bool *)param; - if (sortByType) - { - RINOZ(MyCompare(a1.ExtensionIndex, a2.ExtensionIndex)) - RINOZ(MyStringCompareNoCase(u1.Name + a1.ExtensionPos, u2.Name + a2.ExtensionPos)); - RINOZ(MyStringCompareNoCase(u1.Name + a1.NamePos, u2.Name + a2.NamePos)); - if (u1.IsLastWriteTimeDefined && u2.IsLastWriteTimeDefined) - RINOZ(CompareFileTime(&u1.LastWriteTime, &u2.LastWriteTime)); - RINOZ(MyCompare(u1.Size, u2.Size)) - } - return MyStringCompareNoCase(u1.Name, u2.Name); -} - -struct CSolidGroup -{ - CCompressionMethodMode Method; - CRecordVector Indices; -}; - -static wchar_t *g_ExeExts[] = -{ - L"dll", - L"exe", - L"ocx", - L"sfx", - L"sys" -}; - -static bool IsExeFile(const UString &ext) -{ - for (int i = 0; i < sizeof(g_ExeExts) / sizeof(g_ExeExts[0]); i++) - if (ext.CompareNoCase(g_ExeExts[i]) == 0) - return true; - return false; -} - -static CMethodID k_BCJ_X86 = { { 0x3, 0x3, 0x1, 0x3 }, 4 }; -static CMethodID k_BCJ2 = { { 0x3, 0x3, 0x1, 0x1B }, 4 }; -static CMethodID k_LZMA = { { 0x3, 0x1, 0x1 }, 3 }; - -static bool GetMethodFull(const CMethodID &methodID, - UInt32 numInStreams, CMethodFull &methodResult) -{ - methodResult.MethodID = methodID; - methodResult.NumInStreams = numInStreams; - methodResult.NumOutStreams = 1; - - #ifndef EXCLUDE_COM - CMethodInfo methodInfo; - if (!GetMethodInfo(methodID, methodInfo)) - return false; - if (!methodInfo.EncoderIsAssigned) - return false; - methodResult.EncoderClassID = methodInfo.Encoder; - methodResult.FilePath = methodInfo.FilePath; - if (methodInfo.NumOutStreams != 1 || methodInfo.NumInStreams != numInStreams) - return false; - #endif - return true; -} - -static bool MakeExeMethod(const CCompressionMethodMode &method, - bool bcj2Filter, CCompressionMethodMode &exeMethod) -{ - exeMethod = method; - if (bcj2Filter) - { - CMethodFull methodFull; - if (!GetMethodFull(k_BCJ2, 4, methodFull)) - return false; - exeMethod.Methods.Insert(0, methodFull); - if (!GetMethodFull(k_LZMA, 1, methodFull)) - return false; - { - CProperty property; - property.PropID = NCoderPropID::kAlgorithm; - property.Value = kAlgorithmForBCJ2_LZMA; - methodFull.CoderProperties.Add(property); - } - { - CProperty property; - property.PropID = NCoderPropID::kMatchFinder; - property.Value = kMatchFinderForBCJ2_LZMA; - methodFull.CoderProperties.Add(property); - } - { - CProperty property; - property.PropID = NCoderPropID::kDictionarySize; - property.Value = kDictionaryForBCJ2_LZMA; - methodFull.CoderProperties.Add(property); - } - { - CProperty property; - property.PropID = NCoderPropID::kNumFastBytes; - property.Value = kNumFastBytesForBCJ2_LZMA; - methodFull.CoderProperties.Add(property); - } - - exeMethod.Methods.Add(methodFull); - exeMethod.Methods.Add(methodFull); - CBind bind; - - bind.OutCoder = 0; - bind.InStream = 0; - - bind.InCoder = 1; - bind.OutStream = 0; - exeMethod.Binds.Add(bind); - - bind.InCoder = 2; - bind.OutStream = 1; - exeMethod.Binds.Add(bind); - - bind.InCoder = 3; - bind.OutStream = 2; - exeMethod.Binds.Add(bind); - } - else - { - CMethodFull methodFull; - if (!GetMethodFull(k_BCJ_X86, 1, methodFull)) - return false; - exeMethod.Methods.Insert(0, methodFull); - CBind bind; - bind.OutCoder = 0; - bind.InStream = 0; - bind.InCoder = 1; - bind.OutStream = 0; - exeMethod.Binds.Add(bind); - } - return true; -} - -static void SplitFilesToGroups( - const CCompressionMethodMode &method, - bool useFilters, bool maxFilter, - const CObjectVector &updateItems, - CObjectVector &groups) -{ - if (method.Methods.Size() != 1 || method.Binds.Size() != 0) - useFilters = false; - groups.Clear(); - groups.Add(CSolidGroup()); - groups.Add(CSolidGroup()); - CSolidGroup &generalGroup = groups[0]; - CSolidGroup &exeGroup = groups[1]; - generalGroup.Method = method; - int i; - for (i = 0; i < updateItems.Size(); i++) - { - const CUpdateItem &updateItem = updateItems[i]; - if (!updateItem.NewData) - continue; - if (!updateItem.HasStream()) - continue; - if (useFilters) - { - const UString name = updateItem.Name; - int dotPos = name.ReverseFind(L'.'); - if (dotPos >= 0) - { - UString ext = name.Mid(dotPos + 1); - if (IsExeFile(ext)) - { - exeGroup.Indices.Add(i); - continue; - } - } - } - generalGroup.Indices.Add(i); - } - if (exeGroup.Indices.Size() > 0) - if (!MakeExeMethod(method, maxFilter, exeGroup.Method)) - exeGroup.Method = method; - for (i = 0; i < groups.Size();) - if (groups[i].Indices.Size() == 0) - groups.Delete(i); - else - i++; -} - -static void FromUpdateItemToFileItem(const CUpdateItem &updateItem, - CFileItem &file) -{ - file.Name = NItemName::MakeLegalName(updateItem.Name); - if (updateItem.AttributesAreDefined) - file.SetAttributes(updateItem.Attributes); - - if (updateItem.IsCreationTimeDefined) - file.SetCreationTime(updateItem.CreationTime); - if (updateItem.IsLastWriteTimeDefined) - file.SetLastWriteTime(updateItem.LastWriteTime); - if (updateItem.IsLastAccessTimeDefined) - file.SetLastAccessTime(updateItem.LastAccessTime); - - file.UnPackSize = updateItem.Size; - file.IsDirectory = updateItem.IsDirectory; - file.IsAnti = updateItem.IsAnti; - file.HasStream = updateItem.HasStream(); -} - -static HRESULT Update2( - IInStream *inStream, - const CArchiveDatabaseEx *database, - const CObjectVector &updateItems, - ISequentialOutStream *seqOutStream, - IArchiveUpdateCallback *updateCallback, - const CUpdateOptions &options) -{ - UInt64 numSolidFiles = options.NumSolidFiles; - if (numSolidFiles == 0) - numSolidFiles = 1; - /* - CMyComPtr outStream; - RINOK(seqOutStream->QueryInterface(IID_IOutStream, (void **)&outStream)); - if (!outStream) - return E_NOTIMPL; - */ - - UInt64 startBlockSize = database != 0 ? - database->ArchiveInfo.StartPosition: 0; - if (startBlockSize > 0 && !options.RemoveSfxBlock) - { - CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream; - CMyComPtr limitedStream(streamSpec); - RINOK(inStream->Seek(0, STREAM_SEEK_SET, NULL)); - streamSpec->SetStream(inStream); - streamSpec->Init(startBlockSize); - RINOK(CopyBlock(limitedStream, seqOutStream, NULL)); - } - - CRecordVector fileIndexToUpdateIndexMap; - if (database != 0) - { - fileIndexToUpdateIndexMap.Reserve(database->Files.Size()); - for (int i = 0; i < database->Files.Size(); i++) - fileIndexToUpdateIndexMap.Add(-1); - } - int i; - for(i = 0; i < updateItems.Size(); i++) - { - int index = updateItems[i].IndexInArchive; - if (index != -1) - fileIndexToUpdateIndexMap[index] = i; - } - - CRecordVector folderRefs; - if (database != 0) - { - for(i = 0; i < database->Folders.Size(); i++) - { - CNum indexInFolder = 0; - CNum numCopyItems = 0; - CNum numUnPackStreams = database->NumUnPackStreamsVector[i]; - for (CNum fileIndex = database->FolderStartFileIndex[i]; - indexInFolder < numUnPackStreams; fileIndex++) - { - if (database->Files[fileIndex].HasStream) - { - indexInFolder++; - int updateIndex = fileIndexToUpdateIndexMap[fileIndex]; - if (updateIndex >= 0) - if (!updateItems[updateIndex].NewData) - numCopyItems++; - } - } - if (numCopyItems != numUnPackStreams && numCopyItems != 0) - return E_NOTIMPL; // It needs repacking !!! - if (numCopyItems > 0) - folderRefs.Add(i); - } - folderRefs.Sort(CompareFolderRefs, (void *)database); - } - - CArchiveDatabase newDatabase; - - //////////////////////////// - - COutArchive archive; - RINOK(archive.Create(seqOutStream, false)); - RINOK(archive.SkeepPrefixArchiveHeader()); - UInt64 complexity = 0; - for(i = 0; i < folderRefs.Size(); i++) - complexity += database->GetFolderFullPackSize(folderRefs[i]); - UInt64 inSizeForReduce = 0; - for(i = 0; i < updateItems.Size(); i++) - { - const CUpdateItem &updateItem = updateItems[i]; - if (updateItem.NewData) - { - complexity += updateItem.Size; - if (numSolidFiles == 1) - { - if (updateItem.Size > inSizeForReduce) - inSizeForReduce = updateItem.Size; - } - else - inSizeForReduce += updateItem.Size; - } - } - RINOK(updateCallback->SetTotal(complexity)); - complexity = 0; - RINOK(updateCallback->SetCompleted(&complexity)); - - ///////////////////////////////////////// - // Write Copy Items - - for(i = 0; i < folderRefs.Size(); i++) - { - int folderIndex = folderRefs[i]; - - RINOK(WriteRange(inStream, archive.SeqStream, - database->GetFolderStreamPos(folderIndex, 0), - database->GetFolderFullPackSize(folderIndex), - updateCallback, complexity)); - - const CFolder &folder = database->Folders[folderIndex]; - CNum startIndex = database->FolderStartPackStreamIndex[folderIndex]; - for (int j = 0; j < folder.PackStreams.Size(); j++) - { - newDatabase.PackSizes.Add(database->PackSizes[startIndex + j]); - // newDatabase.PackCRCsDefined.Add(database.PackCRCsDefined[startIndex + j]); - // newDatabase.PackCRCs.Add(database.PackCRCs[startIndex + j]); - } - newDatabase.Folders.Add(folder); - - CNum numUnPackStreams = database->NumUnPackStreamsVector[folderIndex]; - newDatabase.NumUnPackStreamsVector.Add(numUnPackStreams); - - CNum indexInFolder = 0; - for (CNum fi = database->FolderStartFileIndex[folderIndex]; - indexInFolder < numUnPackStreams; fi++) - { - CFileItem file = database->Files[fi]; - if (file.HasStream) - { - indexInFolder++; - int updateIndex = fileIndexToUpdateIndexMap[fi]; - if (updateIndex >= 0) - { - const CUpdateItem &updateItem = updateItems[updateIndex]; - if (updateItem.NewProperties) - { - CFileItem file2; - FromUpdateItemToFileItem(updateItem, file2); - file2.UnPackSize = file.UnPackSize; - file2.FileCRC = file.FileCRC; - file2.IsFileCRCDefined = file.IsFileCRCDefined; - file2.HasStream = file.HasStream; - file = file2; - } - } - newDatabase.Files.Add(file); - } - } - } - - ///////////////////////////////////////// - // Compress New Files - - CObjectVector groups; - SplitFilesToGroups(*options.Method, options.UseFilters, options.MaxFilter, - updateItems, groups); - - const UInt32 kMinReduceSize = (1 << 16); - if (inSizeForReduce < kMinReduceSize) - inSizeForReduce = kMinReduceSize; - - for (int groupIndex = 0; groupIndex < groups.Size(); groupIndex++) - { - const CSolidGroup &group = groups[groupIndex]; - int numFiles = group.Indices.Size(); - if (numFiles == 0) - continue; - CRecordVector refItems; - refItems.Reserve(numFiles); - bool sortByType = (numSolidFiles > 1); - for (i = 0; i < numFiles; i++) - refItems.Add(CRefItem(group.Indices[i], updateItems[group.Indices[i]], sortByType)); - refItems.Sort(CompareUpdateItems, (void *)&sortByType); - - CRecordVector indices; - indices.Reserve(numFiles); - - for (i = 0; i < numFiles; i++) - { - UInt32 index = refItems[i].Index; - indices.Add(index); - /* - const CUpdateItem &updateItem = updateItems[index]; - CFileItem file; - if (updateItem.NewProperties) - FromUpdateItemToFileItem(updateItem, file); - else - file = database.Files[updateItem.IndexInArchive]; - if (file.IsAnti || file.IsDirectory) - return E_FAIL; - newDatabase.Files.Add(file); - */ - } - - CEncoder encoder(group.Method); - - for (i = 0; i < numFiles;) - { - UInt64 totalSize = 0; - int numSubFiles; - UString prevExtension; - for (numSubFiles = 0; i + numSubFiles < numFiles && - numSubFiles < numSolidFiles; numSubFiles++) - { - const CUpdateItem &updateItem = updateItems[indices[i + numSubFiles]]; - totalSize += updateItem.Size; - if (totalSize > options.NumSolidBytes) - break; - if (options.SolidExtension) - { - UString ext = updateItem.GetExtension(); - if (numSubFiles == 0) - prevExtension = ext; - else - if (ext.CompareNoCase(prevExtension) != 0) - break; - } - } - if (numSubFiles < 1) - numSubFiles = 1; - - CFolderInStream *inStreamSpec = new CFolderInStream; - CMyComPtr solidInStream(inStreamSpec); - inStreamSpec->Init(updateCallback, &indices[i], numSubFiles); - - CFolder folderItem; - CLocalProgress *localProgressSpec = new CLocalProgress; - CMyComPtr localProgress = localProgressSpec; - localProgressSpec->Init(updateCallback, true); - CLocalCompressProgressInfo *localCompressProgressSpec = new CLocalCompressProgressInfo; - CMyComPtr compressProgress = localCompressProgressSpec; - localCompressProgressSpec->Init(localProgress, &complexity, NULL); - - RINOK(encoder.Encode(solidInStream, NULL, &inSizeForReduce, folderItem, - archive.SeqStream, newDatabase.PackSizes, compressProgress)); - // for() - // newDatabase.PackCRCsDefined.Add(false); - // newDatabase.PackCRCs.Add(0); - - newDatabase.Folders.Add(folderItem); - - CNum numUnPackStreams = 0; - for (int subIndex = 0; subIndex < numSubFiles; subIndex++) - { - const CUpdateItem &updateItem = updateItems[indices[i + subIndex]]; - CFileItem file; - if (updateItem.NewProperties) - FromUpdateItemToFileItem(updateItem, file); - else - file = database->Files[updateItem.IndexInArchive]; - if (file.IsAnti || file.IsDirectory) - return E_FAIL; - - /* - CFileItem &file = newDatabase.Files[ - startFileIndexInDatabase + i + subIndex]; - */ - if (!inStreamSpec->Processed[subIndex]) - { - continue; - // file.Name += L".locked"; - } - - file.FileCRC = inStreamSpec->CRCs[subIndex]; - file.UnPackSize = inStreamSpec->Sizes[subIndex]; - if (file.UnPackSize != 0) - { - file.IsFileCRCDefined = true; - file.HasStream = true; - numUnPackStreams++; - complexity += file.UnPackSize; - } - else - { - file.IsFileCRCDefined = false; - file.HasStream = false; - } - newDatabase.Files.Add(file); - } - // numUnPackStreams = 0 is very bad case for locked files - // v3.13 doesn't understand it. - newDatabase.NumUnPackStreamsVector.Add(numUnPackStreams); - i += numSubFiles; - } - } - - { - ///////////////////////////////////////// - // Write Empty Files & Folders - - CRecordVector emptyRefs; - for(i = 0; i < updateItems.Size(); i++) - { - const CUpdateItem &updateItem = updateItems[i]; - if (updateItem.NewData) - { - if (updateItem.HasStream()) - continue; - } - else - if (updateItem.IndexInArchive != -1) - if (database->Files[updateItem.IndexInArchive].HasStream) - continue; - emptyRefs.Add(i); - } - emptyRefs.Sort(CompareEmptyItems, (void *)&updateItems); - for(i = 0; i < emptyRefs.Size(); i++) - { - const CUpdateItem &updateItem = updateItems[emptyRefs[i]]; - CFileItem file; - if (updateItem.NewProperties) - FromUpdateItemToFileItem(updateItem, file); - else - file = database->Files[updateItem.IndexInArchive]; - newDatabase.Files.Add(file); - } - } - - /* - if (newDatabase.Files.Size() != updateItems.Size()) - return E_FAIL; - */ - - return archive.WriteDatabase(newDatabase, options.HeaderMethod, options.HeaderOptions); -} - -#ifdef _7Z_VOL - -static HRESULT WriteVolumeHeader(COutArchive &archive, CFileItem &file, const CUpdateOptions &options) -{ - CAltCoderInfo altCoder; - altCoder.MethodID.IDSize = 1; - altCoder.MethodID.ID[0] = 0; - CCoderInfo coder; - coder.NumInStreams = coder.NumOutStreams = 1; - coder.AltCoders.Add(altCoder); - - CFolder folder; - folder.Coders.Add(coder); - folder.PackStreams.Add(0); - - CNum numUnPackStreams = 0; - if (file.UnPackSize != 0) - { - file.IsFileCRCDefined = true; - file.HasStream = true; - numUnPackStreams++; - } - else - { - throw 1; - file.IsFileCRCDefined = false; - file.HasStream = false; - } - folder.UnPackSizes.Add(file.UnPackSize); - - CArchiveDatabase newDatabase; - newDatabase.Files.Add(file); - newDatabase.Folders.Add(folder); - newDatabase.NumUnPackStreamsVector.Add(numUnPackStreams); - newDatabase.PackSizes.Add(file.UnPackSize); - newDatabase.PackCRCsDefined.Add(false); - newDatabase.PackCRCs.Add(file.FileCRC); - - return archive.WriteDatabase(newDatabase, - options.HeaderMethod, - false, - false); -} - -HRESULT UpdateVolume( - IInStream *inStream, - const CArchiveDatabaseEx *database, - CObjectVector &updateItems, - ISequentialOutStream *seqOutStream, - IArchiveUpdateCallback *updateCallback, - const CUpdateOptions &options) -{ - if (updateItems.Size() != 1) - return E_NOTIMPL; - - CMyComPtr volumeCallback; - RINOK(updateCallback->QueryInterface(IID_IArchiveUpdateCallback2, (void **)&volumeCallback)); - if (!volumeCallback) - return E_NOTIMPL; - - CMyComPtr fileStream; - HRESULT result = updateCallback->GetStream(0, &fileStream); - if (result != S_OK && result != S_FALSE) - return result; - if (result == S_FALSE) - return E_FAIL; - - CFileItem file; - - const CUpdateItem &updateItem = updateItems[0]; - if (updateItem.NewProperties) - FromUpdateItemToFileItem(updateItem, file); - else - file = database->Files[updateItem.IndexInArchive]; - if (file.IsAnti || file.IsDirectory) - return E_FAIL; - - UInt64 complexity = 0; - file.IsStartPosDefined = true; - file.StartPos = 0; - for (UInt64 volumeIndex = 0; true; volumeIndex++) - { - UInt64 volSize; - RINOK(volumeCallback->GetVolumeSize(volumeIndex, &volSize)); - UInt64 pureSize = COutArchive::GetVolPureSize(volSize, file.Name.Length(), true); - CMyComPtr volumeStream; - RINOK(volumeCallback->GetVolumeStream(volumeIndex, &volumeStream)); - - COutArchive archive; - RINOK(archive.Create(volumeStream, true)); - RINOK(archive.SkeepPrefixArchiveHeader()); - - CSequentialInStreamWithCRC *inCrcStreamSpec = new CSequentialInStreamWithCRC; - CMyComPtr inCrcStream = inCrcStreamSpec; - inCrcStreamSpec->Init(fileStream); - - RINOK(WriteRange(inCrcStream, volumeStream, pureSize, - updateCallback, complexity)); - file.UnPackSize = inCrcStreamSpec->GetSize(); - if (file.UnPackSize == 0) - break; - file.FileCRC = inCrcStreamSpec->GetCRC(); - RINOK(WriteVolumeHeader(archive, file, options)); - file.StartPos += file.UnPackSize; - if (file.UnPackSize < pureSize) - break; - } - return S_OK; -} - -class COutVolumeStream: - public ISequentialOutStream, - public CMyUnknownImp -{ - int _volIndex; - UInt64 _volSize; - UInt64 _curPos; - CMyComPtr _volumeStream; - COutArchive _archive; - CCRC _crc; - -public: - MY_UNKNOWN_IMP - - CFileItem _file; - CUpdateOptions _options; - CMyComPtr VolumeCallback; - void Init(IArchiveUpdateCallback2 *volumeCallback, - const UString &name) - { - _file.Name = name; - _file.IsStartPosDefined = true; - _file.StartPos = 0; - - VolumeCallback = volumeCallback; - _volIndex = 0; - _volSize = 0; - } - - HRESULT Flush(); - STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); -}; - -HRESULT COutVolumeStream::Flush() -{ - if (_volumeStream) - { - _file.UnPackSize = _curPos; - _file.FileCRC = _crc.GetDigest(); - RINOK(WriteVolumeHeader(_archive, _file, _options)); - _archive.Close(); - _volumeStream.Release(); - _file.StartPos += _file.UnPackSize; - } - return S_OK; -} - -STDMETHODIMP COutVolumeStream::Write(const void *data, UInt32 size, UInt32 *processedSize) -{ - if(processedSize != NULL) - *processedSize = 0; - while(size > 0) - { - if (!_volumeStream) - { - RINOK(VolumeCallback->GetVolumeSize(_volIndex, &_volSize)); - RINOK(VolumeCallback->GetVolumeStream(_volIndex, &_volumeStream)); - _volIndex++; - _curPos = 0; - RINOK(_archive.Create(_volumeStream, true)); - RINOK(_archive.SkeepPrefixArchiveHeader()); - _crc.Init(); - continue; - } - UInt64 pureSize = COutArchive::GetVolPureSize(_volSize, _file.Name.Length()); - UInt32 curSize = (UInt32)MyMin(UInt64(size), pureSize - _curPos); - - _crc.Update(data, curSize); - UInt32 realProcessed; - RINOK(_volumeStream->Write(data, curSize, &realProcessed)) - data = (void *)((Byte *)data + realProcessed); - size -= realProcessed; - if(processedSize != NULL) - *processedSize += realProcessed; - _curPos += realProcessed; - if (realProcessed != curSize && realProcessed == 0) - return E_FAIL; - if (_curPos == pureSize) - { - RINOK(Flush()); - } - } - return S_OK; -} - -#endif - -HRESULT Update( - IInStream *inStream, - const CArchiveDatabaseEx *database, - const CObjectVector &updateItems, - ISequentialOutStream *seqOutStream, - IArchiveUpdateCallback *updateCallback, - const CUpdateOptions &options) -{ - #ifdef _7Z_VOL - if (seqOutStream) - #endif - return Update2(inStream, database, updateItems, - seqOutStream, updateCallback, options); - #ifdef _7Z_VOL - if (options.VolumeMode) - return UpdateVolume(inStream, database, updateItems, - seqOutStream, updateCallback, options); - COutVolumeStream *volStreamSpec = new COutVolumeStream; - CMyComPtr volStream = volStreamSpec; - CMyComPtr volumeCallback; - RINOK(updateCallback->QueryInterface(IID_IArchiveUpdateCallback2, (void **)&volumeCallback)); - if (!volumeCallback) - return E_NOTIMPL; - volStreamSpec->Init(volumeCallback, L"a.7z"); - volStreamSpec->_options = options; - RINOK(Update2(inStream, database, updateItems, - volStream, updateCallback, options)); - return volStreamSpec->Flush(); - #endif -} - -}} diff --git a/7zip/Archive/7z/7zUpdate.h b/7zip/Archive/7z/7zUpdate.h deleted file mode 100755 index 385bd942..00000000 --- a/7zip/Archive/7z/7zUpdate.h +++ /dev/null @@ -1,79 +0,0 @@ -// 7zUpdate.h - -#ifndef __7Z_UPDATE_H -#define __7Z_UPDATE_H - -#include "7zIn.h" -#include "7zOut.h" -#include "7zCompressionMode.h" - -#include "../IArchive.h" - -namespace NArchive { -namespace N7z { - -struct CUpdateItem -{ - bool NewData; - bool NewProperties; - int IndexInArchive; - int IndexInClient; - - UInt32 Attributes; - FILETIME CreationTime; - FILETIME LastWriteTime; - FILETIME LastAccessTime; - - UInt64 Size; - UString Name; - - bool IsAnti; - bool IsDirectory; - - bool IsCreationTimeDefined; - bool IsLastWriteTimeDefined; - bool IsLastAccessTimeDefined; - bool AttributesAreDefined; - - const bool HasStream() const - { return !IsDirectory && !IsAnti && Size != 0; } - CUpdateItem(): - IsAnti(false), - AttributesAreDefined(false), - IsCreationTimeDefined(false), - IsLastWriteTimeDefined(false), - IsLastAccessTimeDefined(false) - {} - void SetDirectoryStatusFromAttributes() - { IsDirectory = ((Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0); }; - - int GetExtensionPos() const; - UString GetExtension() const; -}; - -struct CUpdateOptions -{ - const CCompressionMethodMode *Method; - const CCompressionMethodMode *HeaderMethod; - bool UseFilters; - bool MaxFilter; - - CHeaderOptions HeaderOptions; - - UInt64 NumSolidFiles; - UInt64 NumSolidBytes; - bool SolidExtension; - bool RemoveSfxBlock; - bool VolumeMode; -}; - -HRESULT Update( - IInStream *inStream, - const CArchiveDatabaseEx *database, - const CObjectVector &updateItems, - ISequentialOutStream *seqOutStream, - IArchiveUpdateCallback *updateCallback, - const CUpdateOptions &options); -}} - -#endif diff --git a/7zip/Archive/7z/DllExports.cpp b/7zip/Archive/7z/DllExports.cpp deleted file mode 100755 index c8d31b3b..00000000 --- a/7zip/Archive/7z/DllExports.cpp +++ /dev/null @@ -1,115 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "../../../Common/MyInitGuid.h" -#include "../../../Common/ComTry.h" -#ifdef _WIN32 -#include "../../../Common/Alloc.h" -#endif - -#include "../../ICoder.h" - -#include "7zHandler.h" - -#ifndef EXCLUDE_COM -// {23170F69-40C1-278B-06F1-070100000100} -DEFINE_GUID(CLSID_CCrypto7zAESEncoder, -0x23170F69, 0x40C1, 0x278B, 0x06, 0xF1, 0x07, 0x01, 0x00, 0x00, 0x01, 0x00); -#else -#include "../../Compress/LZ/IMatchFinder.h" -#endif - -HINSTANCE g_hInstance; -#ifndef _UNICODE -bool g_IsNT = false; -static bool IsItWindowsNT() -{ - OSVERSIONINFO versionInfo; - versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); - if (!::GetVersionEx(&versionInfo)) - return false; - return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT); -} -#endif - - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - if (dwReason == DLL_PROCESS_ATTACH) - { - g_hInstance = hInstance; - #ifndef _UNICODE - g_IsNT = IsItWindowsNT(); - #endif - #ifdef _WIN32 - SetLargePageSize(); - #endif - } - return TRUE; -} - - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != NArchive::N7z::CLSID_CFormat7z) - return CLASS_E_CLASSNOTAVAILABLE; - if (*interfaceID == IID_IInArchive) - { - CMyComPtr inArchive = new NArchive::N7z::CHandler; - *outObject = inArchive.Detach(); - } - #ifndef EXTRACT_ONLY - else if (*interfaceID == IID_IOutArchive) - { - CMyComPtr outArchive = new NArchive::N7z::CHandler; - *outObject = outArchive.Detach(); - } - #endif - else - return E_NOINTERFACE; - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"7z"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&NArchive::N7z::CLSID_CFormat7z, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"7z"; - break; - case NArchive::kUpdate: - propVariant = true; - break; - case NArchive::kKeepName: - propVariant = false; - break; - case NArchive::kStartSignature: - { - if ((value->bstrVal = ::SysAllocStringByteLen((const char *)NArchive::N7z::kSignature, - NArchive::N7z::kSignatureSize)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - } - propVariant.Detach(value); - return S_OK; -} diff --git a/7zip/Archive/7z/StdAfx.cpp b/7zip/Archive/7z/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Archive/7z/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Archive/7z/StdAfx.h b/7zip/Archive/7z/StdAfx.h deleted file mode 100755 index 2e4be10b..00000000 --- a/7zip/Archive/7z/StdAfx.h +++ /dev/null @@ -1,9 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" -#include "../../../Common/NewHandler.h" - -#endif diff --git a/7zip/Archive/7z/makefile b/7zip/Archive/7z/makefile deleted file mode 100755 index 06bf2f37..00000000 --- a/7zip/Archive/7z/makefile +++ /dev/null @@ -1,89 +0,0 @@ -PROG = 7z.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -DCOMPRESS_MT -LIBS = $(LIBS) oleaut32.lib user32.lib - -7Z_OBJS = \ - $O\7zCompressionMode.obj \ - $O\7zDecode.obj \ - $O\7zEncode.obj \ - $O\7zExtract.obj \ - $O\7zFolderInStream.obj \ - $O\7zFolderOutStream.obj \ - $O\7zHandler.obj \ - $O\7zHandlerOut.obj \ - $O\7zHeader.obj \ - $O\7zIn.obj \ - $O\7zMethodID.obj \ - $O\7zMethods.obj \ - $O\7zOut.obj \ - $O\7zProperties.obj \ - $O\7zSpecStream.obj \ - $O\7zUpdate.obj \ - $O\DllExports.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\CRC.obj \ - $O\IntToString.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\StringToInt.obj \ - $O\Vector.obj \ - -WIN_OBJS = \ - $O\DLL.obj \ - $O\FileDir.obj \ - $O\FileFind.obj \ - $O\FileIO.obj \ - $O\PropVariant.obj \ - $O\Synchronization.obj - -7ZIP_COMMON_OBJS = \ - $O\InOutTempBuffer.obj \ - $O\LimitedStreams.obj \ - $O\LockedStream.obj \ - $O\OutBuffer.obj \ - $O\ProgressUtils.obj \ - $O\StreamBinder.obj \ - $O\StreamObjects.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\CodecsPath.obj \ - $O\CoderLoader.obj \ - $O\CoderMixer2.obj \ - $O\CoderMixer2MT.obj \ - $O\CrossThreadProgress.obj \ - $O\FilterCoder.obj \ - $O\InStreamWithCRC.obj \ - $O\ItemNameUtils.obj \ - $O\MultiStream.obj \ - $O\OutStreamWithCRC.obj \ - $O\ParseProperties.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(7Z_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $O\CopyCoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(7Z_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) diff --git a/7zip/Archive/7z/resource.rc b/7zip/Archive/7z/resource.rc deleted file mode 100755 index 8868173c..00000000 --- a/7zip/Archive/7z/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("7z Plugin", "7z") - -101 ICON "7z.ico" diff --git a/7zip/Archive/7z_C/7zAlloc.c b/7zip/Archive/7z_C/7zAlloc.c deleted file mode 100755 index 21bb30c7..00000000 --- a/7zip/Archive/7z_C/7zAlloc.c +++ /dev/null @@ -1,70 +0,0 @@ -/* 7zAlloc.c */ - -#include -#include "7zAlloc.h" - -/* #define _SZ_ALLOC_DEBUG */ -/* use _SZ_ALLOC_DEBUG to debug alloc/free operations */ - -#ifdef _SZ_ALLOC_DEBUG - -#ifdef _WIN32 -#include -#endif -#include -int g_allocCount = 0; -int g_allocCountTemp = 0; -#endif - -void *SzAlloc(size_t size) -{ - if (size == 0) - return 0; - #ifdef _SZ_ALLOC_DEBUG - fprintf(stderr, "\nAlloc %10d bytes; count = %10d", size, g_allocCount); - g_allocCount++; - #endif - return malloc(size); -} - -void SzFree(void *address) -{ - #ifdef _SZ_ALLOC_DEBUG - if (address != 0) - { - g_allocCount--; - fprintf(stderr, "\nFree; count = %10d", g_allocCount); - } - #endif - free(address); -} - -void *SzAllocTemp(size_t size) -{ - if (size == 0) - return 0; - #ifdef _SZ_ALLOC_DEBUG - fprintf(stderr, "\nAlloc_temp %10d bytes; count = %10d", size, g_allocCountTemp); - g_allocCountTemp++; - #ifdef _WIN32 - return HeapAlloc(GetProcessHeap(), 0, size); - #endif - #endif - return malloc(size); -} - -void SzFreeTemp(void *address) -{ - #ifdef _SZ_ALLOC_DEBUG - if (address != 0) - { - g_allocCountTemp--; - fprintf(stderr, "\nFree_temp; count = %10d", g_allocCountTemp); - } - #ifdef _WIN32 - HeapFree(GetProcessHeap(), 0, address); - return; - #endif - #endif - free(address); -} diff --git a/7zip/Archive/7z_C/7zAlloc.h b/7zip/Archive/7z_C/7zAlloc.h deleted file mode 100755 index 4ca4170c..00000000 --- a/7zip/Archive/7z_C/7zAlloc.h +++ /dev/null @@ -1,20 +0,0 @@ -/* 7zAlloc.h */ - -#ifndef __7Z_ALLOC_H -#define __7Z_ALLOC_H - -#include - -typedef struct _ISzAlloc -{ - void *(*Alloc)(size_t size); - void (*Free)(void *address); /* address can be 0 */ -} ISzAlloc; - -void *SzAlloc(size_t size); -void SzFree(void *address); - -void *SzAllocTemp(size_t size); -void SzFreeTemp(void *address); - -#endif diff --git a/7zip/Archive/7z_C/7zBuffer.c b/7zip/Archive/7z_C/7zBuffer.c deleted file mode 100755 index 3c4b71e8..00000000 --- a/7zip/Archive/7z_C/7zBuffer.c +++ /dev/null @@ -1,29 +0,0 @@ -/* 7zBuffer.c */ - -#include "7zBuffer.h" -#include "7zAlloc.h" - -void SzByteBufferInit(CSzByteBuffer *buffer) -{ - buffer->Capacity = 0; - buffer->Items = 0; -} - -int SzByteBufferCreate(CSzByteBuffer *buffer, size_t newCapacity, void * (*allocFunc)(size_t size)) -{ - buffer->Capacity = newCapacity; - if (newCapacity == 0) - { - buffer->Items = 0; - return 1; - } - buffer->Items = (Byte *)allocFunc(newCapacity); - return (buffer->Items != 0); -} - -void SzByteBufferFree(CSzByteBuffer *buffer, void (*freeFunc)(void *)) -{ - freeFunc(buffer->Items); - buffer->Items = 0; - buffer->Capacity = 0; -} diff --git a/7zip/Archive/7z_C/7zBuffer.h b/7zip/Archive/7z_C/7zBuffer.h deleted file mode 100755 index 17e59060..00000000 --- a/7zip/Archive/7z_C/7zBuffer.h +++ /dev/null @@ -1,19 +0,0 @@ -/* 7zBuffer.h */ - -#ifndef __7Z_BUFFER_H -#define __7Z_BUFFER_H - -#include -#include "7zTypes.h" - -typedef struct _CSzByteBuffer -{ - size_t Capacity; - Byte *Items; -}CSzByteBuffer; - -void SzByteBufferInit(CSzByteBuffer *buffer); -int SzByteBufferCreate(CSzByteBuffer *buffer, size_t newCapacity, void * (*allocFunc)(size_t size)); -void SzByteBufferFree(CSzByteBuffer *buffer, void (*freeFunc)(void *)); - -#endif diff --git a/7zip/Archive/7z_C/7zCrc.c b/7zip/Archive/7z_C/7zCrc.c deleted file mode 100755 index 97738404..00000000 --- a/7zip/Archive/7z_C/7zCrc.c +++ /dev/null @@ -1,76 +0,0 @@ -/* 7zCrc.c */ - -#include "7zCrc.h" - -#define kCrcPoly 0xEDB88320 - -UInt32 g_CrcTable[256]; - -void InitCrcTable() -{ - UInt32 i; - for (i = 0; i < 256; i++) - { - UInt32 r = i; - int j; - for (j = 0; j < 8; j++) - if (r & 1) - r = (r >> 1) ^ kCrcPoly; - else - r >>= 1; - g_CrcTable[i] = r; - } -} - -void CrcInit(UInt32 *crc) { *crc = 0xFFFFFFFF; } -UInt32 CrcGetDigest(UInt32 *crc) { return *crc ^ 0xFFFFFFFF; } - -void CrcUpdateByte(UInt32 *crc, Byte b) -{ - *crc = g_CrcTable[((Byte)(*crc)) ^ b] ^ (*crc >> 8); -} - -void CrcUpdateUInt16(UInt32 *crc, UInt16 v) -{ - CrcUpdateByte(crc, (Byte)v); - CrcUpdateByte(crc, (Byte)(v >> 8)); -} - -void CrcUpdateUInt32(UInt32 *crc, UInt32 v) -{ - int i; - for (i = 0; i < 4; i++) - CrcUpdateByte(crc, (Byte)(v >> (8 * i))); -} - -void CrcUpdateUInt64(UInt32 *crc, UInt64 v) -{ - int i; - for (i = 0; i < 8; i++) - { - CrcUpdateByte(crc, (Byte)(v)); - v >>= 8; - } -} - -void CrcUpdate(UInt32 *crc, const void *data, size_t size) -{ - UInt32 v = *crc; - const Byte *p = (const Byte *)data; - for (; size > 0 ; size--, p++) - v = g_CrcTable[((Byte)(v)) ^ *p] ^ (v >> 8); - *crc = v; -} - -UInt32 CrcCalculateDigest(const void *data, size_t size) -{ - UInt32 crc; - CrcInit(&crc); - CrcUpdate(&crc, data, size); - return CrcGetDigest(&crc); -} - -int CrcVerifyDigest(UInt32 digest, const void *data, size_t size) -{ - return (CrcCalculateDigest(data, size) == digest); -} diff --git a/7zip/Archive/7z_C/7zCrc.h b/7zip/Archive/7z_C/7zCrc.h deleted file mode 100755 index adcc563a..00000000 --- a/7zip/Archive/7z_C/7zCrc.h +++ /dev/null @@ -1,24 +0,0 @@ -/* 7zCrc.h */ - -#ifndef __7Z_CRC_H -#define __7Z_CRC_H - -#include - -#include "7zTypes.h" - -extern UInt32 g_CrcTable[256]; -void InitCrcTable(); - -void CrcInit(UInt32 *crc); -UInt32 CrcGetDigest(UInt32 *crc); -void CrcUpdateByte(UInt32 *crc, Byte v); -void CrcUpdateUInt16(UInt32 *crc, UInt16 v); -void CrcUpdateUInt32(UInt32 *crc, UInt32 v); -void CrcUpdateUInt64(UInt32 *crc, UInt64 v); -void CrcUpdate(UInt32 *crc, const void *data, size_t size); - -UInt32 CrcCalculateDigest(const void *data, size_t size); -int CrcVerifyDigest(UInt32 digest, const void *data, size_t size); - -#endif diff --git a/7zip/Archive/7z_C/7zDecode.c b/7zip/Archive/7z_C/7zDecode.c deleted file mode 100755 index b42ff927..00000000 --- a/7zip/Archive/7z_C/7zDecode.c +++ /dev/null @@ -1,150 +0,0 @@ -/* 7zDecode.c */ - -#include "7zDecode.h" -#ifdef _SZ_ONE_DIRECTORY -#include "LzmaDecode.h" -#else -#include "../../Compress/LZMA_C/LzmaDecode.h" -#endif - -CMethodID k_Copy = { { 0x0 }, 1 }; -CMethodID k_LZMA = { { 0x3, 0x1, 0x1 }, 3 }; - -#ifdef _LZMA_IN_CB - -typedef struct _CLzmaInCallbackImp -{ - ILzmaInCallback InCallback; - ISzInStream *InStream; - size_t Size; -} CLzmaInCallbackImp; - -int LzmaReadImp(void *object, const unsigned char **buffer, SizeT *size) -{ - CLzmaInCallbackImp *cb = (CLzmaInCallbackImp *)object; - size_t processedSize; - SZ_RESULT res; - *size = 0; - res = cb->InStream->Read((void *)cb->InStream, (void **)buffer, cb->Size, &processedSize); - *size = (SizeT)processedSize; - if (processedSize > cb->Size) - return (int)SZE_FAIL; - cb->Size -= processedSize; - if (res == SZ_OK) - return 0; - return (int)res; -} - -#endif - -SZ_RESULT SzDecode(const CFileSize *packSizes, const CFolder *folder, - #ifdef _LZMA_IN_CB - ISzInStream *inStream, - #else - const Byte *inBuffer, - #endif - Byte *outBuffer, size_t outSize, - size_t *outSizeProcessed, ISzAlloc *allocMain) -{ - UInt32 si; - size_t inSize = 0; - CCoderInfo *coder; - if (folder->NumPackStreams != 1) - return SZE_NOTIMPL; - if (folder->NumCoders != 1) - return SZE_NOTIMPL; - coder = folder->Coders; - *outSizeProcessed = 0; - - for (si = 0; si < folder->NumPackStreams; si++) - inSize += (size_t)packSizes[si]; - - if (AreMethodsEqual(&coder->MethodID, &k_Copy)) - { - size_t i; - if (inSize != outSize) - return SZE_DATA_ERROR; - #ifdef _LZMA_IN_CB - for (i = 0; i < inSize;) - { - size_t j; - Byte *inBuffer; - size_t bufferSize; - RINOK(inStream->Read((void *)inStream, (void **)&inBuffer, inSize - i, &bufferSize)); - if (bufferSize == 0) - return SZE_DATA_ERROR; - if (bufferSize > inSize - i) - return SZE_FAIL; - *outSizeProcessed += bufferSize; - for (j = 0; j < bufferSize && i < inSize; j++, i++) - outBuffer[i] = inBuffer[j]; - } - #else - for (i = 0; i < inSize; i++) - outBuffer[i] = inBuffer[i]; - *outSizeProcessed = inSize; - #endif - return SZ_OK; - } - - if (AreMethodsEqual(&coder->MethodID, &k_LZMA)) - { - #ifdef _LZMA_IN_CB - CLzmaInCallbackImp lzmaCallback; - #else - SizeT inProcessed; - #endif - - CLzmaDecoderState state; /* it's about 24-80 bytes structure, if int is 32-bit */ - int result; - SizeT outSizeProcessedLoc; - - #ifdef _LZMA_IN_CB - lzmaCallback.Size = inSize; - lzmaCallback.InStream = inStream; - lzmaCallback.InCallback.Read = LzmaReadImp; - #endif - - if (LzmaDecodeProperties(&state.Properties, coder->Properties.Items, - coder->Properties.Capacity) != LZMA_RESULT_OK) - return SZE_FAIL; - - state.Probs = (CProb *)allocMain->Alloc(LzmaGetNumProbs(&state.Properties) * sizeof(CProb)); - if (state.Probs == 0) - return SZE_OUTOFMEMORY; - - #ifdef _LZMA_OUT_READ - if (state.Properties.DictionarySize == 0) - state.Dictionary = 0; - else - { - state.Dictionary = (unsigned char *)allocMain->Alloc(state.Properties.DictionarySize); - if (state.Dictionary == 0) - { - allocMain->Free(state.Probs); - return SZE_OUTOFMEMORY; - } - } - LzmaDecoderInit(&state); - #endif - - result = LzmaDecode(&state, - #ifdef _LZMA_IN_CB - &lzmaCallback.InCallback, - #else - inBuffer, (SizeT)inSize, &inProcessed, - #endif - outBuffer, (SizeT)outSize, &outSizeProcessedLoc); - *outSizeProcessed = (size_t)outSizeProcessedLoc; - allocMain->Free(state.Probs); - #ifdef _LZMA_OUT_READ - allocMain->Free(state.Dictionary); - #endif - if (result == LZMA_RESULT_DATA_ERROR) - return SZE_DATA_ERROR; - if (result != LZMA_RESULT_OK) - return SZE_FAIL; - return SZ_OK; - } - return SZE_NOTIMPL; -} diff --git a/7zip/Archive/7z_C/7zDecode.h b/7zip/Archive/7z_C/7zDecode.h deleted file mode 100755 index 74bb180f..00000000 --- a/7zip/Archive/7z_C/7zDecode.h +++ /dev/null @@ -1,21 +0,0 @@ -/* 7zDecode.h */ - -#ifndef __7Z_DECODE_H -#define __7Z_DECODE_H - -#include "7zItem.h" -#include "7zAlloc.h" -#ifdef _LZMA_IN_CB -#include "7zIn.h" -#endif - -SZ_RESULT SzDecode(const CFileSize *packSizes, const CFolder *folder, - #ifdef _LZMA_IN_CB - ISzInStream *stream, - #else - const Byte *inBuffer, - #endif - Byte *outBuffer, size_t outSize, - size_t *outSizeProcessed, ISzAlloc *allocMain); - -#endif diff --git a/7zip/Archive/7z_C/7zExtract.c b/7zip/Archive/7z_C/7zExtract.c deleted file mode 100755 index aa75659b..00000000 --- a/7zip/Archive/7z_C/7zExtract.c +++ /dev/null @@ -1,118 +0,0 @@ -/* 7zExtract.c */ - -#include "7zExtract.h" -#include "7zDecode.h" -#include "7zCrc.h" - -SZ_RESULT SzExtract( - ISzInStream *inStream, - CArchiveDatabaseEx *db, - UInt32 fileIndex, - UInt32 *blockIndex, - Byte **outBuffer, - size_t *outBufferSize, - size_t *offset, - size_t *outSizeProcessed, - ISzAlloc *allocMain, - ISzAlloc *allocTemp) -{ - UInt32 folderIndex = db->FileIndexToFolderIndexMap[fileIndex]; - SZ_RESULT res = SZ_OK; - *offset = 0; - *outSizeProcessed = 0; - if (folderIndex == (UInt32)-1) - { - allocMain->Free(*outBuffer); - *blockIndex = folderIndex; - *outBuffer = 0; - *outBufferSize = 0; - return SZ_OK; - } - - if (*outBuffer == 0 || *blockIndex != folderIndex) - { - CFolder *folder = db->Database.Folders + folderIndex; - CFileSize unPackSize = SzFolderGetUnPackSize(folder); - #ifndef _LZMA_IN_CB - CFileSize packSize = SzArDbGetFolderFullPackSize(db, folderIndex); - Byte *inBuffer = 0; - size_t processedSize; - #endif - if (unPackSize != (size_t)unPackSize) - return SZE_OUTOFMEMORY; - *blockIndex = folderIndex; - allocMain->Free(*outBuffer); - *outBuffer = 0; - - RINOK(inStream->Seek(inStream, SzArDbGetFolderStreamPos(db, folderIndex, 0))); - - #ifndef _LZMA_IN_CB - if (packSize != 0) - { - inBuffer = (Byte *)allocTemp->Alloc((size_t)packSize); - if (inBuffer == 0) - return SZE_OUTOFMEMORY; - } - res = inStream->Read(inStream, inBuffer, (size_t)packSize, &processedSize); - if (res == SZ_OK && processedSize != (size_t)packSize) - res = SZE_FAIL; - #endif - if (res == SZ_OK) - { - *outBufferSize = (size_t)unPackSize; - if (unPackSize != 0) - { - *outBuffer = (Byte *)allocMain->Alloc((size_t)unPackSize); - if (*outBuffer == 0) - res = SZE_OUTOFMEMORY; - } - if (res == SZ_OK) - { - size_t outRealSize; - res = SzDecode(db->Database.PackSizes + - db->FolderStartPackStreamIndex[folderIndex], folder, - #ifdef _LZMA_IN_CB - inStream, - #else - inBuffer, - #endif - *outBuffer, (size_t)unPackSize, &outRealSize, allocTemp); - if (res == SZ_OK) - { - if (outRealSize == (size_t)unPackSize) - { - if (folder->UnPackCRCDefined) - { - if (!CrcVerifyDigest(folder->UnPackCRC, *outBuffer, (size_t)unPackSize)) - res = SZE_FAIL; - } - } - else - res = SZE_FAIL; - } - } - } - #ifndef _LZMA_IN_CB - allocTemp->Free(inBuffer); - #endif - } - if (res == SZ_OK) - { - UInt32 i; - CFileItem *fileItem = db->Database.Files + fileIndex; - *offset = 0; - for(i = db->FolderStartFileIndex[folderIndex]; i < fileIndex; i++) - *offset += (UInt32)db->Database.Files[i].Size; - *outSizeProcessed = (size_t)fileItem->Size; - if (*offset + *outSizeProcessed > *outBufferSize) - return SZE_FAIL; - { - if (fileItem->IsFileCRCDefined) - { - if (!CrcVerifyDigest(fileItem->FileCRC, *outBuffer + *offset, *outSizeProcessed)) - res = SZE_FAIL; - } - } - } - return res; -} diff --git a/7zip/Archive/7z_C/7zExtract.h b/7zip/Archive/7z_C/7zExtract.h deleted file mode 100755 index e9a4fb4e..00000000 --- a/7zip/Archive/7z_C/7zExtract.h +++ /dev/null @@ -1,40 +0,0 @@ -/* 7zExtract.h */ - -#ifndef __7Z_EXTRACT_H -#define __7Z_EXTRACT_H - -#include "7zIn.h" - -/* - SzExtract extracts file from archive - - *outBuffer must be 0 before first call for each new archive. - - Extracting cache: - If you need to decompress more than one file, you can send - these values from previous call: - *blockIndex, - *outBuffer, - *outBufferSize - You can consider "*outBuffer" as cache of solid block. If your archive is solid, - it will increase decompression speed. - - If you use external function, you can declare these 3 cache variables - (blockIndex, outBuffer, outBufferSize) as static in that external function. - - Free *outBuffer and set *outBuffer to 0, if you want to flush cache. -*/ - -SZ_RESULT SzExtract( - ISzInStream *inStream, - CArchiveDatabaseEx *db, - UInt32 fileIndex, /* index of file */ - UInt32 *blockIndex, /* index of solid block */ - Byte **outBuffer, /* pointer to pointer to output buffer (allocated with allocMain) */ - size_t *outBufferSize, /* buffer size for output buffer */ - size_t *offset, /* offset of stream for required file in *outBuffer */ - size_t *outSizeProcessed, /* size of file in *outBuffer */ - ISzAlloc *allocMain, - ISzAlloc *allocTemp); - -#endif diff --git a/7zip/Archive/7z_C/7zHeader.c b/7zip/Archive/7z_C/7zHeader.c deleted file mode 100755 index 3be4bc27..00000000 --- a/7zip/Archive/7z_C/7zHeader.c +++ /dev/null @@ -1,5 +0,0 @@ -/* 7zHeader.c */ - -#include "7zHeader.h" - -Byte k7zSignature[k7zSignatureSize] = {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C}; diff --git a/7zip/Archive/7z_C/7zHeader.h b/7zip/Archive/7z_C/7zHeader.h deleted file mode 100755 index 0356aaa6..00000000 --- a/7zip/Archive/7z_C/7zHeader.h +++ /dev/null @@ -1,55 +0,0 @@ -/* 7zHeader.h */ - -#ifndef __7Z_HEADER_H -#define __7Z_HEADER_H - -#include "7zTypes.h" - -#define k7zSignatureSize 6 -extern Byte k7zSignature[k7zSignatureSize]; - -#define k7zMajorVersion 0 - -#define k7zStartHeaderSize 0x20 - -enum EIdEnum -{ - k7zIdEnd, - - k7zIdHeader, - - k7zIdArchiveProperties, - - k7zIdAdditionalStreamsInfo, - k7zIdMainStreamsInfo, - k7zIdFilesInfo, - - k7zIdPackInfo, - k7zIdUnPackInfo, - k7zIdSubStreamsInfo, - - k7zIdSize, - k7zIdCRC, - - k7zIdFolder, - - k7zIdCodersUnPackSize, - k7zIdNumUnPackStream, - - k7zIdEmptyStream, - k7zIdEmptyFile, - k7zIdAnti, - - k7zIdName, - k7zIdCreationTime, - k7zIdLastAccessTime, - k7zIdLastWriteTime, - k7zIdWinAttributes, - k7zIdComment, - - k7zIdEncodedHeader, - - k7zIdStartPos -}; - -#endif diff --git a/7zip/Archive/7z_C/7zIn.c b/7zip/Archive/7z_C/7zIn.c deleted file mode 100755 index 0b9d9bd7..00000000 --- a/7zip/Archive/7z_C/7zIn.c +++ /dev/null @@ -1,1282 +0,0 @@ -/* 7zIn.c */ - -#include "7zIn.h" -#include "7zCrc.h" -#include "7zDecode.h" - -#define RINOM(x) { if((x) == 0) return SZE_OUTOFMEMORY; } - -void SzArDbExInit(CArchiveDatabaseEx *db) -{ - SzArchiveDatabaseInit(&db->Database); - db->FolderStartPackStreamIndex = 0; - db->PackStreamStartPositions = 0; - db->FolderStartFileIndex = 0; - db->FileIndexToFolderIndexMap = 0; -} - -void SzArDbExFree(CArchiveDatabaseEx *db, void (*freeFunc)(void *)) -{ - freeFunc(db->FolderStartPackStreamIndex); - freeFunc(db->PackStreamStartPositions); - freeFunc(db->FolderStartFileIndex); - freeFunc(db->FileIndexToFolderIndexMap); - SzArchiveDatabaseFree(&db->Database, freeFunc); - SzArDbExInit(db); -} - -/* -CFileSize GetFolderPackStreamSize(int folderIndex, int streamIndex) const -{ - return PackSizes[FolderStartPackStreamIndex[folderIndex] + streamIndex]; -} - -CFileSize GetFilePackSize(int fileIndex) const -{ - int folderIndex = FileIndexToFolderIndexMap[fileIndex]; - if (folderIndex >= 0) - { - const CFolder &folderInfo = Folders[folderIndex]; - if (FolderStartFileIndex[folderIndex] == fileIndex) - return GetFolderFullPackSize(folderIndex); - } - return 0; -} -*/ - -#define MY_ALLOC(T, p, size, allocFunc) { if ((size) == 0) p = 0; else \ - if ((p = (T *)allocFunc((size) * sizeof(T))) == 0) return SZE_OUTOFMEMORY; } - -SZ_RESULT SzArDbExFill(CArchiveDatabaseEx *db, void * (*allocFunc)(size_t size)) -{ - UInt32 startPos = 0; - CFileSize startPosSize = 0; - UInt32 i; - UInt32 folderIndex = 0; - UInt32 indexInFolder = 0; - MY_ALLOC(UInt32, db->FolderStartPackStreamIndex, db->Database.NumFolders, allocFunc); - for(i = 0; i < db->Database.NumFolders; i++) - { - db->FolderStartPackStreamIndex[i] = startPos; - startPos += db->Database.Folders[i].NumPackStreams; - } - - MY_ALLOC(CFileSize, db->PackStreamStartPositions, db->Database.NumPackStreams, allocFunc); - - for(i = 0; i < db->Database.NumPackStreams; i++) - { - db->PackStreamStartPositions[i] = startPosSize; - startPosSize += db->Database.PackSizes[i]; - } - - MY_ALLOC(UInt32, db->FolderStartFileIndex, db->Database.NumFolders, allocFunc); - MY_ALLOC(UInt32, db->FileIndexToFolderIndexMap, db->Database.NumFiles, allocFunc); - - for (i = 0; i < db->Database.NumFiles; i++) - { - CFileItem *file = db->Database.Files + i; - int emptyStream = !file->HasStream; - if (emptyStream && indexInFolder == 0) - { - db->FileIndexToFolderIndexMap[i] = (UInt32)-1; - continue; - } - if (indexInFolder == 0) - { - /* - v3.13 incorrectly worked with empty folders - v4.07: Loop for skipping empty folders - */ - for (;;) - { - if (folderIndex >= db->Database.NumFolders) - return SZE_ARCHIVE_ERROR; - db->FolderStartFileIndex[folderIndex] = i; - if (db->Database.Folders[folderIndex].NumUnPackStreams != 0) - break; - folderIndex++; - } - } - db->FileIndexToFolderIndexMap[i] = folderIndex; - if (emptyStream) - continue; - indexInFolder++; - if (indexInFolder >= db->Database.Folders[folderIndex].NumUnPackStreams) - { - folderIndex++; - indexInFolder = 0; - } - } - return SZ_OK; -} - - -CFileSize SzArDbGetFolderStreamPos(CArchiveDatabaseEx *db, UInt32 folderIndex, UInt32 indexInFolder) -{ - return db->ArchiveInfo.DataStartPosition + - db->PackStreamStartPositions[db->FolderStartPackStreamIndex[folderIndex] + indexInFolder]; -} - -CFileSize SzArDbGetFolderFullPackSize(CArchiveDatabaseEx *db, UInt32 folderIndex) -{ - UInt32 packStreamIndex = db->FolderStartPackStreamIndex[folderIndex]; - CFolder *folder = db->Database.Folders + folderIndex; - CFileSize size = 0; - UInt32 i; - for (i = 0; i < folder->NumPackStreams; i++) - size += db->Database.PackSizes[packStreamIndex + i]; - return size; -} - - -/* -SZ_RESULT SzReadTime(const CObjectVector &dataVector, - CObjectVector &files, UInt64 type) -{ - CBoolVector boolVector; - RINOK(ReadBoolVector2(files.Size(), boolVector)) - - CStreamSwitch streamSwitch; - RINOK(streamSwitch.Set(this, &dataVector)); - - for(int i = 0; i < files.Size(); i++) - { - CFileItem &file = files[i]; - CArchiveFileTime fileTime; - bool defined = boolVector[i]; - if (defined) - { - UInt32 low, high; - RINOK(SzReadUInt32(low)); - RINOK(SzReadUInt32(high)); - fileTime.dwLowDateTime = low; - fileTime.dwHighDateTime = high; - } - switch(type) - { - case k7zIdCreationTime: - file.IsCreationTimeDefined = defined; - if (defined) - file.CreationTime = fileTime; - break; - case k7zIdLastWriteTime: - file.IsLastWriteTimeDefined = defined; - if (defined) - file.LastWriteTime = fileTime; - break; - case k7zIdLastAccessTime: - file.IsLastAccessTimeDefined = defined; - if (defined) - file.LastAccessTime = fileTime; - break; - } - } - return SZ_OK; -} -*/ - -SZ_RESULT SafeReadDirect(ISzInStream *inStream, Byte *data, size_t size) -{ - #ifdef _LZMA_IN_CB - while (size > 0) - { - Byte *inBuffer; - size_t processedSize; - RINOK(inStream->Read(inStream, (void **)&inBuffer, size, &processedSize)); - if (processedSize == 0 || processedSize > size) - return SZE_FAIL; - size -= processedSize; - do - { - *data++ = *inBuffer++; - } - while (--processedSize != 0); - } - #else - size_t processedSize; - RINOK(inStream->Read(inStream, data, size, &processedSize)); - if (processedSize != size) - return SZE_FAIL; - #endif - return SZ_OK; -} - -SZ_RESULT SafeReadDirectByte(ISzInStream *inStream, Byte *data) -{ - return SafeReadDirect(inStream, data, 1); -} - -SZ_RESULT SafeReadDirectUInt32(ISzInStream *inStream, UInt32 *value) -{ - int i; - *value = 0; - for (i = 0; i < 4; i++) - { - Byte b; - RINOK(SafeReadDirectByte(inStream, &b)); - *value |= ((UInt32)b << (8 * i)); - } - return SZ_OK; -} - -SZ_RESULT SafeReadDirectUInt64(ISzInStream *inStream, UInt64 *value) -{ - int i; - *value = 0; - for (i = 0; i < 8; i++) - { - Byte b; - RINOK(SafeReadDirectByte(inStream, &b)); - *value |= ((UInt64)b << (8 * i)); - } - return SZ_OK; -} - -int TestSignatureCandidate(Byte *testBytes) -{ - size_t i; - for (i = 0; i < k7zSignatureSize; i++) - if (testBytes[i] != k7zSignature[i]) - return 0; - return 1; -} - -typedef struct _CSzState -{ - Byte *Data; - size_t Size; -}CSzData; - -SZ_RESULT SzReadByte(CSzData *sd, Byte *b) -{ - if (sd->Size == 0) - return SZE_ARCHIVE_ERROR; - sd->Size--; - *b = *sd->Data++; - return SZ_OK; -} - -SZ_RESULT SzReadBytes(CSzData *sd, Byte *data, size_t size) -{ - size_t i; - for (i = 0; i < size; i++) - { - RINOK(SzReadByte(sd, data + i)); - } - return SZ_OK; -} - -SZ_RESULT SzReadUInt32(CSzData *sd, UInt32 *value) -{ - int i; - *value = 0; - for (i = 0; i < 4; i++) - { - Byte b; - RINOK(SzReadByte(sd, &b)); - *value |= ((UInt32)(b) << (8 * i)); - } - return SZ_OK; -} - -SZ_RESULT SzReadNumber(CSzData *sd, UInt64 *value) -{ - Byte firstByte; - Byte mask = 0x80; - int i; - RINOK(SzReadByte(sd, &firstByte)); - *value = 0; - for (i = 0; i < 8; i++) - { - Byte b; - if ((firstByte & mask) == 0) - { - UInt64 highPart = firstByte & (mask - 1); - *value += (highPart << (8 * i)); - return SZ_OK; - } - RINOK(SzReadByte(sd, &b)); - *value |= ((UInt64)b << (8 * i)); - mask >>= 1; - } - return SZ_OK; -} - -SZ_RESULT SzReadSize(CSzData *sd, CFileSize *value) -{ - UInt64 value64; - RINOK(SzReadNumber(sd, &value64)); - *value = (CFileSize)value64; - return SZ_OK; -} - -SZ_RESULT SzReadNumber32(CSzData *sd, UInt32 *value) -{ - UInt64 value64; - RINOK(SzReadNumber(sd, &value64)); - if (value64 >= 0x80000000) - return SZE_NOTIMPL; - if (value64 >= ((UInt64)(1) << ((sizeof(size_t) - 1) * 8 + 2))) - return SZE_NOTIMPL; - *value = (UInt32)value64; - return SZ_OK; -} - -SZ_RESULT SzReadID(CSzData *sd, UInt64 *value) -{ - return SzReadNumber(sd, value); -} - -SZ_RESULT SzSkeepDataSize(CSzData *sd, UInt64 size) -{ - if (size > sd->Size) - return SZE_ARCHIVE_ERROR; - sd->Size -= (size_t)size; - sd->Data += (size_t)size; - return SZ_OK; -} - -SZ_RESULT SzSkeepData(CSzData *sd) -{ - UInt64 size; - RINOK(SzReadNumber(sd, &size)); - return SzSkeepDataSize(sd, size); -} - -SZ_RESULT SzReadArchiveProperties(CSzData *sd) -{ - for (;;) - { - UInt64 type; - RINOK(SzReadID(sd, &type)); - if (type == k7zIdEnd) - break; - SzSkeepData(sd); - } - return SZ_OK; -} - -SZ_RESULT SzWaitAttribute(CSzData *sd, UInt64 attribute) -{ - for (;;) - { - UInt64 type; - RINOK(SzReadID(sd, &type)); - if (type == attribute) - return SZ_OK; - if (type == k7zIdEnd) - return SZE_ARCHIVE_ERROR; - RINOK(SzSkeepData(sd)); - } -} - -SZ_RESULT SzReadBoolVector(CSzData *sd, size_t numItems, Byte **v, void * (*allocFunc)(size_t size)) -{ - Byte b = 0; - Byte mask = 0; - size_t i; - MY_ALLOC(Byte, *v, numItems, allocFunc); - for (i = 0; i < numItems; i++) - { - if (mask == 0) - { - RINOK(SzReadByte(sd, &b)); - mask = 0x80; - } - (*v)[i] = (Byte)(((b & mask) != 0) ? 1 : 0); - mask >>= 1; - } - return SZ_OK; -} - -SZ_RESULT SzReadBoolVector2(CSzData *sd, size_t numItems, Byte **v, void * (*allocFunc)(size_t size)) -{ - Byte allAreDefined; - size_t i; - RINOK(SzReadByte(sd, &allAreDefined)); - if (allAreDefined == 0) - return SzReadBoolVector(sd, numItems, v, allocFunc); - MY_ALLOC(Byte, *v, numItems, allocFunc); - for(i = 0; i < numItems; i++) - (*v)[i] = 1; - return SZ_OK; -} - -SZ_RESULT SzReadHashDigests( - CSzData *sd, - size_t numItems, - Byte **digestsDefined, - UInt32 **digests, - void * (*allocFunc)(size_t size)) -{ - size_t i; - RINOK(SzReadBoolVector2(sd, numItems, digestsDefined, allocFunc)); - MY_ALLOC(UInt32, *digests, numItems, allocFunc); - for(i = 0; i < numItems; i++) - if ((*digestsDefined)[i]) - { - RINOK(SzReadUInt32(sd, (*digests) + i)); - } - return SZ_OK; -} - -SZ_RESULT SzReadPackInfo( - CSzData *sd, - CFileSize *dataOffset, - UInt32 *numPackStreams, - CFileSize **packSizes, - Byte **packCRCsDefined, - UInt32 **packCRCs, - void * (*allocFunc)(size_t size)) -{ - UInt32 i; - RINOK(SzReadSize(sd, dataOffset)); - RINOK(SzReadNumber32(sd, numPackStreams)); - - RINOK(SzWaitAttribute(sd, k7zIdSize)); - - MY_ALLOC(CFileSize, *packSizes, (size_t)*numPackStreams, allocFunc); - - for(i = 0; i < *numPackStreams; i++) - { - RINOK(SzReadSize(sd, (*packSizes) + i)); - } - - for (;;) - { - UInt64 type; - RINOK(SzReadID(sd, &type)); - if (type == k7zIdEnd) - break; - if (type == k7zIdCRC) - { - RINOK(SzReadHashDigests(sd, (size_t)*numPackStreams, packCRCsDefined, packCRCs, allocFunc)); - continue; - } - RINOK(SzSkeepData(sd)); - } - if (*packCRCsDefined == 0) - { - MY_ALLOC(Byte, *packCRCsDefined, (size_t)*numPackStreams, allocFunc); - MY_ALLOC(UInt32, *packCRCs, (size_t)*numPackStreams, allocFunc); - for(i = 0; i < *numPackStreams; i++) - { - (*packCRCsDefined)[i] = 0; - (*packCRCs)[i] = 0; - } - } - return SZ_OK; -} - -SZ_RESULT SzReadSwitch(CSzData *sd) -{ - Byte external; - RINOK(SzReadByte(sd, &external)); - return (external == 0) ? SZ_OK: SZE_ARCHIVE_ERROR; -} - -SZ_RESULT SzGetNextFolderItem(CSzData *sd, CFolder *folder, void * (*allocFunc)(size_t size)) -{ - UInt32 numCoders; - UInt32 numBindPairs; - UInt32 numPackedStreams; - UInt32 i; - UInt32 numInStreams = 0; - UInt32 numOutStreams = 0; - RINOK(SzReadNumber32(sd, &numCoders)); - folder->NumCoders = numCoders; - - MY_ALLOC(CCoderInfo, folder->Coders, (size_t)numCoders, allocFunc); - - for (i = 0; i < numCoders; i++) - SzCoderInfoInit(folder->Coders + i); - - for (i = 0; i < numCoders; i++) - { - Byte mainByte; - CCoderInfo *coder = folder->Coders + i; - { - RINOK(SzReadByte(sd, &mainByte)); - coder->MethodID.IDSize = (Byte)(mainByte & 0xF); - RINOK(SzReadBytes(sd, coder->MethodID.ID, coder->MethodID.IDSize)); - if ((mainByte & 0x10) != 0) - { - RINOK(SzReadNumber32(sd, &coder->NumInStreams)); - RINOK(SzReadNumber32(sd, &coder->NumOutStreams)); - } - else - { - coder->NumInStreams = 1; - coder->NumOutStreams = 1; - } - if ((mainByte & 0x20) != 0) - { - UInt64 propertiesSize = 0; - RINOK(SzReadNumber(sd, &propertiesSize)); - if (!SzByteBufferCreate(&coder->Properties, (size_t)propertiesSize, allocFunc)) - return SZE_OUTOFMEMORY; - RINOK(SzReadBytes(sd, coder->Properties.Items, (size_t)propertiesSize)); - } - } - while ((mainByte & 0x80) != 0) - { - RINOK(SzReadByte(sd, &mainByte)); - RINOK(SzSkeepDataSize(sd, (mainByte & 0xF))); - if ((mainByte & 0x10) != 0) - { - UInt32 n; - RINOK(SzReadNumber32(sd, &n)); - RINOK(SzReadNumber32(sd, &n)); - } - if ((mainByte & 0x20) != 0) - { - UInt64 propertiesSize = 0; - RINOK(SzReadNumber(sd, &propertiesSize)); - RINOK(SzSkeepDataSize(sd, propertiesSize)); - } - } - numInStreams += (UInt32)coder->NumInStreams; - numOutStreams += (UInt32)coder->NumOutStreams; - } - - numBindPairs = numOutStreams - 1; - folder->NumBindPairs = numBindPairs; - - - MY_ALLOC(CBindPair, folder->BindPairs, (size_t)numBindPairs, allocFunc); - - for (i = 0; i < numBindPairs; i++) - { - CBindPair *bindPair = folder->BindPairs + i;; - RINOK(SzReadNumber32(sd, &bindPair->InIndex)); - RINOK(SzReadNumber32(sd, &bindPair->OutIndex)); - } - - numPackedStreams = numInStreams - (UInt32)numBindPairs; - - folder->NumPackStreams = numPackedStreams; - MY_ALLOC(UInt32, folder->PackStreams, (size_t)numPackedStreams, allocFunc); - - if (numPackedStreams == 1) - { - UInt32 j; - UInt32 pi = 0; - for (j = 0; j < numInStreams; j++) - if (SzFolderFindBindPairForInStream(folder, j) < 0) - { - folder->PackStreams[pi++] = j; - break; - } - } - else - for(i = 0; i < numPackedStreams; i++) - { - RINOK(SzReadNumber32(sd, folder->PackStreams + i)); - } - return SZ_OK; -} - -SZ_RESULT SzReadUnPackInfo( - CSzData *sd, - UInt32 *numFolders, - CFolder **folders, /* for allocFunc */ - void * (*allocFunc)(size_t size), - ISzAlloc *allocTemp) -{ - UInt32 i; - RINOK(SzWaitAttribute(sd, k7zIdFolder)); - RINOK(SzReadNumber32(sd, numFolders)); - { - RINOK(SzReadSwitch(sd)); - - MY_ALLOC(CFolder, *folders, (size_t)*numFolders, allocFunc); - - for(i = 0; i < *numFolders; i++) - SzFolderInit((*folders) + i); - - for(i = 0; i < *numFolders; i++) - { - RINOK(SzGetNextFolderItem(sd, (*folders) + i, allocFunc)); - } - } - - RINOK(SzWaitAttribute(sd, k7zIdCodersUnPackSize)); - - for(i = 0; i < *numFolders; i++) - { - UInt32 j; - CFolder *folder = (*folders) + i; - UInt32 numOutStreams = SzFolderGetNumOutStreams(folder); - - MY_ALLOC(CFileSize, folder->UnPackSizes, (size_t)numOutStreams, allocFunc); - - for(j = 0; j < numOutStreams; j++) - { - RINOK(SzReadSize(sd, folder->UnPackSizes + j)); - } - } - - for (;;) - { - UInt64 type; - RINOK(SzReadID(sd, &type)); - if (type == k7zIdEnd) - return SZ_OK; - if (type == k7zIdCRC) - { - SZ_RESULT res; - Byte *crcsDefined = 0; - UInt32 *crcs = 0; - res = SzReadHashDigests(sd, *numFolders, &crcsDefined, &crcs, allocTemp->Alloc); - if (res == SZ_OK) - { - for(i = 0; i < *numFolders; i++) - { - CFolder *folder = (*folders) + i; - folder->UnPackCRCDefined = crcsDefined[i]; - folder->UnPackCRC = crcs[i]; - } - } - allocTemp->Free(crcs); - allocTemp->Free(crcsDefined); - RINOK(res); - continue; - } - RINOK(SzSkeepData(sd)); - } -} - -SZ_RESULT SzReadSubStreamsInfo( - CSzData *sd, - UInt32 numFolders, - CFolder *folders, - UInt32 *numUnPackStreams, - CFileSize **unPackSizes, - Byte **digestsDefined, - UInt32 **digests, - ISzAlloc *allocTemp) -{ - UInt64 type = 0; - UInt32 i; - UInt32 si = 0; - UInt32 numDigests = 0; - - for(i = 0; i < numFolders; i++) - folders[i].NumUnPackStreams = 1; - *numUnPackStreams = numFolders; - - for (;;) - { - RINOK(SzReadID(sd, &type)); - if (type == k7zIdNumUnPackStream) - { - *numUnPackStreams = 0; - for(i = 0; i < numFolders; i++) - { - UInt32 numStreams; - RINOK(SzReadNumber32(sd, &numStreams)); - folders[i].NumUnPackStreams = numStreams; - *numUnPackStreams += numStreams; - } - continue; - } - if (type == k7zIdCRC || type == k7zIdSize) - break; - if (type == k7zIdEnd) - break; - RINOK(SzSkeepData(sd)); - } - - if (*numUnPackStreams == 0) - { - *unPackSizes = 0; - *digestsDefined = 0; - *digests = 0; - } - else - { - *unPackSizes = (CFileSize *)allocTemp->Alloc((size_t)*numUnPackStreams * sizeof(CFileSize)); - RINOM(*unPackSizes); - *digestsDefined = (Byte *)allocTemp->Alloc((size_t)*numUnPackStreams * sizeof(Byte)); - RINOM(*digestsDefined); - *digests = (UInt32 *)allocTemp->Alloc((size_t)*numUnPackStreams * sizeof(UInt32)); - RINOM(*digests); - } - - for(i = 0; i < numFolders; i++) - { - /* - v3.13 incorrectly worked with empty folders - v4.07: we check that folder is empty - */ - CFileSize sum = 0; - UInt32 j; - UInt32 numSubstreams = folders[i].NumUnPackStreams; - if (numSubstreams == 0) - continue; - if (type == k7zIdSize) - for (j = 1; j < numSubstreams; j++) - { - CFileSize size; - RINOK(SzReadSize(sd, &size)); - (*unPackSizes)[si++] = size; - sum += size; - } - (*unPackSizes)[si++] = SzFolderGetUnPackSize(folders + i) - sum; - } - if (type == k7zIdSize) - { - RINOK(SzReadID(sd, &type)); - } - - for(i = 0; i < *numUnPackStreams; i++) - { - (*digestsDefined)[i] = 0; - (*digests)[i] = 0; - } - - - for(i = 0; i < numFolders; i++) - { - UInt32 numSubstreams = folders[i].NumUnPackStreams; - if (numSubstreams != 1 || !folders[i].UnPackCRCDefined) - numDigests += numSubstreams; - } - - - si = 0; - for (;;) - { - if (type == k7zIdCRC) - { - int digestIndex = 0; - Byte *digestsDefined2 = 0; - UInt32 *digests2 = 0; - SZ_RESULT res = SzReadHashDigests(sd, numDigests, &digestsDefined2, &digests2, allocTemp->Alloc); - if (res == SZ_OK) - { - for (i = 0; i < numFolders; i++) - { - CFolder *folder = folders + i; - UInt32 numSubstreams = folder->NumUnPackStreams; - if (numSubstreams == 1 && folder->UnPackCRCDefined) - { - (*digestsDefined)[si] = 1; - (*digests)[si] = folder->UnPackCRC; - si++; - } - else - { - UInt32 j; - for (j = 0; j < numSubstreams; j++, digestIndex++) - { - (*digestsDefined)[si] = digestsDefined2[digestIndex]; - (*digests)[si] = digests2[digestIndex]; - si++; - } - } - } - } - allocTemp->Free(digestsDefined2); - allocTemp->Free(digests2); - RINOK(res); - } - else if (type == k7zIdEnd) - return SZ_OK; - else - { - RINOK(SzSkeepData(sd)); - } - RINOK(SzReadID(sd, &type)); - } -} - - -SZ_RESULT SzReadStreamsInfo( - CSzData *sd, - CFileSize *dataOffset, - CArchiveDatabase *db, - UInt32 *numUnPackStreams, - CFileSize **unPackSizes, /* allocTemp */ - Byte **digestsDefined, /* allocTemp */ - UInt32 **digests, /* allocTemp */ - void * (*allocFunc)(size_t size), - ISzAlloc *allocTemp) -{ - for (;;) - { - UInt64 type; - RINOK(SzReadID(sd, &type)); - if ((UInt64)(int)type != type) - return SZE_FAIL; - switch((int)type) - { - case k7zIdEnd: - return SZ_OK; - case k7zIdPackInfo: - { - RINOK(SzReadPackInfo(sd, dataOffset, &db->NumPackStreams, - &db->PackSizes, &db->PackCRCsDefined, &db->PackCRCs, allocFunc)); - break; - } - case k7zIdUnPackInfo: - { - RINOK(SzReadUnPackInfo(sd, &db->NumFolders, &db->Folders, allocFunc, allocTemp)); - break; - } - case k7zIdSubStreamsInfo: - { - RINOK(SzReadSubStreamsInfo(sd, db->NumFolders, db->Folders, - numUnPackStreams, unPackSizes, digestsDefined, digests, allocTemp)); - break; - } - default: - return SZE_FAIL; - } - } -} - -Byte kUtf8Limits[5] = { 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; - -SZ_RESULT SzReadFileNames(CSzData *sd, UInt32 numFiles, CFileItem *files, - void * (*allocFunc)(size_t size)) -{ - UInt32 i; - for(i = 0; i < numFiles; i++) - { - UInt32 len = 0; - UInt32 pos = 0; - CFileItem *file = files + i; - while(pos + 2 <= sd->Size) - { - int numAdds; - UInt32 value = (UInt32)(sd->Data[pos] | (((UInt32)sd->Data[pos + 1]) << 8)); - pos += 2; - len++; - if (value == 0) - break; - if (value < 0x80) - continue; - if (value >= 0xD800 && value < 0xE000) - { - UInt32 c2; - if (value >= 0xDC00) - return SZE_ARCHIVE_ERROR; - if (pos + 2 > sd->Size) - return SZE_ARCHIVE_ERROR; - c2 = (UInt32)(sd->Data[pos] | (((UInt32)sd->Data[pos + 1]) << 8)); - pos += 2; - if (c2 < 0xDC00 || c2 >= 0xE000) - return SZE_ARCHIVE_ERROR; - value = ((value - 0xD800) << 10) | (c2 - 0xDC00); - } - for (numAdds = 1; numAdds < 5; numAdds++) - if (value < (((UInt32)1) << (numAdds * 5 + 6))) - break; - len += numAdds; - } - - MY_ALLOC(char, file->Name, (size_t)len, allocFunc); - - len = 0; - while(2 <= sd->Size) - { - int numAdds; - UInt32 value = (UInt32)(sd->Data[0] | (((UInt32)sd->Data[1]) << 8)); - SzSkeepDataSize(sd, 2); - if (value < 0x80) - { - file->Name[len++] = (char)value; - if (value == 0) - break; - continue; - } - if (value >= 0xD800 && value < 0xE000) - { - UInt32 c2 = (UInt32)(sd->Data[0] | (((UInt32)sd->Data[1]) << 8)); - SzSkeepDataSize(sd, 2); - value = ((value - 0xD800) << 10) | (c2 - 0xDC00); - } - for (numAdds = 1; numAdds < 5; numAdds++) - if (value < (((UInt32)1) << (numAdds * 5 + 6))) - break; - file->Name[len++] = (char)(kUtf8Limits[numAdds - 1] + (value >> (6 * numAdds))); - do - { - numAdds--; - file->Name[len++] = (char)(0x80 + ((value >> (6 * numAdds)) & 0x3F)); - } - while(numAdds > 0); - - len += numAdds; - } - } - return SZ_OK; -} - -SZ_RESULT SzReadHeader2( - CSzData *sd, - CArchiveDatabaseEx *db, /* allocMain */ - CFileSize **unPackSizes, /* allocTemp */ - Byte **digestsDefined, /* allocTemp */ - UInt32 **digests, /* allocTemp */ - Byte **emptyStreamVector, /* allocTemp */ - Byte **emptyFileVector, /* allocTemp */ - ISzAlloc *allocMain, - ISzAlloc *allocTemp) -{ - UInt64 type; - UInt32 numUnPackStreams = 0; - UInt32 numFiles = 0; - CFileItem *files = 0; - UInt32 numEmptyStreams = 0; - UInt32 i; - - RINOK(SzReadID(sd, &type)); - - if (type == k7zIdArchiveProperties) - { - RINOK(SzReadArchiveProperties(sd)); - RINOK(SzReadID(sd, &type)); - } - - - if (type == k7zIdMainStreamsInfo) - { - RINOK(SzReadStreamsInfo(sd, - &db->ArchiveInfo.DataStartPosition, - &db->Database, - &numUnPackStreams, - unPackSizes, - digestsDefined, - digests, allocMain->Alloc, allocTemp)); - db->ArchiveInfo.DataStartPosition += db->ArchiveInfo.StartPositionAfterHeader; - RINOK(SzReadID(sd, &type)); - } - - if (type == k7zIdEnd) - return SZ_OK; - if (type != k7zIdFilesInfo) - return SZE_ARCHIVE_ERROR; - - RINOK(SzReadNumber32(sd, &numFiles)); - db->Database.NumFiles = numFiles; - - MY_ALLOC(CFileItem, files, (size_t)numFiles, allocMain->Alloc); - - db->Database.Files = files; - for(i = 0; i < numFiles; i++) - SzFileInit(files + i); - - for (;;) - { - UInt64 type; - UInt64 size; - RINOK(SzReadID(sd, &type)); - if (type == k7zIdEnd) - break; - RINOK(SzReadNumber(sd, &size)); - - if ((UInt64)(int)type != type) - { - RINOK(SzSkeepDataSize(sd, size)); - } - else - switch((int)type) - { - case k7zIdName: - { - RINOK(SzReadSwitch(sd)); - RINOK(SzReadFileNames(sd, numFiles, files, allocMain->Alloc)) - break; - } - case k7zIdEmptyStream: - { - RINOK(SzReadBoolVector(sd, numFiles, emptyStreamVector, allocTemp->Alloc)); - numEmptyStreams = 0; - for (i = 0; i < numFiles; i++) - if ((*emptyStreamVector)[i]) - numEmptyStreams++; - break; - } - case k7zIdEmptyFile: - { - RINOK(SzReadBoolVector(sd, numEmptyStreams, emptyFileVector, allocTemp->Alloc)); - break; - } - default: - { - RINOK(SzSkeepDataSize(sd, size)); - } - } - } - - { - UInt32 emptyFileIndex = 0; - UInt32 sizeIndex = 0; - for(i = 0; i < numFiles; i++) - { - CFileItem *file = files + i; - file->IsAnti = 0; - if (*emptyStreamVector == 0) - file->HasStream = 1; - else - file->HasStream = (Byte)((*emptyStreamVector)[i] ? 0 : 1); - if(file->HasStream) - { - file->IsDirectory = 0; - file->Size = (*unPackSizes)[sizeIndex]; - file->FileCRC = (*digests)[sizeIndex]; - file->IsFileCRCDefined = (Byte)(*digestsDefined)[sizeIndex]; - sizeIndex++; - } - else - { - if (*emptyFileVector == 0) - file->IsDirectory = 1; - else - file->IsDirectory = (Byte)((*emptyFileVector)[emptyFileIndex] ? 0 : 1); - emptyFileIndex++; - file->Size = 0; - file->IsFileCRCDefined = 0; - } - } - } - return SzArDbExFill(db, allocMain->Alloc); -} - -SZ_RESULT SzReadHeader( - CSzData *sd, - CArchiveDatabaseEx *db, - ISzAlloc *allocMain, - ISzAlloc *allocTemp) -{ - CFileSize *unPackSizes = 0; - Byte *digestsDefined = 0; - UInt32 *digests = 0; - Byte *emptyStreamVector = 0; - Byte *emptyFileVector = 0; - SZ_RESULT res = SzReadHeader2(sd, db, - &unPackSizes, &digestsDefined, &digests, - &emptyStreamVector, &emptyFileVector, - allocMain, allocTemp); - allocTemp->Free(unPackSizes); - allocTemp->Free(digestsDefined); - allocTemp->Free(digests); - allocTemp->Free(emptyStreamVector); - allocTemp->Free(emptyFileVector); - return res; -} - -SZ_RESULT SzReadAndDecodePackedStreams2( - ISzInStream *inStream, - CSzData *sd, - CSzByteBuffer *outBuffer, - CFileSize baseOffset, - CArchiveDatabase *db, - CFileSize **unPackSizes, - Byte **digestsDefined, - UInt32 **digests, - #ifndef _LZMA_IN_CB - Byte **inBuffer, - #endif - ISzAlloc *allocTemp) -{ - - UInt32 numUnPackStreams = 0; - CFileSize dataStartPos; - CFolder *folder; - #ifndef _LZMA_IN_CB - CFileSize packSize = 0; - UInt32 i = 0; - #endif - CFileSize unPackSize; - size_t outRealSize; - SZ_RESULT res; - - RINOK(SzReadStreamsInfo(sd, &dataStartPos, db, - &numUnPackStreams, unPackSizes, digestsDefined, digests, - allocTemp->Alloc, allocTemp)); - - dataStartPos += baseOffset; - if (db->NumFolders != 1) - return SZE_ARCHIVE_ERROR; - - folder = db->Folders; - unPackSize = SzFolderGetUnPackSize(folder); - - RINOK(inStream->Seek(inStream, dataStartPos)); - - #ifndef _LZMA_IN_CB - for (i = 0; i < db->NumPackStreams; i++) - packSize += db->PackSizes[i]; - - MY_ALLOC(Byte, *inBuffer, (size_t)packSize, allocTemp->Alloc); - - RINOK(SafeReadDirect(inStream, *inBuffer, (size_t)packSize)); - #endif - - if (!SzByteBufferCreate(outBuffer, (size_t)unPackSize, allocTemp->Alloc)) - return SZE_OUTOFMEMORY; - - res = SzDecode(db->PackSizes, folder, - #ifdef _LZMA_IN_CB - inStream, - #else - *inBuffer, - #endif - outBuffer->Items, (size_t)unPackSize, - &outRealSize, allocTemp); - RINOK(res) - if (outRealSize != (UInt32)unPackSize) - return SZE_FAIL; - if (folder->UnPackCRCDefined) - if (!CrcVerifyDigest(folder->UnPackCRC, outBuffer->Items, (size_t)unPackSize)) - return SZE_FAIL; - return SZ_OK; -} - -SZ_RESULT SzReadAndDecodePackedStreams( - ISzInStream *inStream, - CSzData *sd, - CSzByteBuffer *outBuffer, - CFileSize baseOffset, - ISzAlloc *allocTemp) -{ - CArchiveDatabase db; - CFileSize *unPackSizes = 0; - Byte *digestsDefined = 0; - UInt32 *digests = 0; - #ifndef _LZMA_IN_CB - Byte *inBuffer = 0; - #endif - SZ_RESULT res; - SzArchiveDatabaseInit(&db); - res = SzReadAndDecodePackedStreams2(inStream, sd, outBuffer, baseOffset, - &db, &unPackSizes, &digestsDefined, &digests, - #ifndef _LZMA_IN_CB - &inBuffer, - #endif - allocTemp); - SzArchiveDatabaseFree(&db, allocTemp->Free); - allocTemp->Free(unPackSizes); - allocTemp->Free(digestsDefined); - allocTemp->Free(digests); - #ifndef _LZMA_IN_CB - allocTemp->Free(inBuffer); - #endif - return res; -} - -SZ_RESULT SzArchiveOpen2( - ISzInStream *inStream, - CArchiveDatabaseEx *db, - ISzAlloc *allocMain, - ISzAlloc *allocTemp) -{ - Byte signature[k7zSignatureSize]; - Byte version; - UInt32 crcFromArchive; - UInt64 nextHeaderOffset; - UInt64 nextHeaderSize; - UInt32 nextHeaderCRC; - UInt32 crc; - CFileSize pos = 0; - CSzByteBuffer buffer; - CSzData sd; - SZ_RESULT res; - - RINOK(SafeReadDirect(inStream, signature, k7zSignatureSize)); - - if (!TestSignatureCandidate(signature)) - return SZE_ARCHIVE_ERROR; - - /* - db.Clear(); - db.ArchiveInfo.StartPosition = _arhiveBeginStreamPosition; - */ - RINOK(SafeReadDirectByte(inStream, &version)); - if (version != k7zMajorVersion) - return SZE_ARCHIVE_ERROR; - RINOK(SafeReadDirectByte(inStream, &version)); - - RINOK(SafeReadDirectUInt32(inStream, &crcFromArchive)); - - CrcInit(&crc); - RINOK(SafeReadDirectUInt64(inStream, &nextHeaderOffset)); - CrcUpdateUInt64(&crc, nextHeaderOffset); - RINOK(SafeReadDirectUInt64(inStream, &nextHeaderSize)); - CrcUpdateUInt64(&crc, nextHeaderSize); - RINOK(SafeReadDirectUInt32(inStream, &nextHeaderCRC)); - CrcUpdateUInt32(&crc, nextHeaderCRC); - - pos = k7zStartHeaderSize; - db->ArchiveInfo.StartPositionAfterHeader = pos; - - if (CrcGetDigest(&crc) != crcFromArchive) - return SZE_ARCHIVE_ERROR; - - if (nextHeaderSize == 0) - return SZ_OK; - - RINOK(inStream->Seek(inStream, (CFileSize)(pos + nextHeaderOffset))); - - if (!SzByteBufferCreate(&buffer, (size_t)nextHeaderSize, allocTemp->Alloc)) - return SZE_OUTOFMEMORY; - - res = SafeReadDirect(inStream, buffer.Items, (size_t)nextHeaderSize); - if (res == SZ_OK) - { - res = SZE_ARCHIVE_ERROR; - if (CrcVerifyDigest(nextHeaderCRC, buffer.Items, (UInt32)nextHeaderSize)) - { - for (;;) - { - UInt64 type; - sd.Data = buffer.Items; - sd.Size = buffer.Capacity; - res = SzReadID(&sd, &type); - if (res != SZ_OK) - break; - if (type == k7zIdHeader) - { - res = SzReadHeader(&sd, db, allocMain, allocTemp); - break; - } - if (type != k7zIdEncodedHeader) - { - res = SZE_ARCHIVE_ERROR; - break; - } - { - CSzByteBuffer outBuffer; - res = SzReadAndDecodePackedStreams(inStream, &sd, &outBuffer, - db->ArchiveInfo.StartPositionAfterHeader, - allocTemp); - if (res != SZ_OK) - { - SzByteBufferFree(&outBuffer, allocTemp->Free); - break; - } - SzByteBufferFree(&buffer, allocTemp->Free); - buffer.Items = outBuffer.Items; - buffer.Capacity = outBuffer.Capacity; - } - } - } - } - SzByteBufferFree(&buffer, allocTemp->Free); - return res; -} - -SZ_RESULT SzArchiveOpen( - ISzInStream *inStream, - CArchiveDatabaseEx *db, - ISzAlloc *allocMain, - ISzAlloc *allocTemp) -{ - SZ_RESULT res = SzArchiveOpen2(inStream, db, allocMain, allocTemp); - if (res != SZ_OK) - SzArDbExFree(db, allocMain->Free); - return res; -} diff --git a/7zip/Archive/7z_C/7zIn.h b/7zip/Archive/7z_C/7zIn.h deleted file mode 100755 index 6bfa2a70..00000000 --- a/7zip/Archive/7z_C/7zIn.h +++ /dev/null @@ -1,55 +0,0 @@ -/* 7zIn.h */ - -#ifndef __7Z_IN_H -#define __7Z_IN_H - -#include "7zHeader.h" -#include "7zItem.h" -#include "7zAlloc.h" - -typedef struct _CInArchiveInfo -{ - CFileSize StartPositionAfterHeader; - CFileSize DataStartPosition; -}CInArchiveInfo; - -typedef struct _CArchiveDatabaseEx -{ - CArchiveDatabase Database; - CInArchiveInfo ArchiveInfo; - UInt32 *FolderStartPackStreamIndex; - CFileSize *PackStreamStartPositions; - UInt32 *FolderStartFileIndex; - UInt32 *FileIndexToFolderIndexMap; -}CArchiveDatabaseEx; - -void SzArDbExInit(CArchiveDatabaseEx *db); -void SzArDbExFree(CArchiveDatabaseEx *db, void (*freeFunc)(void *)); -CFileSize SzArDbGetFolderStreamPos(CArchiveDatabaseEx *db, UInt32 folderIndex, UInt32 indexInFolder); -CFileSize SzArDbGetFolderFullPackSize(CArchiveDatabaseEx *db, UInt32 folderIndex); - -typedef struct _ISzInStream -{ - #ifdef _LZMA_IN_CB - SZ_RESULT (*Read)( - void *object, /* pointer to ISzInStream itself */ - void **buffer, /* out: pointer to buffer with data */ - size_t maxRequiredSize, /* max required size to read */ - size_t *processedSize); /* real processed size. - processedSize can be less than maxRequiredSize. - If processedSize == 0, then there are no more - bytes in stream. */ - #else - SZ_RESULT (*Read)(void *object, void *buffer, size_t size, size_t *processedSize); - #endif - SZ_RESULT (*Seek)(void *object, CFileSize pos); -} ISzInStream; - - -int SzArchiveOpen( - ISzInStream *inStream, - CArchiveDatabaseEx *db, - ISzAlloc *allocMain, - ISzAlloc *allocTemp); - -#endif diff --git a/7zip/Archive/7z_C/7zItem.c b/7zip/Archive/7z_C/7zItem.c deleted file mode 100755 index 2a408050..00000000 --- a/7zip/Archive/7z_C/7zItem.c +++ /dev/null @@ -1,133 +0,0 @@ -/* 7zItem.c */ - -#include "7zItem.h" -#include "7zAlloc.h" - -void SzCoderInfoInit(CCoderInfo *coder) -{ - SzByteBufferInit(&coder->Properties); -} - -void SzCoderInfoFree(CCoderInfo *coder, void (*freeFunc)(void *p)) -{ - SzByteBufferFree(&coder->Properties, freeFunc); - SzCoderInfoInit(coder); -} - -void SzFolderInit(CFolder *folder) -{ - folder->NumCoders = 0; - folder->Coders = 0; - folder->NumBindPairs = 0; - folder->BindPairs = 0; - folder->NumPackStreams = 0; - folder->PackStreams = 0; - folder->UnPackSizes = 0; - folder->UnPackCRCDefined = 0; - folder->UnPackCRC = 0; - folder->NumUnPackStreams = 0; -} - -void SzFolderFree(CFolder *folder, void (*freeFunc)(void *p)) -{ - UInt32 i; - for (i = 0; i < folder->NumCoders; i++) - SzCoderInfoFree(&folder->Coders[i], freeFunc); - freeFunc(folder->Coders); - freeFunc(folder->BindPairs); - freeFunc(folder->PackStreams); - freeFunc(folder->UnPackSizes); - SzFolderInit(folder); -} - -UInt32 SzFolderGetNumOutStreams(CFolder *folder) -{ - UInt32 result = 0; - UInt32 i; - for (i = 0; i < folder->NumCoders; i++) - result += folder->Coders[i].NumOutStreams; - return result; -} - -int SzFolderFindBindPairForInStream(CFolder *folder, UInt32 inStreamIndex) -{ - UInt32 i; - for(i = 0; i < folder->NumBindPairs; i++) - if (folder->BindPairs[i].InIndex == inStreamIndex) - return i; - return -1; -} - - -int SzFolderFindBindPairForOutStream(CFolder *folder, UInt32 outStreamIndex) -{ - UInt32 i; - for(i = 0; i < folder->NumBindPairs; i++) - if (folder->BindPairs[i].OutIndex == outStreamIndex) - return i; - return -1; -} - -CFileSize SzFolderGetUnPackSize(CFolder *folder) -{ - int i = (int)SzFolderGetNumOutStreams(folder); - if (i == 0) - return 0; - for (i--; i >= 0; i--) - if (SzFolderFindBindPairForOutStream(folder, i) < 0) - return folder->UnPackSizes[i]; - /* throw 1; */ - return 0; -} - -/* -int FindPackStreamArrayIndex(int inStreamIndex) const -{ - for(int i = 0; i < PackStreams.Size(); i++) - if (PackStreams[i] == inStreamIndex) - return i; - return -1; -} -*/ - -void SzFileInit(CFileItem *fileItem) -{ - fileItem->IsFileCRCDefined = 0; - fileItem->HasStream = 1; - fileItem->IsDirectory = 0; - fileItem->IsAnti = 0; - fileItem->Name = 0; -} - -void SzFileFree(CFileItem *fileItem, void (*freeFunc)(void *p)) -{ - freeFunc(fileItem->Name); - SzFileInit(fileItem); -} - -void SzArchiveDatabaseInit(CArchiveDatabase *db) -{ - db->NumPackStreams = 0; - db->PackSizes = 0; - db->PackCRCsDefined = 0; - db->PackCRCs = 0; - db->NumFolders = 0; - db->Folders = 0; - db->NumFiles = 0; - db->Files = 0; -} - -void SzArchiveDatabaseFree(CArchiveDatabase *db, void (*freeFunc)(void *)) -{ - UInt32 i; - for (i = 0; i < db->NumFolders; i++) - SzFolderFree(&db->Folders[i], freeFunc); - for (i = 0; i < db->NumFiles; i++) - SzFileFree(&db->Files[i], freeFunc); - freeFunc(db->PackSizes); - freeFunc(db->PackCRCsDefined); - freeFunc(db->PackCRCs); - freeFunc(db->Folders); - freeFunc(db->Files); - SzArchiveDatabaseInit(db); -} diff --git a/7zip/Archive/7z_C/7zItem.h b/7zip/Archive/7z_C/7zItem.h deleted file mode 100755 index 876539a9..00000000 --- a/7zip/Archive/7z_C/7zItem.h +++ /dev/null @@ -1,90 +0,0 @@ -/* 7zItem.h */ - -#ifndef __7Z_ITEM_H -#define __7Z_ITEM_H - -#include "7zMethodID.h" -#include "7zHeader.h" -#include "7zBuffer.h" - -typedef struct _CCoderInfo -{ - UInt32 NumInStreams; - UInt32 NumOutStreams; - CMethodID MethodID; - CSzByteBuffer Properties; -}CCoderInfo; - -void SzCoderInfoInit(CCoderInfo *coder); -void SzCoderInfoFree(CCoderInfo *coder, void (*freeFunc)(void *p)); - -typedef struct _CBindPair -{ - UInt32 InIndex; - UInt32 OutIndex; -}CBindPair; - -typedef struct _CFolder -{ - UInt32 NumCoders; - CCoderInfo *Coders; - UInt32 NumBindPairs; - CBindPair *BindPairs; - UInt32 NumPackStreams; - UInt32 *PackStreams; - CFileSize *UnPackSizes; - int UnPackCRCDefined; - UInt32 UnPackCRC; - - UInt32 NumUnPackStreams; -}CFolder; - -void SzFolderInit(CFolder *folder); -CFileSize SzFolderGetUnPackSize(CFolder *folder); -int SzFolderFindBindPairForInStream(CFolder *folder, UInt32 inStreamIndex); -UInt32 SzFolderGetNumOutStreams(CFolder *folder); -CFileSize SzFolderGetUnPackSize(CFolder *folder); - -/* #define CArchiveFileTime UInt64 */ - -typedef struct _CFileItem -{ - /* - CArchiveFileTime LastWriteTime; - CFileSize StartPos; - UInt32 Attributes; - */ - CFileSize Size; - UInt32 FileCRC; - char *Name; - - Byte IsFileCRCDefined; - Byte HasStream; - Byte IsDirectory; - Byte IsAnti; - /* - int AreAttributesDefined; - int IsLastWriteTimeDefined; - int IsStartPosDefined; - */ -}CFileItem; - -void SzFileInit(CFileItem *fileItem); - -typedef struct _CArchiveDatabase -{ - UInt32 NumPackStreams; - CFileSize *PackSizes; - Byte *PackCRCsDefined; - UInt32 *PackCRCs; - UInt32 NumFolders; - CFolder *Folders; - UInt32 NumFiles; - CFileItem *Files; -}CArchiveDatabase; - -void SzArchiveDatabaseInit(CArchiveDatabase *db); -void SzArchiveDatabaseFree(CArchiveDatabase *db, void (*freeFunc)(void *)); - - -#endif diff --git a/7zip/Archive/7z_C/7zMain.c b/7zip/Archive/7z_C/7zMain.c deleted file mode 100755 index 10900c54..00000000 --- a/7zip/Archive/7z_C/7zMain.c +++ /dev/null @@ -1,356 +0,0 @@ -/* -7zMain.c -Test application for 7z Decoder -LZMA SDK 4.43 Copyright (c) 1999-2006 Igor Pavlov (2006-06-04) -*/ - -#include -#include -#include - -#ifdef _WIN32 -#define USE_WINDOWS_FUNCTIONS -#endif - -#ifdef USE_WINDOWS_FUNCTIONS -#include -#endif - -#include "7zCrc.h" -#include "7zIn.h" -#include "7zExtract.h" - - -#ifdef USE_WINDOWS_FUNCTIONS -typedef HANDLE MY_FILE_HANDLE; -#else -typedef FILE *MY_FILE_HANDLE; -#endif - -void ConvertNumberToString(CFileSize value, char *s) -{ - char temp[32]; - int pos = 0; - do - { - temp[pos++] = (char)('0' + (int)(value % 10)); - value /= 10; - } - while (value != 0); - do - *s++ = temp[--pos]; - while(pos > 0); - *s = '\0'; -} - - -#ifdef USE_WINDOWS_FUNCTIONS -// ReadFile and WriteFile functions in Windows have BUG: -// If you Read or Write 64MB or more (probably min_failure_size = 64MB - 32KB + 1) -// from/to Network file, it returns ERROR_NO_SYSTEM_RESOURCES -// (Insufficient system resources exist to complete the requested service). -#define kChunkSizeMax (1 << 24) -#endif - -size_t MyReadFile(MY_FILE_HANDLE file, void *data, size_t size) -{ - if (size == 0) - return 0; - #ifdef USE_WINDOWS_FUNCTIONS - { - size_t processedSize = 0; - do - { - DWORD curSize = (size > kChunkSizeMax) ? kChunkSizeMax : (DWORD)size; - DWORD processedLoc = 0; - BOOL res = ReadFile(file, data, curSize, &processedLoc, NULL); - data = (void *)((unsigned char *)data + processedLoc); - size -= processedLoc; - processedSize += processedLoc; - if (!res || processedLoc == 0) - break; - } - while (size > 0); - return processedSize; - } - #else - return fread(data, 1, size, file); - #endif -} - -size_t MyWriteFile(MY_FILE_HANDLE file, void *data, size_t size) -{ - if (size == 0) - return 0; - #ifdef USE_WINDOWS_FUNCTIONS - { - size_t processedSize = 0; - do - { - DWORD curSize = (size > kChunkSizeMax) ? kChunkSizeMax : (DWORD)size; - DWORD processedLoc = 0; - BOOL res = WriteFile(file, data, curSize, &processedLoc, NULL); - data = (void *)((unsigned char *)data + processedLoc); - size -= processedLoc; - processedSize += processedLoc; - if (!res) - break; - } - while (size > 0); - return processedSize; - } - #else - return fwrite(data, 1, size, file); - #endif -} - -int MyCloseFile(MY_FILE_HANDLE file) -{ - #ifdef USE_WINDOWS_FUNCTIONS - return (CloseHandle(file) != FALSE) ? 0 : 1; - #else - return fclose(file); - #endif -} - -typedef struct _CFileInStream -{ - ISzInStream InStream; - MY_FILE_HANDLE File; -} CFileInStream; - -#ifdef _LZMA_IN_CB - -#define kBufferSize (1 << 12) -Byte g_Buffer[kBufferSize]; - -SZ_RESULT SzFileReadImp(void *object, void **buffer, size_t maxRequiredSize, size_t *processedSize) -{ - CFileInStream *s = (CFileInStream *)object; - size_t processedSizeLoc; - if (maxRequiredSize > kBufferSize) - maxRequiredSize = kBufferSize; - processedSizeLoc = MyReadFile(s->File, g_Buffer, maxRequiredSize); - *buffer = g_Buffer; - if (processedSize != 0) - *processedSize = processedSizeLoc; - return SZ_OK; -} - -#else - -SZ_RESULT SzFileReadImp(void *object, void *buffer, size_t size, size_t *processedSize) -{ - CFileInStream *s = (CFileInStream *)object; - size_t processedSizeLoc = MyReadFile(s->File, buffer, size); - if (processedSize != 0) - *processedSize = processedSizeLoc; - return SZ_OK; -} - -#endif - -SZ_RESULT SzFileSeekImp(void *object, CFileSize pos) -{ - CFileInStream *s = (CFileInStream *)object; - - #ifdef USE_WINDOWS_FUNCTIONS - { - LARGE_INTEGER value; - value.LowPart = (DWORD)pos; - value.HighPart = (LONG)(pos >> 32); - value.LowPart = SetFilePointer(s->File, value.LowPart, &value.HighPart, FILE_BEGIN); - if (value.LowPart == 0xFFFFFFFF) - if(GetLastError() != NO_ERROR) - return SZE_FAIL; - return SZ_OK; - } - #else - int res = fseek(s->File, (long)pos, SEEK_SET); - if (res == 0) - return SZ_OK; - return SZE_FAIL; - #endif -} - -void PrintError(char *sz) -{ - printf("\nERROR: %s\n", sz); -} - -int main(int numargs, char *args[]) -{ - CFileInStream archiveStream; - CArchiveDatabaseEx db; - SZ_RESULT res; - ISzAlloc allocImp; - ISzAlloc allocTempImp; - - printf("\n7z ANSI-C Decoder 4.44 Copyright (c) 1999-2006 Igor Pavlov 2006-08-27\n"); - if (numargs == 1) - { - printf( - "\nUsage: 7zDec \n\n" - "\n" - " e: Extract files from archive\n" - " l: List contents of archive\n" - " t: Test integrity of archive\n"); - return 0; - } - if (numargs < 3) - { - PrintError("incorrect command"); - return 1; - } - - archiveStream.File = - #ifdef USE_WINDOWS_FUNCTIONS - CreateFile(args[2], GENERIC_READ, FILE_SHARE_READ, - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (archiveStream.File == INVALID_HANDLE_VALUE) - #else - archiveStream.File = fopen(args[2], "rb"); - if (archiveStream.File == 0) - #endif - { - PrintError("can not open input file"); - return 1; - } - - archiveStream.InStream.Read = SzFileReadImp; - archiveStream.InStream.Seek = SzFileSeekImp; - - allocImp.Alloc = SzAlloc; - allocImp.Free = SzFree; - - allocTempImp.Alloc = SzAllocTemp; - allocTempImp.Free = SzFreeTemp; - - InitCrcTable(); - SzArDbExInit(&db); - res = SzArchiveOpen(&archiveStream.InStream, &db, &allocImp, &allocTempImp); - if (res == SZ_OK) - { - char *command = args[1]; - int listCommand = 0; - int testCommand = 0; - int extractCommand = 0; - if (strcmp(command, "l") == 0) - listCommand = 1; - if (strcmp(command, "t") == 0) - testCommand = 1; - else if (strcmp(command, "e") == 0) - extractCommand = 1; - - if (listCommand) - { - UInt32 i; - for (i = 0; i < db.Database.NumFiles; i++) - { - CFileItem *f = db.Database.Files + i; - char s[32]; - ConvertNumberToString(f->Size, s); - printf("%10s %s\n", s, f->Name); - } - } - else if (testCommand || extractCommand) - { - UInt32 i; - - /* - if you need cache, use these 3 variables. - if you use external function, you can make these variable as static. - */ - UInt32 blockIndex = 0xFFFFFFFF; /* it can have any value before first call (if outBuffer = 0) */ - Byte *outBuffer = 0; /* it must be 0 before first call for each new archive. */ - size_t outBufferSize = 0; /* it can have any value before first call (if outBuffer = 0) */ - - printf("\n"); - for (i = 0; i < db.Database.NumFiles; i++) - { - size_t offset; - size_t outSizeProcessed; - CFileItem *f = db.Database.Files + i; - if (f->IsDirectory) - printf("Directory "); - else - printf(testCommand ? - "Testing ": - "Extracting"); - printf(" %s", f->Name); - if (f->IsDirectory) - { - printf("\n"); - continue; - } - res = SzExtract(&archiveStream.InStream, &db, i, - &blockIndex, &outBuffer, &outBufferSize, - &offset, &outSizeProcessed, - &allocImp, &allocTempImp); - if (res != SZ_OK) - break; - if (!testCommand) - { - MY_FILE_HANDLE outputHandle; - UInt32 processedSize; - char *fileName = f->Name; - size_t nameLen = strlen(f->Name); - for (; nameLen > 0; nameLen--) - if (f->Name[nameLen - 1] == '/') - { - fileName = f->Name + nameLen; - break; - } - - outputHandle = - #ifdef USE_WINDOWS_FUNCTIONS - CreateFile(fileName, GENERIC_WRITE, FILE_SHARE_READ, - NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - if (outputHandle == INVALID_HANDLE_VALUE) - #else - fopen(fileName, "wb+"); - if (outputHandle == 0) - #endif - { - PrintError("can not open output file"); - res = SZE_FAIL; - break; - } - processedSize = MyWriteFile(outputHandle, outBuffer + offset, outSizeProcessed); - if (processedSize != outSizeProcessed) - { - PrintError("can not write output file"); - res = SZE_FAIL; - break; - } - if (MyCloseFile(outputHandle)) - { - PrintError("can not close output file"); - res = SZE_FAIL; - break; - } - } - printf("\n"); - } - allocImp.Free(outBuffer); - } - else - { - PrintError("incorrect command"); - res = SZE_FAIL; - } - } - SzArDbExFree(&db, allocImp.Free); - - MyCloseFile(archiveStream.File); - if (res == SZ_OK) - { - printf("\nEverything is Ok\n"); - return 0; - } - if (res == SZE_OUTOFMEMORY) - PrintError("can not allocate memory"); - else - printf("\nERROR #%d\n", res); - return 1; -} diff --git a/7zip/Archive/7z_C/7zMethodID.c b/7zip/Archive/7z_C/7zMethodID.c deleted file mode 100755 index 5047359f..00000000 --- a/7zip/Archive/7z_C/7zMethodID.c +++ /dev/null @@ -1,14 +0,0 @@ -/* 7zMethodID.c */ - -#include "7zMethodID.h" - -int AreMethodsEqual(CMethodID *a1, CMethodID *a2) -{ - int i; - if (a1->IDSize != a2->IDSize) - return 0; - for (i = 0; i < a1->IDSize; i++) - if (a1->ID[i] != a2->ID[i]) - return 0; - return 1; -} diff --git a/7zip/Archive/7z_C/7zMethodID.h b/7zip/Archive/7z_C/7zMethodID.h deleted file mode 100755 index 162fcd15..00000000 --- a/7zip/Archive/7z_C/7zMethodID.h +++ /dev/null @@ -1,18 +0,0 @@ -/* 7zMethodID.h */ - -#ifndef __7Z_METHOD_ID_H -#define __7Z_METHOD_ID_H - -#include "7zTypes.h" - -#define kMethodIDSize 15 - -typedef struct _CMethodID -{ - Byte ID[kMethodIDSize]; - Byte IDSize; -} CMethodID; - -int AreMethodsEqual(CMethodID *a1, CMethodID *a2); - -#endif diff --git a/7zip/Archive/7z_C/7zTypes.h b/7zip/Archive/7z_C/7zTypes.h deleted file mode 100755 index 60dd68c3..00000000 --- a/7zip/Archive/7z_C/7zTypes.h +++ /dev/null @@ -1,67 +0,0 @@ -/* 7zTypes.h */ - -#ifndef __COMMON_TYPES_H -#define __COMMON_TYPES_H - -#ifndef _7ZIP_BYTE_DEFINED -#define _7ZIP_BYTE_DEFINED -typedef unsigned char Byte; -#endif - -#ifndef _7ZIP_UINT16_DEFINED -#define _7ZIP_UINT16_DEFINED -typedef unsigned short UInt16; -#endif - -#ifndef _7ZIP_UINT32_DEFINED -#define _7ZIP_UINT32_DEFINED -#ifdef _LZMA_UINT32_IS_ULONG -typedef unsigned long UInt32; -#else -typedef unsigned int UInt32; -#endif -#endif - -/* #define _SZ_NO_INT_64 */ -/* define it your compiler doesn't support long long int */ - -#ifndef _7ZIP_UINT64_DEFINED -#define _7ZIP_UINT64_DEFINED -#ifdef _SZ_NO_INT_64 -typedef unsigned long UInt64; -#else -#ifdef _MSC_VER -typedef unsigned __int64 UInt64; -#else -typedef unsigned long long int UInt64; -#endif -#endif -#endif - - -/* #define _SZ_FILE_SIZE_64 */ -/* Use _SZ_FILE_SIZE_64 if you need support for files larger than 4 GB*/ - -#ifndef CFileSize -#ifdef _SZ_FILE_SIZE_64 -typedef UInt64 CFileSize; -#else -typedef UInt32 CFileSize; -#endif -#endif - -#define SZ_RESULT int - -#define SZ_OK (0) -#define SZE_DATA_ERROR (1) -#define SZE_OUTOFMEMORY (2) -#define SZE_CRC_ERROR (3) - -#define SZE_NOTIMPL (4) -#define SZE_FAIL (5) - -#define SZE_ARCHIVE_ERROR (6) - -#define RINOK(x) { int __result_ = (x); if(__result_ != 0) return __result_; } - -#endif diff --git a/7zip/Archive/7z_C/7z_C.dsp b/7zip/Archive/7z_C/7z_C.dsp deleted file mode 100755 index 6129fa86..00000000 --- a/7zip/Archive/7z_C/7z_C.dsp +++ /dev/null @@ -1,182 +0,0 @@ -# Microsoft Developer Studio Project File - Name="7z_C" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=7z_C - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "7z_C.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "7z_C.mak" CFG="7z_C - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "7z_C - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "7z_C - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "7z_C - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W4 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_LZMA_PROB32" /D "_LZMA_IN_CB" /D "_SZ_FILE_SIZE_64" /YX /FD /c -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"Release/7zDec.exe" - -!ELSEIF "$(CFG)" == "7z_C - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W4 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_LZMA_PROB32" /D "_LZMA_IN_CB" /D "_SZ_FILE_SIZE_64" /YX /FD /GZ /c -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"Debug/7zDec.exe" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "7z_C - Win32 Release" -# Name "7z_C - Win32 Debug" -# Begin Group "LZMA" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZMA_C\LzmaDecode.c -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZMA_C\LzmaDecode.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZMA_C\LzmaTypes.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\7zAlloc.c -# End Source File -# Begin Source File - -SOURCE=.\7zAlloc.h -# End Source File -# Begin Source File - -SOURCE=.\7zBuffer.c -# End Source File -# Begin Source File - -SOURCE=.\7zBuffer.h -# End Source File -# Begin Source File - -SOURCE=.\7zCrc.c -# End Source File -# Begin Source File - -SOURCE=.\7zCrc.h -# End Source File -# Begin Source File - -SOURCE=.\7zDecode.c -# End Source File -# Begin Source File - -SOURCE=.\7zDecode.h -# End Source File -# Begin Source File - -SOURCE=.\7zExtract.c -# End Source File -# Begin Source File - -SOURCE=.\7zExtract.h -# End Source File -# Begin Source File - -SOURCE=.\7zHeader.c -# End Source File -# Begin Source File - -SOURCE=.\7zHeader.h -# End Source File -# Begin Source File - -SOURCE=.\7zIn.c -# End Source File -# Begin Source File - -SOURCE=.\7zIn.h -# End Source File -# Begin Source File - -SOURCE=.\7zItem.c -# End Source File -# Begin Source File - -SOURCE=.\7zItem.h -# End Source File -# Begin Source File - -SOURCE=.\7zMain.c -# End Source File -# Begin Source File - -SOURCE=.\7zMethodID.c -# End Source File -# Begin Source File - -SOURCE=.\7zMethodID.h -# End Source File -# Begin Source File - -SOURCE=.\7zTypes.h -# End Source File -# End Target -# End Project diff --git a/7zip/Archive/7z_C/7z_C.dsw b/7zip/Archive/7z_C/7z_C.dsw deleted file mode 100755 index 6fd39621..00000000 --- a/7zip/Archive/7z_C/7z_C.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "7z_C"=.\7z_C.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Archive/7z_C/makefile b/7zip/Archive/7z_C/makefile deleted file mode 100755 index 9ce2c346..00000000 --- a/7zip/Archive/7z_C/makefile +++ /dev/null @@ -1,55 +0,0 @@ -PROG = 7zDec.exe - -!IFNDEF O -!IFDEF CPU -O=$(CPU) -!ELSE -O=O -!ENDIF -!ENDIF - -CFLAGS = $(CFLAGS) -nologo -c -Fo$O/ -GS- -CFLAGS_O1 = $(CFLAGS) -O1 -CFLAGS_O2 = $(CFLAGS) -O2 - -LFLAGS = $(LFLAGS) -nologo -OPT:NOWIN98 - -PROGPATH = $O\$(PROG) - -COMPL_O1 = $(CPP) $(CFLAGS_O1) $** -COMPL_O2 = $(CPP) $(CFLAGS_O2) $** -COMPL = $(CPP) $(CFLAGS_O1) $** - - -7Z_OBJS = \ - $O\7zAlloc.obj \ - $O\7zBuffer.obj \ - $O\7zCrc.obj \ - $O\7zDecode.obj \ - $O\7zExtract.obj \ - $O\7zHeader.obj \ - $O\7zIn.obj \ - $O\7zItem.obj \ - $O\7zMain.obj \ - $O\7zMethodID.obj \ - -OBJS = \ - $(7Z_OBJS) \ - $O\LzmaDecode.obj \ - -all: $(PROGPATH) - -clean: - -del /Q $(PROGPATH) $O\*.exe $O\*.dll $O\*.obj $O\*.lib $O\*.exp $O\*.res $O\*.pch - -$O: - if not exist "$O" mkdir "$O" - -$(PROGPATH): $O $(OBJS) - link $(LFLAGS) -out:$(PROGPATH) $(OBJS) $(LIBS) - - -$(7Z_OBJS): $(*B).c - $(COMPL) -$O\LzmaDecode.obj: ../../Compress/LZMA_C/$(*B).c - $(COMPL_O2) diff --git a/7zip/Archive/7z_C/makefile.gcc b/7zip/Archive/7z_C/makefile.gcc deleted file mode 100755 index 21b7df47..00000000 --- a/7zip/Archive/7z_C/makefile.gcc +++ /dev/null @@ -1,50 +0,0 @@ -PROG = 7zDec -CXX = g++ -LIB = -RM = rm -f -CFLAGS = -c -O2 -Wall - -OBJS = 7zAlloc.o 7zBuffer.o 7zCrc.o 7zDecode.o 7zExtract.o 7zHeader.o 7zIn.o 7zItem.o 7zMain.o 7zMethodID.o LzmaDecode.o - -all: $(PROG) - -$(PROG): $(OBJS) - $(CXX) -o $(PROG) $(LDFLAGS) $(OBJS) $(LIB) - -7zAlloc.o: 7zAlloc.c - $(CXX) $(CFLAGS) 7zAlloc.c - -7zBuffer.o: 7zBuffer.c - $(CXX) $(CFLAGS) 7zBuffer.c - -7zCrc.o: 7zCrc.c - $(CXX) $(CFLAGS) 7zCrc.c - -7zDecode.o: 7zDecode.c - $(CXX) $(CFLAGS) 7zDecode.c - -7zExtract.o: 7zExtract.c - $(CXX) $(CFLAGS) 7zExtract.c - -7zHeader.o: 7zHeader.c - $(CXX) $(CFLAGS) 7zHeader.c - -7zIn.o: 7zIn.c - $(CXX) $(CFLAGS) 7zIn.c - -7zItem.o: 7zItem.c - $(CXX) $(CFLAGS) 7zItem.c - -7zMain.o: 7zMain.c - $(CXX) $(CFLAGS) 7zMain.c - -7zMethodID.o: 7zMethodID.c - $(CXX) $(CFLAGS) 7zMethodID.c - -LzmaDecode.o: ../../Compress/LZMA_C/LzmaDecode.c - $(CXX) $(CFLAGS) ../../Compress/LZMA_C/LzmaDecode.c - - -clean: - -$(RM) $(PROG) $(OBJS) - diff --git a/7zip/Archive/Archive.def b/7zip/Archive/Archive.def deleted file mode 100755 index befc7d83..00000000 --- a/7zip/Archive/Archive.def +++ /dev/null @@ -1,3 +0,0 @@ -EXPORTS - CreateObject PRIVATE - GetHandlerProperty PRIVATE diff --git a/7zip/Archive/Arj/Arj.dsp b/7zip/Archive/Arj/Arj.dsp deleted file mode 100755 index 3bc6fa91..00000000 --- a/7zip/Archive/Arj/Arj.dsp +++ /dev/null @@ -1,329 +0,0 @@ -# Microsoft Developer Studio Project File - Name="arj" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=arj - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "arj.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "arj.mak" CFG="arj - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "arj - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "arj - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "arj - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ARJ_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ARJ_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\arj.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "arj - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ARJ_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ARJ_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\arj.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "arj - Win32 Release" -# Name "arj - Win32 Debug" -# Begin Group "spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\ArjHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\ArjHandler.h -# End Source File -# Begin Source File - -SOURCE=.\ArjHeader.h -# End Source File -# Begin Source File - -SOURCE=.\ArjIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\ArjIn.h -# End Source File -# Begin Source File - -SOURCE=.\ArjItem.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Group "Codecs" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Arj\ArjDecoder1.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Arj\ArjDecoder1.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Arj\ArjDecoder2.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Arj\ArjDecoder2.h -# End Source File -# End Group -# Begin Group "LZ" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.h -# End Source File -# End Group -# Begin Group "Copy" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# End Group -# Begin Group "7zip common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\MSBFDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.h -# End Source File -# Begin Source File - -SOURCE=..\Common\OutStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\OutStreamWithCRC.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\arj.ico -# End Source File -# End Target -# End Project diff --git a/7zip/Archive/Arj/Arj.dsw b/7zip/Archive/Arj/Arj.dsw deleted file mode 100755 index 7ce4bca5..00000000 --- a/7zip/Archive/Arj/Arj.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "arj"=.\arj.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Archive/Arj/ArjHandler.cpp b/7zip/Archive/Arj/ArjHandler.cpp deleted file mode 100755 index a61cc775..00000000 --- a/7zip/Archive/Arj/ArjHandler.cpp +++ /dev/null @@ -1,485 +0,0 @@ -// ArjHandler.cpp - -#include "StdAfx.h" - -#include "Common/Defs.h" -#include "Common/CRC.h" -#include "Common/StringConvert.h" -#include "Common/ComTry.h" - -#include "Windows/Time.h" -#include "Windows/PropVariant.h" - -#include "ArjHandler.h" - -#include "../../ICoder.h" - -#include "../../Common/StreamObjects.h" -#include "../../Common/ProgressUtils.h" -#include "../../Common/LimitedStreams.h" - -#include "../../Compress/Copy/CopyCoder.h" -#include "../../Compress/Arj/ArjDecoder1.h" -#include "../../Compress/Arj/ArjDecoder2.h" - -#include "../Common/ItemNameUtils.h" -#include "../Common/OutStreamWithCRC.h" - -using namespace NWindows; -using namespace NTime; - -namespace NArchive { -namespace NArj{ - -const wchar_t *kHostOS[] = -{ - L"MSDOS", - L"PRIMOS", - L"Unix", - L"AMIGA", - L"Mac", - L"OS/2", - L"APPLE GS", - L"Atari ST", - L"Next", - L"VAX VMS", - L"WIN95" -}; - - -const int kNumHostOSes = sizeof(kHostOS) / sizeof(kHostOS[0]); - -const wchar_t *kUnknownOS = L"Unknown"; - - -/* -enum // PropID -{ - kpidHostOS = kpidUserDefined, - kpidUnPackVersion, - kpidMethod, -}; -*/ - -STATPROPSTG kProperties[] = -{ - { NULL, kpidPath, VT_BSTR}, - { NULL, kpidIsFolder, VT_BOOL}, - { NULL, kpidSize, VT_UI8}, - { NULL, kpidPackedSize, VT_UI8}, - { NULL, kpidLastWriteTime, VT_FILETIME}, - { NULL, kpidAttributes, VT_UI4}, - - { NULL, kpidEncrypted, VT_BOOL}, - // { NULL, kpidCommented, VT_BOOL}, - - { NULL, kpidCRC, VT_UI4}, - - { NULL, kpidMethod, VT_UI1}, - { NULL, kpidHostOS, VT_BSTR} - - // { L"UnPack Version", kpidUnPackVersion, VT_UI1}, - // { L"Method", kpidMethod, VT_UI1}, - // { L"Host OS", kpidHostOS, VT_BSTR} -}; - - -CHandler::CHandler() -{} - -STDMETHODIMP CHandler::GetArchiveProperty(PROPID /* propID */, PROPVARIANT *value) -{ - value->vt = VT_EMPTY; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties) -{ - *numProperties = sizeof(kProperties) / sizeof(kProperties[0]); - return S_OK; -} - -STDMETHODIMP CHandler::GetPropertyInfo(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) -{ - if(index >= sizeof(kProperties) / sizeof(kProperties[0])) - return E_INVALIDARG; - const STATPROPSTG &srcItem = kProperties[index]; - *propID = srcItem.propid; - *varType = srcItem.vt; - *name = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) -{ - *numProperties = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetArchivePropertyInfo(UInt32 /* index */, - BSTR * /* name */, PROPID * /* propID */, VARTYPE * /* varType */) -{ - return E_NOTIMPL; -} - -STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems) -{ - *numItems = _items.Size(); - return S_OK; -} - -STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) -{ - COM_TRY_BEGIN - NWindows::NCOM::CPropVariant propVariant; - const CItemEx &item = _items[index]; - switch(propID) - { - case kpidPath: - propVariant = - NItemName::GetOSName(MultiByteToUnicodeString(item.Name, CP_OEMCP)); - /* - NItemName::GetOSName2( - MultiByteToUnicodeString(item.Name, item.GetCodePage())); - */ - break; - case kpidIsFolder: - propVariant = item.IsDirectory(); - break; - case kpidSize: - propVariant = item.Size; - break; - case kpidPackedSize: - propVariant = item.PackSize; - break; - case kpidLastWriteTime: - { - FILETIME localFileTime, utcFileTime; - if (DosTimeToFileTime(item.ModifiedTime, localFileTime)) - { - if (!LocalFileTimeToFileTime(&localFileTime, &utcFileTime)) - utcFileTime.dwHighDateTime = utcFileTime.dwLowDateTime = 0; - } - else - utcFileTime.dwHighDateTime = utcFileTime.dwLowDateTime = 0; - propVariant = utcFileTime; - break; - } - case kpidAttributes: - propVariant = item.GetWinAttributes(); - break; - case kpidEncrypted: - propVariant = item.IsEncrypted(); - break; - /* - case kpidCommented: - propVariant = item.IsCommented(); - break; - */ - case kpidCRC: - propVariant = item.FileCRC; - break; - case kpidMethod: - propVariant = item.Method; - break; - case kpidHostOS: - propVariant = (item.HostOS < kNumHostOSes) ? - (kHostOS[item.HostOS]) : kUnknownOS; - break; - } - propVariant.Detach(value); - return S_OK; - COM_TRY_END -} - -/* -class CPropgressImp: public CProgressVirt -{ -public: - CMyComPtr Callback; - STDMETHOD(SetCompleted)(const UInt64 *numFiles); -}; - -STDMETHODIMP CPropgressImp::SetCompleted(const UInt64 *numFiles) -{ - if (Callback) - return Callback->SetCompleted(numFiles, NULL); - return S_OK; -} -*/ - -STDMETHODIMP CHandler::Open(IInStream *inStream, - const UInt64 *maxCheckStartPosition, IArchiveOpenCallback *callback) -{ - COM_TRY_BEGIN - try - { - _items.Clear(); - CInArchive archive; - if(!archive.Open(inStream, maxCheckStartPosition)) - return S_FALSE; - if (callback != NULL) - { - RINOK(callback->SetTotal(NULL, NULL)); - UInt64 numFiles = _items.Size(); - RINOK(callback->SetCompleted(&numFiles, NULL)); - } - for (;;) - { - CItemEx itemInfo; - bool filled; - HRESULT result = archive.GetNextItem(filled, itemInfo); - if (result == S_FALSE) - return S_FALSE; - if (result != S_OK) - return S_FALSE; - if (!filled) - break; - _items.Add(itemInfo); - archive.IncreaseRealPosition(itemInfo.PackSize); - if (callback != NULL) - { - UInt64 numFiles = _items.Size(); - RINOK(callback->SetCompleted(&numFiles, NULL)); - } - } - _stream = inStream; - } - catch(...) - { - return S_FALSE; - } - COM_TRY_END - return S_OK; -} - -STDMETHODIMP CHandler::Close() -{ - _items.Clear(); - _stream.Release(); - return S_OK; -} - - - -////////////////////////////////////// -// CHandler::DecompressItems - -STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, - Int32 testModeSpec, IArchiveExtractCallback *extractCallback) -{ - COM_TRY_BEGIN - bool testMode = (testModeSpec != 0); - UInt64 totalUnPacked = 0, totalPacked = 0; - bool allFilesMode = (numItems == UInt32(-1)); - if (allFilesMode) - numItems = _items.Size(); - if(numItems == 0) - return S_OK; - UInt32 i; - for(i = 0; i < numItems; i++) - { - const CItemEx &itemInfo = _items[allFilesMode ? i : indices[i]]; - totalUnPacked += itemInfo.Size; - totalPacked += itemInfo.PackSize; - } - extractCallback->SetTotal(totalUnPacked); - - UInt64 currentTotalUnPacked = 0, currentTotalPacked = 0; - UInt64 currentItemUnPacked, currentItemPacked; - - CMyComPtr arj1Decoder; - CMyComPtr arj2Decoder; - CMyComPtr copyCoder; - - for(i = 0; i < numItems; i++, currentTotalUnPacked += currentItemUnPacked, - currentTotalPacked += currentItemPacked) - { - currentItemUnPacked = 0; - currentItemPacked = 0; - - RINOK(extractCallback->SetCompleted(¤tTotalUnPacked)); - CMyComPtr realOutStream; - Int32 askMode; - askMode = testMode ? NArchive::NExtract::NAskMode::kTest : - NArchive::NExtract::NAskMode::kExtract; - Int32 index = allFilesMode ? i : indices[i]; - const CItemEx &itemInfo = _items[index]; - RINOK(extractCallback->GetStream(index, &realOutStream, askMode)); - - if(itemInfo.IsDirectory()) - { - // if (!testMode) - { - RINOK(extractCallback->PrepareOperation(askMode)); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - } - continue; - } - - if (!testMode && (!realOutStream)) - continue; - - RINOK(extractCallback->PrepareOperation(askMode)); - currentItemUnPacked = itemInfo.Size; - currentItemPacked = itemInfo.PackSize; - - { - COutStreamWithCRC *outStreamSpec = new COutStreamWithCRC; - CMyComPtr outStream(outStreamSpec); - outStreamSpec->SetStream(realOutStream); - outStreamSpec->Init(); - realOutStream.Release(); - - CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream; - CMyComPtr inStream(streamSpec); - - UInt64 pos; - _stream->Seek(itemInfo.DataPosition, STREAM_SEEK_SET, &pos); - - streamSpec->SetStream(_stream); - streamSpec->Init(itemInfo.PackSize); - - - CLocalProgress *localProgressSpec = new CLocalProgress; - CMyComPtr progress = localProgressSpec; - localProgressSpec->Init(extractCallback, false); - - - CLocalCompressProgressInfo *localCompressProgressSpec = - new CLocalCompressProgressInfo; - CMyComPtr compressProgress = localCompressProgressSpec; - localCompressProgressSpec->Init(progress, - ¤tTotalPacked, - ¤tTotalUnPacked); - - if (itemInfo.IsEncrypted()) - { - RINOK(extractCallback->SetOperationResult( - NArchive::NExtract::NOperationResult::kUnSupportedMethod)); - continue; - } - - HRESULT result; - - switch(itemInfo.Method) - { - case NFileHeader::NCompressionMethod::kStored: - { - if(!copyCoder) - copyCoder = new NCompress::CCopyCoder; - try - { - if (itemInfo.IsEncrypted()) - { - RINOK(extractCallback->SetOperationResult( - NArchive::NExtract::NOperationResult::kUnSupportedMethod)); - continue; - } - else - { - result = copyCoder->Code(inStream, outStream, - NULL, NULL, compressProgress); - } - if (result == S_FALSE) - throw "data error"; - if (result != S_OK) - return result; - } - catch(...) - { - outStream.Release(); - RINOK(extractCallback->SetOperationResult( - NArchive::NExtract::NOperationResult::kDataError)); - continue; - } - break; - } - case NFileHeader::NCompressionMethod::kCompressed1a: - case NFileHeader::NCompressionMethod::kCompressed1b: - case NFileHeader::NCompressionMethod::kCompressed1c: - { - if(!arj1Decoder) - { - arj1Decoder = new NCompress::NArj::NDecoder1::CCoder; - } - try - { - if (itemInfo.IsEncrypted()) - { - RINOK(extractCallback->SetOperationResult( - NArchive::NExtract::NOperationResult::kUnSupportedMethod)); - continue; - } - else - { - result = arj1Decoder->Code(inStream, outStream, - NULL, ¤tItemUnPacked, compressProgress); - } - if (result == S_FALSE) - throw "data error"; - if (result != S_OK) - return result; - } - catch(...) - { - outStream.Release(); - RINOK(extractCallback->SetOperationResult( - NArchive::NExtract::NOperationResult::kDataError)); - continue; - } - break; - } - case NFileHeader::NCompressionMethod::kCompressed2: - { - if(!arj2Decoder) - { - arj2Decoder = new NCompress::NArj::NDecoder2::CCoder; - } - try - { - if (itemInfo.IsEncrypted()) - { - RINOK(extractCallback->SetOperationResult( - NArchive::NExtract::NOperationResult::kUnSupportedMethod)); - continue; - } - else - { - result = arj2Decoder->Code(inStream, outStream, - NULL, ¤tItemUnPacked, compressProgress); - } - if (result == S_FALSE) - throw "data error"; - if (result != S_OK) - return result; - } - catch(...) - { - outStream.Release(); - RINOK(extractCallback->SetOperationResult( - NArchive::NExtract::NOperationResult::kDataError)); - continue; - } - break; - } - default: - RINOK(extractCallback->SetOperationResult( - NArchive::NExtract::NOperationResult::kUnSupportedMethod)); - continue; - } - bool crcOK = outStreamSpec->GetCRC() == itemInfo.FileCRC; - outStream.Release(); - if(crcOK) - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)) - else - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kCRCError)) - } - } - return S_OK; - COM_TRY_END -} - - -}} diff --git a/7zip/Archive/Arj/ArjHandler.h b/7zip/Archive/Arj/ArjHandler.h deleted file mode 100755 index a1e69ba6..00000000 --- a/7zip/Archive/Arj/ArjHandler.h +++ /dev/null @@ -1,47 +0,0 @@ -// ArjHandler.h - -#ifndef __ARJ_HANDLER_H -#define __ARJ_HANDLER_H - -#include "Common/MyCom.h" -#include "../IArchive.h" -#include "ArjIn.h" - -namespace NArchive { -namespace NArj { - -class CHandler: - public IInArchive, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP - - STDMETHOD(Open)(IInStream *inStream, - const UInt64 *maxCheckStartPosition, - IArchiveOpenCallback *callback); - STDMETHOD(Close)(); - STDMETHOD(GetNumberOfItems)(UInt32 *numItems); - STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value); - STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems, - Int32 testMode, IArchiveExtractCallback *anExtractCallback); - - STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value); - - STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties); - STDMETHOD(GetPropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - - STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties); - STDMETHOD(GetArchivePropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - - CHandler(); -private: - CObjectVector _items; - CMyComPtr _stream; -}; - -}} - -#endif diff --git a/7zip/Archive/Arj/ArjHeader.h b/7zip/Archive/Arj/ArjHeader.h deleted file mode 100755 index 58ee8c27..00000000 --- a/7zip/Archive/Arj/ArjHeader.h +++ /dev/null @@ -1,121 +0,0 @@ -// Archive/Arj/Header.h - -#ifndef __ARCHIVE_ARJ_HEADER_H -#define __ARCHIVE_ARJ_HEADER_H - -#include "Common/Types.h" - -namespace NArchive { -namespace NArj { - -const int kMaxBlockSize = 2600; - -namespace NSignature -{ - const Byte kSig0 = 0x60; - const Byte kSig1 = 0xEA; -} - -/* -struct CArchiveHeader -{ - // UInt16 BasicHeaderSize; - Byte FirstHeaderSize; - Byte Version; - Byte ExtractVersion; - Byte HostOS; - Byte Flags; - Byte SecuryVersion; - Byte FileType; - Byte Reserved; - UInt32 CreatedTime; - UInt32 ModifiedTime; - UInt32 ArchiveSize; - UInt32 SecurityEnvelopeFilePosition; - UInt16 FilespecPositionInFilename; - UInt16 LengthOfSecurityEnvelopeSata; - Byte EncryptionVersion; - Byte LastChapter; -}; -*/ - -namespace NFileHeader -{ - namespace NCompressionMethod - { - enum EType - { - kStored = 0, - kCompressed1a = 1, - kCompressed1b = 2, - kCompressed1c = 3, - kCompressed2 = 4, - kNoDataNoCRC = 8, - kNoData = 9, - }; - } - namespace NFileType - { - enum EType - { - kBinary = 0, - k7BitText = 1, - kDirectory = 3, - kVolumeLablel = 4, - kChapterLabel = 5, - }; - } - namespace NFlags - { - const Byte kGarbled = 1; - const Byte kVolume = 4; - const Byte kExtFile = 8; - const Byte kPathSym = 0x10; - const Byte kBackup= 0x20; - } - - /* - struct CHeader - { - Byte FirstHeaderSize; - Byte Version; - Byte ExtractVersion; - Byte HostOS; - Byte Flags; - Byte Method; - Byte FileType; - Byte Reserved; - UInt32 ModifiedTime; - UInt32 PackSize; - UInt32 Size; - UInt32 FileCRC; - UInt16 FilespecPositionInFilename; - UInt16 FileAccessMode; - Byte FirstChapter; - Byte LastChapter; - }; - */ - - namespace NHostOS - { - enum EEnum - { - kMSDOS = 0, // filesystem used by MS-DOS, OS/2, Win32 - // pkarj 2.50 (FAT / VFAT / FAT32 file systems) - kPRIMOS = 1, - kUnix = 2, // VAX/VMS - kAMIGA = 3, - kMac = 4, - kOS_2 = 5, // what if it's a minix filesystem? [cjh] - kAPPLE_GS = 6, // filesystem used by OS/2 (and NT 3.x) - kAtari_ST = 7, - kNext = 8, - kVAX_VMS = 9, - kWIN95 = 10 - }; - } -} - -}} - -#endif diff --git a/7zip/Archive/Arj/ArjIn.cpp b/7zip/Archive/Arj/ArjIn.cpp deleted file mode 100755 index 5d03ea65..00000000 --- a/7zip/Archive/Arj/ArjIn.cpp +++ /dev/null @@ -1,283 +0,0 @@ -// Archive/arj/InEngine.cpp - -#include "StdAfx.h" - -#include "Common/StringConvert.h" -#include "Common/Buffer.h" -#include "Common/CRC.h" - -#include "../../Common/StreamUtils.h" - -#include "ArjIn.h" - -namespace NArchive { -namespace NArj { - -HRESULT CInArchive::ReadBytes(void *data, UInt32 size, UInt32 *processedSize) -{ - UInt32 realProcessedSize; - HRESULT result = ReadStream(_stream, data, size, &realProcessedSize); - if(processedSize != NULL) - *processedSize = realProcessedSize; - IncreasePositionValue(realProcessedSize); - return result; -} - -static inline UInt16 GetUInt16FromMemLE(const Byte *p) -{ - return (UInt16)(p[0] | (((UInt16)p[1]) << 8)); -} - -static inline UInt32 GetUInt32FromMemLE(const Byte *p) -{ - return p[0] | (((UInt32)p[1]) << 8) | (((UInt32)p[2]) << 16) | (((UInt32)p[3]) << 24); -} - -inline bool TestMarkerCandidate(const void *testBytes, UInt32 maxSize) -{ - if (maxSize < 2 + 2 + 4) - return false; - const Byte *block = ((const Byte *)(testBytes)); - if (block[0] != NSignature::kSig0 || block[1] != NSignature::kSig1) - return false; - UInt32 blockSize = GetUInt16FromMemLE(block + 2); - if (maxSize < 2 + 2 + blockSize + 4) - return false; - block += 4; - if (blockSize == 0 || blockSize > 2600) - return false; - UInt32 crcFromFile = GetUInt32FromMemLE(block + blockSize); - return (CCRC::VerifyDigest(crcFromFile, block, blockSize)); -} - -bool CInArchive::FindAndReadMarker(const UInt64 *searchHeaderSizeLimit) -{ - // _archiveInfo.StartPosition = 0; - _position = _streamStartPosition; - if(_stream->Seek(_streamStartPosition, STREAM_SEEK_SET, NULL) != S_OK) - return false; - - const int kMarkerSizeMax = 2 + 2 + kMaxBlockSize + 4; - - CByteBuffer byteBuffer; - static const UInt32 kSearchMarkerBufferSize = 0x10000; - byteBuffer.SetCapacity(kSearchMarkerBufferSize); - Byte *buffer = byteBuffer; - - UInt32 processedSize; - ReadBytes(buffer, kMarkerSizeMax, &processedSize); - if (processedSize == 0) - return false; - if (TestMarkerCandidate(buffer, processedSize)) - { - _position = _streamStartPosition; - if(_stream->Seek(_position, STREAM_SEEK_SET, NULL) != S_OK) - return false; - return true; - } - - UInt32 numBytesPrev = processedSize - 1; - memmove(buffer, buffer + 1, numBytesPrev); - UInt64 curTestPos = _streamStartPosition + 1; - for (;;) - { - if (searchHeaderSizeLimit != NULL) - if (curTestPos - _streamStartPosition > *searchHeaderSizeLimit) - return false; - UInt32 numReadBytes = kSearchMarkerBufferSize - numBytesPrev; - ReadBytes(buffer + numBytesPrev, numReadBytes, &processedSize); - UInt32 numBytesInBuffer = numBytesPrev + processedSize; - if (numBytesInBuffer < 1) - return false; - UInt32 numTests = numBytesInBuffer; - for(UInt32 pos = 0; pos < numTests; pos++, curTestPos++) - { - if (TestMarkerCandidate(buffer + pos, numBytesInBuffer - pos)) - { - // _archiveInfo.StartPosition = curTestPos; - _position = curTestPos; - if(_stream->Seek(_position, STREAM_SEEK_SET, NULL) != S_OK) - return false; - return true; - } - } - numBytesPrev = numBytesInBuffer - numTests; - memmove(buffer, buffer + numTests, numBytesPrev); - } -} - -void CInArchive::IncreasePositionValue(UInt64 addValue) -{ - _position += addValue; -} - -void CInArchive::IncreaseRealPosition(UInt64 addValue) -{ - if(_stream->Seek(addValue, STREAM_SEEK_CUR, &_position) != S_OK) - throw CInArchiveException(CInArchiveException::kSeekStreamError); -} - -bool CInArchive::ReadBytesAndTestSize(void *data, UInt32 size) -{ - UInt32 realProcessedSize; - if(ReadBytes(data, size, &realProcessedSize) != S_OK) - throw CInArchiveException(CInArchiveException::kReadStreamError); - return (realProcessedSize == size); -} - -void CInArchive::SafeReadBytes(void *data, UInt32 size) -{ - if(!ReadBytesAndTestSize(data, size)) - throw CInArchiveException(CInArchiveException::kUnexpectedEndOfArchive); -} - -Byte CInArchive::SafeReadByte() -{ - Byte b; - SafeReadBytes(&b, 1); - return b; -} - -UInt16 CInArchive::SafeReadUInt16() -{ - UInt16 value = 0; - for (int i = 0; i < 2; i++) - { - Byte b = SafeReadByte(); - value |= (UInt16(b) << (8 * i)); - } - return value; -} - -UInt32 CInArchive::SafeReadUInt32() -{ - UInt32 value = 0; - for (int i = 0; i < 4; i++) - { - Byte b = SafeReadByte(); - value |= (UInt32(b) << (8 * i)); - } - return value; -} - -bool CInArchive::ReadBlock() -{ - _blockPos = 0; - _blockSize = SafeReadUInt16(); - if (_blockSize == 0 || _blockSize > kMaxBlockSize) - return false; - SafeReadBytes(_block, _blockSize); - UInt32 crcFromFile = SafeReadUInt32(); - if (!CCRC::VerifyDigest(crcFromFile, _block, _blockSize)) - throw CInArchiveException(CInArchiveException::kCRCError); - return true; -} - -bool CInArchive::ReadBlock2() -{ - Byte id[2]; - ReadBytesAndTestSize(id, 2); - if (id[0] != NSignature::kSig0 || id[1] != NSignature::kSig1) - throw CInArchiveException(CInArchiveException::kIncorrectArchive); - return ReadBlock(); -} - -bool CInArchive::Open(IInStream *inStream, const UInt64 *searchHeaderSizeLimit) -{ - _stream = inStream; - if(_stream->Seek(0, STREAM_SEEK_CUR, &_streamStartPosition) != S_OK) - return false; - _position = _streamStartPosition; - if (!FindAndReadMarker(searchHeaderSizeLimit)) - return false; - if (!ReadBlock2()) - return false; - for (;;) - if (!ReadBlock()) - break; - return true; -} - -void CInArchive::Close() -{ - _stream.Release(); -} - -void CInArchive::ThrowIncorrectArchiveException() -{ - throw CInArchiveException(CInArchiveException::kIncorrectArchive); -} - -Byte CInArchive::ReadByte() -{ - if (_blockPos >= _blockSize) - ThrowIncorrectArchiveException(); - return _block[_blockPos++]; -} - -UInt16 CInArchive::ReadUInt16() -{ - UInt16 value = 0; - for (int i = 0; i < 2; i++) - { - Byte b = ReadByte(); - value |= (UInt16(b) << (8 * i)); - } - return value; -} - -UInt32 CInArchive::ReadUInt32() -{ - UInt32 value = 0; - for (int i = 0; i < 4; i++) - { - Byte b = ReadByte(); - value |= (UInt32(b) << (8 * i)); - } - return value; -} - -HRESULT CInArchive::GetNextItem(bool &filled, CItemEx &item) -{ - filled = false; - if (!ReadBlock2()) - return S_OK; - - Byte firstHeaderSize = ReadByte(); - item.Version = ReadByte(); - item.ExtractVersion = ReadByte(); - item.HostOS = ReadByte(); - item.Flags = ReadByte(); - item.Method = ReadByte(); - item.FileType = ReadByte(); - ReadByte(); // Reserved - item.ModifiedTime = ReadUInt32(); - item.PackSize = ReadUInt32(); - item.Size = ReadUInt32(); - item.FileCRC = ReadUInt32(); - ReadUInt16(); // FilespecPositionInFilename - item.FileAccessMode = ReadUInt16(); - ReadByte(); // FirstChapter - ReadByte(); // LastChapter - - /* - UInt32 extraData; - if ((header.Flags & NFileHeader::NFlags::kExtFile) != 0) - extraData = GetUInt32FromMemLE(_block + pos); - */ - _blockPos = firstHeaderSize; - - for (; _blockPos < _blockSize;) - item.Name += (char)ReadByte(); - - for (;;) - if (!ReadBlock()) - break; - - item.DataPosition = _position; - - filled = true; - return S_OK; -} - -}} diff --git a/7zip/Archive/Arj/ArjIn.h b/7zip/Archive/Arj/ArjIn.h deleted file mode 100755 index b73d7dba..00000000 --- a/7zip/Archive/Arj/ArjIn.h +++ /dev/null @@ -1,75 +0,0 @@ -// Archive/ArjIn.h - -#ifndef __ARCHIVE_ARJIN_H -#define __ARCHIVE_ARJIN_H - -#include "Common/MyCom.h" -#include "../../IStream.h" - -#include "ArjItem.h" - -namespace NArchive { -namespace NArj { - -class CInArchiveException -{ -public: - enum CCauseType - { - kUnexpectedEndOfArchive = 0, - kCRCError, - kIncorrectArchive, - kReadStreamError, - kSeekStreamError - } - Cause; - CInArchiveException(CCauseType cause): Cause(cause) {}; -}; - -class CProgressVirt -{ -public: - STDMETHOD(SetCompleted)(const UInt64 *numFiles) PURE; -}; - -class CInArchive -{ - CMyComPtr _stream; - UInt64 _streamStartPosition; - UInt64 _position; - UInt16 _blockSize; - Byte _block[kMaxBlockSize]; - UInt32 _blockPos; - - - bool FindAndReadMarker(const UInt64 *searchHeaderSizeLimit); - - bool ReadBlock(); - bool ReadBlock2(); - - Byte ReadByte(); - UInt16 ReadUInt16(); - UInt32 ReadUInt32(); - - HRESULT ReadBytes(void *data, UInt32 size, UInt32 *processedSize); - bool ReadBytesAndTestSize(void *data, UInt32 size); - void SafeReadBytes(void *data, UInt32 size); - Byte SafeReadByte(); - UInt16 SafeReadUInt16(); - UInt32 SafeReadUInt32(); - - void IncreasePositionValue(UInt64 addValue); - void ThrowIncorrectArchiveException(); - -public: - HRESULT GetNextItem(bool &filled, CItemEx &item); - - bool Open(IInStream *inStream, const UInt64 *searchHeaderSizeLimit); - void Close(); - - void IncreaseRealPosition(UInt64 addValue); -}; - -}} - -#endif diff --git a/7zip/Archive/Arj/ArjItem.h b/7zip/Archive/Arj/ArjItem.h deleted file mode 100755 index d48fe38d..00000000 --- a/7zip/Archive/Arj/ArjItem.h +++ /dev/null @@ -1,75 +0,0 @@ -// Archive/ArjItem.h - -#ifndef __ARCHIVE_ARJ_ITEM_H -#define __ARCHIVE_ARJ_ITEM_H - -#include "Common/Types.h" -#include "Common/String.h" -#include "ArjHeader.h" - -namespace NArchive { -namespace NArj { - -struct CVersion -{ - Byte Version; - Byte HostOS; -}; - -inline bool operator==(const CVersion &v1, const CVersion &v2) - { return (v1.Version == v2.Version) && (v1.HostOS == v2.HostOS); } -inline bool operator!=(const CVersion &v1, const CVersion &v2) - { return !(v1 == v2); } - -class CItem -{ -public: - Byte Version; - Byte ExtractVersion; - Byte HostOS; - Byte Flags; - Byte Method; - Byte FileType; - UInt32 ModifiedTime; - UInt32 PackSize; - UInt32 Size; - UInt32 FileCRC; - - // UInt16 FilespecPositionInFilename; - UInt16 FileAccessMode; - // Byte FirstChapter; - // Byte LastChapter; - - AString Name; - - bool IsEncrypted() const { return (Flags & NFileHeader::NFlags::kGarbled) != 0; } - bool IsDirectory() const { return (FileType == NFileHeader::NFileType::kDirectory); } - UInt32 GetWinAttributes() const - { - UInt32 winAtrributes; - switch(HostOS) - { - case NFileHeader::NHostOS::kMSDOS: - case NFileHeader::NHostOS::kWIN95: - winAtrributes = FileAccessMode; - break; - default: - winAtrributes = 0; - } - if (IsDirectory()) - winAtrributes |= FILE_ATTRIBUTE_DIRECTORY; - return winAtrributes; - } -}; - -class CItemEx: public CItem -{ -public: - UInt64 DataPosition; -}; - -}} - -#endif - - diff --git a/7zip/Archive/Arj/DllExports.cpp b/7zip/Archive/Arj/DllExports.cpp deleted file mode 100755 index 31fbc495..00000000 --- a/7zip/Archive/Arj/DllExports.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "../../ICoder.h" -#include "ArjHandler.h" - -// {23170F69-40C1-278A-1000-000110040000} -DEFINE_GUID(CLSID_CArjHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x04, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /*lpReserved*/) -{ - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CArjHandler) - return CLASS_E_CLASSNOTAVAILABLE; - if (*interfaceID != IID_IInArchive) - return E_NOINTERFACE; - CMyComPtr inArchive = (IInArchive *)new NArchive::NArj::CHandler; - *outObject = inArchive.Detach(); - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Arj"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CArjHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"arj"; - break; - case NArchive::kAddExtension: - propVariant = L".cpio.gz"; - break; - case NArchive::kUpdate: - propVariant = false; - break; - case NArchive::kKeepName: - propVariant = false; - break; - case NArchive::kStartSignature: - { - const unsigned char sig[] = { 0x60, 0xEA }; - if ((value->bstrVal = ::SysAllocStringByteLen((const char *)sig, 2)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - } - propVariant.Detach(value); - return S_OK; -} diff --git a/7zip/Archive/Arj/StdAfx.cpp b/7zip/Archive/Arj/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Archive/Arj/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Archive/Arj/StdAfx.h b/7zip/Archive/Arj/StdAfx.h deleted file mode 100755 index e7fb6986..00000000 --- a/7zip/Archive/Arj/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Archive/Arj/arj.ico b/7zip/Archive/Arj/arj.ico deleted file mode 100755 index c0f8b141..00000000 Binary files a/7zip/Archive/Arj/arj.ico and /dev/null differ diff --git a/7zip/Archive/Arj/makefile b/7zip/Archive/Arj/makefile deleted file mode 100755 index 2609998b..00000000 --- a/7zip/Archive/Arj/makefile +++ /dev/null @@ -1,66 +0,0 @@ -PROG = arj.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib user32.lib - -ARJ_OBJS = \ - $O\DllExports.obj \ - $O\ArjHandler.obj \ - $O\ArjIn.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\CRC.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\Vector.obj \ - -WIN_OBJS = \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\InBuffer.obj \ - $O\LimitedStreams.obj \ - $O\OutBuffer.obj \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\ItemNameUtils.obj \ - $O\OutStreamWithCRC.obj \ - -COMPRESS_ARJ_OBJS = \ - $O\ArjDecoder1.obj \ - $O\ArjDecoder2.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(ARJ_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(COMPRESS_ARJ_OBJS) \ - $O\CopyCoder.obj \ - $O\LZOutWindow.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(ARJ_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$(COMPRESS_ARJ_OBJS): ../../Compress/Arj/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) -$O\LZOutWindow.obj: ../../Compress/LZ/$(*B).cpp - $(COMPL) diff --git a/7zip/Archive/Arj/resource.rc b/7zip/Archive/Arj/resource.rc deleted file mode 100755 index 5158e405..00000000 --- a/7zip/Archive/Arj/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Arj Plugin", "arj") - -101 ICON "arj.ico" diff --git a/7zip/Archive/BZip2/BZip2.dsp b/7zip/Archive/BZip2/BZip2.dsp deleted file mode 100755 index 1d14aedb..00000000 --- a/7zip/Archive/BZip2/BZip2.dsp +++ /dev/null @@ -1,281 +0,0 @@ -# Microsoft Developer Studio Project File - Name="BZip2" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=BZip2 - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "BZip2.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "BZip2.mak" CFG="BZip2 - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "BZip2 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "BZip2 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "BZip2 - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZIP2_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZIP2_EXPORTS" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\bz2.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "BZip2 - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZIP2_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZIP2_EXPORTS" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\bz2.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "BZip2 - Win32 Release" -# Name "BZip2 - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\BZip2.ico -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Compression" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\CodecsPath.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\CodecsPath.h -# End Source File -# Begin Source File - -SOURCE=..\Common\CoderLoader.h -# End Source File -# Begin Source File - -SOURCE=..\Common\DummyOutStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\DummyOutStream.h -# End Source File -# Begin Source File - -SOURCE=..\Common\ParseProperties.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ParseProperties.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\BZip2Handler.cpp -# End Source File -# Begin Source File - -SOURCE=.\BZip2Handler.h -# End Source File -# Begin Source File - -SOURCE=.\BZip2HandlerOut.cpp -# End Source File -# Begin Source File - -SOURCE=.\BZip2Item.h -# End Source File -# Begin Source File - -SOURCE=.\BZip2Update.cpp -# End Source File -# Begin Source File - -SOURCE=.\BZip2Update.h -# End Source File -# End Group -# Begin Group "7zip common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\bz2.ico -# End Source File -# End Target -# End Project diff --git a/7zip/Archive/BZip2/BZip2.dsw b/7zip/Archive/BZip2/BZip2.dsw deleted file mode 100755 index 697e5095..00000000 --- a/7zip/Archive/BZip2/BZip2.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "BZip2"=.\BZip2.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Archive/BZip2/BZip2Handler.cpp b/7zip/Archive/BZip2/BZip2Handler.cpp deleted file mode 100755 index e1065f4f..00000000 --- a/7zip/Archive/BZip2/BZip2Handler.cpp +++ /dev/null @@ -1,285 +0,0 @@ -// BZip2Handler.cpp - -#include "StdAfx.h" - -#include "BZip2Handler.h" - -#include "Common/Defs.h" - -#include "../../Common/ProgressUtils.h" -#include "../../Common/StreamUtils.h" - -#include "Windows/PropVariant.h" -#include "Windows/Defs.h" -#include "Common/ComTry.h" - -#include "../Common/DummyOutStream.h" - -#ifdef COMPRESS_BZIP2 -#include "../../Compress/BZip2/BZip2Decoder.h" -#else -// {23170F69-40C1-278B-0402-020000000000} -DEFINE_GUID(CLSID_CCompressBZip2Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00); -#include "../Common/CoderLoader.h" -extern CSysString GetBZip2CodecPath(); -#endif - -using namespace NWindows; - -namespace NArchive { -namespace NBZip2 { - -STATPROPSTG kProperties[] = -{ - { NULL, kpidPath, VT_BSTR}, - // { NULL, kpidIsFolder, VT_BOOL}, - // { NULL, kpidSize, VT_UI8}, - { NULL, kpidPackedSize, VT_UI8}, -}; - -STDMETHODIMP CHandler::GetArchiveProperty(PROPID /* propID */, PROPVARIANT *value) -{ - value->vt = VT_EMPTY; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties) -{ - *numProperties = sizeof(kProperties) / sizeof(kProperties[0]); - return S_OK; -} - -STDMETHODIMP CHandler::GetPropertyInfo(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) -{ - if(index >= sizeof(kProperties) / sizeof(kProperties[0])) - return E_INVALIDARG; - const STATPROPSTG &srcItem = kProperties[index]; - *propID = srcItem.propid; - *varType = srcItem.vt; - *name = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) -{ - *numProperties = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetArchivePropertyInfo(UInt32 /* index */, - BSTR * /* name */, PROPID * /* propID */, VARTYPE * /* varType */) -{ - return E_INVALIDARG; -} - -STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems) -{ - *numItems = 1; - return S_OK; -} - -STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) -{ - COM_TRY_BEGIN - NWindows::NCOM::CPropVariant propVariant; - if (index != 0) - return E_INVALIDARG; - switch(propID) - { - case kpidIsFolder: - propVariant = false; - break; - case kpidPackedSize: - propVariant = _item.PackSize; - break; - } - propVariant.Detach(value); - return S_OK; - COM_TRY_END -} - -STDMETHODIMP CHandler::Open(IInStream *stream, - const UInt64 * /* maxCheckStartPosition */, - IArchiveOpenCallback * /* openArchiveCallback */) -{ - COM_TRY_BEGIN - try - { - RINOK(stream->Seek(0, STREAM_SEEK_CUR, &_streamStartPosition)); - const int kSignatureSize = 3; - Byte buffer[kSignatureSize]; - UInt32 processedSize; - RINOK(ReadStream(stream, buffer, kSignatureSize, &processedSize)); - if (processedSize != kSignatureSize) - return S_FALSE; - if (buffer[0] != 'B' || buffer[1] != 'Z' || buffer[2] != 'h') - return S_FALSE; - - UInt64 endPosition; - RINOK(stream->Seek(0, STREAM_SEEK_END, &endPosition)); - _item.PackSize = endPosition - _streamStartPosition; - - _stream = stream; - } - catch(...) - { - return S_FALSE; - } - return S_OK; - COM_TRY_END -} - -STDMETHODIMP CHandler::Close() -{ - _stream.Release(); - return S_OK; -} - - -STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, - Int32 testModeSpec, IArchiveExtractCallback *extractCallback) -{ - COM_TRY_BEGIN - bool allFilesMode = (numItems == UInt32(-1)); - if (!allFilesMode) - { - if (numItems == 0) - return S_OK; - if (numItems != 1) - return E_INVALIDARG; - if (indices[0] != 0) - return E_INVALIDARG; - } - - bool testMode = (testModeSpec != 0); - - extractCallback->SetTotal(_item.PackSize); - - UInt64 currentTotalPacked = 0, currentTotalUnPacked = 0; - - RINOK(extractCallback->SetCompleted(¤tTotalPacked)); - - CMyComPtr realOutStream; - Int32 askMode; - askMode = testMode ? NArchive::NExtract::NAskMode::kTest : - NArchive::NExtract::NAskMode::kExtract; - - RINOK(extractCallback->GetStream(0, &realOutStream, askMode)); - - if(!testMode && !realOutStream) - return S_OK; - - - extractCallback->PrepareOperation(askMode); - - #ifndef COMPRESS_BZIP2 - CCoderLibrary lib; - #endif - CMyComPtr decoder; - #ifdef COMPRESS_BZIP2 - decoder = new NCompress::NBZip2::CDecoder; - #else - HRESULT loadResult = lib.LoadAndCreateCoder( - GetBZip2CodecPath(), - CLSID_CCompressBZip2Decoder, &decoder); - if (loadResult != S_OK) - { - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kUnSupportedMethod)); - return S_OK; - } - #endif - - #ifdef COMPRESS_MT - { - CMyComPtr setCoderMt; - decoder.QueryInterface(IID_ICompressSetCoderMt, &setCoderMt); - if (setCoderMt) - { - RINOK(setCoderMt->SetNumberOfThreads(_numThreads)); - } - } - #endif - - CDummyOutStream *outStreamSpec = new CDummyOutStream; - CMyComPtr outStream(outStreamSpec); - outStreamSpec->Init(realOutStream); - - realOutStream.Release(); - - CLocalProgress *localProgressSpec = new CLocalProgress; - CMyComPtr progress = localProgressSpec; - localProgressSpec->Init(extractCallback, true); - - CLocalCompressProgressInfo *localCompressProgressSpec = - new CLocalCompressProgressInfo; - CMyComPtr compressProgress = localCompressProgressSpec; - - RINOK(_stream->Seek(_streamStartPosition, STREAM_SEEK_SET, NULL)); - - - HRESULT result = S_OK; - - bool firstItem = true; - for (;;) - { - localCompressProgressSpec->Init(progress, - ¤tTotalPacked, - ¤tTotalUnPacked); - - const int kSignatureSize = 3; - Byte buffer[kSignatureSize]; - UInt32 processedSize; - RINOK(ReadStream(_stream, buffer, kSignatureSize, &processedSize)); - if (processedSize < kSignatureSize) - { - if (firstItem) - return E_FAIL; - break; - } - if (buffer[0] != 'B' || buffer[1] != 'Z' || buffer[2] != 'h') - { - if (firstItem) - return E_FAIL; - outStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)) - return S_OK; - } - firstItem = false; - - UInt64 dataStartPos; - RINOK(_stream->Seek((UInt64)(Int64)(-3), STREAM_SEEK_CUR, &dataStartPos)); - - result = decoder->Code(_stream, outStream, NULL, NULL, compressProgress); - - if (result != S_OK) - break; - - CMyComPtr getInStreamProcessedSize; - decoder.QueryInterface(IID_ICompressGetInStreamProcessedSize, - &getInStreamProcessedSize); - if (!getInStreamProcessedSize) - break; - - UInt64 packSize; - RINOK(getInStreamProcessedSize->GetInStreamProcessedSize(&packSize)); - UInt64 pos; - RINOK(_stream->Seek(dataStartPos + packSize, STREAM_SEEK_SET, &pos)); - currentTotalPacked = pos - _streamStartPosition; - } - outStream.Release(); - - int retResult; - if (result == S_OK) - retResult = NArchive::NExtract::NOperationResult::kOK; - else - retResult = NArchive::NExtract::NOperationResult::kDataError; - - RINOK(extractCallback->SetOperationResult(retResult)); - - return S_OK; - COM_TRY_END -} - -}} diff --git a/7zip/Archive/BZip2/BZip2Handler.h b/7zip/Archive/BZip2/BZip2Handler.h deleted file mode 100755 index 7977334e..00000000 --- a/7zip/Archive/BZip2/BZip2Handler.h +++ /dev/null @@ -1,83 +0,0 @@ -// BZip2/Handler.h - -#ifndef __BZIP2_HANDLER_H -#define __BZIP2_HANDLER_H - -#include "Common/MyCom.h" -#include "../IArchive.h" -#include "BZip2Item.h" - -#ifdef COMPRESS_MT -#include "../../../Windows/System.h" -#endif - -namespace NArchive { -namespace NBZip2 { - -class CHandler: - public IInArchive, - public IOutArchive, - public ISetProperties, - public CMyUnknownImp -{ - CMyComPtr _stream; - NArchive::NBZip2::CItem _item; - UInt64 _streamStartPosition; - - UInt32 _level; - UInt32 _dicSize; - UInt32 _numPasses; - #ifdef COMPRESS_MT - UInt32 _numThreads; - #endif - void InitMethodProperties() - { - _level = 5; - _dicSize = - _numPasses = 0xFFFFFFFF; - #ifdef COMPRESS_MT - _numThreads = NWindows::NSystem::GetNumberOfProcessors();; - #endif - } - -public: - MY_UNKNOWN_IMP3( - IInArchive, - IOutArchive, - ISetProperties - ) - - STDMETHOD(Open)(IInStream *stream, - const UInt64 *maxCheckStartPosition, - IArchiveOpenCallback *openArchiveCallback); - STDMETHOD(Close)(); - STDMETHOD(GetNumberOfItems)(UInt32 *numItems); - STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value); - STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems, - Int32 testMode, IArchiveExtractCallback *extractCallback); - - STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value); - - STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties); - STDMETHOD(GetPropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - - STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties); - STDMETHOD(GetArchivePropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - - // IOutArchiveHandler - - STDMETHOD(UpdateItems)(ISequentialOutStream *outStream, UInt32 numItems, - IArchiveUpdateCallback *updateCallback); - STDMETHOD(GetFileTimeType)(UInt32 *type); - - // ISetProperties - STDMETHOD(SetProperties)(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties); - - CHandler() { InitMethodProperties(); } -}; - -}} - -#endif diff --git a/7zip/Archive/BZip2/BZip2HandlerOut.cpp b/7zip/Archive/BZip2/BZip2HandlerOut.cpp deleted file mode 100755 index b5fc72a9..00000000 --- a/7zip/Archive/BZip2/BZip2HandlerOut.cpp +++ /dev/null @@ -1,156 +0,0 @@ -// BZip2HandlerOut.cpp - -#include "StdAfx.h" - -#include "BZip2Handler.h" -#include "BZip2Update.h" - -#include "Common/Defs.h" -#include "Common/String.h" - -#include "Windows/PropVariant.h" - -#include "../../Compress/Copy/CopyCoder.h" - -#include "../Common/ParseProperties.h" - -using namespace NWindows; - -static const UInt32 kNumPassesX1 = 1; -static const UInt32 kNumPassesX7 = 2; -static const UInt32 kNumPassesX9 = 7; - -static const UInt32 kDicSizeX1 = 100000; -static const UInt32 kDicSizeX3 = 500000; -static const UInt32 kDicSizeX5 = 900000; - -namespace NArchive { -namespace NBZip2 { - -STDMETHODIMP CHandler::GetFileTimeType(UInt32 *type) -{ - *type = NFileTimeType::kUnix; - return S_OK; -} - -static HRESULT CopyStreams(ISequentialInStream *inStream, ISequentialOutStream *outStream) -{ - CMyComPtr copyCoder = new NCompress::CCopyCoder; - return copyCoder->Code(inStream, outStream, NULL, NULL, NULL); -} - -STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numItems, - IArchiveUpdateCallback *updateCallback) -{ - if (numItems != 1) - return E_INVALIDARG; - - Int32 newData; - Int32 newProperties; - UInt32 indexInArchive; - if (!updateCallback) - return E_FAIL; - RINOK(updateCallback->GetUpdateItemInfo(0, - &newData, &newProperties, &indexInArchive)); - - if (IntToBool(newProperties)) - { - { - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(0, kpidIsFolder, &propVariant)); - if (propVariant.vt == VT_BOOL) - { - if (propVariant.boolVal != VARIANT_FALSE) - return E_INVALIDARG; - } - else if (propVariant.vt != VT_EMPTY) - return E_INVALIDARG; - } - } - - if (IntToBool(newData)) - { - UInt64 size; - { - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(0, kpidSize, &propVariant)); - if (propVariant.vt != VT_UI8) - return E_INVALIDARG; - size = propVariant.uhVal.QuadPart; - } - - UInt32 dicSize = _dicSize; - if (dicSize == 0xFFFFFFFF) - dicSize = (_level >= 5 ? kDicSizeX5 : - (_level >= 3 ? kDicSizeX3 : - kDicSizeX1)); - - UInt32 numPasses = _numPasses; - if (numPasses == 0xFFFFFFFF) - numPasses = (_level >= 9 ? kNumPassesX9 : - (_level >= 7 ? kNumPassesX7 : - kNumPassesX1)); - - return UpdateArchive(size, outStream, 0, dicSize, numPasses, - #ifdef COMPRESS_MT - _numThreads, - #endif - updateCallback); - } - if (indexInArchive != 0) - return E_INVALIDARG; - RINOK(_stream->Seek(_streamStartPosition, STREAM_SEEK_SET, NULL)); - return CopyStreams(_stream, outStream); -} - -STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties) -{ - InitMethodProperties(); - #ifdef COMPRESS_MT - const UInt32 numProcessors = NSystem::GetNumberOfProcessors(); - _numThreads = numProcessors; - #endif - - for (int i = 0; i < numProperties; i++) - { - UString name = UString(names[i]); - name.MakeUpper(); - if (name.IsEmpty()) - return E_INVALIDARG; - - const PROPVARIANT &prop = values[i]; - - if (name[0] == 'X') - { - UInt32 level = 9; - RINOK(ParsePropValue(name.Mid(1), prop, level)); - _level = level; - continue; - } - if (name[0] == 'D') - { - UInt32 dicSize = kDicSizeX5; - RINOK(ParsePropDictionaryValue(name.Mid(1), prop, dicSize)); - _dicSize = dicSize; - continue; - } - if (name.Left(4) == L"PASS") - { - UInt32 num = kNumPassesX9; - RINOK(ParsePropValue(name.Mid(4), prop, num)); - _numPasses = num; - continue; - } - if (name.Left(2) == L"MT") - { - #ifdef COMPRESS_MT - RINOK(ParseMtProp(name.Mid(2), prop, numProcessors, _numThreads)); - #endif - continue; - } - return E_INVALIDARG; - } - return S_OK; -} - -}} diff --git a/7zip/Archive/BZip2/BZip2Item.h b/7zip/Archive/BZip2/BZip2Item.h deleted file mode 100755 index d7508ab9..00000000 --- a/7zip/Archive/BZip2/BZip2Item.h +++ /dev/null @@ -1,20 +0,0 @@ -// Archive/BZip2Item.h - -#ifndef __ARCHIVE_BZIP2_ITEM_H -#define __ARCHIVE_BZIP2_ITEM_H - -namespace NArchive { -namespace NBZip2 { - -struct CItem -{ - UInt64 PackSize; - UInt64 UnPackSize; -}; - -}} - -#endif - - - diff --git a/7zip/Archive/BZip2/BZip2Update.cpp b/7zip/Archive/BZip2/BZip2Update.cpp deleted file mode 100755 index d9bdf963..00000000 --- a/7zip/Archive/BZip2/BZip2Update.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// BZip2Update.cpp - -#include "StdAfx.h" - -#include "../../Common/ProgressUtils.h" -#include "Windows/PropVariant.h" - -#include "BZip2Update.h" - -#ifdef COMPRESS_BZIP2 -#include "../../Compress/BZip2/BZip2Encoder.h" -#else -// {23170F69-40C1-278B-0402-020000000100} -DEFINE_GUID(CLSID_CCompressBZip2Encoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00); -#include "../Common/CoderLoader.h" -extern CSysString GetBZip2CodecPath(); -#endif - -namespace NArchive { -namespace NBZip2 { - -HRESULT UpdateArchive(UInt64 unpackSize, - ISequentialOutStream *outStream, - int indexInClient, - UInt32 dictionary, - UInt32 numPasses, - #ifdef COMPRESS_MT - UInt32 numThreads, - #endif - IArchiveUpdateCallback *updateCallback) -{ - RINOK(updateCallback->SetTotal(unpackSize)); - UInt64 complexity = 0; - RINOK(updateCallback->SetCompleted(&complexity)); - - CMyComPtr fileInStream; - - RINOK(updateCallback->GetStream(indexInClient, &fileInStream)); - - CLocalProgress *localProgressSpec = new CLocalProgress; - CMyComPtr localProgress = localProgressSpec; - localProgressSpec->Init(updateCallback, true); - - #ifndef COMPRESS_BZIP2 - CCoderLibrary lib; - #endif - CMyComPtr encoder; - #ifdef COMPRESS_BZIP2 - encoder = new NCompress::NBZip2::CEncoder; - #else - RINOK(lib.LoadAndCreateCoder(GetBZip2CodecPath(), - CLSID_CCompressBZip2Encoder, &encoder)); - #endif - - CMyComPtr setCoderProperties; - encoder.QueryInterface(IID_ICompressSetCoderProperties, &setCoderProperties); - if (setCoderProperties) - { - NWindows::NCOM::CPropVariant properties[] = - { - dictionary, - numPasses - #ifdef COMPRESS_MT - , numThreads - #endif - }; - PROPID propIDs[] = - { - NCoderPropID::kDictionarySize, - NCoderPropID::kNumPasses - #ifdef COMPRESS_MT - , NCoderPropID::kNumThreads - #endif - }; - RINOK(setCoderProperties->SetCoderProperties(propIDs, properties, sizeof(propIDs) / sizeof(propIDs[0]))); - } - - RINOK(encoder->Code(fileInStream, outStream, NULL, NULL, localProgress)); - - return updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK); -} - -}} diff --git a/7zip/Archive/BZip2/BZip2Update.h b/7zip/Archive/BZip2/BZip2Update.h deleted file mode 100755 index ce20e323..00000000 --- a/7zip/Archive/BZip2/BZip2Update.h +++ /dev/null @@ -1,24 +0,0 @@ -// BZip2Update.h - -#ifndef __BZIP2_UPDATE_H -#define __BZIP2_UPDATE_H - -#include "../IArchive.h" - -namespace NArchive { -namespace NBZip2 { - -HRESULT UpdateArchive( - UInt64 unpackSize, - ISequentialOutStream *outStream, - int indexInClient, - UInt32 dictionary, - UInt32 numPasses, - #ifdef COMPRESS_MT - UInt32 numThreads, - #endif - IArchiveUpdateCallback *updateCallback); - -}} - -#endif diff --git a/7zip/Archive/BZip2/DllExports.cpp b/7zip/Archive/BZip2/DllExports.cpp deleted file mode 100755 index 5a861318..00000000 --- a/7zip/Archive/BZip2/DllExports.cpp +++ /dev/null @@ -1,127 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "BZip2Handler.h" -#include "../../ICoder.h" - -// {23170F69-40C1-278B-0402-020000000100} -DEFINE_GUID(CLSID_CCompressBZip2Encoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00); - -// {23170F69-40C1-278B-0402-020000000000} -DEFINE_GUID(CLSID_CCompressBZip2Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278A-1000-000110020000} -DEFINE_GUID(CLSID_CBZip2Handler, -0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x02, 0x00, 0x00); - -HINSTANCE g_hInstance; -#ifndef _UNICODE -bool g_IsNT = false; -static bool IsItWindowsNT() -{ - OSVERSIONINFO versionInfo; - versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); - if (!::GetVersionEx(&versionInfo)) - return false; - return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT); -} -#endif - -#ifndef COMPRESS_BZIP2 -#include "../Common/CodecsPath.h" -CSysString GetBZip2CodecPath() -{ - return GetCodecsFolderPrefix() + TEXT("BZip2.dll"); -} -#endif - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - if (dwReason == DLL_PROCESS_ATTACH) - { - g_hInstance = hInstance; - #ifndef _UNICODE - g_IsNT = IsItWindowsNT(); - #endif - } - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CBZip2Handler) - return CLASS_E_CLASSNOTAVAILABLE; - int needIn = *interfaceID == IID_IInArchive; - int needOut = *interfaceID == IID_IOutArchive; - if (needIn || needOut) - { - NArchive::NBZip2::CHandler *temp = new NArchive::NBZip2::CHandler; - if (needIn) - { - CMyComPtr inArchive = (IInArchive *)temp; - *outObject = inArchive.Detach(); - } - else - { - CMyComPtr outArchive = (IOutArchive *)temp; - *outObject = outArchive.Detach(); - } - } - else - return E_NOINTERFACE; - COM_TRY_END - return S_OK; -} - - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"BZip2"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CBZip2Handler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"bz2 bzip2 tbz2 tbz"; - break; - case NArchive::kAddExtension: - propVariant = L"* * .tar .tar"; - break; - case NArchive::kUpdate: - propVariant = true; - break; - case NArchive::kKeepName: - propVariant = true; - break; - case NArchive::kStartSignature: - { - const char sig[] = { 'B', 'Z', 'h' }; - if ((value->bstrVal = ::SysAllocStringByteLen(sig, 3)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - - } - propVariant.Detach(value); - return S_OK; -} diff --git a/7zip/Archive/BZip2/StdAfx.cpp b/7zip/Archive/BZip2/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Archive/BZip2/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Archive/BZip2/StdAfx.h b/7zip/Archive/BZip2/StdAfx.h deleted file mode 100755 index e7fb6986..00000000 --- a/7zip/Archive/BZip2/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Archive/BZip2/bz2.ico b/7zip/Archive/BZip2/bz2.ico deleted file mode 100755 index 614e3540..00000000 Binary files a/7zip/Archive/BZip2/bz2.ico and /dev/null differ diff --git a/7zip/Archive/BZip2/makefile b/7zip/Archive/BZip2/makefile deleted file mode 100755 index 20f20bdb..00000000 --- a/7zip/Archive/BZip2/makefile +++ /dev/null @@ -1,55 +0,0 @@ -PROG = bz2.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -DCOMPRESS_MT -LIBS = $(LIBS) oleaut32.lib user32.lib - -BZ2_OBJS = \ - $O\BZip2Handler.obj \ - $O\BZip2HandlerOut.obj \ - $O\BZip2Update.obj \ - $O\DllExports.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\StringToInt.obj \ - -WIN_OBJS = \ - $O\DLL.obj \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\CodecsPath.obj \ - $O\DummyOutStream.obj \ - $O\ParseProperties.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(BZ2_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $O\CopyCoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(BZ2_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) diff --git a/7zip/Archive/BZip2/resource.rc b/7zip/Archive/BZip2/resource.rc deleted file mode 100755 index 2d4f27e3..00000000 --- a/7zip/Archive/BZip2/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("BZip2 Plugin", "bz2") - -101 ICON "bz2.ico" diff --git a/7zip/Archive/Cab/Cab.dsp b/7zip/Archive/Cab/Cab.dsp deleted file mode 100755 index 565661f6..00000000 --- a/7zip/Archive/Cab/Cab.dsp +++ /dev/null @@ -1,395 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Cab" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Cab - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Cab.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Cab.mak" CFG="Cab - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Cab - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Cab - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Cab - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CAB_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CAB_EXPORTS" /FAs /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\cab.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Cab - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CAB_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CAB_EXPORTS" /FAcs /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\cab.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Cab - Win32 Release" -# Name "Cab - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\UTFConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\UTFConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\CabBlockInStream.cpp -# End Source File -# Begin Source File - -SOURCE=.\CabBlockInStream.h -# End Source File -# Begin Source File - -SOURCE=.\CabHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\CabHandler.h -# End Source File -# Begin Source File - -SOURCE=.\CabHeader.cpp -# End Source File -# Begin Source File - -SOURCE=.\CabHeader.h -# End Source File -# Begin Source File - -SOURCE=.\CabIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\CabIn.h -# End Source File -# Begin Source File - -SOURCE=.\CabItem.h -# End Source File -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LSBFDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LSBFDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\MSBFDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Group "LZ" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.h -# End Source File -# End Group -# Begin Group "Lzx" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Lzx\Lzx.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Lzx\Lzx86Converter.cpp - -!IF "$(CFG)" == "Cab - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Cab - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Lzx\Lzx86Converter.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Lzx\LzxDecoder.cpp - -!IF "$(CFG)" == "Cab - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Cab - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Lzx\LzxDecoder.h -# End Source File -# End Group -# Begin Group "Deflate" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Deflate\DeflateConst.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Deflate\DeflateDecoder.cpp - -!IF "$(CFG)" == "Cab - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Cab - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Deflate\DeflateDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Deflate\DeflateExtConst.h -# End Source File -# End Group -# Begin Group "Copy" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "Quantum" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Quantum\QuantumDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Quantum\QuantumDecoder.h -# End Source File -# End Group -# Begin Group "Huffman" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Huffman\HuffmanDecoder.h -# End Source File -# End Group -# End Group -# Begin Source File - -SOURCE=.\cab.ico -# End Source File -# End Target -# End Project diff --git a/7zip/Archive/Cab/Cab.dsw b/7zip/Archive/Cab/Cab.dsw deleted file mode 100755 index 470cb1b3..00000000 --- a/7zip/Archive/Cab/Cab.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Cab"=.\Cab.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Archive/Cab/CabBlockInStream.cpp b/7zip/Archive/Cab/CabBlockInStream.cpp deleted file mode 100755 index b775c105..00000000 --- a/7zip/Archive/Cab/CabBlockInStream.cpp +++ /dev/null @@ -1,194 +0,0 @@ -// CabBlockInStream.cpp - -#include "StdAfx.h" - -#include "Common/Alloc.h" -#include "Common/Defs.h" - -#include "../../Common/StreamUtils.h" - -#include "CabBlockInStream.h" - -namespace NArchive { -namespace NCab { - -static const UInt32 kBlockSize = (1 << 16); - -bool CCabBlockInStream::Create() -{ - if (!_buffer) - _buffer = (Byte *)::MyAlloc(kBlockSize); - return (_buffer != 0); -} - -CCabBlockInStream::~CCabBlockInStream() -{ - MyFree(_buffer); -} - -class CCheckSum2 -{ - UInt32 m_Value; - int m_Pos; - Byte m_Hist[4]; -public: - CCheckSum2(): m_Value(0){}; - void Init() { m_Value = 0; m_Pos = 0; } - void Update(const void *data, UInt32 size); - void FinishDataUpdate() - { - for (int i = 0; i < m_Pos; i++) - m_Value ^= ((UInt32)(m_Hist[i])) << (8 * (m_Pos - i - 1)); - } - void UpdateUInt32(UInt32 v) { m_Value ^= v; } - UInt32 GetResult() const { return m_Value; } -}; - -void CCheckSum2::Update(const void *data, UInt32 size) -{ - UInt32 checkSum = m_Value; - const Byte *dataPointer = (const Byte *)data; - - while (size != 0 && m_Pos != 0) - { - m_Hist[m_Pos] = *dataPointer++; - m_Pos = (m_Pos + 1) & 3; - size--; - if (m_Pos == 0) - for (int i = 0; i < 4; i++) - checkSum ^= ((UInt32)m_Hist[i]) << (8 * i); - } - - int numWords = size / 4; - - while (numWords-- != 0) - { - UInt32 temp = *dataPointer++; - temp |= ((UInt32)(*dataPointer++)) << 8; - temp |= ((UInt32)(*dataPointer++)) << 16; - temp |= ((UInt32)(*dataPointer++)) << 24; - checkSum ^= temp; - } - m_Value = checkSum; - - size &= 3; - - while (size != 0) - { - m_Hist[m_Pos] = *dataPointer++; - m_Pos = (m_Pos + 1) & 3; - size--; - } -} - -static const UInt32 kDataBlockHeaderSize = 8; - -class CTempCabInBuffer2 -{ -public: - Byte Buffer[kDataBlockHeaderSize]; - UInt32 Pos; - Byte ReadByte() - { - return Buffer[Pos++]; - } - UInt32 ReadUInt32() - { - UInt32 value = 0; - for (int i = 0; i < 4; i++) - value |= (((UInt32)ReadByte()) << (8 * i)); - return value; - } - UInt16 ReadUInt16() - { - UInt16 value = 0; - for (int i = 0; i < 2; i++) - value |= (((UInt16)ReadByte()) << (8 * i)); - return value; - } -}; - -HRESULT CCabBlockInStream::PreRead(UInt32 &packSize, UInt32 &unpackSize) -{ - CTempCabInBuffer2 inBuffer; - inBuffer.Pos = 0; - UInt32 processedSizeLoc; - RINOK(ReadStream(_stream, inBuffer.Buffer, kDataBlockHeaderSize, &processedSizeLoc)) - if (processedSizeLoc != kDataBlockHeaderSize) - return S_FALSE; // bad block - - UInt32 checkSum = inBuffer.ReadUInt32(); - packSize = inBuffer.ReadUInt16(); - unpackSize = inBuffer.ReadUInt16(); - if (ReservedSize != 0) - { - RINOK(ReadStream(_stream, _buffer, ReservedSize, &processedSizeLoc)); - if(ReservedSize != processedSizeLoc) - return S_FALSE; // bad block; - } - _pos = 0; - CCheckSum2 checkSumCalc; - checkSumCalc.Init(); - UInt32 packSize2 = packSize; - if (MsZip && _size == 0) - { - if (packSize < 2) - return S_FALSE; // bad block; - Byte sig[2]; - RINOK(ReadStream(_stream, sig, 2, &processedSizeLoc)); - if(processedSizeLoc != 2) - return S_FALSE; - if (sig[0] != 0x43 || sig[1] != 0x4B) - return S_FALSE; - packSize2 -= 2; - checkSumCalc.Update(sig, 2); - } - - if (kBlockSize - _size < packSize2) - return S_FALSE; - - UInt32 curSize = packSize2; - if (curSize != 0) - { - RINOK(ReadStream(_stream, _buffer + _size, curSize, &processedSizeLoc)); - checkSumCalc.Update(_buffer + _size, processedSizeLoc); - _size += processedSizeLoc; - if (processedSizeLoc != curSize) - return S_FALSE; - } - TotalPackSize = _size; - - checkSumCalc.FinishDataUpdate(); - - bool dataError; - if (checkSum == 0) - dataError = false; - else - { - checkSumCalc.UpdateUInt32(packSize | (((UInt32)unpackSize) << 16)); - dataError = (checkSumCalc.GetResult() != checkSum); - } - DataError |= dataError; - return dataError ? S_FALSE : S_OK; -} - -STDMETHODIMP CCabBlockInStream::Read(void *data, UInt32 size, UInt32 *processedSize) -{ - if (processedSize != 0) - *processedSize = 0; - if (size == 0) - return S_OK; - if (_size != 0) - { - size = MyMin(_size, size); - memmove(data, _buffer + _pos, size); - _pos += size; - _size -= size; - if (processedSize != 0) - *processedSize = size; - return S_OK; - } - return S_OK; // no blocks data -} - -}} diff --git a/7zip/Archive/Cab/CabBlockInStream.h b/7zip/Archive/Cab/CabBlockInStream.h deleted file mode 100755 index 46e15222..00000000 --- a/7zip/Archive/Cab/CabBlockInStream.h +++ /dev/null @@ -1,56 +0,0 @@ -// CabBlockInStream.cpp - -#ifndef __CABBLOCKINSTREAM_H -#define __CABBLOCKINSTREAM_H - -#include "Common/MyCom.h" -#include "../../IStream.h" - -namespace NArchive { -namespace NCab { - -class CCabBlockInStream: - public ISequentialInStream, - public CMyUnknownImp -{ - CMyComPtr _stream; - Byte *_buffer; - UInt32 _pos; - UInt32 _size; - int _align; - -public: - UInt32 TotalPackSize; - UInt32 ReservedSize; - bool DataError; - bool MsZip; - - CCabBlockInStream(): _buffer(0), ReservedSize(0), MsZip(false), DataError(false), _align(0), TotalPackSize(0) {} - ~CCabBlockInStream(); - bool Create(); - void SetStream(ISequentialInStream *stream) { _stream = stream; } - - void InitForNewFolder() - { - _align = 0; - TotalPackSize = 0; - } - - void InitForNewBlock() - { - _size = 0; - _align = (_align + (int)TotalPackSize) & 1; - } - - int GetAlign() const { return _align; } - - MY_UNKNOWN_IMP - - STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); - - HRESULT PreRead(UInt32 &packSize, UInt32 &unpackSize); -}; - -}} - -#endif diff --git a/7zip/Archive/Cab/CabHandler.cpp b/7zip/Archive/Cab/CabHandler.cpp deleted file mode 100755 index cac79b11..00000000 --- a/7zip/Archive/Cab/CabHandler.cpp +++ /dev/null @@ -1,812 +0,0 @@ -// CabHandler.cpp - -#include "StdAfx.h" - -#include "Common/StringConvert.h" -#include "Common/Defs.h" -#include "Common/Alloc.h" -#include "Common/UTFConvert.h" -#include "Common/ComTry.h" -#include "Common/IntToString.h" - -#include "Windows/PropVariant.h" -#include "Windows/Time.h" - -#include "CabHandler.h" -#include "CabBlockInStream.h" - -#include "../../Compress/Copy/CopyCoder.h" -#include "../../Compress/Deflate/DeflateDecoder.h" -#include "../../Compress/Lzx/LzxDecoder.h" -#include "../../Compress/Quantum/QuantumDecoder.h" - -#include "../Common/ItemNameUtils.h" - -using namespace NWindows; - -namespace NArchive { -namespace NCab { - -// #define _CAB_DETAILS - -#ifdef _CAB_DETAILS -enum -{ - kpidBlockReal = kpidUserDefined, - kpidOffset, - kpidVolume, -}; -#endif - -STATPROPSTG kProperties[] = -{ - { NULL, kpidPath, VT_BSTR}, - // { NULL, kpidIsFolder, VT_BOOL}, - { NULL, kpidSize, VT_UI8}, - { NULL, kpidLastWriteTime, VT_FILETIME}, - { NULL, kpidAttributes, VT_UI4}, - { NULL, kpidMethod, VT_BSTR}, - { NULL, kpidBlock, VT_I4} - #ifdef _CAB_DETAILS - , - { L"BlockReal", kpidBlockReal, VT_UI4}, - { L"Offset", kpidOffset, VT_UI4}, - { L"Volume", kpidVolume, VT_UI4} - #endif -}; - -static const int kNumProperties = sizeof(kProperties) / sizeof(kProperties[0]); - -static const wchar_t *kMethods[] = -{ - L"None", - L"MSZip", - L"Quantum", - L"LZX" -}; - -static const int kNumMethods = sizeof(kMethods) / sizeof(kMethods[0]); -static const wchar_t *kUnknownMethod = L"Unknown"; - -STDMETHODIMP CHandler::GetArchiveProperty(PROPID /* propID */, PROPVARIANT *value) -{ - value->vt = VT_EMPTY; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties) -{ - *numProperties = sizeof(kProperties) / sizeof(kProperties[0]); - return S_OK; -} - -STDMETHODIMP CHandler::GetPropertyInfo(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) -{ - if(index >= sizeof(kProperties) / sizeof(kProperties[0])) - return E_INVALIDARG; - const STATPROPSTG &srcItem = kProperties[index]; - *propID = srcItem.propid; - *varType = srcItem.vt; - if (srcItem.lpwstrName == 0) - *name = 0; - else - *name = ::SysAllocString(srcItem.lpwstrName); - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) -{ - *numProperties = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetArchivePropertyInfo(UInt32 /* index */, - BSTR * /* name */, PROPID * /* propID */, VARTYPE * /* varType */) -{ - return E_INVALIDARG; -} - -STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) -{ - COM_TRY_BEGIN - NWindows::NCOM::CPropVariant propVariant; - - const CMvItem &mvItem = m_Database.Items[index]; - const CDatabaseEx &db = m_Database.Volumes[mvItem.VolumeIndex]; - int itemIndex = mvItem.ItemIndex; - const CItem &item = db.Items[itemIndex]; - switch(propID) - { - case kpidPath: - { - UString unicodeName; - if (item.IsNameUTF()) - ConvertUTF8ToUnicode(item.Name, unicodeName); - else - unicodeName = MultiByteToUnicodeString(item.Name, CP_ACP); - propVariant = (const wchar_t *)NItemName::WinNameToOSName(unicodeName); - break; - } - case kpidIsFolder: - propVariant = item.IsDirectory(); - break; - case kpidSize: - propVariant = item.Size; - break; - case kpidLastWriteTime: - { - FILETIME localFileTime, utcFileTime; - if (NTime::DosTimeToFileTime(item.Time, localFileTime)) - { - if (!LocalFileTimeToFileTime(&localFileTime, &utcFileTime)) - utcFileTime.dwHighDateTime = utcFileTime.dwLowDateTime = 0; - } - else - utcFileTime.dwHighDateTime = utcFileTime.dwLowDateTime = 0; - propVariant = utcFileTime; - break; - } - case kpidAttributes: - propVariant = item.GetWinAttributes(); - break; - - case kpidMethod: - { - UInt32 realFolderIndex = item.GetFolderIndex(db.Folders.Size()); - const CFolder &folder = db.Folders[realFolderIndex]; - int methodIndex = folder.GetCompressionMethod(); - UString method = (methodIndex < kNumMethods) ? kMethods[methodIndex] : kUnknownMethod; - if (methodIndex == NHeader::NCompressionMethodMajor::kLZX || - methodIndex == NHeader::NCompressionMethodMajor::kQuantum) - { - method += L":"; - wchar_t temp[32]; - ConvertUInt64ToString(folder.CompressionTypeMinor, temp); - method += temp; - } - propVariant = method; - break; - } - case kpidBlock: - propVariant = (Int32)m_Database.GetFolderIndex(&mvItem); - break; - - #ifdef _CAB_DETAILS - - case kpidBlockReal: - propVariant = UInt32(item.FolderIndex); - break; - case kpidOffset: - propVariant = (UInt32)item.Offset; - break; - case kpidVolume: - propVariant = (UInt32)mvItem.VolumeIndex; - break; - - #endif - } - propVariant.Detach(value); - return S_OK; - COM_TRY_END -} - -/* -class CPropgressImp: public CProgressVirt -{ - CMyComPtr m_OpenArchiveCallback; -public: - STDMETHOD(SetTotal)(const UInt64 *numFiles); - STDMETHOD(SetCompleted)(const UInt64 *numFiles); - void Init(IArchiveOpenCallback *openArchiveCallback) - { m_OpenArchiveCallback = openArchiveCallback; } -}; - -STDMETHODIMP CPropgressImp::SetTotal(const UInt64 *numFiles) -{ - if (m_OpenArchiveCallback) - return m_OpenArchiveCallback->SetCompleted(numFiles, NULL); - return S_OK; -} - -STDMETHODIMP CPropgressImp::SetCompleted(const UInt64 *numFiles) -{ - if (m_OpenArchiveCallback) - return m_OpenArchiveCallback->SetCompleted(numFiles, NULL); - return S_OK; -} -*/ - -STDMETHODIMP CHandler::Open(IInStream *inStream, - const UInt64 *maxCheckStartPosition, - IArchiveOpenCallback *openArchiveCallback) -{ - COM_TRY_BEGIN - Close(); - HRESULT res = S_FALSE; - CInArchive archive; - CMyComPtr openVolumeCallback; - { - CMyComPtr openArchiveCallbackWrap = openArchiveCallback; - openArchiveCallbackWrap.QueryInterface(IID_IArchiveOpenVolumeCallback, &openVolumeCallback); - } - - CMyComPtr nextStream = inStream; - bool prevChecked = false; - UInt64 numItems = 0; - try - { - while(nextStream != 0) - { - CDatabaseEx db; - db.Stream = nextStream; - res = archive.Open(maxCheckStartPosition, db); - if (res == S_OK) - { - if (!m_Database.Volumes.IsEmpty()) - { - const CDatabaseEx &dbPrev = m_Database.Volumes[prevChecked ? m_Database.Volumes.Size() - 1 : 0]; - if (dbPrev.ArchiveInfo.SetID != db.ArchiveInfo.SetID || - dbPrev.ArchiveInfo.CabinetNumber + (prevChecked ? 1: - 1) != - db.ArchiveInfo.CabinetNumber) - res = S_FALSE; - } - } - if (res == S_OK) - m_Database.Volumes.Insert(prevChecked ? m_Database.Volumes.Size() : 0, db); - else if (res != S_FALSE) - return res; - else - { - if (m_Database.Volumes.IsEmpty()) - return S_FALSE; - if (prevChecked) - break; - prevChecked = true; - } - - numItems += db.Items.Size(); - RINOK(openArchiveCallback->SetCompleted(&numItems, NULL)); - - nextStream = 0; - for (;;) - { - const COtherArchive *otherArchive = 0; - if (!prevChecked) - { - const CInArchiveInfo &ai = m_Database.Volumes.Front().ArchiveInfo; - if (ai.IsTherePrev()) - otherArchive = &ai.PreviousArchive; - else - prevChecked = true; - } - if (otherArchive == 0) - { - const CInArchiveInfo &ai = m_Database.Volumes.Back().ArchiveInfo; - if (ai.IsThereNext()) - otherArchive = &ai.NextArchive; - } - if (!otherArchive) - break; - const UString fullName = MultiByteToUnicodeString(otherArchive->FileName, CP_ACP); - HRESULT result = openVolumeCallback->GetStream(fullName, &nextStream); - if (result == S_OK) - break; - if (result != S_FALSE) - return result; - if (prevChecked) - break; - prevChecked = true; - } - } - if (res == S_OK) - { - m_Database.FillSortAndShrink(); - if (!m_Database.Check()) - res = S_FALSE; - } - } - catch(...) - { - res = S_FALSE; - } - if (res != S_OK) - { - Close(); - return res; - } - COM_TRY_END - return S_OK; -} - -STDMETHODIMP CHandler::Close() -{ - m_Database.Clear(); - return S_OK; -} - -class CCabFolderOutStream: - public ISequentialOutStream, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP - - STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); -private: - const CMvDatabaseEx *m_Database; - const CRecordVector *m_ExtractStatuses; - int m_StartIndex; - int m_CurrentIndex; - CMyComPtr m_ExtractCallback; - bool m_TestMode; - - CMyComPtr m_RealOutStream; - - bool m_IsOk; - bool m_FileIsOpen; - UInt64 m_RemainFileSize; - UInt64 m_FolderSize; - UInt64 m_PosInFolder; - - HRESULT OpenFile(); - HRESULT Write2(const void *data, UInt32 size, UInt32 *processedSize, bool isOK); -public: - HRESULT WriteEmptyFiles(); - - void Init( - const CMvDatabaseEx *database, - const CRecordVector *extractStatuses, - int startIndex, - UInt64 folderSize, - IArchiveExtractCallback *extractCallback, - bool testMode); - HRESULT FlushCorrupted(); - HRESULT Unsupported(); - - UInt64 GetRemain() const { return m_FolderSize - m_PosInFolder; } - UInt64 GetPosInFolder() const { return m_PosInFolder; } -}; - -void CCabFolderOutStream::Init( - const CMvDatabaseEx *database, - const CRecordVector *extractStatuses, - int startIndex, - UInt64 folderSize, - IArchiveExtractCallback *extractCallback, - bool testMode) -{ - m_Database = database; - m_ExtractStatuses = extractStatuses; - m_StartIndex = startIndex; - m_FolderSize = folderSize; - - m_ExtractCallback = extractCallback; - m_TestMode = testMode; - - m_CurrentIndex = 0; - m_PosInFolder = 0; - m_FileIsOpen = false; - m_IsOk = true; -} - -HRESULT CCabFolderOutStream::OpenFile() -{ - Int32 askMode = (*m_ExtractStatuses)[m_CurrentIndex] ? (m_TestMode ? - NExtract::NAskMode::kTest : - NExtract::NAskMode::kExtract) : - NExtract::NAskMode::kSkip; - RINOK(m_ExtractCallback->GetStream(m_StartIndex + m_CurrentIndex, &m_RealOutStream, askMode)); - if (!m_RealOutStream && !m_TestMode) - askMode = NArchive::NExtract::NAskMode::kSkip; - return m_ExtractCallback->PrepareOperation(askMode); -} - -HRESULT CCabFolderOutStream::WriteEmptyFiles() -{ - if (m_FileIsOpen) - return S_OK; - for(;m_CurrentIndex < m_ExtractStatuses->Size(); m_CurrentIndex++) - { - const CMvItem &mvItem = m_Database->Items[m_StartIndex + m_CurrentIndex]; - const CItem &item = m_Database->Volumes[mvItem.VolumeIndex].Items[mvItem.ItemIndex]; - UInt64 fileSize = item.Size; - if (fileSize != 0) - return S_OK; - HRESULT result = OpenFile(); - m_RealOutStream.Release(); - RINOK(result); - RINOK(m_ExtractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - } - return S_OK; -} - -// This is Write function -HRESULT CCabFolderOutStream::Write2(const void *data, UInt32 size, UInt32 *processedSize, bool isOK) -{ - UInt32 realProcessed = 0; - if (processedSize != NULL) - *processedSize = 0; - while(size != 0) - { - if (m_FileIsOpen) - { - UInt32 numBytesToWrite = (UInt32)MyMin(m_RemainFileSize, (UInt64)(size)); - HRESULT res = S_OK; - if (numBytesToWrite > 0) - { - if (!isOK) - m_IsOk = false; - if (m_RealOutStream) - { - UInt32 processedSizeLocal = 0; - res = m_RealOutStream->Write((const Byte *)data, numBytesToWrite, &processedSizeLocal); - numBytesToWrite = processedSizeLocal; - } - } - realProcessed += numBytesToWrite; - if (processedSize != NULL) - *processedSize = realProcessed; - data = (const void *)((const Byte *)data + numBytesToWrite); - size -= numBytesToWrite; - m_RemainFileSize -= numBytesToWrite; - m_PosInFolder += numBytesToWrite; - if (res != S_OK) - return res; - if (m_RemainFileSize == 0) - { - m_RealOutStream.Release(); - RINOK(m_ExtractCallback->SetOperationResult( - m_IsOk ? - NArchive::NExtract::NOperationResult::kOK: - NArchive::NExtract::NOperationResult::kDataError)); - m_FileIsOpen = false; - } - if (realProcessed > 0) - break; // with this break this function works as Write-Part - } - else - { - if (m_CurrentIndex >= m_ExtractStatuses->Size()) - return E_FAIL; - - const CMvItem &mvItem = m_Database->Items[m_StartIndex + m_CurrentIndex]; - const CItem &item = m_Database->Volumes[mvItem.VolumeIndex].Items[mvItem.ItemIndex]; - - m_RemainFileSize = item.Size; - - UInt32 fileOffset = item.Offset; - if (fileOffset < m_PosInFolder) - return E_FAIL; - if (fileOffset > m_PosInFolder) - { - UInt32 numBytesToWrite = (UInt32)MyMin((UInt64)fileOffset - m_PosInFolder, UInt64(size)); - realProcessed += numBytesToWrite; - if (processedSize != NULL) - *processedSize = realProcessed; - data = (const void *)((const Byte *)data + numBytesToWrite); - size -= numBytesToWrite; - m_PosInFolder += numBytesToWrite; - } - if (fileOffset == m_PosInFolder) - { - RINOK(OpenFile()); - m_FileIsOpen = true; - m_CurrentIndex++; - m_IsOk = true; - } - } - } - return WriteEmptyFiles(); -} - -STDMETHODIMP CCabFolderOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize) -{ - return Write2(data, size, processedSize, true); -} - -HRESULT CCabFolderOutStream::FlushCorrupted() -{ - const UInt32 kBufferSize = (1 << 10); - Byte buffer[kBufferSize]; - for (int i = 0; i < kBufferSize; i++) - buffer[i] = 0; - for (;;) - { - UInt64 remain = GetRemain(); - if (remain == 0) - return S_OK; - UInt32 size = (UInt32)MyMin(remain, (UInt64)kBufferSize); - UInt32 processedSizeLocal = 0; - RINOK(Write2(buffer, size, &processedSizeLocal, false)); - } -} - -HRESULT CCabFolderOutStream::Unsupported() -{ - while(m_CurrentIndex < m_ExtractStatuses->Size()) - { - HRESULT result = OpenFile(); - if (result != S_FALSE && result != S_OK) - return result; - m_RealOutStream.Release(); - RINOK(m_ExtractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kUnSupportedMethod)); - m_CurrentIndex++; - } - return S_OK; -} - - -STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, - Int32 _aTestMode, IArchiveExtractCallback *extractCallback) -{ - COM_TRY_BEGIN - bool allFilesMode = (numItems == (UInt32)(-1)); - if (allFilesMode) - numItems = m_Database.Items.Size(); - if(numItems == 0) - return S_OK; - bool testMode = (_aTestMode != 0); - UInt64 totalUnPacked = 0; - - UInt32 i; - int lastFolder = -2; - UInt64 lastFolderSize = 0; - for(i = 0; i < numItems; i++) - { - int index = allFilesMode ? i : indices[i]; - const CMvItem &mvItem = m_Database.Items[index]; - const CItem &item = m_Database.Volumes[mvItem.VolumeIndex].Items[mvItem.ItemIndex]; - if (item.IsDirectory()) - continue; - int folderIndex = m_Database.GetFolderIndex(&mvItem); - if (folderIndex != lastFolder) - totalUnPacked += lastFolderSize; - lastFolder = folderIndex; - lastFolderSize = item.GetEndOffset(); - } - totalUnPacked += lastFolderSize; - - extractCallback->SetTotal(totalUnPacked); - - totalUnPacked = 0; - - NCompress::CCopyCoder *copyCoderSpec = NULL; - CMyComPtr copyCoder; - - NCompress::NDeflate::NDecoder::CCOMCoder *deflateDecoderSpec = NULL; - CMyComPtr deflateDecoder; - - NCompress::NLzx::CDecoder *lzxDecoderSpec = NULL; - CMyComPtr lzxDecoder; - - NCompress::NQuantum::CDecoder *quantumDecoderSpec = NULL; - CMyComPtr quantumDecoder; - - CCabBlockInStream *cabBlockInStreamSpec = new CCabBlockInStream(); - CMyComPtr cabBlockInStream = cabBlockInStreamSpec; - if (!cabBlockInStreamSpec->Create()) - return E_OUTOFMEMORY; - - CRecordVector extractStatuses; - for(i = 0; i < numItems;) - { - int index = allFilesMode ? i : indices[i]; - - const CMvItem &mvItem = m_Database.Items[index]; - const CDatabaseEx &db = m_Database.Volumes[mvItem.VolumeIndex]; - int itemIndex = mvItem.ItemIndex; - const CItem &item = db.Items[itemIndex]; - - i++; - if (item.IsDirectory()) - { - Int32 askMode= testMode ? - NArchive::NExtract::NAskMode::kTest : - NArchive::NExtract::NAskMode::kExtract; - CMyComPtr realOutStream; - RINOK(extractCallback->GetStream(index, &realOutStream, askMode)); - RINOK(extractCallback->PrepareOperation(askMode)); - realOutStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - continue; - } - int folderIndex = m_Database.GetFolderIndex(&mvItem); - if (folderIndex < 0) - { - // If we need previous archive - Int32 askMode= testMode ? - NArchive::NExtract::NAskMode::kTest : - NArchive::NExtract::NAskMode::kExtract; - CMyComPtr realOutStream; - RINOK(extractCallback->GetStream(index, &realOutStream, askMode)); - RINOK(extractCallback->PrepareOperation(askMode)); - realOutStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kDataError)); - continue; - } - int startIndex2 = m_Database.FolderStartFileIndex[folderIndex]; - int startIndex = startIndex2; - extractStatuses.Clear(); - for (; startIndex < index; startIndex++) - extractStatuses.Add(false); - extractStatuses.Add(true); - startIndex++; - UInt64 curUnpack = item.GetEndOffset(); - for(;i < numItems; i++) - { - int indexNext = allFilesMode ? i : indices[i]; - const CMvItem &mvItem = m_Database.Items[indexNext]; - const CItem &item = m_Database.Volumes[mvItem.VolumeIndex].Items[mvItem.ItemIndex]; - if (item.IsDirectory()) - continue; - int newFolderIndex = m_Database.GetFolderIndex(&mvItem); - - if (newFolderIndex != folderIndex) - break; - for (; startIndex < indexNext; startIndex++) - extractStatuses.Add(false); - extractStatuses.Add(true); - startIndex++; - curUnpack = item.GetEndOffset(); - } - - RINOK(extractCallback->SetCompleted(&totalUnPacked)); - - CCabFolderOutStream *cabFolderOutStream = new CCabFolderOutStream; - CMyComPtr outStream(cabFolderOutStream); - - const CFolder &folder = db.Folders[item.GetFolderIndex(db.Folders.Size())]; - - cabFolderOutStream->Init(&m_Database, &extractStatuses, startIndex2, - curUnpack, extractCallback, testMode); - - cabBlockInStreamSpec->MsZip = false; - switch(folder.GetCompressionMethod()) - { - case NHeader::NCompressionMethodMajor::kNone: - if(copyCoderSpec == NULL) - { - copyCoderSpec = new NCompress::CCopyCoder; - copyCoder = copyCoderSpec; - } - break; - case NHeader::NCompressionMethodMajor::kMSZip: - if(deflateDecoderSpec == NULL) - { - deflateDecoderSpec = new NCompress::NDeflate::NDecoder::CCOMCoder; - deflateDecoder = deflateDecoderSpec; - } - cabBlockInStreamSpec->MsZip = true; - break; - case NHeader::NCompressionMethodMajor::kLZX: - if(lzxDecoderSpec == NULL) - { - lzxDecoderSpec = new NCompress::NLzx::CDecoder; - lzxDecoder = lzxDecoderSpec; - } - RINOK(lzxDecoderSpec->SetParams(folder.CompressionTypeMinor)); - break; - case NHeader::NCompressionMethodMajor::kQuantum: - if(quantumDecoderSpec == NULL) - { - quantumDecoderSpec = new NCompress::NQuantum::CDecoder; - quantumDecoder = quantumDecoderSpec; - } - quantumDecoderSpec->SetParams(folder.CompressionTypeMinor); - break; - default: - { - RINOK(cabFolderOutStream->Unsupported()); - totalUnPacked += curUnpack; - continue; - } - } - - cabBlockInStreamSpec->InitForNewFolder(); - - HRESULT res = S_OK; - - { - int volIndex = mvItem.VolumeIndex; - int locFolderIndex = item.GetFolderIndex(db.Folders.Size()); - bool keepHistory = false; - bool keepInputBuffer = false; - for (UInt32 f = 0; cabFolderOutStream->GetRemain() != 0;) - { - if (volIndex >= m_Database.Volumes.Size()) - { - res = S_FALSE; - break; - } - - const CDatabaseEx &db = m_Database.Volumes[volIndex]; - const CFolder &folder = db.Folders[locFolderIndex]; - if (f == 0) - { - cabBlockInStreamSpec->SetStream(db.Stream); - cabBlockInStreamSpec->ReservedSize = db.ArchiveInfo.GetDataBlockReserveSize(); - RINOK(db.Stream->Seek(db.StartPosition + folder.DataStart, STREAM_SEEK_SET, NULL)); - } - if (f == folder.NumDataBlocks) - { - volIndex++; - locFolderIndex = 0; - f = 0; - continue; - } - f++; - - cabBlockInStreamSpec->DataError = false; - - if (!keepInputBuffer) - cabBlockInStreamSpec->InitForNewBlock(); - - UInt32 packSize, unpackSize; - res = cabBlockInStreamSpec->PreRead(packSize, unpackSize); - if (res == S_FALSE) - break; - RINOK(res); - keepInputBuffer = (unpackSize == 0); - if (keepInputBuffer) - continue; - - - UInt64 totalUnPacked2 = totalUnPacked + cabFolderOutStream->GetPosInFolder(); - RINOK(extractCallback->SetCompleted(&totalUnPacked2)); - UInt64 unpackRemain = cabFolderOutStream->GetRemain(); - - const UInt32 kBlockSizeMax = (1 << 15); - if (unpackRemain > kBlockSizeMax) - unpackRemain = kBlockSizeMax; - if (unpackRemain > unpackSize) - unpackRemain = unpackSize; - - switch(folder.GetCompressionMethod()) - { - case NHeader::NCompressionMethodMajor::kNone: - res = copyCoder->Code(cabBlockInStream, outStream, NULL, &unpackRemain, NULL); - break; - case NHeader::NCompressionMethodMajor::kMSZip: - deflateDecoderSpec->SetKeepHistory(keepHistory); - res = deflateDecoder->Code(cabBlockInStream, outStream, NULL, &unpackRemain, NULL); - break; - case NHeader::NCompressionMethodMajor::kLZX: - lzxDecoderSpec->SetKeepHistory(keepHistory, cabBlockInStreamSpec->GetAlign()); - res = lzxDecoder->Code(cabBlockInStream, outStream, NULL, &unpackRemain, NULL); - break; - case NHeader::NCompressionMethodMajor::kQuantum: - quantumDecoderSpec->SetKeepHistory(keepHistory); - res = quantumDecoder->Code(cabBlockInStream, outStream, NULL, &unpackRemain, NULL); - break; - } - if (res != S_OK) - { - if (res != S_FALSE) - RINOK(res); - break; - } - keepHistory = true; - } - if (res == S_OK) - { - RINOK(cabFolderOutStream->WriteEmptyFiles()); - } - } - if (res != S_OK || cabFolderOutStream->GetRemain() != 0) - { - RINOK(cabFolderOutStream->FlushCorrupted()); - } - totalUnPacked += curUnpack; - } - return S_OK; - COM_TRY_END -} - -STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems) -{ - *numItems = m_Database.Items.Size(); - return S_OK; -} - -}} diff --git a/7zip/Archive/Cab/CabHandler.h b/7zip/Archive/Cab/CabHandler.h deleted file mode 100755 index 245586b6..00000000 --- a/7zip/Archive/Cab/CabHandler.h +++ /dev/null @@ -1,45 +0,0 @@ -// CabHandler.h - -#ifndef __CAB_HANDLER_H -#define __CAB_HANDLER_H - -#include "Common/MyCom.h" -#include "../IArchive.h" -#include "CabIn.h" - -namespace NArchive { -namespace NCab { - -class CHandler: - public IInArchive, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP - - STDMETHOD(Open)(IInStream *stream, - const UInt64 *maxCheckStartPosition, - IArchiveOpenCallback *openArchiveCallback); - STDMETHOD(Close)(); - STDMETHOD(GetNumberOfItems)(UInt32 *numItems); - STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value); - STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems, - Int32 testMode, IArchiveExtractCallback *extractCallback); - - STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value); - - STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties); - STDMETHOD(GetPropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - - STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties); - STDMETHOD(GetArchivePropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - -private: - CMvDatabaseEx m_Database; -}; - -}} - -#endif diff --git a/7zip/Archive/Cab/CabHeader.cpp b/7zip/Archive/Cab/CabHeader.cpp deleted file mode 100755 index 37533dff..00000000 --- a/7zip/Archive/Cab/CabHeader.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// Archive/Cab/Header.h - -#include "StdAfx.h" - -#include "CabHeader.h" - -namespace NArchive{ -namespace NCab{ -namespace NHeader{ - -namespace NArchive { - -UInt32 kSignature = 0x4643534d + 1; -static class CSignatureInitializer -{ public: CSignatureInitializer() { kSignature--; }} g_SignatureInitializer; - -} - -}}} diff --git a/7zip/Archive/Cab/CabHeader.h b/7zip/Archive/Cab/CabHeader.h deleted file mode 100755 index 5c122743..00000000 --- a/7zip/Archive/Cab/CabHeader.h +++ /dev/null @@ -1,42 +0,0 @@ -// Archive/Cab/Header.h - -#ifndef __ARCHIVE_CAB_HEADER_H -#define __ARCHIVE_CAB_HEADER_H - -#include "Common/Types.h" - -namespace NArchive { -namespace NCab { -namespace NHeader{ - -namespace NArchive -{ - extern UInt32 kSignature; - namespace NFlags - { - const int kPrevCabinet = 0x0001; - const int kNextCabinet = 0x0002; - const int kReservePresent = 0x0004; - } -} - -namespace NCompressionMethodMajor -{ - const Byte kNone = 0; - const Byte kMSZip = 1; - const Byte kQuantum = 2; - const Byte kLZX = 3; -} - -const int kFileNameIsUTFAttributeMask = 0x80; - -namespace NFolderIndex -{ - const int kContinuedFromPrev = 0xFFFD; - const int kContinuedToNext = 0xFFFE; - const int kContinuedPrevAndNext = 0xFFFF; -} - -}}} - -#endif diff --git a/7zip/Archive/Cab/CabIn.cpp b/7zip/Archive/Cab/CabIn.cpp deleted file mode 100755 index 447c1f42..00000000 --- a/7zip/Archive/Cab/CabIn.cpp +++ /dev/null @@ -1,343 +0,0 @@ -// Archive/CabIn.cpp - -#include "StdAfx.h" - -#include "Common/StringConvert.h" -#include "Common/MyCom.h" -#include "CabIn.h" -#include "Windows/Defs.h" - -#include "../../Common/StreamUtils.h" - -namespace NArchive{ -namespace NCab{ - -/* -static HRESULT ReadBytes(IInStream *inStream, void *data, UInt32 size) -{ - UInt32 realProcessedSize; - RINOK(ReadStream(inStream, data, size, &realProcessedSize)); - if(realProcessedSize != size) - return S_FALSE; - return S_OK; -} - -static HRESULT SafeRead(IInStream *inStream, void *data, UInt32 size) -{ - UInt32 realProcessedSize; - RINOK(ReadStream(inStream, data, size, &realProcessedSize)); - if(realProcessedSize != size) - throw CInArchiveException(CInArchiveException::kUnexpectedEndOfArchive); - return S_OK; -} - -static void SafeInByteRead(::CInBuffer &inBuffer, void *data, UInt32 size) -{ - UInt32 realProcessedSize; - inBuffer.ReadBytes(data, size, realProcessedSize); - if(realProcessedSize != size) - throw CInArchiveException(CInArchiveException::kUnexpectedEndOfArchive); -} -*/ - -Byte CInArchive::ReadByte() -{ - Byte b; - if (!inBuffer.ReadByte(b)) - throw CInArchiveException(CInArchiveException::kUnsupported); - return b; -} - -UInt16 CInArchive::ReadUInt16() -{ - UInt16 value = 0; - for (int i = 0; i < 2; i++) - { - Byte b = ReadByte(); - value |= (UInt16(b) << (8 * i)); - } - return value; -} - -UInt32 CInArchive::ReadUInt32() -{ - UInt32 value = 0; - for (int i = 0; i < 4; i++) - { - Byte b = ReadByte(); - value |= (UInt32(b) << (8 * i)); - } - return value; -} - -AString CInArchive::SafeReadName() -{ - AString name; - for (;;) - { - Byte b = ReadByte(); - if (b == 0) - return name; - name += (char)b; - } -} - -void CInArchive::ReadOtherArchive(COtherArchive &oa) -{ - oa.FileName = SafeReadName(); - oa.DiskName = SafeReadName(); -} - -void CInArchive::Skeep(size_t size) -{ - while (size-- != 0) - ReadByte(); -} - -HRESULT CInArchive::Open2(IInStream *inStream, - const UInt64 *searchHeaderSizeLimit, - CDatabase &database) -{ - database.Clear(); - RINOK(inStream->Seek(0, STREAM_SEEK_CUR, &database.StartPosition)); - - { - if (!inBuffer.Create(1 << 17)) - return E_OUTOFMEMORY; - inBuffer.SetStream(inStream); - inBuffer.Init(); - UInt64 value = 0; - const int kSignatureSize = 8; - UInt64 kSignature64 = NHeader::NArchive::kSignature; - for (;;) - { - Byte b; - if (!inBuffer.ReadByte(b)) - return S_FALSE; - value >>= 8; - value |= ((UInt64)b) << ((kSignatureSize - 1) * 8); - if (inBuffer.GetProcessedSize() >= kSignatureSize) - { - if (value == kSignature64) - break; - if (searchHeaderSizeLimit != NULL) - if (inBuffer.GetProcessedSize() > (*searchHeaderSizeLimit)) - return S_FALSE; - } - } - database.StartPosition += inBuffer.GetProcessedSize() - kSignatureSize; - } - - CInArchiveInfo &archiveInfo = database.ArchiveInfo; - - archiveInfo.Size = ReadUInt32(); // size of this cabinet file in bytes - if (ReadUInt32() != 0) - return S_FALSE; - archiveInfo.FileHeadersOffset = ReadUInt32(); // offset of the first CFFILE entry - if (ReadUInt32() != 0) - return S_FALSE; - - archiveInfo.VersionMinor = ReadByte(); // cabinet file format version, minor - archiveInfo.VersionMajor = ReadByte(); // cabinet file format version, major - archiveInfo.NumFolders = ReadUInt16(); // number of CFFOLDER entries in this cabinet - archiveInfo.NumFiles = ReadUInt16(); // number of CFFILE entries in this cabinet - archiveInfo.Flags = ReadUInt16(); // number of CFFILE entries in this cabinet - archiveInfo.SetID = ReadUInt16(); // must be the same for all cabinets in a set - archiveInfo.CabinetNumber = ReadUInt16(); // number of this cabinet file in a set - - if (archiveInfo.ReserveBlockPresent()) - { - archiveInfo.PerCabinetAreaSize = ReadUInt16(); // (optional) size of per-cabinet reserved area - archiveInfo.PerFolderAreaSize = ReadByte(); // (optional) size of per-folder reserved area - archiveInfo.PerDataBlockAreaSize = ReadByte(); // (optional) size of per-datablock reserved area - - Skeep(archiveInfo.PerCabinetAreaSize); - } - - { - if (archiveInfo.IsTherePrev()) - ReadOtherArchive(archiveInfo.PreviousArchive); - if (archiveInfo.IsThereNext()) - ReadOtherArchive(archiveInfo.NextArchive); - } - - int i; - for(i = 0; i < archiveInfo.NumFolders; i++) - { - CFolder folder; - - folder.DataStart = ReadUInt32(); - folder.NumDataBlocks = ReadUInt16(); - folder.CompressionTypeMajor = ReadByte(); - folder.CompressionTypeMinor = ReadByte(); - - Skeep(archiveInfo.PerFolderAreaSize); - database.Folders.Add(folder); - } - - RINOK(inStream->Seek(database.StartPosition + archiveInfo.FileHeadersOffset, STREAM_SEEK_SET, NULL)); - - inBuffer.SetStream(inStream); - inBuffer.Init(); - for(i = 0; i < archiveInfo.NumFiles; i++) - { - CItem item; - item.Size = ReadUInt32(); - item.Offset = ReadUInt32(); - item.FolderIndex = ReadUInt16(); - UInt16 pureDate = ReadUInt16(); - UInt16 pureTime = ReadUInt16(); - item.Time = ((UInt32(pureDate) << 16)) | pureTime; - item.Attributes = ReadUInt16(); - item.Name = SafeReadName(); - int folderIndex = item.GetFolderIndex(database.Folders.Size()); - if (folderIndex >= database.Folders.Size()) - return S_FALSE; - database.Items.Add(item); - } - return S_OK; -} - -#define RINOZ(x) { int __tt = (x); if (__tt != 0) return __tt; } - -HRESULT CInArchive::Open( - const UInt64 *searchHeaderSizeLimit, - CDatabaseEx &database) -{ - return Open2(database.Stream, searchHeaderSizeLimit, database); -} - - -static int CompareMvItems2(const CMvItem *p1, const CMvItem *p2) -{ - RINOZ(MyCompare(p1->VolumeIndex, p2->VolumeIndex)); - return MyCompare(p1->ItemIndex, p2->ItemIndex); -} - -static int CompareMvItems(const CMvItem *p1, const CMvItem *p2, void *param) -{ - const CMvDatabaseEx &mvDb = *(const CMvDatabaseEx *)param; - const CDatabaseEx &db1 = mvDb.Volumes[p1->VolumeIndex]; - const CDatabaseEx &db2 = mvDb.Volumes[p2->VolumeIndex]; - const CItem &item1 = db1.Items[p1->ItemIndex]; - const CItem &item2 = db2.Items[p2->ItemIndex];; - bool isDir1 = item1.IsDirectory(); - bool isDir2 = item2.IsDirectory(); - if (isDir1 && !isDir2) - return -1; - if (isDir2 && !isDir1) - return 1; - int f1 = mvDb.GetFolderIndex(p1); - int f2 = mvDb.GetFolderIndex(p2); - RINOZ(MyCompare(f1, f2)); - RINOZ(MyCompare(item1.Offset, item2.Offset)); - RINOZ(MyCompare(item1.Size, item2.Size)); - return CompareMvItems2(p1, p2); -} - -bool CMvDatabaseEx::AreItemsEqual(int i1, int i2) -{ - const CMvItem *p1 = &Items[i1]; - const CMvItem *p2 = &Items[i2]; - const CDatabaseEx &db1 = Volumes[p1->VolumeIndex]; - const CDatabaseEx &db2 = Volumes[p2->VolumeIndex]; - const CItem &item1 = db1.Items[p1->ItemIndex]; - const CItem &item2 = db2.Items[p2->ItemIndex];; - int f1 = GetFolderIndex(p1); - int f2 = GetFolderIndex(p2); - if (f1 != f2) - return false; - if (item1.Offset != item2.Offset) - return false; - if (item1.Size != item2.Size) - return false; - - return true; -} - -void CMvDatabaseEx::FillSortAndShrink() -{ - Items.Clear(); - StartFolderOfVol.Clear(); - FolderStartFileIndex.Clear(); - int offset = 0; - for (int v = 0; v < Volumes.Size(); v++) - { - const CDatabaseEx &db = Volumes[v]; - int curOffset = offset; - if (db.IsTherePrevFolder()) - curOffset--; - StartFolderOfVol.Add(curOffset); - offset += db.GetNumberOfNewFolders(); - - CMvItem mvItem; - mvItem.VolumeIndex = v; - for (int i = 0 ; i < db.Items.Size(); i++) - { - mvItem.ItemIndex = i; - Items.Add(mvItem); - } - } - - Items.Sort(CompareMvItems, (void *)this); - int j = 1; - int i; - for (i = 1; i < Items.Size(); i++) - if (!AreItemsEqual(i, i -1)) - Items[j++] = Items[i]; - Items.DeleteFrom(j); - - for (i = 0; i < Items.Size(); i++) - { - const CMvItem &mvItem = Items[i]; - int folderIndex = GetFolderIndex(&mvItem); - if (folderIndex >= FolderStartFileIndex.Size()) - FolderStartFileIndex.Add(i); - } -} - -bool CMvDatabaseEx::Check() -{ - for (int v = 1; v < Volumes.Size(); v++) - { - const CDatabaseEx &db1 = Volumes[v]; - if (db1.IsTherePrevFolder()) - { - const CDatabaseEx &db0 = Volumes[v - 1]; - if (db0.Folders.IsEmpty() || db1.Folders.IsEmpty()) - return false; - const CFolder &f0 = db0.Folders.Back(); - const CFolder &f1 = db1.Folders.Front(); - if (f0.CompressionTypeMajor != f1.CompressionTypeMajor || - f0.CompressionTypeMinor != f1.CompressionTypeMinor) - return false; - } - } - UInt64 maxPos = 0; - int prevFolder = -2; - for(int i = 0; i < Items.Size(); i++) - { - const CMvItem &mvItem = Items[i]; - int fIndex = GetFolderIndex(&mvItem); - if (fIndex >= FolderStartFileIndex.Size()) - return false; - const CItem &item = Volumes[mvItem.VolumeIndex].Items[mvItem.ItemIndex]; - if (item.IsDirectory()) - continue; - int folderIndex = GetFolderIndex(&mvItem); - if (folderIndex != prevFolder) - { - prevFolder = folderIndex; - maxPos = 0; - continue; - } - if (item.Offset < maxPos) - return false; - maxPos = item.GetEndOffset(); - if (maxPos < item.Offset) - return false; - } - return true; -} - -}} diff --git a/7zip/Archive/Cab/CabIn.h b/7zip/Archive/Cab/CabIn.h deleted file mode 100755 index 4e817e94..00000000 --- a/7zip/Archive/Cab/CabIn.h +++ /dev/null @@ -1,166 +0,0 @@ -// Archive/CabIn.h - -#ifndef __ARCHIVE_CAB_IN_H -#define __ARCHIVE_CAB_IN_H - -#include "../../IStream.h" -#include "../../Common/InBuffer.h" -#include "CabHeader.h" -#include "CabItem.h" - -namespace NArchive { -namespace NCab { - -class CInArchiveException -{ -public: - enum CCauseType - { - kUnexpectedEndOfArchive = 0, - kIncorrectArchive, - kUnsupported, - } Cause; - CInArchiveException(CCauseType cause) : Cause(cause) {} -}; - -struct COtherArchive -{ - AString FileName; - AString DiskName; -}; - -struct CArchiveInfo -{ - Byte VersionMinor; /* cabinet file format version, minor */ - Byte VersionMajor; /* cabinet file format version, major */ - UInt16 NumFolders; /* number of CFFOLDER entries in this cabinet */ - UInt16 NumFiles; /* number of CFFILE entries in this cabinet */ - UInt16 Flags; /* cabinet file option indicators */ - UInt16 SetID; /* must be the same for all cabinets in a set */ - UInt16 CabinetNumber; /* number of this cabinet file in a set */ - - bool ReserveBlockPresent() const { return (Flags & NHeader::NArchive::NFlags::kReservePresent) != 0; } - - bool IsTherePrev() const { return (Flags & NHeader::NArchive::NFlags::kPrevCabinet) != 0; } - bool IsThereNext() const { return (Flags & NHeader::NArchive::NFlags::kNextCabinet) != 0; } - - UInt16 PerCabinetAreaSize; // (optional) size of per-cabinet reserved area - Byte PerFolderAreaSize; // (optional) size of per-folder reserved area - Byte PerDataBlockAreaSize; // (optional) size of per-datablock reserved area - - Byte GetDataBlockReserveSize() const { return (Byte)(ReserveBlockPresent() ? PerDataBlockAreaSize : 0); } - - COtherArchive PreviousArchive; - COtherArchive NextArchive; - - CArchiveInfo() - { - Clear(); - } - - void Clear() - { - PerCabinetAreaSize = 0; - PerFolderAreaSize = 0; - PerDataBlockAreaSize = 0; - } -}; - -struct CInArchiveInfo: public CArchiveInfo -{ - UInt32 Size; /* size of this cabinet file in bytes */ - UInt32 FileHeadersOffset; //offset of the first CFFILE entry -}; - - -class CDatabase -{ -public: - UInt64 StartPosition; - CInArchiveInfo ArchiveInfo; - CObjectVector Folders; - CObjectVector Items; - void Clear() - { - ArchiveInfo.Clear(); - Folders.Clear(); - Items.Clear(); - } - bool IsTherePrevFolder() const - { - for (int i = 0; i < Items.Size(); i++) - if (Items[i].ContinuedFromPrev()) - return true; - return false; - } - int GetNumberOfNewFolders() const - { - int res = Folders.Size(); - if (IsTherePrevFolder()) - res--; - return res; - } - UInt32 GetFileOffset(int index) const { return Items[index].Offset; } - UInt32 GetFileSize(int index) const { return Items[index].Size; } -}; - -class CDatabaseEx: public CDatabase -{ -public: - CMyComPtr Stream; -}; - -struct CMvItem -{ - int VolumeIndex; - int ItemIndex; -}; - -class CMvDatabaseEx -{ - bool AreItemsEqual(int i1, int i2); -public: - CObjectVector Volumes; - CRecordVector Items; - CRecordVector StartFolderOfVol; - CRecordVector FolderStartFileIndex; - int GetFolderIndex(const CMvItem *mvi) const - { - const CDatabaseEx &db = Volumes[mvi->VolumeIndex]; - return StartFolderOfVol[mvi->VolumeIndex] + - db.Items[mvi->ItemIndex].GetFolderIndex(db.Folders.Size()); - } - void Clear() - { - Volumes.Clear(); - Items.Clear(); - StartFolderOfVol.Clear(); - FolderStartFileIndex.Clear(); - } - void FillSortAndShrink(); - bool Check(); -}; - -class CInArchive -{ - CInBuffer inBuffer; - - Byte ReadByte(); - UInt16 ReadUInt16(); - UInt32 ReadUInt32(); - AString SafeReadName(); - void Skeep(size_t size); - void ReadOtherArchive(COtherArchive &oa); - - HRESULT Open2(IInStream *inStream, - const UInt64 *searchHeaderSizeLimit, - CDatabase &database); -public: - HRESULT Open( - const UInt64 *searchHeaderSizeLimit, - CDatabaseEx &database); -}; - -}} - -#endif diff --git a/7zip/Archive/Cab/CabItem.h b/7zip/Archive/Cab/CabItem.h deleted file mode 100755 index d8b56325..00000000 --- a/7zip/Archive/Cab/CabItem.h +++ /dev/null @@ -1,62 +0,0 @@ -// Archive/CabItem.h - -#ifndef __ARCHIVE_CAB_ITEM_H -#define __ARCHIVE_CAB_ITEM_H - -#include "Common/Types.h" -#include "Common/String.h" -#include "CabHeader.h" - -namespace NArchive { -namespace NCab { - -struct CFolder -{ - UInt32 DataStart; // offset of the first CFDATA block in this folder - UInt16 NumDataBlocks; // number of CFDATA blocks in this folder - Byte CompressionTypeMajor; - Byte CompressionTypeMinor; - Byte GetCompressionMethod() const { return (Byte)(CompressionTypeMajor & 0xF); } -}; - -class CItem -{ -public: - AString Name; - UInt32 Offset; - UInt32 Size; - UInt32 Time; - UInt16 FolderIndex; - UInt16 Flags; - UInt16 Attributes; - UInt64 GetEndOffset() const { return (UInt64)Offset + Size; } - UInt32 GetWinAttributes() const { return (Attributes & ~NHeader::kFileNameIsUTFAttributeMask); } - bool IsNameUTF() const { return (Attributes & NHeader::kFileNameIsUTFAttributeMask) != 0; } - bool IsDirectory() const { return (Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0; } - - bool ContinuedFromPrev() const - { - return - (FolderIndex == NHeader::NFolderIndex::kContinuedFromPrev) || - (FolderIndex == NHeader::NFolderIndex::kContinuedPrevAndNext); - } - bool ContinuedToNext() const - { - return - (FolderIndex == NHeader::NFolderIndex::kContinuedToNext) || - (FolderIndex == NHeader::NFolderIndex::kContinuedPrevAndNext); - } - - int GetFolderIndex(int numFolders) const - { - if (ContinuedFromPrev()) - return 0; - if (ContinuedToNext()) - return (numFolders - 1); - return FolderIndex; - } -}; - -}} - -#endif diff --git a/7zip/Archive/Cab/DllExports.cpp b/7zip/Archive/Cab/DllExports.cpp deleted file mode 100755 index fa17f10b..00000000 --- a/7zip/Archive/Cab/DllExports.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "CabHandler.h" -#include "../../ICoder.h" - -// {23170F69-40C1-278A-1000-000110080000} -DEFINE_GUID(CLSID_CCabHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x08, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE, DWORD, LPVOID) -{ - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CCabHandler) - return CLASS_E_CLASSNOTAVAILABLE; - if (*interfaceID != IID_IInArchive) - return E_NOINTERFACE; - CMyComPtr inArchive = (IInArchive *)new NArchive::NCab::CHandler; - *outObject = inArchive.Detach(); - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Cab"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CCabHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"cab"; - break; - case NArchive::kUpdate: - propVariant = false; - break; - case NArchive::kKeepName: - propVariant = false; - break; - case NArchive::kStartSignature: - { - const char sig[] = { 0x4D, 0x53, 0x43, 0x46 }; - if ((value->bstrVal = ::SysAllocStringByteLen(sig, 4)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - } - propVariant.Detach(value); - return S_OK; -} diff --git a/7zip/Archive/Cab/StdAfx.cpp b/7zip/Archive/Cab/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Archive/Cab/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Archive/Cab/StdAfx.h b/7zip/Archive/Cab/StdAfx.h deleted file mode 100755 index e7fb6986..00000000 --- a/7zip/Archive/Cab/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Archive/Cab/cab.ico b/7zip/Archive/Cab/cab.ico deleted file mode 100755 index cc2007fc..00000000 Binary files a/7zip/Archive/Cab/cab.ico and /dev/null differ diff --git a/7zip/Archive/Cab/makefile b/7zip/Archive/Cab/makefile deleted file mode 100755 index 672afed3..00000000 --- a/7zip/Archive/Cab/makefile +++ /dev/null @@ -1,70 +0,0 @@ -PROG = cab.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib user32.lib - -CAB_OBJS = \ - $O\DllExports.obj \ - $O\CabBlockInStream.obj \ - $O\CabHandler.obj \ - $O\CabHeader.obj \ - $O\CabIn.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\IntToString.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\StringToInt.obj \ - $O\UTFConvert.obj \ - $O\Vector.obj \ - -WIN_OBJS = \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\InBuffer.obj \ - $O\LSBFDecoder.obj \ - $O\OutBuffer.obj \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -COMPRESS_LZX_OBJS = \ - $O\LzxDecoder.obj \ - $O\Lzx86Converter.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(CAB_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(COMPRESS_LZX_OBJS) \ - $O\DeflateDecoder.obj \ - $O\QuantumDecoder.obj \ - $O\LZOutWindow.obj \ - $O\CopyCoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(CAB_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(COMPRESS_LZX_OBJS): ../../Compress/Lzx/$(*B).cpp - $(COMPL_O2) -$O\DeflateDecoder.obj: ../../Compress/Deflate/$(*B).cpp - $(COMPL_O2) -$O\QuantumDecoder.obj: ../../Compress/Quantum/$(*B).cpp - $(COMPL) -$O\LZOutWindow.obj: ../../Compress/LZ/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) - diff --git a/7zip/Archive/Cab/resource.rc b/7zip/Archive/Cab/resource.rc deleted file mode 100755 index fa0792bd..00000000 --- a/7zip/Archive/Cab/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Cab Plugin", "cab") - -101 ICON "cab.ico" diff --git a/7zip/Archive/Chm/Chm.dsp b/7zip/Archive/Chm/Chm.dsp deleted file mode 100755 index 7e0b7c66..00000000 --- a/7zip/Archive/Chm/Chm.dsp +++ /dev/null @@ -1,337 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Chm" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Chm - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Chm.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Chm.mak" CFG="Chm - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Chm - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Chm - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Chm - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CHM_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "../../../" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CHM_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\chm.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Chm - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CHM_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../../" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CHM_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\chm.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Chm - Win32 Release" -# Name "Chm - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\ChmHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\ChmHandler.h -# End Source File -# Begin Source File - -SOURCE=.\ChmHeader.cpp -# End Source File -# Begin Source File - -SOURCE=.\ChmHeader.h -# End Source File -# Begin Source File - -SOURCE=.\ChmIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\ChmIn.h -# End Source File -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\UTFConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\UTFConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Group "LZ" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.h -# End Source File -# End Group -# Begin Group "Lzx" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Lzx\Lzx.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Lzx\Lzx86Converter.cpp - -!IF "$(CFG)" == "Chm - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Chm - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Lzx\Lzx86Converter.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Lzx\LzxDecoder.cpp - -!IF "$(CFG)" == "Chm - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Chm - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Lzx\LzxDecoder.h -# End Source File -# End Group -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# End Target -# End Project diff --git a/7zip/Archive/Chm/Chm.dsw b/7zip/Archive/Chm/Chm.dsw deleted file mode 100755 index 58cb09b2..00000000 --- a/7zip/Archive/Chm/Chm.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Chm"=.\Chm.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Archive/Chm/ChmHandler.cpp b/7zip/Archive/Chm/ChmHandler.cpp deleted file mode 100755 index 6b37c73e..00000000 --- a/7zip/Archive/Chm/ChmHandler.cpp +++ /dev/null @@ -1,731 +0,0 @@ -// Chm/Handler.cpp - -#include "StdAfx.h" - -#include "Common/StringConvert.h" -#include "Common/Defs.h" -#include "Common/UTFConvert.h" -#include "Common/ComTry.h" - -#include "Windows/PropVariant.h" -#include "Windows/Time.h" - -#include "../../Common/LimitedStreams.h" -#include "../../Common/StreamUtils.h" -#include "../../Common/ProgressUtils.h" - -#include "../../Compress/Copy/CopyCoder.h" -#include "../../Compress/Lzx/LzxDecoder.h" - -#include "../Common/ItemNameUtils.h" - -#include "ChmHandler.h" - - -using namespace NWindows; -using namespace NTime; - -namespace NArchive { -namespace NChm { - -// #define _CHM_DETAILS - -#ifdef _CHM_DETAILS - -enum -{ - kpidSection = kpidUserDefined, - kpidOffset -}; - -#endif - -STATPROPSTG kProperties[] = -{ - { NULL, kpidPath, VT_BSTR}, - // { NULL, kpidIsFolder, VT_BOOL}, - { NULL, kpidSize, VT_UI8}, - { NULL, kpidMethod, VT_BSTR}, - { NULL, kpidBlock, VT_UI4} - - #ifdef _CHM_DETAILS - , - { L"Section", kpidSection, VT_UI4}, - { L"Offset", kpidOffset, VT_UI4} - #endif -}; - -static const int kNumProperties = sizeof(kProperties) / sizeof(kProperties[0]); - -STDMETHODIMP CHandler::GetArchiveProperty(PROPID /* propID */, PROPVARIANT *value) -{ - value->vt = VT_EMPTY; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties) -{ - *numProperties = sizeof(kProperties) / sizeof(kProperties[0]); - return S_OK; -} - -STDMETHODIMP CHandler::GetPropertyInfo(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) -{ - if(index >= sizeof(kProperties) / sizeof(kProperties[0])) - return E_INVALIDARG; - const STATPROPSTG &srcItem = kProperties[index]; - *propID = srcItem.propid; - *varType = srcItem.vt; - if (srcItem.lpwstrName == 0) - *name = 0; - else - *name = ::SysAllocString(srcItem.lpwstrName); - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) -{ - *numProperties = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetArchivePropertyInfo(UInt32 /* index */, - BSTR * /* name */, PROPID * /* propID */, VARTYPE * /* varType */) -{ - return E_INVALIDARG; -} - -STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) -{ - COM_TRY_BEGIN - NWindows::NCOM::CPropVariant propVariant; - if (m_Database.NewFormat) - { - switch(propID) - { - case kpidSize: - propVariant = (UInt64)m_Database.NewFormatString.Length(); - break; - } - propVariant.Detach(value); - return S_OK; - } - int entryIndex; - if (m_Database.LowLevel) - entryIndex = index; - else - entryIndex = m_Database.Indices[index]; - const CItem &item = m_Database.Items[entryIndex]; - switch(propID) - { - case kpidPath: - { - UString us; - if (ConvertUTF8ToUnicode(item.Name, us)) - { - if (!m_Database.LowLevel) - { - if (us.Length() > 1) - if (us[0] == L'/') - us.Delete(0); - } - propVariant = NItemName::GetOSName2(us); - } - break; - } - case kpidIsFolder: - propVariant = item.IsDirectory(); - break; - case kpidSize: - propVariant = item.Size; - break; - case kpidMethod: - { - if (!item.IsDirectory()) - if (item.Section == 0) - propVariant = L"Copy"; - else if (item.Section < m_Database.Sections.Size()) - propVariant = m_Database.Sections[(int)item.Section].GetMethodName(); - break; - } - case kpidBlock: - if (m_Database.LowLevel) - propVariant = item.Section; - else if (item.Section != 0) - propVariant = m_Database.GetFolder(index); - break; - - #ifdef _CHM_DETAILS - - case kpidSection: - propVariant = (UInt32)item.Section; - break; - case kpidOffset: - propVariant = (UInt32)item.Offset; - break; - - #endif - } - propVariant.Detach(value); - return S_OK; - COM_TRY_END -} - -class CPropgressImp: public CProgressVirt -{ - CMyComPtr m_OpenArchiveCallback; -public: - STDMETHOD(SetTotal)(const UInt64 *numFiles); - STDMETHOD(SetCompleted)(const UInt64 *numFiles); - void Init(IArchiveOpenCallback *openArchiveCallback) - { m_OpenArchiveCallback = openArchiveCallback; } -}; - -STDMETHODIMP CPropgressImp::SetTotal(const UInt64 *numFiles) -{ - if (m_OpenArchiveCallback) - return m_OpenArchiveCallback->SetCompleted(numFiles, NULL); - return S_OK; -} - -STDMETHODIMP CPropgressImp::SetCompleted(const UInt64 *numFiles) -{ - if (m_OpenArchiveCallback) - return m_OpenArchiveCallback->SetCompleted(numFiles, NULL); - return S_OK; -} - -STDMETHODIMP CHandler::Open(IInStream *inStream, - const UInt64 *maxCheckStartPosition, - IArchiveOpenCallback *openArchiveCallback) -{ - COM_TRY_BEGIN - m_Stream.Release(); - try - { - CInArchive archive; - CPropgressImp progressImp; - progressImp.Init(openArchiveCallback); - RINOK(archive.Open(inStream, maxCheckStartPosition, m_Database)); - /* - if (m_Database.LowLevel) - return S_FALSE; - */ - m_Stream = inStream; - } - catch(...) - { - return S_FALSE; - } - return S_OK; - COM_TRY_END -} - -STDMETHODIMP CHandler::Close() -{ - m_Database.Clear(); - m_Stream.Release(); - return S_OK; -} - -class CChmFolderOutStream: - public ISequentialOutStream, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP - - HRESULT Write2(const void *data, UInt32 size, UInt32 *processedSize, bool isOK); - STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); - - UInt64 m_FolderSize; - UInt64 m_PosInFolder; - UInt64 m_PosInSection; - const CRecordVector *m_ExtractStatuses; - int m_StartIndex; - int m_CurrentIndex; - int m_NumFiles; - -private: - const CFilesDatabase *m_Database; - CMyComPtr m_ExtractCallback; - bool m_TestMode; - - bool m_IsOk; - bool m_FileIsOpen; - UInt64 m_RemainFileSize; - CMyComPtr m_RealOutStream; - - HRESULT OpenFile(); - HRESULT WriteEmptyFiles(); -public: - void Init( - const CFilesDatabase *database, - IArchiveExtractCallback *extractCallback, - bool testMode); - HRESULT FlushCorrupted(); -}; - -void CChmFolderOutStream::Init( - const CFilesDatabase *database, - IArchiveExtractCallback *extractCallback, - bool testMode) -{ - m_Database = database; - m_ExtractCallback = extractCallback; - m_TestMode = testMode; - - m_CurrentIndex = 0; - m_FileIsOpen = false; -} - -HRESULT CChmFolderOutStream::OpenFile() -{ - Int32 askMode = (*m_ExtractStatuses)[m_CurrentIndex] ? (m_TestMode ? - NExtract::NAskMode::kTest : - NExtract::NAskMode::kExtract) : - NExtract::NAskMode::kSkip; - m_RealOutStream.Release(); - RINOK(m_ExtractCallback->GetStream(m_StartIndex + m_CurrentIndex, &m_RealOutStream, askMode)); - if (!m_RealOutStream && !m_TestMode) - askMode = NArchive::NExtract::NAskMode::kSkip; - return m_ExtractCallback->PrepareOperation(askMode); -} - -HRESULT CChmFolderOutStream::WriteEmptyFiles() -{ - if (m_FileIsOpen) - return S_OK; - for(;m_CurrentIndex < m_NumFiles; m_CurrentIndex++) - { - UInt64 fileSize = m_Database->GetFileSize(m_StartIndex + m_CurrentIndex); - if (fileSize != 0) - return S_OK; - HRESULT result = OpenFile(); - m_RealOutStream.Release(); - RINOK(result); - RINOK(m_ExtractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - } - return S_OK; -} - -// This is WritePart function -HRESULT CChmFolderOutStream::Write2(const void *data, UInt32 size, UInt32 *processedSize, bool isOK) -{ - UInt32 realProcessed = 0; - if (processedSize != NULL) - *processedSize = 0; - while(size != 0) - { - if (m_FileIsOpen) - { - UInt32 numBytesToWrite = (UInt32)MyMin(m_RemainFileSize, (UInt64)(size)); - HRESULT res = S_OK; - if (numBytesToWrite > 0) - { - if (!isOK) - m_IsOk = false; - if (m_RealOutStream) - { - UInt32 processedSizeLocal = 0; - res = m_RealOutStream->Write((const Byte *)data, numBytesToWrite, &processedSizeLocal); - numBytesToWrite = processedSizeLocal; - } - } - realProcessed += numBytesToWrite; - if (processedSize != NULL) - *processedSize = realProcessed; - data = (const void *)((const Byte *)data + numBytesToWrite); - size -= numBytesToWrite; - m_RemainFileSize -= numBytesToWrite; - m_PosInSection += numBytesToWrite; - m_PosInFolder += numBytesToWrite; - if (res != S_OK) - return res; - if (m_RemainFileSize == 0) - { - m_RealOutStream.Release(); - RINOK(m_ExtractCallback->SetOperationResult( - m_IsOk ? - NArchive::NExtract::NOperationResult::kOK: - NArchive::NExtract::NOperationResult::kDataError)); - m_FileIsOpen = false; - } - if (realProcessed > 0) - break; // with this break this function works as write part - } - else - { - if (m_CurrentIndex >= m_NumFiles) - return E_FAIL; - int fullIndex = m_StartIndex + m_CurrentIndex; - m_RemainFileSize = m_Database->GetFileSize(fullIndex); - UInt64 fileOffset = m_Database->GetFileOffset(fullIndex); - if (fileOffset < m_PosInSection) - return E_FAIL; - if (fileOffset > m_PosInSection) - { - UInt32 numBytesToWrite = (UInt32)MyMin(fileOffset - m_PosInSection, UInt64(size)); - realProcessed += numBytesToWrite; - if (processedSize != NULL) - *processedSize = realProcessed; - data = (const void *)((const Byte *)data + numBytesToWrite); - size -= numBytesToWrite; - m_PosInSection += numBytesToWrite; - m_PosInFolder += numBytesToWrite; - } - if (fileOffset == m_PosInSection) - { - RINOK(OpenFile()); - m_FileIsOpen = true; - m_CurrentIndex++; - m_IsOk = true; - } - } - } - return WriteEmptyFiles(); -} - -STDMETHODIMP CChmFolderOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize) -{ - return Write2(data, size, processedSize, true); -} - -HRESULT CChmFolderOutStream::FlushCorrupted() -{ - const UInt32 kBufferSize = (1 << 10); - Byte buffer[kBufferSize]; - for (int i = 0; i < kBufferSize; i++) - buffer[i] = 0; - while(m_PosInFolder < m_FolderSize) - { - UInt32 size = (UInt32)MyMin(m_FolderSize - m_PosInFolder, (UInt64)kBufferSize); - UInt32 processedSizeLocal = 0; - RINOK(Write2(buffer, size, &processedSizeLocal, false)); - } - return S_OK; -} - - -STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, - Int32 _aTestMode, IArchiveExtractCallback *extractCallback) -{ - COM_TRY_BEGIN - bool allFilesMode = (numItems == UInt32(-1)); - - if (allFilesMode) - numItems = m_Database.NewFormat ? 1: - (m_Database.LowLevel ? - m_Database.Items.Size(): - m_Database.Indices.Size()); - if(numItems == 0) - return S_OK; - bool testMode = (_aTestMode != 0); - - UInt64 currentTotalSize = 0; - - CMyComPtr copyCoder; - UInt32 i; - - CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream; - CMyComPtr inStream(streamSpec); - - if (m_Database.LowLevel) - { - UInt64 currentItemSize = 0; - UInt64 totalSize = 0; - if (m_Database.NewFormat) - totalSize = m_Database.NewFormatString.Length(); - else - for(i = 0; i < numItems; i++) - totalSize += m_Database.Items[allFilesMode ? i : indices[i]].Size; - extractCallback->SetTotal(totalSize); - - for(i = 0; i < numItems; i++, currentTotalSize += currentItemSize) - { - RINOK(extractCallback->SetCompleted(¤tTotalSize)); - CMyComPtr realOutStream; - Int32 askMode; - askMode = testMode ? NArchive::NExtract::NAskMode::kTest : - NArchive::NExtract::NAskMode::kExtract; - Int32 index = allFilesMode ? i : indices[i]; - RINOK(extractCallback->GetStream(index, &realOutStream, askMode)); - - if (m_Database.NewFormat) - { - if (index != 0) - return E_FAIL; - if(!testMode && (!realOutStream)) - continue; - if (!testMode) - { - UInt32 size = m_Database.NewFormatString.Length(); - RINOK(WriteStream(realOutStream, (const char *)m_Database.NewFormatString, size, 0)); - } - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - continue; - } - const CItem &item = m_Database.Items[index]; - - currentItemSize = item.Size; - - if(!testMode && (!realOutStream)) - continue; - RINOK(extractCallback->PrepareOperation(askMode)); - if (item.Section != 0) - { - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kUnSupportedMethod)); - continue; - } - - if (testMode) - { - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - continue; - } - - RINOK(m_Stream->Seek(m_Database.ContentOffset + item.Offset, STREAM_SEEK_SET, NULL)); - streamSpec->SetStream(m_Stream); - streamSpec->Init(item.Size); - - CLocalProgress *localProgressSpec = new CLocalProgress; - CMyComPtr progress = localProgressSpec; - localProgressSpec->Init(extractCallback, false); - - CLocalCompressProgressInfo *localCompressProgressSpec = new CLocalCompressProgressInfo; - CMyComPtr compressProgress = localCompressProgressSpec; - localCompressProgressSpec->Init(progress, ¤tTotalSize, ¤tTotalSize); - - if(!copyCoder) - copyCoder = new NCompress::CCopyCoder; - RINOK(copyCoder->Code(inStream, realOutStream, NULL, NULL, compressProgress)); - realOutStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - } - return S_OK; - } - - UInt64 lastFolderIndex = ((UInt64)0 - 1); - for(i = 0; i < numItems; i++) - { - UInt32 index = allFilesMode ? i : indices[i]; - int entryIndex = m_Database.Indices[index]; - const CItem &item = m_Database.Items[entryIndex]; - UInt64 sectionIndex = item.Section; - if (item.IsDirectory() || item.Size == 0) - continue; - if (sectionIndex == 0) - { - currentTotalSize += item.Size; - continue; - } - const CSectionInfo §ion = m_Database.Sections[(int)item.Section]; - if (section.IsLzx()) - { - const CLzxInfo &lzxInfo = section.Methods[0].LzxInfo; - UInt64 folderIndex = m_Database.GetFolder(index); - if (lastFolderIndex == folderIndex) - folderIndex++; - lastFolderIndex = m_Database.GetLastFolder(index); - for (; folderIndex <= lastFolderIndex; folderIndex++) - currentTotalSize += lzxInfo.GetFolderSize(); - } - } - - RINOK(extractCallback->SetTotal(currentTotalSize)); - - NCompress::NLzx::CDecoder *lzxDecoderSpec = 0; - CMyComPtr lzxDecoder; - CChmFolderOutStream *chmFolderOutStream = 0; - CMyComPtr outStream; - - currentTotalSize = 0; - - CRecordVector extractStatuses; - for(i = 0; i < numItems;) - { - RINOK(extractCallback->SetCompleted(¤tTotalSize)); - UInt32 index = allFilesMode ? i : indices[i]; - i++; - int entryIndex = m_Database.Indices[index]; - const CItem &item = m_Database.Items[entryIndex]; - UInt64 sectionIndex = item.Section; - Int32 askMode= testMode ? - NArchive::NExtract::NAskMode::kTest : - NArchive::NExtract::NAskMode::kExtract; - if (item.IsDirectory()) - { - CMyComPtr realOutStream; - RINOK(extractCallback->GetStream(index, &realOutStream, askMode)); - RINOK(extractCallback->PrepareOperation(askMode)); - realOutStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - continue; - } - - CLocalProgress *localProgressSpec = new CLocalProgress; - CMyComPtr progress = localProgressSpec; - localProgressSpec->Init(extractCallback, false); - - CLocalCompressProgressInfo *localCompressProgressSpec = new CLocalCompressProgressInfo; - CMyComPtr compressProgress = localCompressProgressSpec; - localCompressProgressSpec->Init(progress, NULL, ¤tTotalSize); - - if (item.Size == 0 || sectionIndex == 0) - { - CMyComPtr realOutStream; - RINOK(extractCallback->GetStream(index, &realOutStream, askMode)); - if(!testMode && (!realOutStream)) - continue; - RINOK(extractCallback->PrepareOperation(askMode)); - if (!testMode && item.Size != 0) - { - RINOK(m_Stream->Seek(m_Database.ContentOffset + item.Offset, STREAM_SEEK_SET, NULL)); - streamSpec->SetStream(m_Stream); - streamSpec->Init(item.Size); - if(!copyCoder) - copyCoder = new NCompress::CCopyCoder; - RINOK(copyCoder->Code(inStream, realOutStream, NULL, NULL, compressProgress)); - } - realOutStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - currentTotalSize += item.Size; - continue; - } - - const CSectionInfo §ion = m_Database.Sections[(int)sectionIndex]; - - if (!section.IsLzx()) - { - CMyComPtr realOutStream; - RINOK(extractCallback->GetStream(index, &realOutStream, askMode)); - if(!testMode && (!realOutStream)) - continue; - RINOK(extractCallback->PrepareOperation(askMode)); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kUnSupportedMethod)); - continue; - } - - const CLzxInfo &lzxInfo = section.Methods[0].LzxInfo; - - if (chmFolderOutStream == 0) - { - chmFolderOutStream = new CChmFolderOutStream; - outStream = chmFolderOutStream; - } - - chmFolderOutStream->Init(&m_Database, extractCallback, testMode); - - if(lzxDecoderSpec == NULL) - { - lzxDecoderSpec = new NCompress::NLzx::CDecoder; - lzxDecoder = lzxDecoderSpec; - } - - UInt64 folderIndex = m_Database.GetFolder(index); - - UInt64 compressedPos = m_Database.ContentOffset + section.Offset; - UInt32 numDictBits = lzxInfo.GetNumDictBits(); - RINOK(lzxDecoderSpec->SetParams(numDictBits)); - - const CItem *lastItem = &item; - extractStatuses.Clear(); - extractStatuses.Add(true); - - for (;; folderIndex++) - { - RINOK(extractCallback->SetCompleted(¤tTotalSize)); - - UInt64 startPos = lzxInfo.GetFolderPos(folderIndex); - UInt64 finishPos = lastItem->Offset + lastItem->Size; - UInt64 limitFolderIndex = lzxInfo.GetFolder(finishPos); - - lastFolderIndex = m_Database.GetLastFolder(index); - UInt64 folderSize = lzxInfo.GetFolderSize(); - UInt64 unPackSize = folderSize; - if (extractStatuses.IsEmpty()) - chmFolderOutStream->m_StartIndex = index + 1; - else - chmFolderOutStream->m_StartIndex = index; - if (limitFolderIndex == folderIndex) - { - for(; i < numItems; i++) - { - UInt32 nextIndex = allFilesMode ? i : indices[i]; - int entryIndex = m_Database.Indices[nextIndex]; - const CItem &nextItem = m_Database.Items[entryIndex]; - if (nextItem.Section != sectionIndex) - break; - UInt64 nextFolderIndex = m_Database.GetFolder(nextIndex); - if (nextFolderIndex != folderIndex) - break; - for (index++; index < nextIndex; index++) - extractStatuses.Add(false); - extractStatuses.Add(true); - index = nextIndex; - lastItem = &nextItem; - if (nextItem.Size != 0) - finishPos = nextItem.Offset + nextItem.Size; - lastFolderIndex = m_Database.GetLastFolder(index); - } - } - unPackSize = MyMin(finishPos - startPos, unPackSize); - - chmFolderOutStream->m_FolderSize = folderSize; - chmFolderOutStream->m_PosInFolder = 0; - chmFolderOutStream->m_PosInSection = startPos; - chmFolderOutStream->m_ExtractStatuses = &extractStatuses; - chmFolderOutStream->m_NumFiles = extractStatuses.Size(); - chmFolderOutStream->m_CurrentIndex = 0; - try - { - UInt64 startBlock = lzxInfo.GetBlockIndexFromFolderIndex(folderIndex); - const CResetTable &rt = lzxInfo.ResetTable; - UInt32 numBlocks = (UInt32)rt.GetNumBlocks(unPackSize); - for (UInt32 b = 0; b < numBlocks; b++) - { - UInt64 completedSize = currentTotalSize + chmFolderOutStream->m_PosInSection - startPos; - RINOK(extractCallback->SetCompleted(&completedSize)); - UInt64 bCur = startBlock + b; - if (bCur >= rt.ResetOffsets.Size()) - return E_FAIL; - UInt64 startOffset = rt.ResetOffsets[(int)startBlock]; - UInt64 offset = rt.ResetOffsets[(int)bCur]; - UInt64 compressedSize; - rt.GetCompressedSizeOfBlock(bCur, compressedSize); - UInt64 rem = finishPos - chmFolderOutStream->m_PosInSection; - if (rem > rt.BlockSize) - rem = rt.BlockSize; - // const UInt64 *offsets = (const UInt64 *)&rt.ResetOffsets.Front(); - RINOK(m_Stream->Seek(compressedPos + offset, STREAM_SEEK_SET, NULL)); - streamSpec->SetStream(m_Stream); - streamSpec->Init(compressedSize); - lzxDecoderSpec->SetKeepHistory(b > 0, (int)((offset - startOffset) & 1)); - RINOK(lzxDecoder->Code(inStream, outStream, NULL, &rem, NULL)); - } - } - catch(...) - { - RINOK(chmFolderOutStream->FlushCorrupted()); - } - currentTotalSize += folderSize; - if (folderIndex == lastFolderIndex) - break; - extractStatuses.Clear(); - } - } - return S_OK; - COM_TRY_END -} - -STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems) -{ - *numItems = m_Database.NewFormat ? 1: - (m_Database.LowLevel ? - m_Database.Items.Size(): - m_Database.Indices.Size()); - return S_OK; -} - -}} diff --git a/7zip/Archive/Chm/ChmHandler.h b/7zip/Archive/Chm/ChmHandler.h deleted file mode 100755 index dd0692ba..00000000 --- a/7zip/Archive/Chm/ChmHandler.h +++ /dev/null @@ -1,46 +0,0 @@ -// ChmHandler.h - -#ifndef __ARCHIVE_CHM_HANDLER_H -#define __ARCHIVE_CHM_HANDLER_H - -#include "Common/MyCom.h" -#include "../IArchive.h" -#include "ChmIn.h" - -namespace NArchive { -namespace NChm { - -class CHandler: - public IInArchive, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP - - STDMETHOD(Open)(IInStream *stream, - const UInt64 *maxCheckStartPosition, - IArchiveOpenCallback *openArchiveCallback); - STDMETHOD(Close)(); - STDMETHOD(GetNumberOfItems)(UInt32 *numItems); - STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value); - STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems, - Int32 testMode, IArchiveExtractCallback *extractCallback); - - STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value); - - STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties); - STDMETHOD(GetPropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - - STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties); - STDMETHOD(GetArchivePropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - -private: - CFilesDatabase m_Database; - CMyComPtr m_Stream; -}; - -}} - -#endif diff --git a/7zip/Archive/Chm/ChmHeader.cpp b/7zip/Archive/Chm/ChmHeader.cpp deleted file mode 100755 index 4d485b6c..00000000 --- a/7zip/Archive/Chm/ChmHeader.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// Archive/Chm/Header.h - -#include "StdAfx.h" - -#include "ChmHeader.h" - -namespace NArchive{ -namespace NChm{ -namespace NHeader{ - -UInt32 kItsfSignature = 0x46535449 + 1; -UInt32 kItolSignature = 0x4C4F5449 + 1; -static class CSignatureInitializer -{ -public: - CSignatureInitializer() - { - kItsfSignature--; - kItolSignature--; - } -}g_SignatureInitializer; - - -}}} diff --git a/7zip/Archive/Chm/ChmHeader.h b/7zip/Archive/Chm/ChmHeader.h deleted file mode 100755 index 9f1bd42b..00000000 --- a/7zip/Archive/Chm/ChmHeader.h +++ /dev/null @@ -1,28 +0,0 @@ -// Archive/Chm/Header.h - -#ifndef __ARCHIVE_CHM_HEADER_H -#define __ARCHIVE_CHM_HEADER_H - -#include "Common/Types.h" - -namespace NArchive { -namespace NChm { -namespace NHeader{ - -const UInt32 kItspSignature = 0x50535449; -const UInt32 kPmglSignature = 0x4C474D50; -const UInt32 kLzxcSignature = 0x43585A4C; - -const UInt32 kIfcmSignature = 0x4D434649; -const UInt32 kAollSignature = 0x4C4C4F41; -const UInt32 kCaolSignature = 0x4C4F4143; - -extern UInt32 kItsfSignature; - -extern UInt32 kItolSignature; -const UInt32 kItlsSignature = 0x534C5449; -UInt64 inline GetHxsSignature() { return ((UInt64)kItlsSignature << 32) | kItolSignature; } - -}}} - -#endif diff --git a/7zip/Archive/Chm/ChmIn.cpp b/7zip/Archive/Chm/ChmIn.cpp deleted file mode 100755 index 8c56ec91..00000000 --- a/7zip/Archive/Chm/ChmIn.cpp +++ /dev/null @@ -1,925 +0,0 @@ -// Archive/ChmIn.cpp - -#include "StdAfx.h" - -#include "Common/StringConvert.h" -#include "Common/MyCom.h" -#include "Common/UTFConvert.h" -#include "Common/IntToString.h" -#include "Windows/Defs.h" - -#include "../../Common/LimitedStreams.h" -#include "ChmIn.h" - -namespace NArchive{ -namespace NChm{ - -// define CHM_LOW, if you want to see low level items -// #define CHM_LOW - -static const GUID kChmLzxGuid = - { 0x7FC28940, 0x9D31, 0x11D0, 0x9B, 0x27, 0x00, 0xA0, 0xC9, 0x1E, 0x9C, 0x7C }; -static const GUID kHelp2LzxGuid = - { 0x0A9007C6, 0x4076, 0x11D3, 0x87, 0x89, 0x00, 0x00, 0xF8, 0x10, 0x57, 0x54 }; -static const GUID kDesGuid = - { 0x67F6E4A2, 0x60BF, 0x11D3, 0x85, 0x40, 0x00, 0xC0, 0x4F, 0x58, 0xC3, 0xCF }; - -static bool AreGuidsEqual(REFGUID g1, REFGUID g2) -{ - if (g1.Data1 != g2.Data1 || - g1.Data2 != g2.Data2 || - g1.Data3 != g2.Data3) - return false; - for (int i = 0; i < 8; i++) - if (g1.Data4[i] != g2.Data4[i]) - return false; - return true; -} - -static char GetHex(Byte value) -{ - return (char)((value < 10) ? ('0' + value) : ('A' + (value - 10))); -} - -static void PrintByte(Byte b, AString &s) -{ - s += GetHex(b >> 4); - s += GetHex(b & 0xF); -} - -static void PrintUInt16(UInt16 v, AString &s) -{ - PrintByte((Byte)(v >> 8), s); - PrintByte((Byte)v, s); -} - -static void PrintUInt32(UInt32 v, AString &s) -{ - PrintUInt16((UInt16)(v >> 16), s); - PrintUInt16((UInt16)v, s); -} - -AString CMethodInfo::GetGuidString() const -{ - AString s; - s += '{'; - PrintUInt32(Guid.Data1, s); - s += '-'; - PrintUInt16(Guid.Data2, s); - s += '-'; - PrintUInt16(Guid.Data3, s); - s += '-'; - PrintByte(Guid.Data4[0], s); - PrintByte(Guid.Data4[1], s); - s += '-'; - for (int i = 2; i < 8; i++) - PrintByte(Guid.Data4[i], s); - s += '}'; - return s; -} - -bool CMethodInfo::IsLzx() const -{ - if (AreGuidsEqual(Guid, kChmLzxGuid)) - return true; - return AreGuidsEqual(Guid, kHelp2LzxGuid); -} - -bool CMethodInfo::IsDes() const -{ - return AreGuidsEqual(Guid, kDesGuid); -} - -UString CMethodInfo::GetName() const -{ - UString s; - if (IsLzx()) - { - s = L"LZX:"; - UInt32 numDictBits = LzxInfo.GetNumDictBits(); - wchar_t temp[32]; - ConvertUInt64ToString(numDictBits, temp); - s += temp; - } - else - { - AString s2; - if (IsDes()) - s2 = "DES"; - else - { - s2 = GetGuidString(); - if (ControlData.GetCapacity() > 0) - { - s2 += ":"; - for (size_t i = 0; i < ControlData.GetCapacity(); i++) - PrintByte(ControlData[i], s2); - } - } - ConvertUTF8ToUnicode(s2, s); - } - return s; -} - -bool CSectionInfo::IsLzx() const -{ - if (Methods.Size() != 1) - return false; - return Methods[0].IsLzx(); -} - -UString CSectionInfo::GetMethodName() const -{ - UString s; - if (!IsLzx()) - { - UString temp; - if (ConvertUTF8ToUnicode(Name, temp)) - s += temp; - s += L": "; - } - for (int i = 0; i < Methods.Size(); i++) - { - if (i != 0) - s += L" "; - s += Methods[i].GetName(); - } - return s; -} - -Byte CInArchive::ReadByte() -{ - Byte b; - if (!_inBuffer.ReadByte(b)) - throw 1; - return b; -} - -void CInArchive::Skeep(size_t size) -{ - while (size-- != 0) - ReadByte(); -} - -void CInArchive::ReadBytes(Byte *data, UInt32 size) -{ - for (UInt32 i = 0; i < size; i++) - data[i] = ReadByte(); -} - -UInt16 CInArchive::ReadUInt16() -{ - UInt16 value = 0; - for (int i = 0; i < 2; i++) - value |= ((UInt16)(ReadByte()) << (8 * i)); - return value; -} - -UInt32 CInArchive::ReadUInt32() -{ - UInt32 value = 0; - for (int i = 0; i < 4; i++) - value |= ((UInt32)(ReadByte()) << (8 * i)); - return value; -} - -UInt64 CInArchive::ReadUInt64() -{ - UInt64 value = 0; - for (int i = 0; i < 8; i++) - value |= ((UInt64)(ReadByte()) << (8 * i)); - return value; -} - -UInt64 CInArchive::ReadEncInt() -{ - UInt64 val = 0;; - for (int i = 0; i < 10; i++) - { - Byte b = ReadByte(); - val |= (b & 0x7F); - if (b < 0x80) - return val; - val <<= 7; - } - throw 1; -} - -void CInArchive::ReadGUID(GUID &g) -{ - g.Data1 = ReadUInt32(); - g.Data2 = ReadUInt16(); - g.Data3 = ReadUInt16(); - ReadBytes(g.Data4, 8); -} - -void CInArchive::ReadString(int size, AString &s) -{ - s.Empty(); - while(size-- != 0) - { - char c = (char)ReadByte(); - if (c == 0) - { - Skeep(size); - return; - } - s += c; - } -} - -void CInArchive::ReadUString(int size, UString &s) -{ - s.Empty(); - while(size-- != 0) - { - wchar_t c = ReadUInt16(); - if (c == 0) - { - Skeep(2 * size); - return; - } - s += c; - } -} - -HRESULT CInArchive::ReadChunk(IInStream *inStream, UInt64 pos, UInt64 size) -{ - RINOK(inStream->Seek(pos, STREAM_SEEK_SET, NULL)); - CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream; - CMyComPtr limitedStream(streamSpec); - streamSpec->SetStream(inStream); - streamSpec->Init(size); - _inBuffer.SetStream(limitedStream); - _inBuffer.Init(); - return S_OK; -} - -HRESULT CInArchive::ReadDirEntry(CDatabase &database) -{ - CItem item; - UInt64 nameLength = ReadEncInt(); - if (nameLength == 0 || nameLength >= 0x10000000) - return S_FALSE; - ReadString((int)nameLength, item.Name); - item.Section = ReadEncInt(); - item.Offset = ReadEncInt(); - item.Size = ReadEncInt(); - database.Items.Add(item); - return S_OK; -} - -HRESULT CInArchive::OpenChm(IInStream *inStream, CDatabase &database) -{ - UInt32 headerSize = ReadUInt32(); - if (headerSize != 0x60) - return S_FALSE; - UInt32 unknown1 = ReadUInt32(); - if (unknown1 != 0 && unknown1 != 1) // it's 0 in one .sll file - return S_FALSE; - /* UInt32 timeStamp = */ ReadUInt32(); - // Considered as a big-endian DWORD, it appears to contain seconds (MSB) and - // fractional seconds (second byte). - // The third and fourth bytes may contain even more fractional bits. - // The 4 least significant bits in the last byte are constant. - /* UInt32 lang = */ ReadUInt32(); - GUID g; - ReadGUID(g); // {7C01FD10-7BAA-11D0-9E0C-00A0-C922-E6EC} - ReadGUID(g); // {7C01FD11-7BAA-11D0-9E0C-00A0-C922-E6EC} - const int kNumSections = 2; - UInt64 sectionOffsets[kNumSections]; - UInt64 sectionSizes[kNumSections]; - int i; - for (i = 0; i < kNumSections; i++) - { - sectionOffsets[i] = ReadUInt64(); - sectionSizes[i] = ReadUInt64(); - } - // if (chmVersion == 3) - database.ContentOffset = ReadUInt64(); - /* - else - database.ContentOffset = _startPosition + 0x58 - */ - - /* - // Section 0 - ReadChunk(inStream, sectionOffsets[0], sectionSizes[0]); - if (sectionSizes[0] != 0x18) - return S_FALSE; - ReadUInt32(); // unknown: 01FE - ReadUInt32(); // unknown: 0 - UInt64 fileSize = ReadUInt64(); - ReadUInt32(); // unknown: 0 - ReadUInt32(); // unknown: 0 - */ - - // Section 1: The Directory Listing - ReadChunk(inStream, sectionOffsets[1], sectionSizes[1]); - if (ReadUInt32() != NHeader::kItspSignature) - return S_FALSE; - if (ReadUInt32() != 1) // version - return S_FALSE; - /* UInt32 dirHeaderSize = */ ReadUInt32(); - ReadUInt32(); // 0x0A (unknown) - UInt32 dirChunkSize = ReadUInt32(); // $1000 - if (dirChunkSize < 32) - return S_FALSE; - /* UInt32 density = */ ReadUInt32(); // "Density" of quickref section, usually 2. - /* UInt32 depth = */ ReadUInt32(); // Depth of the index tree: 1 there is no index, - // 2 if there is one level of PMGI chunks. - - /* UInt32 chunkNumber = */ ReadUInt32(); // Chunk number of root index chunk, -1 if there is none - // (though at least one file has 0 despite there being no - // index chunk, probably a bug.) - /* UInt32 firstPmglChunkNumber = */ ReadUInt32(); // Chunk number of first PMGL (listing) chunk - /* UInt32 lastPmglChunkNumber = */ ReadUInt32(); // Chunk number of last PMGL (listing) chunk - ReadUInt32(); // -1 (unknown) - UInt32 numDirChunks = ReadUInt32(); // Number of directory chunks (total) - /* UInt32 windowsLangId = */ ReadUInt32(); - ReadGUID(g); // {5D02926A-212E-11D0-9DF9-00A0C922E6EC} - ReadUInt32(); // 0x54 (This is the length again) - ReadUInt32(); // -1 (unknown) - ReadUInt32(); // -1 (unknown) - ReadUInt32(); // -1 (unknown) - - for (UInt32 ci = 0; ci < numDirChunks; ci++) - { - UInt64 chunkPos = _inBuffer.GetProcessedSize(); - if (ReadUInt32() == NHeader::kPmglSignature) - { - // The quickref area is written backwards from the end of the chunk. - // One quickref entry exists for every n entries in the file, where n - // is calculated as 1 + (1 << quickref density). So for density = 2, n = 5. - - UInt32 quickrefLength = ReadUInt32(); // Length of free space and/or quickref area at end of directory chunk - if (quickrefLength > dirChunkSize || quickrefLength < 2) - return S_FALSE; - ReadUInt32(); // Always 0 - ReadUInt32(); // Chunk number of previous listing chunk when reading - // directory in sequence (-1 if this is the first listing chunk) - ReadUInt32(); // Chunk number of next listing chunk when reading - // directory in sequence (-1 if this is the last listing chunk) - int numItems = 0; - for (;;) - { - UInt64 offset = _inBuffer.GetProcessedSize() - chunkPos; - UInt32 offsetLimit = dirChunkSize - quickrefLength; - if (offset > offsetLimit) - return S_FALSE; - if (offset == offsetLimit) - break; - RINOK(ReadDirEntry(database)); - numItems++; - } - Skeep(quickrefLength - 2); - if (ReadUInt16() != numItems) - return S_FALSE; - } - else - Skeep(dirChunkSize - 4); - } - return S_OK; -} - -HRESULT CInArchive::OpenHelp2(IInStream *inStream, CDatabase &database) -{ - if (ReadUInt32() != 1) // version - return S_FALSE; - if (ReadUInt32() != 0x28) // Location of header section table - return S_FALSE; - UInt32 numHeaderSections = ReadUInt32(); - const int kNumHeaderSectionsMax = 5; - if (numHeaderSections != kNumHeaderSectionsMax) - return S_FALSE; - ReadUInt32(); // Length of post-header table - GUID g; - ReadGUID(g); // {0A9007C1-4076-11D3-8789-0000F8105754} - - // header section table - UInt64 sectionOffsets[kNumHeaderSectionsMax]; - UInt64 sectionSizes[kNumHeaderSectionsMax]; - UInt32 i; - for (i = 0; i < numHeaderSections; i++) - { - sectionOffsets[i] = ReadUInt64(); - sectionSizes[i] = ReadUInt64(); - } - - // Post-Header - ReadUInt32(); // 2 - ReadUInt32(); // 0x98: offset to CAOL from beginning of post-header) - // ----- Directory information - ReadUInt64(); // Chunk number of top-level AOLI chunk in directory, or -1 - ReadUInt64(); // Chunk number of first AOLL chunk in directory - ReadUInt64(); // Chunk number of last AOLL chunk in directory - ReadUInt64(); // 0 (unknown) - ReadUInt32(); // $2000 (Directory chunk size of directory) - ReadUInt32(); // Quickref density for main directory, usually 2 - ReadUInt32(); // 0 (unknown) - ReadUInt32(); // Depth of main directory index tree - // 1 there is no index, 2 if there is one level of AOLI chunks. - ReadUInt64(); // 0 (unknown) - UInt64 numDirEntries = ReadUInt64(); // Number of directory entries - // ----- Directory Index Information - ReadUInt64(); // -1 (unknown, probably chunk number of top-level AOLI in directory index) - ReadUInt64(); // Chunk number of first AOLL chunk in directory index - ReadUInt64(); // Chunk number of last AOLL chunk in directory index - ReadUInt64(); // 0 (unknown) - ReadUInt32(); // $200 (Directory chunk size of directory index) - ReadUInt32(); // Quickref density for directory index, usually 2 - ReadUInt32(); // 0 (unknown) - ReadUInt32(); // Depth of directory index index tree. - ReadUInt64(); // Possibly flags -- sometimes 1, sometimes 0. - ReadUInt64(); // Number of directory index entries (same as number of AOLL - // chunks in main directory) - - // (The obvious guess for the following two fields, which recur in a number - // of places, is they are maximum sizes for the directory and directory index. - // However, I have seen no direct evidence that this is the case.) - - ReadUInt32(); // $100000 (Same as field following chunk size in directory) - ReadUInt32(); // $20000 (Same as field following chunk size in directory index) - - ReadUInt64(); // 0 (unknown) - if (ReadUInt32() != NHeader::kCaolSignature) - return S_FALSE; - if (ReadUInt32() != 2) // (Most likely a version number) - return S_FALSE; - UInt32 caolLength = ReadUInt32(); // $50 (Length of the CAOL section, which includes the ITSF section) - if (caolLength >= 0x2C) - { - /* UInt32 c7 = */ ReadUInt16(); // Unknown. Remains the same when identical files are built. - // Does not appear to be a checksum. Many files have - // 'HH' (HTML Help?) here, indicating this may be a compiler ID - // field. But at least one ITOL/ITLS compiler does not set this - // field to a constant value. - ReadUInt16(); // 0 (Unknown. Possibly part of 00A4 field) - ReadUInt32(); // Unknown. Two values have been seen -- $43ED, and 0. - ReadUInt32(); // $2000 (Directory chunk size of directory) - ReadUInt32(); // $200 (Directory chunk size of directory index) - ReadUInt32(); // $100000 (Same as field following chunk size in directory) - ReadUInt32(); // $20000 (Same as field following chunk size in directory index) - ReadUInt32(); // 0 (unknown) - ReadUInt32(); // 0 (Unknown) - if (caolLength == 0x2C) - { - database.ContentOffset = 0; - database.NewFormat = true; - } - else if (caolLength == 0x50) - { - ReadUInt32(); // 0 (Unknown) - if (ReadUInt32() != NHeader::kItsfSignature) - return S_FALSE; - if (ReadUInt32() != 4) // $4 (Version number -- CHM uses 3) - return S_FALSE; - if (ReadUInt32() != 0x20) // $20 (length of ITSF) - return S_FALSE; - UInt32 unknown = ReadUInt32(); - if (unknown != 0 && unknown != 1) // = 0 for some HxW files, 1 in other cases; - return S_FALSE; - database.ContentOffset = _startPosition + ReadUInt64(); - /* UInt32 timeStamp = */ ReadUInt32(); - // A timestamp of some sort. - // Considered as a big-endian DWORD, it appears to contain - // seconds (MSB) and fractional seconds (second byte). - // The third and fourth bytes may contain even more fractional - // bits. The 4 least significant bits in the last byte are constant. - /* UInt32 lang = */ ReadUInt32(); // BE? - } - else - return S_FALSE; - } - - /* - // Section 0 - ReadChunk(inStream, _startPosition + sectionOffsets[0], sectionSizes[0]); - if (sectionSizes[0] != 0x18) - return S_FALSE; - ReadUInt32(); // unknown: 01FE - ReadUInt32(); // unknown: 0 - UInt64 fileSize = ReadUInt64(); - ReadUInt32(); // unknown: 0 - ReadUInt32(); // unknown: 0 - */ - - // Section 1: The Directory Listing - ReadChunk(inStream, _startPosition + sectionOffsets[1], sectionSizes[1]); - if (ReadUInt32() != NHeader::kIfcmSignature) - return S_FALSE; - if (ReadUInt32() != 1) // (probably a version number) - return S_FALSE; - UInt32 dirChunkSize = ReadUInt32(); // $2000 - if (dirChunkSize < 64) - return S_FALSE; - ReadUInt32(); // $100000 (unknown) - ReadUInt32(); // -1 (unknown) - ReadUInt32(); // -1 (unknown) - UInt32 numDirChunks = ReadUInt32(); - ReadUInt32(); // 0 (unknown, probably high word of above) - - for (UInt32 ci = 0; ci < numDirChunks; ci++) - { - UInt64 chunkPos = _inBuffer.GetProcessedSize(); - if (ReadUInt32() == NHeader::kAollSignature) - { - UInt32 quickrefLength = ReadUInt32(); // Length of quickref area at end of directory chunk - if (quickrefLength > dirChunkSize || quickrefLength < 2) - return S_FALSE; - ReadUInt64(); // Directory chunk number - // This must match physical position in file, that is - // the chunk size times the chunk number must be the - // offset from the end of the directory header. - ReadUInt64(); // Chunk number of previous listing chunk when reading - // directory in sequence (-1 if first listing chunk) - ReadUInt64(); // Chunk number of next listing chunk when reading - // directory in sequence (-1 if last listing chunk) - ReadUInt64(); // Number of first listing entry in this chunk - ReadUInt32(); // 1 (unknown -- other values have also been seen here) - ReadUInt32(); // 0 (unknown) - - int numItems = 0; - for (;;) - { - UInt64 offset = _inBuffer.GetProcessedSize() - chunkPos; - UInt32 offsetLimit = dirChunkSize - quickrefLength; - if (offset > offsetLimit) - return S_FALSE; - if (offset == offsetLimit) - break; - if (database.NewFormat) - { - UInt16 nameLength = ReadUInt16(); - if (nameLength == 0) - return S_FALSE; - UString name; - ReadUString((int)nameLength, name); - AString s; - ConvertUnicodeToUTF8(name, s); - Byte b = ReadByte(); - s += ' '; - PrintByte(b, s); - s += ' '; - UInt64 len = ReadEncInt(); - // then number of items ? - // then length ? - // then some data (binary encoding?) - while (len-- != 0) - { - b = ReadByte(); - PrintByte(b, s); - } - database.NewFormatString += s; - database.NewFormatString += "\r\n"; - } - else - { - RINOK(ReadDirEntry(database)); - } - numItems++; - } - Skeep(quickrefLength - 2); - if (ReadUInt16() != numItems) - return S_FALSE; - if (numItems > numDirEntries) - return S_FALSE; - numDirEntries -= numItems; - } - else - Skeep(dirChunkSize - 4); - } - return numDirEntries == 0 ? S_OK : S_FALSE; -} - -HRESULT CInArchive::DecompressStream(IInStream *inStream, const CDatabase &database, const AString &name) -{ - int index = database.FindItem(name); - if (index < 0) - return S_FALSE; - const CItem &item = database.Items[index]; - _chunkSize = item.Size; - return ReadChunk(inStream, database.ContentOffset + item.Offset, item.Size); -} - - -#define DATA_SPACE "::DataSpace/" -static const char *kNameList = DATA_SPACE "NameList"; -static const char *kStorage = DATA_SPACE "Storage/"; -static const char *kContent = "Content"; -static const char *kControlData = "ControlData"; -static const char *kSpanInfo = "SpanInfo"; -static const char *kTransform = "Transform/"; -static const char *kResetTable = "/InstanceData/ResetTable"; -static const char *kTransformList = "List"; - -static AString GetSectionPrefix(const AString &name) -{ - return AString(kStorage) + name + AString("/"); -} - -#define RINOZ(x) { int __tt = (x); if (__tt != 0) return __tt; } - -static int CompareFiles(const int *p1, const int *p2, void *param) -{ - const CObjectVector &items = *(const CObjectVector *)param; - const CItem &item1 = items[*p1]; - const CItem &item2 = items[*p2]; - bool isDir1 = item1.IsDirectory(); - bool isDir2 = item2.IsDirectory(); - if (isDir1 && !isDir2) - return -1; - if (isDir2) - { - if (isDir1) - return MyCompare(*p1, *p2); - return 1; - } - RINOZ(MyCompare(item1.Section, item2.Section)); - RINOZ(MyCompare(item1.Offset, item2.Offset)); - RINOZ(MyCompare(item1.Size, item2.Size)); - return MyCompare(*p1, *p2); -} - -void CFilesDatabase::SetIndices() -{ - for (int i = 0; i < Items.Size(); i++) - { - const CItem &item = Items[i]; - if (item.IsUserItem() && item.Name.Length() != 1) - Indices.Add(i); - } -} - -void CFilesDatabase::Sort() -{ - Indices.Sort(CompareFiles, (void *)&Items); -} - -bool CFilesDatabase::Check() -{ - UInt64 maxPos = 0; - UInt64 prevSection = 0; - for(int i = 0; i < Indices.Size(); i++) - { - const CItem &item = Items[Indices[i]]; - if (item.Section == 0 || item.IsDirectory()) - continue; - if (item.Section != prevSection) - { - prevSection = item.Section; - maxPos = 0; - continue; - } - if (item.Offset < maxPos) - return false; - maxPos = item.Offset + item.Size; - if (maxPos < item.Offset) - return false; - } - return true; -} - -HRESULT CInArchive::OpenHighLevel(IInStream *inStream, CFilesDatabase &database) -{ - { - // The NameList file - RINOK(DecompressStream(inStream, database, kNameList)); - /* UInt16 length = */ ReadUInt16(); - UInt16 numSections = ReadUInt16(); - for (int i = 0; i < numSections; i++) - { - CSectionInfo section; - UInt16 nameLength = ReadUInt16(); - UString name; - ReadUString(nameLength, name); - if (ReadUInt16() != 0) - return S_FALSE; - if (!ConvertUnicodeToUTF8(name, section.Name)) - return S_FALSE; - database.Sections.Add(section); - } - } - - int i; - for (i = 1; i < database.Sections.Size(); i++) - { - CSectionInfo §ion = database.Sections[i]; - AString sectionPrefix = GetSectionPrefix(section.Name); - { - // Content - int index = database.FindItem(sectionPrefix + kContent); - if (index < 0) - return S_FALSE; - const CItem &item = database.Items[index]; - section.Offset = item.Offset; - section.CompressedSize = item.Size; - } - AString transformPrefix = sectionPrefix + kTransform; - if (database.Help2Format) - { - // Transform List - RINOK(DecompressStream(inStream, database, transformPrefix + kTransformList)); - if ((_chunkSize & 0xF) != 0) - return S_FALSE; - int numGuids = (int)(_chunkSize / 0x10); - if (numGuids < 1) - return S_FALSE; - for (int i = 0; i < numGuids; i++) - { - CMethodInfo method; - ReadGUID(method.Guid); - section.Methods.Add(method); - } - } - else - { - CMethodInfo method; - method.Guid = kChmLzxGuid; - section.Methods.Add(method); - } - - { - // Control Data - RINOK(DecompressStream(inStream, database, sectionPrefix + kControlData)); - for (int mi = 0; mi < section.Methods.Size(); mi++) - { - CMethodInfo &method = section.Methods[mi]; - UInt32 numDWORDS = ReadUInt32(); - if (method.IsLzx()) - { - if (numDWORDS < 5) - return S_FALSE; - if (ReadUInt32() != NHeader::kLzxcSignature) - return S_FALSE; - CLzxInfo &li = method.LzxInfo; - li.Version = ReadUInt32(); - if (li.Version != 2 && li.Version != 3) - return S_FALSE; - li.ResetInterval = ReadUInt32(); - li.WindowSize = ReadUInt32(); - li.CacheSize = ReadUInt32(); - if (li.ResetInterval != 2 && li.ResetInterval != 4) - return S_FALSE; - if (li.WindowSize != 2 && li.WindowSize != 4) - return S_FALSE; - numDWORDS -= 5; - while (numDWORDS-- != 0) - ReadUInt32(); - } - else - { - UInt32 numBytes = numDWORDS * 4; - method.ControlData.SetCapacity(numBytes); - ReadBytes(method.ControlData, numBytes); - } - } - } - - { - // SpanInfo - RINOK(DecompressStream(inStream, database, sectionPrefix + kSpanInfo)); - section.UncompressedSize = ReadUInt64(); - } - - // read ResetTable for LZX - for (int mi = 0; mi < section.Methods.Size(); mi++) - { - CMethodInfo &method = section.Methods[mi]; - if (method.IsLzx()) - { - // ResetTable; - RINOK(DecompressStream(inStream, database, transformPrefix + - method.GetGuidString() + kResetTable)); - CResetTable &rt = method.LzxInfo.ResetTable; - if (_chunkSize < 4) - { - if (_chunkSize != 0) - return S_FALSE; - // ResetTable is empty in .chw files - if (section.UncompressedSize != 0) - return S_FALSE; - rt.UncompressedSize = 0; - rt.CompressedSize = 0; - rt.BlockSize = 0; - } - else - { - UInt32 ver = ReadUInt32(); // 2 unknown (possibly a version number) - if (ver != 2 && ver != 3) - return S_FALSE; - UInt32 numEntries = ReadUInt32(); - if (ReadUInt32() != 8) // Size of table entry (bytes) - return S_FALSE; - if (ReadUInt32() != 0x28) // Length of table header - return S_FALSE; - rt.UncompressedSize = ReadUInt64(); - rt.CompressedSize = ReadUInt64(); - rt.BlockSize = ReadUInt64(); // 0x8000 block size for locations below - if (rt.BlockSize != 0x8000) - return S_FALSE; - rt.ResetOffsets.Reserve(numEntries); - for (UInt32 i = 0; i < numEntries; i++) - rt.ResetOffsets.Add(ReadUInt64()); - } - } - } - } - - database.SetIndices(); - database.Sort(); - return database.Check() ? S_OK : S_FALSE; -} - -HRESULT CInArchive::Open2(IInStream *inStream, - const UInt64 *searchHeaderSizeLimit, - CFilesDatabase &database) -{ - database.Clear(); - - RINOK(inStream->Seek(0, STREAM_SEEK_CUR, &_startPosition)); - - database.Help2Format = false; - const UInt32 chmVersion = 3; - { - if (!_inBuffer.Create(1 << 14)) - return E_OUTOFMEMORY; - _inBuffer.SetStream(inStream); - _inBuffer.Init(); - UInt64 value = 0; - const int kSignatureSize = 8; - UInt64 hxsSignature = NHeader::GetHxsSignature(); - UInt64 chmSignature = ((UInt64)chmVersion << 32)| NHeader::kItsfSignature; - for (;;) - { - Byte b; - if (!_inBuffer.ReadByte(b)) - return S_FALSE; - value >>= 8; - value |= ((UInt64)b) << ((kSignatureSize - 1) * 8); - if (_inBuffer.GetProcessedSize() >= kSignatureSize) - { - if (value == chmSignature) - break; - if (value == hxsSignature) - { - database.Help2Format = true; - break; - } - if (searchHeaderSizeLimit != NULL) - if (_inBuffer.GetProcessedSize() > (*searchHeaderSizeLimit)) - return S_FALSE; - } - } - _startPosition += _inBuffer.GetProcessedSize() - kSignatureSize; - } - - if (database.Help2Format) - { - RINOK(OpenHelp2(inStream, database)); - if (database.NewFormat) - return S_OK; - } - else - { - RINOK(OpenChm(inStream, database)); - } - - #ifndef CHM_LOW - try - { - HRESULT res = OpenHighLevel(inStream, database); - if (res == S_FALSE) - { - database.HighLevelClear(); - return S_OK; - } - RINOK(res); - database.LowLevel = false; - } - catch(...) - { - return S_OK; - } - #endif - return S_OK; -} - -HRESULT CInArchive::Open(IInStream *inStream, - const UInt64 *searchHeaderSizeLimit, - CFilesDatabase &database) -{ - try - { - HRESULT res = Open2(inStream, searchHeaderSizeLimit, database); - _inBuffer.ReleaseStream(); - return res; - } - catch(...) - { - _inBuffer.ReleaseStream(); - throw; - } -} - -}} diff --git a/7zip/Archive/Chm/ChmIn.h b/7zip/Archive/Chm/ChmIn.h deleted file mode 100755 index ebf3c4be..00000000 --- a/7zip/Archive/Chm/ChmIn.h +++ /dev/null @@ -1,242 +0,0 @@ -// Archive/ChmIn.h - -#ifndef __ARCHIVE_CHM_IN_H -#define __ARCHIVE_CHM_IN_H - -#include "Common/String.h" -#include "Common/Buffer.h" -#include "../../IStream.h" -#include "../../Common/InBuffer.h" -#include "ChmHeader.h" - -namespace NArchive { -namespace NChm { - -struct CItem -{ - UInt64 Section; - UInt64 Offset; - UInt64 Size; - AString Name; - - bool IsFormatRelatedItem() const - { - if (Name.Length() < 2) - return false; - return Name[0] == ':' && Name[1] == ':'; - } - - bool IsUserItem() const - { - if (Name.Length() < 2) - return false; - return Name[0] == '/'; - } - - bool IsDirectory() const - { - if (Name.Length() == 0) - return false; - return (Name[Name.Length() - 1] == '/'); - } -}; - -struct CDatabase -{ - UInt64 ContentOffset; - CObjectVector Items; - AString NewFormatString; - bool Help2Format; - bool NewFormat; - - int FindItem(const AString &name) const - { - for (int i = 0; i < Items.Size(); i++) - if (Items[i].Name == name) - return i; - return -1; - } - - void Clear() - { - NewFormat = false; - NewFormatString.Empty(); - Help2Format = false; - Items.Clear(); - } -}; - -struct CResetTable -{ - UInt64 UncompressedSize; - UInt64 CompressedSize; - UInt64 BlockSize; - CRecordVector ResetOffsets; - bool GetCompressedSizeOfBlocks(UInt64 blockIndex, UInt32 numBlocks, UInt64 &size) const - { - if (blockIndex >= ResetOffsets.Size()) - return false; - UInt64 startPos = ResetOffsets[(int)blockIndex]; - if (blockIndex + numBlocks >= ResetOffsets.Size()) - size = CompressedSize - startPos; - else - size = ResetOffsets[(int)(blockIndex + numBlocks)] - startPos; - return true; - } - bool GetCompressedSizeOfBlock(UInt64 blockIndex, UInt64 &size) const - { - return GetCompressedSizeOfBlocks(blockIndex, 1, size); - } - UInt64 GetNumBlocks(UInt64 size) const - { - return (size + BlockSize - 1) / BlockSize; - } -}; - -struct CLzxInfo -{ - UInt32 Version; - UInt32 ResetInterval; - UInt32 WindowSize; - UInt32 CacheSize; - CResetTable ResetTable; - - UInt32 GetNumDictBits() const - { - if (Version == 2 || Version == 3) - { - for (int i = 0; i <= 31; i++) - if (((UInt32)1 << i) >= WindowSize) - return 15 + i; - } - return 0; - } - - UInt64 GetFolderSize() const { return ResetTable.BlockSize * ResetInterval; }; - UInt64 GetFolder(UInt64 offset) const { return offset / GetFolderSize(); }; - UInt64 GetFolderPos(UInt64 folderIndex) const { return folderIndex * GetFolderSize(); }; - UInt64 GetBlockIndexFromFolderIndex(UInt64 folderIndex) const { return folderIndex * ResetInterval; }; - bool GetOffsetOfFolder(UInt64 folderIndex, UInt64 &offset) const - { - UInt64 blockIndex = GetBlockIndexFromFolderIndex(folderIndex); - if (blockIndex >= ResetTable.ResetOffsets.Size()) - return false; - offset = ResetTable.ResetOffsets[(int)blockIndex]; - return true; - } - bool GetCompressedSizeOfFolder(UInt64 folderIndex, UInt64 &size) const - { - UInt64 blockIndex = GetBlockIndexFromFolderIndex(folderIndex); - return ResetTable.GetCompressedSizeOfBlocks(blockIndex, ResetInterval, size); - } -}; - -struct CMethodInfo -{ - GUID Guid; - CByteBuffer ControlData; - CLzxInfo LzxInfo; - bool IsLzx() const; - bool IsDes() const; - AString GetGuidString() const; - UString GetName() const; -}; - -struct CSectionInfo -{ - UInt64 Offset; - UInt64 CompressedSize; - UInt64 UncompressedSize; - - AString Name; - CObjectVector Methods; - - bool IsLzx() const; - UString GetMethodName() const; -}; - -class CFilesDatabase: public CDatabase -{ -public: - bool LowLevel; - CRecordVector Indices; - CObjectVector Sections; - - UInt64 GetFileSize(int fileIndex) const { return Items[Indices[fileIndex]].Size; } - UInt64 GetFileOffset(int fileIndex) const { return Items[Indices[fileIndex]].Offset; } - - UInt64 GetFolder(int fileIndex) const - { - const CItem &item = Items[Indices[fileIndex]]; - const CSectionInfo §ion = Sections[(int)item.Section]; - if (section.IsLzx()) - return section.Methods[0].LzxInfo.GetFolder(item.Offset); - return 0; - } - - UInt64 GetLastFolder(int fileIndex) const - { - const CItem &item = Items[Indices[fileIndex]]; - const CSectionInfo §ion = Sections[(int)item.Section]; - if (section.IsLzx()) - return section.Methods[0].LzxInfo.GetFolder(item.Offset + item.Size - 1); - return 0; - } - - void HighLevelClear() - { - LowLevel = true; - Indices.Clear(); - Sections.Clear(); - } - - void Clear() - { - CDatabase::Clear(); - HighLevelClear(); - } - void SetIndices(); - void Sort(); - bool Check(); -}; - -class CProgressVirt -{ -public: - STDMETHOD(SetTotal)(const UInt64 *numFiles) PURE; - STDMETHOD(SetCompleted)(const UInt64 *numFiles) PURE; -}; - -class CInArchive -{ - UInt64 _startPosition; - ::CInBuffer _inBuffer; - UInt64 _chunkSize; - - Byte ReadByte(); - void ReadBytes(Byte *data, UInt32 size); - void Skeep(size_t size); - UInt16 ReadUInt16(); - UInt32 ReadUInt32(); - UInt64 ReadUInt64(); - UInt64 ReadEncInt(); - void ReadString(int size, AString &s); - void ReadUString(int size, UString &s); - void ReadGUID(GUID &g); - - HRESULT ReadChunk(IInStream *inStream, UInt64 pos, UInt64 size); - - HRESULT ReadDirEntry(CDatabase &database); - HRESULT DecompressStream(IInStream *inStream, const CDatabase &database, const AString &name); - -public: - HRESULT OpenChm(IInStream *inStream, CDatabase &database); - HRESULT OpenHelp2(IInStream *inStream, CDatabase &database); - HRESULT OpenHighLevel(IInStream *inStream, CFilesDatabase &database); - HRESULT Open2(IInStream *inStream, const UInt64 *searchHeaderSizeLimit, CFilesDatabase &database); - HRESULT Open(IInStream *inStream, const UInt64 *searchHeaderSizeLimit, CFilesDatabase &database); -}; - -}} - -#endif diff --git a/7zip/Archive/Chm/DllExports.cpp b/7zip/Archive/Chm/DllExports.cpp deleted file mode 100755 index ad822094..00000000 --- a/7zip/Archive/Chm/DllExports.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "ChmHandler.h" -#include "../../ICoder.h" - -// {23170F69-40C1-278A-1000-000110E90000} -DEFINE_GUID(CLSID_CChmHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0xE9, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /*lpReserved*/) -{ - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CChmHandler) - return CLASS_E_CLASSNOTAVAILABLE; - if (*interfaceID != IID_IInArchive) - return E_NOINTERFACE; - CMyComPtr inArchive = (IInArchive *)new NArchive::NChm::CHandler; - *outObject = inArchive.Detach(); - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Chm"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CChmHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"chm chi chq chw hxs hxi hxr hxq hxw lit"; - break; - case NArchive::kUpdate: - propVariant = false; - break; - case NArchive::kKeepName: - propVariant = false; - break; - case NArchive::kStartSignature: - { - const char sig[] = { 'I', 'T', 'S', 'F' }; - if ((value->bstrVal = ::SysAllocStringByteLen(sig, 4)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kAssociate: - { - propVariant = false; - break; - } - } - propVariant.Detach(value); - return S_OK; -} diff --git a/7zip/Archive/Chm/StdAfx.cpp b/7zip/Archive/Chm/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Archive/Chm/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Archive/Chm/StdAfx.h b/7zip/Archive/Chm/StdAfx.h deleted file mode 100755 index e7fb6986..00000000 --- a/7zip/Archive/Chm/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Archive/Chm/makefile b/7zip/Archive/Chm/makefile deleted file mode 100755 index 4adce2f5..00000000 --- a/7zip/Archive/Chm/makefile +++ /dev/null @@ -1,68 +0,0 @@ -PROG = chm.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib user32.lib - -CHM_OBJS = \ - $O\DllExports.obj \ - $O\ChmHandler.obj \ - $O\ChmHeader.obj \ - $O\ChmIn.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\IntToString.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\UTFConvert.obj \ - $O\Vector.obj \ - -WIN_OBJS = \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\InBuffer.obj \ - $O\LimitedStreams.obj \ - $O\OutBuffer.obj \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\ItemNameUtils.obj \ - -COMPRESS_LZX_OBJS = \ - $O\LzxDecoder.obj \ - $O\Lzx86Converter.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(CHM_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(COMPRESS_LZX_OBJS) \ - $O\LZOutWindow.obj \ - $O\CopyCoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(CHM_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$(COMPRESS_LZX_OBJS): ../../Compress/Lzx/$(*B).cpp - $(COMPL_O2) -$O\LZOutWindow.obj: ../../Compress/LZ/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) - diff --git a/7zip/Archive/Chm/resource.rc b/7zip/Archive/Chm/resource.rc deleted file mode 100755 index fc93ae4f..00000000 --- a/7zip/Archive/Chm/resource.rc +++ /dev/null @@ -1,3 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Chm Plugin", "chm") diff --git a/7zip/Archive/Common/CodecsPath.cpp b/7zip/Archive/Common/CodecsPath.cpp deleted file mode 100755 index 7ee89875..00000000 --- a/7zip/Archive/Common/CodecsPath.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// CodecsPath.cpp - -#include "StdAfx.h" -#include "../../../Common/String.h" - -extern HINSTANCE g_hInstance; - -static CSysString GetLibraryPath() -{ - TCHAR fullPath[MAX_PATH + 1]; - ::GetModuleFileName(g_hInstance, fullPath, MAX_PATH); - return fullPath; -} - -static CSysString GetLibraryFolderPrefix() -{ - CSysString path = GetLibraryPath(); - int pos = path.ReverseFind(TEXT(CHAR_PATH_SEPARATOR)); - return path.Left(pos + 1); -} - -CSysString GetBaseFolderPrefix() -{ - CSysString libPrefix = GetLibraryFolderPrefix(); - CSysString temp = libPrefix; - temp.Delete(temp.Length() - 1); - int pos = temp.ReverseFind(TEXT(CHAR_PATH_SEPARATOR)); - return temp.Left(pos + 1); -} - -CSysString GetCodecsFolderPrefix() -{ - return GetBaseFolderPrefix() + (CSysString)(TEXT("Codecs")) + (CSysString)(TEXT(STRING_PATH_SEPARATOR)); -} diff --git a/7zip/Archive/Common/CodecsPath.h b/7zip/Archive/Common/CodecsPath.h deleted file mode 100755 index 11145a03..00000000 --- a/7zip/Archive/Common/CodecsPath.h +++ /dev/null @@ -1,12 +0,0 @@ -// CodecsPath.h - -#ifndef __CODECSPATH_H -#define __CODECSPATH_H - -#include "../../../Common/String.h" - -CSysString GetBaseFolderPrefix(); -CSysString GetCodecsFolderPrefix(); - -#endif - diff --git a/7zip/Archive/Common/CoderLoader.cpp b/7zip/Archive/Common/CoderLoader.cpp deleted file mode 100755 index bf54f6e0..00000000 --- a/7zip/Archive/Common/CoderLoader.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// CoderLoader.cpp - -#include "StdAfx.h" - -#include "CoderLoader.h" -#include "FilterCoder.h" - -HRESULT CCoderLibrary::CreateCoderSpec(REFGUID clsID, ICompressCoder **coder) -{ - HRESULT result = CreateObject(clsID, IID_ICompressCoder, (void **)coder); - if (result == S_OK || result != E_NOINTERFACE) - return result; - CMyComPtr filter; - RINOK(CreateObject(clsID, IID_ICompressFilter, (void **)&filter)); - CFilterCoder *filterCoderSpec = new CFilterCoder; - CMyComPtr filterCoder = filterCoderSpec; - filterCoderSpec->Filter = filter; - *coder = filterCoder.Detach(); - return S_OK; -} - - -HRESULT CCoderLibrary::LoadAndCreateCoderSpec(LPCTSTR filePath, REFGUID clsID, ICompressCoder **coder) -{ - CCoderLibrary libTemp; - if (!libTemp.Load(filePath)) - return GetLastError(); - RINOK(libTemp.CreateCoderSpec(clsID, coder)); - Attach(libTemp.Detach()); - return S_OK; -} diff --git a/7zip/Archive/Common/CoderLoader.h b/7zip/Archive/Common/CoderLoader.h deleted file mode 100755 index 02322d8c..00000000 --- a/7zip/Archive/Common/CoderLoader.h +++ /dev/null @@ -1,147 +0,0 @@ -// CoderLoader.h - -#ifndef __CODERLOADER_H -#define __CODERLOADER_H - -#include "../../../Common/String.h" -#include "../../../Common/MyCom.h" -#include "../../../Windows/DLL.h" -#include "../../ICoder.h" - -typedef UInt32 (WINAPI * CreateObjectPointer)( - const GUID *clsID, - const GUID *interfaceID, - void **outObject); - -class CCoderLibrary: public NWindows::NDLL::CLibrary -{ -public: - HRESULT CreateObject(REFGUID clsID, REFGUID iid, void **obj) - { - CreateObjectPointer createObject = (CreateObjectPointer) - GetProcAddress("CreateObject"); - if (createObject == NULL) - return GetLastError(); - return createObject(&clsID, &iid, obj); - } - - HRESULT CreateFilter(REFGUID clsID, ICompressFilter **filter) - { - return CreateObject(clsID, IID_ICompressFilter, (void **)filter); - } - - HRESULT CreateCoder(REFGUID clsID, ICompressCoder **coder) - { - return CreateObject(clsID, IID_ICompressCoder, (void **)coder); - } - - HRESULT CreateCoderSpec(REFGUID clsID, ICompressCoder **coder); - - HRESULT LoadAndCreateFilter(LPCTSTR filePath, REFGUID clsID, ICompressFilter **filter) - { - CCoderLibrary libTemp; - if (!libTemp.Load(filePath)) - return GetLastError(); - RINOK(libTemp.CreateFilter(clsID, filter)); - Attach(libTemp.Detach()); - return S_OK; - } - - - HRESULT LoadAndCreateCoder(LPCTSTR filePath, REFGUID clsID, ICompressCoder **coder) - { - CCoderLibrary libTemp; - if (!libTemp.Load(filePath)) - return GetLastError(); - RINOK(libTemp.CreateCoder(clsID, coder)); - Attach(libTemp.Detach()); - return S_OK; - } - - HRESULT LoadAndCreateCoderSpec(LPCTSTR filePath, REFGUID clsID, ICompressCoder **coder); - HRESULT CreateCoder2(REFGUID clsID, ICompressCoder2 **coder) - { - CreateObjectPointer createObject = (CreateObjectPointer) - GetProcAddress("CreateObject"); - if (createObject == NULL) - return GetLastError(); - return createObject(&clsID, &IID_ICompressCoder2, (void **)coder); - } - HRESULT LoadAndCreateCoder2(LPCTSTR filePath, REFGUID clsID, ICompressCoder2 **coder) - { - CCoderLibrary libTemp; - if (!libTemp.Load(filePath)) - return GetLastError(); - RINOK(libTemp.CreateCoder2(clsID, coder)); - Attach(libTemp.Detach()); - return S_OK; - } -}; - - -class CCoderLibraries -{ - struct CPathToLibraryPair - { - CSysString Path; - CCoderLibrary Libary; - }; - CObjectVector Pairs; -public: - int FindPath(LPCTSTR filePath) - { - for (int i = 0; i < Pairs.Size(); i++) - if (Pairs[i].Path.CompareNoCase(filePath) == 0) - return i; - return -1; - } - - HRESULT CreateCoder(LPCTSTR filePath, REFGUID clsID, ICompressCoder **coder) - { - int index = FindPath(filePath); - if (index < 0) - { - CPathToLibraryPair pair; - RINOK(pair.Libary.LoadAndCreateCoder(filePath, clsID, coder)); - pair.Path = filePath; - Pairs.Add(pair); - pair.Libary.Detach(); - return S_OK; - } - return Pairs[index].Libary.CreateCoder(clsID, coder); - } - - HRESULT CreateCoderSpec(LPCTSTR filePath, REFGUID clsID, ICompressCoder **coder) - { - int index = FindPath(filePath); - if (index < 0) - { - CPathToLibraryPair pair; - RINOK(pair.Libary.LoadAndCreateCoderSpec(filePath, clsID, coder)); - pair.Path = filePath; - Pairs.Add(pair); - pair.Libary.Detach(); - return S_OK; - } - return Pairs[index].Libary.CreateCoderSpec(clsID, coder); - } - - HRESULT CreateCoder2(LPCTSTR filePath, REFGUID clsID, ICompressCoder2 **coder) - { - int index = FindPath(filePath); - if (index < 0) - { - CPathToLibraryPair pair; - RINOK(pair.Libary.LoadAndCreateCoder2(filePath, clsID, coder)); - pair.Path = filePath; - Pairs.Add(pair); - pair.Libary.Detach(); - return S_OK; - } - return Pairs[index].Libary.CreateCoder2(clsID, coder); - } -}; - - -#endif - diff --git a/7zip/Archive/Common/CoderMixer2.cpp b/7zip/Archive/Common/CoderMixer2.cpp deleted file mode 100755 index 8f46e985..00000000 --- a/7zip/Archive/Common/CoderMixer2.cpp +++ /dev/null @@ -1,121 +0,0 @@ -// CoderMixer2.cpp - -#include "StdAfx.h" - -#include "CoderMixer2.h" - -namespace NCoderMixer2 { - -CBindReverseConverter::CBindReverseConverter(const CBindInfo &srcBindInfo): - _srcBindInfo(srcBindInfo) -{ - srcBindInfo.GetNumStreams(NumSrcInStreams, _numSrcOutStreams); - - UInt32 j; - for (j = 0; j < NumSrcInStreams; j++) - { - _srcInToDestOutMap.Add(0); - DestOutToSrcInMap.Add(0); - } - for (j = 0; j < _numSrcOutStreams; j++) - { - _srcOutToDestInMap.Add(0); - _destInToSrcOutMap.Add(0); - } - - UInt32 destInOffset = 0; - UInt32 destOutOffset = 0; - UInt32 srcInOffset = NumSrcInStreams; - UInt32 srcOutOffset = _numSrcOutStreams; - - for (int i = srcBindInfo.Coders.Size() - 1; i >= 0; i--) - { - const CCoderStreamsInfo &srcCoderInfo = srcBindInfo.Coders[i]; - - srcInOffset -= srcCoderInfo.NumInStreams; - srcOutOffset -= srcCoderInfo.NumOutStreams; - - UInt32 j; - for (j = 0; j < srcCoderInfo.NumInStreams; j++, destOutOffset++) - { - UInt32 index = srcInOffset + j; - _srcInToDestOutMap[index] = destOutOffset; - DestOutToSrcInMap[destOutOffset] = index; - } - for (j = 0; j < srcCoderInfo.NumOutStreams; j++, destInOffset++) - { - UInt32 index = srcOutOffset + j; - _srcOutToDestInMap[index] = destInOffset; - _destInToSrcOutMap[destInOffset] = index; - } - } -} - -void CBindReverseConverter::CreateReverseBindInfo(CBindInfo &destBindInfo) -{ - destBindInfo.Coders.Clear(); - destBindInfo.BindPairs.Clear(); - destBindInfo.InStreams.Clear(); - destBindInfo.OutStreams.Clear(); - - int i; - for (i = _srcBindInfo.Coders.Size() - 1; i >= 0; i--) - { - const CCoderStreamsInfo &srcCoderInfo = _srcBindInfo.Coders[i]; - CCoderStreamsInfo destCoderInfo; - destCoderInfo.NumInStreams = srcCoderInfo.NumOutStreams; - destCoderInfo.NumOutStreams = srcCoderInfo.NumInStreams; - destBindInfo.Coders.Add(destCoderInfo); - } - for (i = _srcBindInfo.BindPairs.Size() - 1; i >= 0; i--) - { - const CBindPair &srcBindPair = _srcBindInfo.BindPairs[i]; - CBindPair destBindPair; - destBindPair.InIndex = _srcOutToDestInMap[srcBindPair.OutIndex]; - destBindPair.OutIndex = _srcInToDestOutMap[srcBindPair.InIndex]; - destBindInfo.BindPairs.Add(destBindPair); - } - for (i = 0; i < _srcBindInfo.InStreams.Size(); i++) - destBindInfo.OutStreams.Add(_srcInToDestOutMap[_srcBindInfo.InStreams[i]]); - for (i = 0; i < _srcBindInfo.OutStreams.Size(); i++) - destBindInfo.InStreams.Add(_srcOutToDestInMap[_srcBindInfo.OutStreams[i]]); -} - -CCoderInfo::CCoderInfo(UInt32 numInStreams, UInt32 numOutStreams): - NumInStreams(numInStreams), - NumOutStreams(numOutStreams) -{ - InSizes.Reserve(NumInStreams); - InSizePointers.Reserve(NumInStreams); - OutSizePointers.Reserve(NumOutStreams); - OutSizePointers.Reserve(NumOutStreams); -} - -static void SetSizes(const UInt64 **srcSizes, CRecordVector &sizes, - CRecordVector &sizePointers, UInt32 numItems) -{ - sizes.Clear(); - sizePointers.Clear(); - for(UInt32 i = 0; i < numItems; i++) - { - if (srcSizes == 0 || srcSizes[i] == NULL) - { - sizes.Add(0); - sizePointers.Add(NULL); - } - else - { - sizes.Add(*srcSizes[i]); - sizePointers.Add(&sizes.Back()); - } - } -} - -void CCoderInfo::SetCoderInfo(const UInt64 **inSizes, - const UInt64 **outSizes) -{ - SetSizes(inSizes, InSizes, InSizePointers, NumInStreams); - SetSizes(outSizes, OutSizes, OutSizePointers, NumOutStreams); -} - -} diff --git a/7zip/Archive/Common/CoderMixer2.h b/7zip/Archive/Common/CoderMixer2.h deleted file mode 100755 index 78a3f280..00000000 --- a/7zip/Archive/Common/CoderMixer2.h +++ /dev/null @@ -1,168 +0,0 @@ -// CoderMixer2.h - -#ifndef __CODER_MIXER2_H -#define __CODER_MIXER2_H - -#include "../../../Common/Vector.h" -#include "../../../Common/Types.h" -#include "../../../Common/MyCom.h" -#include "../../ICoder.h" - -namespace NCoderMixer2 { - -struct CBindPair -{ - UInt32 InIndex; - UInt32 OutIndex; -}; - -struct CCoderStreamsInfo -{ - UInt32 NumInStreams; - UInt32 NumOutStreams; -}; - -struct CBindInfo -{ - CRecordVector Coders; - CRecordVector BindPairs; - CRecordVector InStreams; - CRecordVector OutStreams; - - void Clear() - { - Coders.Clear(); - BindPairs.Clear(); - InStreams.Clear(); - OutStreams.Clear(); - } - - /* - UInt32 GetCoderStartOutStream(UInt32 coderIndex) const - { - UInt32 numOutStreams = 0; - for (UInt32 i = 0; i < coderIndex; i++) - numOutStreams += Coders[i].NumOutStreams; - return numOutStreams; - } - */ - - - void GetNumStreams(UInt32 &numInStreams, UInt32 &numOutStreams) const - { - numInStreams = 0; - numOutStreams = 0; - for (int i = 0; i < Coders.Size(); i++) - { - const CCoderStreamsInfo &coderStreamsInfo = Coders[i]; - numInStreams += coderStreamsInfo.NumInStreams; - numOutStreams += coderStreamsInfo.NumOutStreams; - } - } - - int FindBinderForInStream(UInt32 inStream) const - { - for (int i = 0; i < BindPairs.Size(); i++) - if (BindPairs[i].InIndex == inStream) - return i; - return -1; - } - int FindBinderForOutStream(UInt32 outStream) const - { - for (int i = 0; i < BindPairs.Size(); i++) - if (BindPairs[i].OutIndex == outStream) - return i; - return -1; - } - - UInt32 GetCoderInStreamIndex(UInt32 coderIndex) const - { - UInt32 streamIndex = 0; - for (UInt32 i = 0; i < coderIndex; i++) - streamIndex += Coders[i].NumInStreams; - return streamIndex; - } - - UInt32 GetCoderOutStreamIndex(UInt32 coderIndex) const - { - UInt32 streamIndex = 0; - for (UInt32 i = 0; i < coderIndex; i++) - streamIndex += Coders[i].NumOutStreams; - return streamIndex; - } - - - void FindInStream(UInt32 streamIndex, UInt32 &coderIndex, - UInt32 &coderStreamIndex) const - { - for (coderIndex = 0; coderIndex < (UInt32)Coders.Size(); coderIndex++) - { - UInt32 curSize = Coders[coderIndex].NumInStreams; - if (streamIndex < curSize) - { - coderStreamIndex = streamIndex; - return; - } - streamIndex -= curSize; - } - throw 1; - } - void FindOutStream(UInt32 streamIndex, UInt32 &coderIndex, - UInt32 &coderStreamIndex) const - { - for (coderIndex = 0; coderIndex < (UInt32)Coders.Size(); coderIndex++) - { - UInt32 curSize = Coders[coderIndex].NumOutStreams; - if (streamIndex < curSize) - { - coderStreamIndex = streamIndex; - return; - } - streamIndex -= curSize; - } - throw 1; - } -}; - -class CBindReverseConverter -{ - UInt32 _numSrcOutStreams; - NCoderMixer2::CBindInfo _srcBindInfo; - CRecordVector _srcInToDestOutMap; - CRecordVector _srcOutToDestInMap; - CRecordVector _destInToSrcOutMap; -public: - UInt32 NumSrcInStreams; - CRecordVector DestOutToSrcInMap; - - CBindReverseConverter(const NCoderMixer2::CBindInfo &srcBindInfo); - void CreateReverseBindInfo(NCoderMixer2::CBindInfo &destBindInfo); -}; - -struct CCoderInfo -{ - CMyComPtr Coder; - CMyComPtr Coder2; - UInt32 NumInStreams; - UInt32 NumOutStreams; - - CRecordVector InSizes; - CRecordVector OutSizes; - CRecordVector InSizePointers; - CRecordVector OutSizePointers; - - CCoderInfo(UInt32 numInStreams, UInt32 numOutStreams); - void SetCoderInfo(const UInt64 **inSizes, const UInt64 **outSizes); -}; - -class CCoderMixer2 -{ -public: - virtual void SetBindInfo(const CBindInfo &bindInfo) = 0; - virtual void ReInit() = 0; - virtual void SetCoderInfo(UInt32 coderIndex, const UInt64 **inSizes, const UInt64 **outSizes) = 0; -}; - -} -#endif - diff --git a/7zip/Archive/Common/CoderMixer2MT.cpp b/7zip/Archive/Common/CoderMixer2MT.cpp deleted file mode 100755 index 28fd3d6a..00000000 --- a/7zip/Archive/Common/CoderMixer2MT.cpp +++ /dev/null @@ -1,359 +0,0 @@ -// CoderMixer2MT.cpp - -#include "StdAfx.h" - -#include "CoderMixer2MT.h" -#include "CrossThreadProgress.h" - -using namespace NWindows; -using namespace NSynchronization; - -namespace NCoderMixer2 { - -CThreadCoderInfo::CThreadCoderInfo(UInt32 numInStreams, UInt32 numOutStreams): - ExitEvent(NULL), - CompressEvent(NULL), - CompressionCompletedEvent(NULL), - CCoderInfo(numInStreams, numOutStreams) -{ - InStreams.Reserve(NumInStreams); - InStreamPointers.Reserve(NumInStreams); - OutStreams.Reserve(NumOutStreams); - OutStreamPointers.Reserve(NumOutStreams); -} - -void CThreadCoderInfo::CreateEvents() -{ - CompressEvent = new CAutoResetEvent(false); - CompressionCompletedEvent = new CAutoResetEvent(false); -} - -CThreadCoderInfo::~CThreadCoderInfo() -{ - if (CompressEvent != NULL) - delete CompressEvent; - if (CompressionCompletedEvent != NULL) - delete CompressionCompletedEvent; -} - -class CCoderInfoFlusher2 -{ - CThreadCoderInfo *m_CoderInfo; -public: - CCoderInfoFlusher2(CThreadCoderInfo *coderInfo): m_CoderInfo(coderInfo) {} - ~CCoderInfoFlusher2() - { - int i; - for (i = 0; i < m_CoderInfo->InStreams.Size(); i++) - m_CoderInfo->InStreams[i].Release(); - for (i = 0; i < m_CoderInfo->OutStreams.Size(); i++) - m_CoderInfo->OutStreams[i].Release(); - m_CoderInfo->CompressionCompletedEvent->Set(); - } -}; - -bool CThreadCoderInfo::WaitAndCode() -{ - HANDLE events[2] = { ExitEvent, *CompressEvent }; - DWORD waitResult = ::WaitForMultipleObjects(2, events, FALSE, INFINITE); - if (waitResult == WAIT_OBJECT_0 + 0) - return false; - - { - InStreamPointers.Clear(); - OutStreamPointers.Clear(); - UInt32 i; - for (i = 0; i < NumInStreams; i++) - { - if (InSizePointers[i] != NULL) - InSizePointers[i] = &InSizes[i]; - InStreamPointers.Add(InStreams[i]); - } - for (i = 0; i < NumOutStreams; i++) - { - if (OutSizePointers[i] != NULL) - OutSizePointers[i] = &OutSizes[i]; - OutStreamPointers.Add(OutStreams[i]); - } - CCoderInfoFlusher2 coderInfoFlusher(this); - if (Coder) - Result = Coder->Code(InStreamPointers[0], - OutStreamPointers[0], - InSizePointers[0], - OutSizePointers[0], - Progress); - else - Result = Coder2->Code(&InStreamPointers.Front(), - &InSizePointers.Front(), - NumInStreams, - &OutStreamPointers.Front(), - &OutSizePointers.Front(), - NumOutStreams, - Progress); - } - return true; -} - -static void SetSizes(const UInt64 **srcSizes, CRecordVector &sizes, - CRecordVector &sizePointers, UInt32 numItems) -{ - sizes.Clear(); - sizePointers.Clear(); - for(UInt32 i = 0; i < numItems; i++) - { - if (srcSizes == 0 || srcSizes[i] == NULL) - { - sizes.Add(0); - sizePointers.Add(NULL); - } - else - { - sizes.Add(*srcSizes[i]); - sizePointers.Add(&sizes.Back()); - } - } -} - - -void CThreadCoderInfo::SetCoderInfo(const UInt64 **inSizes, - const UInt64 **outSizes, ICompressProgressInfo *progress) -{ - Progress = progress; - SetSizes(inSizes, InSizes, InSizePointers, NumInStreams); - SetSizes(outSizes, OutSizes, OutSizePointers, NumOutStreams); -} - -static DWORD WINAPI CoderThread(void *threadCoderInfo) -{ - for (;;) - { - if (!((CThreadCoderInfo *)threadCoderInfo)->WaitAndCode()) - return 0; - } -} - -////////////////////////////////////// -// CCoderMixer2MT - -static DWORD WINAPI MainCoderThread(void *threadCoderInfo) -{ - for (;;) - { - if (!((CCoderMixer2MT *)threadCoderInfo)->MyCode()) - return 0; - } -} - -CCoderMixer2MT::CCoderMixer2MT() -{ - if (!_mainThread.Create(MainCoderThread, this)) - throw 271825; -} - -CCoderMixer2MT::~CCoderMixer2MT() -{ - _exitEvent.Set(); - _mainThread.Wait(); - for(int i = 0; i < _threads.Size(); i++) - { - _threads[i].Wait(); - _threads[i].Close(); - } -} - -void CCoderMixer2MT::SetBindInfo(const CBindInfo &bindInfo) -{ - _bindInfo = bindInfo; - _streamBinders.Clear(); - for(int i = 0; i < _bindInfo.BindPairs.Size(); i++) - { - _streamBinders.Add(CStreamBinder()); - _streamBinders.Back().CreateEvents(); - } -} - -void CCoderMixer2MT::AddCoderCommon() -{ - int index = _coderInfoVector.Size(); - const CCoderStreamsInfo &CoderStreamsInfo = _bindInfo.Coders[index]; - - CThreadCoderInfo threadCoderInfo(CoderStreamsInfo.NumInStreams, - CoderStreamsInfo.NumOutStreams); - _coderInfoVector.Add(threadCoderInfo); - _coderInfoVector.Back().CreateEvents(); - _coderInfoVector.Back().ExitEvent = _exitEvent; - _compressingCompletedEvents.Add(*_coderInfoVector.Back().CompressionCompletedEvent); - - NWindows::CThread newThread; - _threads.Add(newThread); - if (!_threads.Back().Create(CoderThread, &_coderInfoVector.Back())) - throw 271824; -} - -void CCoderMixer2MT::AddCoder(ICompressCoder *coder) -{ - AddCoderCommon(); - _coderInfoVector.Back().Coder = coder; -} - -void CCoderMixer2MT::AddCoder2(ICompressCoder2 *coder) -{ - AddCoderCommon(); - _coderInfoVector.Back().Coder2 = coder; -} - -/* -void CCoderMixer2MT::FinishAddingCoders() -{ - for(int i = 0; i < _coderInfoVector.Size(); i++) - { - DWORD id; - HANDLE newThread = ::CreateThread(NULL, 0, CoderThread, - &_coderInfoVector[i], 0, &id); - if (newThread == 0) - throw 271824; - _threads.Add(newThread); - } -} -*/ - -void CCoderMixer2MT::ReInit() -{ - for(int i = 0; i < _streamBinders.Size(); i++) - _streamBinders[i].ReInit(); -} - - -STDMETHODIMP CCoderMixer2MT::Init(ISequentialInStream **inStreams, - ISequentialOutStream **outStreams) -{ - if (_coderInfoVector.Size() != _bindInfo.Coders.Size()) - throw 0; - int i; - for(i = 0; i < _coderInfoVector.Size(); i++) - { - CThreadCoderInfo &coderInfo = _coderInfoVector[i]; - const CCoderStreamsInfo &coderStreamsInfo = _bindInfo.Coders[i]; - coderInfo.InStreams.Clear(); - UInt32 j; - for(j = 0; j < coderStreamsInfo.NumInStreams; j++) - coderInfo.InStreams.Add(NULL); - coderInfo.OutStreams.Clear(); - for(j = 0; j < coderStreamsInfo.NumOutStreams; j++) - coderInfo.OutStreams.Add(NULL); - } - - for(i = 0; i < _bindInfo.BindPairs.Size(); i++) - { - const CBindPair &bindPair = _bindInfo.BindPairs[i]; - UInt32 inCoderIndex, inCoderStreamIndex; - UInt32 outCoderIndex, outCoderStreamIndex; - _bindInfo.FindInStream(bindPair.InIndex, inCoderIndex, inCoderStreamIndex); - _bindInfo.FindOutStream(bindPair.OutIndex, outCoderIndex, outCoderStreamIndex); - - _streamBinders[i].CreateStreams( - &_coderInfoVector[inCoderIndex].InStreams[inCoderStreamIndex], - &_coderInfoVector[outCoderIndex].OutStreams[outCoderStreamIndex]); - } - - for(i = 0; i < _bindInfo.InStreams.Size(); i++) - { - UInt32 inCoderIndex, inCoderStreamIndex; - _bindInfo.FindInStream(_bindInfo.InStreams[i], inCoderIndex, inCoderStreamIndex); - _coderInfoVector[inCoderIndex].InStreams[inCoderStreamIndex] = inStreams[i]; - } - - for(i = 0; i < _bindInfo.OutStreams.Size(); i++) - { - UInt32 outCoderIndex, outCoderStreamIndex; - _bindInfo.FindOutStream(_bindInfo.OutStreams[i], outCoderIndex, outCoderStreamIndex); - _coderInfoVector[outCoderIndex].OutStreams[outCoderStreamIndex] = outStreams[i]; - } - return S_OK; -} - - -bool CCoderMixer2MT::MyCode() -{ - HANDLE events[2] = { _exitEvent, _startCompressingEvent }; - DWORD waitResult = ::WaitForMultipleObjects(2, events, FALSE, INFINITE); - if (waitResult == WAIT_OBJECT_0 + 0) - return false; - - for(int i = 0; i < _coderInfoVector.Size(); i++) - _coderInfoVector[i].CompressEvent->Set(); - /* DWORD result = */ ::WaitForMultipleObjects(_compressingCompletedEvents.Size(), - &_compressingCompletedEvents.Front(), TRUE, INFINITE); - - _compressingFinishedEvent.Set(); - - return true; -} - - -STDMETHODIMP CCoderMixer2MT::Code(ISequentialInStream **inStreams, - const UInt64 ** /* inSizes */, - UInt32 numInStreams, - ISequentialOutStream **outStreams, - const UInt64 ** /* outSizes */, - UInt32 numOutStreams, - ICompressProgressInfo *progress) -{ - if (numInStreams != (UInt32)_bindInfo.InStreams.Size() || - numOutStreams != (UInt32)_bindInfo.OutStreams.Size()) - return E_INVALIDARG; - - Init(inStreams, outStreams); - - _compressingFinishedEvent.Reset(); // ? - - CCrossThreadProgress *progressSpec = new CCrossThreadProgress; - CMyComPtr crossProgress = progressSpec; - progressSpec->Init(); - _coderInfoVector[_progressCoderIndex].Progress = crossProgress; - - _startCompressingEvent.Set(); - - - for (;;) - { - HANDLE events[2] = {_compressingFinishedEvent, progressSpec->ProgressEvent }; - DWORD waitResult = ::WaitForMultipleObjects(2, events, FALSE, INFINITE); - if (waitResult == WAIT_OBJECT_0 + 0) - break; - if (progress != NULL) - progressSpec->Result = progress->SetRatioInfo(progressSpec->InSize, - progressSpec->OutSize); - else - progressSpec->Result = S_OK; - progressSpec->WaitEvent.Set(); - } - - int i; - for(i = 0; i < _coderInfoVector.Size(); i++) - { - HRESULT result = _coderInfoVector[i].Result; - if (result == S_FALSE) - return result; - } - for(i = 0; i < _coderInfoVector.Size(); i++) - { - HRESULT result = _coderInfoVector[i].Result; - if (result != S_OK && result != E_FAIL) - return result; - } - for(i = 0; i < _coderInfoVector.Size(); i++) - { - HRESULT result = _coderInfoVector[i].Result; - if (result != S_OK) - return result; - } - return S_OK; -} - -UInt64 CCoderMixer2MT::GetWriteProcessedSize(UInt32 binderIndex) const -{ - return _streamBinders[binderIndex].ProcessedSize; -} - -} diff --git a/7zip/Archive/Common/CoderMixer2MT.h b/7zip/Archive/Common/CoderMixer2MT.h deleted file mode 100755 index 78d752de..00000000 --- a/7zip/Archive/Common/CoderMixer2MT.h +++ /dev/null @@ -1,121 +0,0 @@ -// CoderMixer2MT.h - -#ifndef __CODER_MIXER2_MT_H -#define __CODER_MIXER2_MT_H - -#include "CoderMixer2.h" -#include "../../../Common/MyCom.h" -#include "../../../Windows/Thread.h" -#include "../../Common/StreamBinder.h" - -namespace NCoderMixer2 { - -// CreateEvents(); -// { -// SetCoderInfo() -// Init Streams -// set CompressEvent() -// wait CompressionCompletedEvent -// } - -struct CThreadCoderInfo: public CCoderInfo -{ - NWindows::NSynchronization::CAutoResetEvent *CompressEvent; - HANDLE ExitEvent; - NWindows::NSynchronization::CAutoResetEvent *CompressionCompletedEvent; - - CObjectVector< CMyComPtr > InStreams; - CObjectVector< CMyComPtr > OutStreams; - CRecordVector InStreamPointers; - CRecordVector OutStreamPointers; - - CMyComPtr Progress; // CMyComPtr - HRESULT Result; - - CThreadCoderInfo(UInt32 numInStreams, UInt32 numOutStreams); - void SetCoderInfo(const UInt64 **inSizes, - const UInt64 **outSizes, ICompressProgressInfo *progress); - ~CThreadCoderInfo(); - bool WaitAndCode(); - void CreateEvents(); -}; - - -// SetBindInfo() -// for each coder -// { -// AddCoder[2]() -// } -// -// for each file -// { -// ReInit() -// for each coder -// { -// SetCoderInfo -// } -// SetProgressIndex(UInt32 coderIndex); -// Code -// } - - -class CCoderMixer2MT: - public ICompressCoder2, - public CCoderMixer2, - public CMyUnknownImp -{ - MY_UNKNOWN_IMP - -public: - STDMETHOD(Init)(ISequentialInStream **inStreams, - ISequentialOutStream **outStreams); - - STDMETHOD(Code)(ISequentialInStream **inStreams, - const UInt64 **inSizes, - UInt32 numInStreams, - ISequentialOutStream **outStreams, - const UInt64 **outSizes, - UInt32 numOutStreams, - ICompressProgressInfo *progress); - - - CCoderMixer2MT(); - ~CCoderMixer2MT(); - void AddCoderCommon(); - void AddCoder(ICompressCoder *coder); - void AddCoder2(ICompressCoder2 *coder); - - void ReInit(); - void SetCoderInfo(UInt32 coderIndex, const UInt64 **inSizes, const UInt64 **outSizes) - { _coderInfoVector[coderIndex].SetCoderInfo(inSizes, outSizes, NULL); } - void SetProgressCoderIndex(UInt32 coderIndex) - { _progressCoderIndex = coderIndex; } - - - UInt64 GetWriteProcessedSize(UInt32 binderIndex) const; - - - bool MyCode(); - -private: - CBindInfo _bindInfo; - CObjectVector _streamBinders; - CObjectVector _coderInfoVector; - CRecordVector _threads; - NWindows::CThread _mainThread; - - NWindows::NSynchronization::CAutoResetEvent _startCompressingEvent; - CRecordVector _compressingCompletedEvents; - NWindows::NSynchronization::CAutoResetEvent _compressingFinishedEvent; - - NWindows::NSynchronization::CManualResetEvent _exitEvent; - UInt32 _progressCoderIndex; - -public: - void SetBindInfo(const CBindInfo &bindInfo); - -}; - -} -#endif - diff --git a/7zip/Archive/Common/CoderMixer2ST.cpp b/7zip/Archive/Common/CoderMixer2ST.cpp deleted file mode 100755 index c01b776d..00000000 --- a/7zip/Archive/Common/CoderMixer2ST.cpp +++ /dev/null @@ -1,238 +0,0 @@ -// CoderMixer2ST.cpp - -#include "StdAfx.h" - -#include "CoderMixer2ST.h" - -namespace NCoderMixer2 { - -CCoderMixer2ST::CCoderMixer2ST() {} - -CCoderMixer2ST::~CCoderMixer2ST(){ } - -void CCoderMixer2ST::SetBindInfo(const CBindInfo &bindInfo) -{ - _bindInfo = bindInfo; -} - -void CCoderMixer2ST::AddCoderCommon(bool isMain) -{ - const CCoderStreamsInfo &csi = _bindInfo.Coders[_coders.Size()]; - _coders.Add(CSTCoderInfo(csi.NumInStreams, csi.NumOutStreams, isMain)); -} - -void CCoderMixer2ST::AddCoder(ICompressCoder *coder, bool isMain) -{ - AddCoderCommon(isMain); - _coders.Back().Coder = coder; -} - -void CCoderMixer2ST::AddCoder2(ICompressCoder2 *coder, bool isMain) -{ - AddCoderCommon(isMain); - _coders.Back().Coder2 = coder; -} - -void CCoderMixer2ST::ReInit() { } - -HRESULT CCoderMixer2ST::GetInStream( - ISequentialInStream **inStreams, const UInt64 **inSizes, - UInt32 streamIndex, ISequentialInStream **inStreamRes) -{ - CMyComPtr seqInStream; - int i; - for(i = 0; i < _bindInfo.InStreams.Size(); i++) - if (_bindInfo.InStreams[i] == streamIndex) - { - seqInStream = inStreams[i]; - *inStreamRes = seqInStream.Detach(); - return S_OK; - } - int binderIndex = _bindInfo.FindBinderForInStream(streamIndex); - if (binderIndex < 0) - return E_INVALIDARG; - - UInt32 coderIndex, coderStreamIndex; - _bindInfo.FindOutStream(_bindInfo.BindPairs[binderIndex].OutIndex, - coderIndex, coderStreamIndex); - - CCoderInfo &coder = _coders[coderIndex]; - if (!coder.Coder) - return E_NOTIMPL; - coder.Coder.QueryInterface(IID_ISequentialInStream, &seqInStream); - if (!seqInStream) - return E_NOTIMPL; - - UInt32 startIndex = _bindInfo.GetCoderInStreamIndex(coderIndex); - - CMyComPtr setInStream; - if (!coder.Coder) - return E_NOTIMPL; - coder.Coder.QueryInterface(IID_ICompressSetInStream, &setInStream); - if (!setInStream) - return E_NOTIMPL; - - if (coder.NumInStreams > 1) - return E_NOTIMPL; - for (i = 0; i < (int)coder.NumInStreams; i++) - { - CMyComPtr seqInStream2; - RINOK(GetInStream(inStreams, inSizes, startIndex + i, &seqInStream2)); - RINOK(setInStream->SetInStream(seqInStream2)); - } - *inStreamRes = seqInStream.Detach(); - return S_OK; -} - -HRESULT CCoderMixer2ST::GetOutStream( - ISequentialOutStream **outStreams, const UInt64 **outSizes, - UInt32 streamIndex, ISequentialOutStream **outStreamRes) -{ - CMyComPtr seqOutStream; - int i; - for(i = 0; i < _bindInfo.OutStreams.Size(); i++) - if (_bindInfo.OutStreams[i] == streamIndex) - { - seqOutStream = outStreams[i]; - *outStreamRes = seqOutStream.Detach(); - return S_OK; - } - int binderIndex = _bindInfo.FindBinderForOutStream(streamIndex); - if (binderIndex < 0) - return E_INVALIDARG; - - UInt32 coderIndex, coderStreamIndex; - _bindInfo.FindInStream(_bindInfo.BindPairs[binderIndex].InIndex, - coderIndex, coderStreamIndex); - - CCoderInfo &coder = _coders[coderIndex]; - if (!coder.Coder) - return E_NOTIMPL; - coder.Coder.QueryInterface(IID_ISequentialOutStream, &seqOutStream); - if (!seqOutStream) - return E_NOTIMPL; - - UInt32 startIndex = _bindInfo.GetCoderOutStreamIndex(coderIndex); - - CMyComPtr setOutStream; - if (!coder.Coder) - return E_NOTIMPL; - coder.Coder.QueryInterface(IID_ICompressSetOutStream, &setOutStream); - if (!setOutStream) - return E_NOTIMPL; - - if (coder.NumOutStreams > 1) - return E_NOTIMPL; - for (i = 0; i < (int)coder.NumOutStreams; i++) - { - CMyComPtr seqOutStream2; - RINOK(GetOutStream(outStreams, outSizes, startIndex + i, &seqOutStream2)); - RINOK(setOutStream->SetOutStream(seqOutStream2)); - } - *outStreamRes = seqOutStream.Detach(); - return S_OK; -} - - -STDMETHODIMP CCoderMixer2ST::Code(ISequentialInStream **inStreams, - const UInt64 **inSizes, - UInt32 numInStreams, - ISequentialOutStream **outStreams, - const UInt64 **outSizes, - UInt32 numOutStreams, - ICompressProgressInfo *progress) -{ - if (numInStreams != (UInt32)_bindInfo.InStreams.Size() || - numOutStreams != (UInt32)_bindInfo.OutStreams.Size()) - return E_INVALIDARG; - - // Find main coder - int _mainCoderIndex = -1; - int i; - for (i = 0; i < _coders.Size(); i++) - if (_coders[i].IsMain) - { - _mainCoderIndex = i; - break; - } - if (_mainCoderIndex < 0) - for (i = 0; i < _coders.Size(); i++) - if (_coders[i].NumInStreams > 1) - { - if (_mainCoderIndex >= 0) - return E_NOTIMPL; - _mainCoderIndex = i; - } - if (_mainCoderIndex < 0) - _mainCoderIndex = 0; - - // _mainCoderIndex = 0; - // _mainCoderIndex = _coders.Size() - 1; - CCoderInfo &mainCoder = _coders[_mainCoderIndex]; - - CObjectVector< CMyComPtr > seqInStreams; - CObjectVector< CMyComPtr > seqOutStreams; - UInt32 startInIndex = _bindInfo.GetCoderInStreamIndex(_mainCoderIndex); - UInt32 startOutIndex = _bindInfo.GetCoderOutStreamIndex(_mainCoderIndex); - for (i = 0; i < (int)mainCoder.NumInStreams; i++) - { - CMyComPtr seqInStream; - RINOK(GetInStream(inStreams, inSizes, startInIndex + i, &seqInStream)); - seqInStreams.Add(seqInStream); - } - for (i = 0; i < (int)mainCoder.NumOutStreams; i++) - { - CMyComPtr seqOutStream; - RINOK(GetOutStream(outStreams, outSizes, startOutIndex + i, &seqOutStream)); - seqOutStreams.Add(seqOutStream); - } - CRecordVector< ISequentialInStream * > seqInStreamsSpec; - CRecordVector< ISequentialOutStream * > seqOutStreamsSpec; - for (i = 0; i < (int)mainCoder.NumInStreams; i++) - seqInStreamsSpec.Add(seqInStreams[i]); - for (i = 0; i < (int)mainCoder.NumOutStreams; i++) - seqOutStreamsSpec.Add(seqOutStreams[i]); - - for (i = 0; i < _coders.Size(); i++) - { - if (i == _mainCoderIndex) - continue; - CCoderInfo &coder = _coders[i]; - CMyComPtr setOutStreamSize; - coder.Coder.QueryInterface(IID_ICompressSetOutStreamSize, &setOutStreamSize); - if (setOutStreamSize) - { - RINOK(setOutStreamSize->SetOutStreamSize(coder.OutSizePointers[0])); - } - } - if (mainCoder.Coder) - { - RINOK(mainCoder.Coder->Code( - seqInStreamsSpec[0], seqOutStreamsSpec[0], - mainCoder.InSizePointers[0], mainCoder.OutSizePointers[0], - progress)); - } - else - { - RINOK(mainCoder.Coder2->Code( - &seqInStreamsSpec.Front(), - &mainCoder.InSizePointers.Front(), mainCoder.NumInStreams, - &seqOutStreamsSpec.Front(), - &mainCoder.OutSizePointers.Front(), mainCoder.NumOutStreams, - progress)); - } - CMyComPtr flush; - seqOutStreams.Front().QueryInterface(IID_IOutStreamFlush, &flush); - if (flush) - return flush->Flush(); - return S_OK; -} - -/* -UInt64 CCoderMixer2ST::GetWriteProcessedSize(UInt32 binderIndex) const -{ - return _streamBinders[binderIndex].ProcessedSize; -} -*/ - -} diff --git a/7zip/Archive/Common/CoderMixer2ST.h b/7zip/Archive/Common/CoderMixer2ST.h deleted file mode 100755 index 3144918b..00000000 --- a/7zip/Archive/Common/CoderMixer2ST.h +++ /dev/null @@ -1,88 +0,0 @@ -// CoderMixer2ST.h - -#ifndef __CODER_MIXER2_ST_H -#define __CODER_MIXER2_ST_H - -#include "CoderMixer2.h" -#include "../../../Common/MyCom.h" -#include "../../ICoder.h" - -namespace NCoderMixer2 { - -// SetBindInfo() -// for each coder -// { -// AddCoder[2]() -// } -// -// for each file -// { -// ReInit() -// for each coder -// { -// SetCoderInfo -// } -// SetProgressIndex(UInt32 coderIndex); -// Code -// } - -struct CSTCoderInfo: public CCoderInfo -{ - bool IsMain; - CSTCoderInfo(UInt32 numInStreams, UInt32 numOutStreams, bool isMain): - CCoderInfo(numInStreams, numOutStreams),IsMain(isMain) {} -}; - -class CCoderMixer2ST: - public ICompressCoder2, - public CCoderMixer2, - public CMyUnknownImp -{ - MY_UNKNOWN_IMP - - HRESULT GetInStream( - ISequentialInStream **inStreams, const UInt64 **inSizes, - UInt32 streamIndex, ISequentialInStream **inStreamRes); - HRESULT GetOutStream( - ISequentialOutStream **outStreams, const UInt64 **outSizes, - UInt32 streamIndex, ISequentialOutStream **outStreamRes); -public: - STDMETHOD(Code)(ISequentialInStream **inStreams, - const UInt64 **inSizes, - UInt32 numInStreams, - ISequentialOutStream **outStreams, - const UInt64 **outSizes, - UInt32 numOutStreams, - ICompressProgressInfo *progress); - - CCoderMixer2ST(); - ~CCoderMixer2ST(); - void AddCoderCommon(bool isMain); - void AddCoder(ICompressCoder *coder, bool isMain); - void AddCoder2(ICompressCoder2 *coder, bool isMain); - - void ReInit(); - void SetCoderInfo(UInt32 coderIndex, const UInt64 **inSizes, const UInt64 **outSizes) - { - { _coders[coderIndex].SetCoderInfo(inSizes, outSizes); } - } - - void SetProgressCoderIndex(UInt32 /*coderIndex*/) - { - // _progressCoderIndex = coderIndex; - } - - // UInt64 GetWriteProcessedSize(UInt32 binderIndex) const; - -private: - CBindInfo _bindInfo; - CObjectVector _coders; - int _mainCoderIndex; -public: - void SetBindInfo(const CBindInfo &bindInfo); - -}; - -} -#endif - diff --git a/7zip/Archive/Common/CrossThreadProgress.cpp b/7zip/Archive/Common/CrossThreadProgress.cpp deleted file mode 100755 index a974b54c..00000000 --- a/7zip/Archive/Common/CrossThreadProgress.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// CrossThreadProgress.cpp - -#include "StdAfx.h" - -#include "CrossThreadProgress.h" - -STDMETHODIMP CCrossThreadProgress::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize) -{ - InSize = inSize; - OutSize = outSize; - ProgressEvent.Set(); - WaitEvent.Lock(); - return Result; -} - diff --git a/7zip/Archive/Common/CrossThreadProgress.h b/7zip/Archive/Common/CrossThreadProgress.h deleted file mode 100755 index 5dd339dc..00000000 --- a/7zip/Archive/Common/CrossThreadProgress.h +++ /dev/null @@ -1,31 +0,0 @@ -// CrossThreadProgress.h - -#ifndef __CROSSTHREADPROGRESS_H -#define __CROSSTHREADPROGRESS_H - -#include "../../ICoder.h" -#include "../../../Windows/Synchronization.h" -#include "../../../Common/MyCom.h" - -class CCrossThreadProgress: - public ICompressProgressInfo, - public CMyUnknownImp -{ -public: - const UInt64 *InSize; - const UInt64 *OutSize; - HRESULT Result; - NWindows::NSynchronization::CAutoResetEvent ProgressEvent; - NWindows::NSynchronization::CAutoResetEvent WaitEvent; - void Init() - { - ProgressEvent.Reset(); - WaitEvent.Reset(); - } - - MY_UNKNOWN_IMP - - STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize); -}; - -#endif diff --git a/7zip/Archive/Common/DummyOutStream.cpp b/7zip/Archive/Common/DummyOutStream.cpp deleted file mode 100755 index b1d49913..00000000 --- a/7zip/Archive/Common/DummyOutStream.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// DummyOutStream.cpp - -#include "StdAfx.h" - -#include "DummyOutStream.h" - -void CDummyOutStream::Init(ISequentialOutStream *outStream) -{ - m_Stream = outStream; -} - -STDMETHODIMP CDummyOutStream::Write(const void *data, - UInt32 size, UInt32 *processedSize) -{ - if(m_Stream) - return m_Stream->Write(data, size, processedSize); - if(processedSize != NULL) - *processedSize = size; - return S_OK; -} diff --git a/7zip/Archive/Common/DummyOutStream.h b/7zip/Archive/Common/DummyOutStream.h deleted file mode 100755 index 51690787..00000000 --- a/7zip/Archive/Common/DummyOutStream.h +++ /dev/null @@ -1,23 +0,0 @@ -// DummyOutStream.h - -#ifndef __DUMMYOUTSTREAM_H -#define __DUMMYOUTSTREAM_H - -#include "../../IStream.h" -#include "Common/MyCom.h" - -class CDummyOutStream: - public ISequentialOutStream, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP - - STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); -private: - CMyComPtr m_Stream; -public: - void Init(ISequentialOutStream *outStream); -}; - -#endif diff --git a/7zip/Archive/Common/FilterCoder.cpp b/7zip/Archive/Common/FilterCoder.cpp deleted file mode 100755 index 5e104c84..00000000 --- a/7zip/Archive/Common/FilterCoder.cpp +++ /dev/null @@ -1,243 +0,0 @@ -// FilterCoder.cpp - -#include "StdAfx.h" - -#include "FilterCoder.h" -#include "../../../Common/Alloc.h" -#include "../../../Common/Defs.h" -#include "../../Common/StreamUtils.h" - -static const int kBufferSize = 1 << 17; - -CFilterCoder::CFilterCoder() -{ - _buffer = (Byte *)::MidAlloc(kBufferSize); -} - -CFilterCoder::~CFilterCoder() -{ - ::MidFree(_buffer); -} - -HRESULT CFilterCoder::WriteWithLimit(ISequentialOutStream *outStream, UInt32 size) -{ - if (_outSizeIsDefined) - { - UInt64 remSize = _outSize - _nowPos64; - if (size > remSize) - size = (UInt32)remSize; - } - UInt32 processedSize = 0; - RINOK(WriteStream(outStream, _buffer, size, &processedSize)); - if (size != processedSize) - return E_FAIL; - _nowPos64 += processedSize; - return S_OK; -} - - -STDMETHODIMP CFilterCoder::Code(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 * /* inSize */, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - RINOK(Init()); - UInt32 bufferPos = 0; - _outSizeIsDefined = (outSize != 0); - if (_outSizeIsDefined) - _outSize = *outSize; - - while(NeedMore()) - { - UInt32 processedSize; - - // Change it: It can be optimized using ReadPart - RINOK(ReadStream(inStream, _buffer + bufferPos, kBufferSize - bufferPos, &processedSize)); - - UInt32 endPos = bufferPos + processedSize; - - bufferPos = Filter->Filter(_buffer, endPos); - if (bufferPos > endPos) - { - for (; endPos< bufferPos; endPos++) - _buffer[endPos] = 0; - bufferPos = Filter->Filter(_buffer, endPos); - } - - if (bufferPos == 0) - { - if (endPos > 0) - return WriteWithLimit(outStream, endPos); - return S_OK; - } - RINOK(WriteWithLimit(outStream, bufferPos)); - if (progress != NULL) - { - RINOK(progress->SetRatioInfo(&_nowPos64, &_nowPos64)); - } - UInt32 i = 0; - while(bufferPos < endPos) - _buffer[i++] = _buffer[bufferPos++]; - bufferPos = i; - } - return S_OK; -} - -// #ifdef _ST_MODE -STDMETHODIMP CFilterCoder::SetOutStream(ISequentialOutStream *outStream) -{ - _bufferPos = 0; - _outStream = outStream; - return Init(); -} - -STDMETHODIMP CFilterCoder::ReleaseOutStream() -{ - _outStream.Release(); - return S_OK; -}; - - -STDMETHODIMP CFilterCoder::Write(const void *data, UInt32 size, UInt32 *processedSize) -{ - UInt32 processedSizeTotal = 0; - while(size > 0) - { - UInt32 sizeMax = kBufferSize - _bufferPos; - UInt32 sizeTemp = size; - if (sizeTemp > sizeMax) - sizeTemp = sizeMax; - memmove(_buffer + _bufferPos, data, sizeTemp); - size -= sizeTemp; - processedSizeTotal += sizeTemp; - data = (const Byte *)data + sizeTemp; - UInt32 endPos = _bufferPos + sizeTemp; - _bufferPos = Filter->Filter(_buffer, endPos); - if (_bufferPos == 0) - { - _bufferPos = endPos; - break; - } - if (_bufferPos > endPos) - { - if (size != 0) - return E_FAIL; - break; - } - RINOK(WriteWithLimit(_outStream, _bufferPos)); - UInt32 i = 0; - while(_bufferPos < endPos) - _buffer[i++] = _buffer[_bufferPos++]; - _bufferPos = i; - } - if (processedSize != NULL) - *processedSize = processedSizeTotal; - return S_OK; -} - -STDMETHODIMP CFilterCoder::Flush() -{ - if (_bufferPos != 0) - { - UInt32 endPos = Filter->Filter(_buffer, _bufferPos); - if (endPos > _bufferPos) - { - for (; _bufferPos < endPos; _bufferPos++) - _buffer[_bufferPos] = 0; - if (Filter->Filter(_buffer, endPos) != endPos) - return E_FAIL; - } - UInt32 processedSize; - RINOK(WriteStream(_outStream, _buffer, _bufferPos, &processedSize)); - if (_bufferPos != processedSize) - return E_FAIL; - _bufferPos = 0; - } - CMyComPtr flush; - _outStream.QueryInterface(IID_IOutStreamFlush, &flush); - if (flush) - return flush->Flush(); - return S_OK; -} - - -STDMETHODIMP CFilterCoder::SetInStream(ISequentialInStream *inStream) -{ - _convertedPosBegin = _convertedPosEnd = _bufferPos = 0; - _inStream = inStream; - return Init(); -} - -STDMETHODIMP CFilterCoder::ReleaseInStream() -{ - _inStream.Release(); - return S_OK; -}; - -STDMETHODIMP CFilterCoder::Read(void *data, UInt32 size, UInt32 *processedSize) -{ - UInt32 processedSizeTotal = 0; - while(size > 0) - { - if (_convertedPosBegin != _convertedPosEnd) - { - UInt32 sizeTemp = MyMin(size, _convertedPosEnd - _convertedPosBegin); - memmove(data, _buffer + _convertedPosBegin, sizeTemp); - _convertedPosBegin += sizeTemp; - data = (void *)((Byte *)data + sizeTemp); - size -= sizeTemp; - processedSizeTotal += sizeTemp; - break; - } - int i; - for (i = 0; _convertedPosEnd + i < _bufferPos; i++) - _buffer[i] = _buffer[i + _convertedPosEnd]; - _bufferPos = i; - _convertedPosBegin = _convertedPosEnd = 0; - UInt32 processedSizeTemp; - UInt32 size0 = kBufferSize - _bufferPos; - // Optimize it: - RINOK(ReadStream(_inStream, _buffer + _bufferPos, size0, &processedSizeTemp)); - _bufferPos = _bufferPos + processedSizeTemp; - _convertedPosEnd = Filter->Filter(_buffer, _bufferPos); - if (_convertedPosEnd == 0) - { - if (_bufferPos == 0) - break; - else - { - _convertedPosEnd = _bufferPos; // check it - continue; - } - } - if (_convertedPosEnd > _bufferPos) - { - for (; _bufferPos < _convertedPosEnd; _bufferPos++) - _buffer[_bufferPos] = 0; - _convertedPosEnd = Filter->Filter(_buffer, _bufferPos); - } - } - if (processedSize != NULL) - *processedSize = processedSizeTotal; - return S_OK; -} - -// #endif // _ST_MODE - -#ifndef _NO_CRYPTO -STDMETHODIMP CFilterCoder::CryptoSetPassword(const Byte *data, UInt32 size) -{ - return _setPassword->CryptoSetPassword(data, size); -} -#endif - -#ifndef EXTRACT_ONLY -STDMETHODIMP CFilterCoder::WriteCoderProperties(ISequentialOutStream *outStream) -{ - return _writeCoderProperties->WriteCoderProperties(outStream); -} -#endif - -STDMETHODIMP CFilterCoder::SetDecoderProperties2(const Byte *data, UInt32 size) -{ - return _setDecoderProperties->SetDecoderProperties2(data, size); -} diff --git a/7zip/Archive/Common/FilterCoder.h b/7zip/Archive/Common/FilterCoder.h deleted file mode 100755 index 45618172..00000000 --- a/7zip/Archive/Common/FilterCoder.h +++ /dev/null @@ -1,130 +0,0 @@ -// FilterCoder.h - -#ifndef __FILTERCODER_H -#define __FILTERCODER_H - -#include "../../../Common/MyCom.h" -#include "../../ICoder.h" -#include "../../IPassword.h" - -#define MY_QUERYINTERFACE_ENTRY_AG(i, sub0, sub) if (iid == IID_ ## i) \ -{ if (!sub) RINOK(sub0->QueryInterface(IID_ ## i, (void **)&sub)) \ -*outObject = (void *)(i *)this; AddRef(); return S_OK; } - -class CFilterCoder: - public ICompressCoder, - // #ifdef _ST_MODE - public ICompressSetInStream, - public ISequentialInStream, - public ICompressSetOutStream, - public ISequentialOutStream, - public IOutStreamFlush, - // #endif - - #ifndef _NO_CRYPTO - public ICryptoSetPassword, - #endif - #ifndef EXTRACT_ONLY - public ICompressWriteCoderProperties, - #endif - public ICompressSetDecoderProperties2, - public CMyUnknownImp -{ -protected: - Byte *_buffer; - // #ifdef _ST_MODE - CMyComPtr _inStream; - CMyComPtr _outStream; - UInt32 _bufferPos; - UInt32 _convertedPosBegin; - UInt32 _convertedPosEnd; - // #endif - bool _outSizeIsDefined; - UInt64 _outSize; - UInt64 _nowPos64; - - HRESULT Init() - { - _nowPos64 = 0; - _outSizeIsDefined = false; - return Filter->Init(); - } - - CMyComPtr _setPassword; - #ifndef EXTRACT_ONLY - CMyComPtr _writeCoderProperties; - #endif - CMyComPtr _setDecoderProperties; -public: - CMyComPtr Filter; - - CFilterCoder(); - ~CFilterCoder(); - HRESULT WriteWithLimit(ISequentialOutStream *outStream, UInt32 size); - bool NeedMore() const - { return (!_outSizeIsDefined || (_nowPos64 < _outSize)); } - -public: - MY_QUERYINTERFACE_BEGIN - MY_QUERYINTERFACE_ENTRY(ICompressCoder) - // #ifdef _ST_MODE - MY_QUERYINTERFACE_ENTRY(ICompressSetInStream) - MY_QUERYINTERFACE_ENTRY(ISequentialInStream) - - MY_QUERYINTERFACE_ENTRY(ICompressSetOutStream) - MY_QUERYINTERFACE_ENTRY(ISequentialOutStream) - MY_QUERYINTERFACE_ENTRY(IOutStreamFlush) - // #endif - - #ifndef _NO_CRYPTO - MY_QUERYINTERFACE_ENTRY_AG(ICryptoSetPassword, Filter, _setPassword) - #endif - - #ifndef EXTRACT_ONLY - MY_QUERYINTERFACE_ENTRY_AG(ICompressWriteCoderProperties, Filter, _writeCoderProperties) - #endif - - MY_QUERYINTERFACE_ENTRY_AG(ICompressSetDecoderProperties2, Filter, _setDecoderProperties) - MY_QUERYINTERFACE_END - MY_ADDREF_RELEASE - STDMETHOD(Code)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - // #ifdef _ST_MODE - STDMETHOD(ReleaseInStream)(); - STDMETHOD(SetInStream)(ISequentialInStream *inStream); - STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); \ - STDMETHOD(SetOutStream)(ISequentialOutStream *outStream); - STDMETHOD(ReleaseOutStream)(); - STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); - STDMETHOD(Flush)(); - // #endif - - #ifndef _NO_CRYPTO - STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size); - #endif - #ifndef EXTRACT_ONLY - STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream); - #endif - STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size); -}; - -// #ifdef _ST_MODE -class CInStreamReleaser -{ -public: - CFilterCoder *FilterCoder; - CInStreamReleaser(): FilterCoder(0) {} - ~CInStreamReleaser() { if (FilterCoder) FilterCoder->ReleaseInStream(); } -}; - -class COutStreamReleaser -{ -public: - CFilterCoder *FilterCoder; - COutStreamReleaser(): FilterCoder(0) {} - ~COutStreamReleaser() { if (FilterCoder) FilterCoder->ReleaseOutStream(); } -}; -// #endif - -#endif diff --git a/7zip/Archive/Common/InStreamWithCRC.cpp b/7zip/Archive/Common/InStreamWithCRC.cpp deleted file mode 100755 index 74dff7e1..00000000 --- a/7zip/Archive/Common/InStreamWithCRC.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// InStreamWithCRC.cpp - -#include "StdAfx.h" - -#include "InStreamWithCRC.h" - -STDMETHODIMP CSequentialInStreamWithCRC::Read(void *data, UInt32 size, UInt32 *processedSize) -{ - UInt32 realProcessedSize; - HRESULT result = _stream->Read(data, size, &realProcessedSize); - _size += realProcessedSize; - if (size > 0 && realProcessedSize == 0) - _wasFinished = true; - _crc.Update(data, realProcessedSize); - if(processedSize != NULL) - *processedSize = realProcessedSize; - return result; -} - -STDMETHODIMP CInStreamWithCRC::Read(void *data, UInt32 size, UInt32 *processedSize) -{ - UInt32 realProcessedSize; - HRESULT result = _stream->Read(data, size, &realProcessedSize); - if (size > 0 && realProcessedSize == 0) - _wasFinished = true; - _size += realProcessedSize; - _crc.Update(data, realProcessedSize); - if(processedSize != NULL) - *processedSize = realProcessedSize; - return result; -} - -STDMETHODIMP CInStreamWithCRC::Seek(Int64 offset, - UInt32 seekOrigin, UInt64 *newPosition) -{ - if (seekOrigin != STREAM_SEEK_SET || offset != 0) - return E_FAIL; - _size = 0; - _crc.Init(); - return _stream->Seek(offset, seekOrigin, newPosition); -} diff --git a/7zip/Archive/Common/InStreamWithCRC.h b/7zip/Archive/Common/InStreamWithCRC.h deleted file mode 100755 index 770a1437..00000000 --- a/7zip/Archive/Common/InStreamWithCRC.h +++ /dev/null @@ -1,65 +0,0 @@ -// InStreamWithCRC.h - -#ifndef __INSTREAMWITHCRC_H -#define __INSTREAMWITHCRC_H - -#include "../../../Common/CRC.h" -#include "../../../Common/MyCom.h" -#include "../../IStream.h" - -class CSequentialInStreamWithCRC: - public ISequentialInStream, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP - - STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); -private: - CMyComPtr _stream; - UInt64 _size; - CCRC _crc; - bool _wasFinished; -public: - void SetStream(ISequentialInStream *stream) { _stream = stream; } - void Init() - { - _size = 0; - _wasFinished = false; - _crc.Init(); - } - void ReleaseStream() { _stream.Release(); } - UInt32 GetCRC() const { return _crc.GetDigest(); } - UInt64 GetSize() const { return _size; } - bool WasFinished() const { return _wasFinished; } -}; - -class CInStreamWithCRC: - public IInStream, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP1(IInStream) - - STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); - STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition); -private: - CMyComPtr _stream; - UInt64 _size; - CCRC _crc; - bool _wasFinished; -public: - void SetStream(IInStream *stream) { _stream = stream; } - void Init() - { - _size = 0; - _wasFinished = false; - _crc.Init(); - } - void ReleaseStream() { _stream.Release(); } - UInt32 GetCRC() const { return _crc.GetDigest(); } - UInt64 GetSize() const { return _size; } - bool WasFinished() const { return _wasFinished; } -}; - -#endif diff --git a/7zip/Archive/Common/ItemNameUtils.cpp b/7zip/Archive/Common/ItemNameUtils.cpp deleted file mode 100755 index f7c3fcd9..00000000 --- a/7zip/Archive/Common/ItemNameUtils.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// Archive/Common/ItemNameUtils.cpp - -#include "StdAfx.h" - -#include "ItemNameUtils.h" - -namespace NArchive { -namespace NItemName { - -static const wchar_t kOSDirDelimiter = WCHAR_PATH_SEPARATOR; -static const wchar_t kDirDelimiter = L'/'; - -UString MakeLegalName(const UString &name) -{ - UString zipName = name; - zipName.Replace(kOSDirDelimiter, kDirDelimiter); - return zipName; -} - -UString GetOSName(const UString &name) -{ - UString newName = name; - newName.Replace(kDirDelimiter, kOSDirDelimiter); - return newName; -} - -UString GetOSName2(const UString &name) -{ - if (name.IsEmpty()) - return UString(); - UString newName = GetOSName(name); - if (newName[newName.Length() - 1] == kOSDirDelimiter) - newName.Delete(newName.Length() - 1); - return newName; -} - -bool HasTailSlash(const AString &name, UINT codePage) -{ - if (name.IsEmpty()) - return false; - LPCSTR prev = - #ifdef _WIN32 - CharPrevExA((WORD)codePage, name, &name[name.Length()], 0); - #else - (LPCSTR)(name) + (name.Length() - 1); - #endif - return (*prev == '/'); -} - -#ifndef _WIN32 -UString WinNameToOSName(const UString &name) -{ - UString newName = name; - newName.Replace(L'\\', kOSDirDelimiter); - return newName; -} -#endif - -}} diff --git a/7zip/Archive/Common/ItemNameUtils.h b/7zip/Archive/Common/ItemNameUtils.h deleted file mode 100755 index 63a01563..00000000 --- a/7zip/Archive/Common/ItemNameUtils.h +++ /dev/null @@ -1,24 +0,0 @@ -// Archive/Common/ItemNameUtils.h - -#ifndef __ARCHIVE_ITEMNAMEUTILS_H -#define __ARCHIVE_ITEMNAMEUTILS_H - -#include "../../../Common/String.h" - -namespace NArchive { -namespace NItemName { - - UString MakeLegalName(const UString &name); - UString GetOSName(const UString &name); - UString GetOSName2(const UString &name); - bool HasTailSlash(const AString &name, UINT codePage); - - #ifdef _WIN32 - inline UString WinNameToOSName(const UString &name) { return name; } - #else - UString WinNameToOSName(const UString &name); - #endif - -}} - -#endif diff --git a/7zip/Archive/Common/MultiStream.cpp b/7zip/Archive/Common/MultiStream.cpp deleted file mode 100755 index a8cb333e..00000000 --- a/7zip/Archive/Common/MultiStream.cpp +++ /dev/null @@ -1,201 +0,0 @@ -// MultiStream.cpp - -#include "StdAfx.h" - -#include "MultiStream.h" - -STDMETHODIMP CMultiStream::Read(void *data, UInt32 size, UInt32 *processedSize) -{ - if(processedSize != NULL) - *processedSize = 0; - while(_streamIndex < Streams.Size() && size > 0) - { - CSubStreamInfo &s = Streams[_streamIndex]; - if (_pos == s.Size) - { - _streamIndex++; - _pos = 0; - continue; - } - RINOK(s.Stream->Seek(s.Pos + _pos, STREAM_SEEK_SET, 0)); - UInt32 sizeToRead = UInt32(MyMin((UInt64)size, s.Size - _pos)); - UInt32 realProcessed; - HRESULT result = s.Stream->Read(data, sizeToRead, &realProcessed); - data = (void *)((Byte *)data + realProcessed); - size -= realProcessed; - if(processedSize != NULL) - *processedSize += realProcessed; - _pos += realProcessed; - _seekPos += realProcessed; - RINOK(result); - break; - } - return S_OK; -} - -STDMETHODIMP CMultiStream::Seek(Int64 offset, UInt32 seekOrigin, - UInt64 *newPosition) -{ - UInt64 newPos; - switch(seekOrigin) - { - case STREAM_SEEK_SET: - newPos = offset; - break; - case STREAM_SEEK_CUR: - newPos = _seekPos + offset; - break; - case STREAM_SEEK_END: - newPos = _totalLength + offset; - break; - default: - return STG_E_INVALIDFUNCTION; - } - _seekPos = 0; - for (_streamIndex = 0; _streamIndex < Streams.Size(); _streamIndex++) - { - UInt64 size = Streams[_streamIndex].Size; - if (newPos < _seekPos + size) - { - _pos = newPos - _seekPos; - _seekPos += _pos; - if (newPosition != 0) - *newPosition = newPos; - return S_OK; - } - _seekPos += size; - } - if (newPos == _seekPos) - { - if (newPosition != 0) - *newPosition = newPos; - return S_OK; - } - return E_FAIL; -} - - -/* -class COutVolumeStream: - public ISequentialOutStream, - public CMyUnknownImp -{ - int _volIndex; - UInt64 _volSize; - UInt64 _curPos; - CMyComPtr _volumeStream; - COutArchive _archive; - CCRC _crc; - -public: - MY_UNKNOWN_IMP - - CFileItem _file; - CUpdateOptions _options; - CMyComPtr VolumeCallback; - void Init(IArchiveUpdateCallback2 *volumeCallback, - const UString &name) - { - _file.Name = name; - _file.IsStartPosDefined = true; - _file.StartPos = 0; - - VolumeCallback = volumeCallback; - _volIndex = 0; - _volSize = 0; - } - - HRESULT Flush(); - STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); -}; - -HRESULT COutVolumeStream::Flush() -{ - if (_volumeStream) - { - _file.UnPackSize = _curPos; - _file.FileCRC = _crc.GetDigest(); - RINOK(WriteVolumeHeader(_archive, _file, _options)); - _archive.Close(); - _volumeStream.Release(); - _file.StartPos += _file.UnPackSize; - } - return S_OK; -} -*/ - -/* -STDMETHODIMP COutMultiStream::Write(const void *data, UInt32 size, UInt32 *processedSize) -{ - if(processedSize != NULL) - *processedSize = 0; - while(size > 0) - { - if (_streamIndex >= Streams.Size()) - { - CSubStreamInfo subStream; - RINOK(VolumeCallback->GetVolumeSize(Streams.Size(), &subStream.Size)); - RINOK(VolumeCallback->GetVolumeStream(Streams.Size(), &subStream.Stream)); - subStream.Pos = 0; - Streams.Add(subStream); - continue; - } - CSubStreamInfo &subStream = Streams[_streamIndex]; - if (_offsetPos >= subStream.Size) - { - _offsetPos -= subStream.Size; - _streamIndex++; - continue; - } - if (_offsetPos != subStream.Pos) - { - CMyComPtr outStream; - RINOK(subStream.Stream.QueryInterface(IID_IOutStream, &outStream)); - RINOK(outStream->Seek(_offsetPos, STREAM_SEEK_SET, NULL)); - subStream.Pos = _offsetPos; - } - - UInt32 curSize = (UInt32)MyMin((UInt64)size, subStream.Size - subStream.Pos); - UInt32 realProcessed; - RINOK(subStream.Stream->Write(data, curSize, &realProcessed)); - data = (void *)((Byte *)data + realProcessed); - size -= realProcessed; - subStream.Pos += realProcessed; - _offsetPos += realProcessed; - _absPos += realProcessed; - if (_absPos > _length) - _length = _absPos; - if(processedSize != NULL) - *processedSize += realProcessed; - if (subStream.Pos == subStream.Size) - { - _streamIndex++; - _offsetPos = 0; - } - if (realProcessed != curSize && realProcessed == 0) - return E_FAIL; - } - return S_OK; -} - -STDMETHODIMP COutMultiStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition) -{ - if(seekOrigin >= 3) - return STG_E_INVALIDFUNCTION; - switch(seekOrigin) - { - case STREAM_SEEK_SET: - _absPos = offset; - break; - case STREAM_SEEK_CUR: - _absPos += offset; - break; - case STREAM_SEEK_END: - _absPos = _length + offset; - break; - } - _offsetPos = _absPos; - _streamIndex = 0; - return S_OK; -} -*/ diff --git a/7zip/Archive/Common/MultiStream.h b/7zip/Archive/Common/MultiStream.h deleted file mode 100755 index 5a7cc687..00000000 --- a/7zip/Archive/Common/MultiStream.h +++ /dev/null @@ -1,76 +0,0 @@ -// MultiStream.h - -#ifndef __MULTISTREAM_H -#define __MULTISTREAM_H - -#include "../../../Common/MyCom.h" -#include "../../../Common/Vector.h" -#include "../../Archive/IArchive.h" - -class CMultiStream: - public IInStream, - public CMyUnknownImp -{ - int _streamIndex; - UInt64 _pos; - UInt64 _seekPos; - UInt64 _totalLength; -public: - struct CSubStreamInfo - { - CMyComPtr Stream; - UInt64 Pos; - UInt64 Size; - }; - CObjectVector Streams; - void Init() - { - _streamIndex = 0; - _pos = 0; - _seekPos = 0; - _totalLength = 0; - for (int i = 0; i < Streams.Size(); i++) - _totalLength += Streams[i].Size; - } - - MY_UNKNOWN_IMP1(IInStream) - - STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); - STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition); -}; - -/* -class COutMultiStream: - public IOutStream, - public CMyUnknownImp -{ - int _streamIndex; // required stream - UInt64 _offsetPos; // offset from start of _streamIndex index - UInt64 _absPos; - UInt64 _length; - - struct CSubStreamInfo - { - CMyComPtr Stream; - UInt64 Size; - UInt64 Pos; - }; - CObjectVector Streams; -public: - CMyComPtr VolumeCallback; - void Init() - { - _streamIndex = 0; - _offsetPos = 0; - _absPos = 0; - _length = 0; - } - - MY_UNKNOWN_IMP1(IOutStream) - - STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); - STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition); -}; -*/ - -#endif diff --git a/7zip/Archive/Common/OutStreamWithCRC.cpp b/7zip/Archive/Common/OutStreamWithCRC.cpp deleted file mode 100755 index 7ac3f123..00000000 --- a/7zip/Archive/Common/OutStreamWithCRC.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// OutStreamWithCRC.cpp - -#include "StdAfx.h" - -#include "OutStreamWithCRC.h" - -STDMETHODIMP COutStreamWithCRC::Write(const void *data, UInt32 size, UInt32 *processedSize) -{ - UInt32 realProcessedSize; - HRESULT result; - if(!_stream) - { - realProcessedSize = size; - result = S_OK; - } - else - result = _stream->Write(data, size, &realProcessedSize); - if (_calculateCrc) - _crc.Update(data, realProcessedSize); - _size += realProcessedSize; - if(processedSize != NULL) - *processedSize = realProcessedSize; - return result; -} diff --git a/7zip/Archive/Common/OutStreamWithCRC.h b/7zip/Archive/Common/OutStreamWithCRC.h deleted file mode 100755 index 0feb542b..00000000 --- a/7zip/Archive/Common/OutStreamWithCRC.h +++ /dev/null @@ -1,37 +0,0 @@ -// OutStreamWithCRC.h - -#ifndef __OUTSTREAMWITHCRC_H -#define __OUTSTREAMWITHCRC_H - -#include "../../../Common/CRC.h" -#include "../../../Common/MyCom.h" -#include "../../IStream.h" - -class COutStreamWithCRC: - public ISequentialOutStream, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP - - STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); -private: - CMyComPtr _stream; - UInt64 _size; - CCRC _crc; - bool _calculateCrc; -public: - void SetStream(ISequentialOutStream *stream) { _stream = stream; } - void Init(bool calculateCrc = true) - { - _size = 0; - _calculateCrc = calculateCrc; - _crc.Init(); - } - void ReleaseStream() { _stream.Release(); } - UInt64 GetSize() const { return _size; } - UInt32 GetCRC() const { return _crc.GetDigest(); } - void InitCRC() { _crc.Init(); } -}; - -#endif diff --git a/7zip/Archive/Common/ParseProperties.cpp b/7zip/Archive/Common/ParseProperties.cpp deleted file mode 100755 index 9866d900..00000000 --- a/7zip/Archive/Common/ParseProperties.cpp +++ /dev/null @@ -1,171 +0,0 @@ -// ParseProperties.cpp - -#include "StdAfx.h" - -#include "ParseProperties.h" - -#include "Common/StringToInt.h" -#include "Common/MyCom.h" - -HRESULT ParsePropValue(const UString &name, const PROPVARIANT &prop, UInt32 &resValue) -{ - if (prop.vt == VT_UI4) - { - if (!name.IsEmpty()) - return E_INVALIDARG; - resValue = prop.ulVal; - } - else if (prop.vt == VT_EMPTY) - { - if(!name.IsEmpty()) - { - const wchar_t *start = name; - const wchar_t *end; - UInt64 v = ConvertStringToUInt64(start, &end); - if (end - start != name.Length()) - return E_INVALIDARG; - resValue = (UInt32)v; - } - } - else - return E_INVALIDARG; - return S_OK; -} - -static const int kLogarithmicSizeLimit = 32; -static const wchar_t kByteSymbol = L'B'; -static const wchar_t kKiloByteSymbol = L'K'; -static const wchar_t kMegaByteSymbol = L'M'; - -HRESULT ParsePropDictionaryValue(const UString &srcStringSpec, UInt32 &dicSize) -{ - UString srcString = srcStringSpec; - srcString.MakeUpper(); - - const wchar_t *start = srcString; - const wchar_t *end; - UInt64 number = ConvertStringToUInt64(start, &end); - int numDigits = (int)(end - start); - if (numDigits == 0 || srcString.Length() > numDigits + 1) - return E_INVALIDARG; - if (srcString.Length() == numDigits) - { - if (number >= kLogarithmicSizeLimit) - return E_INVALIDARG; - dicSize = (UInt32)1 << (int)number; - return S_OK; - } - switch (srcString[numDigits]) - { - case kByteSymbol: - if (number >= ((UInt64)1 << kLogarithmicSizeLimit)) - return E_INVALIDARG; - dicSize = (UInt32)number; - break; - case kKiloByteSymbol: - if (number >= ((UInt64)1 << (kLogarithmicSizeLimit - 10))) - return E_INVALIDARG; - dicSize = (UInt32)(number << 10); - break; - case kMegaByteSymbol: - if (number >= ((UInt64)1 << (kLogarithmicSizeLimit - 20))) - return E_INVALIDARG; - dicSize = (UInt32)(number << 20); - break; - default: - return E_INVALIDARG; - } - return S_OK; -} - -HRESULT ParsePropDictionaryValue(const UString &name, const PROPVARIANT &prop, UInt32 &resValue) -{ - if (name.IsEmpty()) - { - if (prop.vt == VT_UI4) - { - UInt32 logDicSize = prop.ulVal; - if (logDicSize >= 32) - return E_INVALIDARG; - resValue = (UInt32)1 << logDicSize; - return S_OK; - } - if (prop.vt == VT_BSTR) - return ParsePropDictionaryValue(prop.bstrVal, resValue); - return E_INVALIDARG; - } - return ParsePropDictionaryValue(name, resValue); -} - -HRESULT SetBoolProperty(bool &dest, const PROPVARIANT &value) -{ - switch(value.vt) - { - case VT_EMPTY: - dest = true; - break; - /* - case VT_UI4: - dest = (value.ulVal != 0); - break; - */ - case VT_BSTR: - { - UString valueString = value.bstrVal; - valueString.MakeUpper(); - if (valueString.Compare(L"ON") == 0) - dest = true; - else if (valueString.Compare(L"OFF") == 0) - dest = false; - else - return E_INVALIDARG; - break; - } - default: - return E_INVALIDARG; - } - return S_OK; -} - -int ParseStringToUInt32(const UString &srcString, UInt32 &number) -{ - const wchar_t *start = srcString; - const wchar_t *end; - UInt64 number64 = ConvertStringToUInt64(start, &end); - if (number64 > 0xFFFFFFFF) - { - number = 0; - return 0; - } - number = (UInt32)number64; - return (int)(end - start); -} - -HRESULT ParseMtProp(const UString &name, const PROPVARIANT &prop, UInt32 defaultNumThreads, UInt32 &numThreads) -{ - if (name.IsEmpty()) - { - switch(prop.vt) - { - case VT_UI4: - numThreads = prop.ulVal; - break; - default: - { - bool val; - RINOK(SetBoolProperty(val, prop)); - numThreads = (val ? defaultNumThreads : 1); - break; - } - } - } - else - { - UInt32 number; - int index = ParseStringToUInt32(name, number); - if (index != name.Length()) - return E_INVALIDARG; - numThreads = number; - } - return S_OK; -} diff --git a/7zip/Archive/Common/ParseProperties.h b/7zip/Archive/Common/ParseProperties.h deleted file mode 100755 index e6db316b..00000000 --- a/7zip/Archive/Common/ParseProperties.h +++ /dev/null @@ -1,17 +0,0 @@ -// ParseProperties.h - -#ifndef __PARSEPROPERTIES_H -#define __PARSEPROPERTIES_H - -#include "Common/String.h" -#include "Common/Types.h" - -HRESULT ParsePropValue(const UString &name, const PROPVARIANT &prop, UInt32 &resValue); -HRESULT ParsePropDictionaryValue(const UString &srcStringSpec, UInt32 &dicSize); -HRESULT ParsePropDictionaryValue(const UString &name, const PROPVARIANT &prop, UInt32 &resValue); - -HRESULT SetBoolProperty(bool &dest, const PROPVARIANT &value); -int ParseStringToUInt32(const UString &srcString, UInt32 &number); -HRESULT ParseMtProp(const UString &name, const PROPVARIANT &prop, UInt32 defaultNumThreads, UInt32 &numThreads); - -#endif diff --git a/7zip/Archive/Common/StdAfx.h b/7zip/Archive/Common/StdAfx.h deleted file mode 100755 index 2e4be10b..00000000 --- a/7zip/Archive/Common/StdAfx.h +++ /dev/null @@ -1,9 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" -#include "../../../Common/NewHandler.h" - -#endif diff --git a/7zip/Archive/Cpio/makefile b/7zip/Archive/Cpio/makefile deleted file mode 100755 index d7760281..00000000 --- a/7zip/Archive/Cpio/makefile +++ /dev/null @@ -1,55 +0,0 @@ -PROG = cpio.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib user32.lib - -CPIO_OBJS = \ - $O\DllExports.obj \ - $O\CpioHandler.obj \ - $O\CpioHeader.obj \ - $O\CpioIn.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\StringToInt.obj \ - $O\Vector.obj \ - -WIN_OBJS = \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\LimitedStreams.obj \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\ItemNameUtils.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(CPIO_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(COMPRESS_CPIO_OBJS) \ - $O\CopyCoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(CPIO_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) diff --git a/7zip/Archive/Deb/Deb.dsp b/7zip/Archive/Deb/Deb.dsp deleted file mode 100755 index 56689305..00000000 --- a/7zip/Archive/Deb/Deb.dsp +++ /dev/null @@ -1,269 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Deb" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Deb - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Deb.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Deb.mak" CFG="Deb - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Deb - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Deb - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Deb - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DEB_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DEB_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\deb.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Deb - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DEB_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DEB_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\deb.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Deb - Win32 Release" -# Name "Deb - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\Deb.ico -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\DebHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\DebHandler.h -# End Source File -# Begin Source File - -SOURCE=.\DebHeader.cpp -# End Source File -# Begin Source File - -SOURCE=.\DebHeader.h -# End Source File -# Begin Source File - -SOURCE=.\DebIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\DebIn.h -# End Source File -# Begin Source File - -SOURCE=.\DebItem.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.h -# End Source File -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# End Target -# End Project diff --git a/7zip/Archive/Deb/Deb.dsw b/7zip/Archive/Deb/Deb.dsw deleted file mode 100755 index c7169534..00000000 --- a/7zip/Archive/Deb/Deb.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Deb"=.\Deb.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Archive/Deb/DebHandler.cpp b/7zip/Archive/Deb/DebHandler.cpp deleted file mode 100755 index 8728cec8..00000000 --- a/7zip/Archive/Deb/DebHandler.cpp +++ /dev/null @@ -1,255 +0,0 @@ -// DebHandler.cpp - -#include "StdAfx.h" - -#include "DebHandler.h" -#include "DebIn.h" - -#include "Common/Defs.h" -#include "Common/StringConvert.h" -#include "Common/NewHandler.h" -#include "Common/ComTry.h" - -#include "Windows/Time.h" -#include "Windows/PropVariant.h" - -#include "../../Common/ProgressUtils.h" -#include "../../Common/LimitedStreams.h" - -#include "../../Compress/Copy/CopyCoder.h" - -#include "../Common/ItemNameUtils.h" - -using namespace NWindows; -using namespace NTime; - -namespace NArchive { -namespace NDeb { - -STATPROPSTG kProperties[] = -{ - { NULL, kpidPath, VT_BSTR}, - // { NULL, kpidIsFolder, VT_BOOL}, - { NULL, kpidSize, VT_UI8}, - { NULL, kpidPackedSize, VT_UI8}, - { NULL, kpidLastWriteTime, VT_FILETIME} -}; - -STDMETHODIMP CHandler::GetArchiveProperty(PROPID /* propID */, PROPVARIANT *value) -{ - value->vt = VT_EMPTY; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties) -{ - *numProperties = sizeof(kProperties) / sizeof(kProperties[0]); - return S_OK; -} - -STDMETHODIMP CHandler::GetPropertyInfo(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) -{ - if(index >= sizeof(kProperties) / sizeof(kProperties[0])) - return E_INVALIDARG; - const STATPROPSTG &srcItem = kProperties[index]; - *propID = srcItem.propid; - *varType = srcItem.vt; - *name = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) -{ - *numProperties = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetArchivePropertyInfo(UInt32 /* index */, - BSTR * /* name */, PROPID * /* propID */, VARTYPE * /* varType */) -{ - return E_INVALIDARG; -} - - -STDMETHODIMP CHandler::Open(IInStream *stream, - const UInt64 * /* maxCheckStartPosition */, - IArchiveOpenCallback *openArchiveCallback) -{ - COM_TRY_BEGIN - { - CInArchive archive; - if(archive.Open(stream) != S_OK) - return S_FALSE; - _items.Clear(); - - if (openArchiveCallback != NULL) - { - RINOK(openArchiveCallback->SetTotal(NULL, NULL)); - UInt64 numFiles = _items.Size(); - RINOK(openArchiveCallback->SetCompleted(&numFiles, NULL)); - } - - for (;;) - { - CItemEx itemInfo; - bool filled; - HRESULT result = archive.GetNextItem(filled, itemInfo); - if (result == S_FALSE) - return S_FALSE; - if (result != S_OK) - return S_FALSE; - if (!filled) - break; - _items.Add(itemInfo); - archive.SkeepData(itemInfo.Size); - if (openArchiveCallback != NULL) - { - UInt64 numFiles = _items.Size(); - RINOK(openArchiveCallback->SetCompleted(&numFiles, NULL)); - } - } - _inStream = stream; - } - return S_OK; - COM_TRY_END -} - -STDMETHODIMP CHandler::Close() -{ - _inStream.Release(); - _items.Clear(); - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems) -{ - *numItems = _items.Size(); - return S_OK; -} - -STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) -{ - COM_TRY_BEGIN - NWindows::NCOM::CPropVariant propVariant; - const CItemEx &item = _items[index]; - - switch(propID) - { - case kpidPath: - propVariant = (const wchar_t *)NItemName::GetOSName2( - MultiByteToUnicodeString(item.Name, CP_OEMCP)); - break; - case kpidIsFolder: - propVariant = false; - break; - case kpidSize: - case kpidPackedSize: - propVariant = item.Size; - break; - case kpidLastWriteTime: - { - FILETIME utcFileTime; - if (item.ModificationTime != 0) - NTime::UnixTimeToFileTime(item.ModificationTime, utcFileTime); - else - { - utcFileTime.dwLowDateTime = 0; - utcFileTime.dwHighDateTime = 0; - } - propVariant = utcFileTime; - break; - } - } - propVariant.Detach(value); - return S_OK; - COM_TRY_END -} - -STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, - Int32 _aTestMode, IArchiveExtractCallback *extractCallback) -{ - COM_TRY_BEGIN - bool allFilesMode = (numItems == UInt32(-1)); - if (allFilesMode) - numItems = _items.Size(); - if(numItems == 0) - return S_OK; - bool testMode = (_aTestMode != 0); - UInt64 totalSize = 0; - UInt32 i; - for(i = 0; i < numItems; i++) - totalSize += _items[allFilesMode ? i : indices[i]].Size; - extractCallback->SetTotal(totalSize); - - UInt64 currentTotalSize = 0; - UInt64 currentItemSize; - - CMyComPtr copyCoder; - - for(i = 0; i < numItems; i++, currentTotalSize += currentItemSize) - { - RINOK(extractCallback->SetCompleted(¤tTotalSize)); - CMyComPtr realOutStream; - Int32 askMode; - askMode = testMode ? NArchive::NExtract::NAskMode::kTest : - NArchive::NExtract::NAskMode::kExtract; - Int32 index = allFilesMode ? i : indices[i]; - const CItemEx &itemInfo = _items[index]; - - RINOK(extractCallback->GetStream(index, &realOutStream, askMode)); - - currentItemSize = itemInfo.Size; - - if(!testMode && (!realOutStream)) - { - continue; - } - RINOK(extractCallback->PrepareOperation(askMode)); - { - if (testMode) - { - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - continue; - } - - RINOK(_inStream->Seek(itemInfo.GetDataPosition(), STREAM_SEEK_SET, NULL)); - CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream; - CMyComPtr inStream(streamSpec); - streamSpec->SetStream(_inStream); - streamSpec->Init(itemInfo.Size); - - CLocalProgress *localProgressSpec = new CLocalProgress; - CMyComPtr progress = localProgressSpec; - localProgressSpec->Init(extractCallback, false); - - CLocalCompressProgressInfo *localCompressProgressSpec = - new CLocalCompressProgressInfo; - CMyComPtr compressProgress = localCompressProgressSpec; - localCompressProgressSpec->Init(progress, - ¤tTotalSize, ¤tTotalSize); - - if(copyCoder == NULL) - { - copyCoder = new NCompress::CCopyCoder; - } - try - { - RINOK(copyCoder->Code(inStream, realOutStream, - NULL, NULL, compressProgress)); - } - catch(...) - { - realOutStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kDataError)); - continue; - } - realOutStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - } - } - return S_OK; - COM_TRY_END -} - -}} diff --git a/7zip/Archive/Deb/DebHandler.h b/7zip/Archive/Deb/DebHandler.h deleted file mode 100755 index 47de0224..00000000 --- a/7zip/Archive/Deb/DebHandler.h +++ /dev/null @@ -1,47 +0,0 @@ -// DebHandler.h - -#ifndef __DEB_HANDLER_H -#define __DEB_HANDLER_H - -#include "Common/MyCom.h" -#include "../IArchive.h" - -#include "DebItem.h" - -namespace NArchive { -namespace NDeb { - -class CHandler: - public IInArchive, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP - - STDMETHOD(Open)(IInStream *stream, - const UInt64 *maxCheckStartPosition, - IArchiveOpenCallback *openArchiveCallback); - STDMETHOD(Close)(); - STDMETHOD(GetNumberOfItems)(UInt32 *numItems); - STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value); - STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems, - Int32 testMode, IArchiveExtractCallback *extractCallback); - - STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value); - - STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties); - STDMETHOD(GetPropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - - STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties); - STDMETHOD(GetArchivePropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - -private: - CObjectVector _items; - CMyComPtr _inStream; -}; - -}} - -#endif diff --git a/7zip/Archive/Deb/DebHeader.cpp b/7zip/Archive/Deb/DebHeader.cpp deleted file mode 100755 index dce00e1b..00000000 --- a/7zip/Archive/Deb/DebHeader.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// Archive/Deb/Header.h - -#include "StdAfx.h" - -#include "DebHeader.h" - -namespace NArchive { -namespace NDeb { -namespace NHeader { - -const char *kSignature = "!\n"; - -}}} diff --git a/7zip/Archive/Deb/DebHeader.h b/7zip/Archive/Deb/DebHeader.h deleted file mode 100755 index c2884000..00000000 --- a/7zip/Archive/Deb/DebHeader.h +++ /dev/null @@ -1,38 +0,0 @@ -// Archive/Deb/Header.h - -#ifndef __ARCHIVE_DEB_HEADER_H -#define __ARCHIVE_DEB_HEADER_H - -#include "Common/Types.h" - -namespace NArchive { -namespace NDeb { - -namespace NHeader -{ - const int kSignatureLen = 8; - extern const char *kSignature; - const int kNameSize = 16; - const int kTimeSize = 12; - const int kModeSize = 8; - const int kSizeSize = 10; - - /* - struct CHeader - { - char Name[kNameSize]; - char ModificationTime[kTimeSize]; - char Number0[6]; - char Number1[6]; - char Mode[kModeSize]; - char Size[kSizeSize]; - char Quote; - char NewLine; - }; - */ - const int kHeaderSize = kNameSize + kTimeSize + 6 + 6 + kModeSize + kSizeSize + 1 + 1; -} - -}} - -#endif diff --git a/7zip/Archive/Deb/DebIn.cpp b/7zip/Archive/Deb/DebIn.cpp deleted file mode 100755 index c2221d12..00000000 --- a/7zip/Archive/Deb/DebIn.cpp +++ /dev/null @@ -1,165 +0,0 @@ -// Archive/DebIn.cpp - -#include "StdAfx.h" - -#include "DebIn.h" -#include "DebHeader.h" - -#include "Common/StringToInt.h" -#include "Windows/Defs.h" - -#include "../../Common/StreamUtils.h" - -namespace NArchive { -namespace NDeb { - -using namespace NHeader; - -HRESULT CInArchive::ReadBytes(void *data, UInt32 size, UInt32 &processedSize) -{ - RINOK(ReadStream(m_Stream, data, size, &processedSize)); - m_Position += processedSize; - return S_OK; -} - -HRESULT CInArchive::Open(IInStream *inStream) -{ - RINOK(inStream->Seek(0, STREAM_SEEK_CUR, &m_Position)); - char signature[kSignatureLen]; - UInt32 processedSize; - RINOK(ReadStream(inStream, signature, kSignatureLen, &processedSize)); - m_Position += processedSize; - if (processedSize != kSignatureLen) - return S_FALSE; - if (memcmp(signature, kSignature, kSignatureLen) != 0) - return S_FALSE; - m_Stream = inStream; - return S_OK; -} - -static void MyStrNCpy(char *dest, const char *src, int size) -{ - for (int i = 0; i < size; i++) - { - char c = src[i]; - dest[i] = c; - if (c == 0) - break; - } -} - -static bool OctalToNumber(const char *s, int size, UInt64 &res) -{ - char sz[32]; - MyStrNCpy(sz, s, size); - sz[size] = 0; - const char *end; - int i; - for (i = 0; sz[i] == ' '; i++); - res = ConvertOctStringToUInt64(sz + i, &end); - return (*end == ' ' || *end == 0); -} - -static bool OctalToNumber32(const char *s, int size, UInt32 &res) -{ - UInt64 res64; - if (!OctalToNumber(s, size, res64)) - return false; - res = (UInt32)res64; - return (res64 <= 0xFFFFFFFF); -} - -static bool DecimalToNumber(const char *s, int size, UInt64 &res) -{ - char sz[32]; - MyStrNCpy(sz, s, size); - sz[size] = 0; - const char *end; - int i; - for (i = 0; sz[i] == ' '; i++); - res = ConvertStringToUInt64(sz + i, &end); - return (*end == ' ' || *end == 0); -} - -static bool DecimalToNumber32(const char *s, int size, UInt32 &res) -{ - UInt64 res64; - if (!DecimalToNumber(s, size, res64)) - return false; - res = (UInt32)res64; - return (res64 <= 0xFFFFFFFF); -} - -#define RIF(x) { if (!(x)) return S_FALSE; } - - -HRESULT CInArchive::GetNextItemReal(bool &filled, CItemEx &item) -{ - filled = false; - - char header[NHeader::kHeaderSize]; - const char *cur = header; - - UInt32 processedSize; - item.HeaderPosition = m_Position; - RINOK(ReadBytes(header, sizeof(header), processedSize)); - if (processedSize < sizeof(header)) - return S_OK; - - char tempString[kNameSize + 1]; - MyStrNCpy(tempString, cur, kNameSize); - cur += kNameSize; - tempString[kNameSize] = '\0'; - item.Name = tempString; - item.Name.Trim(); - - for (int i = 0; i < item.Name.Length(); i++) - if (((Byte)item.Name[i]) < 0x20) - return S_FALSE; - - RIF(DecimalToNumber32(cur, kTimeSize, item.ModificationTime)); - cur += kTimeSize; - - cur += 6 + 6; - - RIF(OctalToNumber32(cur, kModeSize, item.Mode)); - cur += kModeSize; - - RIF(DecimalToNumber(cur, kSizeSize, item.Size)); - cur += kSizeSize; - - filled = true; - return S_OK; -} - -HRESULT CInArchive::GetNextItem(bool &filled, CItemEx &item) -{ - for (;;) - { - RINOK(GetNextItemReal(filled, item)); - if (!filled) - return S_OK; - if (item.Name.CompareNoCase("debian-binary") != 0) - return S_OK; - if (item.Size != 4) - return S_OK; - SkeepData(item.Size); - } -} - -HRESULT CInArchive::Skeep(UInt64 numBytes) -{ - UInt64 newPostion; - RINOK(m_Stream->Seek(numBytes, STREAM_SEEK_CUR, &newPostion)); - m_Position += numBytes; - if (m_Position != newPostion) - return E_FAIL; - return S_OK; -} - -HRESULT CInArchive::SkeepData(UInt64 dataSize) -{ - return Skeep((dataSize + 1) & (~((UInt64)0x1))); -} - -}} diff --git a/7zip/Archive/Deb/DebIn.h b/7zip/Archive/Deb/DebIn.h deleted file mode 100755 index c1b72b6e..00000000 --- a/7zip/Archive/Deb/DebIn.h +++ /dev/null @@ -1,29 +0,0 @@ -// Archive/DebIn.h - -#ifndef __ARCHIVE_DEB_IN_H -#define __ARCHIVE_DEB_IN_H - -#include "Common/MyCom.h" -#include "../../IStream.h" -#include "DebItem.h" - -namespace NArchive { -namespace NDeb { - -class CInArchive -{ - CMyComPtr m_Stream; - UInt64 m_Position; - - HRESULT ReadBytes(void *data, UInt32 size, UInt32 &processedSize); - HRESULT GetNextItemReal(bool &filled, CItemEx &itemInfo); - HRESULT Skeep(UInt64 numBytes); -public: - HRESULT Open(IInStream *inStream); - HRESULT GetNextItem(bool &filled, CItemEx &itemInfo); - HRESULT SkeepData(UInt64 dataSize); -}; - -}} - -#endif diff --git a/7zip/Archive/Deb/DebItem.h b/7zip/Archive/Deb/DebItem.h deleted file mode 100755 index f587f3f5..00000000 --- a/7zip/Archive/Deb/DebItem.h +++ /dev/null @@ -1,32 +0,0 @@ -// Archive/Deb/ItemInfo.h - -#ifndef __ARCHIVE_DEB_ITEMINFO_H -#define __ARCHIVE_DEB_ITEMINFO_H - -#include "Common/Types.h" -#include "Common/String.h" -#include "DebHeader.h" - -namespace NArchive { -namespace NDeb { - -class CItem -{ -public: - AString Name; - UInt64 Size; - UInt32 ModificationTime; - UInt32 Mode; -}; - -class CItemEx: public CItem -{ -public: - UInt64 HeaderPosition; - UInt64 GetDataPosition() const { return HeaderPosition + NHeader::kHeaderSize; }; - // UInt64 GetFullSize() const { return NFileHeader::kRecordSize + Size; }; -}; - -}} - -#endif diff --git a/7zip/Archive/Deb/DllExports.cpp b/7zip/Archive/Deb/DllExports.cpp deleted file mode 100755 index fe320531..00000000 --- a/7zip/Archive/Deb/DllExports.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "DebHandler.h" -#include "../../ICoder.h" - -// {23170F69-40C1-278A-1000-000110EC0000} -DEFINE_GUID(CLSID_CDebHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0xEC, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /*lpReserved*/) -{ - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CDebHandler) - return CLASS_E_CLASSNOTAVAILABLE; - if (*interfaceID != IID_IInArchive) - return E_NOINTERFACE; - CMyComPtr inArchive = (IInArchive *)new NArchive::NDeb::CHandler; - *outObject = inArchive.Detach(); - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Deb"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CDebHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"deb"; - break; - case NArchive::kUpdate: - propVariant = false; - break; - case NArchive::kKeepName: - propVariant = false; - break; - case NArchive::kStartSignature: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)NArchive::NDeb::NHeader::kSignature, - NArchive::NDeb::NHeader::kSignatureLen)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - } - propVariant.Detach(value); - return S_OK; -} diff --git a/7zip/Archive/Deb/StdAfx.cpp b/7zip/Archive/Deb/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Archive/Deb/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Archive/Deb/StdAfx.h b/7zip/Archive/Deb/StdAfx.h deleted file mode 100755 index e7fb6986..00000000 --- a/7zip/Archive/Deb/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Archive/Deb/deb.ico b/7zip/Archive/Deb/deb.ico deleted file mode 100755 index 97a08654..00000000 Binary files a/7zip/Archive/Deb/deb.ico and /dev/null differ diff --git a/7zip/Archive/Deb/makefile b/7zip/Archive/Deb/makefile deleted file mode 100755 index a74f33de..00000000 --- a/7zip/Archive/Deb/makefile +++ /dev/null @@ -1,54 +0,0 @@ -PROG = deb.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib user32.lib - -DEB_OBJS = \ - $O\DllExports.obj \ - $O\DebHandler.obj \ - $O\DebHeader.obj \ - $O\DebIn.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\StringToInt.obj \ - $O\Vector.obj \ - -WIN_OBJS = \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\LimitedStreams.obj \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\ItemNameUtils.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(DEB_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $O\CopyCoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(DEB_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) diff --git a/7zip/Archive/Deb/resource.rc b/7zip/Archive/Deb/resource.rc deleted file mode 100755 index a80edced..00000000 --- a/7zip/Archive/Deb/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Deb Plugin", "deb") - -101 ICON "deb.ico" diff --git a/7zip/Archive/GZip/DllExports.cpp b/7zip/Archive/GZip/DllExports.cpp deleted file mode 100755 index 3bddcfb9..00000000 --- a/7zip/Archive/GZip/DllExports.cpp +++ /dev/null @@ -1,125 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "../../ICoder.h" -#include "GZipHandler.h" - -// {23170F69-40C1-278A-1000-000110EF0000} -DEFINE_GUID(CLSID_CGZipHandler, -0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0xEF, 0x00, 0x00); - -// {23170F69-40C1-278B-0401-080000000100} -DEFINE_GUID(CLSID_CCompressDeflateEncoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00); - -// {23170F69-40C1-278B-0401-080000000000} -DEFINE_GUID(CLSID_CCompressDeflateDecoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00); - -HINSTANCE g_hInstance; -#ifndef _UNICODE -bool g_IsNT = false; -static bool IsItWindowsNT() -{ - OSVERSIONINFO versionInfo; - versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); - if (!::GetVersionEx(&versionInfo)) - return false; - return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT); -} -#endif - -#ifndef COMPRESS_DEFLATE -#include "../Common/CodecsPath.h" -CSysString GetDeflateCodecPath() -{ - return GetCodecsFolderPrefix() + TEXT("Deflate.dll"); -} -#endif - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - if (dwReason == DLL_PROCESS_ATTACH) - { - g_hInstance = hInstance; - #ifndef _UNICODE - g_IsNT = IsItWindowsNT(); - #endif - } - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CGZipHandler) - return CLASS_E_CLASSNOTAVAILABLE; - int needIn = *interfaceID == IID_IInArchive; - int needOut = *interfaceID == IID_IOutArchive; - if (needIn || needOut) - { - NArchive::NGZip::CHandler *temp = new NArchive::NGZip::CHandler; - if (needIn) - { - CMyComPtr inArchive = (IInArchive *)temp; - *outObject = inArchive.Detach(); - } - else - { - CMyComPtr outArchive = (IOutArchive *)temp; - *outObject = outArchive.Detach(); - } - } - else - return E_NOINTERFACE; - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"GZip"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CGZipHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"gz gzip tgz tpz"; - break; - case NArchive::kAddExtension: - propVariant = L"* * .tar .tar"; - break; - case NArchive::kUpdate: - propVariant = true; - break; - case NArchive::kKeepName: - propVariant = true; - break; - case NArchive::kStartSignature: - { - const unsigned char sig[] = { 0x1F, 0x8B }; - if ((value->bstrVal = ::SysAllocStringByteLen((const char *)sig, 2)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - } - propVariant.Detach(value); - return S_OK; -} diff --git a/7zip/Archive/GZip/GZip.dsp b/7zip/Archive/GZip/GZip.dsp deleted file mode 100755 index 3af06b46..00000000 --- a/7zip/Archive/GZip/GZip.dsp +++ /dev/null @@ -1,321 +0,0 @@ -# Microsoft Developer Studio Project File - Name="GZip" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=GZip - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "GZip.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "GZip.mak" CFG="GZip - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "GZip - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "GZip - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "GZip - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GZIP_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GZIP_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\gz.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "GZip - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GZIP_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GZIP_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\gz.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "GZip - Win32 Release" -# Name "GZip - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\GZip.ico -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Compression" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\GZipHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\GZipHandler.h -# End Source File -# Begin Source File - -SOURCE=.\GZipHandlerOut.cpp -# End Source File -# Begin Source File - -SOURCE=.\GZipHeader.cpp -# End Source File -# Begin Source File - -SOURCE=.\GZipHeader.h -# End Source File -# Begin Source File - -SOURCE=.\GZipIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\GZipIn.h -# End Source File -# Begin Source File - -SOURCE=.\GZipItem.h -# End Source File -# Begin Source File - -SOURCE=.\GZipOut.cpp -# End Source File -# Begin Source File - -SOURCE=.\GZipOut.h -# End Source File -# Begin Source File - -SOURCE=.\GZipUpdate.cpp -# End Source File -# Begin Source File - -SOURCE=.\GZipUpdate.h -# End Source File -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\CodecsPath.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\CodecsPath.h -# End Source File -# Begin Source File - -SOURCE=..\Common\CoderLoader.h -# End Source File -# Begin Source File - -SOURCE=..\Common\InStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\InStreamWithCRC.h -# End Source File -# Begin Source File - -SOURCE=..\Common\OutStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\OutStreamWithCRC.h -# End Source File -# Begin Source File - -SOURCE=..\Common\ParseProperties.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ParseProperties.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\gz.ico -# End Source File -# End Target -# End Project diff --git a/7zip/Archive/GZip/GZip.dsw b/7zip/Archive/GZip/GZip.dsw deleted file mode 100755 index 5ff50d2c..00000000 --- a/7zip/Archive/GZip/GZip.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "GZip"=.\GZip.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Archive/GZip/GZipHandler.cpp b/7zip/Archive/GZip/GZipHandler.cpp deleted file mode 100755 index ff592324..00000000 --- a/7zip/Archive/GZip/GZipHandler.cpp +++ /dev/null @@ -1,361 +0,0 @@ -// GZipHandler.cpp - -#include "StdAfx.h" - -#include "GZipHandler.h" - -#include "Common/Defs.h" -#include "Common/CRC.h" -#include "Common/StringConvert.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "Windows/Time.h" - -#include "../../ICoder.h" -#include "../../Common/ProgressUtils.h" -#include "../Common/OutStreamWithCRC.h" - -#ifdef COMPRESS_DEFLATE -#include "../../Compress/Deflate/DeflateDecoder.h" -#else -// {23170F69-40C1-278B-0401-080000000000} -DEFINE_GUID(CLSID_CCompressDeflateDecoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00); -#include "../Common/CoderLoader.h" -extern CSysString GetDeflateCodecPath(); -#endif - -using namespace NWindows; - -namespace NArchive { -namespace NGZip { - -const wchar_t *kHostOS[] = -{ - L"FAT", - L"AMIGA", - L"VMS", - L"Unix", - L"VM_CMS", - L"Atari", // what if it's a minix filesystem? [cjh] - L"HPFS", // filesystem used by OS/2 (and NT 3.x) - L"Mac", - L"Z_System", - L"CPM", - L"TOPS20", // pkzip 2.50 NTFS - L"NTFS", // filesystem used by Windows NT - L"QDOS ", // SMS/QDOS - L"Acorn", // Archimedes Acorn RISC OS - L"VFAT", // filesystem used by Windows 95, NT - L"MVS", - L"BeOS", // hybrid POSIX/database filesystem - // BeBOX or PowerMac - L"Tandem", - L"THEOS" -}; - -static const int kNumHostOSes = sizeof(kHostOS) / sizeof(kHostOS[0]); - -static const wchar_t *kUnknownOS = L"Unknown"; - -/* -enum // PropID -{ - kpidExtraIsPresent = kpidUserDefined, - kpidExtraFlags, - kpidIsText -}; -*/ - -STATPROPSTG kProperties[] = -{ - { NULL, kpidPath, VT_BSTR}, - // { NULL, kpidIsFolder, VT_BOOL}, - { NULL, kpidSize, VT_UI8}, - { NULL, kpidPackedSize, VT_UI8}, - - { NULL, kpidLastWriteTime, VT_FILETIME}, - // { NULL, kpidCommented, VT_BOOL}, - // { NULL, kpidMethod, VT_UI1}, - { NULL, kpidHostOS, VT_BSTR}, - - { NULL, kpidCRC, VT_UI4} - // { L"Extra", kpidExtraIsPresent, VT_BOOL} - // { L"Extra flags", kpidExtraFlags, VT_UI1}, - // { L"Is Text", kpidIsText, VT_BOOL}, -}; - -STDMETHODIMP CHandler::GetArchiveProperty(PROPID /* propID */, PROPVARIANT *value) -{ - value->vt = VT_EMPTY; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties) -{ - *numProperties = sizeof(kProperties) / sizeof(kProperties[0]); - return S_OK; -} - -STDMETHODIMP CHandler::GetPropertyInfo(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) -{ - const STATPROPSTG &prop = kProperties[index]; - *propID = prop.propid; - *varType = prop.vt; - *name = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) -{ - *numProperties = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetArchivePropertyInfo(UInt32 /* index */, - BSTR * /* name */, PROPID * /* propID */, VARTYPE * /* varType */) -{ - return E_NOTIMPL; -} - -STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems) -{ - *numItems = 1; - return S_OK; -} - -STDMETHODIMP CHandler::GetProperty(UInt32 /* index */, PROPID propID, PROPVARIANT *value) -{ - COM_TRY_BEGIN - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case kpidPath: - if (m_Item.NameIsPresent()) - propVariant = MultiByteToUnicodeString(m_Item.Name, CP_ACP); - break; - case kpidIsFolder: - propVariant = false; - break; - case kpidLastWriteTime: - { - FILETIME utcTime; - if (m_Item.Time != 0) - { - NTime::UnixTimeToFileTime((UInt32)m_Item.Time, utcTime); - propVariant = utcTime; - } - else - { - // utcTime.dwLowDateTime = utcTime.dwHighDateTime = 0; - // propVariant = utcTime; - } - break; - } - case kpidSize: - propVariant = UInt64(m_Item.UnPackSize32); - break; - case kpidPackedSize: - propVariant = m_PackSize; - break; - case kpidCommented: - propVariant = m_Item.CommentIsPresent(); - break; - case kpidHostOS: - propVariant = (m_Item.HostOS < kNumHostOSes) ? - kHostOS[m_Item.HostOS] : kUnknownOS; - break; - case kpidMethod: - propVariant = m_Item.CompressionMethod; - break; - case kpidCRC: - propVariant = m_Item.FileCRC; - break; - /* - case kpidExtraFlags: - propVariant = m_Item.ExtraFlags; - break; - case kpidIsText: - propVariant = m_Item.IsText(); - break; - case kpidExtraIsPresent: - propVariant = m_Item.ExtraFieldIsPresent(); - break; - */ - } - propVariant.Detach(value); - return S_OK; - COM_TRY_END -} - -STDMETHODIMP CHandler::Open(IInStream *inStream, - const UInt64 * /* maxCheckStartPosition */, - IArchiveOpenCallback * /* openArchiveCallback */) -{ - COM_TRY_BEGIN - try - { - CInArchive archive; - RINOK(inStream->Seek(0, STREAM_SEEK_CUR, &m_StreamStartPosition)); - RINOK(archive.ReadHeader(inStream, m_Item)); - m_DataOffset = archive.GetOffset(); - UInt64 newPosition; - RINOK(inStream->Seek(-8, STREAM_SEEK_END, &newPosition)); - m_PackSize = newPosition - (m_StreamStartPosition + m_DataOffset); - if (archive.ReadPostHeader(inStream, m_Item) != S_OK) - return S_FALSE; - m_Stream = inStream; - } - catch(...) - { - return S_FALSE; - } - return S_OK; - COM_TRY_END -} - -STDMETHODIMP CHandler::Close() -{ - m_Stream.Release(); - return S_OK; -} - -STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, - Int32 _aTestMode, IArchiveExtractCallback *extractCallback) -{ - COM_TRY_BEGIN - bool allFilesMode = (numItems == UInt32(-1)); - if (!allFilesMode) - { - if (numItems == 0) - return S_OK; - if (numItems != 1) - return E_INVALIDARG; - if (indices[0] != 0) - return E_INVALIDARG; - } - - bool testMode = (_aTestMode != 0); - - extractCallback->SetTotal(m_PackSize); - - UInt64 currentTotalUnPacked = 0, currentTotalPacked = 0; - - RINOK(extractCallback->SetCompleted(¤tTotalPacked)); - CMyComPtr realOutStream; - Int32 askMode; - askMode = testMode ? NArchive::NExtract::NAskMode::kTest : - NArchive::NExtract::NAskMode::kExtract; - - RINOK(extractCallback->GetStream(0, &realOutStream, askMode)); - - if(!testMode && !realOutStream) - return S_OK; - - extractCallback->PrepareOperation(askMode); - - COutStreamWithCRC *outStreamSpec = new COutStreamWithCRC; - CMyComPtr outStream(outStreamSpec); - outStreamSpec->SetStream(realOutStream); - outStreamSpec->Init(); - realOutStream.Release(); - - CLocalProgress *localProgressSpec = new CLocalProgress; - CMyComPtr progress = localProgressSpec; - localProgressSpec->Init(extractCallback, true); - - CLocalCompressProgressInfo *localCompressProgressSpec = - new CLocalCompressProgressInfo; - CMyComPtr compressProgress = localCompressProgressSpec; - - #ifndef COMPRESS_DEFLATE - CCoderLibrary lib; - #endif - CMyComPtr deflateDecoder; - bool firstItem = true; - RINOK(m_Stream->Seek(m_StreamStartPosition, STREAM_SEEK_SET, NULL)); - for (;;) - { - localCompressProgressSpec->Init(progress, - ¤tTotalPacked, - ¤tTotalUnPacked); - - CInArchive archive; - CItem item; - HRESULT result = archive.ReadHeader(m_Stream, item); - if (result != S_OK) - { - if (firstItem) - return E_FAIL; - outStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)) - return S_OK; - } - firstItem = false; - - UInt64 dataStartPos; - RINOK(m_Stream->Seek(0, STREAM_SEEK_CUR, &dataStartPos)); - - outStreamSpec->InitCRC(); - - switch(item.CompressionMethod) - { - case NFileHeader::NCompressionMethod::kDeflate: - { - if(!deflateDecoder) - { - #ifdef COMPRESS_DEFLATE - deflateDecoder = new NCompress::NDeflate::NDecoder::CCOMCoder; - #else - RINOK(lib.LoadAndCreateCoder(GetDeflateCodecPath(), - CLSID_CCompressDeflateDecoder, &deflateDecoder)); - #endif - } - try - { - HRESULT result = deflateDecoder->Code(m_Stream, outStream, NULL, NULL, compressProgress); - if (result == S_FALSE) - throw "data error"; - if (result != S_OK) - return result; - } - catch(...) - { - outStream.Release(); - RINOK(extractCallback->SetOperationResult( - NArchive::NExtract::NOperationResult::kDataError)); - return S_OK; - } - break; - } - default: - outStream.Release(); - RINOK(extractCallback->SetOperationResult( - NArchive::NExtract::NOperationResult::kUnSupportedMethod)); - return S_OK; - } - CMyComPtr getInStreamProcessedSize; - RINOK(deflateDecoder.QueryInterface(IID_ICompressGetInStreamProcessedSize, - &getInStreamProcessedSize)); - UInt64 packSize; - RINOK(getInStreamProcessedSize->GetInStreamProcessedSize(&packSize)); - UInt64 pos; - RINOK(m_Stream->Seek(dataStartPos + packSize, STREAM_SEEK_SET, &pos)); - - currentTotalPacked = pos - m_StreamStartPosition; - - CItem postItem; - if (archive.ReadPostHeader(m_Stream, postItem) != S_OK) - return E_FAIL; - if((outStreamSpec->GetCRC() != postItem.FileCRC)) - { - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kCRCError)) - break; - } - } - COM_TRY_END - return S_OK; -} - -}} diff --git a/7zip/Archive/GZip/GZipHandler.h b/7zip/Archive/GZip/GZipHandler.h deleted file mode 100755 index 9af7e4a4..00000000 --- a/7zip/Archive/GZip/GZipHandler.h +++ /dev/null @@ -1,79 +0,0 @@ -// GZip/Handler.h - -#ifndef __GZIP_HANDLER_H -#define __GZIP_HANDLER_H - -#include "Common/MyCom.h" - -#include "../IArchive.h" - -#include "GZipIn.h" -#include "GZipUpdate.h" - -namespace NArchive { -namespace NGZip { - -class CHandler: - public IInArchive, - public IOutArchive, - public ISetProperties, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP3( - IInArchive, - IOutArchive, - ISetProperties) - - STDMETHOD(Open)(IInStream *inStream, - const UInt64 *maxCheckStartPosition, - IArchiveOpenCallback *openArchiveCallback); - STDMETHOD(Close)(); - - STDMETHOD(GetNumberOfItems)(UInt32 *numItems); - STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value); - STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems, - Int32 testMode, IArchiveExtractCallback *extractCallback); - - STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value); - - STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties); - STDMETHOD(GetPropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - - STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties); - STDMETHOD(GetArchivePropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - - // IOutArchive - - STDMETHOD(UpdateItems)(ISequentialOutStream *outStream, UInt32 numItems, - IArchiveUpdateCallback *updateCallback); - - STDMETHOD(GetFileTimeType)(UInt32 *timeType); - - // ISetProperties - STDMETHOD(SetProperties)(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties); - -public: - CHandler() { InitMethodProperties(); } - -private: - NArchive::NGZip::CItem m_Item; - UInt64 m_StreamStartPosition; - UInt64 m_DataOffset; - UInt64 m_PackSize; - CMyComPtr m_Stream; - CCompressionMethodMode m_Method; - UInt32 m_Level; - - void InitMethodProperties() - { - m_Method.NumMatchFinderCyclesDefined = false; - m_Level = m_Method.NumPasses = m_Method.NumFastBytes = m_Method.NumMatchFinderCycles = 0xFFFFFFFF; - } -}; - -}} - -#endif diff --git a/7zip/Archive/GZip/GZipHandlerOut.cpp b/7zip/Archive/GZip/GZipHandlerOut.cpp deleted file mode 100755 index cc896016..00000000 --- a/7zip/Archive/GZip/GZipHandlerOut.cpp +++ /dev/null @@ -1,200 +0,0 @@ -// Archive/GZip/OutHandler.cpp - -#include "StdAfx.h" - -#include "GZipHandler.h" -#include "GZipUpdate.h" - -#include "Common/StringConvert.h" -#include "Common/StringToInt.h" - -#include "Windows/Time.h" -#include "Windows/FileFind.h" -#include "Windows/PropVariant.h" - -#include "../../Compress/Copy/CopyCoder.h" -#include "../Common/ParseProperties.h" - -using namespace NWindows; -using namespace NTime; - -namespace NArchive { -namespace NGZip { - -static const UInt32 kNumPassesX1 = 1; -static const UInt32 kNumPassesX7 = 3; -static const UInt32 kNumPassesX9 = 10; - -static const UInt32 kNumFastBytesX1 = 32; -static const UInt32 kNumFastBytesX7 = 64; -static const UInt32 kNumFastBytesX9 = 128; - - -STDMETHODIMP CHandler::GetFileTimeType(UInt32 *timeType) -{ - *timeType = NFileTimeType::kUnix; - return S_OK; -} - -static HRESULT CopyStreams(ISequentialInStream *inStream, ISequentialOutStream *outStream) -{ - CMyComPtr copyCoder = new NCompress::CCopyCoder; - return copyCoder->Code(inStream, outStream, NULL, NULL, NULL); -} - -STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numItems, - IArchiveUpdateCallback *updateCallback) -{ - if (numItems != 1) - return E_INVALIDARG; - - UInt64 size; - Int32 newData; - Int32 newProperties; - UInt32 indexInArchive; - UInt32 itemIndex = 0; - if (!updateCallback) - return E_FAIL; - RINOK(updateCallback->GetUpdateItemInfo(0, &newData, &newProperties, &indexInArchive)); - - CItem newItem = m_Item; - newItem.ExtraFlags = 0; - newItem.Flags = 0; - if (IntToBool(newProperties)) - { - UInt32 attributes; - FILETIME utcTime; - UString name; - bool isDirectory; - { - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(itemIndex, kpidAttributes, &propVariant)); - if (propVariant.vt == VT_EMPTY) - attributes = 0; - else if (propVariant.vt != VT_UI4) - return E_INVALIDARG; - else - attributes = propVariant.ulVal; - } - { - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(itemIndex, kpidLastWriteTime, &propVariant)); - if (propVariant.vt != VT_FILETIME) - return E_INVALIDARG; - utcTime = propVariant.filetime; - } - { - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(itemIndex, kpidPath, &propVariant)); - if (propVariant.vt == VT_EMPTY) - name.Empty(); - else if (propVariant.vt != VT_BSTR) - return E_INVALIDARG; - else - name = propVariant.bstrVal; - } - { - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(itemIndex, kpidIsFolder, &propVariant)); - if (propVariant.vt == VT_EMPTY) - isDirectory = false; - else if (propVariant.vt != VT_BOOL) - return E_INVALIDARG; - else - isDirectory = (propVariant.boolVal != VARIANT_FALSE); - } - if (isDirectory || NFile::NFind::NAttributes::IsDirectory(attributes)) - return E_INVALIDARG; - if(!FileTimeToUnixTime(utcTime, newItem.Time)) - return E_INVALIDARG; - newItem.Name = UnicodeStringToMultiByte(name, CP_ACP); - int dirDelimiterPos = newItem.Name.ReverseFind(CHAR_PATH_SEPARATOR); - if (dirDelimiterPos >= 0) - newItem.Name = newItem.Name.Mid(dirDelimiterPos + 1); - - newItem.SetNameIsPresentFlag(!newItem.Name.IsEmpty()); - } - - if (IntToBool(newData)) - { - { - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(itemIndex, kpidSize, &propVariant)); - if (propVariant.vt != VT_UI8) - return E_INVALIDARG; - size = propVariant.uhVal.QuadPart; - } - newItem.UnPackSize32 = (UInt32)size; - - UInt32 level = m_Level; - if (level == 0xFFFFFFFF) - level = 5; - if (m_Method.NumPasses == 0xFFFFFFFF) - m_Method.NumPasses = (level >= 9 ? kNumPassesX9 : - (level >= 7 ? kNumPassesX7 : - kNumPassesX1)); - if (m_Method.NumFastBytes == 0xFFFFFFFF) - m_Method.NumFastBytes = (level >= 9 ? kNumFastBytesX9 : - (level >= 7 ? kNumFastBytesX7 : - kNumFastBytesX1)); - - return UpdateArchive(m_Stream, size, outStream, newItem, m_Method, itemIndex, updateCallback); - } - - if (indexInArchive != 0) - return E_INVALIDARG; - - if (IntToBool(newProperties)) - { - COutArchive outArchive; - outArchive.Create(outStream); - outArchive.WriteHeader(newItem); - RINOK(m_Stream->Seek(m_StreamStartPosition + m_DataOffset, STREAM_SEEK_SET, NULL)); - } - else - { - RINOK(m_Stream->Seek(m_StreamStartPosition, STREAM_SEEK_SET, NULL)); - } - return CopyStreams(m_Stream, outStream); -} - -STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties) -{ - InitMethodProperties(); - for (int i = 0; i < numProperties; i++) - { - UString name = names[i]; - name.MakeUpper(); - const PROPVARIANT &prop = values[i]; - if (name[0] == L'X') - { - UInt32 level = 9; - RINOK(ParsePropValue(name.Mid(1), prop, level)); - m_Level = level; - } - else if (name.Left(4) == L"PASS") - { - UInt32 num = kNumPassesX9; - RINOK(ParsePropValue(name.Mid(4), prop, num)); - m_Method.NumPasses = num; - } - else if (name.Left(2) == L"FB") - { - UInt32 num = kNumFastBytesX9; - RINOK(ParsePropValue(name.Mid(2), prop, num)); - m_Method.NumFastBytes = num; - } - else if (name.Left(2) == L"MC") - { - UInt32 num = 0xFFFFFFFF; - RINOK(ParsePropValue(name.Mid(2), prop, num)); - m_Method.NumMatchFinderCycles = num; - m_Method.NumMatchFinderCyclesDefined = true; - } - else - return E_INVALIDARG; - } - return S_OK; -} - -}} diff --git a/7zip/Archive/GZip/GZipHeader.cpp b/7zip/Archive/GZip/GZipHeader.cpp deleted file mode 100755 index 5e697fa9..00000000 --- a/7zip/Archive/GZip/GZipHeader.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// Archive/GZip/Header.h - -#include "StdAfx.h" - -#include "GZipHeader.h" - -namespace NArchive { -namespace NGZip { - -extern UInt16 kSignature = 0x8B1F + 1; - -static class CMarkersInitializer -{ -public: - CMarkersInitializer() - { kSignature--; } -} g_MarkerInitializer; - -}} - diff --git a/7zip/Archive/GZip/GZipHeader.h b/7zip/Archive/GZip/GZipHeader.h deleted file mode 100755 index e83548eb..00000000 --- a/7zip/Archive/GZip/GZipHeader.h +++ /dev/null @@ -1,85 +0,0 @@ -// Archive/GZip/Header.h - -#ifndef __ARCHIVE_GZIP_HEADER_H -#define __ARCHIVE_GZIP_HEADER_H - -#include "Common/Types.h" - -namespace NArchive { -namespace NGZip { - -extern UInt16 kSignature; -static const UInt32 kSignatureSize = 2; - -namespace NFileHeader -{ - /* - struct CBlock - { - UInt16 Id; - Byte CompressionMethod; - Byte Flags; - UInt32 Time; - Byte ExtraFlags; - Byte HostOS; - }; - */ - - namespace NFlags - { - const int kDataIsText = 1 << 0; - const int kHeaderCRCIsPresent = 1 << 1; - const int kExtraIsPresent = 1 << 2; - const int kNameIsPresent = 1 << 3; - const int kComentIsPresent = 1 << 4; - } - - namespace NExtraFlags - { - enum EEnum - { - kMaximum = 2, - kFastest = 4 - }; - } - - namespace NCompressionMethod - { - const Byte kDeflate = 8; - } - - namespace NHostOS - { - enum EEnum - { - kFAT = 0, // filesystem used by MS-DOS, OS/2, Win32 - // pkzip 2.50 (FAT / VFAT / FAT32 file systems) - kAMIGA = 1, - kVMS = 2, // VAX/VMS - kUnix = 3, - kVM_CMS = 4, - kAtari = 5, // what if it's a minix filesystem? [cjh] - kHPFS = 6, // filesystem used by OS/2 (and NT 3.x) - kMac = 7, - kZ_System = 8, - kCPM = 9, - kTOPS20 = 10, // pkzip 2.50 NTFS - kNTFS = 11, // filesystem used by Windows NT - kQDOS = 12, // SMS/QDOS - kAcorn = 13, // Archimedes Acorn RISC OS - kVFAT = 14, // filesystem used by Windows 95, NT - kMVS = 15, - kBeOS = 16, // hybrid POSIX/database filesystem - // BeBOX or PowerMac - kTandem = 17, - kTHEOS = 18, - - kUnknown = 255 - }; - const int kNumHostSystems = 19; - } -} - -}} - -#endif diff --git a/7zip/Archive/GZip/GZipIn.cpp b/7zip/Archive/GZip/GZipIn.cpp deleted file mode 100755 index 2b16d369..00000000 --- a/7zip/Archive/GZip/GZipIn.cpp +++ /dev/null @@ -1,121 +0,0 @@ -// Archive/GZipIn.cpp - -#include "StdAfx.h" - -#include "GZipIn.h" - -#include "Common/Defs.h" -#include "Common/MyCom.h" -#include "Windows/Defs.h" - -#include "../../Common/StreamUtils.h" - -namespace NArchive { -namespace NGZip { - -HRESULT CInArchive::ReadBytes(ISequentialInStream *inStream, void *data, UInt32 size) -{ - UInt32 realProcessedSize; - RINOK(ReadStream(inStream, data, size, &realProcessedSize)); - m_Position += realProcessedSize; - if(realProcessedSize != size) - return S_FALSE; - return S_OK; -} - -HRESULT CInArchive::ReadByte(ISequentialInStream *inStream, Byte &value) -{ - return ReadBytes(inStream, &value, 1); -} - -HRESULT CInArchive::ReadUInt16(ISequentialInStream *inStream, UInt16 &value) -{ - value = 0; - for (int i = 0; i < 2; i++) - { - Byte b; - RINOK(ReadByte(inStream, b)); - value |= (UInt16(b) << (8 * i)); - } - return S_OK; -} - -HRESULT CInArchive::ReadUInt32(ISequentialInStream *inStream, UInt32 &value) -{ - value = 0; - for (int i = 0; i < 4; i++) - { - Byte b; - RINOK(ReadByte(inStream, b)); - value |= (UInt32(b) << (8 * i)); - } - return S_OK; -} - -HRESULT CInArchive::ReadZeroTerminatedString(ISequentialInStream *inStream, AString &resString, CCRC &crc) -{ - resString.Empty(); - for (;;) - { - Byte c; - RINOK(ReadByte(inStream, c)); - crc.UpdateByte(c); - if (c == 0) - return S_OK; - resString += char(c); - } -} - -HRESULT CInArchive::ReadHeader(ISequentialInStream *inStream, CItem &item) -{ - item.Clear(); - m_Position = 0; - - UInt16 signature; - RINOK(ReadUInt16(inStream, signature)); - if (signature != kSignature) - return S_FALSE; - RINOK(ReadByte(inStream, item.CompressionMethod)); - RINOK(ReadByte(inStream, item.Flags)); - RINOK(ReadUInt32(inStream, item.Time)); - RINOK(ReadByte(inStream, item.ExtraFlags)); - RINOK(ReadByte(inStream, item.HostOS)); - - CCRC crc; - crc.Update(&signature, 2); - crc.UpdateByte(item.CompressionMethod); - crc.UpdateByte(item.Flags); - crc.UpdateUInt32(item.Time); - crc.UpdateByte(item.ExtraFlags); - crc.UpdateByte(item.HostOS); - - if (item.ExtraFieldIsPresent()) - { - UInt16 extraSize; - RINOK(ReadUInt16(inStream, extraSize)); - crc.UpdateUInt16(extraSize); - item.Extra.SetCapacity(extraSize); - RINOK(ReadBytes(inStream, item.Extra, extraSize)); - crc.Update(item.Extra, extraSize); - } - if (item.NameIsPresent()) - RINOK(ReadZeroTerminatedString(inStream, item.Name, crc)); - if (item.CommentIsPresent()) - RINOK(ReadZeroTerminatedString(inStream, item.Comment, crc)); - if (item.HeaderCRCIsPresent()) - { - UInt16 headerCRC; - RINOK(ReadUInt16(inStream, headerCRC)); - if ((UInt16)crc.GetDigest() != headerCRC) - return S_FALSE; - } - return S_OK; -} - -HRESULT CInArchive::ReadPostHeader(ISequentialInStream *inStream, CItem &item) -{ - RINOK(ReadUInt32(inStream, item.FileCRC)); - return ReadUInt32(inStream, item.UnPackSize32); -} - -}} diff --git a/7zip/Archive/GZip/GZipIn.h b/7zip/Archive/GZip/GZipIn.h deleted file mode 100755 index 998470e0..00000000 --- a/7zip/Archive/GZip/GZipIn.h +++ /dev/null @@ -1,31 +0,0 @@ -// Archive/GZipIn.h - -#ifndef __ARCHIVE_GZIP_IN_H -#define __ARCHIVE_GZIP_IN_H - -#include "GZipHeader.h" -#include "GZipItem.h" -#include "Common/CRC.h" -#include "../../IStream.h" - -namespace NArchive { -namespace NGZip { - -class CInArchive -{ - UInt64 m_Position; - - HRESULT ReadBytes(ISequentialInStream *inStream, void *data, UInt32 size); - HRESULT ReadZeroTerminatedString(ISequentialInStream *inStream, AString &resString, CCRC &crc); - HRESULT ReadByte(ISequentialInStream *inStream, Byte &value); - HRESULT ReadUInt16(ISequentialInStream *inStream, UInt16 &value); - HRESULT ReadUInt32(ISequentialInStream *inStream, UInt32 &value); -public: - HRESULT ReadHeader(ISequentialInStream *inStream, CItem &item); - HRESULT ReadPostHeader(ISequentialInStream *inStream, CItem &item); - UInt64 GetOffset() const { return m_Position; } -}; - -}} - -#endif diff --git a/7zip/Archive/GZip/GZipItem.h b/7zip/Archive/GZip/GZipItem.h deleted file mode 100755 index 7006dfb3..00000000 --- a/7zip/Archive/GZip/GZipItem.h +++ /dev/null @@ -1,59 +0,0 @@ -// Archive/GZipItem.h - -#ifndef __ARCHIVE_GZIP_ITEM_H -#define __ARCHIVE_GZIP_ITEM_H - -#include "Common/Types.h" -#include "Common/String.h" -#include "Common/Buffer.h" - -namespace NArchive { -namespace NGZip { - -class CItem -{ -private: - bool TestFlag(Byte flag) const { return ((Flags & flag) != 0); } -public: - Byte CompressionMethod; - Byte Flags; - UInt32 Time; - Byte ExtraFlags; - Byte HostOS; - UInt32 FileCRC; - UInt32 UnPackSize32; - - AString Name; - AString Comment; - CByteBuffer Extra; - - bool IsText() const - { return TestFlag(NFileHeader::NFlags::kDataIsText); } - bool HeaderCRCIsPresent() const - { return TestFlag(NFileHeader::NFlags::kHeaderCRCIsPresent); } - bool ExtraFieldIsPresent() const - { return TestFlag(NFileHeader::NFlags::kExtraIsPresent); } - bool NameIsPresent() const - { return TestFlag(NFileHeader::NFlags::kNameIsPresent); } - bool CommentIsPresent() const - { return TestFlag(NFileHeader::NFlags::kComentIsPresent); } - - void SetNameIsPresentFlag(bool nameIsPresent) - { - if (nameIsPresent) - Flags |= NFileHeader::NFlags::kNameIsPresent; - else - Flags &= (~NFileHeader::NFlags::kNameIsPresent); - } - - void Clear() - { - Name.Empty(); - Comment.Empty();; - Extra.SetCapacity(0); - } -}; - -}} - -#endif diff --git a/7zip/Archive/GZip/GZipOut.cpp b/7zip/Archive/GZip/GZipOut.cpp deleted file mode 100755 index afa8a931..00000000 --- a/7zip/Archive/GZip/GZipOut.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// Archive/GZipOut.cpp - -#include "StdAfx.h" - -#include "GZipOut.h" -#include "Common/CRC.h" -#include "Windows/Defs.h" -#include "../../Common/StreamUtils.h" - -namespace NArchive { -namespace NGZip { - -HRESULT COutArchive::WriteBytes(const void *buffer, UInt32 size) -{ - UInt32 processedSize; - RINOK(WriteStream(m_Stream, buffer, size, &processedSize)); - if(processedSize != size) - return E_FAIL; - return S_OK; -} - -HRESULT COutArchive::WriteByte(Byte value) -{ - return WriteBytes(&value, 1); -} - -HRESULT COutArchive::WriteUInt16(UInt16 value) -{ - for (int i = 0; i < 2; i++) - { - RINOK(WriteByte((Byte)value)); - value >>= 8; - } - return S_OK; -} - -HRESULT COutArchive::WriteUInt32(UInt32 value) -{ - for (int i = 0; i < 4; i++) - { - RINOK(WriteByte((Byte)value)); - value >>= 8; - } - return S_OK; -} - -HRESULT COutArchive::WriteHeader(const CItem &item) -{ - RINOK(WriteUInt16(kSignature)); - RINOK(WriteByte(item.CompressionMethod)); - RINOK(WriteByte((Byte)(item.Flags & NFileHeader::NFlags::kNameIsPresent))); - RINOK(WriteUInt32(item.Time)); - RINOK(WriteByte(item.ExtraFlags)); - RINOK(WriteByte(item.HostOS)); - if (item.NameIsPresent()) - { - RINOK(WriteBytes((const char *)item.Name, item.Name.Length())); - RINOK(WriteByte(0)); - } - return S_OK; -} - -HRESULT COutArchive::WritePostHeader(const CItem &item) -{ - RINOK(WriteUInt32(item.FileCRC)); - return WriteUInt32(item.UnPackSize32); -} - -}} diff --git a/7zip/Archive/GZip/GZipOut.h b/7zip/Archive/GZip/GZipOut.h deleted file mode 100755 index a2ba2ebf..00000000 --- a/7zip/Archive/GZip/GZipOut.h +++ /dev/null @@ -1,29 +0,0 @@ -// Archive/GZipOut.h - -#ifndef __ARCHIVE_GZIP_OUT_H -#define __ARCHIVE_GZIP_OUT_H - -#include "Common/MyCom.h" -#include "GZipHeader.h" -#include "GZipItem.h" -#include "../../IStream.h" - -namespace NArchive { -namespace NGZip { - -class COutArchive -{ - CMyComPtr m_Stream; - HRESULT WriteBytes(const void *buffer, UInt32 size); - HRESULT WriteByte(Byte value); - HRESULT WriteUInt16(UInt16 value); - HRESULT WriteUInt32(UInt32 value); -public: - void Create(ISequentialOutStream *outStream) { m_Stream = outStream; } - HRESULT WriteHeader(const CItem &item); - HRESULT WritePostHeader(const CItem &item); -}; - -}} - -#endif diff --git a/7zip/Archive/GZip/GZipUpdate.cpp b/7zip/Archive/GZip/GZipUpdate.cpp deleted file mode 100755 index 45e6e985..00000000 --- a/7zip/Archive/GZip/GZipUpdate.cpp +++ /dev/null @@ -1,120 +0,0 @@ -// GZipUpdate.cpp - -#include "StdAfx.h" - -#include "GZipUpdate.h" - -#include "Common/Defs.h" -#include "Common/StringConvert.h" - -#include "Windows/Defs.h" -#include "Windows/PropVariant.h" - -#include "../../ICoder.h" -#include "../../Common/ProgressUtils.h" -#include "../../Compress/Copy/CopyCoder.h" - -#include "../Common/InStreamWithCRC.h" - -#ifdef COMPRESS_DEFLATE -#include "../../Compress/Deflate/DeflateEncoder.h" -#else -// {23170F69-40C1-278B-0401-080000000100} -DEFINE_GUID(CLSID_CCompressDeflateEncoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00); -#include "../Common/CoderLoader.h" -extern CSysString GetDeflateCodecPath(); -#endif - -namespace NArchive { -namespace NGZip { - -static const Byte kHostOS = NFileHeader::NHostOS::kFAT; - -HRESULT UpdateArchive(IInStream * /* inStream */, - UInt64 unpackSize, - ISequentialOutStream *outStream, - const CItem &newItem, - const CCompressionMethodMode &compressionMethod, - int indexInClient, - IArchiveUpdateCallback *updateCallback) -{ - UInt64 complexity = 0; - - complexity += unpackSize; - - RINOK(updateCallback->SetTotal(complexity)); - - #ifndef COMPRESS_DEFLATE - CCoderLibrary lib; - #endif - CMyComPtr deflateEncoder; - - complexity = 0; - RINOK(updateCallback->SetCompleted(&complexity)); - - CMyComPtr fileInStream; - - RINOK(updateCallback->GetStream(indexInClient, &fileInStream)); - - CSequentialInStreamWithCRC *inStreamSpec = new CSequentialInStreamWithCRC; - CMyComPtr crcStream(inStreamSpec); - inStreamSpec->SetStream(fileInStream); - inStreamSpec->Init(); - - CLocalProgress *localProgressSpec = new CLocalProgress; - CMyComPtr localProgress = localProgressSpec; - localProgressSpec->Init(updateCallback, true); - - CLocalCompressProgressInfo *localCompressProgressSpec = - new CLocalCompressProgressInfo; - CMyComPtr compressProgress = localCompressProgressSpec; - - COutArchive outArchive; - outArchive.Create(outStream); - - CItem item = newItem; - item.CompressionMethod = NFileHeader::NCompressionMethod::kDeflate; - item.ExtraFlags = 0; - item.HostOS = kHostOS; - - RINOK(outArchive.WriteHeader(item)); - - localCompressProgressSpec->Init(localProgress, &complexity, NULL); - - { - #ifdef COMPRESS_DEFLATE - deflateEncoder = new NCompress::NDeflate::NEncoder::CCOMCoder; - #else - RINOK(lib.LoadAndCreateCoder(GetDeflateCodecPath(), - CLSID_CCompressDeflateEncoder, &deflateEncoder)); - #endif - - NWindows::NCOM::CPropVariant properties[] = - { - compressionMethod.NumPasses, - compressionMethod.NumFastBytes, - compressionMethod.NumMatchFinderCycles - }; - PROPID propIDs[] = - { - NCoderPropID::kNumPasses, - NCoderPropID::kNumFastBytes, - NCoderPropID::kMatchFinderCycles - }; - int numProps = sizeof(propIDs) / sizeof(propIDs[0]); - if (!compressionMethod.NumMatchFinderCyclesDefined) - numProps--; - CMyComPtr setCoderProperties; - RINOK(deflateEncoder.QueryInterface(IID_ICompressSetCoderProperties, &setCoderProperties)); - RINOK(setCoderProperties->SetCoderProperties(propIDs, properties, numProps)); - } - RINOK(deflateEncoder->Code(crcStream, outStream, NULL, NULL, compressProgress)); - - item.FileCRC = inStreamSpec->GetCRC(); - item.UnPackSize32 = (UInt32)inStreamSpec->GetSize(); - RINOK(outArchive.WritePostHeader(item)); - return updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK); -} - -}} diff --git a/7zip/Archive/GZip/GZipUpdate.h b/7zip/Archive/GZip/GZipUpdate.h deleted file mode 100755 index c06e8a4c..00000000 --- a/7zip/Archive/GZip/GZipUpdate.h +++ /dev/null @@ -1,32 +0,0 @@ -// GZip/Update.h - -#ifndef __GZIP_UPDATE_H -#define __GZIP_UPDATE_H - -#include "../IArchive.h" - -#include "GZipOut.h" -#include "GZipItem.h" - -namespace NArchive { -namespace NGZip { - -struct CCompressionMethodMode -{ - UInt32 NumPasses; - UInt32 NumFastBytes; - bool NumMatchFinderCyclesDefined; - UInt32 NumMatchFinderCycles; -}; - -HRESULT UpdateArchive(IInStream *inStream, - UInt64 unpackSize, - ISequentialOutStream *outStream, - const CItem &newItem, - const CCompressionMethodMode &compressionMethod, - int indexInClient, - IArchiveUpdateCallback *updateCallback); - -}} - -#endif diff --git a/7zip/Archive/GZip/StdAfx.cpp b/7zip/Archive/GZip/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Archive/GZip/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Archive/GZip/StdAfx.h b/7zip/Archive/GZip/StdAfx.h deleted file mode 100755 index e7fb6986..00000000 --- a/7zip/Archive/GZip/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Archive/GZip/gz.ico b/7zip/Archive/GZip/gz.ico deleted file mode 100755 index f50d8c08..00000000 Binary files a/7zip/Archive/GZip/gz.ico and /dev/null differ diff --git a/7zip/Archive/GZip/makefile b/7zip/Archive/GZip/makefile deleted file mode 100755 index abc3f1e4..00000000 --- a/7zip/Archive/GZip/makefile +++ /dev/null @@ -1,60 +0,0 @@ -PROG = gz.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib user32.lib - -GZ_OBJS = \ - $O\GZipHandler.obj \ - $O\GZipHandlerOut.obj \ - $O\GZipHeader.obj \ - $O\GZipIn.obj \ - $O\GZipOut.obj \ - $O\GZipUpdate.obj \ - $O\DllExports.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\CRC.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\StringToInt.obj \ - -WIN_OBJS = \ - $O\DLL.obj \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\CodecsPath.obj \ - $O\InStreamWithCRC.obj \ - $O\OutStreamWithCRC.obj \ - $O\ParseProperties.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(GZ_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $O\CopyCoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(GZ_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) diff --git a/7zip/Archive/GZip/resource.rc b/7zip/Archive/GZip/resource.rc deleted file mode 100755 index 29fb4825..00000000 --- a/7zip/Archive/GZip/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("GZip Plugin", "gz") - -101 ICON "gz.ico" diff --git a/7zip/Archive/IArchive.h b/7zip/Archive/IArchive.h deleted file mode 100755 index d6cbe804..00000000 --- a/7zip/Archive/IArchive.h +++ /dev/null @@ -1,173 +0,0 @@ -// IArchive.h - -#ifndef __IARCHIVE_H -#define __IARCHIVE_H - -#include "../IStream.h" -#include "../IProgress.h" -#include "../PropID.h" - -// MIDL_INTERFACE("23170F69-40C1-278A-0000-000600xx0000") -#define ARCHIVE_INTERFACE_SUB(i, base, x) \ -DEFINE_GUID(IID_ ## i, \ -0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x06, 0x00, x, 0x00, 0x00); \ -struct i: public base - -#define ARCHIVE_INTERFACE(i, x) ARCHIVE_INTERFACE_SUB(i, IUnknown, x) - -namespace NFileTimeType -{ - enum EEnum - { - kWindows, - kUnix, - kDOS - }; -} - -namespace NArchive -{ - enum - { - kName = 0, - kClassID, - kExtension, - kAddExtension, - kUpdate, - kKeepName, - kStartSignature, - kFinishSignature, - kAssociate - }; - - namespace NExtract - { - namespace NAskMode - { - enum - { - kExtract = 0, - kTest, - kSkip, - }; - } - namespace NOperationResult - { - enum - { - kOK = 0, - kUnSupportedMethod, - kDataError, - kCRCError, - }; - } - } - namespace NUpdate - { - namespace NOperationResult - { - enum - { - kOK = 0, - kError, - }; - } - } -} - -ARCHIVE_INTERFACE(IArchiveOpenCallback, 0x10) -{ - STDMETHOD(SetTotal)(const UInt64 *files, const UInt64 *bytes) PURE; - STDMETHOD(SetCompleted)(const UInt64 *files, const UInt64 *bytes) PURE; -}; - - -ARCHIVE_INTERFACE_SUB(IArchiveExtractCallback, IProgress, 0x20) -{ - STDMETHOD(GetStream)(UInt32 index, ISequentialOutStream **outStream, - Int32 askExtractMode) PURE; - // GetStream OUT: S_OK - OK, S_FALSE - skeep this file - STDMETHOD(PrepareOperation)(Int32 askExtractMode) PURE; - STDMETHOD(SetOperationResult)(Int32 resultEOperationResult) PURE; -}; - - -ARCHIVE_INTERFACE(IArchiveOpenVolumeCallback, 0x30) -{ - STDMETHOD(GetProperty)(PROPID propID, PROPVARIANT *value) PURE; - STDMETHOD(GetStream)(const wchar_t *name, IInStream **inStream) PURE; -}; - - -ARCHIVE_INTERFACE(IInArchiveGetStream, 0x40) -{ - STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream) PURE; -}; - - -ARCHIVE_INTERFACE(IArchiveOpenSetSubArchiveName, 0x50) -{ - STDMETHOD(SetSubArchiveName)(const wchar_t *name) PURE; -}; - - -ARCHIVE_INTERFACE(IInArchive, 0x60) -{ - STDMETHOD(Open)(IInStream *stream, const UInt64 *maxCheckStartPosition, - IArchiveOpenCallback *openArchiveCallback) PURE; - STDMETHOD(Close)() PURE; - STDMETHOD(GetNumberOfItems)(UInt32 *numItems) PURE; - STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value) PURE; - STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems, - Int32 testMode, IArchiveExtractCallback *extractCallback) PURE; - // indices must be sorted - // numItems = 0xFFFFFFFF means all files - // testMode != 0 means "test files operation" - - STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value) PURE; - - STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties) PURE; - STDMETHOD(GetPropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) PURE; - - STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties) PURE; - STDMETHOD(GetArchivePropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) PURE; -}; - - -ARCHIVE_INTERFACE_SUB(IArchiveUpdateCallback, IProgress, 0x80) -{ - STDMETHOD(GetUpdateItemInfo)(UInt32 index, - Int32 *newData, // 1 - new data, 0 - old data - Int32 *newProperties, // 1 - new properties, 0 - old properties - UInt32 *indexInArchive // -1 if there is no in archive, or if doesn't matter - ) PURE; - STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value) PURE; - STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **inStream) PURE; - STDMETHOD(SetOperationResult)(Int32 operationResult) PURE; -}; - - -ARCHIVE_INTERFACE_SUB(IArchiveUpdateCallback2, IArchiveUpdateCallback, 0x82) -{ - STDMETHOD(GetVolumeSize)(UInt32 index, UInt64 *size) PURE; - STDMETHOD(GetVolumeStream)(UInt32 index, ISequentialOutStream **volumeStream) PURE; -}; - - -ARCHIVE_INTERFACE(IOutArchive, 0xA0) -{ - STDMETHOD(UpdateItems)(ISequentialOutStream *outStream, UInt32 numItems, - IArchiveUpdateCallback *updateCallback) PURE; - STDMETHOD(GetFileTimeType)(UInt32 *type) PURE; -}; - - -ARCHIVE_INTERFACE(ISetProperties, 0x03) -{ - STDMETHOD(SetProperties)(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties) PURE; -}; - - -#endif diff --git a/7zip/Archive/Iso/DllExports.cpp b/7zip/Archive/Iso/DllExports.cpp deleted file mode 100755 index f746eea1..00000000 --- a/7zip/Archive/Iso/DllExports.cpp +++ /dev/null @@ -1,88 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "../../ICoder.h" -#include "IsoHandler.h" - -// {23170F69-40C1-278A-1000-000110E70000} -DEFINE_GUID(CLSID_CIsoHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0xE7, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /* lpReserved */) -{ - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CIsoHandler) - return CLASS_E_CLASSNOTAVAILABLE; - int needIn = *interfaceID == IID_IInArchive; - // int needOut = *interfaceID == IID_IOutArchive; - if (needIn /*|| needOut */) - { - NArchive::NIso::CHandler *temp = new NArchive::NIso::CHandler; - if (needIn) - { - CMyComPtr inArchive = (IInArchive *)temp; - *outObject = inArchive.Detach(); - } - /* - else - { - CMyComPtr outArchive = (IOutArchive *)temp; - *outObject = outArchive.Detach(); - } - */ - } - else - return E_NOINTERFACE; - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Iso"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CIsoHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"iso"; - break; - case NArchive::kUpdate: - propVariant = false; - break; - case NArchive::kKeepName: - propVariant = false; - break; - case NArchive::kStartSignature: - { - const unsigned char sig[] = { 'C', 'D', '0', '0', '1', 0x1 }; - if ((value->bstrVal = ::SysAllocStringByteLen((const char *)sig, 7)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - } - propVariant.Detach(value); - return S_OK; -} diff --git a/7zip/Archive/Iso/Iso.dsp b/7zip/Archive/Iso/Iso.dsp deleted file mode 100755 index a204e9cd..00000000 --- a/7zip/Archive/Iso/Iso.dsp +++ /dev/null @@ -1,273 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Iso" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Iso - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Iso.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Iso.mak" CFG="Iso - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Iso - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Iso - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Iso - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\Iso.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Iso - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\Iso.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Iso - Win32 Release" -# Name "Iso - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\Iso.ico -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\IsoHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\IsoHandler.h -# End Source File -# Begin Source File - -SOURCE=.\IsoHeader.cpp -# End Source File -# Begin Source File - -SOURCE=.\IsoHeader.h -# End Source File -# Begin Source File - -SOURCE=.\IsoIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\IsoIn.h -# End Source File -# Begin Source File - -SOURCE=.\IsoItem.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.h -# End Source File -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# End Target -# End Project diff --git a/7zip/Archive/Iso/Iso.dsw b/7zip/Archive/Iso/Iso.dsw deleted file mode 100755 index 27728dd2..00000000 --- a/7zip/Archive/Iso/Iso.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Iso"=.\Iso.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Archive/Iso/Iso.ico b/7zip/Archive/Iso/Iso.ico deleted file mode 100755 index 2538e408..00000000 Binary files a/7zip/Archive/Iso/Iso.ico and /dev/null differ diff --git a/7zip/Archive/Iso/IsoHandler.cpp b/7zip/Archive/Iso/IsoHandler.cpp deleted file mode 100755 index 1831e913..00000000 --- a/7zip/Archive/Iso/IsoHandler.cpp +++ /dev/null @@ -1,301 +0,0 @@ -// Iso/Handler.cpp - -#include "StdAfx.h" - -#include "IsoHandler.h" - -#include "Common/Defs.h" -#include "Common/StringConvert.h" -#include "Common/IntToString.h" -#include "Common/NewHandler.h" -#include "Common/ComTry.h" - -#include "Windows/Time.h" -#include "Windows/PropVariant.h" - -#include "../../Common/ProgressUtils.h" -#include "../../Common/LimitedStreams.h" -#include "../../Compress/Copy/CopyCoder.h" - -#include "../Common/ItemNameUtils.h" - -using namespace NWindows; -using namespace NTime; - -namespace NArchive { -namespace NIso { - -STATPROPSTG kProperties[] = -{ - { NULL, kpidPath, VT_BSTR}, - { NULL, kpidIsFolder, VT_BOOL}, - { NULL, kpidSize, VT_UI8}, - { NULL, kpidPackedSize, VT_UI8}, - { NULL, kpidLastWriteTime, VT_FILETIME} -}; - -STDMETHODIMP CHandler::GetArchiveProperty(PROPID /* propID */, PROPVARIANT *value) -{ - value->vt = VT_EMPTY; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties) -{ - *numProperties = sizeof(kProperties) / sizeof(kProperties[0]); - return S_OK; -} - -STDMETHODIMP CHandler::GetPropertyInfo(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) -{ - if(index >= sizeof(kProperties) / sizeof(kProperties[0])) - return E_INVALIDARG; - const STATPROPSTG &srcItem = kProperties[index]; - *propID = srcItem.propid; - *varType = srcItem.vt; - *name = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) -{ - *numProperties = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetArchivePropertyInfo(UInt32 /* index */, - BSTR * /* name */, PROPID * /* propID */, VARTYPE * /* varType */) -{ - return E_INVALIDARG; -} - -STDMETHODIMP CHandler::Open(IInStream *stream, - const UInt64 * /* maxCheckStartPosition */, - IArchiveOpenCallback * /* openArchiveCallback */) -{ - COM_TRY_BEGIN - Close(); - // try - { - if(_archive.Open(stream) != S_OK) - return S_FALSE; - _inStream = stream; - } - // catch(...) { return S_FALSE; } - return S_OK; - COM_TRY_END -} - -STDMETHODIMP CHandler::Close() -{ - _archive.Clear(); - _inStream.Release(); - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems) -{ - *numItems = _archive.Refs.Size() + _archive.BootEntries.Size(); - return S_OK; -} - -STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) -{ - COM_TRY_BEGIN - NWindows::NCOM::CPropVariant propVariant; - if (index >= (UInt32)_archive.Refs.Size()) - { - index -= _archive.Refs.Size(); - const CBootInitialEntry &be = _archive.BootEntries[index]; - switch(propID) - { - case kpidPath: - { - // wchar_t name[32]; - // ConvertUInt64ToString(index + 1, name); - UString s = L"[BOOT]" WSTRING_PATH_SEPARATOR; - // s += name; - // s += L"-"; - s += be.GetName(); - propVariant = (const wchar_t *)s; - break; - } - case kpidIsFolder: - propVariant = false; - break; - case kpidSize: - case kpidPackedSize: - { - propVariant = (UInt64)_archive.GetBootItemSize(index); - break; - } - } - } - else - { - const CRef &ref = _archive.Refs[index]; - const CDir &item = ref.Dir->_subItems[ref.Index]; - switch(propID) - { - case kpidPath: - if (item.FileId.GetCapacity() >= 0) - { - UString s; - if (_archive.IsJoliet()) - s = item.GetPathU(); - else - s = MultiByteToUnicodeString(item.GetPath(_archive.IsSusp, _archive.SuspSkipSize), CP_OEMCP); - - int pos = s.ReverseFind(L';'); - if (pos >= 0 && pos == s.Length() - 2) - if (s[s.Length() - 1] == L'1') - s = s.Left(pos); - if (!s.IsEmpty()) - if (s[s.Length() - 1] == L'.') - s = s.Left(s.Length() - 1); - propVariant = (const wchar_t *)NItemName::GetOSName2(s); - } - break; - case kpidIsFolder: - propVariant = item.IsDir(); - break; - case kpidSize: - case kpidPackedSize: - if (!item.IsDir()) - propVariant = (UInt64)item.DataLength; - break; - case kpidLastWriteTime: - { - FILETIME utcFileTime; - if (item.DateTime.GetFileTime(utcFileTime)) - propVariant = utcFileTime; - /* - else - { - utcFileTime.dwLowDateTime = 0; - utcFileTime.dwHighDateTime = 0; - } - */ - break; - } - } - } - propVariant.Detach(value); - return S_OK; - COM_TRY_END -} - -STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, - Int32 _aTestMode, IArchiveExtractCallback *extractCallback) -{ - COM_TRY_BEGIN - bool testMode = (_aTestMode != 0); - bool allFilesMode = (numItems == UInt32(-1)); - if (allFilesMode) - numItems = _archive.Refs.Size(); - UInt64 totalSize = 0; - if(numItems == 0) - return S_OK; - UInt32 i; - for(i = 0; i < numItems; i++) - { - UInt32 index = (allFilesMode ? i : indices[i]); - if (index < (UInt32)_archive.Refs.Size()) - { - const CRef &ref = _archive.Refs[index]; - const CDir &item = ref.Dir->_subItems[ref.Index]; - totalSize += item.DataLength; - } - else - { - totalSize += _archive.GetBootItemSize(index - _archive.Refs.Size()); - } - } - extractCallback->SetTotal(totalSize); - - UInt64 currentTotalSize = 0; - UInt64 currentItemSize; - - CMyComPtr copyCoder; - - for (i = 0; i < numItems; i++, currentTotalSize += currentItemSize) - { - currentItemSize = 0; - RINOK(extractCallback->SetCompleted(¤tTotalSize)); - CMyComPtr realOutStream; - Int32 askMode; - askMode = testMode ? NArchive::NExtract::NAskMode::kTest : NArchive::NExtract::NAskMode::kExtract; - UInt32 index = allFilesMode ? i : indices[i]; - - RINOK(extractCallback->GetStream(index, &realOutStream, askMode)); - - UInt64 blockIndex; - if (index < (UInt32)_archive.Refs.Size()) - { - const CRef &ref = _archive.Refs[index]; - const CDir &item = ref.Dir->_subItems[ref.Index]; - if(item.IsDir()) - { - RINOK(extractCallback->PrepareOperation(askMode)); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - continue; - } - currentItemSize = item.DataLength; - blockIndex = item.ExtentLocation; - } - else - { - int bootIndex = index - _archive.Refs.Size(); - const CBootInitialEntry &be = _archive.BootEntries[bootIndex]; - currentItemSize = _archive.GetBootItemSize(bootIndex); - blockIndex = be.LoadRBA; - } - - if(!testMode && (!realOutStream)) - continue; - - RINOK(extractCallback->PrepareOperation(askMode)); - { - if (testMode) - { - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - continue; - } - - RINOK(_inStream->Seek(blockIndex * _archive.BlockSize, STREAM_SEEK_SET, NULL)); - CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream; - CMyComPtr inStream(streamSpec); - streamSpec->SetStream(_inStream); - streamSpec->Init(currentItemSize); - - CLocalProgress *localProgressSpec = new CLocalProgress; - CMyComPtr progress = localProgressSpec; - localProgressSpec->Init(extractCallback, false); - - CLocalCompressProgressInfo *localCompressProgressSpec = new CLocalCompressProgressInfo; - CMyComPtr compressProgress = localCompressProgressSpec; - localCompressProgressSpec->Init(progress, ¤tTotalSize, ¤tTotalSize); - - Int32 res = NArchive::NExtract::NOperationResult::kOK; - if(!copyCoder) - { - copyCoder = new NCompress::CCopyCoder; - } - try - { - RINOK(copyCoder->Code(inStream, realOutStream, NULL, NULL, compressProgress)); - } - catch(...) - { - res = NArchive::NExtract::NOperationResult::kDataError; - } - realOutStream.Release(); - RINOK(extractCallback->SetOperationResult(res)); - } - } - return S_OK; - COM_TRY_END -} - -}} diff --git a/7zip/Archive/Iso/IsoHandler.h b/7zip/Archive/Iso/IsoHandler.h deleted file mode 100755 index e545d2a7..00000000 --- a/7zip/Archive/Iso/IsoHandler.h +++ /dev/null @@ -1,59 +0,0 @@ -// Tar/Handler.h - -#ifndef __ISO_HANDLER_H -#define __ISO_HANDLER_H - -#include "Common/MyCom.h" -#include "../IArchive.h" - -#include "IsoItem.h" -#include "IsoIn.h" - -namespace NArchive { -namespace NIso { - -class CHandler: - public IInArchive, - // public IOutArchive, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP1( - IInArchive - // IOutArchive - ) - - STDMETHOD(Open)(IInStream *stream, - const UInt64 *maxCheckStartPosition, - IArchiveOpenCallback *openArchiveCallback); - STDMETHOD(Close)(); - STDMETHOD(GetNumberOfItems)(UInt32 *numItems); - STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value); - STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems, - Int32 testMode, IArchiveExtractCallback *extractCallback); - - STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value); - - STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties); - STDMETHOD(GetPropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - - STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties); - STDMETHOD(GetArchivePropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - - /* - // IOutArchive - STDMETHOD(UpdateItems)(ISequentialOutStream *outStream, UInt32 numItems, - IArchiveUpdateCallback *updateCallback); - STDMETHOD(GetFileTimeType)(UInt32 *type); - */ - -private: - CMyComPtr _inStream; - CInArchive _archive; -}; - -}} - -#endif diff --git a/7zip/Archive/Iso/IsoHeader.cpp b/7zip/Archive/Iso/IsoHeader.cpp deleted file mode 100755 index 9555e49b..00000000 --- a/7zip/Archive/Iso/IsoHeader.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// Archive/Iso/Header.h - -#include "StdAfx.h" - -#include "IsoHeader.h" - -namespace NArchive { -namespace NIso { - -const char *kElToritoSpec = "EL TORITO SPECIFICATION\0\0\0\0\0\0\0\0\0"; - -const wchar_t *kMediaTypes[5] = -{ - L"NoEmulation", - L"1.2M", - L"1.44M", - L"2.88M", - L"HardDisk" -}; - -}} diff --git a/7zip/Archive/Iso/IsoHeader.h b/7zip/Archive/Iso/IsoHeader.h deleted file mode 100755 index 9702d70a..00000000 --- a/7zip/Archive/Iso/IsoHeader.h +++ /dev/null @@ -1,61 +0,0 @@ -// Archive/IsoHeader.h - -#ifndef __ARCHIVE_ISO_HEADER_H -#define __ARCHIVE_ISO_HEADER_H - -#include "Common/Types.h" - -namespace NArchive { -namespace NIso { - -namespace NVolDescType -{ - const Byte kBootRecord = 0; - const Byte kPrimaryVol = 1; - const Byte kSupplementaryVol = 2; - const Byte kVolParttition = 3; - const Byte kTerminator = 255; -} - -const Byte kVersion = 1; - -namespace NFileFlags -{ - const Byte kDirectory = 1 << 1; -} - -extern const char *kElToritoSpec; - -const UInt32 kStartPos = 0x8000; - -namespace NBootEntryId -{ - const Byte kValidationEntry = 1; - const Byte kInitialEntryNotBootable = 0; - const Byte kInitialEntryBootable = 0x88; -} - -namespace NBootPlatformId -{ - const Byte kX86 = 0; - const Byte kPowerPC = 1; - const Byte kMac = 2; -} - -const BYTE kBootMediaTypeMask = 0xF; - -namespace NBootMediaType -{ - const Byte kNoEmulation = 0; - const Byte k1d2Floppy = 1; - const Byte k1d44Floppy = 2; - const Byte k2d88Floppy = 3; - const Byte kHardDisk = 4; -} - -const int kNumBootMediaTypes = 5; -extern const wchar_t *kMediaTypes[]; - -}} - -#endif diff --git a/7zip/Archive/Iso/IsoIn.cpp b/7zip/Archive/Iso/IsoIn.cpp deleted file mode 100755 index 213b3014..00000000 --- a/7zip/Archive/Iso/IsoIn.cpp +++ /dev/null @@ -1,438 +0,0 @@ -// Archive/IsoIn.cpp - -#include "StdAfx.h" - -#include "IsoIn.h" -#include "IsoHeader.h" - -#include "Windows/Defs.h" - -#include "../../Common/StreamUtils.h" - -namespace NArchive { -namespace NIso { - -HRESULT CInArchive::ReadBytes(void *data, UInt32 size, UInt32 &processedSize) -{ - return ReadStream(_stream, data, size, &processedSize); -} - -Byte CInArchive::ReadByte() -{ - if (m_BufferPos >= BlockSize) - m_BufferPos = 0; - if (m_BufferPos == 0) - { - UInt32 processedSize; - if (ReadBytes(m_Buffer, BlockSize, processedSize) != S_OK) - throw 1; - if (processedSize != BlockSize) - throw 1; - } - Byte b = m_Buffer[m_BufferPos++]; - _position++; - return b; -} - -void CInArchive::ReadBytes(Byte *data, UInt32 size) -{ - for (UInt32 i = 0; i < size; i++) - data[i] = ReadByte(); -} - -void CInArchive::Skeep(size_t size) -{ - while (size-- != 0) - ReadByte(); -} - -void CInArchive::SkeepZeros(size_t size) -{ - while (size-- != 0) - { - Byte b = ReadByte(); - if (b != 0) - throw 1; - } -} - -UInt16 CInArchive::ReadUInt16Spec() -{ - UInt16 value = 0; - for (int i = 0; i < 2; i++) - value |= ((UInt16)(ReadByte()) << (8 * i)); - return value; -} - - -UInt16 CInArchive::ReadUInt16() -{ - Byte b[4]; - ReadBytes(b, 4); - UInt32 value = 0; - for (int i = 0; i < 2; i++) - { - if (b[i] != b[3 - i]) - throw 1; - value |= ((UInt16)(b[i]) << (8 * i)); - } - return (UInt16)value; -} - -UInt32 CInArchive::ReadUInt32Le() -{ - UInt32 value = 0; - for (int i = 0; i < 4; i++) - value |= ((UInt32)(ReadByte()) << (8 * i)); - return value; -} - -UInt32 CInArchive::ReadUInt32Be() -{ - UInt32 value = 0; - for (int i = 0; i < 4; i++) - { - value <<= 8; - value |= ReadByte(); - } - return value; -} - -UInt32 CInArchive::ReadUInt32() -{ - Byte b[8]; - ReadBytes(b, 8); - UInt32 value = 0; - for (int i = 0; i < 4; i++) - { - if (b[i] != b[7 - i]) - throw 1; - value |= ((UInt32)(b[i]) << (8 * i)); - } - return value; -} - -UInt32 CInArchive::ReadDigits(int numDigits) -{ - UInt32 res = 0; - for (int i = 0; i < numDigits; i++) - { - Byte b = ReadByte(); - if (b < '0' || b > '9') - { - if (b == 0) // it's bug in some CD's - b = '0'; - else - throw 1; - } - UInt32 d = (UInt32)(b - '0'); - res *= 10; - res += d; - } - return res; -} - -void CInArchive::ReadDateTime(CDateTime &d) -{ - d.Year = (UInt16)ReadDigits(4); - d.Month = (Byte)ReadDigits(2); - d.Day = (Byte)ReadDigits(2); - d.Hour = (Byte)ReadDigits(2); - d.Minute = (Byte)ReadDigits(2); - d.Second = (Byte)ReadDigits(2); - d.Hundredths = (Byte)ReadDigits(2); - d.GmtOffset = (signed char)ReadByte(); -} - -void CInArchive::ReadBootRecordDescriptor(CBootRecordDescriptor &d) -{ - ReadBytes(d.BootSystemId, sizeof(d.BootSystemId)); - ReadBytes(d.BootId, sizeof(d.BootId)); - ReadBytes(d.BootSystemUse, sizeof(d.BootSystemUse)); -} - -void CInArchive::ReadRecordingDateTime(CRecordingDateTime &t) -{ - t.Year = ReadByte(); - t.Month = ReadByte(); - t.Day = ReadByte(); - t.Hour = ReadByte(); - t.Minute = ReadByte(); - t.Second = ReadByte(); - t.GmtOffset = (signed char)ReadByte(); -} - -void CInArchive::ReadDirRecord2(CDirRecord &r, Byte len) -{ - r.ExtendedAttributeRecordLen = ReadByte(); - if (r.ExtendedAttributeRecordLen != 0) - throw 1; - r.ExtentLocation = ReadUInt32(); - r.DataLength = ReadUInt32(); - ReadRecordingDateTime(r.DateTime); - r.FileFlags = ReadByte(); - r.FileUnitSize = ReadByte(); - r.InterleaveGapSize = ReadByte(); - r.VolSequenceNumber = ReadUInt16(); - Byte idLen = ReadByte(); - r.FileId.SetCapacity(idLen); - ReadBytes((Byte *)r.FileId, idLen); - int padSize = 1 - (idLen & 1); - - // SkeepZeros(1 - (idLen & 1)); - Skeep(1 - (idLen & 1)); // it's bug in some cd's. Must be zeros - - int curPos = 33 + idLen + padSize; - if (curPos > len) - throw 1; - int rem = len - curPos; - r.SystemUse.SetCapacity(rem); - ReadBytes((Byte *)r.SystemUse, rem); -} - -void CInArchive::ReadDirRecord(CDirRecord &r) -{ - Byte len = ReadByte(); - ReadDirRecord2(r, len); -} - -void CInArchive::ReadVolumeDescriptor(CVolumeDescriptor &d) -{ - d.VolFlags = ReadByte(); - ReadBytes(d.SystemId, sizeof(d.SystemId)); - ReadBytes(d.VolumeId, sizeof(d.VolumeId)); - SkeepZeros(8); - d.VolumeSpaceSize = ReadUInt32(); - ReadBytes(d.EscapeSequence, sizeof(d.EscapeSequence)); - d.VolumeSetSize = ReadUInt16(); - d.VolumeSequenceNumber = ReadUInt16(); - d.LogicalBlockSize = ReadUInt16(); - d.PathTableSize = ReadUInt32(); - d.LPathTableLocation = ReadUInt32Le(); - d.LOptionalPathTableLocation = ReadUInt32Le(); - d.MPathTableLocation = ReadUInt32Be(); - d.MOptionalPathTableLocation = ReadUInt32Be(); - ReadDirRecord(d.RootDirRecord); - ReadBytes(d.VolumeSetId, sizeof(d.VolumeSetId)); - ReadBytes(d.PublisherId, sizeof(d.PublisherId)); - ReadBytes(d.DataPreparerId, sizeof(d.DataPreparerId)); - ReadBytes(d.ApplicationId, sizeof(d.ApplicationId)); - ReadBytes(d.CopyrightFileId, sizeof(d.CopyrightFileId)); - ReadBytes(d.AbstractFileId, sizeof(d.AbstractFileId)); - ReadBytes(d.BibFileId, sizeof(d.BibFileId)); - ReadDateTime(d.CreationTime); - ReadDateTime(d.ModificationTime); - ReadDateTime(d.ExpirationTime); - ReadDateTime(d.EffectiveTime); - d.FileStructureVersion = ReadByte(); // = 1 - SkeepZeros(1); - ReadBytes(d.ApplicationUse, sizeof(d.ApplicationUse)); - SkeepZeros(653); -} - -static inline bool CheckDescriptorSignature(const Byte *sig) -{ - return sig[0] == 'C' && - sig[1] == 'D' && - sig[2] == '0' && - sig[3] == '0' && - sig[4] == '1'; -} - -void CInArchive::SeekToBlock(UInt32 blockIndex) -{ - if (_stream->Seek((UInt64)blockIndex * VolDescs[MainVolDescIndex].LogicalBlockSize, STREAM_SEEK_SET, &_position) != S_OK) - throw 1; - m_BufferPos = 0; -} - -void CInArchive::ReadDir(CDir &d, int level) -{ - if (!d.IsDir()) - return; - SeekToBlock(d.ExtentLocation); - UInt64 startPos = _position; - - bool firstItem = true; - for (;;) - { - UInt64 offset = _position - startPos; - if (offset >= d.DataLength) - break; - Byte len = ReadByte(); - if (len == 0) - continue; - CDir subItem; - ReadDirRecord2(subItem, len); - if (firstItem && level == 0) - IsSusp = subItem.CheckSusp(SuspSkipSize); - - if (!subItem.IsSystemItem()) - d._subItems.Add(subItem); - - firstItem = false; - } - for (int i = 0; i < d._subItems.Size(); i++) - ReadDir(d._subItems[i], level + 1); -} - -void CInArchive::CreateRefs(CDir &d) -{ - if (!d.IsDir()) - return; - for (int i = 0; i < d._subItems.Size(); i++) - { - CRef ref; - CDir &subItem = d._subItems[i]; - subItem.Parent = &d; - ref.Dir = &d; - ref.Index = i; - Refs.Add(ref); - CreateRefs(subItem); - } -} - -void CInArchive::ReadBootInfo() -{ - if (!_bootIsDefined) - return; - if (memcmp(_bootDesc.BootSystemId, kElToritoSpec, sizeof(_bootDesc.BootSystemId)) != 0) - return; - - const Byte *p = (const Byte *)_bootDesc.BootSystemUse; - UInt32 blockIndex = p[0] | ((UInt32)p[1] << 8) | ((UInt32)p[2] << 16) | ((UInt32)p[3] << 24); - SeekToBlock(blockIndex); - Byte b = ReadByte(); - if (b != NBootEntryId::kValidationEntry) - return; - { - CBootValidationEntry e; - e.PlatformId = ReadByte(); - if (ReadUInt16Spec() != 0) - throw 1; - ReadBytes(e.Id, sizeof(e.Id)); - /* UInt16 checkSum = */ ReadUInt16Spec(); - if (ReadByte() != 0x55) - throw 1; - if (ReadByte() != 0xAA) - throw 1; - } - b = ReadByte(); - if (b == NBootEntryId::kInitialEntryBootable || b == NBootEntryId::kInitialEntryNotBootable) - { - CBootInitialEntry e; - e.Bootable = (b == NBootEntryId::kInitialEntryBootable); - e.BootMediaType = ReadByte(); - e.LoadSegment = ReadUInt16Spec(); - e.SystemType = ReadByte(); - if (ReadByte() != 0) - throw 1; - e.SectorCount = ReadUInt16Spec(); - e.LoadRBA = ReadUInt32Le(); - if (ReadByte() != 0) - throw 1; - BootEntries.Add(e); - } - else - return; -} - -HRESULT CInArchive::Open2() -{ - Clear(); - RINOK(_stream->Seek(kStartPos, STREAM_SEEK_CUR, &_position)); - - bool primVolDescDefined = false; - m_BufferPos = 0; - BlockSize = kBlockSize; - VolDescs.Add(CVolumeDescriptor()); - for (;;) - { - Byte sig[6]; - ReadBytes(sig, 6); - if (!CheckDescriptorSignature(sig + 1)) - return S_FALSE; - // version = 2 for ISO 9660:1999? - Byte ver = ReadByte(); - if (ver > 2) - throw S_FALSE; - - if (sig[0] == NVolDescType::kTerminator) - break; - switch(sig[0]) - { - case NVolDescType::kBootRecord: - { - _bootIsDefined = true; - ReadBootRecordDescriptor(_bootDesc); - break; - } - case NVolDescType::kPrimaryVol: - { - if (primVolDescDefined) - return S_FALSE; - primVolDescDefined = true; - CVolumeDescriptor &volDesc = VolDescs[0]; - ReadVolumeDescriptor(volDesc); - // some burners write "Joliet" Escape Sequence to primary volume - memset(volDesc.EscapeSequence, 0, sizeof(volDesc.EscapeSequence)); - break; - } - case NVolDescType::kSupplementaryVol: - { - CVolumeDescriptor sd; - ReadVolumeDescriptor(sd); - VolDescs.Add(sd); - break; - } - default: - break; - } - } - MainVolDescIndex = 0; - if (!primVolDescDefined) - return S_FALSE; - for (int i = VolDescs.Size() - 1; i >= 0; i--) - { - if (VolDescs[i].IsJoliet()) - { - MainVolDescIndex = i; - break; - } - } - // MainVolDescIndex = 0; // to read primary volume - if (VolDescs[MainVolDescIndex].LogicalBlockSize != kBlockSize) - return S_FALSE; - (CDirRecord &)_rootDir = VolDescs[MainVolDescIndex].RootDirRecord; - ReadDir(_rootDir, 0); - CreateRefs(_rootDir); - ReadBootInfo(); - return S_OK; -} - -HRESULT CInArchive::Open(IInStream *inStream) -{ - _stream = inStream; - UInt64 pos; - RINOK(_stream->Seek(0, STREAM_SEEK_CUR, &pos)); - RINOK(_stream->Seek(0, STREAM_SEEK_END, &_archiveSize)); - RINOK(_stream->Seek(pos, STREAM_SEEK_SET, &_position)); - HRESULT res = S_FALSE; - try { res = Open2(); } - catch(...) { Clear(); res = S_FALSE; } - _stream.Release(); - return res; -} - -void CInArchive::Clear() -{ - Refs.Clear(); - _rootDir.Clear(); - VolDescs.Clear(); - _bootIsDefined = false; - BootEntries.Clear(); - SuspSkipSize = 0; - IsSusp = false; -} - -}} diff --git a/7zip/Archive/Iso/IsoIn.h b/7zip/Archive/Iso/IsoIn.h deleted file mode 100755 index ab850bd9..00000000 --- a/7zip/Archive/Iso/IsoIn.h +++ /dev/null @@ -1,301 +0,0 @@ -// Archive/IsoIn.h - -#ifndef __ARCHIVE_ISO_IN_H -#define __ARCHIVE_ISO_IN_H - -#include "Common/MyCom.h" -#include "Common/IntToString.h" - -#include "../../IStream.h" - -#include "IsoItem.h" -#include "IsoHeader.h" - -namespace NArchive { -namespace NIso { - -struct CDir: public CDirRecord -{ - CDir *Parent; - CObjectVector _subItems; - - void Clear() - { - Parent = 0; - _subItems.Clear(); - } - - int GetLength(bool checkSusp, int skipSize) const - { - int len = GetLengthCur(checkSusp, skipSize); - if (Parent != 0) - if (Parent->Parent != 0) - len += 1 + Parent->GetLength(checkSusp, skipSize); - return len; - } - - int GetLengthU() const - { - int len = (int)(FileId.GetCapacity() / 2); - if (Parent != 0) - if (Parent->Parent != 0) - len += 1 + Parent->GetLengthU(); - return len; - } - - AString GetPath(bool checkSusp, int skipSize) const - { - AString s; - int len = GetLength(checkSusp, skipSize); - char *p = s.GetBuffer(len + 1); - p += len; - *p = 0; - const CDir *cur = this; - for (;;) - { - int curLen = cur->GetLengthCur(checkSusp, skipSize); - p -= curLen; - memmove(p, (const char *)(const Byte *)cur->GetNameCur(checkSusp, skipSize), curLen); - cur = cur->Parent; - if (cur == 0) - break; - if (cur->Parent == 0) - break; - p--; - *p = CHAR_PATH_SEPARATOR; - } - s.ReleaseBuffer(); - return s; - } - - UString GetPathU() const - { - UString s; - int len = GetLengthU(); - wchar_t *p = s.GetBuffer(len + 1); - p += len; - *p = 0; - const CDir *cur = this; - for (;;) - { - int curLen = (int)(cur->FileId.GetCapacity() / 2); - p -= curLen; - for (int i = 0; i < curLen; i++) - { - Byte b0 = ((const Byte *)cur->FileId)[i * 2]; - Byte b1 = ((const Byte *)cur->FileId)[i * 2 + 1]; - p[i] = (wchar_t)(((wchar_t)b0 << 8) | b1); - } - cur = cur->Parent; - if (cur == 0) - break; - if (cur->Parent == 0) - break; - p--; - *p = WCHAR_PATH_SEPARATOR; - } - s.ReleaseBuffer(); - return s; - } -}; - -struct CDateTime -{ - UInt16 Year; - Byte Month; - Byte Day; - Byte Hour; - Byte Minute; - Byte Second; - Byte Hundredths; - signed char GmtOffset; // min intervals from -48 (West) to +52 (East) recorded. - bool NotSpecified() const { return Year == 0 && Month == 0 && Day == 0 && - Hour == 0 && Minute == 0 && Second == 0 && GmtOffset == 0; } -}; - -struct CBootRecordDescriptor -{ - Byte BootSystemId[32]; // a-characters - Byte BootId[32]; // a-characters - Byte BootSystemUse[1977]; -}; - -struct CBootValidationEntry -{ - Byte PlatformId; - Byte Id[24]; // to identify the manufacturer/developer of the CD-ROM. -}; - -struct CBootInitialEntry -{ - bool Bootable; - Byte BootMediaType; - UInt16 LoadSegment; - /* This is the load segment for the initial boot image. If this - value is 0 the system will use the traditional segment of 7C0. If this value - is non-zero the system will use the specified segment. This applies to x86 - architectures only. For "flat" model architectures (such as Motorola) this - is the address divided by 10. */ - Byte SystemType; // This must be a copy of byte 5 (System Type) from the - // Partition Table found in the boot image. - UInt16 SectorCount; // This is the number of virtual/emulated sectors the system - // will store at Load Segment during the initial boot procedure. - UInt32 LoadRBA; // This is the start address of the virtual disk. CD’s use - // Relative/Logical block addressing. - - UInt64 GetSize() const - { - // if (BootMediaType == NBootMediaType::k1d44Floppy) (1440 << 10); - return SectorCount * 512; - } - - UString GetName() const - { - UString s; - if (Bootable) - s += L"Bootable"; - else - s += L"NotBootable"; - s += L"_"; - if (BootMediaType >= kNumBootMediaTypes) - { - wchar_t name[32]; - ConvertUInt64ToString(BootMediaType, name); - s += name; - } - else - s += kMediaTypes[BootMediaType]; - s += L".img"; - return s; - } -}; - -struct CVolumeDescriptor -{ - Byte VolFlags; - Byte SystemId[32]; // a-characters. An identification of a system - // which can recognize and act upon the content of the Logical - // Sectors with logical Sector Numbers 0 to 15 of the volume. - Byte VolumeId[32]; // d-characters. An identification of the volume. - UInt32 VolumeSpaceSize; // the number of Logical Blocks in which the Volume Space of the volume is recorded - Byte EscapeSequence[32]; - UInt16 VolumeSetSize; - UInt16 VolumeSequenceNumber; // the ordinal number of the volume in the Volume Set of which the volume is a member. - UInt16 LogicalBlockSize; - UInt32 PathTableSize; - UInt32 LPathTableLocation; - UInt32 LOptionalPathTableLocation; - UInt32 MPathTableLocation; - UInt32 MOptionalPathTableLocation; - CDirRecord RootDirRecord; - Byte VolumeSetId[128]; - Byte PublisherId[128]; - Byte DataPreparerId[128]; - Byte ApplicationId[128]; - Byte CopyrightFileId[37]; - Byte AbstractFileId[37]; - Byte BibFileId[37]; - CDateTime CreationTime; - CDateTime ModificationTime; - CDateTime ExpirationTime; - CDateTime EffectiveTime; - Byte FileStructureVersion; // = 1; - Byte ApplicationUse[512]; - - bool IsJoliet() const - { - if ((VolFlags & 1) != 0) - return false; - Byte b = EscapeSequence[2]; - return (EscapeSequence[0] == 0x25 && EscapeSequence[1] == 0x2F && - (b == 0x40 || b == 0x43 || b == 0x45)); - } -}; - -struct CRef -{ - CDir *Dir; - UInt32 Index; -}; - -const UInt32 kBlockSize = 1 << 11; - -class CInArchive -{ - CMyComPtr _stream; - UInt64 _position; - - Byte m_Buffer[kBlockSize]; - UInt32 m_BufferPos; - - CDir _rootDir; - bool _bootIsDefined; - CBootRecordDescriptor _bootDesc; - - HRESULT ReadBytes(void *data, UInt32 size, UInt32 &processedSize); - void Skeep(size_t size); - void SkeepZeros(size_t size); - Byte ReadByte(); - void ReadBytes(Byte *data, UInt32 size); - UInt16 ReadUInt16Spec(); - UInt16 ReadUInt16(); - UInt32 ReadUInt32Le(); - UInt32 ReadUInt32Be(); - UInt32 ReadUInt32(); - UInt64 ReadUInt64(); - UInt32 ReadDigits(int numDigits); - void ReadDateTime(CDateTime &d); - void ReadRecordingDateTime(CRecordingDateTime &t); - void ReadDirRecord2(CDirRecord &r, Byte len); - void ReadDirRecord(CDirRecord &r); - - void ReadBootRecordDescriptor(CBootRecordDescriptor &d); - void ReadVolumeDescriptor(CVolumeDescriptor &d); - - void SeekToBlock(UInt32 blockIndex); - void ReadDir(CDir &d, int level); - void CreateRefs(CDir &d); - - void ReadBootInfo(); - HRESULT Open2(); -public: - HRESULT Open(IInStream *inStream); - void Clear(); - - UInt64 _archiveSize; - - CRecordVector Refs; - CObjectVector VolDescs; - int MainVolDescIndex; - UInt32 BlockSize; - CObjectVector BootEntries; - - - bool IsJoliet() const { return VolDescs[MainVolDescIndex].IsJoliet(); } - - UInt64 GetBootItemSize(int index) const - { - const CBootInitialEntry &be = BootEntries[index]; - UInt64 size = be.GetSize(); - if (be.BootMediaType == NBootMediaType::k1d2Floppy) - size = (1200 << 10); - else if (be.BootMediaType == NBootMediaType::k1d44Floppy) - size = (1440 << 10); - else if (be.BootMediaType == NBootMediaType::k2d88Floppy) - size = (2880 << 10); - UInt64 startPos = be.LoadRBA * BlockSize; - if (startPos < _archiveSize) - { - if (_archiveSize - startPos < size) - size = _archiveSize - startPos; - } - return size; - } - - bool IsSusp; - int SuspSkipSize; -}; - -}} - -#endif diff --git a/7zip/Archive/Iso/IsoItem.h b/7zip/Archive/Iso/IsoItem.h deleted file mode 100755 index 14024d8d..00000000 --- a/7zip/Archive/Iso/IsoItem.h +++ /dev/null @@ -1,145 +0,0 @@ -// Archive/IsoItem.h - -#ifndef __ARCHIVE_ISO_ITEM_H -#define __ARCHIVE_ISO_ITEM_H - -#include "Common/Types.h" -#include "Common/String.h" -#include "Common/Buffer.h" - -#include "IsoHeader.h" - -namespace NArchive { -namespace NIso { - -struct CRecordingDateTime -{ - Byte Year; - Byte Month; - Byte Day; - Byte Hour; - Byte Minute; - Byte Second; - signed char GmtOffset; // min intervals from -48 (West) to +52 (East) recorded. - - bool GetFileTime(FILETIME &ft) const - { - SYSTEMTIME st; - st.wYear = (WORD)(Year + 1900); - st.wMonth = Month; - st.wDayOfWeek = 0; // check it - st.wDay = Day; - st.wHour = Hour; - st.wMinute = Minute; - st.wSecond = Second; - st.wMilliseconds = 0; - if (!SystemTimeToFileTime(&st, &ft)) - return false; - UInt64 value = (((UInt64)ft.dwHighDateTime) << 32) + ft.dwLowDateTime; - value += (UInt64)((Int64)(int)GmtOffset * 15 * 60); - ft.dwLowDateTime = (DWORD)value; - ft.dwHighDateTime = DWORD(value >> 32); - return true; - } -}; - -struct CDirRecord -{ - Byte ExtendedAttributeRecordLen; - UInt32 ExtentLocation; - UInt32 DataLength; - CRecordingDateTime DateTime; - Byte FileFlags; - Byte FileUnitSize; - Byte InterleaveGapSize; - UInt16 VolSequenceNumber; - CByteBuffer FileId; - CByteBuffer SystemUse; - - bool IsDir() const { return (FileFlags & NFileFlags::kDirectory) != 0; } - bool IsSystemItem() const - { - if (FileId.GetCapacity() != 1) - return false; - Byte b = *(const Byte *)FileId; - return (b == 0 || b == 1); - } - - const Byte* FindSuspName(int skipSize, int &lenRes) const - { - lenRes = 0; - const Byte *p = (const Byte *)SystemUse + skipSize; - int length = (int)(SystemUse.GetCapacity() - skipSize); - while (length >= 5) - { - int len = p[2]; - if (p[0] == 'N' && p[1] == 'M' && p[3] == 1) - { - lenRes = len - 5; - return p + 5; - } - p += len; - length -= len; - } - return 0; - } - - int GetLengthCur(bool checkSusp, int skipSize) const - { - if (checkSusp) - { - int len; - const Byte *res = FindSuspName(skipSize, len); - if (res != 0) - return len; - } - return (int)FileId.GetCapacity(); - } - - const Byte* GetNameCur(bool checkSusp, int skipSize) const - { - if (checkSusp) - { - int len; - const Byte *res = FindSuspName(skipSize, len); - if (res != 0) - return res; - } - return (const Byte *)FileId; - } - - - bool CheckSusp(const Byte *p, int &startPos) const - { - if (p[0] == 'S' && - p[1] == 'P' && - p[2] == 0x7 && - p[3] == 0x1 && - p[4] == 0xBE && - p[5] == 0xEF) - { - startPos = p[6]; - return true; - } - return false; - } - - bool CheckSusp(int &startPos) const - { - const Byte *p = (const Byte *)SystemUse; - int length = (int)SystemUse.GetCapacity(); - const int kMinLen = 7; - if (length < kMinLen) - return false; - if (CheckSusp(p, startPos)) - return true; - const int kOffset2 = 14; - if (length < kOffset2 + kMinLen) - return false; - return CheckSusp(p + kOffset2, startPos); - } -}; - -}} - -#endif diff --git a/7zip/Archive/Iso/StdAfx.cpp b/7zip/Archive/Iso/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Archive/Iso/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Archive/Iso/StdAfx.h b/7zip/Archive/Iso/StdAfx.h deleted file mode 100755 index 2e4be10b..00000000 --- a/7zip/Archive/Iso/StdAfx.h +++ /dev/null @@ -1,9 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" -#include "../../../Common/NewHandler.h" - -#endif diff --git a/7zip/Archive/Iso/makefile b/7zip/Archive/Iso/makefile deleted file mode 100755 index 100a3cd0..00000000 --- a/7zip/Archive/Iso/makefile +++ /dev/null @@ -1,55 +0,0 @@ -PROG = iso.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib user32.lib - -TAR_OBJS = \ - $O\DllExports.obj \ - $O\IsoHandler.obj \ - $O\IsoHeader.obj \ - $O\IsoIn.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\IntToString.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\Vector.obj \ - -WIN_OBJS = \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\LimitedStreams.obj \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\ItemNameUtils.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(TAR_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(COMPRESS_TAR_OBJS) \ - $O\CopyCoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(TAR_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) diff --git a/7zip/Archive/Iso/resource.rc b/7zip/Archive/Iso/resource.rc deleted file mode 100755 index 86929b0e..00000000 --- a/7zip/Archive/Iso/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Iso Plugin", "iso") - -101 ICON "iso.ico" diff --git a/7zip/Archive/Lzh/DllExports.cpp b/7zip/Archive/Lzh/DllExports.cpp deleted file mode 100755 index c2b30945..00000000 --- a/7zip/Archive/Lzh/DllExports.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "../../ICoder.h" -#include "LzhHandler.h" - -// {23170F69-40C1-278A-1000-000110060000} -DEFINE_GUID(CLSID_CLzhHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x06, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /* lpReserved */) -{ - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CLzhHandler) - return CLASS_E_CLASSNOTAVAILABLE; - if (*interfaceID != IID_IInArchive) - return E_NOINTERFACE; - CMyComPtr inArchive = (IInArchive *)new NArchive::NLzh::CHandler; - *outObject = inArchive.Detach(); - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Lzh"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CLzhHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"lzh lha"; - break; - case NArchive::kUpdate: - propVariant = false; - break; - case NArchive::kKeepName: - propVariant = false; - break; - case NArchive::kStartSignature: - { - const unsigned char sig[] = { '-', 'l' }; - if ((value->bstrVal = ::SysAllocStringByteLen((const char *)sig, 2)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - } - propVariant.Detach(value); - return S_OK; -} diff --git a/7zip/Archive/Lzh/Lzh.def b/7zip/Archive/Lzh/Lzh.def deleted file mode 100755 index e240b3f2..00000000 --- a/7zip/Archive/Lzh/Lzh.def +++ /dev/null @@ -1,7 +0,0 @@ -; Arj.def - -LIBRARY Arj.dll - -EXPORTS - CreateObject PRIVATE - GetHandlerProperty PRIVATE diff --git a/7zip/Archive/Lzh/Lzh.dsp b/7zip/Archive/Lzh/Lzh.dsp deleted file mode 100755 index ad00699c..00000000 --- a/7zip/Archive/Lzh/Lzh.dsp +++ /dev/null @@ -1,333 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Lzh" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Lzh - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "lzh.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "lzh.mak" CFG="Lzh - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Lzh - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Lzh - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Lzh - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ARJ_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ARJ_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\lzh.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Lzh - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ARJ_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ARJ_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\lzh.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Lzh - Win32 Release" -# Name "Lzh - Win32 Debug" -# Begin Group "spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\LzhCRC.cpp -# End Source File -# Begin Source File - -SOURCE=.\LzhCRC.h -# End Source File -# Begin Source File - -SOURCE=.\LzhHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\LzhHandler.h -# End Source File -# Begin Source File - -SOURCE=.\LzhHeader.h -# End Source File -# Begin Source File - -SOURCE=.\LzhIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\LzhIn.h -# End Source File -# Begin Source File - -SOURCE=.\LzhItem.h -# End Source File -# Begin Source File - -SOURCE=.\LzhOutStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=.\LzhOutStreamWithCRC.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Group "Codecs" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Lzh\LzhDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Lzh\LzhDecoder.h -# End Source File -# End Group -# Begin Group "LZ" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.h -# End Source File -# End Group -# Begin Group "Copy" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "Huffman" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Huffman\HuffmanDecoder.h -# End Source File -# End Group -# End Group -# Begin Group "7zip common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\MSBFDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\lzh.ico -# End Source File -# End Target -# End Project diff --git a/7zip/Archive/Lzh/Lzh.dsw b/7zip/Archive/Lzh/Lzh.dsw deleted file mode 100755 index 41ab2218..00000000 --- a/7zip/Archive/Lzh/Lzh.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "lzh"=.\lzh.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Archive/Lzh/LzhCRC.cpp b/7zip/Archive/Lzh/LzhCRC.cpp deleted file mode 100755 index ca1235bb..00000000 --- a/7zip/Archive/Lzh/LzhCRC.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// LzhCRC.cpp - -#include "StdAfx.h" - -#include "LzhCRC.h" - -namespace NArchive { -namespace NLzh { - -static const UInt16 kCRCPoly = 0xA001; - -UInt16 CCRC::Table[256]; - -void CCRC::InitTable() -{ - for (UInt32 i = 0; i < 256; i++) - { - UInt32 r = i; - for (int j = 0; j < 8; j++) - if (r & 1) - r = (r >> 1) ^ kCRCPoly; - else - r >>= 1; - CCRC::Table[i] = (UInt16)r; - } -} - -class CCRCTableInit -{ -public: - CCRCTableInit() { CCRC::InitTable(); } -} g_CRCTableInit; - -void CCRC::Update(const void *data, size_t size) -{ - UInt16 v = _value; - const Byte *p = (const Byte *)data; - for (; size > 0; size--, p++) - v = (UInt16)(Table[((Byte)(v)) ^ *p] ^ (v >> 8)); - _value = v; -} - -}} diff --git a/7zip/Archive/Lzh/LzhCRC.h b/7zip/Archive/Lzh/LzhCRC.h deleted file mode 100755 index bb5546db..00000000 --- a/7zip/Archive/Lzh/LzhCRC.h +++ /dev/null @@ -1,27 +0,0 @@ -// LzhCRC.h - -#ifndef __LZH_CRC_H -#define __LZH_CRC_H - -#include -#include "Common/Types.h" - -namespace NArchive { -namespace NLzh { - -class CCRC -{ - UInt16 _value; -public: - static UInt16 Table[256]; - static void InitTable(); - - CCRC(): _value(0){}; - void Init() { _value = 0; } - void Update(const void *data, size_t size); - UInt16 GetDigest() const { return _value; } -}; - -}} - -#endif diff --git a/7zip/Archive/Lzh/LzhHandler.cpp b/7zip/Archive/Lzh/LzhHandler.cpp deleted file mode 100755 index 03af11d1..00000000 --- a/7zip/Archive/Lzh/LzhHandler.cpp +++ /dev/null @@ -1,464 +0,0 @@ -// LzhHandler.cpp - -#include "StdAfx.h" - -#include "Common/Defs.h" -#include "Common/StringConvert.h" -#include "Common/ComTry.h" - -#include "Windows/Time.h" -#include "Windows/PropVariant.h" - -#include "LzhHandler.h" -#include "LzhOutStreamWithCRC.h" - -#include "../../ICoder.h" - -#include "../../Common/ProgressUtils.h" -#include "../../Common/LimitedStreams.h" - -#include "../../Compress/Copy/CopyCoder.h" -#include "../../Compress/Lzh/LzhDecoder.h" - -#include "../Common/ItemNameUtils.h" - -using namespace NWindows; -using namespace NTime; - -namespace NArchive { -namespace NLzh{ - -struct COsPair -{ - Byte Id; - const wchar_t *Name; -}; - -COsPair g_OsPairs[] = -{ - { 'M', L"MS-DOS" }, - { '2', L"OS/2" }, - { '9', L"OS9" }, - { 'K', L"OS/68K" }, - { '3', L"OS/386" }, - { 'H', L"HUMAN" }, - { 'U', L"UNIX" }, - { 'C', L"CP/M" }, - { 'F', L"FLEX" }, - { 'm', L"Mac" }, - { 'R', L"Runser" }, - { 'T', L"TownsOS" }, - { 'X', L"XOSK" }, - { 'w', L"Windows95" }, - { 'W', L"WindowsNT" }, - { 0, L"MS-DOS" }, - { 'J', L"Java VM" } -}; - -const wchar_t *kUnknownOS = L"Unknown"; - -const int kNumHostOSes = sizeof(g_OsPairs) / sizeof(g_OsPairs[0]); - -static const wchar_t *GetOS(Byte osId) -{ - for (int i = 0; i < kNumHostOSes; i++) - if (g_OsPairs[i].Id == osId) - return g_OsPairs[i].Name; - return kUnknownOS; -}; - -STATPROPSTG kProperties[] = -{ - { NULL, kpidPath, VT_BSTR}, - { NULL, kpidIsFolder, VT_BOOL}, - { NULL, kpidSize, VT_UI8}, - { NULL, kpidPackedSize, VT_UI8}, - { NULL, kpidLastWriteTime, VT_FILETIME}, - { NULL, kpidAttributes, VT_UI4}, - - // { NULL, kpidCommented, VT_BOOL}, - - { NULL, kpidCRC, VT_UI4}, - - { NULL, kpidMethod, VT_UI1}, - { NULL, kpidHostOS, VT_BSTR} - -}; - - -CHandler::CHandler() -{} - -STDMETHODIMP CHandler::GetArchiveProperty(PROPID /* propID */, PROPVARIANT *value) -{ - value->vt = VT_EMPTY; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties) -{ - *numProperties = sizeof(kProperties) / sizeof(kProperties[0]); - return S_OK; -} - -STDMETHODIMP CHandler::GetPropertyInfo(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) -{ - if(index >= sizeof(kProperties) / sizeof(kProperties[0])) - return E_INVALIDARG; - const STATPROPSTG &srcItem = kProperties[index]; - *propID = srcItem.propid; - *varType = srcItem.vt; - *name = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) -{ - *numProperties = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetArchivePropertyInfo(UInt32 /* index */, - BSTR * /* name */, PROPID * /* propID */, VARTYPE * /* varType */) -{ - return E_NOTIMPL; -} - -STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems) -{ - *numItems = _items.Size(); - return S_OK; -} - -STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) -{ - COM_TRY_BEGIN - NWindows::NCOM::CPropVariant propVariant; - const CItemEx &item = _items[index]; - switch(propID) - { - case kpidPath: - { - UString s = NItemName::WinNameToOSName(MultiByteToUnicodeString(item.GetName(), CP_OEMCP)); - if (!s.IsEmpty()) - { - if (s[s.Length() - 1] == WCHAR_PATH_SEPARATOR) - s.Delete(s.Length() - 1); - propVariant = s; - } - break; - } - case kpidIsFolder: - propVariant = item.IsDirectory(); - break; - case kpidSize: - propVariant = item.Size; - break; - case kpidPackedSize: - propVariant = item.PackSize; - break; - case kpidLastWriteTime: - { - FILETIME utcFileTime; - UInt32 unixTime; - if (item.GetUnixTime(unixTime)) - { - NTime::UnixTimeToFileTime(unixTime, utcFileTime); - } - else - { - FILETIME localFileTime; - if (DosTimeToFileTime(item.ModifiedTime, localFileTime)) - { - if (!LocalFileTimeToFileTime(&localFileTime, &utcFileTime)) - utcFileTime.dwHighDateTime = utcFileTime.dwLowDateTime = 0; - } - else - utcFileTime.dwHighDateTime = utcFileTime.dwLowDateTime = 0; - } - propVariant = utcFileTime; - break; - } - /* - case kpidAttributes: - propVariant = (UInt32)item.Attributes; - break; - case kpidCommented: - propVariant = item.IsCommented(); - break; - */ - case kpidCRC: - propVariant = (UInt32)item.CRC; - break; - case kpidMethod: - { - wchar_t method2[kMethodIdSize + 1]; - method2[kMethodIdSize] = 0; - for (int i = 0; i < kMethodIdSize; i++) - method2[i] = item.Method[i]; - propVariant = method2; - break; - } - case kpidHostOS: - propVariant = GetOS(item.OsId); - break; - } - propVariant.Detach(value); - return S_OK; - COM_TRY_END -} - -/* -class CPropgressImp: public CProgressVirt -{ -public: - CMyComPtr Callback; - STDMETHOD(SetCompleted)(const UInt64 *numFiles); -}; - -STDMETHODIMP CPropgressImp::SetCompleted(const UInt64 *numFiles) -{ - if (Callback) - return Callback->SetCompleted(numFiles, NULL); - return S_OK; -} -*/ - -STDMETHODIMP CHandler::Open(IInStream *inStream, - const UInt64 * /* maxCheckStartPosition */, IArchiveOpenCallback *callback) -{ - COM_TRY_BEGIN - try - { - _items.Clear(); - CInArchive archive; - RINOK(archive.Open(inStream)); - if (callback != NULL) - { - RINOK(callback->SetTotal(NULL, NULL)); - UInt64 numFiles = _items.Size(); - RINOK(callback->SetCompleted(&numFiles, NULL)); - } - for (;;) - { - CItemEx itemInfo; - bool filled; - HRESULT result = archive.GetNextItem(filled, itemInfo); - if (result == S_FALSE) - return S_FALSE; - if (result != S_OK) - return S_FALSE; - if (!filled) - break; - _items.Add(itemInfo); - archive.Skeep(itemInfo.PackSize); - if (callback != NULL) - { - UInt64 numFiles = _items.Size(); - RINOK(callback->SetCompleted(&numFiles, NULL)); - } - } - if (_items.IsEmpty()) - return S_FALSE; - - _stream = inStream; - } - catch(...) - { - return S_FALSE; - } - COM_TRY_END - return S_OK; -} - -STDMETHODIMP CHandler::Close() -{ - _items.Clear(); - _stream.Release(); - return S_OK; -} - - - -////////////////////////////////////// -// CHandler::DecompressItems - -STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, - Int32 testModeSpec, IArchiveExtractCallback *extractCallback) -{ - COM_TRY_BEGIN - bool testMode = (testModeSpec != 0); - UInt64 totalUnPacked = 0, totalPacked = 0; - bool allFilesMode = (numItems == UInt32(-1)); - if (allFilesMode) - numItems = _items.Size(); - if(numItems == 0) - return S_OK; - UInt32 i; - for(i = 0; i < numItems; i++) - { - const CItemEx &itemInfo = _items[allFilesMode ? i : indices[i]]; - totalUnPacked += itemInfo.Size; - totalPacked += itemInfo.PackSize; - } - extractCallback->SetTotal(totalUnPacked); - - UInt64 currentTotalUnPacked = 0, currentTotalPacked = 0; - UInt64 currentItemUnPacked, currentItemPacked; - - NCompress::NLzh::NDecoder::CCoder *lzhDecoderSpec = 0; - CMyComPtr lzhDecoder; - CMyComPtr lzh1Decoder; - CMyComPtr arj2Decoder; - CMyComPtr copyCoder; - - for(i = 0; i < numItems; i++, currentTotalUnPacked += currentItemUnPacked, - currentTotalPacked += currentItemPacked) - { - currentItemUnPacked = 0; - currentItemPacked = 0; - - RINOK(extractCallback->SetCompleted(¤tTotalUnPacked)); - CMyComPtr realOutStream; - Int32 askMode; - askMode = testMode ? NArchive::NExtract::NAskMode::kTest : - NArchive::NExtract::NAskMode::kExtract; - Int32 index = allFilesMode ? i : indices[i]; - const CItemEx &itemInfo = _items[index]; - RINOK(extractCallback->GetStream(index, &realOutStream, askMode)); - - if(itemInfo.IsDirectory()) - { - // if (!testMode) - { - RINOK(extractCallback->PrepareOperation(askMode)); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - } - continue; - } - - if (!testMode && (!realOutStream)) - continue; - - RINOK(extractCallback->PrepareOperation(askMode)); - currentItemUnPacked = itemInfo.Size; - currentItemPacked = itemInfo.PackSize; - - { - COutStreamWithCRC *outStreamSpec = new COutStreamWithCRC; - CMyComPtr outStream(outStreamSpec); - outStreamSpec->Init(realOutStream); - realOutStream.Release(); - - CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream; - CMyComPtr inStream(streamSpec); - - UInt64 pos; - _stream->Seek(itemInfo.DataPosition, STREAM_SEEK_SET, &pos); - - streamSpec->SetStream(_stream); - streamSpec->Init(itemInfo.PackSize); - - - CLocalProgress *localProgressSpec = new CLocalProgress; - CMyComPtr progress = localProgressSpec; - localProgressSpec->Init(extractCallback, false); - - - CLocalCompressProgressInfo *localCompressProgressSpec = - new CLocalCompressProgressInfo; - CMyComPtr compressProgress = localCompressProgressSpec; - localCompressProgressSpec->Init(progress, - ¤tTotalPacked, - ¤tTotalUnPacked); - - HRESULT result; - - if (itemInfo.IsCopyMethod()) - { - if(!copyCoder) - copyCoder = new NCompress::CCopyCoder; - try - { - result = copyCoder->Code(inStream, outStream, NULL, NULL, compressProgress); - if (result == S_FALSE) - throw "data error"; - if (result != S_OK) - return result; - } - catch(...) - { - outStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kDataError)); - continue; - } - } - else if (itemInfo.IsLh4GroupMethod()) - { - if(!lzhDecoder) - { - lzhDecoderSpec = new NCompress::NLzh::NDecoder::CCoder; - lzhDecoder = lzhDecoderSpec; - } - try - { - lzhDecoderSpec->SetDictionary(itemInfo.GetNumDictBits()); - result = lzhDecoder->Code(inStream, outStream, NULL, ¤tItemUnPacked, compressProgress); - if (result == S_FALSE) - throw "data error"; - if (result != S_OK) - return result; - } - catch(...) - { - outStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kDataError)); - continue; - } - } - /* - else if (itemInfo.IsLh1GroupMethod()) - { - if(!lzh1Decoder) - { - lzh1DecoderSpec = new NCompress::NLzh1::NDecoder::CCoder; - lzh1Decoder = lzh1DecoderSpec; - } - try - { - lzh1DecoderSpec->SetDictionary(itemInfo.GetNumDictBits()); - result = lzh1Decoder->Code(inStream, outStream, NULL, ¤tItemUnPacked, compressProgress); - if (result == S_FALSE) - throw "data error"; - if (result != S_OK) - return result; - } - catch(...) - { - outStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kDataError)); - continue; - } - } - */ - else - { - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kUnSupportedMethod)); - continue; - } - - bool crcOK = (outStreamSpec->GetCRC() == itemInfo.CRC); - outStream.Release(); - if(crcOK) - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)) - else - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kCRCError)) - } - } - return S_OK; - COM_TRY_END -} - - -}} diff --git a/7zip/Archive/Lzh/LzhHandler.h b/7zip/Archive/Lzh/LzhHandler.h deleted file mode 100755 index 2dc89494..00000000 --- a/7zip/Archive/Lzh/LzhHandler.h +++ /dev/null @@ -1,47 +0,0 @@ -// LzhHandler.h - -#ifndef __LZH_HANDLER_H -#define __LZH_HANDLER_H - -#include "Common/MyCom.h" -#include "../IArchive.h" -#include "LzhIn.h" - -namespace NArchive { -namespace NLzh { - -class CHandler: - public IInArchive, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP - - STDMETHOD(Open)(IInStream *inStream, - const UInt64 *maxCheckStartPosition, - IArchiveOpenCallback *callback); - STDMETHOD(Close)(); - STDMETHOD(GetNumberOfItems)(UInt32 *numItems); - STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value); - STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems, - Int32 testMode, IArchiveExtractCallback *anExtractCallback); - - STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value); - - STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties); - STDMETHOD(GetPropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - - STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties); - STDMETHOD(GetArchivePropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - - CHandler(); -private: - CObjectVector _items; - CMyComPtr _stream; -}; - -}} - -#endif diff --git a/7zip/Archive/Lzh/LzhHeader.h b/7zip/Archive/Lzh/LzhHeader.h deleted file mode 100755 index 845b9a21..00000000 --- a/7zip/Archive/Lzh/LzhHeader.h +++ /dev/null @@ -1,19 +0,0 @@ -// Archive/Lzh/Header.h - -#ifndef __ARCHIVE_LZH_HEADER_H -#define __ARCHIVE_LZH_HEADER_H - -#include "Common/Types.h" - -namespace NArchive { -namespace NLzh { - -const int kMethodIdSize = 5; - -const Byte kExtIdFileName = 0x01; -const Byte kExtIdDirName = 0x02; -const Byte kExtIdUnixTime = 0x54; - -}} - -#endif diff --git a/7zip/Archive/Lzh/LzhIn.cpp b/7zip/Archive/Lzh/LzhIn.cpp deleted file mode 100755 index 42ef50e4..00000000 --- a/7zip/Archive/Lzh/LzhIn.cpp +++ /dev/null @@ -1,171 +0,0 @@ -// Archive/arj/InEngine.cpp - -#include "StdAfx.h" - -#include "Common/StringConvert.h" -#include "Common/Buffer.h" -#include "Common/CRC.h" - -#include "../../Common/StreamUtils.h" - -#include "LzhIn.h" - -namespace NArchive { -namespace NLzh { - -HRESULT CInArchive::ReadBytes(void *data, UInt32 size, UInt32 &processedSize) -{ - RINOK(ReadStream(m_Stream, data, size, &processedSize)); - m_Position += processedSize; - return S_OK; -} - -HRESULT CInArchive::CheckReadBytes(void *data, UInt32 size) -{ - UInt32 processedSize; - RINOK(ReadBytes(data, size, processedSize)); - return (processedSize == size) ? S_OK: S_FALSE; -} - -HRESULT CInArchive::Open(IInStream *inStream) -{ - RINOK(inStream->Seek(0, STREAM_SEEK_CUR, &m_Position)); - m_Stream = inStream; - return S_OK; -} - -static const Byte *ReadUInt32(const Byte *p, UInt32 &v) -{ - v = 0; - for (int i = 0; i < 4; i++) - v |= ((UInt32)(*p++) << (i * 8)); - return p; -} - -static const Byte *ReadUInt16(const Byte *p, UInt16 &v) -{ - v = 0; - for (int i = 0; i < 2; i++) - v |= ((UInt16)(*p++) << (i * 8)); - return p; -} - -static const Byte *ReadString(const Byte *p, size_t size, AString &s) -{ - s.Empty(); - for (size_t i = 0; i < size; i++) - { - char c = p[i]; - if (c == 0) - break; - s += c; - } - return p + size; -} - -static Byte CalcSum(const Byte *data, size_t size) -{ - Byte sum = 0; - for (size_t i = 0; i < size; i++) - sum = (Byte)(sum + data[i]); - return sum; -} - -HRESULT CInArchive::GetNextItem(bool &filled, CItemEx &item) -{ - filled = false; - - UInt32 processedSize; - Byte startHeader[2]; - RINOK(ReadBytes(startHeader, 2, processedSize)) - if (processedSize == 0) - return S_OK; - if (processedSize == 1) - return (startHeader[0] == 0) ? S_OK: S_FALSE; - if (startHeader[0] == 0 && startHeader[1] == 0) - return S_OK; - - Byte header[256]; - const UInt32 kBasicPartSize = 22; - RINOK(ReadBytes(header, kBasicPartSize, processedSize)); - if (processedSize != kBasicPartSize) - return (startHeader[0] == 0) ? S_OK: S_FALSE; - - const Byte *p = header; - memmove(item.Method, p, kMethodIdSize); - if (!item.IsValidMethod()) - return S_OK; - p += kMethodIdSize; - p = ReadUInt32(p, item.PackSize); - p = ReadUInt32(p, item.Size); - p = ReadUInt32(p, item.ModifiedTime); - item.Attributes = *p++; - item.Level = *p++; - if (item.Level > 2) - return S_FALSE; - UInt32 headerSize; - if (item.Level < 2) - { - headerSize = startHeader[0]; - if (headerSize < kBasicPartSize) - return S_FALSE; - UInt32 remain = headerSize - kBasicPartSize; - RINOK(CheckReadBytes(header + kBasicPartSize, remain)); - if (startHeader[1] != CalcSum(header, headerSize)) - return S_FALSE; - size_t nameLength = *p++; - if ((p - header) + nameLength + 2 > headerSize) - return S_FALSE; - p = ReadString(p, nameLength, item.Name); - } - else - headerSize = startHeader[0] | ((UInt32)startHeader[1] << 8); - p = ReadUInt16(p, item.CRC); - if (item.Level != 0) - { - if (item.Level == 2) - { - RINOK(CheckReadBytes(header + kBasicPartSize, 2)); - } - if ((size_t)(p - header) + 3 > headerSize) - return S_FALSE; - item.OsId = *p++; - UInt16 nextSize; - p = ReadUInt16(p, nextSize); - while (nextSize != 0) - { - if (nextSize < 3) - return S_FALSE; - if (item.Level == 1) - { - if (item.PackSize < nextSize) - return S_FALSE; - item.PackSize -= nextSize; - } - CExtension ext; - RINOK(CheckReadBytes(&ext.Type, 1)) - nextSize -= 3; - ext.Data.SetCapacity(nextSize); - RINOK(CheckReadBytes((Byte *)ext.Data, nextSize)) - item.Extensions.Add(ext); - Byte hdr2[2]; - RINOK(CheckReadBytes(hdr2, 2)); - ReadUInt16(hdr2, nextSize); - } - } - item.DataPosition = m_Position; - filled = true; - return S_OK; -} - -HRESULT CInArchive::Skeep(UInt64 numBytes) -{ - UInt64 newPostion; - RINOK(m_Stream->Seek(numBytes, STREAM_SEEK_CUR, &newPostion)); - m_Position += numBytes; - if (m_Position != newPostion) - return E_FAIL; - return S_OK; -} - -}} diff --git a/7zip/Archive/Lzh/LzhIn.h b/7zip/Archive/Lzh/LzhIn.h deleted file mode 100755 index 344a133f..00000000 --- a/7zip/Archive/Lzh/LzhIn.h +++ /dev/null @@ -1,29 +0,0 @@ -// Archive/LzhIn.h - -#ifndef __ARCHIVE_LZHIN_H -#define __ARCHIVE_LZHIN_H - -#include "Common/MyCom.h" -#include "../../IStream.h" - -#include "LzhItem.h" - -namespace NArchive { -namespace NLzh { - -class CInArchive -{ - CMyComPtr m_Stream; - UInt64 m_Position; - - HRESULT ReadBytes(void *data, UInt32 size, UInt32 &processedSize); - HRESULT CheckReadBytes(void *data, UInt32 size); -public: - HRESULT Open(IInStream *inStream); - HRESULT GetNextItem(bool &filled, CItemEx &itemInfo); - HRESULT Skeep(UInt64 numBytes); -}; - -}} - -#endif diff --git a/7zip/Archive/Lzh/LzhItem.h b/7zip/Archive/Lzh/LzhItem.h deleted file mode 100755 index 66d4ed75..00000000 --- a/7zip/Archive/Lzh/LzhItem.h +++ /dev/null @@ -1,172 +0,0 @@ -// Archive/LzhItem.h - -#ifndef __ARCHIVE_LZH_ITEM_H -#define __ARCHIVE_LZH_ITEM_H - -#include "Common/Types.h" -#include "Common/String.h" -#include "Common/Buffer.h" -#include "LzhHeader.h" - -namespace NArchive { -namespace NLzh { - -struct CExtension -{ - Byte Type; - CByteBuffer Data; - AString GetString() const - { - AString s; - for (size_t i = 0; i < Data.GetCapacity(); i++) - { - char c = (char)Data[i]; - if (c == 0) - break; - s += c; - } - return s; - } -}; - -struct CItem -{ -public: - AString Name; - Byte Method[kMethodIdSize]; - UInt32 PackSize; - UInt32 Size; - UInt32 ModifiedTime; - Byte Attributes; - Byte Level; - UInt16 CRC; - Byte OsId; - CObjectVector Extensions; - - bool IsValidMethod() const { return (Method[0] == '-' && Method[1] == 'l' && Method[4] == '-'); } - bool IsLhMethod() const {return (IsValidMethod() && Method[2] == 'h'); } - bool IsDirectory() const {return (IsLhMethod() && Method[3] == 'd'); } - - bool IsCopyMethod() const - { - return (IsLhMethod() && Method[3] == '0') || - (IsValidMethod() && Method[2] == 'z' && Method[3] == '4'); - } - - bool IsLh1GroupMethod() const - { - if (!IsLhMethod()) - return false; - switch(Method[3]) - { - case '1': - return true; - } - return false; - } - - bool IsLh4GroupMethod() const - { - if (!IsLhMethod()) - return false; - switch(Method[3]) - { - case '4': - case '5': - case '6': - case '7': - return true; - } - return false; - } - - int GetNumDictBits() const - { - if (!IsLhMethod()) - return 0; - switch(Method[3]) - { - case '1': - return 12; - case '2': - return 13; - case '3': - return 13; - case '4': - return 12; - case '5': - return 13; - case '6': - return 15; - case '7': - return 16; - } - return 0; - } - - int FindExt(Byte type) const - { - for (int i = 0; i < Extensions.Size(); i++) - if (Extensions[i].Type == type) - return i; - return -1; - } - bool GetUnixTime(UInt32 &value) const - { - int index = FindExt(kExtIdUnixTime); - if (index < 0) - { - if (Level == 2) - { - value = ModifiedTime; - return true; - } - return false; - } - const Byte *data = (const Byte *)(Extensions[index].Data); - value = data[0] | - ((UInt32)data[1] << 8) | - ((UInt32)data[2] << 16) | - ((UInt32)data[3] << 24); - return true; - } - - AString GetDirName() const - { - int index = FindExt(kExtIdDirName); - if (index < 0) - return AString(); - return Extensions[index].GetString(); - } - - AString GetFileName() const - { - int index = FindExt(kExtIdFileName); - if (index < 0) - return Name; - return Extensions[index].GetString(); - } - - AString GetName() const - { - AString dirName = GetDirName(); - dirName.Replace((char)(unsigned char)0xFF, '\\'); - if (!dirName.IsEmpty()) - { - char c = dirName[dirName.Length() - 1]; - if (c != '\\') - dirName += '\\'; - } - return dirName + GetFileName(); - } -}; - -class CItemEx: public CItem -{ -public: - UInt64 DataPosition; -}; - -}} - -#endif diff --git a/7zip/Archive/Lzh/LzhOutStreamWithCRC.cpp b/7zip/Archive/Lzh/LzhOutStreamWithCRC.cpp deleted file mode 100755 index 2281a884..00000000 --- a/7zip/Archive/Lzh/LzhOutStreamWithCRC.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// LzhOutStreamWithCRC.cpp - -#include "StdAfx.h" - -#include "LzhOutStreamWithCRC.h" - -namespace NArchive { -namespace NLzh { - -STDMETHODIMP COutStreamWithCRC::Write(const void *data, UInt32 size, UInt32 *processedSize) -{ - UInt32 realProcessedSize; - HRESULT result; - if(!_stream) - { - realProcessedSize = size; - result = S_OK; - } - else - result = _stream->Write(data, size, &realProcessedSize); - _crc.Update(data, realProcessedSize); - if(processedSize != NULL) - *processedSize = realProcessedSize; - return result; -} - -}} diff --git a/7zip/Archive/Lzh/LzhOutStreamWithCRC.h b/7zip/Archive/Lzh/LzhOutStreamWithCRC.h deleted file mode 100755 index 31b536b7..00000000 --- a/7zip/Archive/Lzh/LzhOutStreamWithCRC.h +++ /dev/null @@ -1,38 +0,0 @@ -// LzhOutStreamWithCRC.h - -#ifndef __LZHOUTSTREAMWITHCRC_H -#define __LZHOUTSTREAMWITHCRC_H - -#include "LzhCRC.h" -#include "../../../Common/MyCom.h" -#include "../../IStream.h" - -namespace NArchive { -namespace NLzh { - -class COutStreamWithCRC: - public ISequentialOutStream, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP - - STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); -private: - CCRC _crc; - CMyComPtr _stream; -public: - void Init(ISequentialOutStream *stream) - { - _stream = stream; - _crc.Init(); - } - void ReleaseStream() { _stream.Release(); } - UInt32 GetCRC() const { return _crc.GetDigest(); } - void InitCRC() { _crc.Init(); } - -}; - -}} - -#endif diff --git a/7zip/Archive/Lzh/StdAfx.cpp b/7zip/Archive/Lzh/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Archive/Lzh/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Archive/Lzh/StdAfx.h b/7zip/Archive/Lzh/StdAfx.h deleted file mode 100755 index e7fb6986..00000000 --- a/7zip/Archive/Lzh/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Archive/Lzh/lzh.ico b/7zip/Archive/Lzh/lzh.ico deleted file mode 100755 index 84dab49c..00000000 Binary files a/7zip/Archive/Lzh/lzh.ico and /dev/null differ diff --git a/7zip/Archive/Lzh/makefile b/7zip/Archive/Lzh/makefile deleted file mode 100755 index 6f8fd2a0..00000000 --- a/7zip/Archive/Lzh/makefile +++ /dev/null @@ -1,65 +0,0 @@ -PROG = lzh.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib user32.lib - -LZH_OBJS = \ - $O\DllExports.obj \ - $O\LzhCRC.obj \ - $O\LzhHandler.obj \ - $O\LzhIn.obj \ - $O\LzhOutStreamWithCRC.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\Vector.obj \ - -WIN_OBJS = \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\InBuffer.obj \ - $O\LimitedStreams.obj \ - $O\OutBuffer.obj \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\ItemNameUtils.obj \ - -COMPRESS_LZH_OBJS = \ - $O\LzhDecoder.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(LZH_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(COMPRESS_LZH_OBJS) \ - $O\CopyCoder.obj \ - $O\LZOutWindow.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(LZH_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$(COMPRESS_LZH_OBJS): ../../Compress/Lzh/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) -$O\LZOutWindow.obj: ../../Compress/LZ/$(*B).cpp - $(COMPL) diff --git a/7zip/Archive/Lzh/resource.rc b/7zip/Archive/Lzh/resource.rc deleted file mode 100755 index 2870e520..00000000 --- a/7zip/Archive/Lzh/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Lzh Plugin", "lzh") - -101 ICON "lzh.ico" diff --git a/7zip/Archive/Nsis/DllExports.cpp b/7zip/Archive/Nsis/DllExports.cpp deleted file mode 100755 index f10f56ea..00000000 --- a/7zip/Archive/Nsis/DllExports.cpp +++ /dev/null @@ -1,110 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "../../ICoder.h" -#include "NsisHandler.h" - -// {23170F69-40C1-278A-1000-000110090000} -DEFINE_GUID(CLSID_CNsisHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x09, 0x00, 0x00); - -HINSTANCE g_hInstance; -#ifndef _UNICODE -bool g_IsNT = false; -static bool IsItWindowsNT() -{ - OSVERSIONINFO versionInfo; - versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); - if (!::GetVersionEx(&versionInfo)) - return false; - return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT); -} -#endif - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - if (dwReason == DLL_PROCESS_ATTACH) - { - g_hInstance = hInstance; - #ifndef _UNICODE - g_IsNT = IsItWindowsNT(); - #endif - } - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CNsisHandler) - return CLASS_E_CLASSNOTAVAILABLE; - int needIn = *interfaceID == IID_IInArchive; - // int needOut = *interfaceID == IID_IOutArchive; - if (needIn /*|| needOut */) - { - NArchive::NNsis::CHandler *temp = new NArchive::NNsis::CHandler; - if (needIn) - { - CMyComPtr inArchive = (IInArchive *)temp; - *outObject = inArchive.Detach(); - } - /* - else - { - CMyComPtr outArchive = (IOutArchive *)temp; - *outObject = outArchive.Detach(); - } - */ - } - else - return E_NOINTERFACE; - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Nsis"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CNsisHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"exe"; - break; - case NArchive::kUpdate: - propVariant = false; - break; - case NArchive::kStartSignature: - { - if ((value->bstrVal = ::SysAllocStringByteLen((const char *)NArchive::NNsis::kSignature, - NArchive::NNsis::kSignatureSize)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kAssociate: - { - propVariant = false; - break; - } - } - propVariant.Detach(value); - return S_OK; -} diff --git a/7zip/Archive/Nsis/Nsis.dsp b/7zip/Archive/Nsis/Nsis.dsp deleted file mode 100755 index 45ce0386..00000000 --- a/7zip/Archive/Nsis/Nsis.dsp +++ /dev/null @@ -1,337 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Nsis" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Nsis - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Nsis.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Nsis.mak" CFG="Nsis - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Nsis - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Nsis - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Nsis - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\nsis.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Nsis - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\nsis.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Nsis - Win32 Release" -# Name "Nsis - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\Nsis.ico -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\NsisDecode.cpp -# End Source File -# Begin Source File - -SOURCE=.\NsisDecode.h -# End Source File -# Begin Source File - -SOURCE=.\NsisHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\NsisHandler.h -# End Source File -# Begin Source File - -SOURCE=.\NsisIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\NsisIn.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\CodecsPath.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\CodecsPath.h -# End Source File -# Begin Source File - -SOURCE=..\Common\CoderLoader.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\CoderLoader.h -# End Source File -# Begin Source File - -SOURCE=..\Common\FilterCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\FilterCoder.h -# End Source File -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.h -# End Source File -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "7z" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\7z\7zMethodID.cpp -# End Source File -# Begin Source File - -SOURCE=..\7z\7zMethodID.h -# End Source File -# Begin Source File - -SOURCE=..\7z\7zMethods.cpp -# End Source File -# Begin Source File - -SOURCE=..\7z\7zMethods.h -# End Source File -# End Group -# End Target -# End Project diff --git a/7zip/Archive/Nsis/Nsis.dsw b/7zip/Archive/Nsis/Nsis.dsw deleted file mode 100755 index d3df6d27..00000000 --- a/7zip/Archive/Nsis/Nsis.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Nsis"=.\Nsis.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Archive/Nsis/NsisDecode.cpp b/7zip/Archive/Nsis/NsisDecode.cpp deleted file mode 100755 index d49b2312..00000000 --- a/7zip/Archive/Nsis/NsisDecode.cpp +++ /dev/null @@ -1,150 +0,0 @@ -// NsisDecode.cpp - -#include "StdAfx.h" - -#include "NsisDecode.h" - -#include "../../Common/StreamUtils.h" - -#include "../7z/7zMethods.h" - -namespace NArchive { -namespace NNsis { - -static const N7z::CMethodID k_Copy = { { 0x0 }, 1 }; -static const N7z::CMethodID k_Deflate = { { 0x4, 0x9, 0x1 }, 3 }; -static const N7z::CMethodID k_BZip2 = { { 0x4, 0x9, 0x2 }, 3 }; -static const N7z::CMethodID k_LZMA = { { 0x3, 0x1, 0x1 }, 3 }; -static const N7z::CMethodID k_BCJ_X86 = { { 0x3, 0x3, 0x1, 0x3 }, 4 }; - -CDecoder::CDecoder() -{ - N7z::LoadMethodMap(); -} - -HRESULT CDecoder::Init(IInStream *inStream, NMethodType::EEnum method, bool thereIsFilterFlag, bool &useFilter) -{ - useFilter = false; - CObjectVector< CMyComPtr > inStreams; - - if (_decoderInStream) - if (method != _method) - Release(); - _method = method; - if (!_codecInStream) - { - const NArchive::N7z::CMethodID *methodID = 0; - switch (method) - { - case NMethodType::kCopy: - methodID = &k_Copy; - break; - case NMethodType::kDeflate: - methodID = &k_Deflate; - break; - case NMethodType::kBZip2: - methodID = &k_BZip2; - break; - case NMethodType::kLZMA: - methodID = &k_LZMA; - break; - default: - return E_NOTIMPL; - } - N7z::CMethodInfo methodInfo; - if (!N7z::GetMethodInfo(*methodID, methodInfo)) - return E_NOTIMPL; - CMyComPtr coder; - RINOK(_libraries.CreateCoder(methodInfo.FilePath, methodInfo.Decoder, &coder)); - coder.QueryInterface(IID_ISequentialInStream, &_codecInStream); - if (!_codecInStream) - return E_NOTIMPL; - } - - if (thereIsFilterFlag) - { - UInt32 processedSize; - BYTE flag; - RINOK(inStream->Read(&flag, 1, &processedSize)); - if (processedSize != 1) - return E_FAIL; - if (flag > 1) - return E_NOTIMPL; - useFilter = (flag != 0); - } - - if (useFilter) - { - if (!_filterInStream) - { - N7z::CMethodInfo methodInfo; - if (!N7z::GetMethodInfo(k_BCJ_X86, methodInfo)) - return E_NOTIMPL; - CMyComPtr coder; - RINOK(_libraries.CreateCoderSpec(methodInfo.FilePath, methodInfo.Decoder, &coder)); - coder.QueryInterface(IID_ISequentialInStream, &_filterInStream); - if (!_filterInStream) - return E_NOTIMPL; - } - CMyComPtr setInStream; - _filterInStream.QueryInterface(IID_ICompressSetInStream, &setInStream); - if (!setInStream) - return E_NOTIMPL; - RINOK(setInStream->SetInStream(_codecInStream)); - _decoderInStream = _filterInStream; - } - else - _decoderInStream = _codecInStream; - - if (method == NMethodType::kLZMA) - { - CMyComPtr setDecoderProperties; - _codecInStream.QueryInterface(IID_ICompressSetDecoderProperties2, &setDecoderProperties); - if (setDecoderProperties) - { - static const UInt32 kPropertiesSize = 5; - BYTE properties[kPropertiesSize]; - UInt32 processedSize; - RINOK(inStream->Read(properties, kPropertiesSize, &processedSize)); - if (processedSize != kPropertiesSize) - return E_FAIL; - RINOK(setDecoderProperties->SetDecoderProperties2((const Byte *)properties, kPropertiesSize)); - } - } - - { - CMyComPtr setInStream; - _codecInStream.QueryInterface(IID_ICompressSetInStream, &setInStream); - if (!setInStream) - return E_NOTIMPL; - RINOK(setInStream->SetInStream(inStream)); - } - - { - CMyComPtr setOutStreamSize; - _codecInStream.QueryInterface(IID_ICompressSetOutStreamSize, &setOutStreamSize); - if (!setOutStreamSize) - return E_NOTIMPL; - RINOK(setOutStreamSize->SetOutStreamSize(NULL)); - } - - if (useFilter) - { - /* - CMyComPtr setOutStreamSize; - _filterInStream.QueryInterface(IID_ICompressSetOutStreamSize, &setOutStreamSize); - if (!setOutStreamSize) - return E_NOTIMPL; - RINOK(setOutStreamSize->SetOutStreamSize(NULL)); - */ - } - - return S_OK; -} - -HRESULT CDecoder::Read(void *data, UInt32 size, UInt32 *processedSize) -{ - return ReadStream(_decoderInStream, data, size, processedSize);; -} - -}} diff --git a/7zip/Archive/Nsis/NsisDecode.h b/7zip/Archive/Nsis/NsisDecode.h deleted file mode 100755 index 1bec178f..00000000 --- a/7zip/Archive/Nsis/NsisDecode.h +++ /dev/null @@ -1,47 +0,0 @@ -// NsisDecode.h - -#ifndef __NSIS_DECODE_H -#define __NSIS_DECODE_H - -#include "../../IStream.h" - -#include "../Common/CoderLoader.h" - -namespace NArchive { -namespace NNsis { - -namespace NMethodType -{ - enum EEnum - { - kCopy, - kDeflate, - kBZip2, - kLZMA - }; -} - -class CDecoder -{ - NMethodType::EEnum _method; - CCoderLibraries _libraries; - - CMyComPtr _filterInStream; - CMyComPtr _codecInStream; - CMyComPtr _decoderInStream; - -public: - CDecoder(); - void Release() - { - _filterInStream.Release(); - _codecInStream.Release(); - _decoderInStream.Release(); - } - HRESULT Init(IInStream *inStream, NMethodType::EEnum method, bool thereIsFilterFlag, bool &useFilter); - HRESULT Read(void *data, UInt32 size, UInt32 *processedSize); -}; - -}} - -#endif diff --git a/7zip/Archive/Nsis/NsisHandler.cpp b/7zip/Archive/Nsis/NsisHandler.cpp deleted file mode 100755 index 0d840479..00000000 --- a/7zip/Archive/Nsis/NsisHandler.cpp +++ /dev/null @@ -1,484 +0,0 @@ -// NSisHandler.cpp - -#include "StdAfx.h" - -#include "NsisHandler.h" - -#include "Common/StringConvert.h" -#include "Common/IntToString.h" -#include "Common/NewHandler.h" -#include "Common/ComTry.h" - -#include "Windows/PropVariant.h" - -#include "../Common/ItemNameUtils.h" - -using namespace NWindows; - -namespace NArchive { -namespace NNsis { - -static const wchar_t *kBcjMethod = L"BCJ"; -static const wchar_t *kUnknownMethod = L"Unknown"; - -static const wchar_t *kMethods[] = -{ - L"Copy", - L"Deflate", - L"BZip2", - L"LZMA" -}; - -static const int kNumMethods = sizeof(kMethods) / sizeof(kMethods[0]); - -STATPROPSTG kProperties[] = -{ - { NULL, kpidPath, VT_BSTR}, - { NULL, kpidIsFolder, VT_BOOL}, - { NULL, kpidSize, VT_UI8}, - { NULL, kpidPackedSize, VT_UI8}, - { NULL, kpidLastWriteTime, VT_FILETIME}, - { NULL, kpidMethod, VT_BSTR}, - { NULL, kpidSolid, VT_BOOL} -}; - -STDMETHODIMP CHandler::GetArchiveProperty(PROPID /* propID */, PROPVARIANT *value) -{ - value->vt = VT_EMPTY; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties) -{ - *numProperties = sizeof(kProperties) / sizeof(kProperties[0]); - return S_OK; -} - -STDMETHODIMP CHandler::GetPropertyInfo(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) -{ - if(index >= sizeof(kProperties) / sizeof(kProperties[0])) - return E_INVALIDARG; - const STATPROPSTG &srcItem = kProperties[index]; - *propID = srcItem.propid; - *varType = srcItem.vt; - *name = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) -{ - *numProperties = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetArchivePropertyInfo(UInt32 /* index */, - BSTR * /* name */, PROPID * /* propID */, VARTYPE * /* varType */) -{ - return E_INVALIDARG; -} - -STDMETHODIMP CHandler::Open(IInStream *stream, const UInt64 * maxCheckStartPosition, IArchiveOpenCallback * /* openArchiveCallback */) -{ - COM_TRY_BEGIN - Close(); - { - if(_archive.Open(stream, maxCheckStartPosition) != S_OK) - return S_FALSE; - _inStream = stream; - } - return S_OK; - COM_TRY_END -} - -STDMETHODIMP CHandler::Close() -{ - _archive.Clear(); - _archive.Release(); - _inStream.Release(); - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems) -{ - *numItems = _archive.Items.Size() - #ifdef NSIS_SCRIPT - + 1 - #endif - ; - return S_OK; -} - -static UString ConvertUInt32ToString(UInt32 value) -{ - wchar_t buffer[32]; - ConvertUInt64ToString(value, buffer); - return buffer; -} - -static UString GetStringForSizeValue(UInt32 value) -{ - for (int i = 31; i >= 0; i--) - if ((UInt32(1) << i) == value) - return ConvertUInt32ToString(i); - UString result; - if (value % (1 << 20) == 0) - { - result += ConvertUInt32ToString(value >> 20); - result += L"m"; - } - else if (value % (1 << 10) == 0) - { - result += ConvertUInt32ToString(value >> 10); - result += L"k"; - } - else - { - result += ConvertUInt32ToString(value); - result += L"b"; - } - return result; -} - -bool CHandler::GetUncompressedSize(int index, UInt32 &size) -{ - size = 0; - const CItem &item = _archive.Items[index]; - if (item.SizeIsDefined) - size = item.Size; - else if (_archive.IsSolid && item.EstimatedSizeIsDefined) - size = item.EstimatedSize; - else - return false; - return true; -} - -bool CHandler::GetCompressedSize(int index, UInt32 &size) -{ - size = 0; - const CItem &item = _archive.Items[index]; - if (item.CompressedSizeIsDefined) - size = item.CompressedSize; - else - { - if (_archive.IsSolid) - { - if (index == 0) - size = _archive.FirstHeader.GetDataSize(); - else - return false; - } - else - { - if (!item.IsCompressed) - size = item.Size; - else - return false; - } - } - return true; -} - - -STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) -{ - COM_TRY_BEGIN - NWindows::NCOM::CPropVariant propVariant; - #ifdef NSIS_SCRIPT - if (index >= (UInt32)_archive.Items.Size()) - { - switch(propID) - { - case kpidPath: - propVariant = L"[NSIS].nsi"; - break; - case kpidIsFolder: - propVariant = false; - break; - case kpidSize: - case kpidPackedSize: - propVariant = (UInt64)_archive.Script.Length(); - break; - case kpidSolid: - propVariant = false; - break; - } - } - else - #endif - { - const CItem &item = _archive.Items[index]; - switch(propID) - { - case kpidPath: - { - const UString s = NItemName::WinNameToOSName(MultiByteToUnicodeString(item.GetReducedName(), CP_ACP)); - propVariant = (const wchar_t *)s; - break; - } - case kpidIsFolder: - propVariant = false; - break; - case kpidSize: - { - UInt32 size; - if (GetUncompressedSize(index, size)) - propVariant = (UInt64)size; - break; - } - case kpidPackedSize: - { - UInt32 size; - if (GetCompressedSize(index, size)) - propVariant = (UInt64)size; - break; - } - case kpidLastWriteTime: - { - if (item.DateTime.dwHighDateTime > 0x01000000 && - item.DateTime.dwHighDateTime < 0xFF000000) - propVariant = item.DateTime; - break; - } - case kpidMethod: - { - NMethodType::EEnum methodIndex = _archive.Method; - UString method; - if (_archive.IsSolid && _archive.UseFilter || !_archive.IsSolid && item.UseFilter) - { - method += kBcjMethod; - method += L" "; - } - method += (methodIndex < kNumMethods) ? kMethods[methodIndex] : kUnknownMethod; - if (methodIndex == NMethodType::kLZMA) - { - method += L":"; - method += GetStringForSizeValue(_archive.IsSolid ? _archive.DictionarySize: item.DictionarySize); - } - propVariant = method; - break; - } - case kpidSolid: - propVariant = _archive.IsSolid; - break; - } - } - propVariant.Detach(value); - return S_OK; - COM_TRY_END -} - -STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, - Int32 _aTestMode, IArchiveExtractCallback *extractCallback) -{ - COM_TRY_BEGIN - bool testMode = (_aTestMode != 0); - bool allFilesMode = (numItems == UInt32(-1)); - if (allFilesMode) - GetNumberOfItems(&numItems); - if(numItems == 0) - return S_OK; - UInt64 totalSize = 0; - - UInt32 i; - for(i = 0; i < numItems; i++) - { - UInt32 index = (allFilesMode ? i : indices[i]); - #ifdef NSIS_SCRIPT - if (index >= (UInt32)_archive.Items.Size()) - totalSize += _archive.Script.Length(); - else - #endif - { - UInt32 size; - if (_archive.IsSolid) - { - GetUncompressedSize(index, size); - UInt64 pos = _archive.GetPosOfSolidItem(index); - if (pos > totalSize) - totalSize = pos + size; - } - else - { - GetCompressedSize(index, size); - totalSize += size; - } - } - } - extractCallback->SetTotal(totalSize); - - UInt64 currentTotalSize = 0; - UInt32 currentItemSize = 0; - - UInt64 streamPos = 0; - if (_archive.IsSolid) - { - RINOK(_inStream->Seek(_archive.StreamOffset, STREAM_SEEK_SET, NULL)); - bool useFilter; - RINOK(_archive.Decoder.Init(_inStream, _archive.Method, _archive.FilterFlag, useFilter)); - } - - bool dataError = false; - for (i = 0; i < numItems; i++, currentTotalSize += currentItemSize) - { - currentItemSize = 0; - RINOK(extractCallback->SetCompleted(¤tTotalSize)); - CMyComPtr realOutStream; - Int32 askMode; - askMode = testMode ? NArchive::NExtract::NAskMode::kTest : NArchive::NExtract::NAskMode::kExtract; - UInt32 index = allFilesMode ? i : indices[i]; - - RINOK(extractCallback->GetStream(index, &realOutStream, askMode)); - - #ifdef NSIS_SCRIPT - if (index >= (UInt32)_archive.Items.Size()) - { - currentItemSize = _archive.Script.Length(); - if(!testMode && (!realOutStream)) - continue; - RINOK(extractCallback->PrepareOperation(askMode)); - if (!testMode) - RINOK(realOutStream->Write((const char *)_archive.Script, (UInt32)_archive.Script.Length(), NULL)); - } - else - #endif - { - const CItem &item = _archive.Items[index]; - - if (_archive.IsSolid) - GetUncompressedSize(index, currentItemSize); - else - GetCompressedSize(index, currentItemSize); - - if(!testMode && (!realOutStream)) - continue; - - RINOK(extractCallback->PrepareOperation(askMode)); - - if (!dataError) - { - bool needDecompress = false; - bool sizeIsKnown = false; - UInt32 fullSize = 0; - - const UInt32 kBufferLength = 1 << 11; - Byte buffer[kBufferLength]; - - if (_archive.IsSolid) - { - UInt64 pos = _archive.GetPosOfSolidItem(index); - while(streamPos < pos) - { - UInt32 curSize = (UInt32)MyMin(pos - streamPos, (UInt64)kBufferLength); - UInt32 processedSize; - HRESULT res = _archive.Decoder.Read(buffer, curSize, &processedSize); - if (res != S_OK) - { - if (res != S_FALSE) - return res; - dataError = true; - break; - } - if (processedSize == 0) - { - dataError = true; - break; - } - streamPos += processedSize; - } - if (streamPos == pos) - { - UInt32 processedSize; - RINOK(_archive.Decoder.Read(buffer, 4, &processedSize)); - if (processedSize != 4) - return E_FAIL; - streamPos += processedSize; - fullSize = GetUInt32FromMemLE(buffer); - sizeIsKnown = true; - needDecompress = true; - } - } - else - { - RINOK(_inStream->Seek(_archive.GetPosOfNonSolidItem(index) + 4, STREAM_SEEK_SET, NULL)); - if (item.IsCompressed) - { - needDecompress = true; - bool useFilter; - RINOK(_archive.Decoder.Init(_inStream, _archive.Method, _archive.FilterFlag, useFilter)); - fullSize = GetUInt32FromMemLE(buffer); - } - else - fullSize = item.Size; - } - if (!dataError) - { - if (needDecompress) - { - UInt64 offset = 0; - while(!sizeIsKnown || fullSize > 0) - { - UInt32 curSize = kBufferLength; - if (sizeIsKnown && curSize > fullSize) - curSize = fullSize; - UInt32 processedSize; - HRESULT res = _archive.Decoder.Read(buffer, curSize, &processedSize); - if (res != S_OK) - { - if (res != S_FALSE) - return res; - dataError = true; - break; - } - if (processedSize == 0) - { - if (sizeIsKnown) - dataError = true; - break; - } - - fullSize -= processedSize; - streamPos += processedSize; - offset += processedSize; - - UInt64 completed; - if (_archive.IsSolid) - completed = streamPos; - else - completed = currentTotalSize + offset; - RINOK(extractCallback->SetCompleted(&completed)); - if (!testMode) - RINOK(realOutStream->Write(buffer, processedSize, NULL)); - } - } - else - { - while(fullSize > 0) - { - UInt32 curSize = MyMin(fullSize, kBufferLength); - UInt32 processedSize; - RINOK(_inStream->Read(buffer, curSize, &processedSize)); - if (processedSize == 0) - { - dataError = true; - break; - } - fullSize -= processedSize; - streamPos += processedSize; - if (!testMode) - RINOK(realOutStream->Write(buffer, processedSize, 0)); - } - } - } - } - } - if (!testMode) - realOutStream.Release(); - RINOK(extractCallback->SetOperationResult(dataError ? - NArchive::NExtract::NOperationResult::kDataError : - NArchive::NExtract::NOperationResult::kOK)); - } - return S_OK; - COM_TRY_END -} - -}} diff --git a/7zip/Archive/Nsis/NsisHandler.h b/7zip/Archive/Nsis/NsisHandler.h deleted file mode 100755 index 1ff8b776..00000000 --- a/7zip/Archive/Nsis/NsisHandler.h +++ /dev/null @@ -1,41 +0,0 @@ -// NSisHandler.h - -#ifndef __NSIS_HANDLER_H -#define __NSIS_HANDLER_H - -#include "Common/MyCom.h" -#include "../IArchive.h" - -#include "NsisIn.h" - -namespace NArchive { -namespace NNsis { - -class CHandler: - public IInArchive, - public CMyUnknownImp -{ - CMyComPtr _inStream; - CInArchive _archive; - - bool GetUncompressedSize(int index, UInt32 &size); - bool GetCompressedSize(int index, UInt32 &size); - -public: - MY_UNKNOWN_IMP1(IInArchive) - - STDMETHOD(Open)(IInStream *stream, const UInt64 *maxCheckStartPosition, IArchiveOpenCallback *openArchiveCallback); - STDMETHOD(Close)(); - STDMETHOD(GetNumberOfItems)(UInt32 *numItems); - STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value); - STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems, Int32 testMode, IArchiveExtractCallback *extractCallback); - STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value); - STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties); - STDMETHOD(GetPropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType); - STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties); - STDMETHOD(GetArchivePropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType); -}; - -}} - -#endif diff --git a/7zip/Archive/Nsis/NsisIn.cpp b/7zip/Archive/Nsis/NsisIn.cpp deleted file mode 100755 index 0db6ccfd..00000000 --- a/7zip/Archive/Nsis/NsisIn.cpp +++ /dev/null @@ -1,1169 +0,0 @@ -// Archive/NsisIn.cpp - -#include "StdAfx.h" - -#include "NsisIn.h" -#include "NsisDecode.h" - -#include "Windows/Defs.h" - -#include "../../Common/StreamUtils.h" - -#include "Common/IntToString.h" - -namespace NArchive { -namespace NNsis { - -Byte kSignature[kSignatureSize] = { 0xEF + 1, 0xBE, 0xAD, 0xDE, -0x4E, 0x75, 0x6C, 0x6C, 0x73, 0x6F, 0x66, 0x74, 0x49, 0x6E, 0x73, 0x74}; - -class SignatureInitializer -{ -public: - SignatureInitializer() { kSignature[0]--; }; -} g_SignatureInitializer; - -static const char *kCrLf = "\x0D\x0A"; - -UInt32 GetUInt32FromMemLE(const Byte *p) -{ - return p[0] | (((UInt32)p[1]) << 8) | (((UInt32)p[2]) << 16) | (((UInt32)p[3]) << 24); -} - -Byte CInArchive::ReadByte() -{ - if (_posInData >= _size) - throw 1; - return _data[_posInData++]; -} - -UInt32 CInArchive::ReadUInt32() -{ - UInt32 value = 0; - for (int i = 0; i < 4; i++) - value |= ((UInt32)(ReadByte()) << (8 * i)); - return value; -} - -void CInArchive::ReadBlockHeader(CBlockHeader &bh) -{ - bh.Offset = ReadUInt32(); - bh.Num = ReadUInt32(); -} - -#define RINOZ(x) { int __tt = (x); if (__tt != 0) return __tt; } - -static int CompareItems(void *const *p1, void *const *p2, void * /* param */) -{ - RINOZ(MyCompare( - (**(const CItem **)p1).Pos, - (**(const CItem **)p2).Pos)); - return 0; -} - -AString CInArchive::ReadString(UInt32 pos) -{ - AString s; - UInt32 offset = GetOffset() + _stringsPos + pos; - for (;;) - { - if (offset >= _size) - throw 1; - char c = _data[offset++]; - if (c == 0) - break; - s += c; - } - return s; -} - -/* -static AString ParsePrefix(const AString &prefix) -{ - AString res = prefix; - if (prefix.Length() >= 3) - { - if ((Byte)prefix[0] == 0xFD && (Byte)prefix[1] == 0x95 && (Byte)prefix[2] == 0x80) - res = "$INSTDIR" + prefix.Mid(3); - else if ((Byte)prefix[0] == 0xFD && (Byte)prefix[1] == 0x96 && (Byte)prefix[2] == 0x80) - res = "$OUTDIR" + prefix.Mid(3); - } - return res; -} -*/ - -#define SYSREGKEY "Software\\Microsoft\\Windows\\CurrentVersion" - -/* -# define CSIDL_PROGRAMS 0x2 -# define CSIDL_PRINTERS 0x4 -# define CSIDL_PERSONAL 0x5 -# define CSIDL_FAVORITES 0x6 -# define CSIDL_STARTUP 0x7 -# define CSIDL_RECENT 0x8 -# define CSIDL_SENDTO 0x9 -# define CSIDL_STARTMENU 0xB -# define CSIDL_MYMUSIC 0xD -# define CSIDL_MYVIDEO 0xE - -# define CSIDL_DESKTOPDIRECTORY 0x10 -# define CSIDL_NETHOOD 0x13 -# define CSIDL_FONTS 0x14 -# define CSIDL_TEMPLATES 0x15 -# define CSIDL_COMMON_STARTMENU 0x16 -# define CSIDL_COMMON_PROGRAMS 0x17 -# define CSIDL_COMMON_STARTUP 0x18 -# define CSIDL_COMMON_DESKTOPDIRECTORY 0x19 -# define CSIDL_APPDATA 0x1A -# define CSIDL_PRINTHOOD 0x1B -# define CSIDL_LOCAL_APPDATA 0x1C -# define CSIDL_ALTSTARTUP 0x1D -# define CSIDL_COMMON_ALTSTARTUP 0x1E -# define CSIDL_COMMON_FAVORITES 0x1F - -# define CSIDL_INTERNET_CACHE 0x20 -# define CSIDL_COOKIES 0x21 -# define CSIDL_HISTORY 0x22 -# define CSIDL_COMMON_APPDATA 0x23 -# define CSIDL_WINDOWS 0x24 -# define CSIDL_SYSTEM 0x25 -# define CSIDL_PROGRAM_FILES 0x26 -# define CSIDL_MYPICTURES 0x27 -# define CSIDL_PROFILE 0x28 -# define CSIDL_PROGRAM_FILES_COMMON 0x2B -# define CSIDL_COMMON_TEMPLATES 0x2D -# define CSIDL_COMMON_DOCUMENTS 0x2E -# define CSIDL_COMMON_ADMINTOOLS 0x2F - -# define CSIDL_ADMINTOOLS 0x30 -# define CSIDL_COMMON_MUSIC 0x35 -# define CSIDL_COMMON_PICTURES 0x36 -# define CSIDL_COMMON_VIDEO 0x37 -# define CSIDL_RESOURCES 0x38 -# define CSIDL_RESOURCES_LOCALIZED 0x39 -# define CSIDL_CDBURN_AREA 0x3B -*/ - -struct CCommandPair -{ - int NumParams; - const char *Name; -}; - -enum -{ - // 0 - EW_INVALID_OPCODE, // zero is invalid. useful for catching errors. (otherwise an all zeroes instruction - // does nothing, which is easily ignored but means something is wrong. - EW_RET, // return from function call - EW_NOP, // Nop/Jump, do nothing: 1, [?new address+1:advance one] - EW_ABORT, // Abort: 1 [status] - EW_QUIT, // Quit: 0 - EW_CALL, // Call: 1 [new address+1] - EW_UPDATETEXT, // Update status text: 2 [update str, ui_st_updateflag=?ui_st_updateflag:this] - EW_SLEEP, // Sleep: 1 [sleep time in milliseconds] - EW_BRINGTOFRONT, // BringToFront: 0 - EW_CHDETAILSVIEW, // SetDetailsView: 2 [listaction,buttonaction] - - // 10 - EW_SETFILEATTRIBUTES, // SetFileAttributes: 2 [filename, attributes] - EW_CREATEDIR, // Create directory: 2, [path, ?update$INSTDIR] - EW_IFFILEEXISTS, // IfFileExists: 3, [file name, jump amount if exists, jump amount if not exists] - EW_SETFLAG, // Sets a flag: 2 [id, data] - EW_IFFLAG, // If a flag: 4 [on, off, id, new value mask] - EW_GETFLAG, // Gets a flag: 2 [output, id] - EW_RENAME, // Rename: 3 [old, new, rebootok] - EW_GETFULLPATHNAME, // GetFullPathName: 2 [output, input, ?lfn:sfn] - EW_SEARCHPATH, // SearchPath: 2 [output, filename] - EW_GETTEMPFILENAME, // GetTempFileName: 2 [output, base_dir] - - // 20 - EW_EXTRACTFILE, // File to extract: 6 [overwriteflag, output filename, compressed filedata, filedatetimelow, filedatetimehigh, allow ignore] - // overwriteflag: 0x1 = no. 0x0=force, 0x2=try, 0x3=if date is newer - EW_DELETEFILE, // Delete File: 2, [filename, rebootok] - EW_MESSAGEBOX, // MessageBox: 5,[MB_flags,text,retv1:retv2,moveonretv1:moveonretv2] - EW_RMDIR, // RMDir: 2 [path, recursiveflag] - EW_STRLEN, // StrLen: 2 [output, input] - EW_ASSIGNVAR, // Assign: 4 [variable (0-9) to assign, string to assign, maxlen, startpos] - EW_STRCMP, // StrCmp: 5 [str1, str2, jump_if_equal, jump_if_not_equal, case-sensitive?] - EW_READENVSTR, // ReadEnvStr/ExpandEnvStrings: 3 [output, string_with_env_variables, IsRead] - EW_INTCMP, // IntCmp: 6 [val1, val2, equal, val1val2, unsigned?] - EW_INTOP, // IntOp: 4 [output, input1, input2, op] where op: 0=add, 1=sub, 2=mul, 3=div, 4=bor, 5=band, 6=bxor, 7=bnot input1, 8=lnot input1, 9=lor, 10=land], 11=1%2 - - // 30 - EW_INTFMT, // IntFmt: [output, format, input] - EW_PUSHPOP, // Push/Pop/Exchange: 3 [variable/string, ?pop:push, ?exch] - EW_FINDWINDOW, // FindWindow: 5, [outputvar, window class,window name, window_parent, window_after] - EW_SENDMESSAGE, // SendMessage: 6 [output, hwnd, msg, wparam, lparam, [wparamstring?1:0 | lparamstring?2:0 | timeout<<2] - EW_ISWINDOW, // IsWindow: 3 [hwnd, jump_if_window, jump_if_notwindow] - EW_GETDLGITEM, // GetDlgItem: 3: [outputvar, dialog, item_id] - EW_SETCTLCOLORS, // SerCtlColors: 3: [hwnd, pointer to struct colors] - EW_SETBRANDINGIMAGE, // SetBrandingImage: 1: [Bitmap file] - EW_CREATEFONT, // CreateFont: 5: [handle output, face name, height, weight, flags] - EW_SHOWWINDOW, // ShowWindow: 2: [hwnd, show state] - - // 40 - EW_SHELLEXEC, // ShellExecute program: 4, [shell action, complete commandline, parameters, showwindow] - EW_EXECUTE, // Execute program: 3,[complete command line,waitflag,>=0?output errorcode] - EW_GETFILETIME, // GetFileTime; 3 [file highout lowout] - EW_GETDLLVERSION, // GetDLLVersion: 3 [file highout lowout] - EW_REGISTERDLL, // Register DLL: 3,[DLL file name, string ptr of function to call, text to put in display (<0 if none/pass parms), 1 - no unload, 0 - unload] - EW_CREATESHORTCUT, // Make Shortcut: 5, [link file, target file, parameters, icon file, iconindex|show mode<<8|hotkey<<16] - EW_COPYFILES, // CopyFiles: 3 [source mask, destination location, flags] - EW_REBOOT, // Reboot: 0 - EW_WRITEINI, // Write INI String: 4, [Section, Name, Value, INI File] - EW_READINISTR, // ReadINIStr: 4 [output, section, name, ini_file] - - // 50 - EW_DELREG, // DeleteRegValue/DeleteRegKey: 4, [root key(int), KeyName, ValueName, delkeyonlyifempty]. ValueName is -1 if delete key - EW_WRITEREG, // Write Registry value: 5, [RootKey(int),KeyName,ItemName,ItemData,typelen] - // typelen=1 for str, 2 for dword, 3 for binary, 0 for expanded str - EW_READREGSTR, // ReadRegStr: 5 [output, rootkey(int), keyname, itemname, ==1?int::str] - EW_REGENUM, // RegEnum: 5 [output, rootkey, keyname, index, ?key:value] - EW_FCLOSE, // FileClose: 1 [handle] - EW_FOPEN, // FileOpen: 4 [name, openmode, createmode, outputhandle] - EW_FPUTS, // FileWrite: 3 [handle, string, ?int:string] - EW_FGETS, // FileRead: 4 [handle, output, maxlen, ?getchar:gets] - EW_FSEEK, // FileSeek: 4 [handle, offset, mode, >=0?positionoutput] - EW_FINDCLOSE, // FindClose: 1 [handle] - - // 60 - EW_FINDNEXT, // FindNext: 2 [output, handle] - EW_FINDFIRST, // FindFirst: 2 [filespec, output, handleoutput] - EW_WRITEUNINSTALLER, // WriteUninstaller: 3 [name, offset, icon_size] - EW_LOG, // LogText: 2 [0, text] / LogSet: [1, logstate] - EW_SECTIONSET, // SectionSetText: 3: [idx, 0, text] - // SectionGetText: 3: [idx, 1, output] - // SectionSetFlags: 3: [idx, 2, flags] - // SectionGetFlags: 3: [idx, 3, output] - EW_INSTTYPESET, // InstTypeSetFlags: 3: [idx, 0, flags] - // InstTypeGetFlags: 3: [idx, 1, output] - // instructions not actually implemented in exehead, but used in compiler. - EW_GETLABELADDR, // both of these get converted to EW_ASSIGNVAR - EW_GETFUNCTIONADDR, - - EW_LOCKWINDOW -}; - -static CCommandPair kCommandPairs[] = -{ - { 0, "Invalid" }, - { 0, "Return" }, - { 1, "Goto" }, - { 0, "Abort" }, - { 0, "Quit" }, - { 1, "Call" }, - { 2, "UpdateSatusText" }, - { 1, "Sleep" }, - { 0, "BringToFront" }, - { 2, "SetDetailsView" }, - - { 2, "SetFileAttributes" }, - { 2, "SetOutPath" }, - { 3, "IfFileExists" }, - { 2, "SetFlag" }, - { 4, "IfFlag" }, - { 2, "GetFlag" }, - { 3, "Rename" }, - { 2, "GetFullPathName" }, - { 2, "SearchPath" }, - { 2, "GetTempFileName" }, - - { 6, "File" }, - { 2, "Delete" }, - { 5, "MessageBox" }, - { 2, "RMDir" }, - { 2, "Assign" }, - { 4, "StrCpy" }, - { 5, "StrCmp" }, - { 3, "ReadEnvStr" }, - { 6, "IntCmp" }, - { 4, "IntOp" }, - - { 3, "IntFmt" }, - { 3, "PushPop" }, - { 5, "FindWindow" }, - { 6, "SendMessage" }, - { 3, "IsWindow" }, - { 3, "GetDlgItem" }, - { 3, "SerCtlColors" }, - { 1, "SetBrandingImage" }, - { 5, "CreateFont" }, - { 2, "ShowWindow" }, - - { 4, "ShellExecute" }, - { 3, "Execute" }, - { 3, "GetFileTime" }, - { 3, "GetDLLVersion" }, - { 3, "RegisterDLL" }, - { 5, "CreateShortCut" }, - { 3, "CopyFiles" }, - { 0, "Reboot" }, - { 4, "WriteINIStr" }, - { 4, "ReadINIStr" }, - - { 4, "DelReg" }, - { 5, "WriteReg" }, - { 5, "ReadRegStr" }, - { 5, "RegEnum" }, - { 1, "FileClose" }, - { 4, "FileOpen" }, - { 3, "FileWrite" }, - { 4, "FileRead" }, - { 4, "FileSeek" }, - { 1, "FindClose" }, - - { 2, "FindNext" }, - { 2, "FindFirst" }, - { 3, "WriteUninstaller" }, - { 2, "LogText" }, - { 3, "Section?etText" }, - { 3, "InstType?etFlags" }, - { 6, "GetLabelAddr" }, - { 2, "GetFunctionAddress" }, - { 6, "LockWindow" } -}; - - -static const char *kShellStrings[] = -{ - "", - "", - - "SMPROGRAMS", - "", - "PRINTERS", - "DOCUMENTS", - "FAVORITES", - "SMSTARTUP", - "RECENT", - "SENDTO", - "", - "STARTMENU", - "", - "MUSIC", - "VIDEO", - "", - - "DESKTOP", - "", - "", - "NETHOOD", - "FONTS", - "TEMPLATES", - "COMMONSTARTMENU", - "COMMONFILES", - "COMMON_STARTUP", - "COMMON_DESKTOPDIRECTORY", - "QUICKLAUNCH", - "PRINTHOOD", - "LOCALAPPDATA", - "ALTSTARTUP", - "ALTSTARTUP", - "FAVORITES", - - "INTERNET_CACHE", - "COOKIES", - "HISTORY", - "APPDATA", - "WINDIR", - "SYSDIR", - "PROGRAMFILES", - "PICTURES", - "PROFILE", - "", - "", - "COMMONFILES", - "", - "TEMPLATES", - "DOCUMENTS", - "ADMINTOOLS", - - "ADMINTOOLS", - "", - "", - "", - "", - "MUSIC", - "PICTURES", - "VIDEO", - "RESOURCES", - "RESOURCES_LOCALIZED", - "", - "CDBURN_AREA" -}; - -static const int kNumShellStrings = sizeof(kShellStrings) / sizeof(kShellStrings[0]); - -/* -# define CMDLINE 20 // everything before here doesn't have trailing slash removal -# define INSTDIR 21 -# define OUTDIR 22 -# define EXEDIR 23 -# define LANGUAGE 24 -# define TEMP 25 -# define PLUGINSDIR 26 -# define HWNDPARENT 27 -# define _CLICK 28 -# define _OUTDIR 29 -*/ - -static const char *kVarStrings[] = -{ - "CMDLINE", - "INSTDIR", - "OUTDIR", - "EXEDIR", - "LANGUAGE", - "TEMP", - "PLUGINSDIR", - "HWNDPARENT", - "_CLICK", - "_OUTDIR" -}; - -static const int kNumVarStrings = sizeof(kVarStrings) / sizeof(kVarStrings[0]); - - -static AString UIntToString(UInt32 v) -{ - char sz[32]; - ConvertUInt64ToString(v, sz); - return sz; -} - -static AString IntToString(Int32 v) -{ - char sz[32]; - ConvertInt64ToString(v, sz); - return sz; -} - -static AString GetVar(UInt32 index) -{ - AString res = "$"; - if (index < 10) - res += UIntToString(index); - else if (index < 20) - { - res += "R"; - res += UIntToString(index - 10); - } - else if (index < 20 + kNumVarStrings) - res += kVarStrings[index - 20]; - else - { - res += "["; - res += UIntToString(index); - res += "]"; - } - return res; -} - -// $0..$9, $INSTDIR, etc are encoded as ASCII bytes starting from this value. -#define NS_SKIP_CODE 252 -#define NS_VAR_CODE 253 -#define NS_SHELL_CODE 254 -#define NS_LANG_CODE 255 -#define NS_CODES_START NS_SKIP_CODE - -// Based on Dave Laundon's simplified process_string -AString GetNsisString(const AString &s) -{ - AString res; - for (int i = 0; i < s.Length();) - { - unsigned char nVarIdx = s[i++]; - if (nVarIdx > NS_CODES_START && i + 2 <= s.Length()) - { - int nData = s[i++] & 0x7F; - unsigned char c1 = s[i++]; - nData |= (((int)(c1 & 0x7F)) << 7); - - if (nVarIdx == NS_SHELL_CODE) - { - UInt32 index = c1; - bool needPrint = true; - res += "$"; - if (index < kNumShellStrings) - { - const char *sz = kShellStrings[index]; - if (sz[0] != 0) - { - res += sz; - needPrint = false; - } - } - if (needPrint) - { - res += "SHELL["; - res += UIntToString(index); - res += "]"; - } - } - else if (nVarIdx == NS_VAR_CODE) - res += GetVar(nData); - else if (nVarIdx == NS_LANG_CODE) - res += "NS_LANG_CODE"; - } - else if (nVarIdx == NS_SKIP_CODE) - { - if (i < s.Length()) - res += s[i++]; - } - else // Normal char - res += (char)nVarIdx; - } - return res; -} - -AString CInArchive::ReadString2(UInt32 pos) -{ - return GetNsisString(ReadString(pos)); -} - -#define DEL_DIR 1 -#define DEL_RECURSE 2 -#define DEL_REBOOT 4 -// #define DEL_SIMPLE 8 - -static const int kNumEntryParams = 6; - -struct CEntry -{ - UInt32 Which; - UInt32 Params[kNumEntryParams]; - AString GetParamsString(int numParams); - CEntry() - { - Which = 0; - for (UInt32 j = 0; j < kNumEntryParams; j++) - Params[j] = 0; - } -}; - -AString CEntry::GetParamsString(int numParams) -{ - AString s; - for (int i = 0; i < numParams; i++) - { - s += " "; - UInt32 v = Params[i]; - if (v > 0xFFF00000) - s += IntToString((Int32)Params[i]); - else - s += UIntToString(Params[i]); - } - return s; -} - -HRESULT CInArchive::ReadEntries(const CBlockHeader &bh) -{ - _posInData = bh.Offset + GetOffset(); - AString prefix; - for (UInt32 i = 0; i < bh.Num; i++) - { - CEntry e; - e.Which = ReadUInt32(); - for (UInt32 j = 0; j < kNumEntryParams; j++) - e.Params[j] = ReadUInt32(); - #ifdef NSIS_SCRIPT - if (e.Which != EW_PUSHPOP && e.Which < sizeof(kCommandPairs) / sizeof(kCommandPairs[0])) - { - const CCommandPair &pair = kCommandPairs[e.Which]; - Script += pair.Name; - } - #endif - - switch (e.Which) - { - case EW_CREATEDIR: - { - prefix.Empty(); - prefix = ReadString2(e.Params[0]); - #ifdef NSIS_SCRIPT - Script += " "; - Script += prefix; - #endif - break; - } - - case EW_EXTRACTFILE: - { - CItem item; - item.Prefix = prefix; - /* UInt32 overwriteFlag = e.Params[0]; */ - item.Name = ReadString2(e.Params[1]); - item.Pos = e.Params[2]; - item.DateTime.dwLowDateTime = e.Params[3]; - item.DateTime.dwHighDateTime = e.Params[4]; - /* UInt32 allowIgnore = e.Params[5]; */ - if (Items.Size() > 0) - { - /* - if (item.Pos == Items.Back().Pos) - continue; - */ - } - Items.Add(item); - #ifdef NSIS_SCRIPT - Script += " "; - Script += item.Name; - #endif - break; - } - - - #ifdef NSIS_SCRIPT - case EW_UPDATETEXT: - { - Script += " "; - Script += ReadString2(e.Params[0]); - Script += " "; - Script += UIntToString(e.Params[1]); - break; - } - case EW_SETFILEATTRIBUTES: - { - Script += " "; - Script += ReadString2(e.Params[0]); - Script += " "; - Script += UIntToString(e.Params[1]); - break; - } - case EW_IFFILEEXISTS: - { - Script += " "; - Script += ReadString2(e.Params[0]); - Script += " "; - Script += UIntToString(e.Params[1]); - Script += " "; - Script += UIntToString(e.Params[2]); - break; - } - case EW_RENAME: - { - Script += " "; - Script += ReadString2(e.Params[0]); - Script += " "; - Script += ReadString2(e.Params[1]); - Script += " "; - Script += UIntToString(e.Params[2]); - break; - } - case EW_GETFULLPATHNAME: - { - Script += " "; - Script += ReadString2(e.Params[0]); - Script += " "; - Script += ReadString2(e.Params[1]); - Script += " "; - Script += UIntToString(e.Params[2]); - break; - } - case EW_SEARCHPATH: - { - Script += " "; - Script += ReadString2(e.Params[0]); - Script += " "; - Script += ReadString2(e.Params[1]); - break; - } - case EW_GETTEMPFILENAME: - { - AString s; - Script += " "; - Script += ReadString2(e.Params[0]); - Script += " "; - Script += ReadString2(e.Params[1]); - break; - } - - case EW_DELETEFILE: - { - UInt64 flag = e.Params[1]; - if (flag != 0) - { - Script += " "; - if (flag == DEL_REBOOT) - Script += "/REBOOTOK"; - else - Script += UIntToString(e.Params[1]); - } - Script += " "; - Script += ReadString2(e.Params[0]); - break; - } - case EW_RMDIR: - { - UInt64 flag = e.Params[1]; - if (flag != 0) - { - if ((flag & DEL_REBOOT) != 0) - Script += " /REBOOTOK"; - if ((flag & DEL_RECURSE) != 0) - Script += " /r"; - } - Script += " "; - Script += ReadString2(e.Params[0]); - break; - } - case EW_ASSIGNVAR: - { - Script += " "; - Script += GetVar(e.Params[0]);; - Script += " \""; - AString maxLen, startOffset; - Script += ReadString2(e.Params[1]); - Script += "\""; - if (e.Params[2] != 0) - maxLen = ReadString(e.Params[2]); - if (e.Params[3] != 0) - startOffset = ReadString(e.Params[3]); - if (!maxLen.IsEmpty() || !startOffset.IsEmpty()) - { - Script += " "; - if (maxLen.IsEmpty()) - Script += "\"\""; - else - Script += maxLen; - if (!startOffset.IsEmpty()) - { - Script += " "; - Script += startOffset; - } - } - break; - } - case EW_STRCMP: - { - Script += " "; - - Script += " \""; - Script += ReadString2(e.Params[0]); - Script += "\""; - - Script += " \""; - Script += ReadString2(e.Params[1]); - Script += "\""; - - for (int j = 2; j < 5; j++) - { - Script += " "; - Script += UIntToString(e.Params[j]); - } - break; - } - - case EW_PUSHPOP: - { - int isPop = (e.Params[1] != 0); - if (isPop) - { - Script += "Pop"; - Script += " "; - Script += GetVar(e.Params[0]);; - } - else - { - int isExch = (e.Params[2] != 0); - if (isExch) - { - Script += "Exch"; - } - else - { - Script += "Push"; - Script += " "; - Script += ReadString2(e.Params[0]); - } - } - break; - } - - /* - case EW_SENDMESSAGE: - { - Script += " "; - Script += IntToString(e.Params[0]); - Script += " "; - Script += GetVar(e.Params[1]); - Script += " "; - Script += ReadString2(e.Params[2]); - Script += " "; - Script += UIntToString(e.Params[3]); - Script += " "; - Script += IntToString(e.Params[4]); - Script += " "; - Script += UIntToString(e.Params[5]); - break; - } - */ - - case EW_REGISTERDLL: - { - Script += " "; - Script += ReadString2(e.Params[0]); - Script += " "; - Script += ReadString2(e.Params[1]); - Script += " "; - Script += UIntToString(e.Params[2]); - break; - } - - case EW_CREATESHORTCUT: - { - AString s; - - Script += " "; - Script += " \""; - Script += ReadString2(e.Params[0]); - Script += " \""; - - Script += " "; - Script += " \""; - Script += ReadString2(e.Params[1]); - Script += " \""; - - for (int j = 2; j < 5; j++) - { - Script += " "; - Script += UIntToString(e.Params[j]); - } - break; - } - - /* - case EW_DELREG: - { - AString keyName, valueName; - keyName = ReadString2(e.Params[1]); - bool isValue = (e.Params[2] != -1); - if (isValue) - { - valueName = ReadString2(e.Params[2]); - Script += "Key"; - } - else - Script += "Value"; - Script += " "; - Script += UIntToString(e.Params[0]); - Script += " "; - Script += keyName; - if (isValue) - { - Script += " "; - Script += valueName; - } - Script += " "; - Script += UIntToString(e.Params[3]); - break; - } - */ - - case EW_WRITEUNINSTALLER: - { - Script += " "; - Script += ReadString2(e.Params[0]); - for (int j = 1; j < 3; j++) - { - Script += " "; - Script += UIntToString(e.Params[j]); - } - break; - } - - default: - { - int numParams = kNumEntryParams; - if (e.Which < sizeof(kCommandPairs) / sizeof(kCommandPairs[0])) - { - const CCommandPair &pair = kCommandPairs[e.Which]; - // Script += pair.Name; - numParams = pair.NumParams; - } - else - { - Script += "Unknown"; - Script += UIntToString(e.Which); - } - Script += e.GetParamsString(numParams); - } - #endif - } - #ifdef NSIS_SCRIPT - Script += kCrLf; - #endif - } - - { - Items.Sort(CompareItems, 0); - int i; - for (i = 0; i + 1 < Items.Size();) - { - if (Items[i].Pos == Items[i + 1].Pos) - Items.Delete(i + 1); - else - i++; - } - for (i = 0; i + 1 < Items.Size(); i++) - { - CItem &item = Items[i]; - item.EstimatedSizeIsDefined = true; - item.EstimatedSize = Items[i + 1].Pos - item.Pos - 4; - } - if (!IsSolid) - { - for (i = 0; i < Items.Size(); i++) - { - CItem &item = Items[i]; - RINOK(_stream->Seek(GetPosOfNonSolidItem(i), STREAM_SEEK_SET, NULL)); - const UInt32 kSigSize = 4 + 1 + 5; - BYTE sig[kSigSize]; - UInt32 processedSize; - RINOK(ReadStream(_stream, sig, kSigSize, &processedSize)); - if (processedSize < 4) - return S_FALSE; - UInt32 size = GetUInt32FromMemLE(sig); - if ((size & 0x80000000) != 0) - { - item.IsCompressed = true; - // is compressed; - size &= ~0x80000000; - if (Method == NMethodType::kLZMA) - { - if (processedSize < 9) - return S_FALSE; - if (FilterFlag) - item.UseFilter = (sig[4] != 0); - item.DictionarySize = GetUInt32FromMemLE(sig + 5 + (FilterFlag ? 1 : 0)); - } - } - else - { - item.IsCompressed = false; - item.Size = size; - item.SizeIsDefined = true; - } - item.CompressedSize = size; - item.CompressedSizeIsDefined = true; - } - } - } - return S_OK; -} - -HRESULT CInArchive::Parse() -{ - // UInt32 offset = ReadUInt32(); - // ???? offset == FirstHeader.HeaderLength - /* UInt32 ehFlags = */ ReadUInt32(); - CBlockHeader bhPages, bhSections, bhEntries, bhStrings, bhLangTables, bhCtlColors, bhData; - // CBlockHeader bgFont; - ReadBlockHeader(bhPages); - ReadBlockHeader(bhSections); - ReadBlockHeader(bhEntries); - ReadBlockHeader(bhStrings); - ReadBlockHeader(bhLangTables); - ReadBlockHeader(bhCtlColors); - // ReadBlockHeader(bgFont); - ReadBlockHeader(bhData); - - _stringsPos = bhStrings.Offset; - - return ReadEntries(bhEntries); -} - -static bool IsLZMA(const Byte *p, UInt32 &dictionary) -{ - dictionary = GetUInt32FromMemLE(p + 1); - return (p[0] == 0x5D && p[1] == 0x00 && p[2] == 0x00 && p[5] == 0x00); -} - -static bool IsLZMA(const Byte *p, UInt32 &dictionary, bool &thereIsFlag) -{ - if (IsLZMA(p, dictionary)) - { - thereIsFlag = false; - return true; - } - if (IsLZMA(p + 1, dictionary)) - { - thereIsFlag = true; - return true; - } - return false; -} - -HRESULT CInArchive::Open2() -{ - RINOK(_stream->Seek(0, STREAM_SEEK_CUR, &StreamOffset)); - - const UInt32 kSigSize = 4 + 1 + 5 + 1; // size, flag, lzma props, lzma first byte - BYTE sig[kSigSize]; - UInt32 processedSize; - RINOK(ReadStream(_stream, sig, kSigSize, &processedSize)); - if (processedSize != kSigSize) - return S_FALSE; - UInt64 position; - RINOK(_stream->Seek(StreamOffset, STREAM_SEEK_SET, &position)); - - _headerIsCompressed = true; - IsSolid = true; - FilterFlag = false; - - UInt32 compressedHeaderSize = GetUInt32FromMemLE(sig); - - if (compressedHeaderSize == FirstHeader.HeaderLength) - { - _headerIsCompressed = false; - IsSolid = false; - Method = NMethodType::kCopy; - } - else if (IsLZMA(sig, DictionarySize, FilterFlag)) - { - Method = NMethodType::kLZMA; - } - else if (IsLZMA(sig + 4, DictionarySize, FilterFlag)) - { - IsSolid = false; - Method = NMethodType::kLZMA; - } - else if (sig[3] == 0x80) - { - IsSolid = false; - Method = NMethodType::kDeflate; - } - else - { - Method = NMethodType::kDeflate; - } - - _posInData = 0; - if (!IsSolid) - { - _headerIsCompressed = ((compressedHeaderSize & 0x80000000) != 0); - if (_headerIsCompressed) - compressedHeaderSize &= ~0x80000000; - _nonSolidStartOffset = compressedHeaderSize; - RINOK(_stream->Seek(StreamOffset + 4, STREAM_SEEK_SET, NULL)); - } - UInt32 unpackSize = FirstHeader.HeaderLength; - if (_headerIsCompressed) - { - // unpackSize = (1 << 23); - _data.SetCapacity(unpackSize); - RINOK(Decoder.Init(_stream, Method, FilterFlag, UseFilter)); - UInt32 processedSize; - RINOK(Decoder.Read(_data, unpackSize, &processedSize)); - if (processedSize != unpackSize) - return S_FALSE; - _size = (size_t)processedSize; - if (IsSolid) - { - UInt32 size2 = ReadUInt32(); - if (size2 < _size) - _size = size2; - } - } - else - { - _data.SetCapacity(unpackSize); - _size = (size_t)unpackSize; - RINOK(ReadStream(_stream, (Byte *)_data, unpackSize, &processedSize)); - if (processedSize != unpackSize) - return S_FALSE; - } - return Parse(); -} - -/* -NsisExe = -{ - ExeStub - Archive // must start from 512 * N - #ifndef NSIS_CONFIG_CRC_ANAL - { - Some additional data - } -} - -Archive -{ - FirstHeader - Data - #ifdef NSIS_CONFIG_CRC_SUPPORT && FirstHeader.ThereIsCrc() - { - CRC - } -} - -FirstHeader -{ - UInt32 Flags; - Byte Signature[16]; - // points to the header+sections+entries+stringtable in the datablock - UInt32 HeaderLength; - UInt32 ArchiveSize; -} -*/ - -HRESULT CInArchive::Open(IInStream *inStream, const UInt64 *maxCheckStartPosition) -{ - Clear(); - UInt64 pos; - RINOK(inStream->Seek(0, STREAM_SEEK_CUR, &pos)); - RINOK(inStream->Seek(0, STREAM_SEEK_END, &_archiveSize)); - UInt64 position; - RINOK(inStream->Seek(pos, STREAM_SEEK_SET, &position)); - UInt64 maxSize = (maxCheckStartPosition != 0) ? *maxCheckStartPosition : (1 << 20); - const UInt32 kStep = 512; - const UInt32 kStartHeaderSize = 4 * 7; - Byte buffer[kStep]; - bool found = false; - - UInt64 headerPosition = 0; - while (position <= maxSize) - { - UInt32 processedSize; - RINOK(ReadStream(inStream, buffer, kStartHeaderSize, &processedSize)); - if (processedSize != kStartHeaderSize) - return S_FALSE; - headerPosition = position; - position += processedSize; - if(memcmp(buffer + 4, kSignature, kSignatureSize) == 0) - { - found = true; - break; - } - const UInt32 kRem = kStep - kStartHeaderSize; - RINOK(ReadStream(inStream, buffer + kStartHeaderSize, kRem, &processedSize)); - if (processedSize != kRem) - return S_FALSE; - position += processedSize; - } - if (!found) - return S_FALSE; - FirstHeader.Flags = GetUInt32FromMemLE(buffer); - FirstHeader.HeaderLength = GetUInt32FromMemLE(buffer + kSignatureSize + 4); - FirstHeader.ArchiveSize = GetUInt32FromMemLE(buffer + kSignatureSize + 8); - if (_archiveSize - headerPosition < FirstHeader.ArchiveSize) - return S_FALSE; - - _stream = inStream; - HRESULT res = S_FALSE; - try { res = Open2(); } - catch(...) { Clear(); res = S_FALSE; } - _stream.Release(); - return res; -} - -void CInArchive::Clear() -{ - #ifdef NSIS_SCRIPT - Script.Empty(); - #endif - Items.Clear(); -} - -}} diff --git a/7zip/Archive/Nsis/NsisIn.h b/7zip/Archive/Nsis/NsisIn.h deleted file mode 100755 index b7e87e5d..00000000 --- a/7zip/Archive/Nsis/NsisIn.h +++ /dev/null @@ -1,166 +0,0 @@ -// Archive/NsisIn.h - -#ifndef __ARCHIVE_ISO_IN_H -#define __ARCHIVE_ISO_IN_H - -#include "Common/MyCom.h" -#include "Common/IntToString.h" -#include "Common/Buffer.h" - -#include "../../IStream.h" - -#include "NsisDecode.h" - -// #define NSIS_SCRIPT - -namespace NArchive { -namespace NNsis { - -const int kSignatureSize = 16; -extern Byte kSignature[kSignatureSize]; - -const UInt32 kFlagsMask = 0xF; -namespace NFlags -{ - const UInt32 kUninstall = 1; - const UInt32 kSilent = 2; - const UInt32 kNoCrc = 4; - const UInt32 kForceCrc = 8; -} - -struct CFirstHeader -{ - UInt32 Flags; - UInt32 HeaderLength; - - UInt32 ArchiveSize; - - bool ThereIsCrc() const - { - if ((Flags & NFlags::kForceCrc ) != 0) - return true; - return ((Flags & NFlags::kNoCrc) == 0); - } - - UInt32 GetDataSize() const { return ArchiveSize - (ThereIsCrc() ? 4 : 0); } -}; - - -struct CBlockHeader -{ - UInt32 Offset; - UInt32 Num; -}; - -struct CItem -{ - AString Prefix; - AString Name; - UInt32 Pos; - bool SizeIsDefined; - bool CompressedSizeIsDefined; - bool EstimatedSizeIsDefined; - UInt32 Size; - UInt32 CompressedSize; - UInt32 EstimatedSize; - FILETIME DateTime; - UInt32 DictionarySize; - bool IsCompressed; - bool UseFilter; - CItem(): UseFilter(false), SizeIsDefined(false), EstimatedSizeIsDefined(false), - IsCompressed(true), CompressedSizeIsDefined(false), Size(0) {} - - bool IsINSTDIR() const - { - if (Prefix.Length() < 3) - return false; - return true; - } - - AString GetReducedName() const - { - AString prefix = Prefix; - if (prefix.Length() > 0) - if (prefix[prefix.Length() - 1] != '\\') - prefix += '\\'; - AString s2 = prefix + Name; - const int len = 9; - if (s2.Left(len).CompareNoCase("$INSTDIR\\") == 0) - s2 = s2.Mid(len); - return s2; - } - -}; - -class CInArchive -{ - UInt64 _archiveSize; - CMyComPtr _stream; - - Byte ReadByte(); - UInt32 ReadUInt32(); - HRESULT Open2(); - void ReadBlockHeader(CBlockHeader &bh); - AString ReadString(UInt32 pos); - AString ReadString2(UInt32 pos); - HRESULT ReadEntries(const CBlockHeader &bh); - HRESULT Parse(); - - CByteBuffer _data; - UInt64 _size; - - size_t _posInData; - - UInt32 _stringsPos; - - - bool _headerIsCompressed; - UInt32 _nonSolidStartOffset; -public: - HRESULT Open(IInStream *inStream, const UInt64 *maxCheckStartPosition); - void Clear(); - - UInt64 StreamOffset; - CDecoder Decoder; - CObjectVector Items; - bool IsSolid; - CFirstHeader FirstHeader; - NMethodType::EEnum Method; - bool UseFilter; - UInt32 DictionarySize; - bool FilterFlag; - - #ifdef NSIS_SCRIPT - AString Script; - #endif - UInt32 GetOffset() const { return IsSolid ? 4 : 0; } - UInt64 GetDataPos(int index) - { - const CItem &item = Items[index]; - return GetOffset() + FirstHeader.HeaderLength + item.Pos; - } - - UInt64 GetPosOfSolidItem(int index) const - { - const CItem &item = Items[index]; - return 4 + FirstHeader.HeaderLength + item.Pos; - } - - UInt64 GetPosOfNonSolidItem(int index) const - { - const CItem &item = Items[index]; - return StreamOffset + _nonSolidStartOffset + 4 + item.Pos; - } - - void Release() - { - Decoder.Release(); - } - -}; - -UInt32 GetUInt32FromMemLE(const Byte *p); - -}} - -#endif diff --git a/7zip/Archive/Nsis/StdAfx.cpp b/7zip/Archive/Nsis/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Archive/Nsis/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Archive/Nsis/StdAfx.h b/7zip/Archive/Nsis/StdAfx.h deleted file mode 100755 index 2e4be10b..00000000 --- a/7zip/Archive/Nsis/StdAfx.h +++ /dev/null @@ -1,9 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" -#include "../../../Common/NewHandler.h" - -#endif diff --git a/7zip/Archive/Nsis/makefile b/7zip/Archive/Nsis/makefile deleted file mode 100755 index 69fcf523..00000000 --- a/7zip/Archive/Nsis/makefile +++ /dev/null @@ -1,67 +0,0 @@ -PROG = nsis.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib user32.lib - -TAR_OBJS = \ - $O\DllExports.obj \ - $O\NsisDecode.obj \ - $O\NsisHandler.obj \ - $O\NsisIn.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\IntToString.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\Vector.obj \ - -WIN_OBJS = \ - $O\DLL.obj \ - $O\FileFind.obj \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\LimitedStreams.obj \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\CodecsPath.obj \ - $O\CoderLoader.obj \ - $O\ItemNameUtils.obj \ - $O\FilterCoder.obj \ - -7Z_OBJS = \ - $O\7zMethodID.obj \ - $O\7zMethods.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(TAR_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(7Z_OBJS) \ - $(COMPRESS_TAR_OBJS) \ - $O\CopyCoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(TAR_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$(7Z_OBJS): ../7z/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) diff --git a/7zip/Archive/Nsis/resource.rc b/7zip/Archive/Nsis/resource.rc deleted file mode 100755 index 487eb4ee..00000000 --- a/7zip/Archive/Nsis/resource.rc +++ /dev/null @@ -1,3 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Nsis Plugin", "nsis") diff --git a/7zip/Archive/RPM/DllExports.cpp b/7zip/Archive/RPM/DllExports.cpp deleted file mode 100755 index ed21e64f..00000000 --- a/7zip/Archive/RPM/DllExports.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "../../ICoder.h" -#include "RpmHandler.h" - -// {23170F69-40C1-278A-1000-000110EB0000} -DEFINE_GUID(CLSID_CRpmHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0xEB, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /* lpReserved */) -{ - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CRpmHandler) - return CLASS_E_CLASSNOTAVAILABLE; - if (*interfaceID != IID_IInArchive) - return E_NOINTERFACE; - CMyComPtr inArchive = (IInArchive *)new NArchive::NRpm::CHandler; - *outObject = inArchive.Detach(); - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Rpm"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CRpmHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"rpm"; - break; - case NArchive::kAddExtension: - propVariant = L".cpio.gz"; - break; - case NArchive::kUpdate: - propVariant = false; - break; - case NArchive::kKeepName: - propVariant = false; - break; - } - propVariant.Detach(value); - return S_OK; -} diff --git a/7zip/Archive/RPM/Rpm.dsp b/7zip/Archive/RPM/Rpm.dsp deleted file mode 100755 index 085fe137..00000000 --- a/7zip/Archive/RPM/Rpm.dsp +++ /dev/null @@ -1,205 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Rpm" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Rpm - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Rpm.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Rpm.mak" CFG="Rpm - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Rpm - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Rpm - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Rpm - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RPM_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "../../../" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RPM_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-zip\Formats\rpm.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Rpm - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RPM_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "../../../" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RPM_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-zip\Formats\rpm.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Rpm - Win32 Release" -# Name "Rpm - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\Rpm.ico -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "7-zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\RpmHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\RpmHandler.h -# End Source File -# Begin Source File - -SOURCE=.\RpmHeader.h -# End Source File -# Begin Source File - -SOURCE=.\RpmIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\RpmIn.h -# End Source File -# End Target -# End Project diff --git a/7zip/Archive/RPM/Rpm.dsw b/7zip/Archive/RPM/Rpm.dsw deleted file mode 100755 index a67232ed..00000000 --- a/7zip/Archive/RPM/Rpm.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Rpm"=.\Rpm.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Archive/RPM/RpmHandler.cpp b/7zip/Archive/RPM/RpmHandler.cpp deleted file mode 100755 index b1a5bf7d..00000000 --- a/7zip/Archive/RPM/RpmHandler.cpp +++ /dev/null @@ -1,194 +0,0 @@ -// RPM/Handler.cpp - -#include "StdAfx.h" - -#include "RpmHandler.h" -#include "RpmIn.h" - -#include "Common/Defs.h" -#include "Common/StringConvert.h" -#include "Common/NewHandler.h" -#include "Common/ComTry.h" - -#include "Windows/PropVariant.h" -#include "Windows/Defs.h" - -#include "../../Common/StreamObjects.h" -#include "../../Common/ProgressUtils.h" -#include "../../Common/LimitedStreams.h" - -#include "../../Compress/Copy/CopyCoder.h" -#include "../Common/ItemNameUtils.h" - -using namespace NWindows; - -namespace NArchive { -namespace NRpm { - -STATPROPSTG kProperties[] = -{ -// { NULL, kpidPath, VT_BSTR}, -// { NULL, kpidIsFolder, VT_BOOL}, - { NULL, kpidSize, VT_UI8}, - { NULL, kpidPackedSize, VT_UI8} -}; - -STDMETHODIMP CHandler::GetArchiveProperty(PROPID /* propID */, PROPVARIANT *value) -{ - value->vt = VT_EMPTY; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties) -{ - *numProperties = sizeof(kProperties) / sizeof(kProperties[0]); - return S_OK; -} - -STDMETHODIMP CHandler::GetPropertyInfo(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) -{ - if(index >= sizeof(kProperties) / sizeof(kProperties[0])) - return E_INVALIDARG; - const STATPROPSTG &srcItem = kProperties[index]; - *propID = srcItem.propid; - *varType = srcItem.vt; - *name = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) -{ - *numProperties = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetArchivePropertyInfo(UInt32 /* index */, - BSTR * /* name */, PROPID * /* propID */, VARTYPE * /* varType */) -{ - return E_INVALIDARG; -} - -STDMETHODIMP CHandler::Open(IInStream *inStream, - const UInt64 * /* maxCheckStartPosition */, - IArchiveOpenCallback * /* openArchiveCallback */) -{ - COM_TRY_BEGIN - try - { - if(OpenArchive(inStream) != S_OK) - return S_FALSE; - RINOK(inStream->Seek(0, STREAM_SEEK_CUR, &m_Pos)); - m_InStream = inStream; - UInt64 endPosition; - RINOK(inStream->Seek(0, STREAM_SEEK_END, &endPosition)); - m_Size = endPosition - m_Pos; - return S_OK; - } - catch(...) - { - return S_FALSE; - } - COM_TRY_END -} - -STDMETHODIMP CHandler::Close() -{ - m_InStream.Release(); - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems) -{ - *numItems = 1; - return S_OK; -} - -STDMETHODIMP CHandler::GetProperty(UInt32 /* index */, PROPID propID, PROPVARIANT *value) -{ - COM_TRY_BEGIN - NWindows::NCOM::CPropVariant propVariant; - - switch(propID) - { - /* - case kpidPath: - propVariant = (const wchar_t *)L"a.cpio.gz"; - break; - */ - case kpidIsFolder: - propVariant = false; - break; - case kpidSize: - case kpidPackedSize: - propVariant = m_Size; - break; - } - propVariant.Detach(value); - return S_OK; - COM_TRY_END -} - -STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, - Int32 _aTestMode, IArchiveExtractCallback *extractCallback) -{ - COM_TRY_BEGIN - bool allFilesMode = (numItems == UInt32(-1)); - if (allFilesMode) - numItems = 1; - if(numItems == 0) - return S_OK; - if(numItems != 1) - return E_FAIL; - if (indices[0] != 0) - return E_FAIL; - - bool testMode = (_aTestMode != 0); - - UInt64 currentTotalSize = 0; - RINOK(extractCallback->SetTotal(m_Size)); - RINOK(extractCallback->SetCompleted(¤tTotalSize)); - CMyComPtr realOutStream; - Int32 askMode; - askMode = testMode ? NArchive::NExtract::NAskMode::kTest : - NArchive::NExtract::NAskMode::kExtract; - Int32 index = 0; - - RINOK(extractCallback->GetStream(index, &realOutStream, askMode)); - - if(!testMode && (!realOutStream)) - return S_OK; - - RINOK(extractCallback->PrepareOperation(askMode)); - - if (testMode) - { - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - return S_OK; - } - - RINOK(m_InStream->Seek(m_Pos, STREAM_SEEK_SET, NULL)); - - CMyComPtr copyCoder = new NCompress::CCopyCoder; - - CLocalProgress *localProgressSpec = new CLocalProgress; - CMyComPtr progress = localProgressSpec; - localProgressSpec->Init(extractCallback, false); - - try - { - RINOK(copyCoder->Code(m_InStream, realOutStream, NULL, NULL, progress)); - } - catch(...) - { - realOutStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kDataError)); - return S_OK; - } - realOutStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - return S_OK; - COM_TRY_END -} - -}} diff --git a/7zip/Archive/RPM/RpmHandler.h b/7zip/Archive/RPM/RpmHandler.h deleted file mode 100755 index 484c6c54..00000000 --- a/7zip/Archive/RPM/RpmHandler.h +++ /dev/null @@ -1,46 +0,0 @@ -// RPM/Handler.h - -#ifndef __RPM_HANDLER_H -#define __RPM_HANDLER_H - -#include "Common/MyCom.h" -#include "../IArchive.h" - -namespace NArchive { -namespace NRpm { - -class CHandler: - public IInArchive, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP - - STDMETHOD(Open)(IInStream *stream, - const UInt64 *maxCheckStartPosition, - IArchiveOpenCallback *openArchiveCallback); - STDMETHOD(Close)(); - STDMETHOD(GetNumberOfItems)(UInt32 *numItems); - STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value); - STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems, - Int32 testMode, IArchiveExtractCallback *extractCallback); - - STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value); - - STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties); - STDMETHOD(GetPropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - - STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties); - STDMETHOD(GetArchivePropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - -private: - CMyComPtr m_InStream; - UInt64 m_Pos; - UInt64 m_Size; -}; - -}} - -#endif diff --git a/7zip/Archive/RPM/RpmHeader.h b/7zip/Archive/RPM/RpmHeader.h deleted file mode 100755 index d76963bd..00000000 --- a/7zip/Archive/RPM/RpmHeader.h +++ /dev/null @@ -1,63 +0,0 @@ -// Archive/RpmHeader.h - -#ifndef __ARCHIVE_RPM_HEADER_H -#define __ARCHIVE_RPM_HEADER_H - -#include "Common/Types.h" - -namespace NArchive { -namespace NRpm { - -/* Reference: lib/signature.h of rpm package */ -#define RPMSIG_NONE 0 /* Do not change! */ -/* The following types are no longer generated */ -#define RPMSIG_PGP262_1024 1 /* No longer generated */ /* 256 byte */ -/* These are the new-style signatures. They are Header structures. */ -/* Inside them we can put any number of any type of signature we like. */ - -#define RPMSIG_HEADERSIG 5 /* New Header style signature */ - -const UInt32 kLeadSize = 96; -struct CLead -{ - unsigned char Magic[4]; - unsigned char Major; // not supported ver1, only support 2,3 and lator - unsigned char Minor; - UInt16 Type; - UInt16 ArchNum; - char Name[66]; - UInt16 OSNum; - UInt16 SignatureType; - char Reserved[16]; // pad to 96 bytes -- 8 byte aligned - bool MagicCheck() const - { return Magic[0] == 0xed && Magic[1] == 0xab && Magic[2] == 0xee && Magic[3] == 0xdb; }; -}; - -const UInt32 kEntryInfoSize = 16; -/* -struct CEntryInfo -{ - int Tag; - int Type; - int Offset; // Offset from beginning of data segment, only defined on disk - int Count; -}; -*/ - -// case: SignatureType == RPMSIG_HEADERSIG -const UInt32 kCSigHeaderSigSize = 16; -struct CSigHeaderSig -{ - unsigned char Magic[4]; - UInt32 Reserved; - UInt32 IndexLen; // count of index entries - UInt32 DataLen; // number of bytes - bool MagicCheck() - { return Magic[0] == 0x8e && Magic[1] == 0xad && Magic[2] == 0xe8 && Magic[3] == 0x01; }; - UInt32 GetLostHeaderLen() - { return IndexLen * kEntryInfoSize + DataLen; }; -}; - -}} - -#endif diff --git a/7zip/Archive/RPM/RpmIn.cpp b/7zip/Archive/RPM/RpmIn.cpp deleted file mode 100755 index c1600894..00000000 --- a/7zip/Archive/RPM/RpmIn.cpp +++ /dev/null @@ -1,112 +0,0 @@ -// Archive/RpmIn.cpp - -#include "StdAfx.h" - -#include "RpmIn.h" - -#include "RpmHeader.h" - -#include "Windows/Defs.h" -#include "Common/MyCom.h" - -#include "../../Common/StreamUtils.h" - -namespace NArchive { -namespace NRpm { - -static UInt16 GetUInt16(const char *data) -{ - return (UInt16)((Byte)data[1] | (((UInt16)(Byte)data[0]) << 8)); -} - -static UInt32 GetUInt32(const char *data) -{ - return - ((UInt32)(Byte)data[3]) | - (((UInt32)(Byte)data[2]) << 8) | - (((UInt32)(Byte)data[1]) << 16) | - (((UInt32)(Byte)data[0]) << 24); -} - -static HRESULT RedSigHeaderSig(IInStream *inStream, CSigHeaderSig &h) -{ - char dat[kCSigHeaderSigSize]; - char *cur = dat; - UInt32 processedSize; - RINOK(ReadStream(inStream, dat, kCSigHeaderSigSize, &processedSize)); - if (kCSigHeaderSigSize != processedSize) - return S_FALSE; - memmove(h.Magic, cur, 4); - cur += 4; - cur += 4; - h.IndexLen = GetUInt32(cur); - cur += 4; - h.DataLen = GetUInt32(cur); - return S_OK; -} - -HRESULT OpenArchive(IInStream *inStream) -{ - UInt64 pos; - char leadData[kLeadSize]; - char *cur = leadData; - CLead lead; - UInt32 processedSize; - RINOK(ReadStream(inStream, leadData, kLeadSize, &processedSize)); - if (kLeadSize != processedSize) - return S_FALSE; - memmove(lead.Magic, cur, 4); - cur += 4; - lead.Major = *cur++; - lead.Minor = *cur++; - lead.Type = GetUInt16(cur); - cur += 2; - lead.ArchNum = GetUInt16(cur); - cur += 2; - memmove(lead.Name, cur, sizeof(lead.Name)); - cur += sizeof(lead.Name); - lead.OSNum = GetUInt16(cur); - cur += 2; - lead.SignatureType = GetUInt16(cur); - cur += 2; - - if (!lead.MagicCheck() || lead.Major < 3) - return S_FALSE; - - CSigHeaderSig sigHeader, header; - if(lead.SignatureType == RPMSIG_NONE) - { - ; - } - else if(lead.SignatureType == RPMSIG_PGP262_1024) - { - UInt64 pos; - RINOK(inStream->Seek(256, STREAM_SEEK_CUR, &pos)); - } - else if(lead.SignatureType == RPMSIG_HEADERSIG) - { - RINOK(RedSigHeaderSig(inStream, sigHeader)); - if(!sigHeader.MagicCheck()) - return S_FALSE; - UInt32 len = sigHeader.GetLostHeaderLen(); - RINOK(inStream->Seek(len, STREAM_SEEK_CUR, &pos)); - if((pos % 8) != 0) - { - RINOK(inStream->Seek((pos / 8 + 1) * 8 - pos, - STREAM_SEEK_CUR, &pos)); - } - } - else - return S_FALSE; - - RINOK(RedSigHeaderSig(inStream, header)); - if(!header.MagicCheck()) - return S_FALSE; - int headerLen = header.GetLostHeaderLen(); - if(headerLen == -1) - return S_FALSE; - RINOK(inStream->Seek(headerLen, STREAM_SEEK_CUR, &pos)); - return S_OK; -} - -}} diff --git a/7zip/Archive/RPM/RpmIn.h b/7zip/Archive/RPM/RpmIn.h deleted file mode 100755 index ec798cb8..00000000 --- a/7zip/Archive/RPM/RpmIn.h +++ /dev/null @@ -1,15 +0,0 @@ -// Archive/RpmIn.h - -#ifndef __ARCHIVE_RPM_IN_H -#define __ARCHIVE_RPM_IN_H - -#include "../../IStream.h" - -namespace NArchive { -namespace NRpm { - -HRESULT OpenArchive(IInStream *inStream); - -}} - -#endif diff --git a/7zip/Archive/RPM/StdAfx.cpp b/7zip/Archive/RPM/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Archive/RPM/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Archive/RPM/StdAfx.h b/7zip/Archive/RPM/StdAfx.h deleted file mode 100755 index e7fb6986..00000000 --- a/7zip/Archive/RPM/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Archive/RPM/makefile b/7zip/Archive/RPM/makefile deleted file mode 100755 index afda1289..00000000 --- a/7zip/Archive/RPM/makefile +++ /dev/null @@ -1,42 +0,0 @@ -PROG = rpm.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib - -RPM_OBJS = \ - $O\DllExports.obj \ - $O\RpmHandler.obj \ - $O\RpmIn.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\NewHandler.obj \ - -WIN_OBJS = \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(RPM_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $O\CopyCoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(RPM_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) diff --git a/7zip/Archive/RPM/resource.rc b/7zip/Archive/RPM/resource.rc deleted file mode 100755 index 926f09aa..00000000 --- a/7zip/Archive/RPM/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Rpm Plugin", "rpm") - -101 ICON "rpm.ico" diff --git a/7zip/Archive/RPM/rpm.ico b/7zip/Archive/RPM/rpm.ico deleted file mode 100755 index cdeb8d1b..00000000 Binary files a/7zip/Archive/RPM/rpm.ico and /dev/null differ diff --git a/7zip/Archive/Rar/DllExports.cpp b/7zip/Archive/Rar/DllExports.cpp deleted file mode 100755 index 921bffb2..00000000 --- a/7zip/Archive/Rar/DllExports.cpp +++ /dev/null @@ -1,142 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "../../ICoder.h" -#include "../../IPassword.h" -#include "../Common/CodecsPath.h" - -// {23170F69-40C1-278B-0601-010000000000} -DEFINE_GUID(CLSID_CCrypto_AES128_Decoder, -0x23170F69, 0x40C1, 0x278B, 0x06, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00); - -#include "RarHandler.h" - -HINSTANCE g_hInstance; -#ifndef _UNICODE -bool g_IsNT = false; -static bool IsItWindowsNT() -{ - OSVERSIONINFO versionInfo; - versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); - if (!::GetVersionEx(&versionInfo)) - return false; - return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT); -} -#endif - -void GetCryptoFolderPrefix(TCHAR *path) -{ - CSysString s = GetCodecsFolderPrefix(); - lstrcpy(path, s); -} - - -// {23170F69-40C1-278B-0403-010000000000} -DEFINE_GUID(CLSID_CCompressRar15Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0403-020000000000} -DEFINE_GUID(CLSID_CCompressRar20Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0403-030000000000} -DEFINE_GUID(CLSID_CCompressRar29Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00); - -/* -// {23170F69-40C1-278B-06F1-0302000000000} -DEFINE_GUID(CLSID_CCryptoRar20Decoder, -0x23170F69, 0x40C1, 0x278B, 0x06, 0xF1, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-06F1-0303000000000} -DEFINE_GUID(CLSID_CCryptoRar29Decoder, -0x23170F69, 0x40C1, 0x278B, 0x06, 0xF1, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00); -*/ - -// {23170F69-40C1-278A-1000-000110030000} -DEFINE_GUID(CLSID_CRarHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x03, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - if (dwReason == DLL_PROCESS_ATTACH) - { - g_hInstance = hInstance; - #ifndef _UNICODE - g_IsNT = IsItWindowsNT(); - #endif - } - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CRarHandler) - return CLASS_E_CLASSNOTAVAILABLE; - int needIn = *interfaceID == IID_IInArchive; - if (needIn) - { - NArchive::NRar::CHandler *temp = new NArchive::NRar::CHandler; - if (needIn) - { - CMyComPtr inArchive = (IInArchive *)temp; - *outObject = inArchive.Detach(); - } - else - { - CMyComPtr outArchive = (IOutArchive *)temp; - *outObject = outArchive.Detach(); - } - } - else - return E_NOINTERFACE; - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Rar"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CRarHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"rar"; - break; - case NArchive::kUpdate: - propVariant = false; - break; - case NArchive::kKeepName: - propVariant = false; - break; - case NArchive::kStartSignature: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)NArchive::NRar::NHeader::kMarker, - NArchive::NRar::NHeader::kMarkerSize)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - } - propVariant.Detach(value); - return S_OK; -} diff --git a/7zip/Archive/Rar/Rar.dsp b/7zip/Archive/Rar/Rar.dsp deleted file mode 100755 index 739024da..00000000 --- a/7zip/Archive/Rar/Rar.dsp +++ /dev/null @@ -1,459 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Rar" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Rar - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Rar.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Rar.mak" CFG="Rar - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Rar - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Rar - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Rar - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RAR_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RAR_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-ZIP\Formats\rar.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Rar - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RAR_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RAR_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-ZIP\Formats\rar.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Rar - Win32 Release" -# Name "Rar - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\DynamicBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Types.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\UTFConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\UTFConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\CodecsPath.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\CodecsPath.h -# End Source File -# Begin Source File - -SOURCE=..\Common\CoderLoader.h -# End Source File -# Begin Source File - -SOURCE=..\Common\FilterCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\FilterCoder.h -# End Source File -# Begin Source File - -SOURCE=..\Common\IArchiveHandler.h -# End Source File -# Begin Source File - -SOURCE=..\Common\InStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\InStreamWithCRC.h -# End Source File -# Begin Source File - -SOURCE=..\Common\OutStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\OutStreamWithCRC.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Handle.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Thread.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\RarHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\RarHandler.h -# End Source File -# Begin Source File - -SOURCE=.\RarHeader.cpp -# End Source File -# Begin Source File - -SOURCE=.\RarHeader.h -# End Source File -# Begin Source File - -SOURCE=.\RarIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\RarIn.h -# End Source File -# Begin Source File - -SOURCE=.\RarItem.cpp -# End Source File -# Begin Source File - -SOURCE=.\RarItem.h -# End Source File -# Begin Source File - -SOURCE=.\RarVolumeInStream.cpp -# End Source File -# Begin Source File - -SOURCE=.\RarVolumeInStream.h -# End Source File -# End Group -# Begin Group "Crypto" - -# PROP Default_Filter "" -# Begin Group "Rar29" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\RarAES\RarAES.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\RarAES\RarAES.h -# End Source File -# End Group -# Begin Group "Rar20" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\Rar20\Rar20Cipher.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Rar20\Rar20Cipher.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Rar20\Rar20Crypto.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Rar20\Rar20Crypto.h -# End Source File -# End Group -# Begin Group "Hash" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Sha1.cpp - -!IF "$(CFG)" == "Rar - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Rar - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Sha1.h -# End Source File -# End Group -# End Group -# Begin Group "7-zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "7z" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\7z\7zMethodID.cpp -# End Source File -# Begin Source File - -SOURCE=..\7z\7zMethodID.h -# End Source File -# Begin Source File - -SOURCE=..\7z\7zMethods.cpp -# End Source File -# Begin Source File - -SOURCE=..\7z\7zMethods.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\Rar.ico -# End Source File -# End Target -# End Project diff --git a/7zip/Archive/Rar/Rar.dsw b/7zip/Archive/Rar/Rar.dsw deleted file mode 100755 index 3dab87aa..00000000 --- a/7zip/Archive/Rar/Rar.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Rar"=.\Rar.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Archive/Rar/RarHandler.cpp b/7zip/Archive/Rar/RarHandler.cpp deleted file mode 100755 index 3389f0e2..00000000 --- a/7zip/Archive/Rar/RarHandler.cpp +++ /dev/null @@ -1,941 +0,0 @@ -// RarHandler.cpp - -#include "StdAfx.h" - -#include "RarHandler.h" - -#include "Common/StringConvert.h" -#include "Common/ComTry.h" -#include "Common/IntToString.h" - -#include "Windows/PropVariant.h" -#include "Windows/Time.h" - -#include "../../IPassword.h" - -#include "../../Common//ProgressUtils.h" -#include "../../Compress/Copy/CopyCoder.h" - -#include "../../Crypto/Rar20/Rar20Cipher.h" -#include "../../Crypto/RarAES/RarAES.h" - -#include "../Common/OutStreamWithCRC.h" -#include "../Common/CoderLoader.h" -#include "../Common/CodecsPath.h" -#include "../Common/FilterCoder.h" -#include "../Common/ItemNameUtils.h" - -#include "../7z/7zMethods.h" - -using namespace NWindows; -using namespace NTime; - -// {23170F69-40C1-278B-0403-010000000000} -DEFINE_GUID(CLSID_CCompressRar15Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0403-020000000000} -DEFINE_GUID(CLSID_CCompressRar20Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0403-030000000000} -DEFINE_GUID(CLSID_CCompressRar29Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00); - - -namespace NArchive { -namespace NRar { - -static const wchar_t *kHostOS[] = -{ - L"MS DOS", - L"OS/2", - L"Win32", - L"Unix", - L"Mac OS", - L"BeOS" -}; - -static const int kNumHostOSes = sizeof(kHostOS) / sizeof(kHostOS[0]); - -static const wchar_t *kUnknownOS = L"Unknown"; - -enum // PropID -{ - kpidUnPackVersion = kpidUserDefined -}; - -STATPROPSTG kProperties[] = -{ - { NULL, kpidPath, VT_BSTR}, - { NULL, kpidIsFolder, VT_BOOL}, - { NULL, kpidSize, VT_UI8}, - { NULL, kpidPackedSize, VT_UI8}, - { NULL, kpidLastWriteTime, VT_FILETIME}, - { NULL, kpidCreationTime, VT_FILETIME}, - { NULL, kpidLastAccessTime, VT_FILETIME}, - { NULL, kpidAttributes, VT_UI4}, - - - { NULL, kpidEncrypted, VT_BOOL}, - { NULL, kpidSolid, VT_BOOL}, - { NULL, kpidCommented, VT_BOOL}, - { NULL, kpidSplitBefore, VT_BOOL}, - { NULL, kpidSplitAfter, VT_BOOL}, - { NULL, kpidCRC, VT_UI4}, - { NULL, kpidHostOS, VT_BSTR}, - { NULL, kpidMethod, VT_BSTR} - // { NULL, kpidDictionarySize, VT_UI4}, - // { L"UnPack Version", kpidUnPackVersion, VT_UI1} -}; - -STATPROPSTG kArchiveProperties[] = -{ - { NULL, kpidSolid, VT_BOOL}, - { NULL, kpidCommented, VT_BOOL}, -}; - -UInt64 CHandler::GetPackSize(int refIndex) const -{ - const CRefItem &refItem = _refItems[refIndex]; - UInt64 totalPackSize = 0; - for (int i = 0; i < refItem.NumItems; i++) - totalPackSize += _items[refItem.ItemIndex + i].PackSize; - return totalPackSize; -} - -STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value) -{ - COM_TRY_BEGIN - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case kpidSolid: - propVariant = _archiveInfo.IsSolid(); - break; - case kpidCommented: - propVariant = _archiveInfo.IsCommented(); - break; - } - propVariant.Detach(value); - return S_OK; - COM_TRY_END -} - -STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties) -{ - *numProperties = sizeof(kProperties) / sizeof(kProperties[0]); - return S_OK; -} - -STDMETHODIMP CHandler::GetPropertyInfo(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) -{ - if(index >= sizeof(kProperties) / sizeof(kProperties[0])) - return E_INVALIDARG; - const STATPROPSTG &srcItem = kProperties[index]; - *propID = srcItem.propid; - *varType = srcItem.vt; - *name = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) -{ - *numProperties = sizeof(kArchiveProperties) / sizeof(kArchiveProperties[0]); - return S_OK; -} - -STDMETHODIMP CHandler::GetArchivePropertyInfo(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) -{ - if(index >= sizeof(kArchiveProperties) / sizeof(kArchiveProperties[0])) - return E_INVALIDARG; - const STATPROPSTG &srcItem = kArchiveProperties[index]; - *propID = srcItem.propid; - *varType = srcItem.vt; - *name = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems) -{ - *numItems = _refItems.Size(); - return S_OK; -} - -static bool RarTimeToFileTime(const CRarTime &rarTime, FILETIME &result) -{ - if (!DosTimeToFileTime(rarTime.DosTime, result)) - return false; - UInt64 value = (((UInt64)result.dwHighDateTime) << 32) + result.dwLowDateTime; - value += (UInt64)rarTime.LowSecond * 10000000; - value += ((UInt64)rarTime.SubTime[2] << 16) + - ((UInt64)rarTime.SubTime[1] << 8) + - ((UInt64)rarTime.SubTime[0]); - result.dwLowDateTime = (DWORD)value; - result.dwHighDateTime = DWORD(value >> 32); - return true; -} - -STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) -{ - COM_TRY_BEGIN - NWindows::NCOM::CPropVariant propVariant; - const CRefItem &refItem = _refItems[index]; - const CItemEx &item = _items[refItem.ItemIndex]; - switch(propID) - { - case kpidPath: - { - UString u; - if (item.HasUnicodeName() && !item.UnicodeName.IsEmpty()) - u = item.UnicodeName; - else - u = MultiByteToUnicodeString(item.Name, CP_OEMCP); - propVariant = (const wchar_t *)NItemName::WinNameToOSName(u); - break; - } - case kpidIsFolder: - propVariant = item.IsDirectory(); - break; - case kpidSize: - propVariant = item.UnPackSize; - break; - case kpidPackedSize: - { - propVariant = GetPackSize(index); - break; - } - case kpidLastWriteTime: - { - FILETIME localFileTime, utcFileTime; - if (RarTimeToFileTime(item.LastWriteTime, localFileTime)) - { - if (!LocalFileTimeToFileTime(&localFileTime, &utcFileTime)) - utcFileTime.dwHighDateTime = utcFileTime.dwLowDateTime = 0; - } - else - utcFileTime.dwHighDateTime = utcFileTime.dwLowDateTime = 0; - propVariant = utcFileTime; - break; - } - case kpidCreationTime: - { - if (item.IsCreationTimeDefined) - { - FILETIME localFileTime, utcFileTime; - if (RarTimeToFileTime(item.CreationTime, localFileTime)) - { - if (!LocalFileTimeToFileTime(&localFileTime, &utcFileTime)) - utcFileTime.dwHighDateTime = utcFileTime.dwLowDateTime = 0; - } - else - utcFileTime.dwHighDateTime = utcFileTime.dwLowDateTime = 0; - propVariant = utcFileTime; - } - break; - } - case kpidLastAccessTime: - { - if (item.IsLastAccessTimeDefined) - { - FILETIME localFileTime, utcFileTime; - if (RarTimeToFileTime(item.LastAccessTime, localFileTime)) - { - if (!LocalFileTimeToFileTime(&localFileTime, &utcFileTime)) - utcFileTime.dwHighDateTime = utcFileTime.dwLowDateTime = 0; - } - else - utcFileTime.dwHighDateTime = utcFileTime.dwLowDateTime = 0; - propVariant = utcFileTime; - } - break; - } - case kpidAttributes: - propVariant = item.GetWinAttributes(); - break; - case kpidEncrypted: - propVariant = item.IsEncrypted(); - break; - case kpidSolid: - propVariant = IsSolid(index); - break; - case kpidCommented: - propVariant = item.IsCommented(); - break; - case kpidSplitBefore: - propVariant = item.IsSplitBefore(); - break; - case kpidSplitAfter: - propVariant = _items[refItem.ItemIndex + refItem.NumItems - 1].IsSplitAfter(); - break; - /* - case kpidDictionarySize: - if (!item.IsDirectory()) - propVariant = UInt32(0x10000 << item.GetDictSize()); - break; - */ - case kpidCRC: - { - const CItemEx &lastItem = - _items[refItem.ItemIndex + refItem.NumItems - 1]; - if (lastItem.IsSplitAfter()) - propVariant = item.FileCRC; - else - propVariant = lastItem.FileCRC; - break; - } - case kpidUnPackVersion: - propVariant = item.UnPackVersion; - break; - case kpidMethod: - { - UString method; - if (item.Method >= Byte('0') && item.Method <= Byte('5')) - { - method = L"m"; - wchar_t temp[32]; - ConvertUInt64ToString(item.Method - Byte('0'), temp); - method += temp; - if (!item.IsDirectory()) - { - method += L":"; - ConvertUInt64ToString(16 + item.GetDictSize(), temp); - method += temp; - } - } - else - { - wchar_t temp[32]; - ConvertUInt64ToString(item.Method, temp); - method += temp; - } - propVariant = method; - break; - } - case kpidHostOS: - propVariant = (item.HostOS < kNumHostOSes) ? - (kHostOS[item.HostOS]) : kUnknownOS; - break; - } - propVariant.Detach(value); - return S_OK; - COM_TRY_END -} - -class CVolumeName -{ - bool _first; - bool _newStyle; - UString _unchangedPart; - UString _changedPart; - UString _afterPart; -public: - CVolumeName(): _newStyle(true) {}; - - bool InitName(const UString &name, bool newStyle) - { - _first = true; - _newStyle = newStyle; - int dotPos = name.ReverseFind('.'); - UString basePart = name; - if (dotPos >= 0) - { - UString ext = name.Mid(dotPos + 1); - if (ext.CompareNoCase(L"RAR")==0 || - ext.CompareNoCase(L"EXE") == 0) - { - _afterPart = L".rar"; - basePart = name.Left(dotPos); - } - } - - if (!_newStyle) - { - _afterPart.Empty(); - _unchangedPart = basePart + UString(L"."); - _changedPart = L"r00"; - return true;; - } - - int numLetters = 1; - if (basePart.Right(numLetters) == L"1") - { - while (numLetters < basePart.Length()) - { - if (basePart[basePart.Length() - numLetters - 1] != '0') - break; - numLetters++; - } - } - else - return false; - _unchangedPart = basePart.Left(basePart.Length() - numLetters); - _changedPart = basePart.Right(numLetters); - return true; - } - - UString GetNextName() - { - UString newName; - if (_newStyle || !_first) - { - int i; - int numLetters = _changedPart.Length(); - for (i = numLetters - 1; i >= 0; i--) - { - wchar_t c = _changedPart[i]; - if (c == L'9') - { - c = L'0'; - newName = c + newName; - if (i == 0) - newName = UString(L'1') + newName; - continue; - } - c++; - newName = UString(c) + newName; - i--; - for (; i >= 0; i--) - newName = _changedPart[i] + newName; - break; - } - _changedPart = newName; - } - _first = false; - return _unchangedPart + _changedPart + _afterPart; - } -}; - -STDMETHODIMP CHandler::Open(IInStream *stream, - const UInt64 *maxCheckStartPosition, - IArchiveOpenCallback *openArchiveCallback) -{ - COM_TRY_BEGIN - Close(); - try - { - CMyComPtr openVolumeCallback; - CMyComPtr getTextPassword; - CMyComPtr openArchiveCallbackWrap = openArchiveCallback; - - CVolumeName seqName; - - if (openArchiveCallback != NULL) - { - openArchiveCallbackWrap.QueryInterface(IID_IArchiveOpenVolumeCallback, &openVolumeCallback); - RINOK(openArchiveCallback->SetTotal(NULL, NULL)); - UInt64 numFiles = _items.Size(); - RINOK(openArchiveCallback->SetCompleted(&numFiles, NULL)); - openArchiveCallbackWrap.QueryInterface(IID_ICryptoGetTextPassword, &getTextPassword); - } - - for (;;) - { - CMyComPtr inStream; - if (!_archives.IsEmpty()) - { - if (!openVolumeCallback) - break; - - if(_archives.Size() == 1) - { - if (!_archiveInfo.IsVolume()) - break; - UString baseName; - { - NCOM::CPropVariant propVariant; - RINOK(openVolumeCallback->GetProperty(kpidName, &propVariant)); - if (propVariant.vt != VT_BSTR) - break; - baseName = propVariant.bstrVal; - } - seqName.InitName(baseName, _archiveInfo.HaveNewVolumeName()); - } - - UString fullName = seqName.GetNextName(); - HRESULT result = openVolumeCallback->GetStream(fullName, &inStream); - if (result == S_FALSE) - break; - if (result != S_OK) - return result; - if (!stream) - break; - } - else - inStream = stream; - - NArchive::NRar::CInArchive archive; - if(!archive.Open(inStream, maxCheckStartPosition)) - return S_FALSE; - - if (_archives.IsEmpty()) - archive.GetArchiveInfo(_archiveInfo); - - CItemEx item; - for (;;) - { - HRESULT result = archive.GetNextItem(item, getTextPassword); - if (result == S_FALSE) - break; - RINOK(result); - if (item.IgnoreItem()) - continue; - - bool needAdd = true; - if (item.IsSplitBefore()) - { - if (!_refItems.IsEmpty()) - { - CRefItem &refItem = _refItems.Back(); - refItem.NumItems++; - needAdd = false; - } - } - if (needAdd) - { - CRefItem refItem; - refItem.ItemIndex = _items.Size(); - refItem.NumItems = 1; - refItem.VolumeIndex = _archives.Size(); - _refItems.Add(refItem); - } - _items.Add(item); - if (openArchiveCallback != NULL) - { - UInt64 numFiles = _items.Size(); - RINOK(openArchiveCallback->SetCompleted(&numFiles, NULL)); - } - } - _archives.Add(archive); - } - } - catch(...) - { - return S_FALSE; - } - return S_OK; - COM_TRY_END -} - -STDMETHODIMP CHandler::Close() -{ - COM_TRY_BEGIN - _refItems.Clear(); - _items.Clear(); - _archives.Clear(); - return S_OK; - COM_TRY_END -} - -struct CMethodItem -{ - Byte RarUnPackVersion; - CMyComPtr Coder; -}; - - -STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, - Int32 _aTestMode, IArchiveExtractCallback *_anExtractCallback) -{ - COM_TRY_BEGIN - CMyComPtr getTextPassword; - bool testMode = (_aTestMode != 0); - CMyComPtr extractCallback = _anExtractCallback; - UInt64 censoredTotalUnPacked = 0, - // censoredTotalPacked = 0, - importantTotalUnPacked = 0; - // importantTotalPacked = 0; - bool allFilesMode = (numItems == UInt32(-1)); - if (allFilesMode) - numItems = _refItems.Size(); - if(numItems == 0) - return S_OK; - int lastIndex = 0; - CRecordVector importantIndexes; - CRecordVector extractStatuses; - - for(UInt32 t = 0; t < numItems; t++) - { - int index = allFilesMode ? t : indices[t]; - const CRefItem &refItem = _refItems[index]; - const CItemEx &item = _items[refItem.ItemIndex]; - censoredTotalUnPacked += item.UnPackSize; - // censoredTotalPacked += item.PackSize; - int j; - for(j = lastIndex; j <= index; j++) - // if(!_items[_refItems[j].ItemIndex].IsSolid()) - if(!IsSolid(j)) - lastIndex = j; - for(j = lastIndex; j <= index; j++) - { - const CRefItem &refItem = _refItems[j]; - const CItemEx &item = _items[refItem.ItemIndex]; - - // const CItemEx &item = _items[j]; - - importantTotalUnPacked += item.UnPackSize; - // importantTotalPacked += item.PackSize; - importantIndexes.Add(j); - extractStatuses.Add(j == index); - } - lastIndex = index + 1; - } - - extractCallback->SetTotal(importantTotalUnPacked); - UInt64 currentImportantTotalUnPacked = 0; - UInt64 currentImportantTotalPacked = 0; - UInt64 currentUnPackSize, currentPackSize; - - /* - CSysString path = GetCodecsFolderPrefix() + TEXT("Rar29.dll"); - TCHAR compressLibPath[MAX_PATH + 64]; - if (!GetCompressFolderPrefix(compressLibPath)) - return ::GetLastError(); - lstrcat(compressLibPath, TEXT("Rar29.dll")); - */ - N7z::LoadMethodMap(); - CCoderLibraries libraries; - CObjectVector methodItems; - - /* - CCoderLibrary compressLib; - CMyComPtr decoder15; - CMyComPtr decoder20; - CMyComPtr decoder29; - */ - - NCompress::CCopyCoder *copyCoderSpec = NULL; - CMyComPtr copyCoder; - - // CCoderMixer *mixerCoderSpec; - // CMyComPtr mixerCoder; - // bool mixerCoderStoreMethod; - // int mixerCryptoVersion; - - CFilterCoder *filterStreamSpec = new CFilterCoder; - CMyComPtr filterStream = filterStreamSpec; - - NCrypto::NRar20::CDecoder *rar20CryptoDecoderSpec = NULL; - CMyComPtr rar20CryptoDecoder; - NCrypto::NRar29::CDecoder *rar29CryptoDecoderSpec = NULL; - CMyComPtr rar29CryptoDecoder; - - CFolderInStream *folderInStreamSpec = NULL; - CMyComPtr folderInStream; - - for(int i = 0; i < importantIndexes.Size(); i++, - currentImportantTotalUnPacked += currentUnPackSize, - currentImportantTotalPacked += currentPackSize) - { - RINOK(extractCallback->SetCompleted( - ¤tImportantTotalUnPacked)); - CMyComPtr realOutStream; - - Int32 askMode; - if(extractStatuses[i]) - askMode = testMode ? NArchive::NExtract::NAskMode::kTest : - NArchive::NExtract::NAskMode::kExtract; - else - askMode = NArchive::NExtract::NAskMode::kSkip; - - UInt32 index = importantIndexes[i]; - - const CRefItem &refItem = _refItems[index]; - const CItemEx &item = _items[refItem.ItemIndex]; - - currentUnPackSize = item.UnPackSize; - - currentPackSize = GetPackSize(index); - - if(item.IgnoreItem()) - continue; - - RINOK(extractCallback->GetStream(index, &realOutStream, askMode)); - - if(item.IsDirectory()) - { - RINOK(extractCallback->PrepareOperation(askMode)); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - continue; - } - - bool mustBeProcessedAnywhere = false; - if(i < importantIndexes.Size() - 1) - { - // const CRefItem &nextRefItem = _refItems[importantIndexes[i + 1]]; - // const CItemEx &nextItemInfo = _items[nextRefItem.ItemIndex]; - // mustBeProcessedAnywhere = nextItemInfo.IsSolid(); - mustBeProcessedAnywhere = IsSolid(importantIndexes[i + 1]); - } - - if (!mustBeProcessedAnywhere && !testMode && !realOutStream) - continue; - - if (!realOutStream && !testMode) - askMode = NArchive::NExtract::NAskMode::kSkip; - - RINOK(extractCallback->PrepareOperation(askMode)); - - COutStreamWithCRC *outStreamSpec = new COutStreamWithCRC; - CMyComPtr outStream(outStreamSpec); - outStreamSpec->SetStream(realOutStream); - outStreamSpec->Init(); - realOutStream.Release(); - - UInt64 packedPos = currentImportantTotalPacked; - UInt64 unpackedPos = currentImportantTotalUnPacked; - - /* - for (int partIndex = 0; partIndex < 1; partIndex++) - { - CMyComPtr inStream; - - // item redefinition - const CItemEx &item = _items[refItem.ItemIndex + partIndex]; - - NArchive::NRar::CInArchive &archive = _archives[refItem.VolumeIndex + partIndex]; - - inStream.Attach(archive.CreateLimitedStream(item.GetDataPosition(), - item.PackSize)); - */ - if (!folderInStream) - { - folderInStreamSpec = new CFolderInStream; - folderInStream = folderInStreamSpec; - } - - folderInStreamSpec->Init(&_archives, &_items, refItem); - - - CLocalProgress *localProgressSpec = new CLocalProgress; - CMyComPtr progress = localProgressSpec; - localProgressSpec->Init(extractCallback, false); - - CLocalCompressProgressInfo *localCompressProgressSpec = - new CLocalCompressProgressInfo; - CMyComPtr compressProgress = localCompressProgressSpec; - localCompressProgressSpec->Init(progress, - &packedPos, - &unpackedPos); - - UInt64 packSize = currentPackSize; - - // packedPos += item.PackSize; - // unpackedPos += 0; - - CMyComPtr inStream; - if (item.IsEncrypted()) - { - CMyComPtr cryptoSetPassword; - if (item.UnPackVersion >= 29) - { - if (!rar29CryptoDecoder) - { - rar29CryptoDecoderSpec = new NCrypto::NRar29::CDecoder; - rar29CryptoDecoder = rar29CryptoDecoderSpec; - // RINOK(rar29CryptoDecoder.CoCreateInstance(CLSID_CCryptoRar29Decoder)); - } - rar29CryptoDecoderSpec->SetRar350Mode(item.UnPackVersion < 36); - CMyComPtr cryptoProperties; - RINOK(rar29CryptoDecoder.QueryInterface(IID_ICompressSetDecoderProperties2, - &cryptoProperties)); - RINOK(cryptoProperties->SetDecoderProperties2(item.Salt, item.HasSalt() ? sizeof(item.Salt) : 0)); - filterStreamSpec->Filter = rar29CryptoDecoder; - } - else if (item.UnPackVersion >= 20) - { - if (!rar20CryptoDecoder) - { - rar20CryptoDecoderSpec = new NCrypto::NRar20::CDecoder; - rar20CryptoDecoder = rar20CryptoDecoderSpec; - // RINOK(rar20CryptoDecoder.CoCreateInstance(CLSID_CCryptoRar20Decoder)); - } - filterStreamSpec->Filter = rar20CryptoDecoder; - } - else - { - outStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kUnSupportedMethod)); - continue; - } - RINOK(filterStreamSpec->Filter.QueryInterface(IID_ICryptoSetPassword, - &cryptoSetPassword)); - - if (!getTextPassword) - extractCallback.QueryInterface(IID_ICryptoGetTextPassword, - &getTextPassword); - if (getTextPassword) - { - CMyComBSTR password; - RINOK(getTextPassword->CryptoGetTextPassword(&password)); - if (item.UnPackVersion >= 29) - { - CByteBuffer buffer; - UString unicodePassword(password); - const UInt32 sizeInBytes = unicodePassword.Length() * 2; - buffer.SetCapacity(sizeInBytes); - for (int i = 0; i < unicodePassword.Length(); i++) - { - wchar_t c = unicodePassword[i]; - ((Byte *)buffer)[i * 2] = (Byte)c; - ((Byte *)buffer)[i * 2 + 1] = (Byte)(c >> 8); - } - RINOK(cryptoSetPassword->CryptoSetPassword( - (const Byte *)buffer, sizeInBytes)); - } - else - { - AString oemPassword = UnicodeStringToMultiByte( - (const wchar_t *)password, CP_OEMCP); - RINOK(cryptoSetPassword->CryptoSetPassword( - (const Byte *)(const char *)oemPassword, oemPassword.Length())); - } - } - else - { - RINOK(cryptoSetPassword->CryptoSetPassword(0, 0)); - } - filterStreamSpec->SetInStream(folderInStream); - inStream = filterStream; - } - else - { - inStream = folderInStream; - } - CMyComPtr commonCoder; - switch(item.Method) - { - case '0': - { - if(copyCoderSpec == NULL) - { - copyCoderSpec = new NCompress::CCopyCoder; - copyCoder = copyCoderSpec; - } - commonCoder = copyCoder; - break; - } - case '1': - case '2': - case '3': - case '4': - case '5': - { - /* - if (item.UnPackVersion >= 29) - { - outStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kUnSupportedMethod)); - continue; - } - */ - int m; - for (m = 0; m < methodItems.Size(); m++) - if (methodItems[m].RarUnPackVersion == item.UnPackVersion) - break; - if (m == methodItems.Size()) - { - CMethodItem mi; - mi.RarUnPackVersion = item.UnPackVersion; - N7z::CMethodID methodID = { { 0x04, 0x03 } , 3 }; - - Byte myID; - if (item.UnPackVersion < 20) - myID = 1; - else if (item.UnPackVersion < 29) - myID = 2; - else - myID = 3; - methodID.ID[2] = myID; - N7z::CMethodInfo methodInfo; - if (!N7z::GetMethodInfo(methodID, methodInfo)) - { - RINOK(extractCallback->SetOperationResult( - NArchive::NExtract::NOperationResult::kUnSupportedMethod)); - continue; - } - RINOK(libraries.CreateCoder(methodInfo.FilePath, - methodInfo.Decoder, &mi.Coder)); - m = methodItems.Add(mi); - } - CMyComPtr decoder = methodItems[m].Coder; - - CMyComPtr compressSetDecoderProperties; - RINOK(decoder.QueryInterface(IID_ICompressSetDecoderProperties2, - &compressSetDecoderProperties)); - - Byte isSolid = (Byte)((IsSolid(index) || item.IsSplitBefore()) ? 1: 0); - - RINOK(compressSetDecoderProperties->SetDecoderProperties2(&isSolid, 1)); - - commonCoder = decoder; - break; - } - default: - outStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kUnSupportedMethod)); - continue; - } - HRESULT result = commonCoder->Code(inStream, outStream, - &packSize, &item.UnPackSize, compressProgress); - if (item.IsEncrypted()) - filterStreamSpec->ReleaseInStream(); - if (result == S_FALSE) - { - outStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kDataError)); - continue; - } - if (result != S_OK) - return result; - - /* - if (refItem.NumItems == 1 && - !item.IsSplitBefore() && !item.IsSplitAfter()) - */ - { - const CItemEx &lastItem = _items[refItem.ItemIndex + refItem.NumItems - 1]; - bool crcOK = outStreamSpec->GetCRC() == lastItem.FileCRC; - outStream.Release(); - RINOK(extractCallback->SetOperationResult(crcOK ? NArchive::NExtract::NOperationResult::kOK: - NArchive::NExtract::NOperationResult::kCRCError)); - } - /* - else - { - bool crcOK = true; - for (int partIndex = 0; partIndex < refItem.NumItems; partIndex++) - { - const CItemEx &item = _items[refItem.ItemIndex + partIndex]; - if (item.FileCRC != folderInStreamSpec->CRCs[partIndex]) - { - crcOK = false; - break; - } - } - RINOK(extractCallback->SetOperationResult(crcOK ? NArchive::NExtract::NOperationResult::kOK: - NArchive::NExtract::NOperationResult::kCRCError)); - } - */ - } - return S_OK; - COM_TRY_END -} - -/* -STDMETHODIMP CHandler::ExtractAllItems(Int32 testMode, - IArchiveExtractCallback *extractCallback) -{ - COM_TRY_BEGIN - CRecordVector indices; - indices.Reserve(_refItems.Size()); - for(int i = 0; i < _refItems.Size(); i++) - indices.Add(i); - return Extract(&indices.Front(), _refItems.Size(), testMode, extractCallback); - COM_TRY_END -} -*/ - -}} diff --git a/7zip/Archive/Rar/RarHandler.h b/7zip/Archive/Rar/RarHandler.h deleted file mode 100755 index ea13e01e..00000000 --- a/7zip/Archive/Rar/RarHandler.h +++ /dev/null @@ -1,63 +0,0 @@ -// Rar/Handler.h - -#ifndef __RAR_HANDLER_H -#define __RAR_HANDLER_H - -#include "../IArchive.h" -#include "RarIn.h" -#include "RarVolumeInStream.h" - -namespace NArchive { -namespace NRar { - -class CHandler: - public IInArchive, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP - - STDMETHOD(Open)(IInStream *aStream, - const UInt64 *aMaxCheckStartPosition, - IArchiveOpenCallback *anOpenArchiveCallback); - STDMETHOD(Close)(); - STDMETHOD(GetNumberOfItems)(UInt32 *numItems); - STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value); - STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems, - Int32 testMode, IArchiveExtractCallback *anExtractCallback); - - STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value); - - STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties); - STDMETHOD(GetPropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - - STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties); - STDMETHOD(GetArchivePropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - -private: - CRecordVector _refItems; - CObjectVector _items; - CObjectVector _archives; - NArchive::NRar::CInArchiveInfo _archiveInfo; - - UInt64 GetPackSize(int refIndex) const; - // NArchive::NRar::CInArchive _archive; - - bool IsSolid(int refIndex) - { - const CItemEx &item = _items[_refItems[refIndex].ItemIndex]; - if (item.UnPackVersion < 20) - { - if (_archiveInfo.IsSolid()) - return (refIndex > 0); - return false; - } - return item.IsSolid(); - } -}; - -}} - -#endif diff --git a/7zip/Archive/Rar/RarHeader.cpp b/7zip/Archive/Rar/RarHeader.cpp deleted file mode 100755 index 94481e02..00000000 --- a/7zip/Archive/Rar/RarHeader.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// Archive/Rar/Headers.cpp - -#include "StdAfx.h" - -#include "RarHeader.h" - -namespace NArchive{ -namespace NRar{ -namespace NHeader{ - -Byte kMarker[kMarkerSize] = {0x52 + 1, 0x61, 0x72, 0x21, 0x1a, 0x07, 0x00}; - -class CMarkerInitializer -{ -public: - CMarkerInitializer() { kMarker[0]--; }; -}; - -static CMarkerInitializer markerInitializer; - -}}} diff --git a/7zip/Archive/Rar/RarHeader.h b/7zip/Archive/Rar/RarHeader.h deleted file mode 100755 index 832a21c0..00000000 --- a/7zip/Archive/Rar/RarHeader.h +++ /dev/null @@ -1,224 +0,0 @@ -// Archive/RarHeader.h - -#ifndef __ARCHIVE_RAR_HEADER_H -#define __ARCHIVE_RAR_HEADER_H - -#include "Common/Types.h" - -namespace NArchive{ -namespace NRar{ -namespace NHeader{ - -const int kMarkerSize = 7; -extern Byte kMarker[kMarkerSize]; - -const int kArchiveSolid = 0x1; - -namespace NBlockType -{ - enum EBlockType - { - kMarker = 0x72, - kArchiveHeader = 0x73, - kFileHeader = 0x74, - kCommentHeader = 0x75, - kOldAuthenticity = 0x76, - kSubBlock = 0x77, - kRecoveryRecord = 0x78, - kAuthenticity = 0x79, - - kEndOfArchive = 0x7B // Is not safe - }; -} - -namespace NArchive -{ - const UInt16 kVolume = 1; - const UInt16 kComment = 2; - const UInt16 kLock = 4; - const UInt16 kSolid = 8; - const UInt16 kNewVolName = 0x10; // ('volname.partN.rar') - const UInt16 kAuthenticity = 0x20; - const UInt16 kRecovery = 0x40; - const UInt16 kBlockEncryption = 0x80; - const UInt16 kFirstVolume = 0x100; // (set only by RAR 3.0 and later) - const UInt16 kEncryptVer = 0x200; // RAR 3.6 there is EncryptVer Byte in End of MainHeader - - const int kHeaderSizeMin = 7; - - struct CBlock - { - UInt16 CRC; - Byte Type; - UInt16 Flags; - UInt16 Size; - UInt16 Reserved1; - UInt32 Reserved2; - // UInt16 GetRealCRC() const; - }; - - const int kArchiveHeaderSize = 13; - - const int kBlockHeadersAreEncrypted = 0x80; - - struct CHeader360: public CBlock - { - Byte EncryptVersion; - bool IsEncrypted() const { return (Flags & NHeader::NArchive::kBlockEncryption) != 0; } - bool IsThereEncryptVer() const { return (Flags & NHeader::NArchive::kEncryptVer) != 0; } - bool IsEncryptOld() const { return (!IsThereEncryptVer() || EncryptVersion < 36); } - UInt32 GetBaseSize() const { return kArchiveHeaderSize + (IsEncryptOld() ? 0 : 1); } - }; -} - -namespace NFile -{ - const int kSplitBefore = 1 << 0; - const int kSplitAfter = 1 << 1; - const int kEncrypted = 1 << 2; - const int kComment = 1 << 3; - const int kSolid = 1 << 4; - - const int kDictBitStart = 5; - const int kNumDictBits = 3; - const int kDictMask = (1 << kNumDictBits) - 1; - const int kDictDirectoryValue = 0x7; - - const int kSize64Bits = 1 << 8; - const int kUnicodeName = 1 << 9; - const int kSalt = 1 << 10; - const int kOldVersion = 1 << 11; - const int kExtTime = 1 << 12; - // const int kExtFlags = 1 << 13; - // const int kSkipIfUnknown = 1 << 14; - - const int kLongBlock = 1 << 15; - - /* - struct CBlock - { - // UInt16 HeadCRC; - // Byte Type; - // UInt16 Flags; - // UInt16 HeadSize; - UInt32 PackSize; - UInt32 UnPackSize; - Byte HostOS; - UInt32 FileCRC; - UInt32 Time; - Byte UnPackVersion; - Byte Method; - UInt16 NameSize; - UInt32 Attributes; - }; - */ - - /* - struct CBlock32 - { - UInt16 HeadCRC; - Byte Type; - UInt16 Flags; - UInt16 HeadSize; - UInt32 PackSize; - UInt32 UnPackSize; - Byte HostOS; - UInt32 FileCRC; - UInt32 Time; - Byte UnPackVersion; - Byte Method; - UInt16 NameSize; - UInt32 Attributes; - UInt16 GetRealCRC(const void *aName, UInt32 aNameSize, - bool anExtraDataDefined = false, Byte *anExtraData = 0) const; - }; - struct CBlock64 - { - UInt16 HeadCRC; - Byte Type; - UInt16 Flags; - UInt16 HeadSize; - UInt32 PackSizeLow; - UInt32 UnPackSizeLow; - Byte HostOS; - UInt32 FileCRC; - UInt32 Time; - Byte UnPackVersion; - Byte Method; - UInt16 NameSize; - UInt32 Attributes; - UInt32 PackSizeHigh; - UInt32 UnPackSizeHigh; - UInt16 GetRealCRC(const void *aName, UInt32 aNameSize) const; - }; - */ - - const int kLabelFileAttribute = 0x08; - const int kWinFileDirectoryAttributeMask = 0x10; - - enum CHostOS - { - kHostMSDOS = 0, - kHostOS2 = 1, - kHostWin32 = 2, - kHostUnix = 3, - kHostMacOS = 4, - kHostBeOS = 5 - }; -} - -namespace NBlock -{ - const UInt16 kLongBlock = 1 << 15; - struct CBlock - { - UInt16 CRC; - Byte Type; - UInt16 Flags; - UInt16 HeadSize; - // UInt32 DataSize; - }; -} - -/* -struct CSubBlock -{ - UInt16 HeadCRC; - Byte HeadType; - UInt16 Flags; - UInt16 HeadSize; - UInt32 DataSize; - UInt16 SubType; - Byte Level; // Reserved : Must be 0 -}; - -struct CCommentBlock -{ - UInt16 HeadCRC; - Byte HeadType; - UInt16 Flags; - UInt16 HeadSize; - UInt16 UnpSize; - Byte UnpVer; - Byte Method; - UInt16 CommCRC; -}; - - -struct CProtectHeader -{ - UInt16 HeadCRC; - Byte HeadType; - UInt16 Flags; - UInt16 HeadSize; - UInt32 DataSize; - Byte Version; - UInt16 RecSectors; - UInt32 TotalBlocks; - Byte Mark[8]; -}; -*/ - -}}} - -#endif diff --git a/7zip/Archive/Rar/RarIn.cpp b/7zip/Archive/Rar/RarIn.cpp deleted file mode 100755 index 9a88feb7..00000000 --- a/7zip/Archive/Rar/RarIn.cpp +++ /dev/null @@ -1,535 +0,0 @@ -// Archive/RarIn.cpp - -#include "StdAfx.h" - -#include "Common/StringConvert.h" -#include "Common/CRC.h" -#include "Common/UTFConvert.h" - -#include "RarIn.h" -#include "../../Common/LimitedStreams.h" -#include "../../Common/StreamUtils.h" - -namespace NArchive { -namespace NRar { - -static const char kEndOfString = '\0'; - -void CInArchive::ThrowExceptionWithCode( - CInArchiveException::CCauseType cause) -{ - throw CInArchiveException(cause); -} - -bool CInArchive::Open(IInStream *inStream, const UInt64 *searchHeaderSizeLimit) -{ - m_CryptoMode = false; - if(inStream->Seek(0, STREAM_SEEK_CUR, &m_StreamStartPosition) != S_OK) - return false; - m_Position = m_StreamStartPosition; - m_Stream = inStream; - if (ReadMarkerAndArchiveHeader(searchHeaderSizeLimit)) - return true; - m_Stream.Release(); - return false; -} - -void CInArchive::Close() -{ - m_Stream.Release(); -} - - -static inline bool TestMarkerCandidate(const void *aTestBytes) -{ - for (UInt32 i = 0; i < NHeader::kMarkerSize; i++) - if (((const Byte *)aTestBytes)[i] != NHeader::kMarker[i]) - return false; - return true; -} - -bool CInArchive::FindAndReadMarker(const UInt64 *searchHeaderSizeLimit) -{ - // if (m_Length < NHeader::kMarkerSize) - // return false; - m_ArchiveStartPosition = 0; - m_Position = m_StreamStartPosition; - if(m_Stream->Seek(m_StreamStartPosition, STREAM_SEEK_SET, NULL) != S_OK) - return false; - - Byte marker[NHeader::kMarkerSize]; - UInt32 processedSize; - ReadBytes(marker, NHeader::kMarkerSize, &processedSize); - if(processedSize != NHeader::kMarkerSize) - return false; - if (TestMarkerCandidate(marker)) - return true; - - CByteDynamicBuffer dynamicBuffer; - static const UInt32 kSearchMarkerBufferSize = 0x10000; - dynamicBuffer.EnsureCapacity(kSearchMarkerBufferSize); - Byte *buffer = dynamicBuffer; - UInt32 numBytesPrev = NHeader::kMarkerSize - 1; - memmove(buffer, marker + 1, numBytesPrev); - UInt64 curTestPos = m_StreamStartPosition + 1; - for (;;) - { - if (searchHeaderSizeLimit != NULL) - if (curTestPos - m_StreamStartPosition > *searchHeaderSizeLimit) - break; - UInt32 numReadBytes = kSearchMarkerBufferSize - numBytesPrev; - ReadBytes(buffer + numBytesPrev, numReadBytes, &processedSize); - UInt32 numBytesInBuffer = numBytesPrev + processedSize; - if (numBytesInBuffer < NHeader::kMarkerSize) - break; - UInt32 numTests = numBytesInBuffer - NHeader::kMarkerSize + 1; - for(UInt32 pos = 0; pos < numTests; pos++, curTestPos++) - { - if (TestMarkerCandidate(buffer + pos)) - { - m_ArchiveStartPosition = curTestPos; - m_Position = curTestPos + NHeader::kMarkerSize; - if(m_Stream->Seek(m_Position, STREAM_SEEK_SET, NULL) != S_OK) - return false; - return true; - } - } - numBytesPrev = numBytesInBuffer - numTests; - memmove(buffer, buffer + numTests, numBytesPrev); - } - return false; -} - -void CInArchive::ThrowUnexpectedEndOfArchiveException() -{ - ThrowExceptionWithCode(CInArchiveException::kUnexpectedEndOfArchive); -} - -bool CInArchive::ReadBytesAndTestSize(void *data, UInt32 size) -{ - if (m_CryptoMode) - { - const Byte *bufData = (const Byte *)m_DecryptedData; - UInt32 bufSize = m_DecryptedDataSize; - UInt32 i; - for (i = 0; i < size && m_CryptoPos < bufSize; i++) - ((Byte *)data)[i] = bufData[m_CryptoPos++]; - return (i == size); - } - UInt32 processedSize; - ReadStream(m_Stream, data, size, &processedSize); - return (processedSize == size); -} - -void CInArchive::ReadBytesAndTestResult(void *data, UInt32 size) -{ - if(!ReadBytesAndTestSize(data,size)) - ThrowUnexpectedEndOfArchiveException(); -} - -HRESULT CInArchive::ReadBytes(void *data, UInt32 size, UInt32 *processedSize) -{ - UInt32 realProcessedSize; - HRESULT result = ReadStream(m_Stream, data, size, &realProcessedSize); - if(processedSize != NULL) - *processedSize = realProcessedSize; - AddToSeekValue(realProcessedSize); - return result; -} - -bool CInArchive::ReadMarkerAndArchiveHeader(const UInt64 *searchHeaderSizeLimit) -{ - if (!FindAndReadMarker(searchHeaderSizeLimit)) - return false; - - Byte buf[NHeader::NArchive::kArchiveHeaderSize]; - UInt32 processedSize; - ReadBytes(buf, sizeof(buf), &processedSize); - if (processedSize != sizeof(buf)) - return false; - m_CurData = buf; - m_CurPos = 0; - m_PosLimit = sizeof(buf); - - m_ArchiveHeader.CRC = ReadUInt16(); - m_ArchiveHeader.Type = ReadByte(); - m_ArchiveHeader.Flags = ReadUInt16(); - m_ArchiveHeader.Size = ReadUInt16(); - m_ArchiveHeader.Reserved1 = ReadUInt16(); - m_ArchiveHeader.Reserved2 = ReadUInt32(); - m_ArchiveHeader.EncryptVersion = 0; - - CCRC crc; - crc.UpdateByte(m_ArchiveHeader.Type); - crc.UpdateUInt16(m_ArchiveHeader.Flags); - crc.UpdateUInt16(m_ArchiveHeader.Size); - crc.UpdateUInt16(m_ArchiveHeader.Reserved1); - crc.UpdateUInt32(m_ArchiveHeader.Reserved2); - - if (m_ArchiveHeader.IsThereEncryptVer() && m_ArchiveHeader.Size > NHeader::NArchive::kArchiveHeaderSize) - { - ReadBytes(&m_ArchiveHeader.EncryptVersion, 1, &processedSize); - if (processedSize != 1) - return false; - crc.UpdateByte(m_ArchiveHeader.EncryptVersion); - } - - if(m_ArchiveHeader.CRC != (crc.GetDigest() & 0xFFFF)) - ThrowExceptionWithCode(CInArchiveException::kArchiveHeaderCRCError); - if (m_ArchiveHeader.Type != NHeader::NBlockType::kArchiveHeader) - return false; - m_ArchiveCommentPosition = m_Position; - m_SeekOnArchiveComment = true; - return true; -} - -void CInArchive::SkipArchiveComment() -{ - if (!m_SeekOnArchiveComment) - return; - AddToSeekValue(m_ArchiveHeader.Size - m_ArchiveHeader.GetBaseSize()); - m_SeekOnArchiveComment = false; -} - -void CInArchive::GetArchiveInfo(CInArchiveInfo &archiveInfo) const -{ - archiveInfo.StartPosition = m_ArchiveStartPosition; - archiveInfo.Flags = m_ArchiveHeader.Flags; - archiveInfo.CommentPosition = m_ArchiveCommentPosition; - archiveInfo.CommentSize = (UInt16)(m_ArchiveHeader.Size - NHeader::NArchive::kArchiveHeaderSize); -} - -static void DecodeUnicodeFileName(const char *name, const Byte *encName, - int encSize, wchar_t *unicodeName, int maxDecSize) -{ - int encPos = 0; - int decPos = 0; - int flagBits = 0; - Byte flags = 0; - Byte highByte = encName[encPos++]; - while (encPos < encSize && decPos < maxDecSize) - { - if (flagBits == 0) - { - flags = encName[encPos++]; - flagBits = 8; - } - switch(flags >> 6) - { - case 0: - unicodeName[decPos++] = encName[encPos++]; - break; - case 1: - unicodeName[decPos++] = (wchar_t)(encName[encPos++] + (highByte << 8)); - break; - case 2: - unicodeName[decPos++] = (wchar_t)(encName[encPos] + (encName[encPos + 1] << 8)); - encPos += 2; - break; - case 3: - { - int length = encName[encPos++]; - if (length & 0x80) - { - Byte correction = encName[encPos++]; - for (length = (length & 0x7f) + 2; - length > 0 && decPos < maxDecSize; length--, decPos++) - unicodeName[decPos] = (wchar_t)(((name[decPos] + correction) & 0xff) + (highByte << 8)); - } - else - for (length += 2; length > 0 && decPos < maxDecSize; length--, decPos++) - unicodeName[decPos] = name[decPos]; - } - break; - } - flags <<= 2; - flagBits -= 2; - } - unicodeName[decPos < maxDecSize ? decPos : maxDecSize - 1] = 0; -} - -void CInArchive::ReadName(CItemEx &item, int nameSize) -{ - item.UnicodeName.Empty(); - if (nameSize > 0) - { - m_NameBuffer.EnsureCapacity(nameSize + 1); - char *buffer = (char *)m_NameBuffer; - - for (int i = 0; i < nameSize; i++) - buffer[i] = ReadByte(); - - int mainLen; - for (mainLen = 0; mainLen < nameSize; mainLen++) - if (buffer[mainLen] == '\0') - break; - buffer[mainLen] = '\0'; - item.Name = buffer; - - if(item.HasUnicodeName()) - { - if(mainLen < nameSize) - { - int unicodeNameSizeMax = MyMin(nameSize, (0x400)); - _unicodeNameBuffer.EnsureCapacity(unicodeNameSizeMax + 1); - DecodeUnicodeFileName(buffer, (const Byte *)buffer + mainLen + 1, - nameSize - (mainLen + 1), _unicodeNameBuffer, unicodeNameSizeMax); - item.UnicodeName = _unicodeNameBuffer; - } - else if (!ConvertUTF8ToUnicode(item.Name, item.UnicodeName)) - item.UnicodeName.Empty(); - } - } - else - item.Name.Empty(); -} - -Byte CInArchive::ReadByte() -{ - if (m_CurPos >= m_PosLimit) - throw CInArchiveException(CInArchiveException::kIncorrectArchive); - return m_CurData[m_CurPos++]; -} - -UInt16 CInArchive::ReadUInt16() -{ - UInt16 value = 0; - for (int i = 0; i < 2; i++) - { - Byte b = ReadByte(); - value |= (UInt16(b) << (8 * i)); - } - return value; -} - -UInt32 CInArchive::ReadUInt32() -{ - UInt32 value = 0; - for (int i = 0; i < 4; i++) - { - Byte b = ReadByte(); - value |= (UInt32(b) << (8 * i)); - } - return value; -} - -void CInArchive::ReadTime(Byte mask, CRarTime &rarTime) -{ - rarTime.LowSecond = (Byte)(((mask & 4) != 0) ? 1 : 0); - int numDigits = (mask & 3); - rarTime.SubTime[0] = rarTime.SubTime[1] = rarTime.SubTime[2] = 0; - for (int i = 0; i < numDigits; i++) - rarTime.SubTime[3 - numDigits + i] = ReadByte(); -} - -void CInArchive::ReadHeaderReal(CItemEx &item) -{ - item.Flags = m_BlockHeader.Flags; - item.PackSize = ReadUInt32(); - item.UnPackSize = ReadUInt32(); - item.HostOS = ReadByte(); - item.FileCRC = ReadUInt32(); - item.LastWriteTime.DosTime = ReadUInt32(); - item.UnPackVersion = ReadByte(); - item.Method = ReadByte(); - int nameSize = ReadUInt16(); - item.Attributes = ReadUInt32(); - - item.LastWriteTime.LowSecond = 0; - item.LastWriteTime.SubTime[0] = - item.LastWriteTime.SubTime[1] = - item.LastWriteTime.SubTime[2] = 0; - - if((item.Flags & NHeader::NFile::kSize64Bits) != 0) - { - item.PackSize |= ((UInt64)ReadUInt32() << 32); - item.UnPackSize |= ((UInt64)ReadUInt32() << 32); - } - - ReadName(item, nameSize); - - if (item.HasSalt()) - for (int i = 0; i < sizeof(item.Salt); i++) - item.Salt[i] = ReadByte(); - - // some rar archives have HasExtTime flag without field. - if (m_CurPos < m_PosLimit && item.HasExtTime()) - { - Byte accessMask = (Byte)(ReadByte() >> 4); - Byte b = ReadByte(); - Byte modifMask = (Byte)(b >> 4); - Byte createMask = (Byte)(b & 0xF); - if ((modifMask & 8) != 0) - ReadTime(modifMask, item.LastWriteTime); - item.IsCreationTimeDefined = ((createMask & 8) != 0); - if (item.IsCreationTimeDefined) - { - item.CreationTime.DosTime = ReadUInt32(); - ReadTime(createMask, item.CreationTime); - } - item.IsLastAccessTimeDefined = ((accessMask & 8) != 0); - if (item.IsLastAccessTimeDefined) - { - item.LastAccessTime.DosTime = ReadUInt32(); - ReadTime(accessMask, item.LastAccessTime); - } - } - - UInt16 fileHeaderWithNameSize = (UInt16)m_CurPos; - - item.Position = m_Position; - item.MainPartSize = fileHeaderWithNameSize; - item.CommentSize = (UInt16)(m_BlockHeader.HeadSize - fileHeaderWithNameSize); - - if (m_CryptoMode) - item.AlignSize = (UInt16)((16 - ((m_BlockHeader.HeadSize) & 0xF)) & 0xF); - else - item.AlignSize = 0; - AddToSeekValue(m_BlockHeader.HeadSize); -} - -void CInArchive::AddToSeekValue(UInt64 addValue) -{ - m_Position += addValue; -} - -HRESULT CInArchive::GetNextItem(CItemEx &item, ICryptoGetTextPassword *getTextPassword) -{ - if (m_SeekOnArchiveComment) - SkipArchiveComment(); - for (;;) - { - if(!SeekInArchive(m_Position)) - return S_FALSE; - if (!m_CryptoMode && (m_ArchiveHeader.Flags & - NHeader::NArchive::kBlockHeadersAreEncrypted) != 0) - { - m_CryptoMode = false; - if (getTextPassword == 0) - return S_FALSE; - if(!SeekInArchive(m_Position)) - return S_FALSE; - if (!m_RarAES) - { - m_RarAESSpec = new NCrypto::NRar29::CDecoder; - m_RarAES = m_RarAESSpec; - } - m_RarAESSpec->SetRar350Mode(m_ArchiveHeader.IsEncryptOld()); - - // Salt - const UInt32 kSaltSize = 8; - Byte salt[kSaltSize]; - if(!ReadBytesAndTestSize(salt, kSaltSize)) - return false; - m_Position += kSaltSize; - RINOK(m_RarAESSpec->SetDecoderProperties2(salt, kSaltSize)) - // Password - CMyComBSTR password; - RINOK(getTextPassword->CryptoGetTextPassword(&password)) - UString unicodePassword(password); - - CByteBuffer buffer; - const UInt32 sizeInBytes = unicodePassword.Length() * 2; - buffer.SetCapacity(sizeInBytes); - for (int i = 0; i < unicodePassword.Length(); i++) - { - wchar_t c = unicodePassword[i]; - ((Byte *)buffer)[i * 2] = (Byte)c; - ((Byte *)buffer)[i * 2 + 1] = (Byte)(c >> 8); - } - - RINOK(m_RarAESSpec->CryptoSetPassword((const Byte *)buffer, sizeInBytes)); - - const UInt32 kDecryptedBufferSize = (1 << 12); - if (m_DecryptedData.GetCapacity() == 0) - { - m_DecryptedData.SetCapacity(kDecryptedBufferSize); - } - RINOK(m_RarAES->Init()); - RINOK(ReadStream(m_Stream, (Byte *)m_DecryptedData, kDecryptedBufferSize, &m_DecryptedDataSize)); - m_DecryptedDataSize = m_RarAES->Filter((Byte *)m_DecryptedData, m_DecryptedDataSize); - - m_CryptoMode = true; - m_CryptoPos = 0; - } - - m_FileHeaderData.EnsureCapacity(7); - if(!ReadBytesAndTestSize((Byte *)m_FileHeaderData, 7)) - return S_FALSE; - - m_CurData = (Byte *)m_FileHeaderData; - m_CurPos = 0; - m_PosLimit = 7; - m_BlockHeader.CRC = ReadUInt16(); - m_BlockHeader.Type = ReadByte(); - m_BlockHeader.Flags = ReadUInt16(); - m_BlockHeader.HeadSize = ReadUInt16(); - - if (m_BlockHeader.HeadSize < 7) - ThrowExceptionWithCode(CInArchiveException::kIncorrectArchive); - - if (m_BlockHeader.Type == NHeader::NBlockType::kEndOfArchive) - return S_FALSE; - - if (m_BlockHeader.Type == NHeader::NBlockType::kFileHeader) - { - m_FileHeaderData.EnsureCapacity(m_BlockHeader.HeadSize); - m_CurData = (Byte *)m_FileHeaderData; - m_PosLimit = m_BlockHeader.HeadSize; - ReadBytesAndTestResult(m_CurData + m_CurPos, m_BlockHeader.HeadSize - 7); - ReadHeaderReal(item); - if ((CCRC::CalculateDigest(m_CurData + 2, - m_BlockHeader.HeadSize - item.CommentSize - 2) & 0xFFFF) != m_BlockHeader.CRC) - ThrowExceptionWithCode(CInArchiveException::kFileHeaderCRCError); - - FinishCryptoBlock(); - m_CryptoMode = false; - SeekInArchive(m_Position); // Move Position to compressed Data; - AddToSeekValue(item.PackSize); // m_Position points to next header; - return S_OK; - } - if (m_CryptoMode && m_BlockHeader.HeadSize > (1 << 12)) - return E_FAIL; // it's for bad passwords - if ((m_BlockHeader.Flags & NHeader::NBlock::kLongBlock) != 0) - { - m_FileHeaderData.EnsureCapacity(7 + 4); - m_CurData = (Byte *)m_FileHeaderData; - ReadBytesAndTestResult(m_CurData + m_CurPos, 4); // test it - m_PosLimit = 7 + 4; - UInt32 dataSize = ReadUInt32(); - AddToSeekValue(dataSize); - if (m_CryptoMode && dataSize > (1 << 27)) - return E_FAIL; // it's for bad passwords - m_CryptoPos = m_BlockHeader.HeadSize; - } - else - m_CryptoPos = 0; - AddToSeekValue(m_BlockHeader.HeadSize); - FinishCryptoBlock(); - m_CryptoMode = false; - } -} - -void CInArchive::DirectGetBytes(void *data, UInt32 size) -{ - ReadStream(m_Stream, data, size, NULL); -} - -bool CInArchive::SeekInArchive(UInt64 position) -{ - UInt64 newPosition; - m_Stream->Seek(position, STREAM_SEEK_SET, &newPosition); - return newPosition == position; -} - -ISequentialInStream* CInArchive::CreateLimitedStream(UInt64 position, UInt64 size) -{ - CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream; - CMyComPtr inStream(streamSpec); - SeekInArchive(position); - streamSpec->SetStream(m_Stream); - streamSpec->Init(size); - return inStream.Detach(); -} - -}} diff --git a/7zip/Archive/Rar/RarIn.h b/7zip/Archive/Rar/RarIn.h deleted file mode 100755 index 22262a74..00000000 --- a/7zip/Archive/Rar/RarIn.h +++ /dev/null @@ -1,124 +0,0 @@ -// RarIn.h - -#ifndef __ARCHIVE_RAR_IN_H -#define __ARCHIVE_RAR_IN_H - -#include "Common/DynamicBuffer.h" -#include "Common/Exception.h" -#include "Common/MyCom.h" -#include "../../IStream.h" -#include "../../ICoder.h" -#include "../../Common/StreamObjects.h" -#include "../../Crypto/RarAES/RarAES.h" -#include "RarHeader.h" -#include "RarItem.h" - -namespace NArchive { -namespace NRar { - -class CInArchiveException -{ -public: - enum CCauseType - { - kUnexpectedEndOfArchive = 0, - kArchiveHeaderCRCError, - kFileHeaderCRCError, - kIncorrectArchive, - } - Cause; - CInArchiveException(CCauseType cause) : Cause(cause) {} -}; - -class CInArchiveInfo -{ -public: - UInt64 StartPosition; - WORD Flags; - UInt64 CommentPosition; - WORD CommentSize; - bool IsSolid() const { return (Flags & NHeader::NArchive::kSolid) != 0; } - bool IsCommented() const { return (Flags & NHeader::NArchive::kComment) != 0; } - bool IsVolume() const { return (Flags & NHeader::NArchive::kVolume) != 0; } - bool HaveNewVolumeName() const { return (Flags & NHeader::NArchive::kNewVolName) != 0; } - bool IsEncrypted() const { return (Flags & NHeader::NArchive::kBlockEncryption) != 0; } -}; - -class CInArchive -{ - CMyComPtr m_Stream; - - UInt64 m_StreamStartPosition; - UInt64 m_Position; - UInt64 m_ArchiveStartPosition; - - NHeader::NArchive::CHeader360 m_ArchiveHeader; - CDynamicBuffer m_NameBuffer; - CDynamicBuffer _unicodeNameBuffer; - bool m_SeekOnArchiveComment; - UInt64 m_ArchiveCommentPosition; - - void ReadName(CItemEx &item, int nameSize); - void ReadHeaderReal(CItemEx &item); - - HRESULT ReadBytes(void *data, UInt32 size, UInt32 *aProcessedSize); - bool ReadBytesAndTestSize(void *data, UInt32 size); - void ReadBytesAndTestResult(void *data, UInt32 size); - - bool FindAndReadMarker(const UInt64 *searchHeaderSizeLimit); - void ThrowExceptionWithCode(CInArchiveException::CCauseType cause); - void ThrowUnexpectedEndOfArchiveException(); - - void AddToSeekValue(UInt64 addValue); - -protected: - - CDynamicBuffer m_FileHeaderData; - - NHeader::NBlock::CBlock m_BlockHeader; - - NCrypto::NRar29::CDecoder *m_RarAESSpec; - CMyComPtr m_RarAES; - - Byte *m_CurData; // it must point to start of Rar::Block - UInt32 m_CurPos; - UInt32 m_PosLimit; - Byte ReadByte(); - UInt16 ReadUInt16(); - UInt32 ReadUInt32(); - void ReadTime(Byte mask, CRarTime &rarTime); - - CBuffer m_DecryptedData; - UInt32 m_DecryptedDataSize; - - bool m_CryptoMode; - UInt32 m_CryptoPos; - void FinishCryptoBlock() - { - if (m_CryptoMode) - while ((m_CryptoPos & 0xF) != 0) - { - m_CryptoPos++; - m_Position++; - } - } - - bool ReadMarkerAndArchiveHeader(const UInt64 *searchHeaderSizeLimit); -public: - bool Open(IInStream *inStream, const UInt64 *searchHeaderSizeLimit); - void Close(); - HRESULT GetNextItem(CItemEx &item, ICryptoGetTextPassword *getTextPassword); - - void SkipArchiveComment(); - - void GetArchiveInfo(CInArchiveInfo &archiveInfo) const; - - void DirectGetBytes(void *data, UInt32 size); - - bool SeekInArchive(UInt64 position); - ISequentialInStream *CreateLimitedStream(UInt64 position, UInt64 size); -}; - -}} - -#endif diff --git a/7zip/Archive/Rar/RarItem.cpp b/7zip/Archive/Rar/RarItem.cpp deleted file mode 100755 index 61a72557..00000000 --- a/7zip/Archive/Rar/RarItem.cpp +++ /dev/null @@ -1,118 +0,0 @@ -// RarItem.cpp - -#include "StdAfx.h" - -#include "RarItem.h" -#include "RarHeader.h" - -namespace NArchive{ -namespace NRar{ - -bool CItem::IsEncrypted() const - { return (Flags & NHeader::NFile::kEncrypted) != 0; } -bool CItem::IsSolid() const - { return (Flags & NHeader::NFile::kSolid) != 0; } -bool CItem::IsCommented() const - { return (Flags & NHeader::NFile::kComment) != 0; } -bool CItem::IsSplitBefore() const - { return (Flags & NHeader::NFile::kSplitBefore) != 0; } -bool CItem::IsSplitAfter() const - { return (Flags & NHeader::NFile::kSplitAfter) != 0; } -bool CItem::HasSalt() const - { return (Flags & NHeader::NFile::kSalt) != 0; } -bool CItem::HasExtTime() const - { return (Flags & NHeader::NFile::kExtTime) != 0; } -bool CItem::HasUnicodeName() const - { return (Flags & NHeader::NFile::kUnicodeName) != 0; } -bool CItem::IsOldVersion() const - { return (Flags & NHeader::NFile::kOldVersion) != 0; } - -bool CItem::IgnoreItem() const -{ - switch(HostOS) - { - case NHeader::NFile::kHostMSDOS: - case NHeader::NFile::kHostOS2: - case NHeader::NFile::kHostWin32: - return ((Attributes & NHeader::NFile::kLabelFileAttribute) != 0); - } - return false; -} - -UInt32 CItem::GetDictSize() const -{ return (Flags >> NHeader::NFile::kDictBitStart) & NHeader::NFile::kDictMask; } - -bool CItem::IsDirectory() const -{ - if (GetDictSize() == NHeader::NFile::kDictDirectoryValue) - return true; - switch(HostOS) - { - case NHeader::NFile::kHostMSDOS: - case NHeader::NFile::kHostOS2: - case NHeader::NFile::kHostWin32: - if ((Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0) - return true; - } - return false; -} - -UInt32 CItem::GetWinAttributes() const -{ - UInt32 winAttributes; - switch(HostOS) - { - case NHeader::NFile::kHostMSDOS: - case NHeader::NFile::kHostOS2: - case NHeader::NFile::kHostWin32: - winAttributes = Attributes; - break; - default: - winAttributes = 0; // must be converted from unix value;; - } - if (IsDirectory()) // test it; - winAttributes |= NHeader::NFile::kWinFileDirectoryAttributeMask; - return winAttributes; -} - -void CItem::ClearFlags() -{ Flags = 0; } - -void CItem::SetFlagBits(int startBitNumber, int numBits, int value) -{ - UInt16 mask = (UInt16)(((1 << numBits) - 1) << startBitNumber); - Flags &= ~mask; - Flags |= value << startBitNumber; -} - -void CItem::SetBitMask(int bitMask, bool enable) -{ - if(enable) - Flags |= bitMask; - else - Flags &= ~bitMask; -} - -void CItem::SetDictSize(UInt32 size) -{ - SetFlagBits(NHeader::NFile::kDictBitStart, NHeader::NFile::kNumDictBits, (size & NHeader::NFile::kDictMask)); -} - -void CItem::SetAsDirectory(bool directory) -{ - if (directory) - SetDictSize(NHeader::NFile::kDictDirectoryValue); -} - -void CItem::SetEncrypted(bool encrypted) - { SetBitMask(NHeader::NFile::kEncrypted, encrypted); } -void CItem::SetSolid(bool solid) - { SetBitMask(NHeader::NFile::kSolid, solid); } -void CItem::SetCommented(bool commented) - { SetBitMask(NHeader::NFile::kComment, commented); } -void CItem::SetSplitBefore(bool splitBefore) - { SetBitMask(NHeader::NFile::kSplitBefore, splitBefore); } -void CItem::SetSplitAfter(bool splitAfter) - { SetBitMask(NHeader::NFile::kSplitAfter, splitAfter); } - -}} diff --git a/7zip/Archive/Rar/RarItem.h b/7zip/Archive/Rar/RarItem.h deleted file mode 100755 index 85050a42..00000000 --- a/7zip/Archive/Rar/RarItem.h +++ /dev/null @@ -1,91 +0,0 @@ -// RarItem.h - -#ifndef __ARCHIVE_RAR_ITEM_H -#define __ARCHIVE_RAR_ITEM_H - -#include "Common/Types.h" -#include "Common/String.h" - -namespace NArchive{ -namespace NRar{ - -struct CRarTime -{ - UInt32 DosTime; - Byte LowSecond; - Byte SubTime[3]; -}; - -class CItem -{ -public: - UInt16 Flags; - UInt64 PackSize; - UInt64 UnPackSize; - Byte HostOS; - UInt32 FileCRC; - - CRarTime CreationTime; - CRarTime LastWriteTime; - CRarTime LastAccessTime; - bool IsCreationTimeDefined; - // bool IsLastWriteTimeDefined; - bool IsLastAccessTimeDefined; - - Byte UnPackVersion; - Byte Method; - UInt32 Attributes; - AString Name; - UString UnicodeName; - - Byte Salt[8]; - - bool IsEncrypted() const; - bool IsSolid() const; - bool IsCommented() const; - bool IsSplitBefore() const; - bool IsSplitAfter() const; - bool HasSalt() const; - bool HasExtTime() const; - - bool HasUnicodeName() const; - bool IsOldVersion() const; - - UInt32 GetDictSize() const; - bool IsDirectory() const; - bool IgnoreItem() const; - UInt32 GetWinAttributes() const; - - CItem(): IsCreationTimeDefined(false), IsLastAccessTimeDefined(false) {} -private: - void SetFlagBits(int startBitNumber, int numBits, int value); - void SetBitMask(int bitMask, bool enable); -public: - void ClearFlags(); - void SetDictSize(UInt32 size); - void SetAsDirectory(bool directory); - void SetEncrypted(bool encrypted); - void SetSolid(bool solid); - void SetCommented(bool commented); - void SetSplitBefore(bool splitBefore); - void SetSplitAfter(bool splitAfter); -}; - -class CItemEx: public CItem -{ -public: - UInt64 Position; - UInt16 MainPartSize; - UInt16 CommentSize; - UInt16 AlignSize; - UInt64 GetFullSize() const { return MainPartSize + CommentSize + AlignSize + PackSize; }; - // DWORD GetHeaderWithCommentSize() const { return MainPartSize + CommentSize; }; - UInt64 GetCommentPosition() const { return Position + MainPartSize; }; - UInt64 GetDataPosition() const { return GetCommentPosition() + CommentSize + AlignSize; }; -}; - -}} - -#endif - - diff --git a/7zip/Archive/Rar/RarVolumeInStream.cpp b/7zip/Archive/Rar/RarVolumeInStream.cpp deleted file mode 100755 index 32078e6d..00000000 --- a/7zip/Archive/Rar/RarVolumeInStream.cpp +++ /dev/null @@ -1,79 +0,0 @@ -// RarVolumeInStream.cpp - -#include "StdAfx.h" - -#include "RarVolumeInStream.h" - -#include "Windows/Defs.h" -#include "Common/Defs.h" - -namespace NArchive { -namespace NRar { - -void CFolderInStream::Init( - CObjectVector *archives, - const CObjectVector *items, - const CRefItem &refItem) -{ - _archives = archives; - _items = items; - _refItem = refItem; - _curIndex = 0; - CRCs.Clear(); - _fileIsOpen = false; -} - -HRESULT CFolderInStream::OpenStream() -{ - while (_curIndex < _refItem.NumItems) - { - const CItemEx &item = (*_items)[_refItem.ItemIndex + _curIndex]; - _stream.Attach((*_archives)[_refItem.VolumeIndex + _curIndex]. - CreateLimitedStream(item.GetDataPosition(), item.PackSize)); - _curIndex++; - _fileIsOpen = true; - _crc.Init(); - return S_OK; - } - return S_OK; -} - -HRESULT CFolderInStream::CloseStream() -{ - CRCs.Add(_crc.GetDigest()); - _stream.Release(); - _fileIsOpen = false; - return S_OK; -} - -STDMETHODIMP CFolderInStream::Read(void *data, UInt32 size, UInt32 *processedSize) -{ - UInt32 realProcessedSize = 0; - while ((_curIndex < _refItem.NumItems || _fileIsOpen) && size > 0) - { - if (_fileIsOpen) - { - UInt32 localProcessedSize; - RINOK(_stream->Read( - ((Byte *)data) + realProcessedSize, size, &localProcessedSize)); - _crc.Update(((Byte *)data) + realProcessedSize, localProcessedSize); - if (localProcessedSize == 0) - { - RINOK(CloseStream()); - continue; - } - realProcessedSize += localProcessedSize; - size -= localProcessedSize; - break; - } - else - { - RINOK(OpenStream()); - } - } - if (processedSize != 0) - *processedSize = realProcessedSize; - return S_OK; -} - -}} diff --git a/7zip/Archive/Rar/RarVolumeInStream.h b/7zip/Archive/Rar/RarVolumeInStream.h deleted file mode 100755 index 4c9a9e96..00000000 --- a/7zip/Archive/Rar/RarVolumeInStream.h +++ /dev/null @@ -1,50 +0,0 @@ -// RarVolumeInStream.h - -#ifndef __RAR_VOLUME_IN_STREAM_H -#define __RAR_VOLUME_IN_STREAM_H - -#include "../../IStream.h" -#include "Common/CRC.h" -#include "RarIn.h" - -namespace NArchive { -namespace NRar { - -struct CRefItem -{ - int VolumeIndex; - int ItemIndex; - int NumItems; -}; - -class CFolderInStream: - public ISequentialInStream, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP - - STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); - -private: - CObjectVector *_archives; - const CObjectVector *_items; - CRefItem _refItem; - int _curIndex; - CCRC _crc; - bool _fileIsOpen; - CMyComPtr _stream; - - HRESULT OpenStream(); - HRESULT CloseStream(); -public: - void Init(CObjectVector *archives, - const CObjectVector *items, - const CRefItem &refItem); - - CRecordVector CRCs; -}; - -}} - -#endif diff --git a/7zip/Archive/Rar/StdAfx.cpp b/7zip/Archive/Rar/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Archive/Rar/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Archive/Rar/StdAfx.h b/7zip/Archive/Rar/StdAfx.h deleted file mode 100755 index e7fb6986..00000000 --- a/7zip/Archive/Rar/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Archive/Rar/makefile b/7zip/Archive/Rar/makefile deleted file mode 100755 index 678dd412..00000000 --- a/7zip/Archive/Rar/makefile +++ /dev/null @@ -1,90 +0,0 @@ -PROG = rar.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib user32.lib - -RAR_OBJS = \ - $O\DllExports.obj \ - $O\RarHandler.obj \ - $O\RarHeader.obj \ - $O\RarIn.obj \ - $O\RarItem.obj \ - $O\RarVolumeInStream.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\CRC.obj \ - $O\IntToString.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\UTFConvert.obj \ - $O\Vector.obj \ - -WIN_OBJS = \ - $O\DLL.obj \ - $O\FileFind.obj \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\LimitedStreams.obj \ - $O\ProgressUtils.obj \ - $O\StreamObjects.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\CodecsPath.obj \ - $O\FilterCoder.obj \ - $O\InStreamWithCRC.obj \ - $O\OutStreamWithCRC.obj \ - -7Z_OBJS = \ - $O\7zMethodID.obj \ - $O\7zMethods.obj \ - -CRYPTO_HASH_OBJS = \ - $O\Sha1.obj \ - -CRYPTO_RAR20_OBJS = \ - $O\Rar20Cipher.obj \ - $O\Rar20Crypto.obj \ - -CRYPTO_RARAES_OBJS = \ - $O\RarAES.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(RAR_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(7Z_OBJS) \ - $(CRYPTO_HASH_OBJS) \ - $(CRYPTO_RAR20_OBJS) \ - $(CRYPTO_RARAES_OBJS) \ - $O\CopyCoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(RAR_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$(7Z_OBJS): ../7z/$(*B).cpp - $(COMPL) -$(CRYPTO_HASH_OBJS): ../../Crypto/Hash/$(*B).cpp - $(COMPL_O2) -$(CRYPTO_RAR20_OBJS): ../../Crypto/Rar20/$(*B).cpp - $(COMPL) -$(CRYPTO_RARAES_OBJS): ../../Crypto/RarAES/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) diff --git a/7zip/Archive/Rar/rar.ico b/7zip/Archive/Rar/rar.ico deleted file mode 100755 index 2918d294..00000000 Binary files a/7zip/Archive/Rar/rar.ico and /dev/null differ diff --git a/7zip/Archive/Rar/resource.rc b/7zip/Archive/Rar/resource.rc deleted file mode 100755 index 94b4198b..00000000 --- a/7zip/Archive/Rar/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Rar Plugin", "rar") - -101 ICON "rar.ico" diff --git a/7zip/Archive/Split/DllExports.cpp b/7zip/Archive/Split/DllExports.cpp deleted file mode 100755 index e28f64ce..00000000 --- a/7zip/Archive/Split/DllExports.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "SplitHandler.h" -#include "../../ICoder.h" - -// {23170F69-40C1-278A-1000-000110EA0000} -DEFINE_GUID(CLSID_CSplitHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0xEA, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /* lpReserved */) -{ - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CSplitHandler) - return CLASS_E_CLASSNOTAVAILABLE; - if (*interfaceID != IID_IInArchive) - return E_NOINTERFACE; - CMyComPtr inArchive = (IInArchive *)new NArchive::NSplit::CHandler; - *outObject = inArchive.Detach(); - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Split"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CSplitHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"001"; - break; - case NArchive::kUpdate: - propVariant = false; - break; - case NArchive::kKeepName: - propVariant = true; - break; - } - propVariant.Detach(value); - return S_OK; -} diff --git a/7zip/Archive/Split/Split.dsp b/7zip/Archive/Split/Split.dsp deleted file mode 100755 index d6229d98..00000000 --- a/7zip/Archive/Split/Split.dsp +++ /dev/null @@ -1,237 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Split" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Split - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Split.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Split.mak" CFG="Split - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Split - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Split - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Split - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SPLIT_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SPLIT_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\split.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Split - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SPLIT_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SPLIT_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\split.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Split - Win32 Release" -# Name "Split - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\Split.ico -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\MultiStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\MultiStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "Interface" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\IArchive.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\SplitHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\SplitHandler.h -# End Source File -# Begin Source File - -SOURCE=.\SplitHandlerOut.cpp -# End Source File -# End Target -# End Project diff --git a/7zip/Archive/Split/Split.dsw b/7zip/Archive/Split/Split.dsw deleted file mode 100755 index 988ca30a..00000000 --- a/7zip/Archive/Split/Split.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Split"=.\Split.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Archive/Split/Split.ico b/7zip/Archive/Split/Split.ico deleted file mode 100755 index 5cb93e84..00000000 Binary files a/7zip/Archive/Split/Split.ico and /dev/null differ diff --git a/7zip/Archive/Split/SplitHandler.cpp b/7zip/Archive/Split/SplitHandler.cpp deleted file mode 100755 index e919154f..00000000 --- a/7zip/Archive/Split/SplitHandler.cpp +++ /dev/null @@ -1,415 +0,0 @@ -// Tar/Handler.cpp - -#include "StdAfx.h" - -#include "SplitHandler.h" - -#include "Common/Defs.h" -#include "Common/StringConvert.h" -#include "Common/NewHandler.h" -#include "Common/ComTry.h" - -#include "Windows/Time.h" -#include "Windows/PropVariant.h" - -#include "../../Common/ProgressUtils.h" -#include "../../Compress/Copy/CopyCoder.h" -#include "../Common/ItemNameUtils.h" -#include "../Common/MultiStream.h" - -using namespace NWindows; -using namespace NTime; - -namespace NArchive { -namespace NSplit { - -STATPROPSTG kProperties[] = -{ - { NULL, kpidPath, VT_BSTR}, -// { NULL, kpidIsFolder, VT_BOOL}, - { NULL, kpidSize, VT_UI8}, - { NULL, kpidPackedSize, VT_UI8}, -}; - -STDMETHODIMP CHandler::GetArchiveProperty(PROPID /* propID */, PROPVARIANT *value) -{ - value->vt = VT_EMPTY; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties) -{ - *numProperties = sizeof(kProperties) / sizeof(kProperties[0]); - return S_OK; -} - -STDMETHODIMP CHandler::GetPropertyInfo(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) -{ - if(index >= sizeof(kProperties) / sizeof(kProperties[0])) - return E_INVALIDARG; - const STATPROPSTG &srcItem = kProperties[index]; - *propID = srcItem.propid; - *varType = srcItem.vt; - *name = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) -{ - *numProperties = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetArchivePropertyInfo(UInt32 /* index */, - BSTR * /* name */, PROPID * /* propID */, VARTYPE * /* varType */) -{ - return E_INVALIDARG; -} - -class CSeqName -{ -public: - UString _unchangedPart; - UString _changedPart; - bool _splitStyle; - UString GetNextName() - { - UString newName; - if (_splitStyle) - { - int i; - int numLetters = _changedPart.Length(); - for (i = numLetters - 1; i >= 0; i--) - { - wchar_t c = _changedPart[i]; - if (c == 'z') - { - c = 'a'; - newName = c + newName; - continue; - } - else if (c == 'Z') - { - c = 'A'; - newName = c + newName; - continue; - } - c++; - if ((c == 'z' || c == 'Z') && i == 0) - { - _unchangedPart += c; - wchar_t newChar = (c == 'z') ? L'a' : L'A'; - newName.Empty(); - numLetters++; - for (int k = 0; k < numLetters; k++) - newName += newChar; - break; - } - newName = c + newName; - i--; - for (; i >= 0; i--) - newName = _changedPart[i] + newName; - break; - } - } - else - { - int i; - int numLetters = _changedPart.Length(); - for (i = numLetters - 1; i >= 0; i--) - { - wchar_t c = _changedPart[i]; - if (c == L'9') - { - c = L'0'; - newName = c + newName; - if (i == 0) - newName = UString(L'1') + newName; - continue; - } - c++; - newName = c + newName; - i--; - for (; i >= 0; i--) - newName = _changedPart[i] + newName; - break; - } - } - _changedPart = newName; - return _unchangedPart + _changedPart; - } -}; - -STDMETHODIMP CHandler::Open(IInStream *stream, - const UInt64 * /* maxCheckStartPosition */, - IArchiveOpenCallback *openArchiveCallback) -{ - COM_TRY_BEGIN - Close(); - if (openArchiveCallback == 0) - return S_FALSE; - // try - { - CMyComPtr openVolumeCallback; - CMyComPtr openArchiveCallbackWrap = openArchiveCallback; - if (openArchiveCallbackWrap.QueryInterface(IID_IArchiveOpenVolumeCallback, - &openVolumeCallback) != S_OK) - return S_FALSE; - - { - NCOM::CPropVariant propVariant; - RINOK(openVolumeCallback->GetProperty(kpidName, &propVariant)); - if (propVariant.vt != VT_BSTR) - return S_FALSE; - _name = propVariant.bstrVal; - } - - int dotPos = _name.ReverseFind('.'); - UString prefix, ext; - if (dotPos >= 0) - { - prefix = _name.Left(dotPos + 1); - ext = _name.Mid(dotPos + 1); - } - else - ext = _name; - UString extBig = ext; - extBig.MakeUpper(); - - CSeqName seqName; - - int numLetters = 2; - bool splitStyle = false; - if (extBig.Right(2) == L"AA") - { - splitStyle = true; - while (numLetters < extBig.Length()) - { - if (extBig[extBig.Length() - numLetters - 1] != 'A') - break; - numLetters++; - } - } - else if (ext.Right(2) == L"01") - { - while (numLetters < extBig.Length()) - { - if (extBig[extBig.Length() - numLetters - 1] != '0') - break; - numLetters++; - } - if (numLetters != ext.Length()) - return S_FALSE; - } - else - return S_FALSE; - - _streams.Add(stream); - - seqName._unchangedPart = prefix + ext.Left(extBig.Length() - numLetters); - seqName._changedPart = ext.Right(numLetters); - seqName._splitStyle = splitStyle; - - if (prefix.Length() < 1) - _subName = L"file"; - else - _subName = prefix.Left(prefix.Length() - 1); - - _totalSize = 0; - UInt64 size; - { - NCOM::CPropVariant propVariant; - RINOK(openVolumeCallback->GetProperty(kpidSize, &propVariant)); - if (propVariant.vt != VT_UI8) - return E_INVALIDARG; - size = propVariant.uhVal.QuadPart; - } - _totalSize += size; - _sizes.Add(size); - - if (openArchiveCallback != NULL) - { - RINOK(openArchiveCallback->SetTotal(NULL, NULL)); - UInt64 numFiles = _streams.Size(); - RINOK(openArchiveCallback->SetCompleted(&numFiles, NULL)); - } - - for (;;) - { - UString fullName = seqName.GetNextName(); - CMyComPtr nextStream; - HRESULT result = openVolumeCallback->GetStream(fullName, &nextStream); - if (result == S_FALSE) - break; - if (result != S_OK) - return result; - if (!stream) - break; - { - NCOM::CPropVariant propVariant; - RINOK(openVolumeCallback->GetProperty(kpidSize, &propVariant)); - if (propVariant.vt != VT_UI8) - return E_INVALIDARG; - size = propVariant.uhVal.QuadPart; - } - _totalSize += size; - _sizes.Add(size); - _streams.Add(nextStream); - if (openArchiveCallback != NULL) - { - UInt64 numFiles = _streams.Size(); - RINOK(openArchiveCallback->SetCompleted(&numFiles, NULL)); - } - } - } - /* - catch(...) - { - return S_FALSE; - } - */ - return S_OK; - COM_TRY_END -} - -STDMETHODIMP CHandler::Close() -{ - _sizes.Clear(); - _streams.Clear(); - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems) -{ - *numItems = _streams.IsEmpty() ? 0 : 1; - return S_OK; -} - -STDMETHODIMP CHandler::GetProperty(UInt32 /* index */, PROPID propID, PROPVARIANT *value) -{ - COM_TRY_BEGIN - NWindows::NCOM::CPropVariant propVariant; - - switch(propID) - { - case kpidPath: - propVariant = _subName; - break; - case kpidIsFolder: - propVariant = false; - break; - case kpidSize: - case kpidPackedSize: - propVariant = _totalSize; - break; - } - propVariant.Detach(value); - return S_OK; - COM_TRY_END -} - -STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, - Int32 _aTestMode, IArchiveExtractCallback *_anExtractCallback) -{ - COM_TRY_BEGIN - - if (numItems != UInt32(-1)) - { - if (numItems != 1) - return E_INVALIDARG; - if (indices[0] != 0) - return E_INVALIDARG; - } - bool testMode = (_aTestMode != 0); - CMyComPtr extractCallback = _anExtractCallback; - extractCallback->SetTotal(_totalSize); - - /* - CMyComPtr volumeExtractCallback; - if (extractCallback.QueryInterface(&volumeExtractCallback) != S_OK) - return E_FAIL; - */ - - UInt64 currentTotalSize = 0; - UInt64 currentItemSize; - - RINOK(extractCallback->SetCompleted(¤tTotalSize)); - CMyComPtr realOutStream; - Int32 askMode; - askMode = testMode ? NArchive::NExtract::NAskMode::kTest : - NArchive::NExtract::NAskMode::kExtract; - Int32 index = 0; - RINOK(extractCallback->GetStream(index, &realOutStream, askMode)); - - RINOK(extractCallback->PrepareOperation(askMode)); - if (testMode) - { - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - return S_OK; - } - // currentItemSize = itemInfo.Size; - - if(!testMode && (!realOutStream)) - { - return S_OK; - } - - NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder; - CMyComPtr copyCoder = copyCoderSpec; - - for(int i = 0; i < _streams.Size(); i++, currentTotalSize += currentItemSize) - { - // CMyComPtr inStream; - // RINOK(volumeExtractCallback->GetInStream(_names[i], &inStream)); - - CLocalProgress *localProgressSpec = new CLocalProgress; - CMyComPtr progress = localProgressSpec; - localProgressSpec->Init(extractCallback, false); - CLocalCompressProgressInfo *localCompressProgressSpec = - new CLocalCompressProgressInfo; - CMyComPtr compressProgress = localCompressProgressSpec; - localCompressProgressSpec->Init(progress, - ¤tTotalSize, ¤tTotalSize); - IInStream *inStream = _streams[i]; - RINOK(inStream->Seek(0, STREAM_SEEK_SET, NULL)); - try - { - RINOK(copyCoder->Code(inStream, realOutStream, - NULL, NULL, compressProgress)); - } - catch(...) - { - realOutStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kDataError)); - return S_OK;; - } - currentItemSize = copyCoderSpec->TotalSize; - } - realOutStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - return S_OK; - COM_TRY_END -} - -STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream) -{ - if (index != 0) - return E_INVALIDARG; - *stream = 0; - CMultiStream *streamSpec = new CMultiStream; - CMyComPtr streamTemp = streamSpec; - for (int i = 0; i < _streams.Size(); i++) - { - CMultiStream::CSubStreamInfo subStreamInfo; - subStreamInfo.Stream = _streams[i]; - subStreamInfo.Pos = 0; - subStreamInfo.Size = _sizes[i]; - streamSpec->Streams.Add(subStreamInfo); - } - streamSpec->Init(); - *stream = streamTemp.Detach(); - return S_OK; -} - -}} diff --git a/7zip/Archive/Split/SplitHandler.h b/7zip/Archive/Split/SplitHandler.h deleted file mode 100755 index 8b3fcb70..00000000 --- a/7zip/Archive/Split/SplitHandler.h +++ /dev/null @@ -1,62 +0,0 @@ -// Split/Handler.h - -#ifndef __SPLIT_HANDLER_H -#define __SPLIT_HANDLER_H - -#include "Common/MyCom.h" -#include "Common/String.h" -#include "../IArchive.h" - -namespace NArchive { -namespace NSplit { - -class CHandler: - public IInArchive, - public IInArchiveGetStream, - // public IOutArchive, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP1(IInArchiveGetStream) - - STDMETHOD(Open)(IInStream *stream, - const UInt64 *maxCheckStartPosition, - IArchiveOpenCallback *openArchiveCallback); - STDMETHOD(Close)(); - STDMETHOD(GetNumberOfItems)(UInt32 *numItems); - STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value); - STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems, - Int32 testMode, IArchiveExtractCallback *extractCallback); - - STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value); - - STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties); - STDMETHOD(GetPropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - - STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties); - STDMETHOD(GetArchivePropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - - STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream); - - // IOutArchiveHandler - /* - STDMETHOD(UpdateItems)(ISequentialOutStream *outStream, UInt32 numItems, - IArchiveUpdateCallback *updateCallback); - - STDMETHOD(GetFileTimeType)(UInt32 *type); - */ - -private: - UString _subName; - UString _name; - CObjectVector > _streams; - CRecordVector _sizes; - - UInt64 _totalSize; -}; - -}} - -#endif diff --git a/7zip/Archive/Split/SplitHandlerOut.cpp b/7zip/Archive/Split/SplitHandlerOut.cpp deleted file mode 100755 index ea86c281..00000000 --- a/7zip/Archive/Split/SplitHandlerOut.cpp +++ /dev/null @@ -1,102 +0,0 @@ -// Split/OutHandler.cpp - -#include "StdAfx.h" - -#include "SplitHandler.h" -#include "../../../Windows/PropVariant.h" -#include "../../../Common/ComTry.h" -#include "../../../Common/StringToInt.h" - -using namespace NWindows; - -namespace NArchive { -namespace NSplit { - -/* -STDMETHODIMP CHandler::GetFileTimeType(UInt32 *type) -{ - *type = NFileTimeType::kWindows; - return S_OK; -} - -STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numItems, - IArchiveUpdateCallback *updateCallback) -{ - COM_TRY_BEGIN - - if (numItems != 1) - return E_INVALIDARG; - - UInt64 volumeSize = 0; - - CMyComPtr callback2; - updateCallback->QueryInterface(IID_IArchiveUpdateCallback2, - (void **)&callback2); - - RINOK(callback2->GetVolumeSize(0, &volumeSize)); - - Int32 newData; - Int32 newProperties; - UInt32 indexInArchive; - if (!updateCallback) - return E_FAIL; - - UInt32 fileIndex = 0; - RINOK(updateCallback->GetUpdateItemInfo(fileIndex, - &newData, &newProperties, &indexInArchive)); - - if (newProperties != 0) - { - { - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(fileIndex, kpidIsFolder, &propVariant)); - if (propVariant.vt == VT_EMPTY) - { - } - else if (propVariant.vt != VT_BOOL) - return E_INVALIDARG; - else - { - if (propVariant.boolVal != VARIANT_FALSE) - return E_INVALIDARG; - } - } - { - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(fileIndex, kpidIsAnti, &propVariant)); - if (propVariant.vt == VT_EMPTY) - { - } - else if (propVariant.vt != VT_BOOL) - return E_INVALIDARG; - else - { - if (propVariant.boolVal != VARIANT_FALSE) - return E_INVALIDARG; - } - } - } - UInt64 newSize; - bool thereIsCopyData = false; - if (newData != 0) - { - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(fileIndex, kpidSize, &propVariant)); - if (propVariant.vt != VT_UI8) - return E_INVALIDARG; - newSize = propVariant.uhVal.QuadPart; - } - else - thereIsCopyData = true; - - UInt64 pos = 0; - while(pos < newSize) - { - - } - return S_OK; - COM_TRY_END -} -*/ - -}} diff --git a/7zip/Archive/Split/StdAfx.cpp b/7zip/Archive/Split/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Archive/Split/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Archive/Split/StdAfx.h b/7zip/Archive/Split/StdAfx.h deleted file mode 100755 index e7fb6986..00000000 --- a/7zip/Archive/Split/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Archive/Split/makefile b/7zip/Archive/Split/makefile deleted file mode 100755 index 650c750b..00000000 --- a/7zip/Archive/Split/makefile +++ /dev/null @@ -1,51 +0,0 @@ -PROG = split.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib user32.lib - -SPLIT_OBJS = \ - $O\DllExports.obj \ - $O\SplitHandler.obj \ - $O\SplitHandlerOut.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\Vector.obj \ - -WIN_OBJS = \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\MultiStream.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(SPLIT_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $O\CopyCoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(SPLIT_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) diff --git a/7zip/Archive/Split/resource.rc b/7zip/Archive/Split/resource.rc deleted file mode 100755 index 3e301754..00000000 --- a/7zip/Archive/Split/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Split Plugin", "split") - -101 ICON "Split.ico" diff --git a/7zip/Archive/Tar/DllExports.cpp b/7zip/Archive/Tar/DllExports.cpp deleted file mode 100755 index afa2fd24..00000000 --- a/7zip/Archive/Tar/DllExports.cpp +++ /dev/null @@ -1,86 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "../../ICoder.h" -#include "TarHandler.h" - -// {23170F69-40C1-278A-1000-000110EE0000} -DEFINE_GUID(CLSID_CTarHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0xEE, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /* lpReserved */) -{ - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CTarHandler) - return CLASS_E_CLASSNOTAVAILABLE; - int needIn = *interfaceID == IID_IInArchive; - int needOut = *interfaceID == IID_IOutArchive; - if (needIn || needOut) - { - NArchive::NTar::CHandler *temp = new NArchive::NTar::CHandler; - if (needIn) - { - CMyComPtr inArchive = (IInArchive *)temp; - *outObject = inArchive.Detach(); - } - else - { - CMyComPtr outArchive = (IOutArchive *)temp; - *outObject = outArchive.Detach(); - } - } - else - return E_NOINTERFACE; - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Tar"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CTarHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"tar"; - break; - case NArchive::kUpdate: - propVariant = true; - break; - case NArchive::kKeepName: - propVariant = false; - break; - case NArchive::kStartSignature: - { - const unsigned char sig[] = { 'u', 's', 't', 'a', 'r' }; - if ((value->bstrVal = ::SysAllocStringByteLen((const char *)sig, 5)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - } - propVariant.Detach(value); - return S_OK; -} diff --git a/7zip/Archive/Tar/StdAfx.cpp b/7zip/Archive/Tar/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Archive/Tar/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Archive/Tar/StdAfx.h b/7zip/Archive/Tar/StdAfx.h deleted file mode 100755 index 2e4be10b..00000000 --- a/7zip/Archive/Tar/StdAfx.h +++ /dev/null @@ -1,9 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" -#include "../../../Common/NewHandler.h" - -#endif diff --git a/7zip/Archive/Tar/Tar.dsp b/7zip/Archive/Tar/Tar.dsp deleted file mode 100755 index c01e7383..00000000 --- a/7zip/Archive/Tar/Tar.dsp +++ /dev/null @@ -1,297 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Tar" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Tar - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Tar.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Tar.mak" CFG="Tar - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Tar - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Tar - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Tar - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\tar.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Tar - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\tar.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Tar - Win32 Release" -# Name "Tar - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# Begin Source File - -SOURCE=.\Tar.ico -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\TarHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\TarHandler.h -# End Source File -# Begin Source File - -SOURCE=.\TarHandlerOut.cpp -# End Source File -# Begin Source File - -SOURCE=.\TarHeader.cpp -# End Source File -# Begin Source File - -SOURCE=.\TarHeader.h -# End Source File -# Begin Source File - -SOURCE=.\TarIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\TarIn.h -# End Source File -# Begin Source File - -SOURCE=.\TarItem.h -# End Source File -# Begin Source File - -SOURCE=.\TarOut.cpp -# End Source File -# Begin Source File - -SOURCE=.\TarOut.h -# End Source File -# Begin Source File - -SOURCE=.\TarUpdate.cpp -# End Source File -# Begin Source File - -SOURCE=.\TarUpdate.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.h -# End Source File -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# End Target -# End Project diff --git a/7zip/Archive/Tar/Tar.dsw b/7zip/Archive/Tar/Tar.dsw deleted file mode 100755 index 318cce1c..00000000 --- a/7zip/Archive/Tar/Tar.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Tar"=.\Tar.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Archive/Tar/TarHandler.cpp b/7zip/Archive/Tar/TarHandler.cpp deleted file mode 100755 index 9c2cd006..00000000 --- a/7zip/Archive/Tar/TarHandler.cpp +++ /dev/null @@ -1,282 +0,0 @@ -// Tar/Handler.cpp - -#include "StdAfx.h" - -#include "TarHandler.h" -#include "TarIn.h" - -#include "Common/Defs.h" -#include "Common/StringConvert.h" -#include "Common/NewHandler.h" -#include "Common/ComTry.h" - -#include "Windows/Time.h" -#include "Windows/PropVariant.h" - -#include "../../Common/ProgressUtils.h" -#include "../../Common/LimitedStreams.h" -#include "../../Compress/Copy/CopyCoder.h" - -#include "../Common/ItemNameUtils.h" - -using namespace NWindows; -using namespace NTime; - -namespace NArchive { -namespace NTar { - -STATPROPSTG kProperties[] = -{ - { NULL, kpidPath, VT_BSTR}, - { NULL, kpidIsFolder, VT_BOOL}, - { NULL, kpidSize, VT_UI8}, - { NULL, kpidPackedSize, VT_UI8}, - { NULL, kpidLastWriteTime, VT_FILETIME}, - { NULL, kpidUser, VT_BSTR}, - { NULL, kpidGroup, VT_BSTR}, -}; - -STDMETHODIMP CHandler::GetArchiveProperty(PROPID /* propID */, PROPVARIANT *value) -{ - value->vt = VT_EMPTY; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties) -{ - *numProperties = sizeof(kProperties) / sizeof(kProperties[0]); - return S_OK; -} - -STDMETHODIMP CHandler::GetPropertyInfo(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) -{ - if(index >= sizeof(kProperties) / sizeof(kProperties[0])) - return E_INVALIDARG; - const STATPROPSTG &srcItem = kProperties[index]; - *propID = srcItem.propid; - *varType = srcItem.vt; - *name = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) -{ - *numProperties = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetArchivePropertyInfo(UInt32 /* index */, - BSTR * /* name */, PROPID * /* propID */, VARTYPE * /* varType */) -{ - return E_INVALIDARG; -} - -STDMETHODIMP CHandler::Open(IInStream *stream, - const UInt64 * /* maxCheckStartPosition */, - IArchiveOpenCallback *openArchiveCallback) -{ - COM_TRY_BEGIN - // try - { - CInArchive archive; - - if(archive.Open(stream) != S_OK) - return S_FALSE; - - _items.Clear(); - - if (openArchiveCallback != NULL) - { - RINOK(openArchiveCallback->SetTotal(NULL, NULL)); - UInt64 numFiles = _items.Size(); - RINOK(openArchiveCallback->SetCompleted(&numFiles, NULL)); - } - - for (;;) - { - CItemEx item; - bool filled; - HRESULT result = archive.GetNextItem(filled, item); - if (result == S_FALSE) - return S_FALSE; - if (result != S_OK) - return S_FALSE; - if (!filled) - break; - _items.Add(item); - archive.SkeepDataRecords(item.Size); - if (openArchiveCallback != NULL) - { - UInt64 numFiles = _items.Size(); - RINOK(openArchiveCallback->SetCompleted(&numFiles, NULL)); - } - } - if (_items.Size() == 0) - return S_FALSE; - - _inStream = stream; - } - /* - catch(...) - { - return S_FALSE; - } - */ - return S_OK; - COM_TRY_END -} - -STDMETHODIMP CHandler::Close() -{ - _items.Clear(); - _inStream.Release(); - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems) -{ - *numItems = _items.Size(); - return S_OK; -} - -STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) -{ - COM_TRY_BEGIN - NWindows::NCOM::CPropVariant propVariant; - const NArchive::NTar::CItemEx &item = _items[index]; - - switch(propID) - { - case kpidPath: - propVariant = (const wchar_t *)NItemName::GetOSName2( - MultiByteToUnicodeString(item.Name, CP_OEMCP)); - break; - case kpidIsFolder: - propVariant = item.IsDirectory(); - break; - case kpidSize: - case kpidPackedSize: - propVariant = (UInt64)item.Size; - break; - case kpidLastWriteTime: - { - FILETIME utcFileTime; - if (item.ModificationTime != 0) - NTime::UnixTimeToFileTime((UInt32)item.ModificationTime, utcFileTime); - else - { - utcFileTime.dwLowDateTime = 0; - utcFileTime.dwHighDateTime = 0; - } - propVariant = utcFileTime; - break; - } - case kpidUser: - propVariant = (const wchar_t *) - MultiByteToUnicodeString(item.UserName, CP_OEMCP); - break; - case kpidGroup: - propVariant = (const wchar_t *) - MultiByteToUnicodeString(item.GroupName, CP_OEMCP); - break; - } - propVariant.Detach(value); - return S_OK; - COM_TRY_END -} - -STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, - Int32 _aTestMode, IArchiveExtractCallback *extractCallback) -{ - COM_TRY_BEGIN - bool testMode = (_aTestMode != 0); - bool allFilesMode = (numItems == UInt32(-1)); - if (allFilesMode) - numItems = _items.Size(); - UInt64 totalSize = 0; - if(numItems == 0) - return S_OK; - UInt32 i; - for(i = 0; i < numItems; i++) - totalSize += _items[allFilesMode ? i : indices[i]].Size; - extractCallback->SetTotal(totalSize); - - UInt64 currentTotalSize = 0; - UInt64 currentItemSize; - - CMyComPtr copyCoder; - - for(i = 0; i < numItems; i++, currentTotalSize += currentItemSize) - { - RINOK(extractCallback->SetCompleted(¤tTotalSize)); - CMyComPtr realOutStream; - Int32 askMode; - askMode = testMode ? NArchive::NExtract::NAskMode::kTest : - NArchive::NExtract::NAskMode::kExtract; - Int32 index = allFilesMode ? i : indices[i]; - const CItemEx &item = _items[index]; - - RINOK(extractCallback->GetStream(index, &realOutStream, askMode)); - - currentItemSize = item.Size; - - if(item.IsDirectory()) - { - RINOK(extractCallback->PrepareOperation(askMode)); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - continue; - } - if(!testMode && (!realOutStream)) - { - continue; - } - RINOK(extractCallback->PrepareOperation(askMode)); - { - if (testMode) - { - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - continue; - } - - RINOK(_inStream->Seek(item.GetDataPosition(), STREAM_SEEK_SET, NULL)); - CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream; - CMyComPtr inStream(streamSpec); - streamSpec->SetStream(_inStream); - streamSpec->Init(item.Size); - - CLocalProgress *localProgressSpec = new CLocalProgress; - CMyComPtr progress = localProgressSpec; - localProgressSpec->Init(extractCallback, false); - - - CLocalCompressProgressInfo *localCompressProgressSpec = - new CLocalCompressProgressInfo; - CMyComPtr compressProgress = localCompressProgressSpec; - localCompressProgressSpec->Init(progress, - ¤tTotalSize, ¤tTotalSize); - - if(!copyCoder) - { - copyCoder = new NCompress::CCopyCoder; - } - try - { - RINOK(copyCoder->Code(inStream, realOutStream, - NULL, NULL, compressProgress)); - } - catch(...) - { - realOutStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kDataError)); - continue; - } - realOutStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - } - } - return S_OK; - COM_TRY_END -} - -}} diff --git a/7zip/Archive/Tar/TarHandler.h b/7zip/Archive/Tar/TarHandler.h deleted file mode 100755 index 7b6e3a40..00000000 --- a/7zip/Archive/Tar/TarHandler.h +++ /dev/null @@ -1,56 +0,0 @@ -// Tar/Handler.h - -#ifndef __TAR_HANDLER_H -#define __TAR_HANDLER_H - -#include "Common/MyCom.h" -#include "../IArchive.h" - -#include "TarItem.h" - -namespace NArchive { -namespace NTar { - -class CHandler: - public IInArchive, - public IOutArchive, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP2( - IInArchive, - IOutArchive - ) - - STDMETHOD(Open)(IInStream *stream, - const UInt64 *maxCheckStartPosition, - IArchiveOpenCallback *openArchiveCallback); - STDMETHOD(Close)(); - STDMETHOD(GetNumberOfItems)(UInt32 *numItems); - STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value); - STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems, - Int32 testMode, IArchiveExtractCallback *extractCallback); - - STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value); - - STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties); - STDMETHOD(GetPropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - - STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties); - STDMETHOD(GetArchivePropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - - // IOutArchive - STDMETHOD(UpdateItems)(ISequentialOutStream *outStream, UInt32 numItems, - IArchiveUpdateCallback *updateCallback); - STDMETHOD(GetFileTimeType)(UInt32 *type); - -private: - CObjectVector _items; - CMyComPtr _inStream; -}; - -}} - -#endif diff --git a/7zip/Archive/Tar/TarHandlerOut.cpp b/7zip/Archive/Tar/TarHandlerOut.cpp deleted file mode 100755 index 110833fb..00000000 --- a/7zip/Archive/Tar/TarHandlerOut.cpp +++ /dev/null @@ -1,126 +0,0 @@ -// Tar/HandlerOut.cpp - -#include "StdAfx.h" - -#include "Common/StringConvert.h" -#include "Common/ComTry.h" - -#include "Windows/PropVariant.h" -#include "Windows/Time.h" - -#include "../Common/ItemNameUtils.h" - -#include "TarHandler.h" -#include "TarUpdate.h" - -using namespace NWindows; -using namespace NCOM; -using namespace NTime; - -namespace NArchive { -namespace NTar { - -STDMETHODIMP CHandler::GetFileTimeType(UInt32 *type) -{ - *type = NFileTimeType::kUnix; - return S_OK; -} - -STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numItems, - IArchiveUpdateCallback *updateCallback) -{ - COM_TRY_BEGIN - CObjectVector updateItems; - for(UInt32 i = 0; i < numItems; i++) - { - CUpdateItemInfo updateItem; - Int32 newData; - Int32 newProperties; - UInt32 indexInArchive; - if (!updateCallback) - return E_FAIL; - RINOK(updateCallback->GetUpdateItemInfo(i, - &newData, &newProperties, &indexInArchive)); - updateItem.NewProperties = IntToBool(newProperties); - updateItem.NewData = IntToBool(newData); - updateItem.IndexInArchive = indexInArchive; - updateItem.IndexInClient = i; - - if (IntToBool(newProperties)) - { - FILETIME utcTime; - UString name; - bool isDirectoryStatusDefined; - UInt32 attributes; - { - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(i, kpidAttributes, &propVariant)); - if (propVariant.vt == VT_EMPTY) - attributes = 0; - else if (propVariant.vt != VT_UI4) - return E_INVALIDARG; - else - attributes = propVariant.ulVal; - } - { - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(i, kpidLastWriteTime, &propVariant)); - if (propVariant.vt != VT_FILETIME) - return E_INVALIDARG; - utcTime = propVariant.filetime; - } - { - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(i, kpidPath, &propVariant)); - if (propVariant.vt == VT_EMPTY) - name.Empty(); - else if (propVariant.vt != VT_BSTR) - return E_INVALIDARG; - else - name = propVariant.bstrVal; - } - { - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(i, kpidIsFolder, &propVariant)); - if (propVariant.vt == VT_EMPTY) - isDirectoryStatusDefined = false; - else if (propVariant.vt != VT_BOOL) - return E_INVALIDARG; - else - { - updateItem.IsDirectory = (propVariant.boolVal != VARIANT_FALSE); - isDirectoryStatusDefined = true; - } - } - updateItem.Name = UnicodeStringToMultiByte( - NItemName::MakeLegalName(name), CP_OEMCP); - if (!isDirectoryStatusDefined) - updateItem.IsDirectory = ((attributes & FILE_ATTRIBUTE_DIRECTORY) != 0); - if (updateItem.IsDirectory) - updateItem.Name += '/'; - - if(!FileTimeToUnixTime(utcTime, updateItem.Time)) - { - updateItem.Time = 0; - // return E_INVALIDARG; - } - } - if (IntToBool(newData)) - { - UInt64 size; - { - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(i, kpidSize, &propVariant)); - if (propVariant.vt != VT_UI8) - return E_INVALIDARG; - size = propVariant.uhVal.QuadPart; - } - updateItem.Size = size; - } - updateItems.Add(updateItem); - } - return UpdateArchive(_inStream, outStream, _items, updateItems, updateCallback); - COM_TRY_END -} - -}} diff --git a/7zip/Archive/Tar/TarHeader.cpp b/7zip/Archive/Tar/TarHeader.cpp deleted file mode 100755 index 35f0d0cf..00000000 --- a/7zip/Archive/Tar/TarHeader.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// Archive/Tar/Header.h - -#include "StdAfx.h" - -#include "TarHeader.h" - -namespace NArchive { -namespace NTar { -namespace NFileHeader { - - // The checksum field is filled with this while the checksum is computed. - const char *kCheckSumBlanks = " "; // 8 blanks, no null - - const char *kLongLink = "././@LongLink"; - const char *kLongLink2 = "@LongLink"; - - // The magic field is filled with this if uname and gname are valid. - namespace NMagic - { - const char *kUsTar = "ustar"; // 5 chars - const char *kGNUTar = "GNUtar "; // 7 chars and a null - const char *kEmpty = "\0\0\0\0\0\0\0\0"; // 7 chars and a null - } - -}}} diff --git a/7zip/Archive/Tar/TarHeader.h b/7zip/Archive/Tar/TarHeader.h deleted file mode 100755 index 0ab31e52..00000000 --- a/7zip/Archive/Tar/TarHeader.h +++ /dev/null @@ -1,99 +0,0 @@ -// Archive/Tar/Header.h - -#ifndef __ARCHIVE_TAR_HEADER_H -#define __ARCHIVE_TAR_HEADER_H - -#include "Common/Types.h" - -namespace NArchive { -namespace NTar { - -namespace NFileHeader -{ - const int kRecordSize = 512; - const int kNameSize = 100; - const int kUserNameSize = 32; - const int kGroupNameSize = 32; - const int kPrefixSize = 155; - - /* - struct CHeader - { - char Name[kNameSize]; - char Mode[8]; - char UID[8]; - char GID[8]; - char Size[12]; - char ModificationTime[12]; - char CheckSum[8]; - char LinkFlag; - char LinkName[kNameSize]; - char Magic[8]; - char UserName[kUserNameSize]; - char GroupName[kGroupNameSize]; - char DeviceMajor[8]; - char DeviceMinor[8]; - char Prefix[155]; - }; - union CRecord - { - CHeader Header; - Byte Padding[kRecordSize]; - }; - */ - - namespace NMode - { - const int kSetUID = 04000; // Set UID on execution - const int kSetGID = 02000; // Set GID on execution - const int kSaveText = 01000; // Save text (sticky bit) - } - - namespace NFilePermissions - { - const int kUserRead = 00400; // read by owner - const int kUserWrite = 00200; // write by owner - const int kUserExecute = 00100; // execute/search by owner - const int kGroupRead = 00040; // read by group - const int kGroupWrite = 00020; // write by group - const int kGroupExecute = 00010; // execute/search by group - const int kOtherRead = 00004; // read by other - const int kOtherWrite = 00002; // write by other - const int kOtherExecute = 00001; // execute/search by other - } - - - // The linkflag defines the type of file - namespace NLinkFlag - { - const char kOldNormal = '\0'; // Normal disk file, Unix compatible - const char kNormal = '0'; // Normal disk file - const char kLink = '1'; // Link to previously dumped file - const char kSymbolicLink = '2'; // Symbolic link - const char kCharacter = '3'; // Character special file - const char kBlock = '4'; // Block special file - const char kDirectory = '5'; // Directory - const char kFIFO = '6'; // FIFO special file - const char kContiguous = '7'; // Contiguous file - } - // Further link types may be defined later. - - // The checksum field is filled with this while the checksum is computed. - extern const char *kCheckSumBlanks;// = " "; // 8 blanks, no null - - extern const char *kLongLink; // = "././@LongLink"; - extern const char *kLongLink2; // = "@LongLink"; - - // The magic field is filled with this if uname and gname are valid. - namespace NMagic - { - extern const char *kUsTar; // = "ustar"; // 5 chars - extern const char *kGNUTar; // = "GNUtar "; // 7 chars and a null - extern const char *kEmpty; // = "GNUtar "; // 7 chars and a null - } - -} - -}} - -#endif diff --git a/7zip/Archive/Tar/TarIn.cpp b/7zip/Archive/Tar/TarIn.cpp deleted file mode 100755 index 86afc482..00000000 --- a/7zip/Archive/Tar/TarIn.cpp +++ /dev/null @@ -1,248 +0,0 @@ -// Archive/TarIn.cpp - -#include "StdAfx.h" - -#include "TarIn.h" -#include "TarHeader.h" - -#include "Common/StringToInt.h" -#include "Windows/Defs.h" - -#include "../../Common/StreamUtils.h" - -namespace NArchive { -namespace NTar { - -HRESULT CInArchive::ReadBytes(void *data, UInt32 size, UInt32 &processedSize) -{ - RINOK(ReadStream(m_Stream, data, size, &processedSize)); - m_Position += processedSize; - return S_OK; -} - -HRESULT CInArchive::Open(IInStream *inStream) -{ - RINOK(inStream->Seek(0, STREAM_SEEK_CUR, &m_Position)); - m_Stream = inStream; - return S_OK; -} - -static void MyStrNCpy(char *dest, const char *src, int size) -{ - for (int i = 0; i < size; i++) - { - char c = src[i]; - dest[i] = c; - if (c == 0) - break; - } -} - -static bool OctalToNumber(const char *srcString, int size, UInt64 &res) -{ - char sz[32]; - MyStrNCpy(sz, srcString, size); - sz[size] = 0; - const char *end; - int i; - for (i = 0; sz[i] == ' '; i++); - res = ConvertOctStringToUInt64(sz + i, &end); - return (*end == ' ' || *end == 0); -} - -static bool OctalToNumber32(const char *srcString, int size, UInt32 &res) -{ - UInt64 res64; - if (!OctalToNumber(srcString, size, res64)) - return false; - res = (UInt32)res64; - return (res64 <= 0xFFFFFFFF); -} - -#define RIF(x) { if (!(x)) return S_FALSE; } - -static bool IsRecordLast(const char *record) -{ - for (int i = 0; i < NFileHeader::kRecordSize; i++) - if (record[i] != 0) - return false; - return true; -} - -static void ReadString(const char *s, int size, AString &result) -{ - if (size > NFileHeader::kRecordSize) - size = NFileHeader::kNameSize; - char tempString[NFileHeader::kRecordSize + 1]; - MyStrNCpy(tempString, s, size); - tempString[size] = '\0'; - result = tempString; -} - -static char GetHex(Byte value) -{ - return (char)((value < 10) ? ('0' + value) : ('A' + (value - 10))); -} - -HRESULT CInArchive::GetNextItemReal(bool &filled, CItemEx &item) -{ - item.LongLinkSize = 0; - // NFileHeader::CRecord record; - char record[NFileHeader::kRecordSize]; - char *cur = record; - - filled = false; - - UInt32 processedSize; - item.HeaderPosition = m_Position; - RINOK(ReadBytes(record, NFileHeader::kRecordSize, processedSize)); - if (processedSize == 0 || - (processedSize == NFileHeader::kRecordSize && IsRecordLast(record))) - return S_OK; - if (processedSize < NFileHeader::kRecordSize) - return S_FALSE; - - // NFileHeader::CHeader &header = record.Header; - - AString name; - ReadString(cur, NFileHeader::kNameSize, name); - cur += NFileHeader::kNameSize; - - item.Name.Empty(); - int i; - for (i = 0; i < name.Length(); i++) - { - char c = name[i]; - if (((Byte)c) < 0x08) - { - return S_FALSE; - } - if (((Byte)c) < 0x20) - { - item.Name += '['; - item.Name += GetHex((Byte)(((Byte)c) >> 4)); - item.Name += GetHex((Byte)(((Byte)c) & 0xF)); - item.Name += ']'; - } - else - item.Name += c; - } - - RIF(OctalToNumber32(cur, 8, item.Mode)); - cur += 8; - - if (!OctalToNumber32(cur, 8, item.UID)) - item.UID = 0; - cur += 8; - - if (!OctalToNumber32(cur, 8, item.GID)) - item.GID = 0; - cur += 8; - - RIF(OctalToNumber(cur, 12, item.Size)); - cur += 12; - - RIF(OctalToNumber32(cur, 12, item.ModificationTime)); - cur += 12; - - UInt32 checkSum; - RIF(OctalToNumber32(cur, 8, checkSum)); - memmove(cur, NFileHeader::kCheckSumBlanks, 8); - cur += 8; - - item.LinkFlag = *cur++; - - ReadString(cur, NFileHeader::kNameSize, item.LinkName); - cur += NFileHeader::kNameSize; - - memmove(item.Magic, cur, 8); - cur += 8; - - ReadString(cur, NFileHeader::kUserNameSize, item.UserName); - cur += NFileHeader::kUserNameSize; - ReadString(cur, NFileHeader::kUserNameSize, item.GroupName); - cur += NFileHeader::kUserNameSize; - - item.DeviceMajorDefined = (cur[0] != 0); - RIF(OctalToNumber32(cur, 8, item.DeviceMajor)); - cur += 8; - - item.DeviceMinorDefined = (cur[0] != 0); - RIF(OctalToNumber32(cur, 8, item.DeviceMinor)); - cur += 8; - - AString prefix; - ReadString(cur, NFileHeader::kPrefixSize, prefix); - cur += NFileHeader::kPrefixSize; - if (!prefix.IsEmpty() && item.IsMagic()) - item.Name = prefix + AString('/') + item.Name; - - if (item.LinkFlag == NFileHeader::NLinkFlag::kLink) - item.Size = 0; - - - UInt32 checkSumReal = 0; - for(i = 0; i < NFileHeader::kRecordSize; i++) - checkSumReal += Byte(record[i]); - - if (checkSumReal != checkSum) - return S_FALSE; - - filled = true; - return S_OK; -} - -HRESULT CInArchive::GetNextItem(bool &filled, CItemEx &item) -{ - RINOK(GetNextItemReal(filled, item)); - if (!filled) - return S_OK; - // GNUtar extension - if (item.LinkFlag == 'L') - { - if (item.Name.Compare(NFileHeader::kLongLink) != 0) - if (item.Name.Compare(NFileHeader::kLongLink2) != 0) - return S_FALSE; - UInt64 headerPosition = item.HeaderPosition; - - UInt32 processedSize; - AString fullName; - char *buffer = fullName.GetBuffer((UInt32)item.Size + 1); - RINOK(ReadBytes(buffer, (UInt32)item.Size, processedSize)); - buffer[item.Size] = '\0'; - fullName.ReleaseBuffer(); - if (processedSize != item.Size) - return S_FALSE; - RINOK(Skeep((0 - item.Size) & 0x1FF)); - RINOK(GetNextItemReal(filled, item)); - item.Name = fullName; - item.LongLinkSize = item.HeaderPosition - headerPosition; - item.HeaderPosition = headerPosition; - } - else if (item.LinkFlag == 'g' || item.LinkFlag == 'x') - { - // pax Extended Header - return S_OK; - } - else if (item.LinkFlag > '7' || (item.LinkFlag < '0' && item.LinkFlag != 0)) - return S_FALSE; - return S_OK; -} - -HRESULT CInArchive::Skeep(UInt64 numBytes) -{ - UInt64 newPostion; - RINOK(m_Stream->Seek(numBytes, STREAM_SEEK_CUR, &newPostion)); - m_Position += numBytes; - if (m_Position != newPostion) - return E_FAIL; - return S_OK; -} - - -HRESULT CInArchive::SkeepDataRecords(UInt64 dataSize) -{ - return Skeep((dataSize + 0x1FF) & (~((UInt64)0x1FF))); -} - -}} diff --git a/7zip/Archive/Tar/TarIn.h b/7zip/Archive/Tar/TarIn.h deleted file mode 100755 index 28781375..00000000 --- a/7zip/Archive/Tar/TarIn.h +++ /dev/null @@ -1,30 +0,0 @@ -// Archive/TarIn.h - -#ifndef __ARCHIVE_TAR_IN_H -#define __ARCHIVE_TAR_IN_H - -#include "Common/MyCom.h" -#include "../../IStream.h" - -#include "TarItem.h" - -namespace NArchive { -namespace NTar { - -class CInArchive -{ - CMyComPtr m_Stream; - UInt64 m_Position; - - HRESULT ReadBytes(void *data, UInt32 size, UInt32 &processedSize); -public: - HRESULT Open(IInStream *inStream); - HRESULT GetNextItemReal(bool &filled, CItemEx &itemInfo); - HRESULT GetNextItem(bool &filled, CItemEx &itemInfo); - HRESULT Skeep(UInt64 numBytes); - HRESULT SkeepDataRecords(UInt64 dataSize); -}; - -}} - -#endif diff --git a/7zip/Archive/Tar/TarItem.h b/7zip/Archive/Tar/TarItem.h deleted file mode 100755 index 71fff7ba..00000000 --- a/7zip/Archive/Tar/TarItem.h +++ /dev/null @@ -1,69 +0,0 @@ -// Archive/Tar/Item.h - -#ifndef __ARCHIVE_TAR_ITEM_H -#define __ARCHIVE_TAR_ITEM_H - -#include - -#include "Common/Types.h" -#include "Common/String.h" - -#include "../Common/ItemNameUtils.h" -#include "TarHeader.h" - -namespace NArchive { -namespace NTar { - -class CItem -{ -public: - AString Name; - UInt32 Mode; - UInt32 UID; - UInt32 GID; - UInt64 Size; - UInt32 ModificationTime; - char LinkFlag; - AString LinkName; - char Magic[8]; - AString UserName; - AString GroupName; - - bool DeviceMajorDefined; - UInt32 DeviceMajor; - bool DeviceMinorDefined; - UInt32 DeviceMinor; - - bool IsDirectory() const - { - if (LinkFlag == NFileHeader::NLinkFlag::kDirectory) - return true; - if (LinkFlag == NFileHeader::NLinkFlag::kOldNormal || - LinkFlag == NFileHeader::NLinkFlag::kNormal) - { - return NItemName::HasTailSlash(Name, CP_OEMCP); - } - return false; - } - - bool IsMagic() const - { - for (int i = 0; i < 5; i++) - if (Magic[i] != NFileHeader::NMagic::kUsTar[i]) - return false; - return true; - } -}; - -class CItemEx: public CItem -{ -public: - UInt64 HeaderPosition; - UInt64 LongLinkSize; - UInt64 GetDataPosition() const { return HeaderPosition + LongLinkSize + NFileHeader::kRecordSize; }; - UInt64 GetFullSize() const { return LongLinkSize + NFileHeader::kRecordSize + Size; }; -}; - -}} - -#endif diff --git a/7zip/Archive/Tar/TarOut.cpp b/7zip/Archive/Tar/TarOut.cpp deleted file mode 100755 index e278edda..00000000 --- a/7zip/Archive/Tar/TarOut.cpp +++ /dev/null @@ -1,191 +0,0 @@ -// Archive/TarOut.cpp - -#include "StdAfx.h" - -#include "TarOut.h" -#include "TarHeader.h" - -#include "Common/IntToString.h" -#include "Windows/Defs.h" -#include "../../Common/StreamUtils.h" - -namespace NArchive { -namespace NTar { - -HRESULT COutArchive::WriteBytes(const void *buffer, UInt32 size) -{ - UInt32 processedSize; - RINOK(WriteStream(m_Stream, buffer, size, &processedSize)); - if(processedSize != size) - return E_FAIL; - return S_OK; -} - -void COutArchive::Create(ISequentialOutStream *outStream) -{ - m_Stream = outStream; -} - -static AString MakeOctalString(UInt64 value) -{ - char s[32]; - ConvertUInt64ToString(value, s, 8); - return AString(s) + ' '; -} - -static void MyStrNCpy(char *dest, const char *src, int size) -{ - for (int i = 0; i < size; i++) - { - char c = src[i]; - dest[i] = c; - if (c == 0) - break; - } -} - -static bool MakeOctalString8(char *s, UInt32 value) -{ - AString tempString = MakeOctalString(value); - - const int kMaxSize = 8; - if (tempString.Length() >= kMaxSize) - return false; - int numSpaces = kMaxSize - (tempString.Length() + 1); - for(int i = 0; i < numSpaces; i++) - s[i] = ' '; - MyStringCopy(s + numSpaces, (const char *)tempString); - return true; -} - -static bool MakeOctalString12(char *s, UInt64 value) -{ - AString tempString = MakeOctalString(value); - const int kMaxSize = 12; - if (tempString.Length() > kMaxSize) - return false; - int numSpaces = kMaxSize - tempString.Length(); - for(int i = 0; i < numSpaces; i++) - s[i] = ' '; - memmove(s + numSpaces, (const char *)tempString, tempString.Length()); - return true; -} - -static bool CopyString(char *dest, const AString &src, int maxSize) -{ - if (src.Length() >= maxSize) - return false; - MyStringCopy(dest, (const char *)src); - return true; -} - -#define RETURN_IF_NOT_TRUE(x) { if (!(x)) return E_FAIL; } - -HRESULT COutArchive::WriteHeaderReal(const CItem &item) -{ - char record[NFileHeader::kRecordSize]; - char *cur = record; - int i; - for (i = 0; i < NFileHeader::kRecordSize; i++) - record[i] = 0; - - // RETURN_IF_NOT_TRUE(CopyString(header.Name, item.Name, NFileHeader::kNameSize)); - if (item.Name.Length() > NFileHeader::kNameSize) - return E_FAIL; - MyStrNCpy(cur, item.Name, NFileHeader::kNameSize); - cur += NFileHeader::kNameSize; - - RETURN_IF_NOT_TRUE(MakeOctalString8(cur, item.Mode)); - cur += 8; - RETURN_IF_NOT_TRUE(MakeOctalString8(cur, item.UID)); - cur += 8; - RETURN_IF_NOT_TRUE(MakeOctalString8(cur, item.GID)); - cur += 8; - - RETURN_IF_NOT_TRUE(MakeOctalString12(cur, item.Size)); - cur += 12; - RETURN_IF_NOT_TRUE(MakeOctalString12(cur, item.ModificationTime)); - cur += 12; - - memmove(cur, NFileHeader::kCheckSumBlanks, 8); - cur += 8; - - *cur++ = item.LinkFlag; - - RETURN_IF_NOT_TRUE(CopyString(cur, item.LinkName, NFileHeader::kNameSize)); - cur += NFileHeader::kNameSize; - - memmove(cur, item.Magic, 8); - cur += 8; - - RETURN_IF_NOT_TRUE(CopyString(cur, item.UserName, NFileHeader::kUserNameSize)); - cur += NFileHeader::kUserNameSize; - RETURN_IF_NOT_TRUE(CopyString(cur, item.GroupName, NFileHeader::kGroupNameSize)); - cur += NFileHeader::kUserNameSize; - - - if (item.DeviceMajorDefined) - RETURN_IF_NOT_TRUE(MakeOctalString8(cur, item.DeviceMajor)); - cur += 8; - - if (item.DeviceMinorDefined) - RETURN_IF_NOT_TRUE(MakeOctalString8(cur, item.DeviceMinor)); - cur += 8; - - - UInt32 checkSumReal = 0; - for(i = 0; i < NFileHeader::kRecordSize; i++) - checkSumReal += Byte(record[i]); - - RETURN_IF_NOT_TRUE(MakeOctalString8(record + 148, checkSumReal)); - - return WriteBytes(record, NFileHeader::kRecordSize); -} - -HRESULT COutArchive::WriteHeader(const CItem &item) -{ - int nameSize = item.Name.Length(); - if (nameSize < NFileHeader::kNameSize) - return WriteHeaderReal(item); - - CItem modifiedItem = item; - int nameStreamSize = nameSize + 1; - modifiedItem.Size = nameStreamSize; - modifiedItem.LinkFlag = 'L'; - modifiedItem.Name = NFileHeader::kLongLink; - modifiedItem.LinkName.Empty(); - RINOK(WriteHeaderReal(modifiedItem)); - RINOK(WriteBytes(item.Name, nameStreamSize)); - RINOK(FillDataResidual(nameStreamSize)); - - modifiedItem = item; - modifiedItem.Name = item.Name.Left(NFileHeader::kNameSize - 1); - return WriteHeaderReal(modifiedItem); -} - -HRESULT COutArchive::FillDataResidual(UInt64 dataSize) -{ - UInt32 lastRecordSize = UInt32(dataSize & (NFileHeader::kRecordSize - 1)); - if (lastRecordSize == 0) - return S_OK; - UInt32 residualSize = NFileHeader::kRecordSize - lastRecordSize; - Byte residualBytes[NFileHeader::kRecordSize]; - for (UInt32 i = 0; i < residualSize; i++) - residualBytes[i] = 0; - return WriteBytes(residualBytes, residualSize); -} - -HRESULT COutArchive::WriteFinishHeader() -{ - Byte record[NFileHeader::kRecordSize]; - int i; - for (i = 0; i < NFileHeader::kRecordSize; i++) - record[i] = 0; - for (i = 0; i < 2; i++) - { - RINOK(WriteBytes(record, NFileHeader::kRecordSize)); - } - return S_OK; -} - -}} diff --git a/7zip/Archive/Tar/TarOut.h b/7zip/Archive/Tar/TarOut.h deleted file mode 100755 index ef837869..00000000 --- a/7zip/Archive/Tar/TarOut.h +++ /dev/null @@ -1,28 +0,0 @@ -// Archive/TarOut.h - -#ifndef __ARCHIVE_TAR_OUT_H -#define __ARCHIVE_TAR_OUT_H - -#include "TarItem.h" - -#include "Common/MyCom.h" -#include "../../IStream.h" - -namespace NArchive { -namespace NTar { - -class COutArchive -{ - CMyComPtr m_Stream; - HRESULT WriteBytes(const void *buffer, UInt32 size); -public: - void Create(ISequentialOutStream *outStream); - HRESULT WriteHeaderReal(const CItem &item); - HRESULT WriteHeader(const CItem &item); - HRESULT FillDataResidual(UInt64 dataSize); - HRESULT WriteFinishHeader(); -}; - -}} - -#endif diff --git a/7zip/Archive/Tar/TarUpdate.cpp b/7zip/Archive/Tar/TarUpdate.cpp deleted file mode 100755 index 9a6f64e2..00000000 --- a/7zip/Archive/Tar/TarUpdate.cpp +++ /dev/null @@ -1,162 +0,0 @@ -// TarUpdate.cpp - -#include "StdAfx.h" - -#include "Common/Defs.h" -#include "Common/StringConvert.h" -#include "Windows/Defs.h" - -#include "../../Common/ProgressUtils.h" -#include "../../Common/LimitedStreams.h" -#include "../../Compress/Copy/CopyCoder.h" - -#include "TarOut.h" -#include "TarUpdate.h" - -static const UInt64 kOneItemComplexity = 512; - -namespace NArchive { -namespace NTar { - -static HRESULT CopyBlock(ISequentialInStream *inStream, - ISequentialOutStream *outStream, ICompressProgressInfo *progress, - UInt64 *totalSize = NULL) -{ - NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder; - CMyComPtr copyCoder = copyCoderSpec; - HRESULT result = copyCoder->Code(inStream, outStream, NULL, NULL, progress); - if (totalSize != NULL) - *totalSize = copyCoderSpec->TotalSize; - return result; -} - -HRESULT UpdateArchive(IInStream *inStream, ISequentialOutStream *outStream, - const CObjectVector &inputItems, - const CObjectVector &updateItems, - IArchiveUpdateCallback *updateCallback) -{ - COutArchive outArchive; - outArchive.Create(outStream); - - UInt64 complexity = 0; - - int i; - for(i = 0; i < updateItems.Size(); i++) - { - const CUpdateItemInfo &updateItem = updateItems[i]; - if (updateItem.NewData) - complexity += updateItem.Size; - else - complexity += inputItems[updateItem.IndexInArchive].GetFullSize(); - complexity += kOneItemComplexity; - } - - RINOK(updateCallback->SetTotal(complexity)); - - complexity = 0; - - for(i = 0; i < updateItems.Size(); i++) - { - RINOK(updateCallback->SetCompleted(&complexity)); - - CLocalProgress *localProgressSpec = new CLocalProgress; - CMyComPtr localProgress = localProgressSpec; - localProgressSpec->Init(updateCallback, true); - - CLocalCompressProgressInfo *localCompressProgressSpec = new CLocalCompressProgressInfo; - CMyComPtr compressProgress = localCompressProgressSpec; - - localCompressProgressSpec->Init(localProgress, &complexity, NULL); - - const CUpdateItemInfo &updateItem = updateItems[i]; - CItem item; - if (updateItem.NewProperties) - { - item.Mode = 0777; - item.Name = (updateItem.Name); - if (updateItem.IsDirectory) - { - item.LinkFlag = NFileHeader::NLinkFlag::kDirectory; - item.Size = 0; - } - else - { - item.LinkFlag = NFileHeader::NLinkFlag::kNormal; - item.Size = updateItem.Size; - } - item.ModificationTime = updateItem.Time; - item.DeviceMajorDefined = false; - item.DeviceMinorDefined = false; - item.UID = 0; - item.GID = 0; - memmove(item.Magic, NFileHeader::NMagic::kEmpty, 8); - } - else - { - const CItemEx &existItemInfo = inputItems[updateItem.IndexInArchive]; - item = existItemInfo; - } - if (updateItem.NewData) - { - item.Size = updateItem.Size; - if (item.Size == UInt64(Int64(-1))) - return E_INVALIDARG; - } - else - { - const CItemEx &existItemInfo = inputItems[updateItem.IndexInArchive]; - item.Size = existItemInfo.Size; - } - - if (updateItem.NewData) - { - CMyComPtr fileInStream; - HRESULT res = updateCallback->GetStream(updateItem.IndexInClient, &fileInStream); - if (res != S_FALSE) - { - RINOK(res); - RINOK(outArchive.WriteHeader(item)); - if (!updateItem.IsDirectory) - { - UInt64 totalSize; - RINOK(CopyBlock(fileInStream, outStream, compressProgress, &totalSize)); - if (totalSize != item.Size) - return E_FAIL; - RINOK(outArchive.FillDataResidual(item.Size)); - } - } - complexity += updateItem.Size; - RINOK(updateCallback->SetOperationResult( - NArchive::NUpdate::NOperationResult::kOK)); - } - else - { - CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream; - CMyComPtr inStreamLimited(streamSpec); - const CItemEx &existItemInfo = inputItems[updateItem.IndexInArchive]; - if (updateItem.NewProperties) - { - RINOK(outArchive.WriteHeader(item)); - RINOK(inStream->Seek(existItemInfo.GetDataPosition(), - STREAM_SEEK_SET, NULL)); - streamSpec->SetStream(inStream); - streamSpec->Init(existItemInfo.Size); - } - else - { - RINOK(inStream->Seek(existItemInfo.HeaderPosition, - STREAM_SEEK_SET, NULL)); - streamSpec->SetStream(inStream); - streamSpec->Init(existItemInfo.GetFullSize()); - } - RINOK(CopyBlock(inStreamLimited, outStream, compressProgress)); - RINOK(outArchive.FillDataResidual(existItemInfo.Size)); - complexity += existItemInfo.GetFullSize(); - } - complexity += kOneItemComplexity; - } - return outArchive.WriteFinishHeader(); -} - -}} - diff --git a/7zip/Archive/Tar/TarUpdate.h b/7zip/Archive/Tar/TarUpdate.h deleted file mode 100755 index 92f5cebb..00000000 --- a/7zip/Archive/Tar/TarUpdate.h +++ /dev/null @@ -1,36 +0,0 @@ -// Tar/Update.h - -#ifndef __TAR_UPDATE_H -#define __TAR_UPDATE_H - -#include "Common/Vector.h" -#include "Common/Types.h" -#include "Common/String.h" - -#include "../IArchive.h" -#include "TarItem.h" - -namespace NArchive { -namespace NTar { - -struct CUpdateItemInfo -{ - bool NewData; - bool NewProperties; - int IndexInArchive; - int IndexInClient; - - UInt32 Time; - UInt64 Size; - AString Name; - bool IsDirectory; -}; - -HRESULT UpdateArchive(IInStream *inStream, ISequentialOutStream *outStream, - const CObjectVector &inputItems, - const CObjectVector &updateItems, - IArchiveUpdateCallback *updateCallback); - -}} - -#endif diff --git a/7zip/Archive/Tar/makefile b/7zip/Archive/Tar/makefile deleted file mode 100755 index f892c303..00000000 --- a/7zip/Archive/Tar/makefile +++ /dev/null @@ -1,59 +0,0 @@ -PROG = tar.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib user32.lib - -TAR_OBJS = \ - $O\DllExports.obj \ - $O\TarHandler.obj \ - $O\TarHandlerOut.obj \ - $O\TarHeader.obj \ - $O\TarIn.obj \ - $O\TarOut.obj \ - $O\TarUpdate.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\IntToString.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\StringToInt.obj \ - $O\Vector.obj \ - -WIN_OBJS = \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\LimitedStreams.obj \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\ItemNameUtils.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(TAR_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(COMPRESS_TAR_OBJS) \ - $O\CopyCoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(TAR_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) diff --git a/7zip/Archive/Tar/resource.rc b/7zip/Archive/Tar/resource.rc deleted file mode 100755 index 3d37f440..00000000 --- a/7zip/Archive/Tar/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Tar Plugin", "tar") - -101 ICON "tar.ico" diff --git a/7zip/Archive/Tar/tar.ico b/7zip/Archive/Tar/tar.ico deleted file mode 100755 index 6835885b..00000000 Binary files a/7zip/Archive/Tar/tar.ico and /dev/null differ diff --git a/7zip/Archive/Z/DllExports.cpp b/7zip/Archive/Z/DllExports.cpp deleted file mode 100755 index b8df85f4..00000000 --- a/7zip/Archive/Z/DllExports.cpp +++ /dev/null @@ -1,91 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "ZHandler.h" -#include "../../ICoder.h" - -// {23170F69-40C1-278A-1000-000110050000} -DEFINE_GUID(CLSID_CZHandler, -0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x05, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /* lpReserved */) -{ - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CZHandler) - return CLASS_E_CLASSNOTAVAILABLE; - int needIn = *interfaceID == IID_IInArchive; - int needOut = *interfaceID == IID_IOutArchive; - if (needIn || needOut) - { - NArchive::NZ::CHandler *temp = new NArchive::NZ::CHandler; - if (needIn) - { - CMyComPtr inArchive = (IInArchive *)temp; - *outObject = inArchive.Detach(); - } - else - { - CMyComPtr outArchive = (IOutArchive *)temp; - *outObject = outArchive.Detach(); - } - } - else - return E_NOINTERFACE; - COM_TRY_END - return S_OK; -} - - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Z"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CZHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"z taz"; - break; - case NArchive::kAddExtension: - propVariant = L"* .tar"; - break; - case NArchive::kUpdate: - propVariant = false; - break; - case NArchive::kKeepName: - propVariant = true; - break; - case NArchive::kStartSignature: - { - const unsigned char sig[] = { 0x1F, 0x9D }; - if ((value->bstrVal = ::SysAllocStringByteLen((const char *)sig, 2)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - - } - propVariant.Detach(value); - return S_OK; -} diff --git a/7zip/Archive/Z/StdAfx.cpp b/7zip/Archive/Z/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Archive/Z/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Archive/Z/StdAfx.h b/7zip/Archive/Z/StdAfx.h deleted file mode 100755 index e7fb6986..00000000 --- a/7zip/Archive/Z/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Archive/Z/Z.dsp b/7zip/Archive/Z/Z.dsp deleted file mode 100755 index e1f72522..00000000 --- a/7zip/Archive/Z/Z.dsp +++ /dev/null @@ -1,237 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Z" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Z - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Z.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Z.mak" CFG="Z - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Z - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Z - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Z - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZIP2_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZIP2_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\z.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Z - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZIP2_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZIP2_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\z.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Z - Win32 Release" -# Name "Z - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# Begin Source File - -SOURCE=.\Z.ico -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Compression" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Z\ZDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Z\ZDecoder.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\DummyOutStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\DummyOutStream.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\ZHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\ZHandler.h -# End Source File -# End Group -# Begin Group "7zip common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\z.ico -# End Source File -# End Target -# End Project diff --git a/7zip/Archive/Z/Z.dsw b/7zip/Archive/Z/Z.dsw deleted file mode 100755 index 1f67186a..00000000 --- a/7zip/Archive/Z/Z.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Z"=.\Z.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Archive/Z/Z.ico b/7zip/Archive/Z/Z.ico deleted file mode 100755 index 2db53583..00000000 Binary files a/7zip/Archive/Z/Z.ico and /dev/null differ diff --git a/7zip/Archive/Z/ZHandler.cpp b/7zip/Archive/Z/ZHandler.cpp deleted file mode 100755 index 33887690..00000000 --- a/7zip/Archive/Z/ZHandler.cpp +++ /dev/null @@ -1,202 +0,0 @@ -// ZHandler.cpp - -#include "StdAfx.h" - -#include "ZHandler.h" - -#include "Common/Defs.h" - -#include "../../Common/ProgressUtils.h" -#include "../../Compress/Z/ZDecoder.h" -#include "../../Common/StreamUtils.h" - -#include "Windows/PropVariant.h" -#include "Windows/Defs.h" -#include "Common/ComTry.h" - -#include "../Common/DummyOutStream.h" - -namespace NArchive { -namespace NZ { - -STATPROPSTG kProperties[] = -{ - { NULL, kpidPath, VT_BSTR}, - { NULL, kpidPackedSize, VT_UI8}, -}; - -STDMETHODIMP CHandler::GetArchiveProperty(PROPID /* propID */, PROPVARIANT *value) -{ - value->vt = VT_EMPTY; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties) -{ - *numProperties = sizeof(kProperties) / sizeof(kProperties[0]); - return S_OK; -} - -STDMETHODIMP CHandler::GetPropertyInfo(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) -{ - if(index >= sizeof(kProperties) / sizeof(kProperties[0])) - return E_INVALIDARG; - const STATPROPSTG &srcItem = kProperties[index]; - *propID = srcItem.propid; - *varType = srcItem.vt; - *name = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) -{ - *numProperties = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetArchivePropertyInfo(UInt32 /* index */, - BSTR * /* name */, PROPID * /* propID */, VARTYPE * /* varType */) -{ - return E_INVALIDARG; -} - -STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems) -{ - *numItems = 1; - return S_OK; -} - -STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) -{ - COM_TRY_BEGIN - NWindows::NCOM::CPropVariant propVariant; - if (index != 0) - return E_INVALIDARG; - switch(propID) - { - case kpidIsFolder: - propVariant = false; - break; - case kpidPackedSize: - propVariant = _packSize; - break; - } - propVariant.Detach(value); - return S_OK; - COM_TRY_END -} - -static const int kSignatureSize = 3; - -STDMETHODIMP CHandler::Open(IInStream *stream, - const UInt64 * /* maxCheckStartPosition */, - IArchiveOpenCallback * /* openArchiveCallback */) -{ - COM_TRY_BEGIN - try - { - RINOK(stream->Seek(0, STREAM_SEEK_CUR, &_streamStartPosition)); - Byte buffer[kSignatureSize]; - UInt32 processedSize; - RINOK(ReadStream(stream, buffer, kSignatureSize, &processedSize)); - if (processedSize != kSignatureSize) - return S_FALSE; - if (buffer[0] != 0x1F || buffer[1] != 0x9D) - return S_FALSE; - _properties = buffer[2]; - - UInt64 endPosition; - RINOK(stream->Seek(0, STREAM_SEEK_END, &endPosition)); - _packSize = endPosition - _streamStartPosition - kSignatureSize; - - _stream = stream; - } - catch(...) - { - return S_FALSE; - } - return S_OK; - COM_TRY_END -} - -STDMETHODIMP CHandler::Close() -{ - _stream.Release(); - return S_OK; -} - - -STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, - Int32 testModeSpec, IArchiveExtractCallback *extractCallback) -{ - COM_TRY_BEGIN - bool allFilesMode = (numItems == (UInt32)(-1)); - if (!allFilesMode) - { - if (numItems == 0) - return S_OK; - if (numItems != 1) - return E_INVALIDARG; - if (indices[0] != 0) - return E_INVALIDARG; - } - - bool testMode = (testModeSpec != 0); - - extractCallback->SetTotal(_packSize); - - UInt64 currentTotalPacked = 0; - - RINOK(extractCallback->SetCompleted(¤tTotalPacked)); - - CMyComPtr realOutStream; - Int32 askMode; - askMode = testMode ? NArchive::NExtract::NAskMode::kTest : - NArchive::NExtract::NAskMode::kExtract; - - RINOK(extractCallback->GetStream(0, &realOutStream, askMode)); - - if(!testMode && !realOutStream) - return S_OK; - - extractCallback->PrepareOperation(askMode); - - CDummyOutStream *outStreamSpec = new CDummyOutStream; - CMyComPtr outStream(outStreamSpec); - outStreamSpec->Init(realOutStream); - - realOutStream.Release(); - - CLocalProgress *localProgressSpec = new CLocalProgress; - CMyComPtr progress = localProgressSpec; - localProgressSpec->Init(extractCallback, true); - - RINOK(_stream->Seek(_streamStartPosition + kSignatureSize, STREAM_SEEK_SET, NULL)); - - CMyComPtr decoder; - NCompress::NZ::CDecoder *decoderSpec = new NCompress::NZ::CDecoder; - decoder = decoderSpec; - - HRESULT result = decoderSpec->SetDecoderProperties2(&_properties, 1); - - int opResult; - if (result != S_OK) - opResult = NArchive::NExtract::NOperationResult::kUnSupportedMethod; - else - { - result = decoder->Code(_stream, outStream, NULL, NULL, progress); - outStream.Release(); - if (result == S_FALSE) - opResult = NArchive::NExtract::NOperationResult::kDataError; - else if (result == S_OK) - opResult = NArchive::NExtract::NOperationResult::kOK; - else - return result; - } - RINOK(extractCallback->SetOperationResult(opResult)); - return S_OK; - COM_TRY_END -} - -}} diff --git a/7zip/Archive/Z/ZHandler.h b/7zip/Archive/Z/ZHandler.h deleted file mode 100755 index 7abba29f..00000000 --- a/7zip/Archive/Z/ZHandler.h +++ /dev/null @@ -1,47 +0,0 @@ -// ZHandler.h - -#ifndef __Z_HANDLER_H -#define __Z_HANDLER_H - -#include "Common/MyCom.h" -#include "../IArchive.h" - -namespace NArchive { -namespace NZ { - -class CHandler: - public IInArchive, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP - - STDMETHOD(Open)(IInStream *stream, - const UInt64 *maxCheckStartPosition, - IArchiveOpenCallback *openArchiveCallback); - STDMETHOD(Close)(); - STDMETHOD(GetNumberOfItems)(UInt32 *numItems); - STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value); - STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems, - Int32 testMode, IArchiveExtractCallback *extractCallback); - - STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value); - - STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties); - STDMETHOD(GetPropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - - STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties); - STDMETHOD(GetArchivePropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - -private: - CMyComPtr _stream; - UInt64 _streamStartPosition; - UInt64 _packSize; - Byte _properties; -}; - -}} - -#endif diff --git a/7zip/Archive/Z/makefile b/7zip/Archive/Z/makefile deleted file mode 100755 index aff4fc42..00000000 --- a/7zip/Archive/Z/makefile +++ /dev/null @@ -1,52 +0,0 @@ -PROG = z.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib - -Z_OBJS = \ - $O\DllExports.obj \ - $O\ZHandler.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\NewHandler.obj \ - -WIN_OBJS = \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\InBuffer.obj \ - $O\OutBuffer.obj \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\DummyOutStream.obj \ - -COMPRESS_Z_OBJS = \ - $O\ZDecoder.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(Z_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(COMPRESS_Z_OBJS) \ - $O\resource.res - -!include "../../../Build.mak" - -$(Z_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$(COMPRESS_Z_OBJS): ../../Compress/Z/$(*B).cpp - $(COMPL) diff --git a/7zip/Archive/Z/resource.rc b/7zip/Archive/Z/resource.rc deleted file mode 100755 index 05a81423..00000000 --- a/7zip/Archive/Z/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Z Plugin", "z") - -101 ICON "Z.ico" diff --git a/7zip/Archive/Zip/DllExports.cpp b/7zip/Archive/Zip/DllExports.cpp deleted file mode 100755 index da2a15a4..00000000 --- a/7zip/Archive/Zip/DllExports.cpp +++ /dev/null @@ -1,152 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "ZipHandler.h" -#include "Windows/PropVariant.h" -#include "../../ICoder.h" -#include "../../IPassword.h" -#include "../../Crypto/WzAES/WzAES.h" -#include "../Common/CodecsPath.h" - -// {23170F69-40C1-278B-0401-080000000100} -DEFINE_GUID(CLSID_CCompressDeflateEncoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00); - -// {23170F69-40C1-278B-0401-080000000000} -DEFINE_GUID(CLSID_CCompressDeflateDecoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0401-090000000100} -DEFINE_GUID(CLSID_CCompressDeflate64Encoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00); - -// {23170F69-40C1-278B-0401-090000000000} -DEFINE_GUID(CLSID_CCompressDeflate64Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0402-020000000100} -DEFINE_GUID(CLSID_CCompressBZip2Encoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00); - -// {23170F69-40C1-278B-0402-020000000000} -DEFINE_GUID(CLSID_CCompressBZip2Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0401-060000000000} -DEFINE_GUID(CLSID_CCompressImplodeDecoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-06F1-0101000000100} -DEFINE_GUID(CLSID_CCryptoZipEncoder, -0x23170F69, 0x40C1, 0x278B, 0x06, 0xF1, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00); - -// {23170F69-40C1-278B-06F1-0101000000000} -DEFINE_GUID(CLSID_CCryptoZipDecoder, -0x23170F69, 0x40C1, 0x278B, 0x06, 0xF1, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278A-1000-000110010000} -DEFINE_GUID(CLSID_CZipHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x01, 0x00, 0x00); - -HINSTANCE g_hInstance; -#ifndef _UNICODE -bool g_IsNT = false; -static bool IsItWindowsNT() -{ - OSVERSIONINFO versionInfo; - versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); - if (!::GetVersionEx(&versionInfo)) - return false; - return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT); -} -#endif - -void GetCryptoFolderPrefix(TCHAR *path) -{ - CSysString s = GetCodecsFolderPrefix(); - lstrcpy(path, s); -} - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - if (dwReason == DLL_PROCESS_ATTACH) - { - g_hInstance = hInstance; - #ifndef _UNICODE - g_IsNT = IsItWindowsNT(); - #endif - } - return TRUE; -} - - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CZipHandler) - return CLASS_E_CLASSNOTAVAILABLE; - int needIn = *interfaceID == IID_IInArchive; - int needOut = *interfaceID == IID_IOutArchive; - if (needIn || needOut) - { - NArchive::NZip::CHandler *temp = new NArchive::NZip::CHandler; - if (needIn) - { - CMyComPtr inArchive = (IInArchive *)temp; - *outObject = inArchive.Detach(); - } - else - { - CMyComPtr outArchive = (IOutArchive *)temp; - *outObject = outArchive.Detach(); - } - } - else - return E_NOINTERFACE; - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Zip"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CZipHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"zip jar xpi"; - break; - case NArchive::kUpdate: - propVariant = true; - break; - case NArchive::kKeepName: - propVariant = false; - break; - case NArchive::kStartSignature: - { - const char sig[] = { 0x50, 0x4B, 0x03, 0x04 }; - if ((value->bstrVal = ::SysAllocStringByteLen(sig, 4)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - } - propVariant.Detach(value); - return S_OK; -} diff --git a/7zip/Archive/Zip/StdAfx.cpp b/7zip/Archive/Zip/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Archive/Zip/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Archive/Zip/StdAfx.h b/7zip/Archive/Zip/StdAfx.h deleted file mode 100755 index e7fb6986..00000000 --- a/7zip/Archive/Zip/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Archive/Zip/Zip.dsp b/7zip/Archive/Zip/Zip.dsp deleted file mode 100755 index 2ac27f4f..00000000 --- a/7zip/Archive/Zip/Zip.dsp +++ /dev/null @@ -1,651 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Zip" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Zip - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Zip.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Zip.mak" CFG="Zip - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Zip - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Zip - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Zip - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZIP_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZIP_EXPORTS" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\zip.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Zip - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZIP_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZIP_EXPORTS" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\zip.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Zip - Win32 Release" -# Name "Zip - Win32 Debug" -# Begin Group "spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\AutoPtr.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Random.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Random.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Thread.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\CodecsPath.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\CodecsPath.h -# End Source File -# Begin Source File - -SOURCE=..\Common\CoderLoader.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\CoderLoader.h -# End Source File -# Begin Source File - -SOURCE=..\Common\FilterCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\FilterCoder.h -# End Source File -# Begin Source File - -SOURCE=..\Common\InStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\InStreamWithCRC.h -# End Source File -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.h -# End Source File -# Begin Source File - -SOURCE=..\Common\OutStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\OutStreamWithCRC.h -# End Source File -# Begin Source File - -SOURCE=..\Common\ParseProperties.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ParseProperties.h -# End Source File -# End Group -# Begin Group "7zip common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LSBFDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LSBFDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\MemBlocks.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\MemBlocks.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OffsetStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OffsetStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutMemStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutMemStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressMt.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressMt.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\ZipAddCommon.cpp -# End Source File -# Begin Source File - -SOURCE=.\ZipAddCommon.h -# End Source File -# Begin Source File - -SOURCE=.\ZipCompressionMode.h -# End Source File -# Begin Source File - -SOURCE=.\ZipHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\ZipHandler.h -# End Source File -# Begin Source File - -SOURCE=.\ZipHandlerOut.cpp -# End Source File -# Begin Source File - -SOURCE=.\ZipHeader.cpp -# End Source File -# Begin Source File - -SOURCE=.\ZipHeader.h -# End Source File -# Begin Source File - -SOURCE=.\ZipIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\ZipIn.h -# End Source File -# Begin Source File - -SOURCE=.\ZipItem.cpp -# End Source File -# Begin Source File - -SOURCE=.\ZipItem.h -# End Source File -# Begin Source File - -SOURCE=.\ZipItemEx.h -# End Source File -# Begin Source File - -SOURCE=.\ZipOut.cpp -# End Source File -# Begin Source File - -SOURCE=.\ZipOut.h -# End Source File -# Begin Source File - -SOURCE=.\ZipUpdate.cpp -# End Source File -# Begin Source File - -SOURCE=.\ZipUpdate.h -# End Source File -# End Group -# Begin Group "Crypto" - -# PROP Default_Filter "" -# Begin Group "WzAes" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\WzAES\WzAES.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\WzAES\WzAES.h -# End Source File -# End Group -# Begin Group "Hash" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\Hash\HmacSha1.cpp - -!IF "$(CFG)" == "Zip - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Zip - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\HmacSha1.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Pbkdf2HmacSha1.cpp - -!IF "$(CFG)" == "Zip - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Zip - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Pbkdf2HmacSha1.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\RandGen.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\RandGen.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\RotateDefs.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Sha1.cpp - -!IF "$(CFG)" == "Zip - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Zip - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Sha1.h -# End Source File -# End Group -# Begin Source File - -SOURCE=..\..\Crypto\Zip\ZipCipher.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Zip\ZipCipher.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Zip\ZipCrypto.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Zip\ZipCrypto.h -# End Source File -# End Group -# Begin Group "7z" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\7z\7zMethodID.cpp -# End Source File -# Begin Source File - -SOURCE=..\7z\7zMethodID.h -# End Source File -# Begin Source File - -SOURCE=..\7z\7zMethods.cpp -# End Source File -# Begin Source File - -SOURCE=..\7z\7zMethods.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Group "Shrink" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Shrink\ShrinkDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Shrink\ShrinkDecoder.h -# End Source File -# End Group -# Begin Group "copy" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "Implode" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Implode\ImplodeDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Implode\ImplodeDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Implode\ImplodeHuffmanDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Implode\ImplodeHuffmanDecoder.h -# End Source File -# End Group -# Begin Group "LZ" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.h -# End Source File -# End Group -# End Group -# Begin Source File - -SOURCE=.\zip.ico -# End Source File -# End Target -# End Project diff --git a/7zip/Archive/Zip/Zip.dsw b/7zip/Archive/Zip/Zip.dsw deleted file mode 100755 index 0a355329..00000000 --- a/7zip/Archive/Zip/Zip.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Zip"=.\Zip.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Archive/Zip/ZipAddCommon.cpp b/7zip/Archive/Zip/ZipAddCommon.cpp deleted file mode 100755 index 7eb2787f..00000000 --- a/7zip/Archive/Zip/ZipAddCommon.cpp +++ /dev/null @@ -1,309 +0,0 @@ -// AddCommon.cpp - -#include "StdAfx.h" - -#include "Common/CRC.h" -#include "Windows/PropVariant.h" -#include "Windows/Defs.h" -#include "../../ICoder.h" -#include "../../IPassword.h" -#include "../Common/InStreamWithCRC.h" -#include "../7z/7zMethods.h" - -#include "ZipAddCommon.h" -#include "ZipHeader.h" - -#ifdef COMPRESS_DEFLATE -#include "../../Compress/Deflate/DeflateEncoder.h" -#else -// {23170F69-40C1-278B-0401-080000000100} -DEFINE_GUID(CLSID_CCompressDeflateEncoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00); -#endif - -#ifdef COMPRESS_DEFLATE64 -#include "../../Compress/Deflate/DeflateEncoder.h" -#else -// {23170F69-40C1-278B-0401-090000000100} -DEFINE_GUID(CLSID_CCompressDeflate64Encoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00); -#endif - -#ifdef COMPRESS_BZIP2 -#include "../../Compress/BZip2/BZip2Encoder.h" -#else -// {23170F69-40C1-278B-0402-020000000100} -DEFINE_GUID(CLSID_CCompressBZip2Encoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00); -#endif - - -#ifdef CRYPTO_ZIP -#include "../../Crypto/Zip/ZipCipher.h" -#else -// {23170F69-40C1-278B-06F1-0101000000100} -DEFINE_GUID(CLSID_CCryptoZipEncoder, -0x23170F69, 0x40C1, 0x278B, 0x06, 0xF1, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00); -#endif - -namespace NArchive { -namespace NZip { - -CAddCommon::CAddCommon(const CCompressionMethodMode &options): - _options(options), - _copyCoderSpec(NULL), - _cryptoStreamSpec(0) - {} - -static HRESULT GetStreamCRC(ISequentialInStream *inStream, UInt32 &resultCRC) -{ - CCRC crc; - crc.Init(); - const UInt32 kBufferSize = (1 << 14); - Byte buffer[kBufferSize]; - for (;;) - { - UInt32 realProcessedSize; - RINOK(inStream->Read(buffer, kBufferSize, &realProcessedSize)); - if(realProcessedSize == 0) - { - resultCRC = crc.GetDigest(); - return S_OK; - } - crc.Update(buffer, realProcessedSize); - } -} - -HRESULT CAddCommon::Compress(ISequentialInStream *inStream, IOutStream *outStream, - ICompressProgressInfo *progress, CCompressingResult &operationResult) -{ - CSequentialInStreamWithCRC *inSecCrcStreamSpec = 0; - CInStreamWithCRC *inCrcStreamSpec = 0; - CMyComPtr inCrcStream; - { - CMyComPtr inStream2; - // we don't support stdin, since stream from stdin can require 64-bit size header - RINOK(inStream->QueryInterface(IID_IInStream, (void **)&inStream2)); - if (inStream2) - { - inCrcStreamSpec = new CInStreamWithCRC; - inCrcStream = inCrcStreamSpec; - inCrcStreamSpec->SetStream(inStream2); - inCrcStreamSpec->Init(); - } - else - { - inSecCrcStreamSpec = new CSequentialInStreamWithCRC; - inCrcStream = inSecCrcStreamSpec; - inSecCrcStreamSpec->SetStream(inStream); - inSecCrcStreamSpec->Init(); - } - } - - int numTestMethods = _options.MethodSequence.Size(); - if (numTestMethods > 1 || _options.PasswordIsDefined) - { - if (inCrcStreamSpec == 0) - { - if (_options.PasswordIsDefined) - return E_NOTIMPL; - numTestMethods = 1; - } - } - Byte method = 0; - COutStreamReleaser outStreamReleaser; - for(int i = 0; i < numTestMethods; i++) - { - if (inCrcStreamSpec != 0) - RINOK(inCrcStreamSpec->Seek(0, STREAM_SEEK_SET, NULL)); - RINOK(outStream->Seek(0, STREAM_SEEK_SET, NULL)); - if (_options.PasswordIsDefined) - { - if (!_cryptoStream) - { - _cryptoStreamSpec = new CFilterCoder; - _cryptoStream = _cryptoStreamSpec; - } - if (_options.IsAesMode) - { - _cryptoStreamSpec->Filter = _aesFilter = _filterAesSpec = new NCrypto::NWzAES::CEncoder; - _filterAesSpec->SetKeyMode(_options.AesKeyMode); - RINOK(_filterAesSpec->CryptoSetPassword( - (const Byte *)(const char *)_options.Password, _options.Password.Length())); - RINOK(_filterAesSpec->WriteHeader(outStream)); - } - else - { - _cryptoStreamSpec->Filter = _zipCryptoFilter = _filterSpec = new NCrypto::NZip::CEncoder; - RINOK(_filterSpec->CryptoSetPassword( - (const Byte *)(const char *)_options.Password, _options.Password.Length())); - UInt32 crc = 0; - RINOK(GetStreamCRC(inStream, crc)); - RINOK(inCrcStreamSpec->Seek(0, STREAM_SEEK_SET, NULL)); - RINOK(_filterSpec->CryptoSetCRC(crc)); - RINOK(_filterSpec->WriteHeader(outStream)); - } - RINOK(_cryptoStreamSpec->SetOutStream(outStream)); - outStreamReleaser.FilterCoder = _cryptoStreamSpec; - } - - method = _options.MethodSequence[i]; - switch(method) - { - case NFileHeader::NCompressionMethod::kStored: - { - if(_copyCoderSpec == NULL) - { - _copyCoderSpec = new NCompress::CCopyCoder; - _copyCoder = _copyCoderSpec; - } - CMyComPtr outStreamNew; - if (_options.PasswordIsDefined) - outStreamNew = _cryptoStream; - else - outStreamNew = outStream; - RINOK(_copyCoder->Code(inCrcStream, outStreamNew, NULL, NULL, progress)); - operationResult.ExtractVersion = NFileHeader::NCompressionMethod::kStoreExtractVersion; - break; - } - default: - { - if(!_compressEncoder) - { - // RINOK(m_MatchFinder.CoCreateInstance(CLSID_CMatchFinderBT3)); - #ifndef COMPRESS_DEFLATE - UString methodName; - N7z::LoadMethodMap(); - #endif - switch(method) - { - case NFileHeader::NCompressionMethod::kDeflated: - { - #ifdef COMPRESS_DEFLATE - _compressEncoder = new NCompress::NDeflate::NEncoder::CCOMCoder; - #else - methodName = L"Deflate"; - #endif - break; - } - case NFileHeader::NCompressionMethod::kDeflated64: - { - #ifdef COMPRESS_DEFLATE64 - _compressEncoder = new NCompress::NDeflate::NEncoder::CCOMCoder64; - #else - methodName = L"Deflate64"; - #endif - break; - } - case NFileHeader::NCompressionMethod::kBZip2: - { - #ifdef COMPRESS_BZIP2 - _compressEncoder = new NCompress::NBZip2::CEncoder; - #else - methodName = L"BZip2"; - #endif - break; - } - } - #ifndef COMPRESS_DEFLATE - N7z::CMethodInfo2 methodInfo; - if (!N7z::GetMethodInfo(methodName, methodInfo)) - return E_NOTIMPL; - RINOK(_compressLib.LoadAndCreateCoder( - methodInfo.FilePath, methodInfo.Encoder, &_compressEncoder)); - #endif - - if (method == NFileHeader::NCompressionMethod::kDeflated || - method == NFileHeader::NCompressionMethod::kDeflated64) - { - NWindows::NCOM::CPropVariant properties[] = - { - _options.NumPasses, - _options.NumFastBytes, - _options.NumMatchFinderCycles - }; - PROPID propIDs[] = - { - NCoderPropID::kNumPasses, - NCoderPropID::kNumFastBytes, - NCoderPropID::kMatchFinderCycles - }; - int numProps = sizeof(propIDs) / sizeof(propIDs[0]); - if (!_options.NumMatchFinderCyclesDefined) - numProps--; - CMyComPtr setCoderProperties; - _compressEncoder.QueryInterface(IID_ICompressSetCoderProperties, &setCoderProperties); - if (setCoderProperties) - { - RINOK(setCoderProperties->SetCoderProperties(propIDs, properties, numProps)); - } - } - else if (method == NFileHeader::NCompressionMethod::kBZip2) - { - NWindows::NCOM::CPropVariant properties[] = - { - _options.DicSize, - _options.NumPasses - #ifdef COMPRESS_MT - , _options.NumThreads - #endif - }; - PROPID propIDs[] = - { - NCoderPropID::kDictionarySize, - NCoderPropID::kNumPasses - #ifdef COMPRESS_MT - , NCoderPropID::kNumThreads - #endif - }; - CMyComPtr setCoderProperties; - _compressEncoder.QueryInterface(IID_ICompressSetCoderProperties, &setCoderProperties); - if (setCoderProperties) - { - RINOK(setCoderProperties->SetCoderProperties(propIDs, properties, sizeof(propIDs) / sizeof(propIDs[0]))); - } - } - } - CMyComPtr outStreamNew; - if (_options.PasswordIsDefined) - outStreamNew = _cryptoStream; - else - outStreamNew = outStream; - RINOK(_compressEncoder->Code(inCrcStream, outStreamNew, NULL, NULL, progress)); - operationResult.ExtractVersion = NFileHeader::NCompressionMethod::kDeflateExtractVersion; - break; - } - } - - RINOK(outStream->Seek(0, STREAM_SEEK_CUR, &operationResult.PackSize)); - - if (inCrcStreamSpec != 0) - { - operationResult.CRC = inCrcStreamSpec->GetCRC(); - operationResult.UnpackSize = inCrcStreamSpec->GetSize(); - } - else - { - operationResult.CRC = inSecCrcStreamSpec->GetCRC(); - operationResult.UnpackSize = inSecCrcStreamSpec->GetSize(); - } - - if (_options.PasswordIsDefined) - { - if (operationResult.PackSize < operationResult.UnpackSize + - (_options.IsAesMode ? _filterAesSpec->GetHeaderSize() : NCrypto::NZip::kHeaderSize)) - break; - } - else if (operationResult.PackSize < operationResult.UnpackSize) - break; - } - if (_options.IsAesMode) - { - RINOK(_filterAesSpec->WriteFooter(outStream)); - RINOK(outStream->Seek(0, STREAM_SEEK_CUR, &operationResult.PackSize)); - } - operationResult.Method = method; - return outStream->SetSize(operationResult.PackSize); -} - -}} diff --git a/7zip/Archive/Zip/ZipAddCommon.h b/7zip/Archive/Zip/ZipAddCommon.h deleted file mode 100755 index 26cec643..00000000 --- a/7zip/Archive/Zip/ZipAddCommon.h +++ /dev/null @@ -1,58 +0,0 @@ -// Zip/AddCommon.h - -#ifndef __ZIP_ADDCOMMON_H -#define __ZIP_ADDCOMMON_H - -#include "../../ICoder.h" -#include "../../IProgress.h" -#include "../../Compress/Copy/CopyCoder.h" -#ifndef COMPRESS_DEFLATE -#include "../Common/CoderLoader.h" -#endif -#include "../Common/FilterCoder.h" -#include "ZipCompressionMode.h" -#include "../../Crypto/Zip/ZipCipher.h" -#include "../../Crypto/WzAES/WzAES.h" - -namespace NArchive { -namespace NZip { - -struct CCompressingResult -{ - UInt64 UnpackSize; - UInt64 PackSize; - UInt32 CRC; - UInt16 Method; - Byte ExtractVersion; -}; - -class CAddCommon -{ - CCompressionMethodMode _options; - NCompress::CCopyCoder *_copyCoderSpec; - CMyComPtr _copyCoder; - - #ifndef COMPRESS_DEFLATE - CCoderLibrary _compressLib; - #endif - CMyComPtr _compressEncoder; - - CFilterCoder *_cryptoStreamSpec; - CMyComPtr _cryptoStream; - - NCrypto::NZip::CEncoder *_filterSpec; - NCrypto::NWzAES::CEncoder *_filterAesSpec; - - CMyComPtr _zipCryptoFilter; - CMyComPtr _aesFilter; - - -public: - CAddCommon(const CCompressionMethodMode &options); - HRESULT Compress(ISequentialInStream *inStream, IOutStream *outStream, - ICompressProgressInfo *progress, CCompressingResult &operationResult); -}; - -}} - -#endif diff --git a/7zip/Archive/Zip/ZipCompressionMode.h b/7zip/Archive/Zip/ZipCompressionMode.h deleted file mode 100755 index f1c79918..00000000 --- a/7zip/Archive/Zip/ZipCompressionMode.h +++ /dev/null @@ -1,39 +0,0 @@ -// CompressionMode.h - -#ifndef __ZIP_COMPRESSIONMETHOD_H -#define __ZIP_COMPRESSIONMETHOD_H - -#include "Common/Vector.h" -#include "Common/String.h" - -namespace NArchive { -namespace NZip { - -struct CCompressionMethodMode -{ - CRecordVector MethodSequence; - // bool MaximizeRatio; - UInt32 NumPasses; - UInt32 NumFastBytes; - bool NumMatchFinderCyclesDefined; - UInt32 NumMatchFinderCycles; - UInt32 DicSize; - #ifdef COMPRESS_MT - UInt32 NumThreads; - #endif - bool PasswordIsDefined; - AString Password; - bool IsAesMode; - Byte AesKeyMode; - - CCompressionMethodMode(): - NumMatchFinderCyclesDefined(false), - PasswordIsDefined(false), - IsAesMode(false), - AesKeyMode(3) - {} -}; - -}} - -#endif diff --git a/7zip/Archive/Zip/ZipHandler.cpp b/7zip/Archive/Zip/ZipHandler.cpp deleted file mode 100755 index 4672d768..00000000 --- a/7zip/Archive/Zip/ZipHandler.cpp +++ /dev/null @@ -1,766 +0,0 @@ -// ZipHandler.cpp - -#include "StdAfx.h" - -#include "ZipHandler.h" - -#include "Common/Defs.h" -#include "Common/CRC.h" -#include "Common/StringConvert.h" -#include "Common/ComTry.h" -#include "Common/IntToString.h" - -#include "Windows/Time.h" -#include "Windows/PropVariant.h" - -#include "../../IPassword.h" - -#include "../../Common/ProgressUtils.h" -#include "../../Common/StreamObjects.h" - -#include "../../Compress/Copy/CopyCoder.h" - -#include "../Common/ItemNameUtils.h" -#include "../Common/OutStreamWithCRC.h" -#include "../Common/FilterCoder.h" -#include "../7z/7zMethods.h" - -#include "../../Compress/Shrink/ShrinkDecoder.h" -#include "../../Compress/Implode/ImplodeDecoder.h" - -#ifdef COMPRESS_DEFLATE -#include "../../Compress/Deflate/DeflateDecoder.h" -#else -// {23170F69-40C1-278B-0401-080000000000} -DEFINE_GUID(CLSID_CCompressDeflateDecoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00); -#endif - -#ifdef COMPRESS_DEFLATE64 -#include "../../Compress/Deflate/DeflateDecoder.h" -#else -// {23170F69-40C1-278B-0401-090000000000} -DEFINE_GUID(CLSID_CCompressDeflate64Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00); -#endif - -/* -#ifdef COMPRESS_IMPLODE -#else -// {23170F69-40C1-278B-0401-060000000000} -DEFINE_GUID(CLSID_CCompressImplodeDecoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00); -#endif -*/ - -#ifdef COMPRESS_BZIP2 -#include "../../Compress/BZip2/BZip2Decoder.h" -#else -// {23170F69-40C1-278B-0402-020000000000} -DEFINE_GUID(CLSID_CCompressBZip2Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00); -#endif - -#include "../../Crypto/Zip/ZipCipher.h" -#include "../../Crypto/WzAES/WzAES.h" - -#ifndef EXCLUDE_COM -#include "../Common/CoderLoader.h" -#endif - -using namespace NWindows; -using namespace NTime; - -namespace NArchive { -namespace NZip { - -const wchar_t *kHostOS[] = -{ - L"FAT", - L"AMIGA", - L"VMS", - L"Unix", - L"VM_CMS", - L"Atari", // what if it's a minix filesystem? [cjh] - L"HPFS", // filesystem used by OS/2 (and NT 3.x) - L"Mac", - L"Z_System", - L"CPM", - L"TOPS20", // pkzip 2.50 NTFS - L"NTFS", // filesystem used by Windows NT - L"QDOS ", // SMS/QDOS - L"Acorn", // Archimedes Acorn RISC OS - L"VFAT", // filesystem used by Windows 95, NT - L"MVS", - L"BeOS", // hybrid POSIX/database filesystem - // BeBOX or PowerMac - L"Tandem", - L"THEOS" -}; - - -static const int kNumHostOSes = sizeof(kHostOS) / sizeof(kHostOS[0]); - -static const wchar_t *kUnknownOS = L"Unknown"; - - -/* -enum // PropID -{ - kpidUnPackVersion, -}; -*/ - -STATPROPSTG kProperties[] = -{ - { NULL, kpidPath, VT_BSTR}, - { NULL, kpidIsFolder, VT_BOOL}, - { NULL, kpidSize, VT_UI8}, - { NULL, kpidPackedSize, VT_UI8}, - { NULL, kpidLastWriteTime, VT_FILETIME}, - { NULL, kpidAttributes, VT_UI4}, - - { NULL, kpidEncrypted, VT_BOOL}, - { NULL, kpidComment, VT_BSTR}, - - { NULL, kpidCRC, VT_UI4}, - - { NULL, kpidMethod, VT_BSTR}, - { NULL, kpidHostOS, VT_BSTR} - - // { L"UnPack Version", kpidUnPackVersion, VT_UI1}, -}; - -const wchar_t *kMethods[] = -{ - L"Store", - L"Shrink", - L"Reduced1", - L"Reduced2", - L"Reduced2", - L"Reduced3", - L"Implode", - L"Tokenizing", - L"Deflate", - L"Deflate64", - L"PKImploding", - L"Unknown", - L"BZip2" -}; - -const int kNumMethods = sizeof(kMethods) / sizeof(kMethods[0]); -// const wchar_t *kUnknownMethod = L"Unknown"; -const wchar_t *kPPMdMethod = L"PPMd"; -const wchar_t *kAESMethod = L"AES"; -const wchar_t *kZipCryptoMethod = L"ZipCrypto"; - -CHandler::CHandler(): - m_ArchiveIsOpen(false) -{ - InitMethodProperties(); -} - -STDMETHODIMP CHandler::GetArchiveProperty(PROPID /* propID */, PROPVARIANT *value) -{ - value->vt = VT_EMPTY; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties) -{ - *numProperties = sizeof(kProperties) / sizeof(kProperties[0]); - return S_OK; -} - -STDMETHODIMP CHandler::GetPropertyInfo(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) -{ - if(index >= sizeof(kProperties) / sizeof(kProperties[0])) - return E_INVALIDARG; - const STATPROPSTG &srcItem = kProperties[index]; - *propID = srcItem.propid; - *varType = srcItem.vt; - *name = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) -{ - *numProperties = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetArchivePropertyInfo(UInt32 /* index */, - BSTR * /* name */, PROPID * /* propID */, VARTYPE * /* varType */) -{ - return E_NOTIMPL; -} - -STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems) -{ - *numItems = m_Items.Size(); - return S_OK; -} - -static void MyStrNCpy(char *dest, const char *src, int size) -{ - for (int i = 0; i < size; i++) - { - char c = src[i]; - dest[i] = c; - if (c == 0) - break; - } -} - -STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID aPropID, PROPVARIANT *aValue) -{ - COM_TRY_BEGIN - NWindows::NCOM::CPropVariant propVariant; - const CItemEx &item = m_Items[index]; - switch(aPropID) - { - case kpidPath: - propVariant = NItemName::GetOSName2( - MultiByteToUnicodeString(item.Name, item.GetCodePage())); - break; - case kpidIsFolder: - propVariant = item.IsDirectory(); - break; - case kpidSize: - propVariant = item.UnPackSize; - break; - case kpidPackedSize: - propVariant = item.PackSize; - break; - case kpidLastWriteTime: - { - FILETIME aLocalFileTime, anUTCFileTime; - if (DosTimeToFileTime(item.Time, aLocalFileTime)) - { - if (!LocalFileTimeToFileTime(&aLocalFileTime, &anUTCFileTime)) - anUTCFileTime.dwHighDateTime = anUTCFileTime.dwLowDateTime = 0; - } - else - anUTCFileTime.dwHighDateTime = anUTCFileTime.dwLowDateTime = 0; - propVariant = anUTCFileTime; - break; - } - case kpidAttributes: - propVariant = item.GetWinAttributes(); - break; - case kpidEncrypted: - propVariant = item.IsEncrypted(); - break; - case kpidComment: - { - int size = (int)item.Comment.GetCapacity(); - if (size > 0) - { - AString s; - char *p = s.GetBuffer(size + 1); - MyStrNCpy(p, (const char *)(const Byte *)item.Comment, size); - p[size] = '\0'; - s.ReleaseBuffer(); - propVariant = MultiByteToUnicodeString(s, item.GetCodePage()); - } - break; - } - case kpidCRC: - if (item.IsThereCrc()) - propVariant = item.FileCRC; - break; - case kpidMethod: - { - UInt16 methodId = item.CompressionMethod; - UString method; - if (item.IsEncrypted()) - { - if (methodId == NFileHeader::NCompressionMethod::kWzAES) - { - method = kAESMethod; - CWzAesExtraField aesField; - if (item.CentralExtra.GetWzAesField(aesField)) - { - method += L"-"; - wchar_t s[32]; - ConvertUInt64ToString((aesField.Strength + 1) * 64 , s); - method += s; - method += L" "; - methodId = aesField.Method; - } - } - else - { - method += kZipCryptoMethod; - method += L" "; - } - } - if (methodId < kNumMethods) - method += kMethods[methodId]; - else if (methodId == NFileHeader::NCompressionMethod::kWzPPMd) - method += kPPMdMethod; - else - { - wchar_t s[32]; - ConvertUInt64ToString(methodId, s); - method += s; - } - propVariant = method; - break; - } - case kpidHostOS: - propVariant = (item.MadeByVersion.HostOS < kNumHostOSes) ? - (kHostOS[item.MadeByVersion.HostOS]) : kUnknownOS; - break; - } - propVariant.Detach(aValue); - return S_OK; - COM_TRY_END -} - -class CPropgressImp: public CProgressVirt -{ - CMyComPtr m_OpenArchiveCallback; -public: - STDMETHOD(SetCompleted)(const UInt64 *numFiles); - void Init(IArchiveOpenCallback *openArchiveCallback) - { m_OpenArchiveCallback = openArchiveCallback; } -}; - -STDMETHODIMP CPropgressImp::SetCompleted(const UInt64 *numFiles) -{ - if (m_OpenArchiveCallback) - return m_OpenArchiveCallback->SetCompleted(numFiles, NULL); - return S_OK; -} - -STDMETHODIMP CHandler::Open(IInStream *inStream, - const UInt64 *maxCheckStartPosition, IArchiveOpenCallback *openArchiveCallback) -{ - COM_TRY_BEGIN - // try - { - if(!m_Archive.Open(inStream, maxCheckStartPosition)) - return S_FALSE; - m_ArchiveIsOpen = true; - m_Items.Clear(); - if (openArchiveCallback != NULL) - { - RINOK(openArchiveCallback->SetTotal(NULL, NULL)); - } - CPropgressImp propgressImp; - propgressImp.Init(openArchiveCallback); - RINOK(m_Archive.ReadHeaders(m_Items, &propgressImp)); - } - /* - catch(...) - { - return S_FALSE; - } - */ - COM_TRY_END - return S_OK; -} - -STDMETHODIMP CHandler::Close() -{ - m_Items.Clear(); - m_Archive.Close(); - m_ArchiveIsOpen = false; - return S_OK; -} - -////////////////////////////////////// -// CHandler::DecompressItems - -struct CMethodItem -{ - UInt16 ZipMethod; - CMyComPtr Coder; -}; - -class CZipDecoder -{ - NCrypto::NZip::CDecoder *_zipCryptoDecoderSpec; - NCrypto::NWzAES::CDecoder *_aesDecoderSpec; - CMyComPtr _zipCryptoDecoder; - CMyComPtr _aesDecoder; - CFilterCoder *filterStreamSpec; - CMyComPtr filterStream; - CMyComPtr getTextPassword; - #ifndef EXCLUDE_COM - CCoderLibraries libraries; - #endif - CObjectVector methodItems; - -public: - CZipDecoder(): _zipCryptoDecoderSpec(0), _aesDecoderSpec(0), filterStreamSpec(0) {} - - static void Init() - { - #ifndef EXCLUDE_COM - N7z::LoadMethodMap(); - #endif - } - - HRESULT Decode(CInArchive &archive, const CItemEx &item, - ISequentialOutStream *realOutStream, - IArchiveExtractCallback *extractCallback, - ICompressProgressInfo *compressProgress, - UInt32 numThreads, Int32 &res); -}; - -HRESULT CZipDecoder::Decode(CInArchive &archive, const CItemEx &item, - ISequentialOutStream *realOutStream, - IArchiveExtractCallback *extractCallback, - ICompressProgressInfo *compressProgress, - UInt32 numThreads, Int32 &res) -{ - res = NArchive::NExtract::NOperationResult::kDataError; - CInStreamReleaser inStreamReleaser; - - bool needCRC = true; - bool aesMode = false; - UInt16 methodId = item.CompressionMethod; - if (item.IsEncrypted()) - if (methodId == NFileHeader::NCompressionMethod::kWzAES) - { - CWzAesExtraField aesField; - if (item.CentralExtra.GetWzAesField(aesField)) - { - aesMode = true; - needCRC = aesField.NeedCrc(); - } - } - - COutStreamWithCRC *outStreamSpec = new COutStreamWithCRC;; - CMyComPtr outStream = outStreamSpec; - outStreamSpec->SetStream(realOutStream); - outStreamSpec->Init(needCRC); - - UInt64 authenticationPos; - - CMyComPtr inStream; - { - UInt64 packSize = item.PackSize; - if (aesMode) - { - if (packSize < NCrypto::NWzAES::kMacSize) - return S_OK; - packSize -= NCrypto::NWzAES::kMacSize; - } - UInt64 dataPos = item.GetDataPosition(); - inStream.Attach(archive.CreateLimitedStream(dataPos, packSize)); - authenticationPos = dataPos + packSize; - } - - CMyComPtr cryptoFilter; - if (item.IsEncrypted()) - { - if (aesMode) - { - CWzAesExtraField aesField; - if (!item.CentralExtra.GetWzAesField(aesField)) - return S_OK; - methodId = aesField.Method; - if (!_aesDecoder) - { - _aesDecoderSpec = new NCrypto::NWzAES::CDecoder; - _aesDecoder = _aesDecoderSpec; - } - cryptoFilter = _aesDecoder; - Byte properties = aesField.Strength; - RINOK(_aesDecoderSpec->SetDecoderProperties2(&properties, 1)); - } - else - { - if (!_zipCryptoDecoder) - { - _zipCryptoDecoderSpec = new NCrypto::NZip::CDecoder; - _zipCryptoDecoder = _zipCryptoDecoderSpec; - } - cryptoFilter = _zipCryptoDecoder; - } - CMyComPtr cryptoSetPassword; - RINOK(cryptoFilter.QueryInterface(IID_ICryptoSetPassword, &cryptoSetPassword)); - - if (!getTextPassword) - extractCallback->QueryInterface(IID_ICryptoGetTextPassword, (void **)&getTextPassword); - - if (getTextPassword) - { - CMyComBSTR password; - RINOK(getTextPassword->CryptoGetTextPassword(&password)); - AString charPassword; - if (aesMode) - { - charPassword = UnicodeStringToMultiByte((const wchar_t *)password, CP_ACP); - /* - for (int i = 0;; i++) - { - wchar_t c = password[i]; - if (c == 0) - break; - if (c >= 0x80) - { - res = NArchive::NExtract::NOperationResult::kDataError; - return S_OK; - } - charPassword += (char)c; - } - */ - } - else - { - // we use OEM. WinZip/Windows probably use ANSI for some files - charPassword = UnicodeStringToMultiByte((const wchar_t *)password, CP_OEMCP); - } - HRESULT res = cryptoSetPassword->CryptoSetPassword( - (const Byte *)(const char *)charPassword, charPassword.Length()); - if (res != S_OK) - return S_OK; - } - else - { - RINOK(cryptoSetPassword->CryptoSetPassword(0, 0)); - } - } - - int m; - for (m = 0; m < methodItems.Size(); m++) - if (methodItems[m].ZipMethod == methodId) - break; - - if (m == methodItems.Size()) - { - CMethodItem mi; - mi.ZipMethod = methodId; - if (methodId == NFileHeader::NCompressionMethod::kStored) - mi.Coder = new NCompress::CCopyCoder; - else if (methodId == NFileHeader::NCompressionMethod::kShrunk) - mi.Coder = new NCompress::NShrink::CDecoder; - else if (methodId == NFileHeader::NCompressionMethod::kImploded) - mi.Coder = new NCompress::NImplode::NDecoder::CCoder; - else - { - #ifdef EXCLUDE_COM - switch(methodId) - { - case NFileHeader::NCompressionMethod::kDeflated: - mi.Coder = new NCompress::NDeflate::NDecoder::CCOMCoder; - break; - case NFileHeader::NCompressionMethod::kDeflated64: - mi.Coder = new NCompress::NDeflate::NDecoder::CCOMCoder64; - break; - case NFileHeader::NCompressionMethod::kBZip2: - mi.Coder = new NCompress::NBZip2::CDecoder; - break; - default: - res = NArchive::NExtract::NOperationResult::kUnSupportedMethod; - return S_OK; - } - #else - N7z::CMethodID methodID = { { 0x04, 0x01 } , 3 }; - if (methodId > 0xFF) - { - res = NArchive::NExtract::NOperationResult::kUnSupportedMethod; - return S_OK; - } - methodID.ID[2] = (Byte)methodId; - if (methodId == NFileHeader::NCompressionMethod::kStored) - { - methodID.ID[0] = 0; - methodID.IDSize = 1; - } - else if (methodId == NFileHeader::NCompressionMethod::kBZip2) - { - methodID.ID[1] = 0x02; - methodID.ID[2] = 0x02; - } - - N7z::CMethodInfo methodInfo; - if (!N7z::GetMethodInfo(methodID, methodInfo)) - { - res = NArchive::NExtract::NOperationResult::kUnSupportedMethod; - return S_OK; - } - RINOK(libraries.CreateCoder(methodInfo.FilePath, methodInfo.Decoder, &mi.Coder)); - #endif - } - m = methodItems.Add(mi); - } - ICompressCoder *coder = methodItems[m].Coder; - - { - CMyComPtr setDecoderProperties; - coder->QueryInterface(IID_ICompressSetDecoderProperties2, (void **)&setDecoderProperties); - if (setDecoderProperties) - { - Byte properties = (Byte)item.Flags; - RINOK(setDecoderProperties->SetDecoderProperties2(&properties, 1)); - } - } - - #ifdef COMPRESS_MT - { - CMyComPtr setCoderMt; - coder->QueryInterface(IID_ICompressSetCoderMt, (void **)&setCoderMt); - if (setCoderMt) - { - RINOK(setCoderMt->SetNumberOfThreads(numThreads)); - } - } - #endif - - { - HRESULT result; - CMyComPtr inStreamNew; - if (item.IsEncrypted()) - { - if (!filterStream) - { - filterStreamSpec = new CFilterCoder; - filterStream = filterStreamSpec; - } - filterStreamSpec->Filter = cryptoFilter; - if (aesMode) - { - RINOK(_aesDecoderSpec->ReadHeader(inStream)); - } - else - { - RINOK(_zipCryptoDecoderSpec->ReadHeader(inStream)); - } - RINOK(filterStreamSpec->SetInStream(inStream)); - inStreamReleaser.FilterCoder = filterStreamSpec; - inStreamNew = filterStream; - - if (aesMode) - { - if (!_aesDecoderSpec->CheckPasswordVerifyCode()) - return S_OK; - } - } - else - inStreamNew = inStream; - result = coder->Code(inStreamNew, outStream, NULL, &item.UnPackSize, compressProgress); - if (result == S_FALSE) - return S_OK; - RINOK(result); - } - bool crcOK = true; - bool authOk = true; - if (needCRC) - crcOK = (outStreamSpec->GetCRC() == item.FileCRC); - if (aesMode) - { - inStream.Attach(archive.CreateLimitedStream(authenticationPos, NCrypto::NWzAES::kMacSize)); - if (_aesDecoderSpec->CheckMac(inStream, authOk) != S_OK) - authOk = false; - } - - res = ((crcOK && authOk) ? - NArchive::NExtract::NOperationResult::kOK : - NArchive::NExtract::NOperationResult::kCRCError); - return S_OK; -} - - -STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, - Int32 _aTestMode, IArchiveExtractCallback *extractCallback) -{ - COM_TRY_BEGIN - CZipDecoder myDecoder; - bool testMode = (_aTestMode != 0); - UInt64 totalUnPacked = 0, totalPacked = 0; - bool allFilesMode = (numItems == UInt32(-1)); - if (allFilesMode) - numItems = m_Items.Size(); - if(numItems == 0) - return S_OK; - UInt32 i; - for(i = 0; i < numItems; i++) - { - const CItemEx &item = m_Items[allFilesMode ? i : indices[i]]; - totalUnPacked += item.UnPackSize; - totalPacked += item.PackSize; - } - extractCallback->SetTotal(totalUnPacked); - - UInt64 currentTotalUnPacked = 0, currentTotalPacked = 0; - UInt64 currentItemUnPacked, currentItemPacked; - - CLocalProgress *localProgressSpec = new CLocalProgress; - CMyComPtr progress = localProgressSpec; - CLocalCompressProgressInfo *localCompressProgressSpec = new CLocalCompressProgressInfo; - CMyComPtr compressProgress = localCompressProgressSpec; - - CZipDecoder::Init(); - - for (i = 0; i < numItems; i++, currentTotalUnPacked += currentItemUnPacked, - currentTotalPacked += currentItemPacked) - { - currentItemUnPacked = 0; - currentItemPacked = 0; - - RINOK(extractCallback->SetCompleted(¤tTotalUnPacked)); - CMyComPtr realOutStream; - Int32 askMode = testMode ? - NArchive::NExtract::NAskMode::kTest : - NArchive::NExtract::NAskMode::kExtract; - Int32 index = allFilesMode ? i : indices[i]; - - RINOK(extractCallback->GetStream(index, &realOutStream, askMode)); - - CItemEx item = m_Items[index]; - if (!item.FromLocal) - { - HRESULT res = m_Archive.ReadLocalItemAfterCdItem(item); - if (res == S_FALSE) - { - if (item.IsDirectory() || realOutStream || testMode) - { - RINOK(extractCallback->PrepareOperation(askMode)); - realOutStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kUnSupportedMethod)); - } - continue; - } - RINOK(res); - } - - if (item.IsDirectory() || item.IgnoreItem()) - { - // if (!testMode) - { - RINOK(extractCallback->PrepareOperation(askMode)); - realOutStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - } - continue; - } - - currentItemUnPacked = item.UnPackSize; - currentItemPacked = item.PackSize; - - if (!testMode && (!realOutStream)) - continue; - - RINOK(extractCallback->PrepareOperation(askMode)); - - localProgressSpec->Init(extractCallback, false); - localCompressProgressSpec->Init(progress, ¤tTotalPacked, ¤tTotalUnPacked); - - Int32 res; - RINOK(myDecoder.Decode(m_Archive, item, realOutStream, extractCallback, - compressProgress, _numThreads, res)); - realOutStream.Release(); - - RINOK(extractCallback->SetOperationResult(res)) - } - return S_OK; - COM_TRY_END -} - -}} diff --git a/7zip/Archive/Zip/ZipHandler.h b/7zip/Archive/Zip/ZipHandler.h deleted file mode 100755 index ea6becd0..00000000 --- a/7zip/Archive/Zip/ZipHandler.h +++ /dev/null @@ -1,100 +0,0 @@ -// Zip/Handler.h - -#ifndef __ZIP_HANDLER_H -#define __ZIP_HANDLER_H - -#include "Common/DynamicBuffer.h" -#include "../../ICoder.h" -#include "../IArchive.h" - -#include "ZipIn.h" -#include "ZipCompressionMode.h" - -#ifdef COMPRESS_MT -#include "../../../Windows/System.h" -#endif - -namespace NArchive { -namespace NZip { - -class CHandler: - public IInArchive, - public IOutArchive, - public ISetProperties, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP3( - IInArchive, - IOutArchive, - ISetProperties - ) - - STDMETHOD(Open)(IInStream *aStream, - const UInt64 *aMaxCheckStartPosition, - IArchiveOpenCallback *anOpenArchiveCallback); - STDMETHOD(Close)(); - STDMETHOD(GetNumberOfItems)(UInt32 *numItems); - STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value); - STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems, - Int32 testMode, IArchiveExtractCallback *anExtractCallback); - - STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value); - - STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties); - STDMETHOD(GetPropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - - STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties); - STDMETHOD(GetArchivePropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - - // IOutArchive - STDMETHOD(UpdateItems)(ISequentialOutStream *outStream, UInt32 numItems, - IArchiveUpdateCallback *updateCallback); - STDMETHOD(GetFileTimeType)(UInt32 *timeType); - - // ISetProperties - STDMETHOD(SetProperties)(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties); - - CHandler(); -private: - CObjectVector m_Items; - CInArchive m_Archive; - bool m_ArchiveIsOpen; - - int m_Level; - int m_MainMethod; - UInt32 m_DicSize; - UInt32 m_NumPasses; - UInt32 m_NumFastBytes; - UInt32 m_NumMatchFinderCycles; - bool m_NumMatchFinderCyclesDefined; - - bool m_IsAesMode; - Byte m_AesKeyMode; - - #ifdef COMPRESS_MT - UInt32 _numThreads; - #endif - - void InitMethodProperties() - { - m_Level = -1; - m_MainMethod = -1; - m_DicSize = - m_NumPasses = - m_NumFastBytes = - m_NumMatchFinderCycles = 0xFFFFFFFF; - m_NumMatchFinderCyclesDefined = false; - m_IsAesMode = false; - m_AesKeyMode = 3; // aes-256 - #ifdef COMPRESS_MT - _numThreads = NWindows::NSystem::GetNumberOfProcessors();; - #endif - } -}; - -}} - -#endif diff --git a/7zip/Archive/Zip/ZipHandlerOut.cpp b/7zip/Archive/Zip/ZipHandlerOut.cpp deleted file mode 100755 index e2394172..00000000 --- a/7zip/Archive/Zip/ZipHandlerOut.cpp +++ /dev/null @@ -1,393 +0,0 @@ -// Zip/HandlerOut.cpp - -#include "StdAfx.h" - -#include "ZipHandler.h" -#include "ZipUpdate.h" - -#include "Common/StringConvert.h" -#include "Common/ComTry.h" -#include "Common/StringToInt.h" - -#include "Windows/PropVariant.h" -#include "Windows/Time.h" - -#include "../../IPassword.h" -#include "../Common/ItemNameUtils.h" -#include "../Common/ParseProperties.h" -#include "../../Crypto/WzAES/WzAES.h" - -using namespace NWindows; -using namespace NCOM; -using namespace NTime; - -namespace NArchive { -namespace NZip { - -static const UInt32 kDeflateNumPassesX1 = 1; -static const UInt32 kDeflateNumPassesX7 = 3; -static const UInt32 kDeflateNumPassesX9 = 10; - -static const UInt32 kNumFastBytesX1 = 32; -static const UInt32 kNumFastBytesX7 = 64; -static const UInt32 kNumFastBytesX9 = 128; - -static const UInt32 kBZip2NumPassesX1 = 1; -static const UInt32 kBZip2NumPassesX7 = 2; -static const UInt32 kBZip2NumPassesX9 = 7; - -static const UInt32 kBZip2DicSizeX1 = 100000; -static const UInt32 kBZip2DicSizeX3 = 500000; -static const UInt32 kBZip2DicSizeX5 = 900000; - -STDMETHODIMP CHandler::GetFileTimeType(UInt32 *timeType) -{ - *timeType = NFileTimeType::kDOS; - return S_OK; -} - -static bool IsAsciiString(const UString &s) -{ - for (int i = 0; i < s.Length(); i++) - { - wchar_t c = s[i]; - if (c < 0x20 || c > 0x7F) - return false; - } - return true; -} - -STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numItems, - IArchiveUpdateCallback *updateCallback) -{ - COM_TRY_BEGIN - CObjectVector updateItems; - for(UInt32 i = 0; i < numItems; i++) - { - CUpdateItem updateItem; - Int32 newData; - Int32 newProperties; - UInt32 indexInArchive; - if (!updateCallback) - return E_FAIL; - RINOK(updateCallback->GetUpdateItemInfo(i, - &newData, // 1 - compress 0 - copy - &newProperties, - &indexInArchive)); - updateItem.NewProperties = IntToBool(newProperties); - updateItem.NewData = IntToBool(newData); - updateItem.IndexInArchive = indexInArchive; - updateItem.IndexInClient = i; - // bool existInArchive = (indexInArchive != UInt32(-1)); - if (IntToBool(newProperties)) - { - FILETIME utcFileTime; - UString name; - bool isDirectoryStatusDefined; - { - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(i, kpidAttributes, &propVariant)); - if (propVariant.vt == VT_EMPTY) - updateItem.Attributes = 0; - else if (propVariant.vt != VT_UI4) - return E_INVALIDARG; - else - updateItem.Attributes = propVariant.ulVal; - } - { - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(i, kpidLastWriteTime, &propVariant)); - if (propVariant.vt != VT_FILETIME) - return E_INVALIDARG; - utcFileTime = propVariant.filetime; - } - { - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(i, kpidPath, &propVariant)); - if (propVariant.vt == VT_EMPTY) - name.Empty(); - else if (propVariant.vt != VT_BSTR) - return E_INVALIDARG; - else - name = propVariant.bstrVal; - } - { - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(i, kpidIsFolder, &propVariant)); - if (propVariant.vt == VT_EMPTY) - isDirectoryStatusDefined = false; - else if (propVariant.vt != VT_BOOL) - return E_INVALIDARG; - else - { - updateItem.IsDirectory = (propVariant.boolVal != VARIANT_FALSE); - isDirectoryStatusDefined = true; - } - } - FILETIME localFileTime; - if(!FileTimeToLocalFileTime(&utcFileTime, &localFileTime)) - return E_INVALIDARG; - if(!FileTimeToDosTime(localFileTime, updateItem.Time)) - { - // return E_INVALIDARG; - } - - if (!isDirectoryStatusDefined) - updateItem.IsDirectory = ((updateItem.Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0); - - name = NItemName::MakeLegalName(name); - bool needSlash = updateItem.IsDirectory; - const wchar_t kSlash = L'/'; - if (!name.IsEmpty()) - { - if (name[name.Length() - 1] == kSlash) - { - if (!updateItem.IsDirectory) - return E_INVALIDARG; - needSlash = false; - } - } - if (needSlash) - name += kSlash; - updateItem.Name = UnicodeStringToMultiByte(name, CP_OEMCP); - if (updateItem.Name.Length() > 0xFFFF) - return E_INVALIDARG; - - updateItem.IndexInClient = i; - /* - if(existInArchive) - { - const CItemEx &itemInfo = m_Items[indexInArchive]; - // updateItem.Commented = itemInfo.IsCommented(); - updateItem.Commented = false; - if(updateItem.Commented) - { - updateItem.CommentRange.Position = itemInfo.GetCommentPosition(); - updateItem.CommentRange.Size = itemInfo.CommentSize; - } - } - else - updateItem.Commented = false; - */ - } - if (IntToBool(newData)) - { - UInt64 size; - { - NCOM::CPropVariant propVariant; - RINOK(updateCallback->GetProperty(i, kpidSize, &propVariant)); - if (propVariant.vt != VT_UI8) - return E_INVALIDARG; - size = propVariant.uhVal.QuadPart; - } - updateItem.Size = size; - } - updateItems.Add(updateItem); - } - - CMyComPtr getTextPassword; - if (!getTextPassword) - { - CMyComPtr udateCallBack2(updateCallback); - udateCallBack2.QueryInterface(IID_ICryptoGetTextPassword2, &getTextPassword); - } - CCompressionMethodMode options; - - if (getTextPassword) - { - CMyComBSTR password; - Int32 passwordIsDefined; - RINOK(getTextPassword->CryptoGetTextPassword2(&passwordIsDefined, &password)); - options.PasswordIsDefined = IntToBool(passwordIsDefined); - if (options.PasswordIsDefined) - { - if (!IsAsciiString((const wchar_t *)password)) - return E_INVALIDARG; - if (m_IsAesMode) - { - if (options.Password.Length() > NCrypto::NWzAES::kPasswordSizeMax) - return E_INVALIDARG; - } - options.Password = UnicodeStringToMultiByte((const wchar_t *)password, CP_OEMCP); - options.IsAesMode = m_IsAesMode; - options.AesKeyMode = m_AesKeyMode; - } - } - else - options.PasswordIsDefined = false; - - int level = m_Level; - if (level < 0) - level = 5; - - Byte mainMethod; - if (m_MainMethod < 0) - mainMethod = (Byte)(((level == 0) ? - NFileHeader::NCompressionMethod::kStored : - NFileHeader::NCompressionMethod::kDeflated)); - else - mainMethod = (Byte)m_MainMethod; - options.MethodSequence.Add(mainMethod); - if (mainMethod != NFileHeader::NCompressionMethod::kStored) - options.MethodSequence.Add(NFileHeader::NCompressionMethod::kStored); - bool isDeflate = (mainMethod == NFileHeader::NCompressionMethod::kDeflated) || - (mainMethod == NFileHeader::NCompressionMethod::kDeflated64); - bool isBZip2 = (mainMethod == NFileHeader::NCompressionMethod::kBZip2); - options.NumPasses = m_NumPasses; - options.DicSize = m_DicSize; - options.NumFastBytes = m_NumFastBytes; - options.NumMatchFinderCycles = m_NumMatchFinderCycles; - options.NumMatchFinderCyclesDefined = m_NumMatchFinderCyclesDefined; - #ifdef COMPRESS_MT - options.NumThreads = _numThreads; - #endif - if (isDeflate) - { - if (options.NumPasses == 0xFFFFFFFF) - options.NumPasses = (level >= 9 ? kDeflateNumPassesX9 : - (level >= 7 ? kDeflateNumPassesX7 : - kDeflateNumPassesX1)); - if (options.NumFastBytes == 0xFFFFFFFF) - options.NumFastBytes = (level >= 9 ? kNumFastBytesX9 : - (level >= 7 ? kNumFastBytesX7 : - kNumFastBytesX1)); - } - if (isBZip2) - { - if (options.NumPasses == 0xFFFFFFFF) - options.NumPasses = (level >= 9 ? kBZip2NumPassesX9 : - (level >= 7 ? kBZip2NumPassesX7 : - kBZip2NumPassesX1)); - if (options.DicSize == 0xFFFFFFFF) - options.DicSize = (level >= 5 ? kBZip2DicSizeX5 : - (level >= 3 ? kBZip2DicSizeX3 : - kBZip2DicSizeX1)); - } - - return Update(m_Items, updateItems, outStream, - m_ArchiveIsOpen ? &m_Archive : NULL, &options, updateCallback); - COM_TRY_END -} - -STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties) -{ - #ifdef COMPRESS_MT - const UInt32 numProcessors = NSystem::GetNumberOfProcessors(); - _numThreads = numProcessors; - #endif - InitMethodProperties(); - for (int i = 0; i < numProperties; i++) - { - UString name = UString(names[i]); - name.MakeUpper(); - if (name.IsEmpty()) - return E_INVALIDARG; - - const PROPVARIANT &prop = values[i]; - - if (name[0] == L'X') - { - UInt32 level = 9; - RINOK(ParsePropValue(name.Mid(1), prop, level)); - m_Level = level; - continue; - } - else if (name == L"M") - { - if (prop.vt == VT_BSTR) - { - UString valueString = prop.bstrVal; - valueString.MakeUpper(); - if (valueString == L"COPY") - m_MainMethod = NFileHeader::NCompressionMethod::kStored; - else if (valueString == L"DEFLATE") - m_MainMethod = NFileHeader::NCompressionMethod::kDeflated; - else if (valueString == L"DEFLATE64") - m_MainMethod = NFileHeader::NCompressionMethod::kDeflated64; - else if (valueString == L"BZIP2") - m_MainMethod = NFileHeader::NCompressionMethod::kBZip2; - else - return E_INVALIDARG; - } - else if (prop.vt == VT_UI4) - { - switch(prop.ulVal) - { - case NFileHeader::NCompressionMethod::kStored: - case NFileHeader::NCompressionMethod::kDeflated: - case NFileHeader::NCompressionMethod::kDeflated64: - case NFileHeader::NCompressionMethod::kBZip2: - m_MainMethod = (Byte)prop.ulVal; - break; - default: - return E_INVALIDARG; - } - } - else - return E_INVALIDARG; - } - else if (name.Left(2) == L"EM") - { - if (prop.vt == VT_BSTR) - { - UString valueString = prop.bstrVal; - valueString.MakeUpper(); - if (valueString.Left(3) == L"AES") - { - valueString = valueString.Mid(3); - if (valueString == L"128") - m_AesKeyMode = 1; - else if (valueString == L"192") - m_AesKeyMode = 2; - else if (valueString == L"256" || valueString.IsEmpty()) - m_AesKeyMode = 3; - else - return E_INVALIDARG; - m_IsAesMode = true; - } - else if (valueString == L"ZIPCRYPTO") - m_IsAesMode = false; - else - return E_INVALIDARG; - } - else - return E_INVALIDARG; - } - else if (name[0] == L'D') - { - UInt32 dicSize = kBZip2DicSizeX5; - RINOK(ParsePropDictionaryValue(name.Mid(1), prop, dicSize)); - m_DicSize = dicSize; - } - else if (name.Left(4) == L"PASS") - { - UInt32 num = kDeflateNumPassesX9; - RINOK(ParsePropValue(name.Mid(4), prop, num)); - m_NumPasses = num; - } - else if (name.Left(2) == L"FB") - { - UInt32 num = kNumFastBytesX9; - RINOK(ParsePropValue(name.Mid(2), prop, num)); - m_NumFastBytes = num; - } - else if (name.Left(2) == L"MC") - { - UInt32 num = 0xFFFFFFFF; - RINOK(ParsePropValue(name.Mid(2), prop, num)); - m_NumMatchFinderCycles = num; - m_NumMatchFinderCyclesDefined = true; - } - else if (name.Left(2) == L"MT") - { - #ifdef COMPRESS_MT - RINOK(ParseMtProp(name.Mid(2), prop, numProcessors, _numThreads)); - #endif - } - else - return E_INVALIDARG; - } - return S_OK; -} - -}} diff --git a/7zip/Archive/Zip/ZipHeader.cpp b/7zip/Archive/Zip/ZipHeader.cpp deleted file mode 100755 index fd8856bb..00000000 --- a/7zip/Archive/Zip/ZipHeader.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// Archive/Zip/Header.h - -#include "StdAfx.h" - -#include "ZipHeader.h" - -namespace NArchive { -namespace NZip { - -namespace NSignature -{ - UInt32 kLocalFileHeader = 0x04034B50 + 1; - UInt32 kDataDescriptor = 0x08074B50 + 1; - UInt32 kCentralFileHeader = 0x02014B50 + 1; - UInt32 kEndOfCentralDir = 0x06054B50 + 1; - UInt32 kZip64EndOfCentralDir = 0x06064B50 + 1; - UInt32 kZip64EndOfCentralDirLocator = 0x07064B50 + 1; - - class CMarkersInitializer - { - public: - CMarkersInitializer() - { - kLocalFileHeader--; - kDataDescriptor--; - kCentralFileHeader--; - kEndOfCentralDir--; - kZip64EndOfCentralDir--; - kZip64EndOfCentralDirLocator--; - } - }; - static CMarkersInitializer g_MarkerInitializer; -} - -}} - diff --git a/7zip/Archive/Zip/ZipHeader.h b/7zip/Archive/Zip/ZipHeader.h deleted file mode 100755 index ac98ea76..00000000 --- a/7zip/Archive/Zip/ZipHeader.h +++ /dev/null @@ -1,248 +0,0 @@ -// Archive/Zip/Header.h - -#ifndef __ARCHIVE_ZIP_HEADER_H -#define __ARCHIVE_ZIP_HEADER_H - -#include "Common/Types.h" - -namespace NArchive { -namespace NZip { - -namespace NSignature -{ - extern UInt32 kLocalFileHeader; - extern UInt32 kDataDescriptor; - extern UInt32 kCentralFileHeader; - extern UInt32 kEndOfCentralDir; - extern UInt32 kZip64EndOfCentralDir; - extern UInt32 kZip64EndOfCentralDirLocator; - - static const UInt32 kMarkerSize = 4; -} - -const UInt32 kEcdSize = 22; -const UInt32 kZip64EcdSize = 44; -const UInt32 kZip64EcdLocatorSize = 20; -/* -struct CEndOfCentralDirectoryRecord -{ - UInt16 ThisDiskNumber; - UInt16 StartCentralDirectoryDiskNumber; - UInt16 NumEntriesInCentaralDirectoryOnThisDisk; - UInt16 NumEntriesInCentaralDirectory; - UInt32 CentralDirectorySize; - UInt32 CentralDirectoryStartOffset; - UInt16 CommentSize; -}; - -struct CEndOfCentralDirectoryRecordFull -{ - UInt32 Signature; - CEndOfCentralDirectoryRecord Header; -}; -*/ - -namespace NFileHeader -{ - /* - struct CVersion - { - Byte Version; - Byte HostOS; - }; - */ - - namespace NCompressionMethod - { - enum EType - { - kStored = 0, - kShrunk = 1, - kReduced1 = 2, - kReduced2 = 3, - kReduced3 = 4, - kReduced4 = 5, - kImploded = 6, - kReservedTokenizing = 7, // reserved for tokenizing - kDeflated = 8, - kDeflated64 = 9, - kPKImploding = 10, - - kBZip2 = 12, - kWzPPMd = 0x62, - kWzAES = 0x63 - }; - const int kNumCompressionMethods = 11; - const Byte kMadeByProgramVersion = 20; - - const Byte kDeflateExtractVersion = 20; - const Byte kStoreExtractVersion = 10; - - const Byte kSupportedVersion = 20; - } - - namespace NExtraID - { - enum - { - kZip64 = 0x01, - kWzAES = 0x9901 - }; - } - - const UInt32 kLocalBlockSize = 26; - /* - struct CLocalBlock - { - CVersion ExtractVersion; - - UInt16 Flags; - UInt16 CompressionMethod; - UInt32 Time; - UInt32 FileCRC; - UInt32 PackSize; - UInt32 UnPackSize; - UInt16 NameSize; - UInt16 ExtraSize; - }; - */ - - const UInt32 kDataDescriptorSize = 16; - /* - struct CDataDescriptor - { - UInt32 Signature; - UInt32 FileCRC; - UInt32 PackSize; - UInt32 UnPackSize; - }; - - struct CLocalBlockFull - { - UInt32 Signature; - CLocalBlock Header; - }; - */ - - const UInt32 kCentralBlockSize = 42; - /* - struct CBlock - { - CVersion MadeByVersion; - CVersion ExtractVersion; - UInt16 Flags; - UInt16 CompressionMethod; - UInt32 Time; - UInt32 FileCRC; - UInt32 PackSize; - UInt32 UnPackSize; - UInt16 NameSize; - UInt16 ExtraSize; - UInt16 CommentSize; - UInt16 DiskNumberStart; - UInt16 InternalAttributes; - UInt32 ExternalAttributes; - UInt32 LocalHeaderOffset; - }; - - struct CBlockFull - { - UInt32 Signature; - CBlock Header; - }; - */ - - namespace NFlags - { - const int kNumUsedBits = 4; - const int kUsedBitsMask = (1 << kNumUsedBits) - 1; - - const int kEncryptedMask = 1 << 0; - const int kDescriptorUsedMask = 1 << 3; - - const int kImplodeDictionarySizeMask = 1 << 1; - const int kImplodeLiteralsOnMask = 1 << 2; - - const int kDeflateTypeBitStart = 1; - const int kNumDeflateTypeBits = 2; - const int kNumDeflateTypes = (1 << kNumDeflateTypeBits); - const int kDeflateTypeMask = (1 << kNumDeflateTypeBits) - 1; - } - - namespace NHostOS - { - enum EEnum - { - kFAT = 0, // filesystem used by MS-DOS, OS/2, Win32 - // pkzip 2.50 (FAT / VFAT / FAT32 file systems) - kAMIGA = 1, - kVMS = 2, // VAX/VMS - kUnix = 3, - kVM_CMS = 4, - kAtari = 5, // what if it's a minix filesystem? [cjh] - kHPFS = 6, // filesystem used by OS/2 (and NT 3.x) - kMac = 7, - kZ_System = 8, - kCPM = 9, - kTOPS20 = 10, // pkzip 2.50 NTFS - kNTFS = 11, // filesystem used by Windows NT - kQDOS = 12, // SMS/QDOS - kAcorn = 13, // Archimedes Acorn RISC OS - kVFAT = 14, // filesystem used by Windows 95, NT - kMVS = 15, - kBeOS = 16, // hybrid POSIX/database filesystem - // BeBOX or PowerMac - kTandem = 17, - kTHEOS = 18 - }; - // const int kNumHostSystems = 19; - } - namespace NUnixAttribute - { - const UInt32 kIFMT = 0170000; /* Unix file type mask */ - - const UInt32 kIFDIR = 0040000; /* Unix directory */ - const UInt32 kIFREG = 0100000; /* Unix regular file */ - const UInt32 kIFSOCK = 0140000; /* Unix socket (BSD, not SysV or Amiga) */ - const UInt32 kIFLNK = 0120000; /* Unix symbolic link (not SysV, Amiga) */ - const UInt32 kIFBLK = 0060000; /* Unix block special (not Amiga) */ - const UInt32 kIFCHR = 0020000; /* Unix character special (not Amiga) */ - const UInt32 kIFIFO = 0010000; /* Unix fifo (BCC, not MSC or Amiga) */ - - const UInt32 kISUID = 04000; /* Unix set user id on execution */ - const UInt32 kISGID = 02000; /* Unix set group id on execution */ - const UInt32 kISVTX = 01000; /* Unix directory permissions control */ - const UInt32 kENFMT = kISGID; /* Unix record locking enforcement flag */ - const UInt32 kIRWXU = 00700; /* Unix read, write, execute: owner */ - const UInt32 kIRUSR = 00400; /* Unix read permission: owner */ - const UInt32 kIWUSR = 00200; /* Unix write permission: owner */ - const UInt32 kIXUSR = 00100; /* Unix execute permission: owner */ - const UInt32 kIRWXG = 00070; /* Unix read, write, execute: group */ - const UInt32 kIRGRP = 00040; /* Unix read permission: group */ - const UInt32 kIWGRP = 00020; /* Unix write permission: group */ - const UInt32 kIXGRP = 00010; /* Unix execute permission: group */ - const UInt32 kIRWXO = 00007; /* Unix read, write, execute: other */ - const UInt32 kIROTH = 00004; /* Unix read permission: other */ - const UInt32 kIWOTH = 00002; /* Unix write permission: other */ - const UInt32 kIXOTH = 00001; /* Unix execute permission: other */ - } - - namespace NAmigaAttribute - { - const UInt32 kIFMT = 06000; /* Amiga file type mask */ - const UInt32 kIFDIR = 04000; /* Amiga directory */ - const UInt32 kIFREG = 02000; /* Amiga regular file */ - const UInt32 kIHIDDEN = 00200; /* to be supported in AmigaDOS 3.x */ - const UInt32 kISCRIPT = 00100; /* executable script (text command file) */ - const UInt32 kIPURE = 00040; /* allow loading into resident memory */ - const UInt32 kIARCHIVE = 00020; /* not modified since bit was last set */ - const UInt32 kIREAD = 00010; /* can be opened for reading */ - const UInt32 kIWRITE = 00004; /* can be opened for writing */ - const UInt32 kIEXECUTE = 00002; /* executable image, a loadable runfile */ - const UInt32 kIDELETE = 00001; /* can be deleted */ - } -} - -}} - -#endif diff --git a/7zip/Archive/Zip/ZipIn.cpp b/7zip/Archive/Zip/ZipIn.cpp deleted file mode 100755 index c9e3a7d1..00000000 --- a/7zip/Archive/Zip/ZipIn.cpp +++ /dev/null @@ -1,797 +0,0 @@ -// Archive/ZipIn.cpp - -#include "StdAfx.h" - -#include "ZipIn.h" -#include "Windows/Defs.h" -#include "Common/StringConvert.h" -#include "Common/DynamicBuffer.h" -#include "../../Common/LimitedStreams.h" -#include "../../Common/StreamUtils.h" - -namespace NArchive { -namespace NZip { - -// static const char kEndOfString = '\0'; - -bool CInArchive::Open(IInStream *inStream, const UInt64 *searchHeaderSizeLimit) -{ - m_Stream = inStream; - if(m_Stream->Seek(0, STREAM_SEEK_CUR, &m_StreamStartPosition) != S_OK) - return false; - m_Position = m_StreamStartPosition; - return FindAndReadMarker(searchHeaderSizeLimit); -} - -void CInArchive::Close() -{ - m_Stream.Release(); -} - -HRESULT CInArchive::Seek(UInt64 offset) -{ - return m_Stream->Seek(offset, STREAM_SEEK_SET, NULL); -} - -////////////////////////////////////// -// Markers - -static inline bool TestMarkerCandidate(const Byte *p, UInt32 &value) -{ - value = p[0] | (((UInt32)p[1]) << 8) | (((UInt32)p[2]) << 16) | (((UInt32)p[3]) << 24); - return (value == NSignature::kLocalFileHeader) || - (value == NSignature::kEndOfCentralDir); -} - -bool CInArchive::FindAndReadMarker(const UInt64 *searchHeaderSizeLimit) -{ - m_ArchiveInfo.Clear(); - m_Position = m_StreamStartPosition; - if(Seek(m_StreamStartPosition) != S_OK) - return false; - - Byte marker[NSignature::kMarkerSize]; - UInt32 processedSize; - ReadBytes(marker, NSignature::kMarkerSize, &processedSize); - if(processedSize != NSignature::kMarkerSize) - return false; - if (TestMarkerCandidate(marker, m_Signature)) - return true; - - CByteDynamicBuffer dynamicBuffer; - static const UInt32 kSearchMarkerBufferSize = 0x10000; - dynamicBuffer.EnsureCapacity(kSearchMarkerBufferSize); - Byte *buffer = dynamicBuffer; - UInt32 numBytesPrev = NSignature::kMarkerSize - 1; - memmove(buffer, marker + 1, numBytesPrev); - UInt64 curTestPos = m_StreamStartPosition + 1; - for (;;) - { - if (searchHeaderSizeLimit != NULL) - if (curTestPos - m_StreamStartPosition > *searchHeaderSizeLimit) - break; - UInt32 numReadBytes = kSearchMarkerBufferSize - numBytesPrev; - ReadBytes(buffer + numBytesPrev, numReadBytes, &processedSize); - UInt32 numBytesInBuffer = numBytesPrev + processedSize; - if (numBytesInBuffer < NSignature::kMarkerSize) - break; - UInt32 numTests = numBytesInBuffer - NSignature::kMarkerSize + 1; - for(UInt32 pos = 0; pos < numTests; pos++, curTestPos++) - { - if (TestMarkerCandidate(buffer + pos, m_Signature)) - { - m_ArchiveInfo.StartPosition = curTestPos; - // m_ArchiveInfo.Base = m_ArchiveInfo.StartPosition; - // m_ArchiveInfo.Base = 0; - m_Position = curTestPos + NSignature::kMarkerSize; - if(Seek(m_Position) != S_OK) - return false; - return true; - } - } - numBytesPrev = numBytesInBuffer - numTests; - memmove(buffer, buffer + numTests, numBytesPrev); - } - return false; -} - -HRESULT CInArchive::ReadBytes(void *data, UInt32 size, UInt32 *processedSize) -{ - UInt32 realProcessedSize; - HRESULT result = ReadStream(m_Stream, data, size, &realProcessedSize); - if(processedSize != NULL) - *processedSize = realProcessedSize; - m_Position += realProcessedSize; - return result; -} - -void CInArchive::IncreaseRealPosition(UInt64 addValue) -{ - if(m_Stream->Seek(addValue, STREAM_SEEK_CUR, &m_Position) != S_OK) - throw CInArchiveException(CInArchiveException::kSeekStreamError); -} - -bool CInArchive::ReadBytesAndTestSize(void *data, UInt32 size) -{ - UInt32 realProcessedSize; - if(ReadBytes(data, size, &realProcessedSize) != S_OK) - throw CInArchiveException(CInArchiveException::kReadStreamError); - return (realProcessedSize == size); -} - -void CInArchive::SafeReadBytes(void *data, UInt32 size) -{ - if(!ReadBytesAndTestSize(data, size)) - throw CInArchiveException(CInArchiveException::kUnexpectedEndOfArchive); -} - -void CInArchive::ReadBuffer(CByteBuffer &buffer, UInt32 size) -{ - buffer.SetCapacity(size); - if (size > 0) - SafeReadBytes(buffer, size); -} - -Byte CInArchive::ReadByte() -{ - Byte b; - SafeReadBytes(&b, 1); - return b; -} - -UInt16 CInArchive::ReadUInt16() -{ - UInt16 value = 0; - for (int i = 0; i < 2; i++) - value |= (((UInt16)ReadByte()) << (8 * i)); - return value; -} - -UInt32 CInArchive::ReadUInt32() -{ - UInt32 value = 0; - for (int i = 0; i < 4; i++) - value |= (((UInt32)ReadByte()) << (8 * i)); - return value; -} - -UInt64 CInArchive::ReadUInt64() -{ - UInt64 value = 0; - for (int i = 0; i < 8; i++) - value |= (((UInt64)ReadByte()) << (8 * i)); - return value; -} - -bool CInArchive::ReadUInt32(UInt32 &value) -{ - value = 0; - for (int i = 0; i < 4; i++) - { - Byte b; - if (!ReadBytesAndTestSize(&b, 1)) - return false; - value |= (UInt32(b) << (8 * i)); - } - return true; -} - - -AString CInArchive::ReadFileName(UInt32 nameSize) -{ - if (nameSize == 0) - return AString(); - SafeReadBytes(m_NameBuffer.GetBuffer(nameSize), nameSize); - m_NameBuffer.ReleaseBuffer(nameSize); - return m_NameBuffer; -} - -void CInArchive::GetArchiveInfo(CInArchiveInfo &archiveInfo) const -{ - archiveInfo = m_ArchiveInfo; -} - -/* -void CInArchive::ThrowIncorrectArchiveException() -{ - throw CInArchiveException(CInArchiveException::kIncorrectArchive); -} -*/ - -static UInt32 GetUInt32(const Byte *data) -{ - return - ((UInt32)(Byte)data[0]) | - (((UInt32)(Byte)data[1]) << 8) | - (((UInt32)(Byte)data[2]) << 16) | - (((UInt32)(Byte)data[3]) << 24); -} - -/* -static UInt16 GetUInt16(const Byte *data) -{ - return - ((UInt16)(Byte)data[0]) | - (((UInt16)(Byte)data[1]) << 8); -} -*/ - -static UInt64 GetUInt64(const Byte *data) -{ - return GetUInt32(data) | ((UInt64)GetUInt32(data + 4) << 32); -} - - - -void CInArchive::ReadExtra(UInt32 extraSize, CExtraBlock &extraBlock, - UInt64 &unpackSize, UInt64 &packSize, UInt64 &localHeaderOffset, UInt32 &diskStartNumber) -{ - extraBlock.Clear(); - UInt32 remain = extraSize; - while(remain >= 4) - { - CExtraSubBlock subBlock; - subBlock.ID = ReadUInt16(); - UInt32 dataSize = ReadUInt16(); - remain -= 4; - if (dataSize > remain) // it's bug - dataSize = remain; - if (subBlock.ID == NFileHeader::NExtraID::kZip64) - { - if (unpackSize == 0xFFFFFFFF) - { - if (dataSize < 8) - break; - unpackSize = ReadUInt64(); - remain -= 8; - dataSize -= 8; - } - if (packSize == 0xFFFFFFFF) - { - if (dataSize < 8) - break; - packSize = ReadUInt64(); - remain -= 8; - dataSize -= 8; - } - if (localHeaderOffset == 0xFFFFFFFF) - { - if (dataSize < 8) - break; - localHeaderOffset = ReadUInt64(); - remain -= 8; - dataSize -= 8; - } - if (diskStartNumber == 0xFFFF) - { - if (dataSize < 4) - break; - diskStartNumber = ReadUInt32(); - remain -= 4; - dataSize -= 4; - } - for (UInt32 i = 0; i < dataSize; i++) - ReadByte(); - } - else - { - ReadBuffer(subBlock.Data, dataSize); - extraBlock.SubBlocks.Add(subBlock); - } - remain -= dataSize; - } - IncreaseRealPosition(remain); -} - -HRESULT CInArchive::ReadLocalItem(CItemEx &item) -{ - item.ExtractVersion.Version = ReadByte(); - item.ExtractVersion.HostOS = ReadByte(); - item.Flags = ReadUInt16(); // & NFileHeader::NFlags::kUsedBitsMask; - item.CompressionMethod = ReadUInt16(); - item.Time = ReadUInt32(); - item.FileCRC = ReadUInt32(); - item.PackSize = ReadUInt32(); - item.UnPackSize = ReadUInt32(); - UInt32 fileNameSize = ReadUInt16(); - item.LocalExtraSize = ReadUInt16(); - item.Name = ReadFileName(fileNameSize); - item.FileHeaderWithNameSize = 4 + NFileHeader::kLocalBlockSize + fileNameSize; - if (item.LocalExtraSize > 0) - { - UInt64 localHeaderOffset = 0; - UInt32 diskStartNumber = 0; - ReadExtra(item.LocalExtraSize, item.LocalExtra, item.UnPackSize, item.PackSize, - localHeaderOffset, diskStartNumber); - } - /* - if (item.IsDirectory()) - item.UnPackSize = 0; // check It - */ - return S_OK; -} - -HRESULT CInArchive::ReadLocalItemAfterCdItem(CItemEx &item) -{ - if (item.FromLocal) - return S_OK; - try - { - RINOK(Seek(m_ArchiveInfo.Base + item.LocalHeaderPosition)); - CItemEx localItem; - if (ReadUInt32() != NSignature::kLocalFileHeader) - return S_FALSE; - RINOK(ReadLocalItem(localItem)); - if (item.Flags != localItem.Flags) - { - if (item.CompressionMethod != NFileHeader::NCompressionMethod::kDeflated || - (item.Flags & 0xFFFC) != (localItem.Flags & 0xFFFC)) - return S_FALSE; - } - - if (item.CompressionMethod != localItem.CompressionMethod || - // item.Time != localItem.Time || - (!localItem.HasDescriptor() && - ( - item.FileCRC != localItem.FileCRC || - item.PackSize != localItem.PackSize || - item.UnPackSize != localItem.UnPackSize - ) - ) || - item.Name.Length() != localItem.Name.Length() - ) - return S_FALSE; - item.FileHeaderWithNameSize = localItem.FileHeaderWithNameSize; - item.LocalExtraSize = localItem.LocalExtraSize; - item.LocalExtra = localItem.LocalExtra; - item.FromLocal = true; - } - catch(...) { return S_FALSE; } - return S_OK; -} - -HRESULT CInArchive::ReadLocalItemDescriptor(CItemEx &item) -{ - if (item.HasDescriptor()) - { - const int kBufferSize = (1 << 12); - Byte buffer[kBufferSize]; - - UInt32 numBytesInBuffer = 0; - UInt32 packedSize = 0; - - bool descriptorWasFound = false; - for (;;) - { - UInt32 processedSize; - RINOK(ReadBytes(buffer + numBytesInBuffer, kBufferSize - numBytesInBuffer, &processedSize)); - numBytesInBuffer += processedSize; - if (numBytesInBuffer < NFileHeader::kDataDescriptorSize) - return S_FALSE; - UInt32 i; - for (i = 0; i <= numBytesInBuffer - NFileHeader::kDataDescriptorSize; i++) - { - // descriptorSignature field is Info-ZIP's extension - // to Zip specification. - UInt32 descriptorSignature = GetUInt32(buffer + i); - - // !!!! It must be fixed for Zip64 archives - UInt32 descriptorPackSize = GetUInt32(buffer + i + 8); - if (descriptorSignature== NSignature::kDataDescriptor && descriptorPackSize == packedSize + i) - { - descriptorWasFound = true; - item.FileCRC = GetUInt32(buffer + i + 4); - item.PackSize = descriptorPackSize; - item.UnPackSize = GetUInt32(buffer + i + 12); - IncreaseRealPosition(Int64(Int32(0 - (numBytesInBuffer - i - NFileHeader::kDataDescriptorSize)))); - break; - } - } - if (descriptorWasFound) - break; - packedSize += i; - int j; - for (j = 0; i < numBytesInBuffer; i++, j++) - buffer[j] = buffer[i]; - numBytesInBuffer = j; - } - } - else - IncreaseRealPosition(item.PackSize); - return S_OK; -} - -HRESULT CInArchive::ReadLocalItemAfterCdItemFull(CItemEx &item) -{ - if (item.FromLocal) - return S_OK; - try - { - RINOK(ReadLocalItemAfterCdItem(item)); - if (item.HasDescriptor()) - { - RINOK(Seek(m_ArchiveInfo.Base + item.GetDataPosition() + item.PackSize)); - if (ReadUInt32() != NSignature::kDataDescriptor) - return S_FALSE; - UInt32 crc = ReadUInt32(); - UInt32 packSize = ReadUInt32(); - UInt32 unpackSize = ReadUInt32(); - if (crc != item.FileCRC || item.PackSize != packSize || item.UnPackSize != unpackSize) - return S_FALSE; - } - } - catch(...) { return S_FALSE; } - return S_OK; -} - -HRESULT CInArchive::ReadCdItem(CItemEx &item) -{ - item.FromCentral = true; - item.MadeByVersion.Version = ReadByte(); - item.MadeByVersion.HostOS = ReadByte(); - item.ExtractVersion.Version = ReadByte(); - item.ExtractVersion.HostOS = ReadByte(); - item.Flags = ReadUInt16(); // & NFileHeader::NFlags::kUsedBitsMask; - item.CompressionMethod = ReadUInt16(); - item.Time = ReadUInt32(); - item.FileCRC = ReadUInt32(); - item.PackSize = ReadUInt32(); - item.UnPackSize = ReadUInt32(); - UInt16 headerNameSize = ReadUInt16(); - UInt16 headerExtraSize = ReadUInt16(); - UInt16 headerCommentSize = ReadUInt16(); - UInt32 headerDiskNumberStart = ReadUInt16(); - item.InternalAttributes = ReadUInt16(); - item.ExternalAttributes = ReadUInt32(); - item.LocalHeaderPosition = ReadUInt32(); - item.Name = ReadFileName(headerNameSize); - - if (headerExtraSize > 0) - { - ReadExtra(headerExtraSize, item.CentralExtra, item.UnPackSize, item.PackSize, - item.LocalHeaderPosition, headerDiskNumberStart); - } - - if (headerDiskNumberStart != 0) - throw CInArchiveException(CInArchiveException::kMultiVolumeArchiveAreNotSupported); - - // May be these strings must be deleted - /* - if (item.IsDirectory()) - item.UnPackSize = 0; - */ - - ReadBuffer(item.Comment, headerCommentSize); - return S_OK; -} - -HRESULT CInArchive::TryEcd64(UInt64 offset, CCdInfo &cdInfo) -{ - RINOK(Seek(offset)); - const UInt32 kEcd64Size = 56; - Byte buf[kEcd64Size]; - if(!ReadBytesAndTestSize(buf, kEcd64Size)) - return S_FALSE; - if (GetUInt32(buf) != NSignature::kZip64EndOfCentralDir) - return S_FALSE; - // cdInfo.NumEntries = GetUInt64(buf + 24); - cdInfo.Size = GetUInt64(buf + 40); - cdInfo.Offset = GetUInt64(buf + 48); - return S_OK; -} - -HRESULT CInArchive::FindCd(CCdInfo &cdInfo) -{ - UInt64 endPosition; - RINOK(m_Stream->Seek(0, STREAM_SEEK_END, &endPosition)); - const UInt32 kBufSizeMax = (1 << 16) + kEcdSize + kZip64EcdLocatorSize; - Byte buf[kBufSizeMax]; - UInt32 bufSize = (endPosition < kBufSizeMax) ? (UInt32)endPosition : kBufSizeMax; - if (bufSize < kEcdSize) - return S_FALSE; - UInt64 startPosition = endPosition - bufSize; - RINOK(m_Stream->Seek(startPosition, STREAM_SEEK_SET, &m_Position)); - if (m_Position != startPosition) - return S_FALSE; - if (!ReadBytesAndTestSize(buf, bufSize)) - return S_FALSE; - for (int i = (int)(bufSize - kEcdSize); i >= 0; i--) - { - if (GetUInt32(buf + i) == NSignature::kEndOfCentralDir) - { - if (i >= kZip64EcdLocatorSize) - { - const Byte *locator = buf + i - kZip64EcdLocatorSize; - if (GetUInt32(locator) == NSignature::kZip64EndOfCentralDirLocator) - { - UInt64 ecd64Offset = GetUInt64(locator + 8); - if (TryEcd64(ecd64Offset, cdInfo) == S_OK) - return S_OK; - if (TryEcd64(m_ArchiveInfo.StartPosition + ecd64Offset, cdInfo) == S_OK) - { - m_ArchiveInfo.Base = m_ArchiveInfo.StartPosition; - return S_OK; - } - } - } - if (GetUInt32(buf + i + 4) == 0) - { - // cdInfo.NumEntries = GetUInt16(buf + i + 10); - cdInfo.Size = GetUInt32(buf + i + 12); - cdInfo.Offset = GetUInt32(buf + i + 16); - return S_OK; - } - } - } - return S_FALSE; -} - -HRESULT CInArchive::TryReadCd(CObjectVector &items, UInt64 cdOffset, UInt64 cdSize) -{ - items.Clear(); - RINOK(m_Stream->Seek(cdOffset, STREAM_SEEK_SET, &m_Position)); - if (m_Position != cdOffset) - return S_FALSE; - while(m_Position - cdOffset < cdSize) - { - if(ReadUInt32() != NSignature::kCentralFileHeader) - return S_FALSE; - CItemEx cdItem; - RINOK(ReadCdItem(cdItem)); - items.Add(cdItem); - } - return (m_Position - cdOffset == cdSize) ? S_OK : S_FALSE; -} - -HRESULT CInArchive::ReadCd(CObjectVector &items, UInt64 &cdOffset, UInt64 &cdSize) -{ - m_ArchiveInfo.Base = 0; - CCdInfo cdInfo; - RINOK(FindCd(cdInfo)); - HRESULT res = S_FALSE; - cdSize = cdInfo.Size; - cdOffset = cdInfo.Offset; - res = TryReadCd(items, m_ArchiveInfo.Base + cdOffset, cdSize); - if (res == S_FALSE && m_ArchiveInfo.Base == 0) - { - res = TryReadCd(items, cdInfo.Offset + m_ArchiveInfo.StartPosition, cdSize); - if (res == S_OK) - m_ArchiveInfo.Base = m_ArchiveInfo.StartPosition; - } - if (!ReadUInt32(m_Signature)) - return S_FALSE; - return res; -} - -HRESULT CInArchive::ReadLocalsAndCd(CObjectVector &items, CProgressVirt *progress, UInt64 &cdOffset) -{ - items.Clear(); - while (m_Signature == NSignature::kLocalFileHeader) - { - // FSeek points to next byte after signature - // NFileHeader::CLocalBlock localHeader; - CItemEx item; - item.LocalHeaderPosition = m_Position - m_StreamStartPosition - 4; // points to signature; - RINOK(ReadLocalItem(item)); - item.FromLocal = true; - ReadLocalItemDescriptor(item); - items.Add(item); - if (progress != 0) - { - UInt64 numItems = items.Size(); - RINOK(progress->SetCompleted(&numItems)); - } - if (!ReadUInt32(m_Signature)) - break; - } - cdOffset = m_Position - 4; - for(int i = 0; i < items.Size(); i++) - { - if (progress != 0) - { - UInt64 numItems = items.Size(); - RINOK(progress->SetCompleted(&numItems)); - } - if(m_Signature != NSignature::kCentralFileHeader) - return S_FALSE; - - CItemEx cdItem; - RINOK(ReadCdItem(cdItem)); - - if (i == 0) - { - if (cdItem.LocalHeaderPosition == 0) - m_ArchiveInfo.Base = m_ArchiveInfo.StartPosition; - } - - int index; - int left = 0, right = items.Size(); - for (;;) - { - if (left >= right) - return S_FALSE; - index = (left + right) / 2; - UInt64 position = items[index].LocalHeaderPosition - m_ArchiveInfo.Base; - if (cdItem.LocalHeaderPosition == position) - break; - if (cdItem.LocalHeaderPosition < position) - right = index; - else - left = index + 1; - } - CItemEx &item = items[index]; - item.LocalHeaderPosition = cdItem.LocalHeaderPosition; - item.MadeByVersion = cdItem.MadeByVersion; - item.CentralExtra = cdItem.CentralExtra; - - if ( - // item.ExtractVersion != cdItem.ExtractVersion || - item.Flags != cdItem.Flags || - item.CompressionMethod != cdItem.CompressionMethod || - // item.Time != cdItem.Time || - item.FileCRC != cdItem.FileCRC) - return S_FALSE; - - if (item.Name.Length() != cdItem.Name.Length() || - item.PackSize != cdItem.PackSize || - item.UnPackSize != cdItem.UnPackSize - ) - return S_FALSE; - item.Name = cdItem.Name; - item.InternalAttributes = cdItem.InternalAttributes; - item.ExternalAttributes = cdItem.ExternalAttributes; - item.Comment = cdItem.Comment; - item.FromCentral = cdItem.FromCentral; - if (!ReadUInt32(m_Signature)) - return S_FALSE; - } - return S_OK; -} - -HRESULT CInArchive::ReadHeaders(CObjectVector &items, CProgressVirt *progress) -{ - // m_Signature must be kLocalFileHeaderSignature or - // kEndOfCentralDirSignature - // m_Position points to next byte after signature - - items.Clear(); - if (progress != 0) - { - UInt64 numItems = items.Size(); - RINOK(progress->SetCompleted(&numItems)); - } - - UInt64 cdSize, cdStartOffset; - HRESULT res = ReadCd(items, cdStartOffset, cdSize); - if (res != S_FALSE && res != S_OK) - return res; - - /* - if (res != S_OK) - return res; - res = S_FALSE; - */ - - if (res == S_FALSE) - { - m_ArchiveInfo.Base = 0; - RINOK(m_Stream->Seek(m_ArchiveInfo.StartPosition, STREAM_SEEK_SET, &m_Position)); - if (m_Position != m_ArchiveInfo.StartPosition) - return S_FALSE; - if (!ReadUInt32(m_Signature)) - return S_FALSE; - RINOK(ReadLocalsAndCd(items, progress, cdStartOffset)); - cdSize = (m_Position - 4) - cdStartOffset; - cdStartOffset -= m_ArchiveInfo.Base; - } - - UInt32 thisDiskNumber = 0; - UInt32 startCDDiskNumber = 0; - UInt64 numEntriesInCDOnThisDisk = 0; - UInt64 numEntriesInCD = 0; - UInt64 cdSizeFromRecord = 0; - UInt64 cdStartOffsetFromRecord = 0; - bool isZip64 = false; - UInt64 zip64EcdStartOffset = m_Position - 4 - m_ArchiveInfo.Base; - if(m_Signature == NSignature::kZip64EndOfCentralDir) - { - isZip64 = true; - UInt64 recordSize = ReadUInt64(); - /* UInt16 versionMade = */ ReadUInt16(); - /* UInt16 versionNeedExtract = */ ReadUInt16(); - thisDiskNumber = ReadUInt32(); - startCDDiskNumber = ReadUInt32(); - numEntriesInCDOnThisDisk = ReadUInt64(); - numEntriesInCD = ReadUInt64(); - cdSizeFromRecord = ReadUInt64(); - cdStartOffsetFromRecord = ReadUInt64(); - IncreaseRealPosition(recordSize - kZip64EcdSize); - if (!ReadUInt32(m_Signature)) - return S_FALSE; - if (thisDiskNumber != 0 || startCDDiskNumber != 0) - throw CInArchiveException(CInArchiveException::kMultiVolumeArchiveAreNotSupported); - if (numEntriesInCDOnThisDisk != items.Size() || - numEntriesInCD != items.Size() || - cdSizeFromRecord != cdSize || - (cdStartOffsetFromRecord != cdStartOffset && - (!items.IsEmpty()))) - return S_FALSE; - } - if(m_Signature == NSignature::kZip64EndOfCentralDirLocator) - { - /* UInt32 startEndCDDiskNumber = */ ReadUInt32(); - UInt64 endCDStartOffset = ReadUInt64(); - /* UInt32 numberOfDisks = */ ReadUInt32(); - if (zip64EcdStartOffset != endCDStartOffset) - return S_FALSE; - if (!ReadUInt32(m_Signature)) - return S_FALSE; - } - if(m_Signature != NSignature::kEndOfCentralDir) - return S_FALSE; - - UInt16 thisDiskNumber16 = ReadUInt16(); - if (!isZip64 || thisDiskNumber16) - thisDiskNumber = thisDiskNumber16; - - UInt16 startCDDiskNumber16 = ReadUInt16(); - if (!isZip64 || startCDDiskNumber16 != 0xFFFF) - startCDDiskNumber = startCDDiskNumber16; - - UInt16 numEntriesInCDOnThisDisk16 = ReadUInt16(); - if (!isZip64 || numEntriesInCDOnThisDisk16 != 0xFFFF) - numEntriesInCDOnThisDisk = numEntriesInCDOnThisDisk16; - - UInt16 numEntriesInCD16 = ReadUInt16(); - if (!isZip64 || numEntriesInCD16 != 0xFFFF) - numEntriesInCD = numEntriesInCD16; - - UInt32 cdSizeFromRecord32 = ReadUInt32(); - if (!isZip64 || cdSizeFromRecord32 != 0xFFFFFFFF) - cdSizeFromRecord = cdSizeFromRecord32; - - UInt32 cdStartOffsetFromRecord32 = ReadUInt32(); - if (!isZip64 || cdStartOffsetFromRecord32 != 0xFFFFFFFF) - cdStartOffsetFromRecord = cdStartOffsetFromRecord32; - - UInt16 commentSize = ReadUInt16(); - ReadBuffer(m_ArchiveInfo.Comment, commentSize); - - if (thisDiskNumber != 0 || startCDDiskNumber != 0) - throw CInArchiveException(CInArchiveException::kMultiVolumeArchiveAreNotSupported); - if ((UInt16)numEntriesInCDOnThisDisk != ((UInt16)items.Size()) || - (UInt16)numEntriesInCD != ((UInt16)items.Size()) || - (UInt32)cdSizeFromRecord != (UInt32)cdSize || - ((UInt32)(cdStartOffsetFromRecord) != (UInt32)cdStartOffset && - (!items.IsEmpty()))) - return S_FALSE; - - return S_OK; -} - -ISequentialInStream* CInArchive::CreateLimitedStream(UInt64 position, UInt64 size) -{ - CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream; - CMyComPtr inStream(streamSpec); - SeekInArchive(m_ArchiveInfo.Base + position); - streamSpec->SetStream(m_Stream); - streamSpec->Init(size); - return inStream.Detach(); -} - -IInStream* CInArchive::CreateStream() -{ - CMyComPtr inStream = m_Stream; - return inStream.Detach(); -} - -bool CInArchive::SeekInArchive(UInt64 position) -{ - UInt64 newPosition; - if(m_Stream->Seek(position, STREAM_SEEK_SET, &newPosition) != S_OK) - return false; - return (newPosition == position); -} - -}} - diff --git a/7zip/Archive/Zip/ZipIn.h b/7zip/Archive/Zip/ZipIn.h deleted file mode 100755 index 80de2272..00000000 --- a/7zip/Archive/Zip/ZipIn.h +++ /dev/null @@ -1,111 +0,0 @@ -// Archive/ZipIn.h - -#ifndef __ZIP_IN_H -#define __ZIP_IN_H - -#include "Common/MyCom.h" -#include "../../IStream.h" - -#include "ZipHeader.h" -#include "ZipItemEx.h" - -namespace NArchive { -namespace NZip { - -class CInArchiveException -{ -public: - enum ECauseType - { - kUnexpectedEndOfArchive = 0, - kArchiceHeaderCRCError, - kFileHeaderCRCError, - kIncorrectArchive, - kDataDescroptorsAreNotSupported, - kMultiVolumeArchiveAreNotSupported, - kReadStreamError, - kSeekStreamError - } - Cause; - CInArchiveException(ECauseType cause): Cause(cause) {} -}; - -class CInArchiveInfo -{ -public: - UInt64 Base; - UInt64 StartPosition; - CByteBuffer Comment; - CInArchiveInfo(): Base(0), StartPosition(0) {} - void Clear() - { - Base = 0; - StartPosition = 0; - Comment.SetCapacity(0); - } -}; - -class CProgressVirt -{ -public: - STDMETHOD(SetCompleted)(const UInt64 *numFiles) PURE; -}; - -struct CCdInfo -{ - // UInt64 NumEntries; - UInt64 Size; - UInt64 Offset; -}; - -class CInArchive -{ - CMyComPtr m_Stream; - UInt32 m_Signature; - UInt64 m_StreamStartPosition; - UInt64 m_Position; - CInArchiveInfo m_ArchiveInfo; - AString m_NameBuffer; - - HRESULT Seek(UInt64 offset); - - bool FindAndReadMarker(const UInt64 *searchHeaderSizeLimit); - bool ReadUInt32(UInt32 &signature); - AString ReadFileName(UInt32 nameSize); - - HRESULT ReadBytes(void *data, UInt32 size, UInt32 *processedSize); - bool ReadBytesAndTestSize(void *data, UInt32 size); - void SafeReadBytes(void *data, UInt32 size); - void ReadBuffer(CByteBuffer &buffer, UInt32 size); - Byte ReadByte(); - UInt16 ReadUInt16(); - UInt32 ReadUInt32(); - UInt64 ReadUInt64(); - - void IncreaseRealPosition(UInt64 addValue); - - void ReadExtra(UInt32 extraSize, CExtraBlock &extraBlock, - UInt64 &unpackSize, UInt64 &packSize, UInt64 &localHeaderOffset, UInt32 &diskStartNumber); - HRESULT ReadLocalItem(CItemEx &item); - HRESULT ReadLocalItemDescriptor(CItemEx &item); - HRESULT ReadCdItem(CItemEx &item); - HRESULT TryEcd64(UInt64 offset, CCdInfo &cdInfo); - HRESULT FindCd(CCdInfo &cdInfo); - HRESULT TryReadCd(CObjectVector &items, UInt64 cdOffset, UInt64 cdSize); - HRESULT ReadCd(CObjectVector &items, UInt64 &cdOffset, UInt64 &cdSize); - HRESULT ReadLocalsAndCd(CObjectVector &items, CProgressVirt *progress, UInt64 &cdOffset); -public: - HRESULT ReadHeaders(CObjectVector &items, CProgressVirt *progress); - HRESULT ReadLocalItemAfterCdItem(CItemEx &item); - HRESULT ReadLocalItemAfterCdItemFull(CItemEx &item); - bool Open(IInStream *inStream, const UInt64 *searchHeaderSizeLimit); - void Close(); - void GetArchiveInfo(CInArchiveInfo &archiveInfo) const; - bool SeekInArchive(UInt64 position); - ISequentialInStream *CreateLimitedStream(UInt64 position, UInt64 size); - IInStream* CreateStream(); -}; - -}} - -#endif diff --git a/7zip/Archive/Zip/ZipItem.cpp b/7zip/Archive/Zip/ZipItem.cpp deleted file mode 100755 index 1934c357..00000000 --- a/7zip/Archive/Zip/ZipItem.cpp +++ /dev/null @@ -1,137 +0,0 @@ -// Archive/ZipItem.cpp - -#include "StdAfx.h" - -#include "ZipHeader.h" -#include "ZipItem.h" -#include "../Common/ItemNameUtils.h" - -namespace NArchive { -namespace NZip { - -bool operator==(const CVersion &v1, const CVersion &v2) -{ - return (v1.Version == v2.Version) && (v1.HostOS == v2.HostOS); -} - -bool operator!=(const CVersion &v1, const CVersion &v2) -{ - return !(v1 == v2); -} - -bool CLocalItem::IsEncrypted() const -{ return (Flags & NFileHeader::NFlags::kEncryptedMask) != 0; } -bool CLocalItem::HasDescriptor() const - { return (Flags & NFileHeader::NFlags::kDescriptorUsedMask) != 0; } - -bool CLocalItem::IsImplodeBigDictionary() const -{ -if (CompressionMethod != NFileHeader::NCompressionMethod::kImploded) - throw 12312212; - return (Flags & NFileHeader::NFlags::kImplodeDictionarySizeMask) != 0; -} - -bool CLocalItem::IsImplodeLiteralsOn() const -{ - if (CompressionMethod != NFileHeader::NCompressionMethod::kImploded) - throw 12312213; - return (Flags & NFileHeader::NFlags::kImplodeLiteralsOnMask) != 0; -} - -static const char *kUnknownAttributes = "Unknown file attributes"; - -bool CLocalItem::IsDirectory() const -{ - return NItemName::HasTailSlash(Name, GetCodePage()); -} - -bool CItem::IsDirectory() const -{ - if (NItemName::HasTailSlash(Name, GetCodePage())) - return true; - if (!FromCentral) - return false; - WORD highAttributes = WORD((ExternalAttributes >> 16 ) & 0xFFFF); - switch(MadeByVersion.HostOS) - { - case NFileHeader::NHostOS::kAMIGA: - switch (highAttributes & NFileHeader::NAmigaAttribute::kIFMT) - { - case NFileHeader::NAmigaAttribute::kIFDIR: - return true; - case NFileHeader::NAmigaAttribute::kIFREG: - return false; - default: - return false; // change it throw kUnknownAttributes; - } - case NFileHeader::NHostOS::kFAT: - case NFileHeader::NHostOS::kNTFS: - case NFileHeader::NHostOS::kHPFS: - case NFileHeader::NHostOS::kVFAT: - return ((ExternalAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0); - case NFileHeader::NHostOS::kAtari: - case NFileHeader::NHostOS::kMac: - case NFileHeader::NHostOS::kVMS: - case NFileHeader::NHostOS::kVM_CMS: - case NFileHeader::NHostOS::kAcorn: - case NFileHeader::NHostOS::kMVS: - return false; // change it throw kUnknownAttributes; - default: - /* - switch (highAttributes & NFileHeader::NUnixAttribute::kIFMT) - { - case NFileHeader::NUnixAttribute::kIFDIR: - return true; - default: - return false; - } - */ - return false; - } -} - -UInt32 CLocalItem::GetWinAttributes() const -{ - DWORD winAttributes = 0; - if (IsDirectory()) - winAttributes |= FILE_ATTRIBUTE_DIRECTORY; - return winAttributes; -} - -UInt32 CItem::GetWinAttributes() const -{ - DWORD winAttributes = 0; - switch(MadeByVersion.HostOS) - { - case NFileHeader::NHostOS::kFAT: - case NFileHeader::NHostOS::kNTFS: - if (FromCentral) - winAttributes = ExternalAttributes; - break; - default: - winAttributes = 0; // must be converted from unix value; - } - if (IsDirectory()) // test it; - winAttributes |= FILE_ATTRIBUTE_DIRECTORY; - return winAttributes; -} - -void CLocalItem::SetFlagBits(int startBitNumber, int numBits, int value) -{ - UInt16 mask = (UInt16)(((1 << numBits) - 1) << startBitNumber); - Flags &= ~mask; - Flags |= value << startBitNumber; -} - -void CLocalItem::SetBitMask(int bitMask, bool enable) -{ - if(enable) - Flags |= bitMask; - else - Flags &= ~bitMask; -} - -void CLocalItem::SetEncrypted(bool encrypted) - { SetBitMask(NFileHeader::NFlags::kEncryptedMask, encrypted); } - -}} diff --git a/7zip/Archive/Zip/ZipItem.h b/7zip/Archive/Zip/ZipItem.h deleted file mode 100755 index 765bfd85..00000000 --- a/7zip/Archive/Zip/ZipItem.h +++ /dev/null @@ -1,191 +0,0 @@ -// Archive/ZipItem.h - -#ifndef __ARCHIVE_ZIP_ITEM_H -#define __ARCHIVE_ZIP_ITEM_H - -#include "Common/Types.h" -#include "Common/String.h" -#include "Common/Buffer.h" - -#include "ZipHeader.h" - -namespace NArchive { -namespace NZip { - -struct CVersion -{ - Byte Version; - Byte HostOS; -}; - -bool operator==(const CVersion &v1, const CVersion &v2); -bool operator!=(const CVersion &v1, const CVersion &v2); - -struct CExtraSubBlock -{ - UInt16 ID; - CByteBuffer Data; -}; - -struct CWzAesExtraField -{ - UInt16 VendorVersion; // 0x0001 - AE-1, 0x0002 - AE-2, - // UInt16 VendorId; // "AE" - Byte Strength; // 1 - 128-bit , 2 - 192-bit , 3 - 256-bit - UInt16 Method; - - CWzAesExtraField(): VendorVersion(2), Strength(3), Method(0) {} - - bool NeedCrc() const { return (VendorVersion == 1); } - - bool ParseFromSubBlock(const CExtraSubBlock &sb) - { - if (sb.ID != NFileHeader::NExtraID::kWzAES) - return false; - if (sb.Data.GetCapacity() < 7) - return false; - const Byte *p = (const Byte *)sb.Data; - VendorVersion = (((UInt16)p[1]) << 8) | p[0]; - if (p[2] != 'A' || p[3] != 'E') - return false; - Strength = p[4]; - Method = (((UInt16)p[6]) << 16) | p[5]; - return true; - } - void SetSubBlock(CExtraSubBlock &sb) const - { - sb.Data.SetCapacity(7); - sb.ID = NFileHeader::NExtraID::kWzAES; - Byte *p = (Byte *)sb.Data; - p[0] = (Byte)VendorVersion; - p[1] = (Byte)(VendorVersion >> 8); - p[2] = 'A'; - p[3] = 'E'; - p[4] = Strength; - p[5] = (Byte)Method; - p[6] = (Byte)(Method >> 8); - } -}; - -struct CExtraBlock -{ - CObjectVector SubBlocks; - void Clear() { SubBlocks.Clear(); } - size_t GetSize() const - { - size_t res = 0; - for (int i = 0; i < SubBlocks.Size(); i++) - res += SubBlocks[i].Data.GetCapacity() + 2 + 2; - return res; - } - bool GetWzAesField(CWzAesExtraField &aesField) const - { - // size_t res = 0; - for (int i = 0; i < SubBlocks.Size(); i++) - if (aesField.ParseFromSubBlock(SubBlocks[i])) - return true; - return false; - } - - bool HasWzAesField() const - { - CWzAesExtraField aesField; - return GetWzAesField(aesField); - } - - void RemoveUnknownSubBlocks() - { - for (int i = SubBlocks.Size() - 1; i >= 0;) - { - const CExtraSubBlock &subBlock = SubBlocks[i]; - if (subBlock.ID != NFileHeader::NExtraID::kWzAES) - SubBlocks.Delete(i); - else - i--; - } - } -}; - - -class CLocalItem -{ -public: - CVersion ExtractVersion; - UInt16 Flags; - UInt16 CompressionMethod; - UInt32 Time; - UInt32 FileCRC; - UInt64 PackSize; - UInt64 UnPackSize; - - AString Name; - - CExtraBlock LocalExtra; - - bool IsEncrypted() const; - - bool IsImplodeBigDictionary() const; - bool IsImplodeLiteralsOn() const; - - bool IsDirectory() const; - bool IgnoreItem() const { return false; } - UInt32 GetWinAttributes() const; - - bool HasDescriptor() const; - -private: - void SetFlagBits(int startBitNumber, int numBits, int value); - void SetBitMask(int bitMask, bool enable); -public: - void ClearFlags() { Flags = 0; } - void SetEncrypted(bool encrypted); - - WORD GetCodePage() const - { - return CP_OEMCP; - } -}; - -class CItem: public CLocalItem -{ -public: - CVersion MadeByVersion; - UInt16 InternalAttributes; - UInt32 ExternalAttributes; - - UInt64 LocalHeaderPosition; - - CExtraBlock CentralExtra; - CByteBuffer Comment; - - bool FromLocal; - bool FromCentral; - - bool IsDirectory() const; - UInt32 GetWinAttributes() const; - - bool IsThereCrc() const - { - if (CompressionMethod == NFileHeader::NCompressionMethod::kWzAES) - { - CWzAesExtraField aesField; - if (CentralExtra.GetWzAesField(aesField)) - return aesField.NeedCrc(); - } - return true; - } - - WORD GetCodePage() const - { - return (WORD)((MadeByVersion.HostOS == NFileHeader::NHostOS::kFAT - || MadeByVersion.HostOS == NFileHeader::NHostOS::kNTFS - ) ? CP_OEMCP : CP_ACP); - } - CItem() : FromLocal(false), FromCentral(false) {} -}; - -}} - -#endif - - diff --git a/7zip/Archive/Zip/ZipItemEx.h b/7zip/Archive/Zip/ZipItemEx.h deleted file mode 100755 index 3cacc0e7..00000000 --- a/7zip/Archive/Zip/ZipItemEx.h +++ /dev/null @@ -1,29 +0,0 @@ -// Archive/ZipItemEx.h - -#ifndef __ARCHIVE_ZIP_ITEMEX_H -#define __ARCHIVE_ZIP_ITEMEX_H - -#include "ZipHeader.h" -#include "ZipItem.h" - -namespace NArchive { -namespace NZip { - -class CItemEx: public CItem -{ -public: - UInt32 FileHeaderWithNameSize; - UInt16 LocalExtraSize; - - UInt64 GetLocalFullSize() const - { return FileHeaderWithNameSize + LocalExtraSize + PackSize + - (HasDescriptor() ? NFileHeader::kDataDescriptorSize : 0); }; - UInt64 GetLocalExtraPosition() const - { return LocalHeaderPosition + FileHeaderWithNameSize; }; - UInt64 GetDataPosition() const - { return GetLocalExtraPosition() + LocalExtraSize; }; -}; - -}} - -#endif diff --git a/7zip/Archive/Zip/ZipOut.cpp b/7zip/Archive/Zip/ZipOut.cpp deleted file mode 100755 index 7575d320..00000000 --- a/7zip/Archive/Zip/ZipOut.cpp +++ /dev/null @@ -1,259 +0,0 @@ -// ZipOut.cpp - -#include "StdAfx.h" - -#include "ZipOut.h" -#include "Common/StringConvert.h" -#include "Common/CRC.h" -#include "../../Common/OffsetStream.h" -#include "../../Common/StreamUtils.h" - -namespace NArchive { -namespace NZip { - -void COutArchive::Create(IOutStream *outStream) -{ - m_Stream = outStream; - m_BasePosition = 0; -} - -void COutArchive::MoveBasePosition(UInt64 distanceToMove) -{ - m_BasePosition += distanceToMove; // test overflow -} - -void COutArchive::PrepareWriteCompressedDataZip64(UInt16 fileNameLength, bool isZip64, bool aesEncryption) -{ - m_IsZip64 = isZip64; - m_ExtraSize = isZip64 ? (4 + 8 + 8) : 0; - if (aesEncryption) - m_ExtraSize += 4 + 7; - m_LocalFileHeaderSize = 4 + NFileHeader::kLocalBlockSize + fileNameLength + m_ExtraSize; -} - -void COutArchive::PrepareWriteCompressedData(UInt16 fileNameLength, UInt64 unPackSize, bool aesEncryption) -{ - // We test it to 0xF8000000 to support case when compressed size - // can be larger than uncompressed size. - PrepareWriteCompressedDataZip64(fileNameLength, unPackSize >= 0xF8000000, aesEncryption); -} - -void COutArchive::PrepareWriteCompressedData2(UInt16 fileNameLength, UInt64 unPackSize, UInt64 packSize, bool aesEncryption) -{ - bool isUnPack64 = unPackSize >= 0xFFFFFFFF; - bool isPack64 = packSize >= 0xFFFFFFFF; - bool isZip64 = isPack64 || isUnPack64; - PrepareWriteCompressedDataZip64(fileNameLength, isZip64, aesEncryption); -} - -void COutArchive::WriteBytes(const void *buffer, UInt32 size) -{ - UInt32 processedSize; - if(WriteStream(m_Stream, buffer, size, &processedSize) != S_OK) - throw 0; - if(processedSize != size) - throw 0; - m_BasePosition += size; -} - -void COutArchive::WriteByte(Byte b) -{ - WriteBytes(&b, 1); -} - -void COutArchive::WriteUInt16(UInt16 value) -{ - for (int i = 0; i < 2; i++) - { - WriteByte((Byte)value); - value >>= 8; - } -} - -void COutArchive::WriteUInt32(UInt32 value) -{ - for (int i = 0; i < 4; i++) - { - WriteByte((Byte)value); - value >>= 8; - } -} - -void COutArchive::WriteUInt64(UInt64 value) -{ - for (int i = 0; i < 8; i++) - { - WriteByte((Byte)value); - value >>= 8; - } -} - -void COutArchive::WriteExtra(const CExtraBlock &extra) -{ - if (extra.SubBlocks.Size() != 0) - { - for (int i = 0; i < extra.SubBlocks.Size(); i++) - { - const CExtraSubBlock &subBlock = extra.SubBlocks[i]; - WriteUInt16(subBlock.ID); - WriteUInt16((UInt16)subBlock.Data.GetCapacity()); - WriteBytes(subBlock.Data, (UInt32)subBlock.Data.GetCapacity()); - } - } -} - -HRESULT COutArchive::WriteLocalHeader(const CLocalItem &item) -{ - m_Stream->Seek(m_BasePosition, STREAM_SEEK_SET, NULL); - - bool isZip64 = m_IsZip64 || item.PackSize >= 0xFFFFFFFF || item.UnPackSize >= 0xFFFFFFFF; - - WriteUInt32(NSignature::kLocalFileHeader); - WriteByte(item.ExtractVersion.Version); - WriteByte(item.ExtractVersion.HostOS); - WriteUInt16(item.Flags); - WriteUInt16(item.CompressionMethod); - WriteUInt32(item.Time); - WriteUInt32(item.FileCRC); - WriteUInt32(isZip64 ? 0xFFFFFFFF: (UInt32)item.PackSize); - WriteUInt32(isZip64 ? 0xFFFFFFFF: (UInt32)item.UnPackSize); - WriteUInt16((UInt16)item.Name.Length()); - { - UInt16 localExtraSize = (UInt16)((isZip64 ? (4 + 16): 0) + item.LocalExtra.GetSize()); - if (localExtraSize > m_ExtraSize) - return E_FAIL; - } - WriteUInt16((UInt16)m_ExtraSize); // test it; - WriteBytes((const char *)item.Name, item.Name.Length()); - - UInt32 extraPos = 0; - if (isZip64) - { - extraPos += 4 + 16; - WriteUInt16(NFileHeader::NExtraID::kZip64); - WriteUInt16(16); - WriteUInt64(item.UnPackSize); - WriteUInt64(item.PackSize); - } - - WriteExtra(item.LocalExtra); - extraPos += (UInt32)item.LocalExtra.GetSize(); - for (; extraPos < m_ExtraSize; extraPos++) - WriteByte(0); - - MoveBasePosition(item.PackSize); - return m_Stream->Seek(m_BasePosition, STREAM_SEEK_SET, NULL); -} - -void COutArchive::WriteCentralHeader(const CItem &item) -{ - m_Stream->Seek(m_BasePosition, STREAM_SEEK_SET, NULL); - - bool isUnPack64 = item.UnPackSize >= 0xFFFFFFFF; - bool isPack64 = item.PackSize >= 0xFFFFFFFF; - bool isPosition64 = item.LocalHeaderPosition >= 0xFFFFFFFF; - bool isZip64 = isPack64 || isUnPack64 || isPosition64; - - WriteUInt32(NSignature::kCentralFileHeader); - WriteByte(item.MadeByVersion.Version); - WriteByte(item.MadeByVersion.HostOS); - WriteByte(item.ExtractVersion.Version); - WriteByte(item.ExtractVersion.HostOS); - WriteUInt16(item.Flags); - WriteUInt16(item.CompressionMethod); - WriteUInt32(item.Time); - WriteUInt32(item.FileCRC); - WriteUInt32(isPack64 ? 0xFFFFFFFF: (UInt32)item.PackSize); - WriteUInt32(isUnPack64 ? 0xFFFFFFFF: (UInt32)item.UnPackSize); - WriteUInt16((UInt16)item.Name.Length()); - UInt16 zip64ExtraSize = (UInt16)((isUnPack64 ? 8: 0) + (isPack64 ? 8: 0) + (isPosition64 ? 8: 0)); - UInt16 centralExtraSize = (UInt16)(isZip64 ? (4 + zip64ExtraSize) : 0); - centralExtraSize = (UInt16)(centralExtraSize + item.CentralExtra.GetSize()); - WriteUInt16(centralExtraSize); // test it; - WriteUInt16((UInt16)item.Comment.GetCapacity()); - WriteUInt16(0); // DiskNumberStart; - WriteUInt16(item.InternalAttributes); - WriteUInt32(item.ExternalAttributes); - WriteUInt32(isPosition64 ? 0xFFFFFFFF: (UInt32)item.LocalHeaderPosition); - WriteBytes((const char *)item.Name, item.Name.Length()); - if (isZip64) - { - WriteUInt16(NFileHeader::NExtraID::kZip64); - WriteUInt16(zip64ExtraSize); - if(isUnPack64) - WriteUInt64(item.UnPackSize); - if(isPack64) - WriteUInt64(item.PackSize); - if(isPosition64) - WriteUInt64(item.LocalHeaderPosition); - } - WriteExtra(item.CentralExtra); - if (item.Comment.GetCapacity() > 0) - WriteBytes(item.Comment, (UInt32)item.Comment.GetCapacity()); -} - -void COutArchive::WriteCentralDir(const CObjectVector &items, const CByteBuffer &comment) -{ - m_Stream->Seek(m_BasePosition, STREAM_SEEK_SET, NULL); - - UInt64 cdOffset = GetCurrentPosition(); - for(int i = 0; i < items.Size(); i++) - WriteCentralHeader(items[i]); - UInt64 cd64EndOffset = GetCurrentPosition(); - UInt64 cdSize = cd64EndOffset - cdOffset; - bool cdOffset64 = cdOffset >= 0xFFFFFFFF; - bool cdSize64 = cdSize >= 0xFFFFFFFF; - bool items64 = items.Size() >= 0xFFFF; - bool isZip64 = (cdOffset64 || cdSize64 || items64); - - if (isZip64) - { - WriteUInt32(NSignature::kZip64EndOfCentralDir); - WriteUInt64(kZip64EcdSize); // ThisDiskNumber = 0; - WriteUInt16(45); // version - WriteUInt16(45); // version - WriteUInt32(0); // ThisDiskNumber = 0; - WriteUInt32(0); // StartCentralDirectoryDiskNumber;; - WriteUInt64((UInt64)items.Size()); - WriteUInt64((UInt64)items.Size()); - WriteUInt64((UInt64)cdSize); - WriteUInt64((UInt64)cdOffset); - - WriteUInt32(NSignature::kZip64EndOfCentralDirLocator); - WriteUInt32(0); // number of the disk with the start of the zip64 end of central directory - WriteUInt64(cd64EndOffset); - WriteUInt32(1); // total number of disks - } - WriteUInt32(NSignature::kEndOfCentralDir); - WriteUInt16(0); // ThisDiskNumber = 0; - WriteUInt16(0); // StartCentralDirectoryDiskNumber; - WriteUInt16((UInt16)(items64 ? 0xFFFF: items.Size())); - WriteUInt16((UInt16)(items64 ? 0xFFFF: items.Size())); - WriteUInt32(cdSize64 ? 0xFFFFFFFF: (UInt32)cdSize); - WriteUInt32(cdOffset64 ? 0xFFFFFFFF: (UInt32)cdOffset); - UInt16 commentSize = (UInt16)comment.GetCapacity(); - WriteUInt16(commentSize); - if (commentSize > 0) - WriteBytes((const Byte *)comment, commentSize); -} - -void COutArchive::CreateStreamForCompressing(IOutStream **outStream) -{ - COffsetOutStream *streamSpec = new COffsetOutStream; - CMyComPtr tempStream(streamSpec); - streamSpec->Init(m_Stream, m_BasePosition + m_LocalFileHeaderSize); - *outStream = tempStream.Detach(); -} - -void COutArchive::SeekToPackedDataPosition() -{ - m_Stream->Seek(m_BasePosition + m_LocalFileHeaderSize, STREAM_SEEK_SET, NULL); -} - -void COutArchive::CreateStreamForCopying(ISequentialOutStream **outStream) -{ - CMyComPtr tempStream(m_Stream); - *outStream = tempStream.Detach(); -} - -}} diff --git a/7zip/Archive/Zip/ZipOut.h b/7zip/Archive/Zip/ZipOut.h deleted file mode 100755 index e08c306e..00000000 --- a/7zip/Archive/Zip/ZipOut.h +++ /dev/null @@ -1,51 +0,0 @@ -// ZipOut.h - -#ifndef __ZIP_OUT_H -#define __ZIP_OUT_H - -#include "Common/MyCom.h" - -#include "../../IStream.h" - -#include "ZipItem.h" - -namespace NArchive { -namespace NZip { - -class COutArchive -{ - CMyComPtr m_Stream; - - UInt64 m_BasePosition; - UInt32 m_LocalFileHeaderSize; - UInt32 m_ExtraSize; - bool m_IsZip64; - - void WriteBytes(const void *buffer, UInt32 size); - void WriteByte(Byte b); - void WriteUInt16(UInt16 value); - void WriteUInt32(UInt32 value); - void WriteUInt64(UInt64 value); - - void WriteExtraHeader(const CItem &item); - void WriteCentralHeader(const CItem &item); - void WriteExtra(const CExtraBlock &extra); -public: - void Create(IOutStream *outStream); - void MoveBasePosition(UInt64 distanceToMove); - UInt64 GetCurrentPosition() const { return m_BasePosition; }; - void PrepareWriteCompressedDataZip64(UInt16 fileNameLength, bool isZip64, bool aesEncryption); - void PrepareWriteCompressedData(UInt16 fileNameLength, UInt64 unPackSize, bool aesEncryption); - void PrepareWriteCompressedData2(UInt16 fileNameLength, UInt64 unPackSize, UInt64 packSize, bool aesEncryption); - HRESULT WriteLocalHeader(const CLocalItem &item); - - void WriteCentralDir(const CObjectVector &items, const CByteBuffer &comment); - - void CreateStreamForCompressing(IOutStream **outStream); - void CreateStreamForCopying(ISequentialOutStream **outStream); - void SeekToPackedDataPosition(); -}; - -}} - -#endif diff --git a/7zip/Archive/Zip/ZipUpdate.cpp b/7zip/Archive/Zip/ZipUpdate.cpp deleted file mode 100755 index 349e780a..00000000 --- a/7zip/Archive/Zip/ZipUpdate.cpp +++ /dev/null @@ -1,718 +0,0 @@ -// ZipUpdate.cpp - -#include "StdAfx.h" - -#include - -#include "ZipUpdate.h" -#include "ZipAddCommon.h" -#include "ZipOut.h" - -#include "Common/Defs.h" -#include "Common/AutoPtr.h" -#include "Common/StringConvert.h" -#include "Windows/Defs.h" -#include "Windows/Thread.h" - -#include "../../Common/ProgressUtils.h" -#ifdef COMPRESS_MT -#include "../../Common/ProgressMt.h" -#endif -#include "../../Common/LimitedStreams.h" -#include "../../Common/OutMemStream.h" - -#include "../../Compress/Copy/CopyCoder.h" - -using namespace NWindows; -using namespace NSynchronization; - -namespace NArchive { -namespace NZip { - -class CCriticalSectionLock2 -{ - CCriticalSection *_object; - void Unlock() { if (_object != 0) _object->Leave(); } -public: - CCriticalSectionLock2(): _object(0) {} - void Set(CCriticalSection &object) { _object = &object; _object->Enter(); } - ~CCriticalSectionLock2() { Unlock(); } -}; - -static const Byte kMadeByHostOS = NFileHeader::NHostOS::kFAT; -static const Byte kExtractHostOS = NFileHeader::NHostOS::kFAT; - -static const Byte kMethodForDirectory = NFileHeader::NCompressionMethod::kStored; -static const Byte kExtractVersionForDirectory = NFileHeader::NCompressionMethod::kStoreExtractVersion; - -static HRESULT CopyBlockToArchive(ISequentialInStream *inStream, - COutArchive &outArchive, ICompressProgressInfo *progress) -{ - CMyComPtr outStream; - outArchive.CreateStreamForCopying(&outStream); - CMyComPtr copyCoder = new NCompress::CCopyCoder; - return copyCoder->Code(inStream, outStream, NULL, NULL, progress); -} - -static HRESULT WriteRange(IInStream *inStream, COutArchive &outArchive, - const CUpdateRange &range, ICompressProgressInfo *progress) -{ - UInt64 position; - RINOK(inStream->Seek(range.Position, STREAM_SEEK_SET, &position)); - - CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream; - CMyComPtr inStreamLimited(streamSpec); - streamSpec->SetStream(inStream); - streamSpec->Init(range.Size); - - RINOK(CopyBlockToArchive(inStreamLimited, outArchive, progress)); - return progress->SetRatioInfo(&range.Size, &range.Size); -} - -static void SetFileHeader( - COutArchive &archive, - const CCompressionMethodMode &options, - const CUpdateItem &updateItem, - CItem &item) -{ - item.UnPackSize = updateItem.Size; - bool isDirectory; - - if (updateItem.NewProperties) - { - isDirectory = updateItem.IsDirectory; - item.Name = updateItem.Name; - item.ExternalAttributes = updateItem.Attributes; - item.Time = updateItem.Time; - } - else - isDirectory = item.IsDirectory(); - - item.LocalHeaderPosition = archive.GetCurrentPosition(); - item.MadeByVersion.HostOS = kMadeByHostOS; - item.MadeByVersion.Version = NFileHeader::NCompressionMethod::kMadeByProgramVersion; - - item.ExtractVersion.HostOS = kExtractHostOS; - - item.InternalAttributes = 0; // test it - item.ClearFlags(); - item.SetEncrypted(!isDirectory && options.PasswordIsDefined); - if (isDirectory) - { - item.ExtractVersion.Version = kExtractVersionForDirectory; - item.CompressionMethod = kMethodForDirectory; - item.PackSize = 0; - item.FileCRC = 0; // test it - } -} - -static void SetItemInfoFromCompressingResult(const CCompressingResult &compressingResult, - bool isAesMode, Byte aesKeyMode, CItem &item) -{ - item.ExtractVersion.Version = compressingResult.ExtractVersion; - item.CompressionMethod = compressingResult.Method; - item.FileCRC = compressingResult.CRC; - item.UnPackSize = compressingResult.UnpackSize; - item.PackSize = compressingResult.PackSize; - - item.LocalExtra.Clear(); - item.CentralExtra.Clear(); - - if (isAesMode) - { - CWzAesExtraField wzAesField; - wzAesField.Strength = aesKeyMode; - wzAesField.Method = compressingResult.Method; - item.CompressionMethod = NFileHeader::NCompressionMethod::kWzAES; - item.FileCRC = 0; - CExtraSubBlock sb; - wzAesField.SetSubBlock(sb); - item.LocalExtra.SubBlocks.Add(sb); - item.CentralExtra.SubBlocks.Add(sb); - } -} - -#ifdef COMPRESS_MT - -static DWORD WINAPI CoderThread(void *threadCoderInfo); - -struct CThreadInfo -{ - NWindows::CThread Thread; - CAutoResetEvent *CompressEvent; - CAutoResetEvent *CompressionCompletedEvent; - bool ExitThread; - - CMtCompressProgress *ProgressSpec; - CMyComPtr Progress; - - COutMemStream *OutStreamSpec; - CMyComPtr OutStream; - CMyComPtr InStream; - - CAddCommon Coder; - HRESULT Result; - CCompressingResult CompressingResult; - - bool IsFree; - UInt32 UpdateIndex; - - CThreadInfo(const CCompressionMethodMode &options): - CompressEvent(NULL), - CompressionCompletedEvent(NULL), - ExitThread(false), - ProgressSpec(0), - OutStreamSpec(0), - Coder(options) - {} - - void CreateEvents() - { - CompressEvent = new CAutoResetEvent(false); - CompressionCompletedEvent = new CAutoResetEvent(false); - } - bool CreateThread() { return Thread.Create(CoderThread, this); } - ~CThreadInfo(); - - void WaitAndCode(); - void StopWaitClose() - { - ExitThread = true; - if (OutStreamSpec != 0) - OutStreamSpec->StopWriting(E_ABORT); - if (CompressEvent != NULL) - CompressEvent->Set(); - Thread.Wait(); - Thread.Close(); - } - -}; - -CThreadInfo::~CThreadInfo() -{ - if (CompressEvent != NULL) - delete CompressEvent; - if (CompressionCompletedEvent != NULL) - delete CompressionCompletedEvent; -} - -void CThreadInfo::WaitAndCode() -{ - for (;;) - { - CompressEvent->Lock(); - if (ExitThread) - return; - Result = Coder.Compress(InStream, OutStream, Progress, CompressingResult); - if (Result == S_OK && Progress) - Result = Progress->SetRatioInfo(&CompressingResult.UnpackSize, &CompressingResult.PackSize); - CompressionCompletedEvent->Set(); - } -} - -static DWORD WINAPI CoderThread(void *threadCoderInfo) -{ - ((CThreadInfo *)threadCoderInfo)->WaitAndCode(); - return 0; -} - -class CThreads -{ -public: - CObjectVector Threads; - ~CThreads() - { - for (int i = 0; i < Threads.Size(); i++) - Threads[i].StopWaitClose(); - } -}; - -struct CMemBlocks2: public CMemLockBlocks -{ - CCompressingResult CompressingResult; - bool Defined; - bool Skip; - CMemBlocks2(): Defined(false), Skip(false) {} -}; - -class CMemRefs -{ -public: - CMemBlockManagerMt *Manager; - CObjectVector Refs; - CMemRefs(CMemBlockManagerMt *manager): Manager(manager) {} ; - ~CMemRefs() - { - for (int i = 0; i < Refs.Size(); i++) - Refs[i].FreeOpt(Manager); - } -}; - -#endif - -static HRESULT Update2(COutArchive &archive, - CInArchive *inArchive, - IInStream *inStream, - const CObjectVector &inputItems, - const CObjectVector &updateItems, - const CCompressionMethodMode *options, - const CByteBuffer &comment, - IArchiveUpdateCallback *updateCallback) -{ - UInt64 complexity = 0; - UInt64 numFilesToCompress = 0; - UInt64 numBytesToCompress = 0; - - int i; - for(i = 0; i < updateItems.Size(); i++) - { - const CUpdateItem &updateItem = updateItems[i]; - if (updateItem.NewData) - { - complexity += updateItem.Size; - numBytesToCompress += updateItem.Size; - numFilesToCompress++; - /* - if (updateItem.Commented) - complexity += updateItem.CommentRange.Size; - */ - } - else - { - CItemEx inputItem = inputItems[updateItem.IndexInArchive]; - if (inArchive->ReadLocalItemAfterCdItemFull(inputItem) != S_OK) - return E_NOTIMPL; - complexity += inputItem.GetLocalFullSize(); - // complexity += inputItem.GetCentralExtraPlusCommentSize(); - } - complexity += NFileHeader::kLocalBlockSize; - complexity += NFileHeader::kCentralBlockSize; - } - - if (comment != 0) - complexity += comment.GetCapacity(); - complexity++; // end of central - updateCallback->SetTotal(complexity); - - CAddCommon compressor(*options); - - complexity = 0; - - CObjectVector items; - - CLocalProgress *localProgressSpec = new CLocalProgress; - CMyComPtr localProgress = localProgressSpec; - localProgressSpec->Init(updateCallback, true); - - CLocalCompressProgressInfo *localCompressProgressSpec = new CLocalCompressProgressInfo; - CMyComPtr compressProgress = localCompressProgressSpec; - - - #ifdef COMPRESS_MT - - const size_t kNumMaxThreads = (1 << 10); - UInt32 numThreads = options->NumThreads; - if (numThreads > kNumMaxThreads) - numThreads = kNumMaxThreads; - - const size_t kMemPerThread = (1 << 25); - const size_t kBlockSize = 1 << 16; - - CCompressionMethodMode options2; - if (options != 0) - options2 = *options; - - bool mtMode = ((options != 0) && (numThreads > 1)); - - if (numFilesToCompress <= 1) - mtMode = false; - - if (mtMode) - { - Byte method = options->MethodSequence.Front(); - if (method == NFileHeader::NCompressionMethod::kStored && !options->PasswordIsDefined) - mtMode = false; - if (method == NFileHeader::NCompressionMethod::kBZip2) - { - UInt64 averageSize = numBytesToCompress / numFilesToCompress; - UInt32 blockSize = options->DicSize; - if (blockSize == 0) - blockSize = 1; - UInt64 averageNumberOfBlocks = averageSize / blockSize; - UInt32 numBZip2Threads = 32; - if (averageNumberOfBlocks < numBZip2Threads) - numBZip2Threads = (UInt32)averageNumberOfBlocks; - if (numBZip2Threads < 1) - numBZip2Threads = 1; - numThreads = numThreads / numBZip2Threads; - options2.NumThreads = numBZip2Threads; - if (numThreads <= 1) - mtMode = false; - } - } - - - CMtCompressProgressMixer mtCompressProgressMixer; - mtCompressProgressMixer.Init(numThreads + 1, localProgress); - - // we need one item for main stream - CMtCompressProgress *progressMainSpec = new CMtCompressProgress(); - CMyComPtr progressMain = progressMainSpec; - progressMainSpec->Init(&mtCompressProgressMixer, (int)numThreads); - - CMemBlockManagerMt memManager(kBlockSize); - CMemRefs refs(&memManager); - - CThreads threads; - CRecordVector compressingCompletedEvents; - CRecordVector threadIndices; // list threads in order of updateItems - - if (mtMode) - { - if (!memManager.AllocateSpaceAlways((size_t)numThreads * (kMemPerThread / kBlockSize))) - return E_OUTOFMEMORY; - for(i = 0; i < updateItems.Size(); i++) - refs.Refs.Add(CMemBlocks2()); - - UInt32 i; - for (i = 0; i < numThreads; i++) - threads.Threads.Add(CThreadInfo(options2)); - - for (i = 0; i < numThreads; i++) - { - CThreadInfo &threadInfo = threads.Threads[i]; - threadInfo.CreateEvents(); - threadInfo.OutStreamSpec = new COutMemStream(&memManager); - threadInfo.OutStream = threadInfo.OutStreamSpec; - threadInfo.IsFree = true; - threadInfo.ProgressSpec = new CMtCompressProgress(); - threadInfo.Progress = threadInfo.ProgressSpec; - threadInfo.ProgressSpec->Init(&mtCompressProgressMixer, (int)i); - if (!threadInfo.CreateThread()) - return ::GetLastError(); - } - } - int mtItemIndex = 0; - - #endif - - int itemIndex = 0; - int lastRealStreamItemIndex = -1; - - while(itemIndex < updateItems.Size()) - { - #ifdef COMPRESS_MT - if (!mtMode) - #endif - { - RINOK(updateCallback->SetCompleted(&complexity)); - } - - #ifdef COMPRESS_MT - if (mtMode && (UInt32)threadIndices.Size() < numThreads && mtItemIndex < updateItems.Size()) - { - const CUpdateItem &updateItem = updateItems[mtItemIndex++]; - if (!updateItem.NewData) - continue; - CItemEx item; - if (updateItem.NewProperties) - { - if (updateItem.IsDirectory) - continue; - } - else - { - item = inputItems[updateItem.IndexInArchive]; - if (inArchive->ReadLocalItemAfterCdItemFull(item) != S_OK) - return E_NOTIMPL; - if (item.IsDirectory()) - continue; - } - CMyComPtr fileInStream; - { - NWindows::NSynchronization::CCriticalSectionLock lock(mtCompressProgressMixer.CriticalSection); - HRESULT res = updateCallback->GetStream(updateItem.IndexInClient, &fileInStream); - if (res == S_FALSE) - { - complexity += updateItem.Size; - complexity++; - RINOK(updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK)); - refs.Refs[mtItemIndex - 1].Skip = true; - continue; - } - RINOK(res); - RINOK(updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK)); - } - - for (UInt32 i = 0; i < numThreads; i++) - { - CThreadInfo &threadInfo = threads.Threads[i]; - if (threadInfo.IsFree) - { - threadInfo.IsFree = false; - threadInfo.InStream = fileInStream; - threadInfo.OutStreamSpec->Init(); - threadInfo.ProgressSpec->Reinit(); - threadInfo.CompressEvent->Set(); - threadInfo.UpdateIndex = mtItemIndex - 1; - - compressingCompletedEvents.Add(*threadInfo.CompressionCompletedEvent); - threadIndices.Add(i); - break; - } - } - continue; - } - if (mtMode) - if (refs.Refs[itemIndex].Skip) - { - itemIndex++; - continue; - } - #endif - - const CUpdateItem &updateItem = updateItems[itemIndex]; - - CItemEx item; - if (!updateItem.NewProperties || !updateItem.NewData) - { - item = inputItems[updateItem.IndexInArchive]; - if (inArchive->ReadLocalItemAfterCdItemFull(item) != S_OK) - return E_NOTIMPL; - } - - - bool isDirectory; - if (updateItem.NewProperties) - isDirectory = updateItem.IsDirectory; - else - isDirectory = item.IsDirectory(); - - if (updateItem.NewData) - { - #ifdef COMPRESS_MT - if (mtMode && !isDirectory) - { - if (lastRealStreamItemIndex < itemIndex) - { - lastRealStreamItemIndex = itemIndex; - SetFileHeader(archive, *options, updateItem, item); - // file Size can be 64-bit !!! - archive.PrepareWriteCompressedData((UInt16)item.Name.Length(), updateItem.Size, options->IsAesMode); - } - - CMemBlocks2 &memRef = refs.Refs[itemIndex]; - if (memRef.Defined) - { - CMyComPtr outStream; - archive.CreateStreamForCompressing(&outStream); - memRef.WriteToStream(memManager.GetBlockSize(), outStream); - SetItemInfoFromCompressingResult(memRef.CompressingResult, - options->IsAesMode, options->AesKeyMode, item); - SetFileHeader(archive, *options, updateItem, item); - RINOK(archive.WriteLocalHeader(item)); - complexity += item.UnPackSize; - // RINOK(updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK)); - memRef.FreeOpt(&memManager); - } - else - { - { - CThreadInfo &thread = threads.Threads[threadIndices.Front()]; - if (!thread.OutStreamSpec->WasUnlockEventSent()) - { - CMyComPtr outStream; - archive.CreateStreamForCompressing(&outStream); - thread.OutStreamSpec->SetOutStream(outStream); - thread.OutStreamSpec->SetRealStreamMode(); - } - } - - DWORD result = ::WaitForMultipleObjects(compressingCompletedEvents.Size(), - &compressingCompletedEvents.Front(), FALSE, INFINITE); - int t = (int)(result - WAIT_OBJECT_0); - CThreadInfo &threadInfo = threads.Threads[threadIndices[t]]; - threadInfo.InStream.Release(); - threadInfo.IsFree = true; - RINOK(threadInfo.Result); - threadIndices.Delete(t); - compressingCompletedEvents.Delete(t); - if (t == 0) - { - RINOK(threadInfo.OutStreamSpec->WriteToRealStream()); - threadInfo.OutStreamSpec->ReleaseOutStream(); - SetItemInfoFromCompressingResult(threadInfo.CompressingResult, - options->IsAesMode, options->AesKeyMode, item); - SetFileHeader(archive, *options, updateItem, item); - RINOK(archive.WriteLocalHeader(item)); - complexity += item.UnPackSize; - } - else - { - CMemBlocks2 &memRef = refs.Refs[threadInfo.UpdateIndex]; - threadInfo.OutStreamSpec->DetachData(memRef); - memRef.CompressingResult = threadInfo.CompressingResult; - memRef.Defined = true; - continue; - } - } - } - else - #endif - { - { - CMyComPtr fileInStream; - { - #ifdef COMPRESS_MT - CCriticalSectionLock2 lock; - if (mtMode) - lock.Set(mtCompressProgressMixer.CriticalSection); - #endif - HRESULT res = updateCallback->GetStream(updateItem.IndexInClient, &fileInStream); - if (res == S_FALSE) - { - complexity += updateItem.Size; - complexity++; - RINOK(updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK)); - itemIndex++; - continue; - } - RINOK(res); - - #ifdef COMPRESS_MT - if (mtMode) - { - RINOK(updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK)); - } - #endif - } - // file Size can be 64-bit !!! - SetFileHeader(archive, *options, updateItem, item); - archive.PrepareWriteCompressedData((UInt16)item.Name.Length(), updateItem.Size, options->IsAesMode); - - if(!isDirectory) - { - CCompressingResult compressingResult; - CMyComPtr outStream; - archive.CreateStreamForCompressing(&outStream); - - localCompressProgressSpec->Init(localProgress, &complexity, NULL); - - RINOK(compressor.Compress(fileInStream, outStream, compressProgress, compressingResult)); - - SetItemInfoFromCompressingResult(compressingResult, - options->IsAesMode, options->AesKeyMode, item); - } - } - RINOK(archive.WriteLocalHeader(item)); - complexity += item.UnPackSize; - #ifdef COMPRESS_MT - if (!mtMode) - #endif - { - RINOK(updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK)); - } - } - } - else - { - // item = inputItems[copyIndices[copyIndexIndex++]]; - - #ifdef COMPRESS_MT - if (mtMode) - progressMainSpec->Reinit(); - #endif - - localCompressProgressSpec->Init(localProgress, &complexity, NULL); - ICompressProgressInfo *progress = compressProgress; - #ifdef COMPRESS_MT - if (mtMode) - progress = progressMain; - #endif - - if (updateItem.NewProperties) - { - if (item.HasDescriptor()) - return E_NOTIMPL; - - // use old name size. - // CUpdateRange range(item.GetLocalExtraPosition(), item.LocalExtraSize + item.PackSize); - CUpdateRange range(item.GetDataPosition(), item.PackSize); - - // item.ExternalAttributes = updateItem.Attributes; - // Test it - item.Name = updateItem.Name; - item.Time = updateItem.Time; - item.CentralExtra.RemoveUnknownSubBlocks(); - item.LocalExtra.RemoveUnknownSubBlocks(); - - archive.PrepareWriteCompressedData2((UInt16)item.Name.Length(), item.UnPackSize, item.PackSize, item.LocalExtra.HasWzAesField()); - item.LocalHeaderPosition = archive.GetCurrentPosition(); - archive.SeekToPackedDataPosition(); - RINOK(WriteRange(inStream, archive, range, progress)); - complexity += range.Size; - archive.WriteLocalHeader(item); - } - else - { - CUpdateRange range(item.LocalHeaderPosition, item.GetLocalFullSize()); - - // set new header position - item.LocalHeaderPosition = archive.GetCurrentPosition(); - - RINOK(WriteRange(inStream, archive, range, progress)); - complexity += range.Size; - archive.MoveBasePosition(range.Size); - } - } - items.Add(item); - complexity += NFileHeader::kLocalBlockSize; - itemIndex++; - } - archive.WriteCentralDir(items, comment); - return S_OK; -} - -HRESULT Update( - const CObjectVector &inputItems, - const CObjectVector &updateItems, - ISequentialOutStream *seqOutStream, - CInArchive *inArchive, - CCompressionMethodMode *compressionMethodMode, - IArchiveUpdateCallback *updateCallback) -{ - CMyComPtr outStream; - RINOK(seqOutStream->QueryInterface(IID_IOutStream, (void **)&outStream)); - if (!outStream) - return E_NOTIMPL; - - CInArchiveInfo archiveInfo; - if(inArchive != 0) - { - inArchive->GetArchiveInfo(archiveInfo); - if (archiveInfo.Base != 0) - return E_NOTIMPL; - } - else - archiveInfo.StartPosition = 0; - - COutArchive outArchive; - outArchive.Create(outStream); - if (archiveInfo.StartPosition > 0) - { - CMyComPtr inStream; - inStream.Attach(inArchive->CreateLimitedStream(0, archiveInfo.StartPosition)); - RINOK(CopyBlockToArchive(inStream, outArchive, NULL)); - outArchive.MoveBasePosition(archiveInfo.StartPosition); - } - CMyComPtr inStream; - if(inArchive != 0) - inStream.Attach(inArchive->CreateStream()); - - return Update2(outArchive, inArchive, inStream, - inputItems, updateItems, - compressionMethodMode, - archiveInfo.Comment, updateCallback); -} - -}} diff --git a/7zip/Archive/Zip/ZipUpdate.h b/7zip/Archive/Zip/ZipUpdate.h deleted file mode 100755 index d846b05f..00000000 --- a/7zip/Archive/Zip/ZipUpdate.h +++ /dev/null @@ -1,52 +0,0 @@ -// Zip/Update.h - -#ifndef __ZIP_UPDATE_H -#define __ZIP_UPDATE_H - -#include "Common/Vector.h" -#include "Common/Types.h" - -#include "../../ICoder.h" -#include "../IArchive.h" - -#include "ZipCompressionMode.h" -#include "ZipIn.h" - -namespace NArchive { -namespace NZip { - -struct CUpdateRange -{ - UInt64 Position; - UInt64 Size; - CUpdateRange() {}; - CUpdateRange(UInt64 position, UInt64 size): Position(position), Size(size) {}; -}; - -struct CUpdateItem -{ - bool NewData; - bool NewProperties; - bool IsDirectory; - int IndexInArchive; - int IndexInClient; - UInt32 Attributes; - UInt32 Time; - UInt64 Size; - AString Name; - // bool Commented; - // CUpdateRange CommentRange; - CUpdateItem(): Size(0) {} -}; - -HRESULT Update( - const CObjectVector &inputItems, - const CObjectVector &updateItems, - ISequentialOutStream *seqOutStream, - CInArchive *inArchive, - CCompressionMethodMode *compressionMethodMode, - IArchiveUpdateCallback *updateCallback); - -}} - -#endif diff --git a/7zip/Archive/Zip/makefile b/7zip/Archive/Zip/makefile deleted file mode 100755 index eaf1031f..00000000 --- a/7zip/Archive/Zip/makefile +++ /dev/null @@ -1,124 +0,0 @@ -PROG = zip.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -DCOMPRESS_MT -LIBS = $(LIBS) oleaut32.lib user32.lib - -ZIP_OBJS = \ - $O\DllExports.obj \ - $O\ZipAddCommon.obj \ - $O\ZipHandler.obj \ - $O\ZipHandlerOut.obj \ - $O\ZipHeader.obj \ - $O\ZipIn.obj \ - $O\ZipItem.obj \ - $O\ZipOut.obj \ - $O\ZipUpdate.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\CRC.obj \ - $O\IntToString.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\StringToInt.obj \ - $O\Vector.obj \ - -WIN_OBJS = \ - $O\DLL.obj \ - $O\FileFind.obj \ - $O\PropVariant.obj \ - $O\Synchronization.obj \ - -7ZIP_COMMON_OBJS = \ - $O\InBuffer.obj \ - $O\LimitedStreams.obj \ - $O\LSBFDecoder.obj \ - $O\MemBlocks.obj \ - $O\OffsetStream.obj \ - $O\OutBuffer.obj \ - $O\OutMemStream.obj \ - $O\ProgressMt.obj \ - $O\ProgressUtils.obj \ - $O\StreamObjects.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\CodecsPath.obj \ - $O\CoderLoader.obj \ - $O\FilterCoder.obj \ - $O\InStreamWithCRC.obj \ - $O\ItemNameUtils.obj \ - $O\OutStreamWithCRC.obj \ - $O\ParseProperties.obj \ - -7Z_OBJS = \ - $O\7zMethodID.obj \ - $O\7zMethods.obj \ - -IMPLODE_OBJS = \ - $O\ImplodeDecoder.obj \ - $O\ImplodeHuffmanDecoder.obj \ - -SHRINK_OBJS = \ - $O\ShrinkDecoder.obj \ - -CRYPTO_HASH_OBJS = \ - $O\HmacSha1.obj \ - $O\Pbkdf2HmacSha1.obj \ - $O\RandGen.obj \ - $O\Sha1.obj \ - -CRYPTO_WZAES_OBJS = \ - $O\WzAES.obj \ - -CRYPTO_ZIP_OBJS = \ - $O\ZipCipher.obj \ - $O\ZipCrypto.obj \ - - -OBJS = \ - $O\StdAfx.obj \ - $(ZIP_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(7Z_OBJS) \ - $(CRYPTO_HASH_OBJS) \ - $(CRYPTO_WZAES_OBJS) \ - $(CRYPTO_ZIP_OBJS) \ - $(IMPLODE_OBJS) \ - $(SHRINK_OBJS) \ - $O\CopyCoder.obj \ - $O\LZOutWindow.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(ZIP_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$(7Z_OBJS): ../7z/$(*B).cpp - $(COMPL) -$(CRYPTO_HASH_OBJS): ../../Crypto/Hash/$(*B).cpp - $(COMPL_O2) -$(CRYPTO_ZIP_OBJS): ../../Crypto/Zip/$(*B).cpp - $(COMPL) -$(CRYPTO_WZAES_OBJS): ../../Crypto/WzAES/$(*B).cpp - $(COMPL_O2) -$(IMPLODE_OBJS): ../../Compress/Implode/$(*B).cpp - $(COMPL) -$(SHRINK_OBJS): ../../Compress/Shrink/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) -$O\LZOutWindow.obj: ../../Compress/LZ/$(*B).cpp - $(COMPL) diff --git a/7zip/Archive/Zip/resource.rc b/7zip/Archive/Zip/resource.rc deleted file mode 100755 index 388f349e..00000000 --- a/7zip/Archive/Zip/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Zip Plugin", "zip") - -101 ICON "zip.ico" diff --git a/7zip/Archive/Zip/zip.ico b/7zip/Archive/Zip/zip.ico deleted file mode 100755 index 2af46066..00000000 Binary files a/7zip/Archive/Zip/zip.ico and /dev/null differ diff --git a/7zip/Archive/cpio/CpioHandler.cpp b/7zip/Archive/cpio/CpioHandler.cpp deleted file mode 100755 index 601afbd6..00000000 --- a/7zip/Archive/cpio/CpioHandler.cpp +++ /dev/null @@ -1,289 +0,0 @@ -// Archive/cpio/Handler.cpp - -#include "StdAfx.h" - -#include "CpioHandler.h" - -#include "Common/Defs.h" -#include "Common/StringConvert.h" -#include "Common/NewHandler.h" -#include "Common/ComTry.h" - -#include "Windows/Time.h" -#include "Windows/PropVariant.h" - -#include "../../Common/ProgressUtils.h" -#include "../../Common//LimitedStreams.h" - -#include "../../Compress/Copy/CopyCoder.h" -#include "../Common/ItemNameUtils.h" -#include "CpioIn.h" - -using namespace NWindows; -using namespace NTime; - -namespace NArchive { -namespace NCpio { - -enum // PropID -{ - kpidinode = kpidUserDefined, - kpidiChkSum -}; - -STATPROPSTG kProperties[] = -{ - { NULL, kpidPath, VT_BSTR}, - { NULL, kpidIsFolder, VT_BOOL}, - { NULL, kpidSize, VT_UI8}, - { NULL, kpidPackedSize, VT_UI8}, - { NULL, kpidLastWriteTime, VT_FILETIME}, - // { NULL, kpidUser, VT_BSTR}, - // { NULL, kpidGroup, VT_BSTR}, - // { L"inode", kpidinode, VT_UI4} - // { L"CheckSum", kpidiChkSum, VT_UI4} -}; - -STDMETHODIMP CHandler::GetArchiveProperty(PROPID /* propID */, PROPVARIANT *value) -{ - value->vt = VT_EMPTY; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties) -{ - *numProperties = sizeof(kProperties) / sizeof(kProperties[0]); - return S_OK; -} - -STDMETHODIMP CHandler::GetPropertyInfo(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) -{ - if(index >= sizeof(kProperties) / sizeof(kProperties[0])) - return E_INVALIDARG; - const STATPROPSTG &srcItem = kProperties[index]; - *propID = srcItem.propid; - *varType = srcItem.vt; - *name = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) -{ - *numProperties = 0; - return S_OK; -} - -STDMETHODIMP CHandler::GetArchivePropertyInfo(UInt32 /* index */, - BSTR * /* name */, PROPID * /* propID */, VARTYPE * /* varType */) -{ - return E_INVALIDARG; -} - -STDMETHODIMP CHandler::Open(IInStream *inStream, - const UInt64 * /* maxCheckStartPosition */, - IArchiveOpenCallback *openArchiveCallback) -{ - COM_TRY_BEGIN - // try - { - CInArchive archive; - - if(archive.Open(inStream) != S_OK) - return S_FALSE; - - m_Items.Clear(); - - if (openArchiveCallback != NULL) - { - RINOK(openArchiveCallback->SetTotal(NULL, NULL)); - UInt64 numFiles = m_Items.Size(); - RINOK(openArchiveCallback->SetCompleted(&numFiles, NULL)); - } - - for (;;) - { - CItemEx itemInfo; - bool filled; - HRESULT result = archive.GetNextItem(filled, itemInfo); - if (result == S_FALSE) - return S_FALSE; - if (result != S_OK) - return S_FALSE; - if (!filled) - break; - m_Items.Add(itemInfo); - archive.SkeepDataRecords(itemInfo.Size, itemInfo.Align); - if (openArchiveCallback != NULL) - { - UInt64 numFiles = m_Items.Size(); - RINOK(openArchiveCallback->SetCompleted(&numFiles, NULL)); - } - } - if (m_Items.Size() == 0) - return S_FALSE; - - m_InStream = inStream; - } - /* - catch(...) - { - return S_FALSE; - } - */ - return S_OK; - COM_TRY_END -} - -STDMETHODIMP CHandler::Close() -{ - m_Items.Clear(); - m_InStream.Release(); - return S_OK; -} - -STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems) -{ - *numItems = m_Items.Size(); - return S_OK; -} - -STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) -{ - COM_TRY_BEGIN - NWindows::NCOM::CPropVariant propVariant; - const CItemEx &item = m_Items[index]; - - switch(propID) - { - case kpidPath: - propVariant = (const wchar_t *)NItemName::GetOSName( - MultiByteToUnicodeString(item.Name, CP_OEMCP)); - break; - case kpidIsFolder: - propVariant = item.IsDirectory(); - break; - case kpidSize: - case kpidPackedSize: - propVariant = item.Size; - break; - case kpidLastWriteTime: - { - FILETIME utcFileTime; - if (item.ModificationTime != 0) - NTime::UnixTimeToFileTime(item.ModificationTime, utcFileTime); - else - { - utcFileTime.dwLowDateTime = 0; - utcFileTime.dwHighDateTime = 0; - } - propVariant = utcFileTime; - break; - } - case kpidinode: - propVariant = item.inode; - break; - /* - case kpidiChkSum: - propVariant = item.ChkSum; - break; - */ - } - propVariant.Detach(value); - return S_OK; - COM_TRY_END -} - -STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, - Int32 _aTestMode, IArchiveExtractCallback *extractCallback) -{ - COM_TRY_BEGIN - bool allFilesMode = (numItems == UInt32(-1)); - if (allFilesMode) - numItems = m_Items.Size(); - if(numItems == 0) - return S_OK; - bool testMode = (_aTestMode != 0); - UInt64 totalSize = 0; - UInt32 i; - for(i = 0; i < numItems; i++) - totalSize += m_Items[allFilesMode ? i : indices[i]].Size; - extractCallback->SetTotal(totalSize); - - UInt64 currentTotalSize = 0; - UInt64 currentItemSize; - - CMyComPtr copyCoder; - - for(i = 0; i < numItems; i++, currentTotalSize += currentItemSize) - { - RINOK(extractCallback->SetCompleted(¤tTotalSize)); - CMyComPtr realOutStream; - Int32 askMode; - askMode = testMode ? NArchive::NExtract::NAskMode::kTest : - NArchive::NExtract::NAskMode::kExtract; - Int32 index = allFilesMode ? i : indices[i]; - const CItemEx &itemInfo = m_Items[index]; - - RINOK(extractCallback->GetStream(index, &realOutStream, askMode)); - - currentItemSize = itemInfo.Size; - - if(itemInfo.IsDirectory()) - { - RINOK(extractCallback->PrepareOperation(askMode)); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - continue; - } - if(!testMode && (!realOutStream)) - { - continue; - } - RINOK(extractCallback->PrepareOperation(askMode)); - { - if (testMode) - { - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - continue; - } - - RINOK(m_InStream->Seek(itemInfo.GetDataPosition(), STREAM_SEEK_SET, NULL)); - CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream; - CMyComPtr inStream(streamSpec); - streamSpec->SetStream(m_InStream); - streamSpec->Init(itemInfo.Size); - - CLocalProgress *localProgressSpec = new CLocalProgress; - CMyComPtr progress = localProgressSpec; - localProgressSpec->Init(extractCallback, false); - - CLocalCompressProgressInfo *localCompressProgressSpec = - new CLocalCompressProgressInfo; - CMyComPtr compressProgress = localCompressProgressSpec; - localCompressProgressSpec->Init(progress, - ¤tTotalSize, ¤tTotalSize); - - if(copyCoder == NULL) - { - copyCoder = new NCompress::CCopyCoder; - } - try - { - RINOK(copyCoder->Code(inStream, realOutStream, - NULL, NULL, compressProgress)); - } - catch(...) - { - realOutStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kDataError)); - continue; - } - realOutStream.Release(); - RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK)); - } - } - return S_OK; - COM_TRY_END -} - -}} diff --git a/7zip/Archive/cpio/CpioHandler.h b/7zip/Archive/cpio/CpioHandler.h deleted file mode 100755 index 39702541..00000000 --- a/7zip/Archive/cpio/CpioHandler.h +++ /dev/null @@ -1,47 +0,0 @@ -// Archive/cpio/Handler.h - -#ifndef __ARCHIVE_CPIO_HANDLER_H -#define __ARCHIVE_CPIO_HANDLER_H - -#include "Common/MyCom.h" -#include "../IArchive.h" - -#include "CpioItem.h" - -namespace NArchive { -namespace NCpio { - -class CHandler: - public IInArchive, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP - - STDMETHOD(Open)(IInStream *stream, - const UInt64 *maxCheckStartPosition, - IArchiveOpenCallback *openArchiveCallback); - STDMETHOD(Close)(); - STDMETHOD(GetNumberOfItems)(UInt32 *numItems); - STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value); - STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems, - Int32 testMode, IArchiveExtractCallback *extractCallback); - - STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value); - - STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties); - STDMETHOD(GetPropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - - STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties); - STDMETHOD(GetArchivePropertyInfo)(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType); - -private: - CObjectVector m_Items; - CMyComPtr m_InStream; -}; - -}} - -#endif diff --git a/7zip/Archive/cpio/CpioHeader.cpp b/7zip/Archive/cpio/CpioHeader.cpp deleted file mode 100755 index 9e4d99cb..00000000 --- a/7zip/Archive/cpio/CpioHeader.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Archive/cpio/Header.h - -#include "StdAfx.h" - -#include "CpioHeader.h" - -namespace NArchive { -namespace NCpio { -namespace NFileHeader { - - namespace NMagic - { - extern const char *kMagic1 = "070701"; - extern const char *kMagic2 = "070702"; - extern const char *kMagic3 = "070707"; - extern const char *kEndName = "TRAILER!!!"; - - const Byte kMagicForRecord2[2] = { 0xC7, 0x71 }; - // unsigned short kMagicForRecord2BE = 0xC771; - } - -}}} - diff --git a/7zip/Archive/cpio/CpioHeader.h b/7zip/Archive/cpio/CpioHeader.h deleted file mode 100755 index 40a0014a..00000000 --- a/7zip/Archive/cpio/CpioHeader.h +++ /dev/null @@ -1,70 +0,0 @@ -// Archive/cpio/Header.h - -#ifndef __ARCHIVE_CPIO_HEADER_H -#define __ARCHIVE_CPIO_HEADER_H - -#include "Common/Types.h" - -namespace NArchive { -namespace NCpio { - -namespace NFileHeader -{ - namespace NMagic - { - extern const char *kMagic1; - extern const char *kMagic2; - extern const char *kMagic3; - extern const char *kEndName; - extern const Byte kMagicForRecord2[2]; - } - - const UInt32 kRecord2Size = 26; - /* - struct CRecord2 - { - unsigned short c_magic; - short c_dev; - unsigned short c_ino; - unsigned short c_mode; - unsigned short c_uid; - unsigned short c_gid; - unsigned short c_nlink; - short c_rdev; - unsigned short c_mtimes[2]; - unsigned short c_namesize; - unsigned short c_filesizes[2]; - }; - */ - - const UInt32 kRecordSize = 110; - /* - struct CRecord - { - char Magic[6]; // "070701" for "new" portable format, "070702" for CRC format - char inode[8]; - char Mode[8]; - char UID[8]; - char GID[8]; - char nlink[8]; - char mtime[8]; - char Size[8]; // must be 0 for FIFOs and directories - char DevMajor[8]; - char DevMinor[8]; - char RDevMajor[8]; //only valid for chr and blk special files - char RDevMinor[8]; //only valid for chr and blk special files - char NameSize[8]; // count includes terminating NUL in pathname - char ChkSum[8]; // 0 for "new" portable format; for CRC format the sum of all the bytes in the file - bool CheckMagic() const - { return memcmp(Magic, NMagic::kMagic1, 6) == 0 || - memcmp(Magic, NMagic::kMagic2, 6) == 0; }; - }; - */ - - const UInt32 kOctRecordSize = 76; - -} - -}} - -#endif diff --git a/7zip/Archive/cpio/CpioIn.cpp b/7zip/Archive/cpio/CpioIn.cpp deleted file mode 100755 index 91399362..00000000 --- a/7zip/Archive/cpio/CpioIn.cpp +++ /dev/null @@ -1,271 +0,0 @@ -// Archive/cpioIn.cpp - -#include "StdAfx.h" - -#include "CpioIn.h" - -#include "Common/StringToInt.h" -#include "Windows/Defs.h" - -#include "../../Common/StreamUtils.h" - -#include "CpioHeader.h" - -namespace NArchive { -namespace NCpio { - -HRESULT CInArchive::ReadBytes(void *data, UInt32 size, UInt32 &processedSize) -{ - RINOK(ReadStream(m_Stream, data, size, &processedSize)); - m_Position += processedSize; - return S_OK; -} - -Byte CInArchive::ReadByte() -{ - if (_blockPos >= _blockSize) - throw "Incorrect cpio archive"; - return _block[_blockPos++]; -} - -UInt16 CInArchive::ReadUInt16() -{ - UInt16 value = 0; - for (int i = 0; i < 2; i++) - { - Byte b = ReadByte(); - value |= (UInt16(b) << (8 * i)); - } - return value; -} - -UInt32 CInArchive::ReadUInt32() -{ - UInt32 value = 0; - for (int i = 0; i < 4; i++) - { - Byte b = ReadByte(); - value |= (UInt32(b) << (8 * i)); - } - return value; -} - -HRESULT CInArchive::Open(IInStream *inStream) -{ - RINOK(inStream->Seek(0, STREAM_SEEK_CUR, &m_Position)); - m_Stream = inStream; - return S_OK; -} - -bool CInArchive::ReadNumber(UInt32 &resultValue) -{ - resultValue = 0; - for (int i = 0; i < 8; i++) - { - char c = char(ReadByte()); - int d; - if (c >= '0' && c <= '9') - d = c - '0'; - else if (c >= 'A' && c <= 'F') - d = 10 + c - 'A'; - else if (c >= 'a' && c <= 'f') - d = 10 + c - 'a'; - else - return false; - resultValue *= 0x10; - resultValue += d; - } - return true; -} - -static bool OctalToNumber(const char *s, UInt64 &res) -{ - const char *end; - res = ConvertOctStringToUInt64(s, &end); - return (*end == ' ' || *end == 0); -} - -static bool OctalToNumber32(const char *s, UInt32 &res) -{ - UInt64 res64; - if (!OctalToNumber(s, res64)) - return false; - res = (UInt32)res64; - return (res64 <= 0xFFFFFFFF); -} - -bool CInArchive::ReadOctNumber(int size, UInt32 &resultValue) -{ - char sz[32 + 4]; - int i; - for (i = 0; i < size && i < 32; i++) - sz[i] = (char)ReadByte(); - sz[i] = 0; - return OctalToNumber32(sz, resultValue); -} - -#define GetFromHex(y) { if (!ReadNumber(y)) return S_FALSE; } -#define GetFromOct6(y) { if (!ReadOctNumber(6, y)) return S_FALSE; } -#define GetFromOct11(y) { if (!ReadOctNumber(11, y)) return S_FALSE; } - -static unsigned short ConvertValue(unsigned short value, bool convert) -{ - if (!convert) - return value; - return (unsigned short)((((unsigned short)(value & 0xFF)) << 8) | (value >> 8)); -} - -static UInt32 GetAlignedSize(UInt32 size, UInt32 align) -{ - while ((size & (align - 1)) != 0) - size++; - return size; -} - - -HRESULT CInArchive::GetNextItem(bool &filled, CItemEx &item) -{ - filled = false; - - UInt32 processedSize; - item.HeaderPosition = m_Position; - - _blockSize = kMaxBlockSize; - RINOK(ReadBytes(_block, 2, processedSize)); - if (processedSize != 2) - return S_FALSE; - _blockPos = 0; - - UInt32 nameSize; - - bool oldBE = - _block[0] == NFileHeader::NMagic::kMagicForRecord2[1] && - _block[1] == NFileHeader::NMagic::kMagicForRecord2[0]; - - bool binMode = (_block[0] == NFileHeader::NMagic::kMagicForRecord2[0] && - _block[1] == NFileHeader::NMagic::kMagicForRecord2[1]) || - oldBE; - - if (binMode) - { - RINOK(ReadBytes(_block + 2, NFileHeader::kRecord2Size - 2, processedSize)); - if (processedSize != NFileHeader::kRecord2Size - 2) - return S_FALSE; - item.Align = 2; - _blockPos = 2; - item.DevMajor = 0; - item.DevMinor = ConvertValue(ReadUInt16(), oldBE); - item.inode = ConvertValue(ReadUInt16(), oldBE); - item.Mode = ConvertValue(ReadUInt16(), oldBE); - item.UID = ConvertValue(ReadUInt16(), oldBE); - item.GID = ConvertValue(ReadUInt16(), oldBE); - item.NumLinks = ConvertValue(ReadUInt16(), oldBE); - item.RDevMajor =0; - item.RDevMinor = ConvertValue(ReadUInt16(), oldBE); - UInt16 timeHigh = ConvertValue(ReadUInt16(), oldBE); - UInt16 timeLow = ConvertValue(ReadUInt16(), oldBE); - item.ModificationTime = (UInt32(timeHigh) << 16) + timeLow; - nameSize = ConvertValue(ReadUInt16(), oldBE); - UInt16 sizeHigh = ConvertValue(ReadUInt16(), oldBE); - UInt16 sizeLow = ConvertValue(ReadUInt16(), oldBE); - item.Size = (UInt32(sizeHigh) << 16) + sizeLow; - - item.ChkSum = 0; - item.HeaderSize = GetAlignedSize( - nameSize + NFileHeader::kRecord2Size, item.Align); - nameSize = item.HeaderSize - NFileHeader::kRecord2Size; - } - else - { - RINOK(ReadBytes(_block + 2, 4, processedSize)); - if (processedSize != 4) - return S_FALSE; - - bool magicOK = - memcmp(_block, NFileHeader::NMagic::kMagic1, 6) == 0 || - memcmp(_block, NFileHeader::NMagic::kMagic2, 6) == 0; - _blockPos = 6; - if (magicOK) - { - RINOK(ReadBytes(_block + 6, NFileHeader::kRecordSize - 6, processedSize)); - if (processedSize != NFileHeader::kRecordSize - 6) - return S_FALSE; - item.Align = 4; - - GetFromHex(item.inode); - GetFromHex(item.Mode); - GetFromHex(item.UID); - GetFromHex(item.GID); - GetFromHex(item.NumLinks); - UInt32 modificationTime; - GetFromHex(modificationTime); - item.ModificationTime = modificationTime; - GetFromHex(item.Size); - GetFromHex(item.DevMajor); - GetFromHex(item.DevMinor); - GetFromHex(item.RDevMajor); - GetFromHex(item.RDevMinor); - GetFromHex(nameSize); - GetFromHex(item.ChkSum); - item.HeaderSize = GetAlignedSize( - nameSize + NFileHeader::kRecordSize, item.Align); - nameSize = item.HeaderSize - NFileHeader::kRecordSize; - } - else - { - if (!memcmp(_block, NFileHeader::NMagic::kMagic3, 6) == 0) - return S_FALSE; - RINOK(ReadBytes(_block + 6, NFileHeader::kOctRecordSize - 6, processedSize)); - if (processedSize != NFileHeader::kOctRecordSize - 6) - return S_FALSE; - item.Align = 1; - item.DevMajor = 0; - GetFromOct6(item.DevMinor); - GetFromOct6(item.inode); - GetFromOct6(item.Mode); - GetFromOct6(item.UID); - GetFromOct6(item.GID); - GetFromOct6(item.NumLinks); - item.RDevMajor = 0; - GetFromOct6(item.RDevMinor); - UInt32 modificationTime; - GetFromOct11(modificationTime); - item.ModificationTime = modificationTime; - GetFromOct6(nameSize); - GetFromOct11(item.Size); // ????? - item.HeaderSize = GetAlignedSize( - nameSize + NFileHeader::kOctRecordSize, item.Align); - nameSize = item.HeaderSize - NFileHeader::kOctRecordSize; - } - } - if (nameSize == 0 || nameSize >= (1 << 27)) - return E_FAIL; - RINOK(ReadBytes(item.Name.GetBuffer(nameSize), - nameSize, processedSize)); - if (processedSize != nameSize) - return E_FAIL; - item.Name.ReleaseBuffer(); - if (strcmp(item.Name, NFileHeader::NMagic::kEndName) == 0) - return S_OK; - filled = true; - return S_OK; -} - -HRESULT CInArchive::Skeep(UInt64 numBytes) -{ - UInt64 newPostion; - RINOK(m_Stream->Seek(numBytes, STREAM_SEEK_CUR, &newPostion)); - m_Position += numBytes; - if (m_Position != newPostion) - return E_FAIL; - return S_OK; -} - -HRESULT CInArchive::SkeepDataRecords(UInt64 dataSize, UInt32 align) -{ - while ((dataSize & (align - 1)) != 0) - dataSize++; - return Skeep(dataSize); -} - -}} diff --git a/7zip/Archive/cpio/CpioIn.h b/7zip/Archive/cpio/CpioIn.h deleted file mode 100755 index 19e3da10..00000000 --- a/7zip/Archive/cpio/CpioIn.h +++ /dev/null @@ -1,41 +0,0 @@ -// CpioIn.h - -#ifndef __ARCHIVE_CPIO_IN_H -#define __ARCHIVE_CPIO_IN_H - -#include "Common/MyCom.h" -#include "Common/Types.h" -#include "../../IStream.h" -#include "CpioItem.h" - -namespace NArchive { -namespace NCpio { - -const UInt32 kMaxBlockSize = NFileHeader::kRecordSize; - -class CInArchive -{ - CMyComPtr m_Stream; - UInt64 m_Position; - - UInt16 _blockSize; - Byte _block[kMaxBlockSize]; - UInt32 _blockPos; - Byte ReadByte(); - UInt16 ReadUInt16(); - UInt32 ReadUInt32(); - - bool ReadNumber(UInt32 &resultValue); - bool ReadOctNumber(int size, UInt32 &resultValue); - - HRESULT ReadBytes(void *data, UInt32 size, UInt32 &processedSize); -public: - HRESULT Open(IInStream *inStream); - HRESULT GetNextItem(bool &filled, CItemEx &itemInfo); - HRESULT Skeep(UInt64 numBytes); - HRESULT SkeepDataRecords(UInt64 dataSize, UInt32 align); -}; - -}} - -#endif diff --git a/7zip/Archive/cpio/CpioItem.h b/7zip/Archive/cpio/CpioItem.h deleted file mode 100755 index 0eb2a0b4..00000000 --- a/7zip/Archive/cpio/CpioItem.h +++ /dev/null @@ -1,55 +0,0 @@ -// Archive/cpio/ItemInfo.h - -#ifndef __ARCHIVE_CPIO_ITEMINFO_H -#define __ARCHIVE_CPIO_ITEMINFO_H - -#include - -#include "Common/Types.h" -#include "Common/String.h" -#include "CpioHeader.h" - -namespace NArchive { -namespace NCpio { - -struct CItem -{ - AString Name; - UInt32 inode; - UInt32 Mode; - UInt32 UID; - UInt32 GID; - UInt32 Size; - UInt32 ModificationTime; - - // char LinkFlag; - // AString LinkName; ????? - char Magic[8]; - UInt32 NumLinks; - UInt32 DevMajor; - UInt32 DevMinor; - UInt32 RDevMajor; - UInt32 RDevMinor; - UInt32 ChkSum; - - UInt32 Align; - - bool IsDirectory() const -#ifdef _WIN32 - { return (Mode & _S_IFMT) == _S_IFDIR; } -#else - { return (Mode & S_IFMT) == S_IFDIR; } -#endif -}; - -class CItemEx: public CItem -{ -public: - UInt64 HeaderPosition; - UInt32 HeaderSize; - UInt64 GetDataPosition() const { return HeaderPosition + HeaderSize; }; -}; - -}} - -#endif diff --git a/7zip/Archive/cpio/DllExports.cpp b/7zip/Archive/cpio/DllExports.cpp deleted file mode 100755 index 8eb38bfd..00000000 --- a/7zip/Archive/cpio/DllExports.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "CpioHandler.h" -#include "../../ICoder.h" - -// {23170F69-40C1-278A-1000-000110ED0000} -DEFINE_GUID(CLSID_CCpioHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0xED, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /*lpReserved*/) -{ - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CCpioHandler) - return CLASS_E_CLASSNOTAVAILABLE; - if (*interfaceID != IID_IInArchive) - return E_NOINTERFACE; - CMyComPtr inArchive = (IInArchive *)new NArchive::NCpio::CHandler; - *outObject = inArchive.Detach(); - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Cpio"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CCpioHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"cpio"; - break; - case NArchive::kUpdate: - propVariant = false; - break; - case NArchive::kKeepName: - propVariant = false; - break; - } - propVariant.Detach(value); - return S_OK; -} diff --git a/7zip/Archive/cpio/StdAfx.cpp b/7zip/Archive/cpio/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Archive/cpio/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Archive/cpio/StdAfx.h b/7zip/Archive/cpio/StdAfx.h deleted file mode 100755 index e7fb6986..00000000 --- a/7zip/Archive/cpio/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Archive/cpio/cpio.dsp b/7zip/Archive/cpio/cpio.dsp deleted file mode 100755 index f30c3e63..00000000 --- a/7zip/Archive/cpio/cpio.dsp +++ /dev/null @@ -1,265 +0,0 @@ -# Microsoft Developer Studio Project File - Name="cpio" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=cpio - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "cpio.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "cpio.mak" CFG="cpio - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "cpio - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "cpio - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "cpio - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CPIO_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CPIO_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\cpio.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "cpio - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CPIO_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CPIO_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\cpio.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "cpio - Win32 Release" -# Name "cpio - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\cpio.ico -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\CpioHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\CpioHandler.h -# End Source File -# Begin Source File - -SOURCE=.\CpioHeader.cpp -# End Source File -# Begin Source File - -SOURCE=.\CpioHeader.h -# End Source File -# Begin Source File - -SOURCE=.\CpioIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\CpioIn.h -# End Source File -# Begin Source File - -SOURCE=.\CpioItem.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.h -# End Source File -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# End Target -# End Project diff --git a/7zip/Archive/cpio/cpio.dsw b/7zip/Archive/cpio/cpio.dsw deleted file mode 100755 index b1b6d98f..00000000 --- a/7zip/Archive/cpio/cpio.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "cpio"=.\cpio.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Archive/cpio/cpio.ico b/7zip/Archive/cpio/cpio.ico deleted file mode 100755 index 9abaabc7..00000000 Binary files a/7zip/Archive/cpio/cpio.ico and /dev/null differ diff --git a/7zip/Archive/cpio/resource.rc b/7zip/Archive/cpio/resource.rc deleted file mode 100755 index d5456e5a..00000000 --- a/7zip/Archive/cpio/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Cpio Plugin", "cpio") - -101 ICON "cpio.ico" diff --git a/7zip/Archive/makefile b/7zip/Archive/makefile deleted file mode 100755 index 7512ad56..00000000 --- a/7zip/Archive/makefile +++ /dev/null @@ -1,23 +0,0 @@ -DIRS = \ - 7z\~ \ - Arj\~ \ - BZip2\~ \ - Cab\~ \ - Chm\~ \ - Cpio\~ \ - Deb\~ \ - GZip\~ \ - Iso\~ \ - Lzh\~ \ - Nsis\~ \ - Rar\~ \ - RPM\~ \ - Split\~ \ - Tar\~ \ - Z\~ \ - Zip\~ \ - -all: $(DIRS) - -$(DIRS): -!include "../SubBuild.mak" diff --git a/7zip/Bundles/Alone/Alone.dsp b/7zip/Bundles/Alone/Alone.dsp deleted file mode 100755 index 42ce825c..00000000 --- a/7zip/Bundles/Alone/Alone.dsp +++ /dev/null @@ -1,2201 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Alone" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=Alone - Win32 DebugU -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Alone.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Alone.mak" CFG="Alone - Win32 DebugU" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Alone - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "Alone - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE "Alone - Win32 ReleaseU" (based on "Win32 (x86) Console Application") -!MESSAGE "Alone - Win32 DebugU" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Alone - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /Gz /MT /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "FORMAT_Z" /D "FORMAT_SPLIT" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_MT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_DEFLATE64" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_MT" /Yu"StdAfx.h" /FD /c -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"c:\UTIL\7za.exe" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "FORMAT_Z" /D "FORMAT_SPLIT" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_MT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_DEFLATE64" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_MT" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"c:\UTIL\7za.exe" /pdbtype:sept - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ReleaseU" -# PROP BASE Intermediate_Dir "ReleaseU" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ReleaseU" -# PROP Intermediate_Dir "ReleaseU" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_PAT" /D "COMPRESS_MF_BT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /Yu"StdAfx.h" /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "FORMAT_Z" /D "FORMAT_SPLIT" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_MT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_DEFLATE64" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_MT" /Yu"StdAfx.h" /FD /c -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"c:\UTIL\7za.exe" /opt:NOWIN98 -# SUBTRACT BASE LINK32 /pdb:none -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"c:\UTIL\7zan.exe" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "DebugU" -# PROP BASE Intermediate_Dir "DebugU" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "DebugU" -# PROP Intermediate_Dir "DebugU" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_PAT" /D "COMPRESS_MF_BT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /D "_MBCS" /Yu"StdAfx.h" /FD /GZ /c -# ADD CPP /nologo /Gz /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "FORMAT_Z" /D "FORMAT_SPLIT" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_MT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_DEFLATE64" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_MT" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"c:\UTIL\7za.exe" /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"c:\UTIL\7zan.exe" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Alone - Win32 Release" -# Name "Alone - Win32 Debug" -# Name "Alone - Win32 ReleaseU" -# Name "Alone - Win32 DebugU" -# Begin Group "Console" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\UI\Console\ArError.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\CompressionMode.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\ConsoleClose.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\ConsoleClose.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\ExtractCallbackConsole.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\ExtractCallbackConsole.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\List.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\List.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\Main.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\MainAr.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\OpenCallbackConsole.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\OpenCallbackConsole.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\PercentPrinter.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\PercentPrinter.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\UpdateCallbackConsole.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\UpdateCallbackConsole.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\UserInputUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\UserInputUtils.h -# End Source File -# End Group -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\AlignedBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\AlignedBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\AutoPtr.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CommandLineParser.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CommandLineParser.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\ComTry.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Defs.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\DynamicBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Exception.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\ListFileUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\ListFileUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\MyCom.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\MyGuidDef.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\MyInitGuid.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\MyUnknown.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\MyWindows.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\MyWindows.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Random.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Random.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StdInStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StdInStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StdOutStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StdOutStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Types.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\UTFConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\UTFConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Wildcard.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Wildcard.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\Defs.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Device.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Error.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Error.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileDir.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileDir.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileIO.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileIO.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileName.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileName.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Handle.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\MemoryLock.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\MemoryLock.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariantConversions.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariantConversions.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Thread.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Time.h -# End Source File -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Archive\Common\CrossThreadProgress.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CrossThreadProgress.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\FilePathAutoRename.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\FilePathAutoRename.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\FileStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\FileStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InOutTempBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InOutTempBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LockedStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LockedStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LSBFDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LSBFDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LSBFEncoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LSBFEncoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\MemBlocks.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\MSBFDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\MSBFEncoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OffsetStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OffsetStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutMemStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutMemStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressMt.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressMt.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamBinder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamBinder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Group "Branch" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Branch\BranchCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\BranchCoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\Coder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\x86.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\x86.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\x86_2.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\x86_2.h -# End Source File -# End Group -# Begin Group "BZip2" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\BZip2\BZip2CRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\BZip2\BZip2CRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\BZip2\BZip2Decoder.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\BZip2\BZip2Decoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\BZip2\BZip2Encoder.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\BZip2\BZip2Encoder.h -# End Source File -# End Group -# Begin Group "Copy" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "Deflate" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Deflate\DeflateConst.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Deflate\DeflateDecoder.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Deflate\DeflateDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Deflate\DeflateEncoder.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Deflate\DeflateEncoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Deflate\DeflateExtConst.h -# End Source File -# End Group -# Begin Group "Huffman" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Huffman\HuffmanDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Huffman\HuffmanEncoder.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Huffman\HuffmanEncoder.h -# End Source File -# End Group -# Begin Group "Implode" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Implode\ImplodeDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Implode\ImplodeDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Implode\ImplodeHuffmanDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Implode\ImplodeHuffmanDecoder.h -# End Source File -# End Group -# Begin Group "LZ" - -# PROP Default_Filter "" -# Begin Group "MT" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZ\MT\MT.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\MT\MT.h -# End Source File -# End Group -# Begin Group "HC" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZ\HashChain\HC.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\HashChain\HC2.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\HashChain\HC3.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\HashChain\HC4.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\HashChain\HC4b.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\HashChain\HCMain.h -# End Source File -# End Group -# Begin Source File - -SOURCE=..\..\Compress\LZ\IMatchFinder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZInWindow.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O1 - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O1 - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZInWindow.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O1 - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O1 - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.h -# End Source File -# End Group -# Begin Group "LZMA" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZMA\LZMA.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZMA\LZMADecoder.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZMA\LZMADecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZMA\LZMAEncoder.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZMA\LZMAEncoder.h -# End Source File -# End Group -# Begin Group "PPMd" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDContext.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDDecode.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDDecoder.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDEncode.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDEncoder.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDEncoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDSubAlloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDType.h -# End Source File -# End Group -# Begin Group "RangeCoder" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\RangeCoder\RangeCoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\RangeCoder\RangeCoderBit.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O1 - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O1 - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\RangeCoder\RangeCoderBit.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\RangeCoder\RangeCoderBitTree.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\RangeCoder\RangeCoderOpt.h -# End Source File -# End Group -# Begin Group "Shrink" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Shrink\ShrinkDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Shrink\ShrinkDecoder.h -# End Source File -# End Group -# Begin Group "Z" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Z\ZDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Z\ZDecoder.h -# End Source File -# End Group -# Begin Group "BWT" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\BWT\BlockSort.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\BWT\BlockSort.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\BWT\Mtf8.h -# End Source File -# End Group -# End Group -# Begin Group "Archive" - -# PROP Default_Filter "" -# Begin Group "7z" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Archive\7z\7zCompressionMode.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zCompressionMode.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zDecode.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zDecode.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zEncode.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zEncode.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zExtract.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zFolderInStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zFolderInStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zFolderOutStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zFolderOutStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHandlerOut.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHeader.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHeader.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zIn.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zIn.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zItem.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zMethodID.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zMethodID.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zOut.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zOut.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zProperties.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zProperties.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zSpecStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zSpecStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zUpdate.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zUpdate.h -# End Source File -# End Group -# Begin Group "bz2" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Archive\BZip2\BZip2Handler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\BZip2\BZip2Handler.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\BZip2\BZip2HandlerOut.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\BZip2\BZip2Item.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\BZip2\BZip2Update.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\BZip2\BZip2Update.h -# End Source File -# End Group -# Begin Group "gz" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Archive\GZip\GZipHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\GZip\GZipHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\GZip\GZipHandlerOut.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\GZip\GZipHeader.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\GZip\GZipHeader.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\GZip\GZipIn.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\GZip\GZipIn.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\GZip\GZipItem.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\GZip\GZipOut.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\GZip\GZipOut.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\GZip\GZipUpdate.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\GZip\GZipUpdate.h -# End Source File -# End Group -# Begin Group "tar" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Archive\Tar\TarHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Tar\TarHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Tar\TarHandlerOut.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Tar\TarHeader.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Tar\TarHeader.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Tar\TarIn.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Tar\TarIn.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Tar\TarItem.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Tar\TarOut.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Tar\TarOut.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Tar\TarUpdate.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Tar\TarUpdate.h -# End Source File -# End Group -# Begin Group "zip" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Archive\Zip\ZipAddCommon.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Zip\ZipAddCommon.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Zip\ZipCompressionMode.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Zip\ZipHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Zip\ZipHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Zip\ZipHandlerOut.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Zip\ZipHeader.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Zip\ZipHeader.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Zip\ZipIn.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Zip\ZipIn.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Zip\ZipItem.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Zip\ZipItem.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Zip\ZipItemEx.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Zip\ZipOut.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Zip\ZipOut.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Zip\ZipUpdate.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Zip\ZipUpdate.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2MT.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2MT.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2ST.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2ST.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\DummyOutStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\DummyOutStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\FilterCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\FilterCoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\InStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\InStreamWithCRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\ItemNameUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\MultiStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\MultiStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\OutStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\OutStreamWithCRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\ParseProperties.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\ParseProperties.h -# End Source File -# End Group -# Begin Group "split" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Archive\Split\SplitHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Split\SplitHandler.h -# End Source File -# End Group -# Begin Group "Z Format" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Archive\Z\ZHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Z\ZHandler.h -# End Source File -# End Group -# End Group -# Begin Group "UI Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiveCommandLine.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiveCommandLine.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiveExtractCallback.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiveExtractCallback.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiveOpenCallback.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiveOpenCallback.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiverInfo.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiverInfo.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\DefaultName.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\DefaultName.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\EnumDirItems.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\EnumDirItems.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\Extract.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\Extract.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ExtractingFilePath.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ExtractingFilePath.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\OpenArchive.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\OpenArchive.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\PropIDUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\PropIDUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\SetProperties.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\SetProperties.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\SortUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\SortUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\TempFiles.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\TempFiles.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\Update.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\Update.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\UpdateAction.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\UpdateAction.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\UpdateCallback.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\UpdateCallback.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\UpdatePair.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\UpdatePair.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\UpdateProduce.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\UpdateProduce.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\WorkDir.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\WorkDir.h -# End Source File -# End Group -# Begin Group "Crypto" - -# PROP Default_Filter "" -# Begin Group "Zip Crypto" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\Zip\ZipCipher.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O1 - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O1 - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Zip\ZipCipher.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Zip\ZipCrypto.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O1 - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O1 - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Zip\ZipCrypto.h -# End Source File -# End Group -# Begin Group "AES" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\AES\aes.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\AES_CBC.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\aescpp.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\aescrypt.c - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\aeskey.c - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\aesopt.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\aestab.c - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\MyAES.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\MyAES.h -# End Source File -# End Group -# Begin Group "7z AES" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\7zAES\7zAES.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\7zAES\7zAES.h -# End Source File -# End Group -# Begin Group "WzAES" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\WzAES\WzAES.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\WzAES\WzAES.h -# End Source File -# End Group -# Begin Group "Hash" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\Hash\HmacSha1.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\HmacSha1.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Pbkdf2HmacSha1.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Pbkdf2HmacSha1.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Sha1.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Sha1.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Sha256.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Sha256.h -# End Source File -# End Group -# End Group -# Begin Group "7-zip" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\ICoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\IMyUnknown.h -# End Source File -# Begin Source File - -SOURCE=..\..\IPassword.h -# End Source File -# Begin Source File - -SOURCE=..\..\IProgress.h -# End Source File -# Begin Source File - -SOURCE=..\..\IStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\PropID.h -# End Source File -# End Group -# End Target -# End Project diff --git a/7zip/Bundles/Alone/Alone.dsw b/7zip/Bundles/Alone/Alone.dsw deleted file mode 100755 index 65eca43f..00000000 --- a/7zip/Bundles/Alone/Alone.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Alone"=.\Alone.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Bundles/Alone/StdAfx.cpp b/7zip/Bundles/Alone/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Bundles/Alone/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Bundles/Alone/StdAfx.h b/7zip/Bundles/Alone/StdAfx.h deleted file mode 100755 index 2e4be10b..00000000 --- a/7zip/Bundles/Alone/StdAfx.h +++ /dev/null @@ -1,9 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" -#include "../../../Common/NewHandler.h" - -#endif diff --git a/7zip/Bundles/Alone/afxres.h b/7zip/Bundles/Alone/afxres.h deleted file mode 100755 index c2fadd4a..00000000 --- a/7zip/Bundles/Alone/afxres.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/7zip/Bundles/Alone/makefile b/7zip/Bundles/Alone/makefile deleted file mode 100755 index e14b1104..00000000 --- a/7zip/Bundles/Alone/makefile +++ /dev/null @@ -1,357 +0,0 @@ -PROG = 7za.exe -LIBS = $(LIBS) user32.lib oleaut32.lib Advapi32.lib - -CFLAGS = $(CFLAGS) -I ../../../ \ - -DEXCLUDE_COM \ - -DNO_REGISTRY \ - -DFORMAT_7Z \ - -DFORMAT_BZIP2 \ - -DFORMAT_GZIP \ - -DFORMAT_SPLIT \ - -DFORMAT_TAR \ - -DFORMAT_Z \ - -DFORMAT_ZIP \ - -DCOMPRESS_MT \ - -DCOMPRESS_BCJ_X86 \ - -DCOMPRESS_BCJ2 \ - -DCOMPRESS_BZIP2 \ - -DCOMPRESS_BZIP2_MT \ - -DCOMPRESS_COPY \ - -DCOMPRESS_DEFLATE \ - -DCOMPRESS_DEFLATE64 \ - -DCOMPRESS_IMPLODE \ - -DCOMPRESS_LZMA \ - -DCOMPRESS_MF_MT \ - -DCOMPRESS_PPMD \ - -DCRYPTO_7ZAES \ - -DCRYPTO_AES \ - -DCRYPTO_ZIP \ - - -CONSOLE_OBJS = \ - $O\ConsoleClose.obj \ - $O\ExtractCallbackConsole.obj \ - $O\List.obj \ - $O\Main.obj \ - $O\MainAr.obj \ - $O\OpenCallbackConsole.obj \ - $O\PercentPrinter.obj \ - $O\UpdateCallbackConsole.obj \ - $O\UserInputUtils.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\CommandLineParser.obj \ - $O\CRC.obj \ - $O\IntToString.obj \ - $O\ListFileUtils.obj \ - $O\NewHandler.obj \ - $O\StdInStream.obj \ - $O\StdOutStream.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\StringToInt.obj \ - $O\UTFConvert.obj \ - $O\Vector.obj \ - $O\Wildcard.obj \ - -WIN_OBJS = \ - $O\DLL.obj \ - $O\Error.obj \ - $O\FileDir.obj \ - $O\FileFind.obj \ - $O\FileIO.obj \ - $O\FileName.obj \ - $O\MemoryLock.obj \ - $O\PropVariant.obj \ - $O\PropVariantConversions.obj \ - $O\Synchronization.obj - -7ZIP_COMMON_OBJS = \ - $O\FilePathAutoRename.obj \ - $O\FileStreams.obj \ - $O\InBuffer.obj \ - $O\InOutTempBuffer.obj \ - $O\LimitedStreams.obj \ - $O\LockedStream.obj \ - $O\LSBFDecoder.obj \ - $O\LSBFEncoder.obj \ - $O\MemBlocks.obj \ - $O\OffsetStream.obj \ - $O\OutBuffer.obj \ - $O\OutMemStream.obj \ - $O\ProgressMt.obj \ - $O\ProgressUtils.obj \ - $O\StreamBinder.obj \ - $O\StreamObjects.obj \ - $O\StreamUtils.obj \ - -UI_COMMON_OBJS = \ - $O\ArchiveCommandLine.obj \ - $O\ArchiveExtractCallback.obj \ - $O\ArchiveOpenCallback.obj \ - $O\ArchiverInfo.obj \ - $O\DefaultName.obj \ - $O\EnumDirItems.obj \ - $O\Extract.obj \ - $O\ExtractingFilePath.obj \ - $O\OpenArchive.obj \ - $O\PropIDUtils.obj \ - $O\SetProperties.obj \ - $O\SortUtils.obj \ - $O\TempFiles.obj \ - $O\Update.obj \ - $O\UpdateAction.obj \ - $O\UpdateCallback.obj \ - $O\UpdatePair.obj \ - $O\UpdateProduce.obj \ - $O\WorkDir.obj \ - -AR_COMMON_OBJS = \ - $O\CoderMixer2.obj \ - $O\CoderMixer2MT.obj \ - $O\CrossThreadProgress.obj \ - $O\DummyOutStream.obj \ - $O\FilterCoder.obj \ - $O\InStreamWithCRC.obj \ - $O\ItemNameUtils.obj \ - $O\MultiStream.obj \ - $O\OutStreamWithCRC.obj \ - $O\ParseProperties.obj \ - - -7Z_OBJS = \ - $O\7zCompressionMode.obj \ - $O\7zDecode.obj \ - $O\7zEncode.obj \ - $O\7zExtract.obj \ - $O\7zFolderInStream.obj \ - $O\7zFolderOutStream.obj \ - $O\7zHandler.obj \ - $O\7zHandlerOut.obj \ - $O\7zHeader.obj \ - $O\7zIn.obj \ - $O\7zMethodID.obj \ - $O\7zOut.obj \ - $O\7zProperties.obj \ - $O\7zSpecStream.obj \ - $O\7zUpdate.obj \ - -BZ2_OBJS = \ - $O\BZip2Handler.obj \ - $O\BZip2HandlerOut.obj \ - $O\BZip2Update.obj \ - -GZ_OBJS = \ - $O\GZipHandler.obj \ - $O\GZipHandlerOut.obj \ - $O\GZipHeader.obj \ - $O\GZipIn.obj \ - $O\GZipOut.obj \ - $O\GZipUpdate.obj \ - -SPLIT_OBJS = \ - $O\SplitHandler.obj \ - $O\SplitHandlerOut.obj \ - -TAR_OBJS = \ - $O\TarHandler.obj \ - $O\TarHandlerOut.obj \ - $O\TarHeader.obj \ - $O\TarIn.obj \ - $O\TarOut.obj \ - $O\TarUpdate.obj \ - -Z_OBJS = \ - $O\ZHandler.obj \ - -ZIP_OBJS = \ - $O\ZipAddCommon.obj \ - $O\ZipHandler.obj \ - $O\ZipHandlerOut.obj \ - $O\ZipHeader.obj \ - $O\ZipIn.obj \ - $O\ZipItem.obj \ - $O\ZipOut.obj \ - $O\ZipUpdate.obj \ - - -BRANCH_OPT_OBJS = \ - $O\BranchCoder.obj \ - $O\x86.obj \ - $O\x86_2.obj \ - -BZIP2_OBJS = \ - $O\BZip2CRC.obj \ - -BZIP2_OPT_OBJS = \ - $O\BZip2Decoder.obj \ - $O\BZip2Encoder.obj \ - -DEFLATE_OPT_OBJS = \ - $O\DeflateDecoder.obj \ - $O\DeflateEncoder.obj \ - -LZ_OBJS = \ - $O\LZInWindow.obj \ - $O\LZOutWindow.obj \ - -LZMA_OPT_OBJS = \ - $O\LZMADecoder.obj \ - $O\LZMAEncoder.obj \ - -IMPLODE_OBJS = \ - $O\ImplodeDecoder.obj \ - $O\ImplodeHuffmanDecoder.obj \ - -PPMD_OPT_OBJS = \ - $O\PPMDDecoder.obj \ - $O\PPMDEncoder.obj \ - -SHRINK_OBJS = \ - $O\ShrinkDecoder.obj \ - -COMPRESS_Z_OBJS = \ - $O\ZDecoder.obj \ - - -7ZAES_OPT_OBJS = \ - $O\7zAES.obj \ - -AES_OPT_OBJS = \ - $O\MyAES.obj \ - -AES_ORIG_OBJS = \ - $O\aescrypt.obj \ - $O\aeskey.obj \ - $O\aestab.obj \ - -CRYPTO_HASH_OBJS = \ - $O\HmacSha1.obj \ - $O\Pbkdf2HmacSha1.obj \ - $O\RandGen.obj \ - $O\Sha1.obj \ - $O\Sha256.obj \ - -CRYPTO_WZAES_OBJS = \ - $O\WzAES.obj \ - -CRYPTO_ZIP_OBJS = \ - $O\ZipCipher.obj \ - $O\ZipCrypto.obj \ - - -OBJS = \ - $O\StdAfx.obj \ - $(CONSOLE_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(UI_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(7Z_OBJS) \ - $(BZ2_OBJS) \ - $(GZ_OBJS) \ - $(SPLIT_OBJS) \ - $(TAR_OBJS) \ - $(Z_OBJS) \ - $(ZIP_OBJS) \ - $(BZIP2_OBJS) \ - $(BZIP2_OPT_OBJS) \ - $(BRANCH_OPT_OBJS) \ - $(DEFLATE_OPT_OBJS) \ - $(IMPLODE_OBJS) \ - $(LZ_OBJS) \ - $(LZMA_OPT_OBJS) \ - $(PPMD_OPT_OBJS) \ - $(SHRINK_OBJS) \ - $(COMPRESS_Z_OBJS) \ - $O\BlockSort.obj \ - $O\CopyCoder.obj \ - $O\HuffmanEncoder.obj \ - $O\MT.obj \ - $O\RangeCoderBit.obj \ - $(7ZAES_OPT_OBJS) \ - $(AES_OPT_OBJS) \ - $(AES_ORIG_OBJS) \ - $(CRYPTO_HASH_OBJS) \ - $(CRYPTO_ZIP_OBJS) \ - $(CRYPTO_WZAES_OBJS) \ - $O\resource.res - - -!include "../../../Build.mak" - -$(CONSOLE_OBJS): ../../UI/Console/$(*B).cpp - $(COMPL) - -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(UI_COMMON_OBJS): ../../UI/Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../../Archive/Common/$(*B).cpp - $(COMPL) - -$(7Z_OBJS): ../../Archive/7z/$(*B).cpp - $(COMPL) -$(BZ2_OBJS): ../../Archive/BZip2/$(*B).cpp - $(COMPL) -$(GZ_OBJS): ../../Archive/GZip/$(*B).cpp - $(COMPL) -$(SPLIT_OBJS): ../../Archive/Split/$(*B).cpp - $(COMPL) -$(TAR_OBJS): ../../Archive/Tar/$(*B).cpp - $(COMPL) -$(Z_OBJS): ../../Archive/Z/$(*B).cpp - $(COMPL) -$(ZIP_OBJS): ../../Archive/Zip/$(*B).cpp - $(COMPL) - -$(BRANCH_OPT_OBJS): ../../Compress/Branch/$(*B).cpp - $(COMPL_O2) -$(BZIP2_OBJS): ../../Compress/BZip2/$(*B).cpp - $(COMPL) -$(BZIP2_OPT_OBJS): ../../Compress/BZip2/$(*B).cpp - $(COMPL_O2) -$(DEFLATE_OPT_OBJS): ../../Compress/Deflate/$(*B).cpp - $(COMPL_O2) -$(IMPLODE_OBJS): ../../Compress/Implode/$(*B).cpp - $(COMPL) -$(LZ_OBJS): ../../Compress/LZ/$(*B).cpp - $(COMPL) -$(LZMA_OPT_OBJS): ../../Compress/LZMA/$(*B).cpp - $(COMPL_O2) -$(PPMD_OPT_OBJS): ../../Compress/PPMD/$(*B).cpp - $(COMPL_O2) -$(SHRINK_OBJS): ../../Compress/Shrink/$(*B).cpp - $(COMPL) -$(COMPRESS_Z_OBJS): ../../Compress/Z/$(*B).cpp - $(COMPL) - -$O\BlockSort.obj: ../../Compress/BWT/$(*B).cpp - $(COMPL_O2) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) -$O\HuffmanEncoder.obj: ../../Compress/Huffman/$(*B).cpp - $(COMPL_O2) -$O\MT.obj: ../../Compress/LZ/MT/$(*B).cpp - $(COMPL_O2) -$O\RangeCoderBit.obj: ../../Compress/RangeCoder/$(*B).cpp - $(COMPL) - -$(AES_OPT_OBJS): ../../Crypto/AES/$(*B).cpp - $(COMPL_O2) -$(AES_ORIG_OBJS): ../../Crypto/AES/$(*B).c - $(COMPL_O2_W3) -$(7ZAES_OPT_OBJS): ../../Crypto/7zAES/$(*B).cpp - $(COMPL_O2) -$(CRYPTO_HASH_OBJS): ../../Crypto/Hash/$(*B).cpp - $(COMPL_O2) -$(CRYPTO_ZIP_OBJS): ../../Crypto/Zip/$(*B).cpp - $(COMPL) -$(CRYPTO_WZAES_OBJS): ../../Crypto/WzAES/$(*B).cpp - $(COMPL_O2) diff --git a/7zip/Bundles/Alone/resource.rc b/7zip/Bundles/Alone/resource.rc deleted file mode 100755 index fc9063c1..00000000 --- a/7zip/Bundles/Alone/resource.rc +++ /dev/null @@ -1,3 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_APP("7-Zip Standalone Console", "7za") diff --git a/7zip/Bundles/Alone7z/Alone.dsp b/7zip/Bundles/Alone7z/Alone.dsp deleted file mode 100755 index 758fb198..00000000 --- a/7zip/Bundles/Alone7z/Alone.dsp +++ /dev/null @@ -1,1366 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Alone" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=Alone - Win32 DebugU -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Alone.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Alone.mak" CFG="Alone - Win32 DebugU" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Alone - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "Alone - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE "Alone - Win32 ReleaseU" (based on "Win32 (x86) Console Application") -!MESSAGE "Alone - Win32 DebugU" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Alone - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /Gz /MT /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMFORMAT_SPLIT" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /c -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"c:\UTIL\7za.exe" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMFORMAT_SPLIT" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"c:\UTIL\7za.exe" /pdbtype:sept - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ReleaseU" -# PROP BASE Intermediate_Dir "ReleaseU" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ReleaseU" -# PROP Intermediate_Dir "ReleaseU" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_PAT" /D "COMPRESS_MF_BT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /Yu"StdAfx.h" /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMFORMAT_SPLIT" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /c -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"c:\UTIL\7za.exe" /opt:NOWIN98 -# SUBTRACT BASE LINK32 /pdb:none -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"c:\UTIL\7zan.exe" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "DebugU" -# PROP BASE Intermediate_Dir "DebugU" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "DebugU" -# PROP Intermediate_Dir "DebugU" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_PAT" /D "COMPRESS_MF_BT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /D "_MBCS" /Yu"StdAfx.h" /FD /GZ /c -# ADD CPP /nologo /Gz /W4 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMFORMAT_SPLIT" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"c:\UTIL\7za.exe" /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"c:\UTIL\7zan.exe" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Alone - Win32 Release" -# Name "Alone - Win32 Debug" -# Name "Alone - Win32 ReleaseU" -# Name "Alone - Win32 DebugU" -# Begin Group "Console" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\UI\Console\ArError.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\CompressionMode.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\ConsoleClose.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\ConsoleClose.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\ExtractCallbackConsole.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\ExtractCallbackConsole.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\List.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\List.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\Main.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\MainAr.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\OpenCallbackConsole.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\OpenCallbackConsole.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\PercentPrinter.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\PercentPrinter.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\UpdateCallbackConsole.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\UpdateCallbackConsole.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\UserInputUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\UserInputUtils.h -# End Source File -# End Group -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\AlignedBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\AlignedBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\AutoPtr.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CommandLineParser.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CommandLineParser.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\ComTry.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Defs.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\DynamicBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Exception.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\ListFileUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\ListFileUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\MyCom.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\MyGuidDef.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\MyInitGuid.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\MyUnknown.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\MyWindows.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\MyWindows.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Random.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Random.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StdInStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StdInStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StdOutStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StdOutStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Types.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\UTFConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\UTFConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Wildcard.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Wildcard.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\Defs.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Device.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Error.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Error.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileDir.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileDir.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileIO.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileIO.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileName.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileName.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Handle.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\MemoryLock.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\MemoryLock.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariantConversions.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariantConversions.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Thread.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Time.h -# End Source File -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Archive\Common\CrossThreadProgress.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CrossThreadProgress.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\FilePathAutoRename.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\FilePathAutoRename.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\FileStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\FileStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InOutTempBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InOutTempBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LockedStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LockedStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LSBFDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LSBFDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LSBFEncoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LSBFEncoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\MSBFDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\MSBFEncoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OffsetStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OffsetStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutMemStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutMemStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressMt.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressMt.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamBinder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamBinder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Group "Branch" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Branch\BranchCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\BranchCoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\Coder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\x86.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\x86.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\x86_2.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\x86_2.h -# End Source File -# End Group -# Begin Group "Copy" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "LZ" - -# PROP Default_Filter "" -# Begin Group "MT" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZ\MT\MT.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\MT\MT.h -# End Source File -# End Group -# Begin Group "HC" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZ\HashChain\HC.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\HashChain\HC2.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\HashChain\HC3.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\HashChain\HC4.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\HashChain\HC4b.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\HashChain\HCMain.h -# End Source File -# End Group -# Begin Source File - -SOURCE=..\..\Compress\LZ\IMatchFinder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZInWindow.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O1 - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O1 - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZInWindow.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O1 - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O1 - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.h -# End Source File -# End Group -# Begin Group "LZMA" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZMA\LZMA.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZMA\LZMADecoder.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZMA\LZMADecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZMA\LZMAEncoder.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZMA\LZMAEncoder.h -# End Source File -# End Group -# Begin Group "RangeCoder" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\RangeCoder\RangeCoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\RangeCoder\RangeCoderBit.cpp - -!IF "$(CFG)" == "Alone - Win32 Release" - -# ADD CPP /O1 - -!ELSEIF "$(CFG)" == "Alone - Win32 Debug" - -!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU" - -# ADD CPP /O1 - -!ELSEIF "$(CFG)" == "Alone - Win32 DebugU" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\RangeCoder\RangeCoderBit.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\RangeCoder\RangeCoderBitTree.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\RangeCoder\RangeCoderOpt.h -# End Source File -# End Group -# End Group -# Begin Group "Archive" - -# PROP Default_Filter "" -# Begin Group "7z" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Archive\7z\7zCompressionMode.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zCompressionMode.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zDecode.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zDecode.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zEncode.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zEncode.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zExtract.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zFolderInStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zFolderInStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zFolderOutStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zFolderOutStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHandlerOut.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHeader.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHeader.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zIn.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zIn.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zItem.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zMethodID.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zMethodID.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zOut.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zOut.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zProperties.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zProperties.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zSpecStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zSpecStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zUpdate.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zUpdate.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2MT.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2MT.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2ST.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2ST.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\DummyOutStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\DummyOutStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\FilterCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\FilterCoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\InStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\InStreamWithCRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\ItemNameUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\MultiStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\MultiStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\OutStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\OutStreamWithCRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\ParseProperties.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\ParseProperties.h -# End Source File -# End Group -# Begin Group "split" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Archive\Split\SplitHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Split\SplitHandler.h -# End Source File -# End Group -# End Group -# Begin Group "UI Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiveCommandLine.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiveCommandLine.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiveExtractCallback.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiveExtractCallback.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiveOpenCallback.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiveOpenCallback.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiverInfo.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiverInfo.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\DefaultName.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\DefaultName.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\EnumDirItems.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\EnumDirItems.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\Extract.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\Extract.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ExtractingFilePath.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ExtractingFilePath.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\OpenArchive.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\OpenArchive.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\PropIDUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\PropIDUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\SetProperties.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\SetProperties.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\SortUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\SortUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\TempFiles.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\TempFiles.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\Update.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\Update.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\UpdateAction.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\UpdateAction.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\UpdateCallback.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\UpdateCallback.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\UpdatePair.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\UpdatePair.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\UpdateProduce.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\UpdateProduce.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\WorkDir.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\WorkDir.h -# End Source File -# End Group -# Begin Group "7-zip" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\ICoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\IMyUnknown.h -# End Source File -# Begin Source File - -SOURCE=..\..\IPassword.h -# End Source File -# Begin Source File - -SOURCE=..\..\IProgress.h -# End Source File -# Begin Source File - -SOURCE=..\..\IStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\PropID.h -# End Source File -# End Group -# End Target -# End Project diff --git a/7zip/Bundles/Alone7z/Alone.dsw b/7zip/Bundles/Alone7z/Alone.dsw deleted file mode 100755 index 65eca43f..00000000 --- a/7zip/Bundles/Alone7z/Alone.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Alone"=.\Alone.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Bundles/Alone7z/StdAfx.cpp b/7zip/Bundles/Alone7z/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Bundles/Alone7z/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Bundles/Alone7z/StdAfx.h b/7zip/Bundles/Alone7z/StdAfx.h deleted file mode 100755 index 2e4be10b..00000000 --- a/7zip/Bundles/Alone7z/StdAfx.h +++ /dev/null @@ -1,9 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" -#include "../../../Common/NewHandler.h" - -#endif diff --git a/7zip/Bundles/Alone7z/makefile b/7zip/Bundles/Alone7z/makefile deleted file mode 100755 index 465f7005..00000000 --- a/7zip/Bundles/Alone7z/makefile +++ /dev/null @@ -1,183 +0,0 @@ -PROG = 7za.exe -LIBS = $(LIBS) user32.lib oleaut32.lib Advapi32.lib - -CFLAGS = $(CFLAGS) -I ../../../ \ - -DEXCLUDE_COM \ - -DNO_REGISTRY \ - -D_NO_CRYPTO \ - -DFORMAT_7Z \ - -DCOMPRESS_MT \ - -DCOMPRESS_BCJ_X86 \ - -DCOMPRESS_BCJ2 \ - -DCOMPRESS_COPY \ - -DCOMPRESS_LZMA \ - -DCOMPRESS_MF_MT \ - - -CONSOLE_OBJS = \ - $O\ConsoleClose.obj \ - $O\ExtractCallbackConsole.obj \ - $O\List.obj \ - $O\Main.obj \ - $O\MainAr.obj \ - $O\OpenCallbackConsole.obj \ - $O\PercentPrinter.obj \ - $O\UpdateCallbackConsole.obj \ - $O\UserInputUtils.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\CommandLineParser.obj \ - $O\CRC.obj \ - $O\IntToString.obj \ - $O\ListFileUtils.obj \ - $O\NewHandler.obj \ - $O\Random.obj \ - $O\StdInStream.obj \ - $O\StdOutStream.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\StringToInt.obj \ - $O\UTFConvert.obj \ - $O\Vector.obj \ - $O\Wildcard.obj \ - -WIN_OBJS = \ - $O\DLL.obj \ - $O\Error.obj \ - $O\FileDir.obj \ - $O\FileFind.obj \ - $O\FileIO.obj \ - $O\FileName.obj \ - $O\MemoryLock.obj \ - $O\PropVariant.obj \ - $O\PropVariantConversions.obj \ - $O\Synchronization.obj - -7ZIP_COMMON_OBJS = \ - $O\FilePathAutoRename.obj \ - $O\FileStreams.obj \ - $O\InBuffer.obj \ - $O\InOutTempBuffer.obj \ - $O\LimitedStreams.obj \ - $O\LockedStream.obj \ - $O\OffsetStream.obj \ - $O\OutBuffer.obj \ - $O\ProgressUtils.obj \ - $O\StreamBinder.obj \ - $O\StreamObjects.obj \ - $O\StreamUtils.obj \ - -UI_COMMON_OBJS = \ - $O\ArchiveCommandLine.obj \ - $O\ArchiveExtractCallback.obj \ - $O\ArchiveOpenCallback.obj \ - $O\ArchiverInfo.obj \ - $O\DefaultName.obj \ - $O\EnumDirItems.obj \ - $O\Extract.obj \ - $O\ExtractingFilePath.obj \ - $O\OpenArchive.obj \ - $O\PropIDUtils.obj \ - $O\SetProperties.obj \ - $O\SortUtils.obj \ - $O\TempFiles.obj \ - $O\Update.obj \ - $O\UpdateAction.obj \ - $O\UpdateCallback.obj \ - $O\UpdatePair.obj \ - $O\UpdateProduce.obj \ - $O\WorkDir.obj \ - -AR_COMMON_OBJS = \ - $O\CoderMixer2.obj \ - $O\CoderMixer2MT.obj \ - $O\CrossThreadProgress.obj \ - $O\DummyOutStream.obj \ - $O\FilterCoder.obj \ - $O\InStreamWithCRC.obj \ - $O\ItemNameUtils.obj \ - $O\MultiStream.obj \ - $O\OutStreamWithCRC.obj \ - $O\ParseProperties.obj \ - - -7Z_OBJS = \ - $O\7zCompressionMode.obj \ - $O\7zDecode.obj \ - $O\7zEncode.obj \ - $O\7zExtract.obj \ - $O\7zFolderInStream.obj \ - $O\7zFolderOutStream.obj \ - $O\7zHandler.obj \ - $O\7zHandlerOut.obj \ - $O\7zHeader.obj \ - $O\7zIn.obj \ - $O\7zMethodID.obj \ - $O\7zOut.obj \ - $O\7zProperties.obj \ - $O\7zSpecStream.obj \ - $O\7zUpdate.obj \ - - -BRANCH_OPT_OBJS = \ - $O\BranchCoder.obj \ - $O\x86.obj \ - $O\x86_2.obj \ - -LZ_OBJS = \ - $O\LZInWindow.obj \ - $O\LZOutWindow.obj \ - -LZMA_OPT_OBJS = \ - $O\LZMADecoder.obj \ - $O\LZMAEncoder.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(CONSOLE_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(UI_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(7Z_OBJS) \ - $(BRANCH_OPT_OBJS) \ - $(LZ_OBJS) \ - $(LZMA_OPT_OBJS) \ - $O\CopyCoder.obj \ - $O\MT.obj \ - $O\RangeCoderBit.obj \ - $O\resource.res - - -!include "../../../Build.mak" - -$(CONSOLE_OBJS): ../../UI/Console/$(*B).cpp - $(COMPL) - -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(UI_COMMON_OBJS): ../../UI/Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../../Archive/Common/$(*B).cpp - $(COMPL) - -$(7Z_OBJS): ../../Archive/7z/$(*B).cpp - $(COMPL) -$(BRANCH_OPT_OBJS): ../../Compress/Branch/$(*B).cpp - $(COMPL_O2) -$(LZ_OBJS): ../../Compress/LZ/$(*B).cpp - $(COMPL) -$(LZMA_OPT_OBJS): ../../Compress/LZMA/$(*B).cpp - $(COMPL_O2) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) -$O\MT.obj: ../../Compress/LZ/MT/$(*B).cpp - $(COMPL_O2) -$O\RangeCoderBit.obj: ../../Compress/RangeCoder/$(*B).cpp - $(COMPL) diff --git a/7zip/Bundles/Alone7z/resource.rc b/7zip/Bundles/Alone7z/resource.rc deleted file mode 100755 index fc9063c1..00000000 --- a/7zip/Bundles/Alone7z/resource.rc +++ /dev/null @@ -1,3 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_APP("7-Zip Standalone Console", "7za") diff --git a/7zip/Bundles/Format7z/Format7z.dsp b/7zip/Bundles/Format7z/Format7z.dsp deleted file mode 100755 index 05a1b1fb..00000000 --- a/7zip/Bundles/Format7z/Format7z.dsp +++ /dev/null @@ -1,957 +0,0 @@ -# Microsoft Developer Studio Project File - Name="7z" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=7z - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Format7z.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Format7z.mak" CFG="7z - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "7z - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "7z - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "7z - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MT /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_MT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE_DECODER" /D "COMPRESS_BZIP2_DECODER" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_MT" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\7za.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none /debug - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\SDK" /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_MT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE_DECODER" /D "COMPRESS_BZIP2_DECODER" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_MT" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\7za.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "7z - Win32 Release" -# Name "7z - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Archive\7z\7z.ico -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Archive.def -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Wildcard.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Wildcard.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\FileDir.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileDir.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileIO.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileIO.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.h -# End Source File -# End Group -# Begin Group "Archive common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2MT.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2MT.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CrossThreadProgress.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CrossThreadProgress.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\FilterCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\FilterCoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\InStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\InStreamWithCRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\ItemNameUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\OutStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\OutStreamWithCRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\ParseProperties.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\ParseProperties.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Group "LZ" - -# PROP Default_Filter "" -# Begin Group "MT" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZ\MT\MT.cpp - -!IF "$(CFG)" == "7z - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\MT\MT.h -# End Source File -# End Group -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZInWindow.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZInWindow.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.h -# End Source File -# End Group -# Begin Group "PPMD" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDContext.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDDecode.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDDecoder.cpp - -!IF "$(CFG)" == "7z - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDEncode.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDEncoder.cpp - -!IF "$(CFG)" == "7z - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDEncoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDSubAlloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDType.h -# End Source File -# End Group -# Begin Group "Branch" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Branch\BranchCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\BranchCoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\x86.cpp - -!IF "$(CFG)" == "7z - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\x86.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\x86_2.cpp - -!IF "$(CFG)" == "7z - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\x86_2.h -# End Source File -# End Group -# Begin Group "LZMA" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZMA\LZMA.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZMA\LZMADecoder.cpp - -!IF "$(CFG)" == "7z - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZMA\LZMADecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZMA\LZMAEncoder.cpp - -!IF "$(CFG)" == "7z - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZMA\LZMAEncoder.h -# End Source File -# End Group -# Begin Group "Copy" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "RangeCoder" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\RangeCoder\RangeCoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\RangeCoder\RangeCoderBit.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\RangeCoder\RangeCoderBit.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\RangeCoder\RangeCoderBitTree.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\RangeCoder\RangeCoderOpt.h -# End Source File -# End Group -# Begin Group "Deflate" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Deflate\DeflateConst.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Deflate\DeflateDecoder.cpp - -!IF "$(CFG)" == "7z - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Deflate\DeflateDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Deflate\DeflateExtConst.h -# End Source File -# End Group -# Begin Group "BZip2" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\BZip2\BZip2Const.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\BZip2\BZip2CRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\BZip2\BZip2CRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\BZip2\BZip2Decoder.cpp - -!IF "$(CFG)" == "7z - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\BZip2\BZip2Decoder.h -# End Source File -# End Group -# End Group -# Begin Group "Crypto" - -# PROP Default_Filter "" -# Begin Group "AES" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\AES\aes.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\AES_CBC.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\aescpp.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\aescrypt.c - -!IF "$(CFG)" == "7z - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\aeskey.c - -!IF "$(CFG)" == "7z - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\aesopt.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\aestab.c - -!IF "$(CFG)" == "7z - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\MyAES.cpp - -!IF "$(CFG)" == "7z - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\MyAES.h -# End Source File -# End Group -# Begin Group "7zAES" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\7zAES\7zAES.cpp - -!IF "$(CFG)" == "7z - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\7zAES\7zAES.h -# End Source File -# End Group -# Begin Group "Hash" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Sha256.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Sha256.h -# End Source File -# End Group -# End Group -# Begin Group "7z" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Archive\7z\7zCompressionMode.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zCompressionMode.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zDecode.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zDecode.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zEncode.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zEncode.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zExtract.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zFolderInStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zFolderInStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zFolderOutStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zFolderOutStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHandlerOut.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHeader.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHeader.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zIn.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zIn.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zItem.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zMethodID.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zMethodID.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zMethods.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zOut.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zOut.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zProperties.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zProperties.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zSpecStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zSpecStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zUpdate.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zUpdate.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zUpdateItem.h -# End Source File -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InOutTempBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InOutTempBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LockedStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LockedStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LSBFDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LSBFDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamBinder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamBinder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# End Target -# End Project diff --git a/7zip/Bundles/Format7z/Format7z.dsw b/7zip/Bundles/Format7z/Format7z.dsw deleted file mode 100755 index 324dab1f..00000000 --- a/7zip/Bundles/Format7z/Format7z.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "7z"=.\Format7z.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Bundles/Format7z/StdAfx.cpp b/7zip/Bundles/Format7z/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Bundles/Format7z/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Bundles/Format7z/StdAfx.h b/7zip/Bundles/Format7z/StdAfx.h deleted file mode 100755 index 2e4be10b..00000000 --- a/7zip/Bundles/Format7z/StdAfx.h +++ /dev/null @@ -1,9 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" -#include "../../../Common/NewHandler.h" - -#endif diff --git a/7zip/Bundles/Format7z/makefile b/7zip/Bundles/Format7z/makefile deleted file mode 100755 index 90d68362..00000000 --- a/7zip/Bundles/Format7z/makefile +++ /dev/null @@ -1,190 +0,0 @@ -PROG = 7za.dll -DEF_FILE = ../../Archive/Archive.def -LIBS = $(LIBS) user32.lib oleaut32.lib -CFLAGS = $(CFLAGS) -I ../../../ \ - -DEXCLUDE_COM \ - -DNO_REGISTRY \ - -DFORMAT_7Z \ - -DCOMPRESS_MT \ - -DCOMPRESS_BCJ_X86 \ - -DCOMPRESS_BCJ2 \ - -DCOMPRESS_BZIP2_DECODER \ - -DCOMPRESS_BZIP2_MT \ - -DCOMPRESS_COPY \ - -DCOMPRESS_DEFLATE_DECODER \ - -DCOMPRESS_LZMA \ - -DCOMPRESS_MF_MT \ - -DCOMPRESS_PPMD \ - -DCRYPTO_7ZAES \ - -DCRYPTO_AES \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\CRC.obj \ - $O\IntToString.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\StringToInt.obj \ - $O\Vector.obj \ - $O\Wildcard.obj \ - -WIN_OBJS = \ - $O\FileDir.obj \ - $O\FileFind.obj \ - $O\FileIO.obj \ - $O\PropVariant.obj \ - $O\Synchronization.obj - -7ZIP_COMMON_OBJS = \ - $O\InBuffer.obj \ - $O\InOutTempBuffer.obj \ - $O\LimitedStreams.obj \ - $O\LockedStream.obj \ - $O\LSBFDecoder.obj \ - $O\OutBuffer.obj \ - $O\ProgressUtils.obj \ - $O\StreamBinder.obj \ - $O\StreamObjects.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\CoderMixer2.obj \ - $O\CoderMixer2MT.obj \ - $O\CrossThreadProgress.obj \ - $O\FilterCoder.obj \ - $O\InStreamWithCRC.obj \ - $O\ItemNameUtils.obj \ - $O\OutStreamWithCRC.obj \ - $O\ParseProperties.obj \ - - -7Z_OBJS = \ - $O\DllExports.obj \ - $O\7zCompressionMode.obj \ - $O\7zDecode.obj \ - $O\7zEncode.obj \ - $O\7zExtract.obj \ - $O\7zFolderInStream.obj \ - $O\7zFolderOutStream.obj \ - $O\7zHandler.obj \ - $O\7zHandlerOut.obj \ - $O\7zHeader.obj \ - $O\7zIn.obj \ - $O\7zMethodID.obj \ - $O\7zOut.obj \ - $O\7zProperties.obj \ - $O\7zSpecStream.obj \ - $O\7zUpdate.obj \ - - -BRANCH_OPT_OBJS = \ - $O\BranchCoder.obj \ - $O\x86.obj \ - $O\x86_2.obj \ - -BZIP2_OBJS = \ - $O\BZip2CRC.obj \ - -BZIP2_OPT_OBJS = \ - $O\BZip2Decoder.obj \ - -DEFLATE_OPT_OBJS = \ - $O\DeflateDecoder.obj \ - -LZ_OBJS = \ - $O\LZInWindow.obj \ - $O\LZOutWindow.obj \ - -LZMA_OPT_OBJS = \ - $O\LZMADecoder.obj \ - $O\LZMAEncoder.obj \ - -PPMD_OPT_OBJS = \ - $O\PPMDDecoder.obj \ - $O\PPMDEncoder.obj \ - - -7ZAES_OPT_OBJS = \ - $O\7zAES.obj \ - -AES_OPT_OBJS = \ - $O\MyAES.obj \ - -AES_ORIG_OBJS = \ - $O\aescrypt.obj \ - $O\aeskey.obj \ - $O\aestab.obj \ - -CRYPTO_HASH_OBJS = \ - $O\Sha256.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(CONSOLE_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(7Z_OBJS) \ - $(BZIP2_OBJS) \ - $(BZIP2_OPT_OBJS) \ - $(BRANCH_OPT_OBJS) \ - $(DEFLATE_OPT_OBJS) \ - $(LZ_OBJS) \ - $(LZMA_OPT_OBJS) \ - $(PPMD_OPT_OBJS) \ - $O\CopyCoder.obj \ - $O\MT.obj \ - $O\RangeCoderBit.obj \ - $(7ZAES_OPT_OBJS) \ - $(AES_OPT_OBJS) \ - $(AES_ORIG_OBJS) \ - $(CRYPTO_HASH_OBJS) \ - $O\resource.res - - -!include "../../../Build.mak" - -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../../Archive/Common/$(*B).cpp - $(COMPL) - -$(7Z_OBJS): ../../Archive/7z/$(*B).cpp - $(COMPL) - -$(BRANCH_OPT_OBJS): ../../Compress/Branch/$(*B).cpp - $(COMPL_O2) -$(BZIP2_OBJS): ../../Compress/BZip2/$(*B).cpp - $(COMPL) -$(BZIP2_OPT_OBJS): ../../Compress/BZip2/$(*B).cpp - $(COMPL_O2) -$(DEFLATE_OPT_OBJS): ../../Compress/Deflate/$(*B).cpp - $(COMPL_O2) -$(LZ_OBJS): ../../Compress/LZ/$(*B).cpp - $(COMPL) -$(LZMA_OPT_OBJS): ../../Compress/LZMA/$(*B).cpp - $(COMPL_O2) -$(PPMD_OPT_OBJS): ../../Compress/PPMD/$(*B).cpp - $(COMPL_O2) - -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) -$O\MT.obj: ../../Compress/LZ/MT/$(*B).cpp - $(COMPL_O2) -$O\RangeCoderBit.obj: ../../Compress/RangeCoder/$(*B).cpp - $(COMPL) - -$(AES_OPT_OBJS): ../../Crypto/AES/$(*B).cpp - $(COMPL_O2) -$(AES_ORIG_OBJS): ../../Crypto/AES/$(*B).c - $(COMPL_O2_W3) -$(7ZAES_OPT_OBJS): ../../Crypto/7zAES/$(*B).cpp - $(COMPL_O2) -$(CRYPTO_HASH_OBJS): ../../Crypto/Hash/$(*B).cpp - $(COMPL_O2) diff --git a/7zip/Bundles/Format7z/resource.rc b/7zip/Bundles/Format7z/resource.rc deleted file mode 100755 index 5b3f363e..00000000 --- a/7zip/Bundles/Format7z/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("7z Standalone Plugin", "7za") - -101 ICON "../../Archive/7z/7z.ico" diff --git a/7zip/Bundles/Format7zExtract/Format7z.dsp b/7zip/Bundles/Format7zExtract/Format7z.dsp deleted file mode 100755 index d049d00c..00000000 --- a/7zip/Bundles/Format7zExtract/Format7z.dsp +++ /dev/null @@ -1,813 +0,0 @@ -# Microsoft Developer Studio Project File - Name="7z" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=7z - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Format7z.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Format7z.mak" CFG="7z - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "7z - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "7z - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "7z - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MT /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "EXTRACT_ONLY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_MT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE_DECODER" /D "COMPRESS_BZIP2_DECODER" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_MT" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\7zxa.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none /debug - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\SDK" /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "EXTRACT_ONLY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_MT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE_DECODER" /D "COMPRESS_BZIP2_DECODER" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_MT" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\7zxa.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "7z - Win32 Release" -# Name "7z - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Archive\7z\7z.ico -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Archive.def -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Wildcard.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Wildcard.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\FileDir.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileDir.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileIO.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileIO.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.h -# End Source File -# End Group -# Begin Group "Archive common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2MT.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2MT.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CrossThreadProgress.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CrossThreadProgress.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\FilterCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\FilterCoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\ItemNameUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\OutStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\OutStreamWithCRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\ParseProperties.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\ParseProperties.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Group "LZ" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.h -# End Source File -# End Group -# Begin Group "PPMD" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDContext.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDDecode.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDDecoder.cpp - -!IF "$(CFG)" == "7z - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDSubAlloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDType.h -# End Source File -# End Group -# Begin Group "Branch" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Branch\BranchCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\BranchCoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\x86.cpp - -!IF "$(CFG)" == "7z - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\x86.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\x86_2.cpp - -!IF "$(CFG)" == "7z - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\x86_2.h -# End Source File -# End Group -# Begin Group "LZMA" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZMA\LZMA.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZMA\LZMADecoder.cpp - -!IF "$(CFG)" == "7z - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZMA\LZMADecoder.h -# End Source File -# End Group -# Begin Group "Copy" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "RangeCoder" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\RangeCoder\RangeCoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\RangeCoder\RangeCoderBit.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\RangeCoder\RangeCoderBit.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\RangeCoder\RangeCoderBitTree.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\RangeCoder\RangeCoderOpt.h -# End Source File -# End Group -# Begin Group "Deflate" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Deflate\DeflateConst.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Deflate\DeflateDecoder.cpp - -!IF "$(CFG)" == "7z - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Deflate\DeflateDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Deflate\DeflateExtConst.h -# End Source File -# End Group -# Begin Group "BZip2" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\BZip2\BZip2Const.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\BZip2\BZip2CRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\BZip2\BZip2CRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\BZip2\BZip2Decoder.cpp - -!IF "$(CFG)" == "7z - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\BZip2\BZip2Decoder.h -# End Source File -# End Group -# End Group -# Begin Group "Crypto" - -# PROP Default_Filter "" -# Begin Group "AES" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\AES\aes.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\AES_CBC.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\aescpp.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\aescrypt.c - -!IF "$(CFG)" == "7z - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\aeskey.c - -!IF "$(CFG)" == "7z - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\aesopt.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\aestab.c - -!IF "$(CFG)" == "7z - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\MyAES.cpp - -!IF "$(CFG)" == "7z - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\MyAES.h -# End Source File -# End Group -# Begin Group "7zAES" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\7zAES\7zAES.cpp - -!IF "$(CFG)" == "7z - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "7z - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\7zAES\7zAES.h -# End Source File -# End Group -# Begin Group "Hash" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Sha256.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Sha256.h -# End Source File -# End Group -# End Group -# Begin Group "7z" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Archive\7z\7zDecode.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zDecode.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zExtract.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zFolderOutStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zFolderOutStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHeader.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHeader.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zIn.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zIn.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zItem.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zMethodID.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zMethodID.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zMethods.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zProperties.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zProperties.h -# End Source File -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LockedStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LockedStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LSBFDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LSBFDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamBinder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamBinder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# End Target -# End Project diff --git a/7zip/Bundles/Format7zExtract/Format7z.dsw b/7zip/Bundles/Format7zExtract/Format7z.dsw deleted file mode 100755 index 324dab1f..00000000 --- a/7zip/Bundles/Format7zExtract/Format7z.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "7z"=.\Format7z.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Bundles/Format7zExtract/StdAfx.cpp b/7zip/Bundles/Format7zExtract/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Bundles/Format7zExtract/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Bundles/Format7zExtract/StdAfx.h b/7zip/Bundles/Format7zExtract/StdAfx.h deleted file mode 100755 index 2e4be10b..00000000 --- a/7zip/Bundles/Format7zExtract/StdAfx.h +++ /dev/null @@ -1,9 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" -#include "../../../Common/NewHandler.h" - -#endif diff --git a/7zip/Bundles/Format7zExtract/makefile b/7zip/Bundles/Format7zExtract/makefile deleted file mode 100755 index 9a74f429..00000000 --- a/7zip/Bundles/Format7zExtract/makefile +++ /dev/null @@ -1,175 +0,0 @@ -PROG = 7zxa.dll -DEF_FILE = ../../Archive/Archive.def -LIBS = $(LIBS) user32.lib oleaut32.lib -CFLAGS = $(CFLAGS) -I ../../../ \ - -DEXCLUDE_COM \ - -DNO_REGISTRY \ - -DEXTRACT_ONLY \ - -DFORMAT_7Z \ - -DCOMPRESS_MT \ - -DCOMPRESS_BCJ_X86 \ - -DCOMPRESS_BCJ2 \ - -DCOMPRESS_BZIP2_DECODER \ - -DCOMPRESS_BZIP2_MT \ - -DCOMPRESS_COPY \ - -DCOMPRESS_DEFLATE_DECODER \ - -DCOMPRESS_LZMA \ - -DCOMPRESS_MF_MT \ - -DCOMPRESS_PPMD \ - -DCRYPTO_7ZAES \ - -DCRYPTO_AES \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\CRC.obj \ - $O\IntToString.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\StringToInt.obj \ - $O\Vector.obj \ - $O\Wildcard.obj \ - -WIN_OBJS = \ - $O\FileDir.obj \ - $O\FileFind.obj \ - $O\FileIO.obj \ - $O\PropVariant.obj \ - $O\Synchronization.obj - -7ZIP_COMMON_OBJS = \ - $O\InBuffer.obj \ - $O\InOutTempBuffer.obj \ - $O\LimitedStreams.obj \ - $O\LockedStream.obj \ - $O\LSBFDecoder.obj \ - $O\OutBuffer.obj \ - $O\ProgressUtils.obj \ - $O\StreamBinder.obj \ - $O\StreamObjects.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\CoderMixer2.obj \ - $O\CoderMixer2MT.obj \ - $O\CrossThreadProgress.obj \ - $O\FilterCoder.obj \ - $O\ItemNameUtils.obj \ - $O\OutStreamWithCRC.obj \ - $O\ParseProperties.obj \ - - -7Z_OBJS = \ - $O\DllExports.obj \ - $O\7zCompressionMode.obj \ - $O\7zDecode.obj \ - $O\7zExtract.obj \ - $O\7zFolderOutStream.obj \ - $O\7zHandler.obj \ - $O\7zHeader.obj \ - $O\7zIn.obj \ - $O\7zMethodID.obj \ - $O\7zProperties.obj \ - - -BRANCH_OPT_OBJS = \ - $O\BranchCoder.obj \ - $O\x86.obj \ - $O\x86_2.obj \ - -BZIP2_OBJS = \ - $O\BZip2CRC.obj \ - -BZIP2_OPT_OBJS = \ - $O\BZip2Decoder.obj \ - -DEFLATE_OPT_OBJS = \ - $O\DeflateDecoder.obj \ - -LZ_OBJS = \ - $O\LZOutWindow.obj \ - -LZMA_OPT_OBJS = \ - $O\LZMADecoder.obj \ - -PPMD_OPT_OBJS = \ - $O\PPMDDecoder.obj \ - - -7ZAES_OPT_OBJS = \ - $O\7zAES.obj \ - -AES_OPT_OBJS = \ - $O\MyAES.obj \ - -AES_ORIG_OBJS = \ - $O\aescrypt.obj \ - $O\aeskey.obj \ - $O\aestab.obj \ - -CRYPTO_HASH_OBJS = \ - $O\Sha256.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(CONSOLE_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(7Z_OBJS) \ - $(BZIP2_OBJS) \ - $(BZIP2_OPT_OBJS) \ - $(BRANCH_OPT_OBJS) \ - $(DEFLATE_OPT_OBJS) \ - $(LZ_OBJS) \ - $(LZMA_OPT_OBJS) \ - $(PPMD_OPT_OBJS) \ - $O\CopyCoder.obj \ - $(7ZAES_OPT_OBJS) \ - $(AES_OPT_OBJS) \ - $(AES_ORIG_OBJS) \ - $(CRYPTO_HASH_OBJS) \ - $O\resource.res - - -!include "../../../Build.mak" - -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../../Archive/Common/$(*B).cpp - $(COMPL) - -$(7Z_OBJS): ../../Archive/7z/$(*B).cpp - $(COMPL) - -$(BRANCH_OPT_OBJS): ../../Compress/Branch/$(*B).cpp - $(COMPL_O2) -$(BZIP2_OBJS): ../../Compress/BZip2/$(*B).cpp - $(COMPL) -$(BZIP2_OPT_OBJS): ../../Compress/BZip2/$(*B).cpp - $(COMPL_O2) -$(DEFLATE_OPT_OBJS): ../../Compress/Deflate/$(*B).cpp - $(COMPL_O2) -$(LZ_OBJS): ../../Compress/LZ/$(*B).cpp - $(COMPL) -$(LZMA_OPT_OBJS): ../../Compress/LZMA/$(*B).cpp - $(COMPL_O2) -$(PPMD_OPT_OBJS): ../../Compress/PPMD/$(*B).cpp - $(COMPL_O2) - -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) - -$(AES_OPT_OBJS): ../../Crypto/AES/$(*B).cpp - $(COMPL_O2) -$(AES_ORIG_OBJS): ../../Crypto/AES/$(*B).c - $(COMPL_O2_W3) -$(7ZAES_OPT_OBJS): ../../Crypto/7zAES/$(*B).cpp - $(COMPL_O2) -$(CRYPTO_HASH_OBJS): ../../Crypto/Hash/$(*B).cpp - $(COMPL_O2) diff --git a/7zip/Bundles/Format7zExtract/resource.rc b/7zip/Bundles/Format7zExtract/resource.rc deleted file mode 100755 index 56e6b5d7..00000000 --- a/7zip/Bundles/Format7zExtract/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("7z Standalone Extracting Plugin", "7zxa") - -101 ICON "../../Archive/7z/7z.ico" diff --git a/7zip/Bundles/SFXCon/7z.ico b/7zip/Bundles/SFXCon/7z.ico deleted file mode 100755 index 47ffb781..00000000 Binary files a/7zip/Bundles/SFXCon/7z.ico and /dev/null differ diff --git a/7zip/Bundles/SFXCon/Main.cpp b/7zip/Bundles/SFXCon/Main.cpp deleted file mode 100755 index 65ed8931..00000000 --- a/7zip/Bundles/SFXCon/Main.cpp +++ /dev/null @@ -1,416 +0,0 @@ -// Main.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" - -#include "Common/CommandLineParser.h" -#include "Common/StdOutStream.h" -#include "Common/Wildcard.h" -#include "Common/StringConvert.h" -#include "Common/MyCom.h" -#include "Common/Exception.h" - -#include "Windows/FileDir.h" -#include "Windows/FileName.h" -#include "Windows/Defs.h" - -#include "../../IPassword.h" -#include "../../ICoder.h" - -#include "../../UI/Common/OpenArchive.h" -#include "../../UI/Common/DefaultName.h" -#include "../../UI/Common/ExitCode.h" -#include "../../UI/Common/Extract.h" - -#include "../../UI/Console/List.h" -#include "../../UI/Console/OpenCallbackConsole.h" -#include "../../UI/Console/ExtractCallbackConsole.h" - -#include "../../MyVersion.h" - -using namespace NWindows; -using namespace NFile; -using namespace NCommandLineParser; - -extern CStdOutStream *g_StdStream; - -static const char *kCopyrightString = -"\n7-Zip SFX " MY_VERSION_COPYRIGHT_DATE "\n"; - -static const int kNumSwitches = 6; - -#ifdef _WIN32 -static const wchar_t *kDefaultExt = L".exe"; -static const int kDefaultExtLength = 4; -#endif - -namespace NKey { -enum Enum -{ - kHelp1 = 0, - kHelp2, - kDisablePercents, - kYes, - kPassword, - kOutputDir -}; - -} - -namespace NRecursedType { -enum EEnum -{ - kRecursed, - kWildCardOnlyRecursed, - kNonRecursed, -}; -} - -static const char kRecursedIDChar = 'R'; -static const wchar_t *kRecursedPostCharSet = L"0-"; - -namespace NRecursedPostCharIndex { - enum EEnum - { - kWildCardRecursionOnly = 0, - kNoRecursion = 1 - }; -} - -static const char kFileListID = '@'; -static const char kImmediateNameID = '!'; - -static const char kSomeCludePostStringMinSize = 2; // at least <@|!>ame must be -static const char kSomeCludeAfterRecursedPostStringMinSize = 2; // at least <@|!>ame must be - -static const CSwitchForm kSwitchForms[kNumSwitches] = - { - { L"?", NSwitchType::kSimple, false }, - { L"H", NSwitchType::kSimple, false }, - { L"BD", NSwitchType::kSimple, false }, - { L"Y", NSwitchType::kSimple, false }, - { L"P", NSwitchType::kUnLimitedPostString, false, 1 }, - { L"O", NSwitchType::kUnLimitedPostString, false, 1 }, - }; - -static const int kNumCommandForms = 3; - -namespace NCommandType { -enum EEnum -{ - kTest = 0, - // kExtract, - kFullExtract, - kList -}; - -} - -static const CCommandForm commandForms[kNumCommandForms] = -{ - { L"T", false }, - // { "E", false }, - { L"X", false }, - { L"L", false } -}; - -static const NRecursedType::EEnum kCommandRecursedDefault[kNumCommandForms] = -{ - NRecursedType::kRecursed -}; - -static const bool kTestExtractRecursedDefault = true; -static const bool kAddRecursedDefault = false; - -static const int kMaxCmdLineSize = 1000; -static const wchar_t *kUniversalWildcard = L"*"; -static const int kMinNonSwitchWords = 1; -static const int kCommandIndex = 0; - -static const char *kHelpString = - "\nUsage: 7zSFX [] [...]\n" - "\n" - "\n" - " l: List contents of archive\n" - " t: Test integrity of archive\n" - " x: eXtract files with full pathname (default)\n" - "\n" - // " -bd Disable percentage indicator\n" - " -o{Directory}: set Output directory\n" - " -p{Password}: set Password\n" - " -y: assume Yes on all queries\n"; - - -// --------------------------- -// exception messages - -static const char *kUserErrorMessage = "Incorrect command line"; // NExitCode::kUserError -static const char *kIncorrectListFile = "Incorrect wildcard in listfile"; -static const char *kIncorrectWildCardInCommandLine = "Incorrect wildcard in command line"; - -// static const CSysString kFileIsNotArchiveMessageBefore = "File \""; -// static const CSysString kFileIsNotArchiveMessageAfter = "\" is not archive"; - -static const char *kProcessArchiveMessage = " archive: "; - -static const char *kCantFindSFX = " cannot find sfx"; - - -struct CArchiveCommand -{ - NCommandType::EEnum CommandType; - NRecursedType::EEnum DefaultRecursedType() const; -}; - -NRecursedType::EEnum CArchiveCommand::DefaultRecursedType() const -{ - return kCommandRecursedDefault[CommandType]; -} - -void PrintHelp(void) -{ - g_StdOut << kHelpString; -} - -static void ShowMessageAndThrowException(const char *message, NExitCode::EEnum code) -{ - g_StdOut << message << endl; - throw code; -} - -static void PrintHelpAndExit() // yyy -{ - PrintHelp(); - ShowMessageAndThrowException(kUserErrorMessage, NExitCode::kUserError); -} - -bool ParseArchiveCommand(const UString &commandString, CArchiveCommand &command) -{ - UString commandStringUpper = commandString; - commandStringUpper.MakeUpper(); - UString postString; - int commandIndex = ParseCommand(kNumCommandForms, commandForms, commandStringUpper, - postString) ; - if (commandIndex < 0) - return false; - command.CommandType = (NCommandType::EEnum)commandIndex; - return true; -} - -// ------------------------------------------------------------------ -// filenames functions - -static bool AddNameToCensor(NWildcard::CCensor &wildcardCensor, - const UString &name, bool include, NRecursedType::EEnum type) -{ - /* - if(!IsWildCardFilePathLegal(name)) - return false; - */ - bool isWildCard = DoesNameContainWildCard(name); - bool recursed = false; - - switch (type) - { - case NRecursedType::kWildCardOnlyRecursed: - recursed = isWildCard; - break; - case NRecursedType::kRecursed: - recursed = true; - break; - case NRecursedType::kNonRecursed: - recursed = false; - break; - } - wildcardCensor.AddItem(include, name, recursed); - return true; -} - -void AddCommandLineWildCardToCensor(NWildcard::CCensor &wildcardCensor, - const UString &name, bool include, NRecursedType::EEnum type) -{ - if (!AddNameToCensor(wildcardCensor, name, include, type)) - ShowMessageAndThrowException(kIncorrectWildCardInCommandLine, NExitCode::kUserError); -} - -void AddToCensorFromNonSwitchesStrings(NWildcard::CCensor &wildcardCensor, - const UStringVector & /* nonSwitchStrings */, NRecursedType::EEnum type, - bool /* thereAreSwitchIncludeWildCards */) -{ - AddCommandLineWildCardToCensor(wildcardCensor, kUniversalWildcard, true, type); -} - - -#ifndef _WIN32 -static void GetArguments(int numArguments, const char *arguments[], UStringVector &parts) -{ - parts.Clear(); - for(int i = 0; i < numArguments; i++) - { - UString s = MultiByteToUnicodeString(arguments[i]); - parts.Add(s); - } -} -#endif - -int Main2( - #ifndef _WIN32 - int numArguments, const char *arguments[] - #endif -) -{ - #ifdef _WIN32 - SetFileApisToOEM(); - #endif - - g_StdOut << kCopyrightString; - - UStringVector commandStrings; - #ifdef _WIN32 - NCommandLineParser::SplitCommandLine(GetCommandLineW(), commandStrings); - #else - GetArguments(numArguments, arguments, commandStrings); - #endif - - UString archiveName = commandStrings.Front(); - - commandStrings.Delete(0); - - NCommandLineParser::CParser parser(kNumSwitches); - try - { - parser.ParseStrings(kSwitchForms, commandStrings); - } - catch(...) - { - PrintHelpAndExit(); - } - - if(parser[NKey::kHelp1].ThereIs || parser[NKey::kHelp2].ThereIs) - { - PrintHelp(); - return 0; - } - const UStringVector &nonSwitchStrings = parser.NonSwitchStrings; - - int numNonSwitchStrings = nonSwitchStrings.Size(); - - CArchiveCommand command; - if (numNonSwitchStrings == 0) - command.CommandType = NCommandType::kFullExtract; - else - { - if (numNonSwitchStrings > 1) - PrintHelpAndExit(); - if (!ParseArchiveCommand(nonSwitchStrings[kCommandIndex], command)) - PrintHelpAndExit(); - } - - - NRecursedType::EEnum recursedType; - recursedType = command.DefaultRecursedType(); - - NWildcard::CCensor wildcardCensor; - - bool thereAreSwitchIncludeWildCards; - thereAreSwitchIncludeWildCards = false; - AddToCensorFromNonSwitchesStrings(wildcardCensor, nonSwitchStrings, recursedType, - thereAreSwitchIncludeWildCards); - - bool yesToAll = parser[NKey::kYes].ThereIs; - - #ifdef _WIN32 - if (archiveName.Right(kDefaultExtLength).CompareNoCase(kDefaultExt) != 0) - archiveName += kDefaultExt; - #endif - - // NExtractMode::EEnum extractMode; - // bool isExtractGroupCommand = command.IsFromExtractGroup(extractMode); - - bool passwordEnabled = parser[NKey::kPassword].ThereIs; - - UString password; - if(passwordEnabled) - password = parser[NKey::kPassword].PostStrings[0]; - - NFind::CFileInfoW archiveFileInfo; - if (!NFind::FindFile(archiveName, archiveFileInfo)) - throw kCantFindSFX; - if (archiveFileInfo.IsDirectory()) - throw kCantFindSFX; - - UString outputDir; - if(parser[NKey::kOutputDir].ThereIs) - { - outputDir = parser[NKey::kOutputDir].PostStrings[0]; - NName::NormalizeDirPathPrefix(outputDir); - } - - { - UStringVector v1, v2; - v1.Add(archiveName); - v2.Add(archiveName); - const NWildcard::CCensorNode &wildcardCensorHead = - wildcardCensor.Pairs.Front().Head; - if(command.CommandType != NCommandType::kList) - { - CExtractCallbackConsole *ecs = new CExtractCallbackConsole; - CMyComPtr extractCallback = ecs; - ecs->OutStream = g_StdStream; - ecs->PasswordIsDefined = passwordEnabled; - ecs->Password = password; - ecs->Init(); - - COpenCallbackConsole openCallback; - openCallback.OutStream = g_StdStream; - openCallback.PasswordIsDefined = passwordEnabled; - openCallback.Password = password; - - CExtractOptions eo; - eo.StdOutMode = false; - eo.PathMode = NExtract::NPathMode::kFullPathnames; - eo.TestMode = command.CommandType == NCommandType::kTest; - eo.OverwriteMode = yesToAll ? - NExtract::NOverwriteMode::kWithoutPrompt : - NExtract::NOverwriteMode::kAskBefore; - eo.OutputDir = outputDir; - eo.YesToAll = yesToAll; - - UString errorMessage; - HRESULT result = DecompressArchives( - v1, v2, - wildcardCensorHead, - eo, &openCallback, ecs, errorMessage); - if (!errorMessage.IsEmpty()) - { - (*g_StdStream) << endl << "Error: " << errorMessage;; - if (result == S_OK) - result = E_FAIL; - } - - if (ecs->NumArchiveErrors != 0 || ecs->NumFileErrors != 0) - { - if (ecs->NumArchiveErrors != 0) - (*g_StdStream) << endl << "Archive Errors: " << ecs->NumArchiveErrors << endl; - if (ecs->NumFileErrors != 0) - (*g_StdStream) << endl << "Sub items Errors: " << ecs->NumFileErrors << endl; - return NExitCode::kFatalError; - } - if (result != S_OK) - throw CSystemException(result); - } - else - { - HRESULT result = ListArchives( - v1, v2, - wildcardCensorHead, - true, false, - passwordEnabled, - password); - if (result != S_OK) - throw CSystemException(result); - } - } - return 0; -} diff --git a/7zip/Bundles/SFXCon/SFXCon.dsp b/7zip/Bundles/SFXCon/SFXCon.dsp deleted file mode 100755 index 5b61dae3..00000000 --- a/7zip/Bundles/SFXCon/SFXCon.dsp +++ /dev/null @@ -1,759 +0,0 @@ -# Microsoft Developer Studio Project File - Name="SFXCon" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=SFXCon - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "SFXCon.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "SFXCon.mak" CFG="SFXCon - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "SFXCon - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "SFXCon - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "SFXCon - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "COMPRESS_BCJ2" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "EXTRACT_ONLY" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_COPY" /D "COMPRESS_PPMD" /D "_SFX" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /Yu"StdAfx.h" /FD /c -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"C:\Util\7zCon.sfx" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "SFXCon - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /W3 /Gm /GX /ZI /Od /I "..\..\..\..\\" /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "EXTRACT_ONLY" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_COPY" /D "COMPRESS_PPMD" /D "_SFX" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"C:\Util\7zCon.sfx" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "SFXCon - Win32 Release" -# Name "SFXCon - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\resource.h -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2MT.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2MT.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2ST.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2ST.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CrossThreadProgress.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CrossThreadProgress.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\FilterCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\FilterCoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\ItemNameUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\OutStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\OutStreamWithCRC.h -# End Source File -# End Group -# Begin Group "Console" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\UI\Console\ConsoleClose.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\ConsoleClose.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\ExtractCallbackConsole.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\ExtractCallbackConsole.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\List.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\List.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\MainAr.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\OpenCallbackConsole.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\OpenCallbackConsole.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\UserInputUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Console\UserInputUtils.h -# End Source File -# End Group -# Begin Group "7z" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Archive\7z\7zDecode.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zDecode.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zExtract.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zFolderOutStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zFolderOutStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHeader.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHeader.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zIn.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zIn.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zItem.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zMethodID.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zMethodID.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Group "LZMA" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZMA\LZMADecoder.cpp -# End Source File -# End Group -# Begin Group "Branch" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Branch\BranchCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\BranchCoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\x86.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\x86_2.cpp -# End Source File -# End Group -# Begin Group "PPMD" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDDecoder.cpp -# End Source File -# End Group -# Begin Group "LZ" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.h -# End Source File -# End Group -# Begin Group "Copy" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# End Group -# Begin Group "Crypto" - -# PROP Default_Filter "" -# Begin Group "7zAES" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\7zAES\7zAES.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\7zAES\7zAES.h -# End Source File -# End Group -# Begin Group "AES" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\AES\aes.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\AES_CBC.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\aescpp.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\aescrypt.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\aeskey.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\aesopt.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\aestab.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\MyAES.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\MyAES.h -# End Source File -# End Group -# Begin Group "Hash" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\Hash\RotateDefs.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Sha256.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Sha256.h -# End Source File -# End Group -# End Group -# Begin Group "SDK" - -# PROP Default_Filter "" -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\Error.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Error.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileDir.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileDir.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileIO.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileIO.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileName.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileName.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariantConversions.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariantConversions.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CommandLineParser.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CommandLineParser.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StdInStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StdInStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StdOutStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StdOutStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Wildcard.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Wildcard.h -# End Source File -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\FilePathAutoRename.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\FilePathAutoRename.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\FileStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\FileStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LockedStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LockedStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OffsetStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OffsetStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamBinder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamBinder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "UI" - -# PROP Default_Filter "" -# Begin Group "UI Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiveExtractCallback.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiveExtractCallback.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiveOpenCallback.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiveOpenCallback.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiverInfo.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiverInfo.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\DefaultName.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\DefaultName.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ExitCode.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\Extract.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\Extract.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ExtractingFilePath.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ExtractingFilePath.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ExtractMode.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\OpenArchive.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\OpenArchive.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\PropIDUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\PropIDUtils.h -# End Source File -# End Group -# End Group -# Begin Source File - -SOURCE=.\7z.ico -# End Source File -# Begin Source File - -SOURCE=.\Main.cpp -# End Source File -# End Target -# End Project diff --git a/7zip/Bundles/SFXCon/SFXCon.dsw b/7zip/Bundles/SFXCon/SFXCon.dsw deleted file mode 100755 index 27bf7e6d..00000000 --- a/7zip/Bundles/SFXCon/SFXCon.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "SFXCon"=.\SFXCon.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Bundles/SFXCon/StdAfx.cpp b/7zip/Bundles/SFXCon/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Bundles/SFXCon/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Bundles/SFXCon/StdAfx.h b/7zip/Bundles/SFXCon/StdAfx.h deleted file mode 100755 index 2e4be10b..00000000 --- a/7zip/Bundles/SFXCon/StdAfx.h +++ /dev/null @@ -1,9 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" -#include "../../../Common/NewHandler.h" - -#endif diff --git a/7zip/Bundles/SFXCon/makefile b/7zip/Bundles/SFXCon/makefile deleted file mode 100755 index 7501a497..00000000 --- a/7zip/Bundles/SFXCon/makefile +++ /dev/null @@ -1,180 +0,0 @@ -PROG = 7zCon.sfx -LIBS = $(LIBS) user32.lib oleaut32.lib -CFLAGS = $(CFLAGS) -I ../../../ \ - -DEXCLUDE_COM \ - -DNO_REGISTRY \ - -DEXTRACT_ONLY \ - -D_SFX \ - -DFORMAT_7Z \ - -DCOMPRESS_BCJ_X86 \ - -DCOMPRESS_BCJ2 \ - -DCOMPRESS_COPY \ - -DCOMPRESS_LZMA \ - -DCOMPRESS_PPMD \ - -DCRYPTO_7ZAES \ - -DCRYPTO_AES \ - -SFX_CONSOLE_OBJS = \ - $O\Main.obj \ - -CONSOLE_OBJS = \ - $O\ConsoleClose.obj \ - $O\ExtractCallbackConsole.obj \ - $O\List.obj \ - $O\MainAr.obj \ - $O\OpenCallbackConsole.obj \ - $O\UserInputUtils.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\CommandLineParser.obj \ - $O\CRC.obj \ - $O\IntToString.obj \ - $O\NewHandler.obj \ - $O\StdInStream.obj \ - $O\StdOutStream.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\Vector.obj \ - $O\Wildcard.obj \ - -WIN_OBJS = \ - $O\Error.obj \ - $O\FileDir.obj \ - $O\FileFind.obj \ - $O\FileIO.obj \ - $O\FileName.obj \ - $O\PropVariant.obj \ - $O\PropVariantConversions.obj \ - $O\Synchronization.obj - -7ZIP_COMMON_OBJS = \ - $O\FilePathAutoRename.obj \ - $O\FileStreams.obj \ - $O\InBuffer.obj \ - $O\LimitedStreams.obj \ - $O\LockedStream.obj \ - $O\OutBuffer.obj \ - $O\ProgressUtils.obj \ - $O\StreamBinder.obj \ - $O\StreamObjects.obj \ - $O\StreamUtils.obj \ - -UI_COMMON_OBJS = \ - $O\ArchiveExtractCallback.obj \ - $O\ArchiveOpenCallback.obj \ - $O\ArchiverInfo.obj \ - $O\DefaultName.obj \ - $O\Extract.obj \ - $O\ExtractingFilePath.obj \ - $O\OpenArchive.obj \ - $O\PropIDUtils.obj \ - -AR_COMMON_OBJS = \ - $O\CoderMixer2.obj \ - $O\CoderMixer2MT.obj \ - $O\CrossThreadProgress.obj \ - $O\FilterCoder.obj \ - $O\ItemNameUtils.obj \ - $O\OutStreamWithCRC.obj \ - - -7Z_OBJS = \ - $O\7zDecode.obj \ - $O\7zExtract.obj \ - $O\7zFolderOutStream.obj \ - $O\7zHandler.obj \ - $O\7zHeader.obj \ - $O\7zIn.obj \ - $O\7zMethodID.obj \ - -BRANCH_OPT_OBJS = \ - $O\BranchCoder.obj \ - $O\x86.obj \ - $O\x86_2.obj \ - -LZ_OBJS = \ - $O\LZOutWindow.obj \ - -LZMA_OPT_OBJS = \ - $O\LZMADecoder.obj \ - -PPMD_OPT_OBJS = \ - $O\PPMDDecoder.obj \ - -7ZAES_OPT_OBJS = \ - $O\7zAES.obj \ - -AES_OPT_OBJS = \ - $O\MyAES.obj \ - -AES_ORIG_OBJS = \ - $O\aescrypt.obj \ - $O\aeskey.obj \ - $O\aestab.obj \ - -CRYPTO_HASH_OBJS = \ - $O\Sha256.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(SFX_CONSOLE_OBJS) \ - $(CONSOLE_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(UI_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(7Z_OBJS) \ - $(BRANCH_OPT_OBJS) \ - $(LZ_OBJS) \ - $(LZMA_OPT_OBJS) \ - $(PPMD_OPT_OBJS) \ - $O\CopyCoder.obj \ - $(7ZAES_OPT_OBJS) \ - $(AES_OPT_OBJS) \ - $(AES_ORIG_OBJS) \ - $(CRYPTO_HASH_OBJS) \ - $O\resource.res - - -!include "../../../Build.mak" - -$(SFX_CONSOLE_OBJS): $(*B).cpp - $(COMPL) - -$(CONSOLE_OBJS): ../../UI/Console/$(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(UI_COMMON_OBJS): ../../UI/Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../../Archive/Common/$(*B).cpp - $(COMPL) - -$(7Z_OBJS): ../../Archive/7z/$(*B).cpp - $(COMPL) -$(BRANCH_OPT_OBJS): ../../Compress/Branch/$(*B).cpp - $(COMPL) -$(LZ_OBJS): ../../Compress/LZ/$(*B).cpp - $(COMPL) -$(LZMA_OPT_OBJS): ../../Compress/LZMA/$(*B).cpp - $(COMPL) -$(PPMD_OPT_OBJS): ../../Compress/PPMD/$(*B).cpp - $(COMPL) - -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) - -$(AES_OPT_OBJS): ../../Crypto/AES/$(*B).cpp - $(COMPL) -$(AES_ORIG_OBJS): ../../Crypto/AES/$(*B).c - $(COMPL_O1_W3) -$(7ZAES_OPT_OBJS): ../../Crypto/7zAES/$(*B).cpp - $(COMPL) -$(CRYPTO_HASH_OBJS): ../../Crypto/Hash/$(*B).cpp - $(COMPL) diff --git a/7zip/Bundles/SFXCon/resource.rc b/7zip/Bundles/SFXCon/resource.rc deleted file mode 100755 index 58331b81..00000000 --- a/7zip/Bundles/SFXCon/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_APP("7z Console SFX", "7z.sfx") - -101 ICON "7z.ico" \ No newline at end of file diff --git a/7zip/Bundles/SFXSetup/ExtractCallback.cpp b/7zip/Bundles/SFXSetup/ExtractCallback.cpp deleted file mode 100755 index 6294516c..00000000 --- a/7zip/Bundles/SFXSetup/ExtractCallback.cpp +++ /dev/null @@ -1,249 +0,0 @@ -// ExtractCallback.h - -#include "StdAfx.h" - -#include "ExtractCallback.h" - -#include "Common/Wildcard.h" -#include "Common/StringConvert.h" - -#include "Windows/COM.h" -#include "Windows/FileDir.h" -#include "Windows/FileFind.h" -#include "Windows/Time.h" -#include "Windows/Defs.h" -#include "Windows/PropVariant.h" - -#include "Windows/PropVariantConversions.h" - -using namespace NWindows; -using namespace NFile; - -static LPCWSTR kErrorTitle = L"7-Zip"; -static LPCWSTR kCantDeleteFile = L"Can not delete output file"; -static LPCWSTR kCantOpenFile = L"Can not open output file"; -static LPCWSTR kUnsupportedMethod = L"Unsupported Method"; -// static LPCWSTR kCRCFailed = L"CRC Failed"; -// static LPCWSTR kDataError = L"Data Error"; -// static LPCWSTR kUnknownError = L""Unknown Error"; - -void CExtractCallbackImp::Init(IInArchive *archiveHandler, - const UString &directoryPath, - const UString &itemDefaultName, - const FILETIME &utcLastWriteTimeDefault, - UInt32 attributesDefault) -{ - _message.Empty(); - _isCorrupt = false; - _itemDefaultName = itemDefaultName; - _utcLastWriteTimeDefault = utcLastWriteTimeDefault; - _attributesDefault = attributesDefault; - _archiveHandler = archiveHandler; - _directoryPath = directoryPath; - NName::NormalizeDirPathPrefix(_directoryPath); -} - -STDMETHODIMP CExtractCallbackImp::SetTotal(UInt64 size) -{ - #ifndef _NO_PROGRESS - ProgressDialog.ProgressSynch.SetProgress(size, 0); - #endif - return S_OK; -} - -STDMETHODIMP CExtractCallbackImp::SetCompleted(const UInt64 *completeValue) -{ - #ifndef _NO_PROGRESS - for (;;) - { - if(ProgressDialog.ProgressSynch.GetStopped()) - return E_ABORT; - if(!ProgressDialog.ProgressSynch.GetPaused()) - break; - ::Sleep(100); - } - if (completeValue != NULL) - ProgressDialog.ProgressSynch.SetPos(*completeValue); - #endif - return S_OK; -} - -void CExtractCallbackImp::CreateComplexDirectory(const UStringVector &dirPathParts) -{ - UString fullPath = _directoryPath; - for(int i = 0; i < dirPathParts.Size(); i++) - { - fullPath += dirPathParts[i]; - NDirectory::MyCreateDirectory(fullPath); - fullPath += NName::kDirDelimiter; - } -} - -STDMETHODIMP CExtractCallbackImp::GetStream(UInt32 index, - ISequentialOutStream **outStream, Int32 askExtractMode) -{ - #ifndef _NO_PROGRESS - if(ProgressDialog.ProgressSynch.GetStopped()) - return E_ABORT; - #endif - _outFileStream.Release(); - NCOM::CPropVariant propVariantName; - RINOK(_archiveHandler->GetProperty(index, kpidPath, &propVariantName)); - UString fullPath; - if(propVariantName.vt == VT_EMPTY) - fullPath = _itemDefaultName; - else - { - if(propVariantName.vt != VT_BSTR) - return E_FAIL; - fullPath = propVariantName.bstrVal; - } - _filePath = fullPath; - - // m_CurrentFilePath = GetSystemString(fullPath, _codePage); - - if(askExtractMode == NArchive::NExtract::NAskMode::kExtract) - { - NCOM::CPropVariant propVariant; - RINOK(_archiveHandler->GetProperty(index, kpidAttributes, &propVariant)); - if (propVariant.vt == VT_EMPTY) - _processedFileInfo.Attributes = _attributesDefault; - else - { - if (propVariant.vt != VT_UI4) - return E_FAIL; - _processedFileInfo.Attributes = propVariant.ulVal; - } - - RINOK(_archiveHandler->GetProperty(index, kpidIsFolder, &propVariant)); - _processedFileInfo.IsDirectory = VARIANT_BOOLToBool(propVariant.boolVal); - - bool isAnti = false; - { - NCOM::CPropVariant propVariantTemp; - RINOK(_archiveHandler->GetProperty(index, kpidIsAnti, - &propVariantTemp)); - if (propVariantTemp.vt == VT_BOOL) - isAnti = VARIANT_BOOLToBool(propVariantTemp.boolVal); - } - - RINOK(_archiveHandler->GetProperty(index, kpidLastWriteTime, &propVariant)); - switch(propVariant.vt) - { - case VT_EMPTY: - _processedFileInfo.UTCLastWriteTime = _utcLastWriteTimeDefault; - break; - case VT_FILETIME: - _processedFileInfo.UTCLastWriteTime = propVariant.filetime; - break; - default: - return E_FAIL; - } - - UStringVector pathParts; - SplitPathToParts(fullPath, pathParts); - if(pathParts.IsEmpty()) - return E_FAIL; - - UString processedPath = fullPath; - - if(!_processedFileInfo.IsDirectory) - pathParts.DeleteBack(); - if (!pathParts.IsEmpty()) - { - if (!isAnti) - CreateComplexDirectory(pathParts); - } - - UString fullProcessedPath = _directoryPath + processedPath; - - if(_processedFileInfo.IsDirectory) - { - _diskFilePath = fullProcessedPath; - - if (isAnti) - NDirectory::MyRemoveDirectory(_diskFilePath); - return S_OK; - } - - NFind::CFileInfoW fileInfo; - if(NFind::FindFile(fullProcessedPath, fileInfo)) - { - if (!NDirectory::DeleteFileAlways(fullProcessedPath)) - { - _message = kCantDeleteFile; - return E_FAIL; - } - } - - if (!isAnti) - { - _outFileStreamSpec = new COutFileStream; - CMyComPtr outStreamLoc(_outFileStreamSpec); - if (!_outFileStreamSpec->Create(fullProcessedPath, true)) - { - _message = kCantOpenFile; - return E_FAIL; - } - _outFileStream = outStreamLoc; - *outStream = outStreamLoc.Detach(); - } - _diskFilePath = fullProcessedPath; - } - else - { - *outStream = NULL; - } - return S_OK; -} - -STDMETHODIMP CExtractCallbackImp::PrepareOperation(Int32 askExtractMode) -{ - _extractMode = false; - switch (askExtractMode) - { - case NArchive::NExtract::NAskMode::kExtract: - _extractMode = true; - break; - }; - return S_OK; -} - -STDMETHODIMP CExtractCallbackImp::SetOperationResult(Int32 resultEOperationResult) -{ - switch(resultEOperationResult) - { - case NArchive::NExtract::NOperationResult::kOK: - { - break; - } - default: - { - _outFileStream.Release(); - switch(resultEOperationResult) - { - case NArchive::NExtract::NOperationResult::kUnSupportedMethod: - _message = kUnsupportedMethod; - break; - case NArchive::NExtract::NOperationResult::kCRCError: - _isCorrupt = true; - // _message = kCRCFailed; - break; - case NArchive::NExtract::NOperationResult::kDataError: - _isCorrupt = true; - // _message = kDataError; - break; - default: - _isCorrupt = true; - } - return E_FAIL; - } - } - if(_outFileStream != NULL) - _outFileStreamSpec->File.SetLastWriteTime(&_processedFileInfo.UTCLastWriteTime); - _outFileStream.Release(); - if (_extractMode) - NDirectory::MySetFileAttributes(_diskFilePath, _processedFileInfo.Attributes); - return S_OK; -} - diff --git a/7zip/Bundles/SFXSetup/ExtractCallback.h b/7zip/Bundles/SFXSetup/ExtractCallback.h deleted file mode 100755 index f3880890..00000000 --- a/7zip/Bundles/SFXSetup/ExtractCallback.h +++ /dev/null @@ -1,96 +0,0 @@ -// ExtractCallback.h - -#ifndef __EXTRACTCALLBACK_H -#define __EXTRACTCALLBACK_H - -#include "resource.h" - -#include "Common/String.h" -#include "Windows/ResourceString.h" - -#include "../../Archive/IArchive.h" - -#include "../../Common/FileStreams.h" -#include "../../ICoder.h" - -#ifndef _NO_PROGRESS -#include "../../FileManager/Resource/ProgressDialog/ProgressDialog.h" -#endif - -class CExtractCallbackImp: - public IArchiveExtractCallback, - public CMyUnknownImp -{ -public: - - MY_UNKNOWN_IMP - - // IProgress - STDMETHOD(SetTotal)(UInt64 size); - STDMETHOD(SetCompleted)(const UInt64 *completeValue); - - // IExtractCallback - STDMETHOD(GetStream)(UInt32 index, ISequentialOutStream **outStream, - Int32 askExtractMode); - STDMETHOD(PrepareOperation)(Int32 askExtractMode); - STDMETHOD(SetOperationResult)(Int32 resultEOperationResult); - -private: - CMyComPtr _archiveHandler; - UString _directoryPath; - - UString _filePath; - - UString _diskFilePath; - - bool _extractMode; - struct CProcessedFileInfo - { - FILETIME UTCLastWriteTime; - bool IsDirectory; - UInt32 Attributes; - } _processedFileInfo; - - COutFileStream *_outFileStreamSpec; - CMyComPtr _outFileStream; - - UString _itemDefaultName; - FILETIME _utcLastWriteTimeDefault; - UInt32 _attributesDefault; - - void CreateComplexDirectory(const UStringVector &dirPathParts); -public: - #ifndef _NO_PROGRESS - CProgressDialog ProgressDialog; - #endif - - bool _isCorrupt; - UString _message; - - void Init(IInArchive *archiveHandler, - const UString &directoryPath, - const UString &itemDefaultName, - const FILETIME &utcLastWriteTimeDefault, - UInt32 attributesDefault); - - #ifndef _NO_PROGRESS - HRESULT StartProgressDialog(const UString &title) - { - ProgressDialog.Create(title, 0); - { - #ifdef LANG - ProgressDialog.SetText(LangLoadString(IDS_PROGRESS_EXTRACTING, 0x02000890)); - #else - ProgressDialog.SetText(NWindows::MyLoadStringW(IDS_PROGRESS_EXTRACTING)); - #endif - } - - ProgressDialog.Show(SW_SHOWNORMAL); - return S_OK; - } - virtual ~CExtractCallbackImp() { ProgressDialog.Destroy(); } - #endif - -}; - -#endif diff --git a/7zip/Bundles/SFXSetup/ExtractEngine.cpp b/7zip/Bundles/SFXSetup/ExtractEngine.cpp deleted file mode 100755 index 19fcb0d2..00000000 --- a/7zip/Bundles/SFXSetup/ExtractEngine.cpp +++ /dev/null @@ -1,139 +0,0 @@ -// ExtractEngine.cpp - -#include "StdAfx.h" - -#include "ExtractEngine.h" - -#include "Common/StringConvert.h" - -#include "Windows/FileDir.h" -#include "Windows/FileFind.h" -#include "Windows/Thread.h" - -#include "../../UI/Common/OpenArchive.h" - -#include "../../UI/Explorer/MyMessages.h" -#include "../../FileManager/FormatUtils.h" - -#include "ExtractCallback.h" - -using namespace NWindows; - -struct CThreadExtracting -{ - CArchiveLink ArchiveLink; - - CExtractCallbackImp *ExtractCallbackSpec; - CMyComPtr ExtractCallback; - - #ifndef _NO_PROGRESS - HRESULT Result; - - HRESULT Extract() - { - return ArchiveLink.GetArchive()->Extract(0, (UInt32)-1 , BoolToInt(false), ExtractCallback); - } - DWORD Process() - { - ExtractCallbackSpec->ProgressDialog.WaitCreating(); - Result = Extract(); - ExtractCallbackSpec->ProgressDialog.MyClose(); - return 0; - } - static DWORD WINAPI MyThreadFunction(void *param) - { - return ((CThreadExtracting *)param)->Process(); - } - #endif -}; - -static const LPCWSTR kCantFindArchive = L"Can not find archive file"; -static const LPCWSTR kCantOpenArchive = L"File is not correct archive"; - -HRESULT ExtractArchive( - const UString &fileName, - const UString &folderName, - COpenCallbackGUI *openCallback, - bool showProgress, - bool &isCorrupt, - UString &errorMessage) -{ - isCorrupt = false; - NFile::NFind::CFileInfoW archiveFileInfo; - if (!NFile::NFind::FindFile(fileName, archiveFileInfo)) - { - errorMessage = kCantFindArchive; - return E_FAIL; - } - - CThreadExtracting extracter; - - HRESULT result = MyOpenArchive(fileName, extracter.ArchiveLink, openCallback); - - if (result != S_OK) - { - errorMessage = kCantOpenArchive; - return result; - } - - UString directoryPath = folderName; - NFile::NName::NormalizeDirPathPrefix(directoryPath); - - /* - UString directoryPath; - { - UString fullPath; - int fileNamePartStartIndex; - if (!NWindows::NFile::NDirectory::MyGetFullPathName(fileName, fullPath, fileNamePartStartIndex)) - { - MessageBox(NULL, "Error 1329484", "7-Zip", 0); - return E_FAIL; - } - directoryPath = fullPath.Left(fileNamePartStartIndex); - } - */ - - if(!NFile::NDirectory::CreateComplexDirectory(directoryPath)) - { - errorMessage = MyFormatNew(IDS_CANNOT_CREATE_FOLDER, - #ifdef LANG - 0x02000603, - #endif - directoryPath); - return E_FAIL; - } - - extracter.ExtractCallbackSpec = new CExtractCallbackImp; - extracter.ExtractCallback = extracter.ExtractCallbackSpec; - - extracter.ExtractCallbackSpec->Init( - extracter.ArchiveLink.GetArchive(), - directoryPath, L"Default", archiveFileInfo.LastWriteTime, 0); - - #ifndef _NO_PROGRESS - - if (showProgress) - { - CThread thread; - if (!thread.Create(CThreadExtracting::MyThreadFunction, &extracter)) - throw 271824; - - UString title; - #ifdef LANG - title = LangLoadString(IDS_PROGRESS_EXTRACTING, 0x02000890); - #else - title = NWindows::MyLoadStringW(IDS_PROGRESS_EXTRACTING); - #endif - extracter.ExtractCallbackSpec->StartProgressDialog(title); - result = extracter.Result; - } - else - - #endif - { - result = extracter.Extract(); - } - errorMessage = extracter.ExtractCallbackSpec->_message; - isCorrupt = extracter.ExtractCallbackSpec->_isCorrupt; - return result; -} diff --git a/7zip/Bundles/SFXSetup/ExtractEngine.h b/7zip/Bundles/SFXSetup/ExtractEngine.h deleted file mode 100755 index 595d2b29..00000000 --- a/7zip/Bundles/SFXSetup/ExtractEngine.h +++ /dev/null @@ -1,17 +0,0 @@ -// ExtractEngine.h - -#ifndef __EXTRACTENGINE_H -#define __EXTRACTENGINE_H - -#include "Common/String.h" -#include "../../UI/GUI/OpenCallbackGUI.h" - -HRESULT ExtractArchive( - const UString &fileName, - const UString &folderName, - COpenCallbackGUI *openCallback, - bool showProgress, - bool &isCorrupt, - UString &errorMessage); - -#endif diff --git a/7zip/Bundles/SFXSetup/Main.cpp b/7zip/Bundles/SFXSetup/Main.cpp deleted file mode 100755 index 12de5c01..00000000 --- a/7zip/Bundles/SFXSetup/Main.cpp +++ /dev/null @@ -1,335 +0,0 @@ -// Main.cpp - -#include "StdAfx.h" - -#include - -#include "Common/StringConvert.h" -#include "Common/Random.h" -#include "Common/TextConfig.h" -#include "Common/CommandLineParser.h" - -#include "Windows/FileDir.h" -#include "Windows/FileIO.h" -#include "Windows/FileFind.h" -#include "Windows/FileName.h" -#include "Windows/DLL.h" -#include "Windows/ResourceString.h" - -#include "../../IPassword.h" -#include "../../ICoder.h" -#include "../../Archive/IArchive.h" -#include "../../UI/Explorer/MyMessages.h" - -// #include "../../UI/GUI/ExtractGUI.h" - -#include "ExtractEngine.h" - -#include "resource.h" - -using namespace NWindows; - -HINSTANCE g_hInstance; - -static LPCTSTR kTempDirPrefix = TEXT("7zS"); - -#define _SHELL_EXECUTE - -static bool ReadDataString(LPCWSTR fileName, LPCSTR startID, - LPCSTR endID, AString &stringResult) -{ - stringResult.Empty(); - NFile::NIO::CInFile inFile; - if (!inFile.Open(fileName)) - return false; - const int kBufferSize = (1 << 12); - - Byte buffer[kBufferSize]; - int signatureStartSize = lstrlenA(startID); - int signatureEndSize = lstrlenA(endID); - - UInt32 numBytesPrev = 0; - bool writeMode = false; - UInt64 posTotal = 0; - for (;;) - { - if (posTotal > (1 << 20)) - return (stringResult.IsEmpty()); - UInt32 numReadBytes = kBufferSize - numBytesPrev; - UInt32 processedSize; - if (!inFile.Read(buffer + numBytesPrev, numReadBytes, processedSize)) - return false; - if (processedSize == 0) - return true; - UInt32 numBytesInBuffer = numBytesPrev + processedSize; - UInt32 pos = 0; - for (;;) - { - if (writeMode) - { - if (pos > numBytesInBuffer - signatureEndSize) - break; - if (memcmp(buffer + pos, endID, signatureEndSize) == 0) - return true; - char b = buffer[pos]; - if (b == 0) - return false; - stringResult += b; - pos++; - } - else - { - if (pos > numBytesInBuffer - signatureStartSize) - break; - if (memcmp(buffer + pos, startID, signatureStartSize) == 0) - { - writeMode = true; - pos += signatureStartSize; - } - else - pos++; - } - } - numBytesPrev = numBytesInBuffer - pos; - posTotal += pos; - memmove(buffer, buffer + pos, numBytesPrev); - } -} - -static char kStartID[] = ",!@Install@!UTF-8!"; -static char kEndID[] = ",!@InstallEnd@!"; - -class CInstallIDInit -{ -public: - CInstallIDInit() - { - kStartID[0] = ';'; - kEndID[0] = ';'; - }; -} g_CInstallIDInit; - - -class CCurrentDirRestorer -{ - CSysString m_CurrentDirectory; -public: - CCurrentDirRestorer() - { NFile::NDirectory::MyGetCurrentDirectory(m_CurrentDirectory); } - ~CCurrentDirRestorer() - { RestoreDirectory();} - bool RestoreDirectory() - { return BOOLToBool(::SetCurrentDirectory(m_CurrentDirectory)); } -}; - -#ifndef _UNICODE -bool g_IsNT = false; -static inline bool IsItWindowsNT() -{ - OSVERSIONINFO versionInfo; - versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); - if (!::GetVersionEx(&versionInfo)) - return false; - return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT); -} -#endif - -int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /* lpCmdLine */,int /* nCmdShow */) -{ - g_hInstance = (HINSTANCE)hInstance; - #ifndef _UNICODE - g_IsNT = IsItWindowsNT(); - #endif - InitCommonControls(); - - UString archiveName, switches; - #ifdef _SHELL_EXECUTE - UString executeFile, executeParameters; - #endif - NCommandLineParser::SplitCommandLine(GetCommandLineW(), archiveName, switches); - - UString fullPath; - NDLL::MyGetModuleFileName(g_hInstance, fullPath); - - switches.Trim(); - bool assumeYes = false; - if (switches.Left(2).CompareNoCase(UString(L"-y")) == 0) - { - assumeYes = true; - switches = switches.Mid(2); - switches.Trim(); - } - - AString config; - if (!ReadDataString(fullPath, kStartID, kEndID, config)) - { - if (!assumeYes) - MyMessageBox(L"Can't load config info"); - return 1; - } - - UString dirPrefix = L".\\"; - UString appLaunched; - bool showProgress = true; - if (!config.IsEmpty()) - { - CObjectVector pairs; - if (!GetTextConfig(config, pairs)) - { - if (!assumeYes) - MyMessageBox(L"Config failed"); - return 1; - } - UString friendlyName = GetTextConfigValue(pairs, L"Title"); - UString installPrompt = GetTextConfigValue(pairs, L"BeginPrompt"); - UString progress = GetTextConfigValue(pairs, L"Progress"); - if (progress.CompareNoCase(L"no") == 0) - showProgress = false; - int index = FindTextConfigItem(pairs, L"Directory"); - if (index >= 0) - dirPrefix = pairs[index].String; - if (!installPrompt.IsEmpty() && !assumeYes) - { - if (MessageBoxW(0, installPrompt, friendlyName, MB_YESNO | - MB_ICONQUESTION) != IDYES) - return 0; - } - appLaunched = GetTextConfigValue(pairs, L"RunProgram"); - - #ifdef _SHELL_EXECUTE - executeFile = GetTextConfigValue(pairs, L"ExecuteFile"); - executeParameters = GetTextConfigValue(pairs, L"ExecuteParameters") + switches; - #endif - } - - NFile::NDirectory::CTempDirectory tempDir; - if (!tempDir.Create(kTempDirPrefix)) - { - if (!assumeYes) - MyMessageBox(L"Can not create temp folder archive"); - return 1; - } - - COpenCallbackGUI openCallback; - - UString tempDirPath = GetUnicodeString(tempDir.GetPath()); - { - bool isCorrupt = false; - UString errorMessage; - HRESULT result = ExtractArchive(fullPath, tempDirPath, &openCallback, showProgress, - isCorrupt, errorMessage); - - if (result != S_OK) - { - if (!assumeYes) - { - if (result == S_FALSE || isCorrupt) - { - errorMessage = NWindows::MyLoadStringW(IDS_EXTRACTION_ERROR_MESSAGE); - result = E_FAIL; - } - if (result != E_ABORT && !errorMessage.IsEmpty()) - ::MessageBoxW(0, errorMessage, NWindows::MyLoadStringW(IDS_EXTRACTION_ERROR_TITLE), MB_ICONERROR); - } - return 1; - } - } - - CCurrentDirRestorer currentDirRestorer; - - if (!SetCurrentDirectory(tempDir.GetPath())) - return 1; - - HANDLE hProcess = 0; -#ifdef _SHELL_EXECUTE - if (!executeFile.IsEmpty()) - { - CSysString filePath = GetSystemString(executeFile); - SHELLEXECUTEINFO execInfo; - execInfo.cbSize = sizeof(execInfo); - execInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_DDEWAIT; - execInfo.hwnd = NULL; - execInfo.lpVerb = NULL; - execInfo.lpFile = filePath; - - if (!switches.IsEmpty()) - executeParameters += switches; - - CSysString parametersSys = GetSystemString(executeParameters); - if (parametersSys.IsEmpty()) - execInfo.lpParameters = NULL; - else - execInfo.lpParameters = parametersSys; - - execInfo.lpDirectory = NULL; - execInfo.nShow = SW_SHOWNORMAL; - execInfo.hProcess = 0; - /* BOOL success = */ ::ShellExecuteEx(&execInfo); - UINT32 result = (UINT32)(UINT_PTR)execInfo.hInstApp; - if(result <= 32) - { - if (!assumeYes) - MyMessageBox(L"Can not open file"); - return 1; - } - hProcess = execInfo.hProcess; - } - else -#endif - { - if (appLaunched.IsEmpty()) - { - appLaunched = L"setup.exe"; - if (!NFile::NFind::DoesFileExist(GetSystemString(appLaunched))) - { - if (!assumeYes) - MyMessageBox(L"Can not find setup.exe"); - return 1; - } - } - - { - UString s2 = tempDirPath; - NFile::NName::NormalizeDirPathPrefix(s2); - appLaunched.Replace(L"%%T\\", s2); - } - - appLaunched.Replace(L"%%T", tempDirPath); - - if (!switches.IsEmpty()) - { - appLaunched += L' '; - appLaunched += switches; - } - STARTUPINFO startupInfo; - startupInfo.cb = sizeof(startupInfo); - startupInfo.lpReserved = 0; - startupInfo.lpDesktop = 0; - startupInfo.lpTitle = 0; - startupInfo.dwFlags = 0; - startupInfo.cbReserved2 = 0; - startupInfo.lpReserved2 = 0; - - PROCESS_INFORMATION processInformation; - - CSysString appLaunchedSys = GetSystemString(dirPrefix + appLaunched); - - BOOL createResult = CreateProcess(NULL, (LPTSTR)(LPCTSTR)appLaunchedSys, - NULL, NULL, FALSE, 0, NULL, NULL /*tempDir.GetPath() */, - &startupInfo, &processInformation); - if (createResult == 0) - { - if (!assumeYes) - ShowLastErrorMessage(); - return 1; - } - ::CloseHandle(processInformation.hThread); - hProcess = processInformation.hProcess; - } - if (hProcess != 0) - { - WaitForSingleObject(hProcess, INFINITE); - ::CloseHandle(hProcess); - } - return 0; -} diff --git a/7zip/Bundles/SFXSetup/SFXSetup.dsp b/7zip/Bundles/SFXSetup/SFXSetup.dsp deleted file mode 100755 index a58feab5..00000000 --- a/7zip/Bundles/SFXSetup/SFXSetup.dsp +++ /dev/null @@ -1,696 +0,0 @@ -# Microsoft Developer Studio Project File - Name="SFXSetup" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=SFXSetup - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "SFXSetup.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "SFXSetup.mak" CFG="SFXSetup - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "SFXSetup - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "SFXSetup - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE "SFXSetup - Win32 ReleaseD" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "SFXSetup - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /Gz /MT /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "_SFX" /D "_NO_CRYPTO" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"C:\Util\7zS.sfx" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "SFXSetup - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "_SFX" /D "_NO_CRYPTO" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib /nologo /subsystem:windows /debug /machine:I386 /out:"C:\UTIL\7zSfxS.exe" /pdbtype:sept - -!ELSEIF "$(CFG)" == "SFXSetup - Win32 ReleaseD" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ReleaseD" -# PROP BASE Intermediate_Dir "ReleaseD" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ReleaseD" -# PROP Intermediate_Dir "ReleaseD" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O1 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "_SFX" /Yu"StdAfx.h" /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "_SFX" /D "_NO_CRYPTO" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"C:\UTIL\7zWinSR.exe" -# SUBTRACT BASE LINK32 /debug /nodefaultlib -# ADD LINK32 comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"C:\Util\7zSD.sfx" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "SFXSetup - Win32 Release" -# Name "SFXSetup - Win32 Debug" -# Name "SFXSetup - Win32 ReleaseD" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Interface" - -# PROP Default_Filter "" -# End Group -# Begin Group "7z" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Archive\7z\7zDecode.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zDecode.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zExtract.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zFolderOutStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zFolderOutStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHeader.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHeader.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zIn.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zIn.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zItem.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zMethodID.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zMethodID.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2MT.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2MT.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CrossThreadProgress.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CrossThreadProgress.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\FilterCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\FilterCoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\ItemNameUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\OutStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\OutStreamWithCRC.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Group "LZMA" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZMA\LZMADecoder.cpp -# End Source File -# End Group -# Begin Group "Branch" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Branch\BranchCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\BranchCoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\x86.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\x86_2.cpp -# End Source File -# End Group -# Begin Group "Copy" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "LZ" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.h -# End Source File -# End Group -# End Group -# Begin Group "SDK" - -# PROP Default_Filter "" -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CommandLineParser.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CommandLineParser.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\TextConfig.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\TextConfig.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\UTFConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\UTFConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Wildcard.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Wildcard.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Group "Control" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\Control\Dialog.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Control\Dialog.h -# End Source File -# End Group -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Error.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Error.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileDir.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileDir.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileIO.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileIO.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileName.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileName.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\ResourceString.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\ResourceString.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Window.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Window.h -# End Source File -# End Group -# Begin Group "7z Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\FileStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\FileStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LockedStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LockedStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamBinder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamBinder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "UI" - -# PROP Default_Filter "" -# Begin Group "Explorer" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\UI\Explorer\MyMessages.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Explorer\MyMessages.h -# End Source File -# End Group -# Begin Group "UI Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiveOpenCallback.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiveOpenCallback.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiverInfo.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiverInfo.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\DefaultName.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\DefaultName.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ExtractMode.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\OpenArchive.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\OpenArchive.h -# End Source File -# End Group -# Begin Group "GUI" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\UI\GUI\OpenCallbackGUI.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\GUI\OpenCallbackGUI.h -# End Source File -# End Group -# End Group -# Begin Group "File Manager" - -# PROP Default_Filter "" -# Begin Group "Dialog" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\FileManager\Resource\ProgressDialog\ProgressDialog.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\FileManager\Resource\ProgressDialog\ProgressDialog.h -# End Source File -# End Group -# Begin Source File - -SOURCE=..\..\FileManager\FormatUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\FileManager\FormatUtils.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\ExtractCallback.cpp -# End Source File -# Begin Source File - -SOURCE=.\ExtractCallback.h -# End Source File -# Begin Source File - -SOURCE=.\ExtractEngine.cpp -# End Source File -# Begin Source File - -SOURCE=.\ExtractEngine.h -# End Source File -# Begin Source File - -SOURCE=.\Main.cpp -# End Source File -# Begin Source File - -SOURCE=.\setup.ico -# End Source File -# End Target -# End Project diff --git a/7zip/Bundles/SFXSetup/SFXSetup.dsw b/7zip/Bundles/SFXSetup/SFXSetup.dsw deleted file mode 100755 index f563b21f..00000000 --- a/7zip/Bundles/SFXSetup/SFXSetup.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "SFXSetup"=.\SFXSetup.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Bundles/SFXSetup/StdAfx.cpp b/7zip/Bundles/SFXSetup/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Bundles/SFXSetup/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Bundles/SFXSetup/StdAfx.h b/7zip/Bundles/SFXSetup/StdAfx.h deleted file mode 100755 index 19ece34b..00000000 --- a/7zip/Bundles/SFXSetup/StdAfx.h +++ /dev/null @@ -1,10 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" -#include "../../../Common/NewHandler.h" -#include - -#endif diff --git a/7zip/Bundles/SFXSetup/makefile b/7zip/Bundles/SFXSetup/makefile deleted file mode 100755 index 1f86c42c..00000000 --- a/7zip/Bundles/SFXSetup/makefile +++ /dev/null @@ -1,156 +0,0 @@ -PROG = 7zS.sfx -LIBS = $(LIBS) user32.lib oleaut32.lib shell32.lib ole32.lib comctl32.lib -CFLAGS = $(CFLAGS) -I ../../../ \ - -DEXCLUDE_COM \ - -DNO_REGISTRY \ - -DEXTRACT_ONLY \ - -D_SFX \ - -DFORMAT_7Z \ - -DCOMPRESS_BCJ_X86 \ - -DCOMPRESS_BCJ2 \ - -DCOMPRESS_COPY \ - -DCOMPRESS_LZMA \ - -D_NO_CRYPTO - -SFX_WIN_OBJS = \ - $O\Main.obj \ - $O\ExtractCallback.obj \ - $O\ExtractEngine.obj \ - -GUI_OBJS = \ - $O\OpenCallbackGUI.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\CommandLineParser.obj \ - $O\CRC.obj \ - $O\IntToString.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\TextConfig.obj \ - $O\UTFConvert.obj \ - $O\Vector.obj \ - $O\Wildcard.obj \ - -WIN_OBJS = \ - $O\DLL.obj \ - $O\Error.obj \ - $O\FileDir.obj \ - $O\FileFind.obj \ - $O\FileIO.obj \ - $O\FileName.obj \ - $O\PropVariant.obj \ - $O\ResourceString.obj \ - $O\Synchronization.obj \ - $O\Window.obj \ - -WIN_CTRL_OBJS = \ - $O\Dialog.obj \ - -7ZIP_COMMON_OBJS = \ - $O\FileStreams.obj \ - $O\InBuffer.obj \ - $O\LimitedStreams.obj \ - $O\LockedStream.obj \ - $O\OutBuffer.obj \ - $O\ProgressUtils.obj \ - $O\StreamBinder.obj \ - $O\StreamObjects.obj \ - $O\StreamUtils.obj \ - -UI_COMMON_OBJS = \ - $O\ArchiveOpenCallback.obj \ - $O\ArchiverInfo.obj \ - $O\DefaultName.obj \ - $O\OpenArchive.obj \ - -FM_OBJS = \ - $O\FormatUtils.obj \ - -AR_COMMON_OBJS = \ - $O\CoderMixer2.obj \ - $O\CoderMixer2MT.obj \ - $O\CrossThreadProgress.obj \ - $O\FilterCoder.obj \ - $O\ItemNameUtils.obj \ - $O\OutStreamWithCRC.obj \ - -7Z_OBJS = \ - $O\7zDecode.obj \ - $O\7zExtract.obj \ - $O\7zFolderOutStream.obj \ - $O\7zHandler.obj \ - $O\7zHeader.obj \ - $O\7zIn.obj \ - $O\7zMethodID.obj \ - -BRANCH_OPT_OBJS = \ - $O\BranchCoder.obj \ - $O\x86.obj \ - $O\x86_2.obj \ - -LZ_OBJS = \ - $O\LZOutWindow.obj \ - -LZMA_OPT_OBJS = \ - $O\LZMADecoder.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(SFX_WIN_OBJS) \ - $(GUI_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(WIN_CTRL_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(UI_COMMON_OBJS) \ - $(FM_OBJS)\ - $(AR_COMMON_OBJS) \ - $(7Z_OBJS) \ - $(BRANCH_OPT_OBJS) \ - $(LZ_OBJS) \ - $(LZMA_OPT_OBJS) \ - $O\CopyCoder.obj \ - $O\MyMessages.obj \ - $O\ProgressDialog.obj \ - $O\resource.res - - -!include "../../../Build.mak" - -$(SFX_WIN_OBJS): $(*B).cpp - $(COMPL) - -$(GUI_OBJS): ../../UI/GUI/$(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(WIN_CTRL_OBJS): ../../../Windows/Control/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(UI_COMMON_OBJS): ../../UI/Common/$(*B).cpp - $(COMPL) -$(FM_OBJS): ../../FileManager/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../../Archive/Common/$(*B).cpp - $(COMPL) - -$(7Z_OBJS): ../../Archive/7z/$(*B).cpp - $(COMPL) -$(BRANCH_OPT_OBJS): ../../Compress/Branch/$(*B).cpp - $(COMPL) -$(LZ_OBJS): ../../Compress/LZ/$(*B).cpp - $(COMPL) -$(LZMA_OPT_OBJS): ../../Compress/LZMA/$(*B).cpp - $(COMPL) - -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) -$O\MyMessages.obj: ../../UI/Explorer/MyMessages.cpp - $(COMPL) -$O\ProgressDialog.obj: ../../FileManager/Resource/ProgressDialog/$(*B).cpp - $(COMPL) diff --git a/7zip/Bundles/SFXSetup/resource.h b/7zip/Bundles/SFXSetup/resource.h deleted file mode 100755 index 2c7e5a22..00000000 --- a/7zip/Bundles/SFXSetup/resource.h +++ /dev/null @@ -1,6 +0,0 @@ -#define IDI_ICON3 159 - -#define IDS_EXTRACTION_ERROR_TITLE 7 -#define IDS_EXTRACTION_ERROR_MESSAGE 8 -#define IDS_CANNOT_CREATE_FOLDER 9 -#define IDS_PROGRESS_EXTRACTING 69 diff --git a/7zip/Bundles/SFXSetup/resource.rc b/7zip/Bundles/SFXSetup/resource.rc deleted file mode 100755 index 4bf6a585..00000000 --- a/7zip/Bundles/SFXSetup/resource.rc +++ /dev/null @@ -1,16 +0,0 @@ -#include "../../MyVersionInfo.rc" -#include "resource.h" - -MY_VERSION_INFO_APP("7z Setup SFX", "7zS.sfx") - -IDI_ICON3 ICON "setup.ico" - -STRINGTABLE -BEGIN - IDS_EXTRACTION_ERROR_TITLE "Extraction Failed" - IDS_EXTRACTION_ERROR_MESSAGE "File is corrupt" - IDS_CANNOT_CREATE_FOLDER "Cannot create folder '{0}'" - IDS_PROGRESS_EXTRACTING "Extracting" -END - -#include "../../FileManager/Resource/ProgressDialog/resource.rc" diff --git a/7zip/Bundles/SFXSetup/setup.ico b/7zip/Bundles/SFXSetup/setup.ico deleted file mode 100755 index bb455be1..00000000 Binary files a/7zip/Bundles/SFXSetup/setup.ico and /dev/null differ diff --git a/7zip/Bundles/SFXWin/7z.ico b/7zip/Bundles/SFXWin/7z.ico deleted file mode 100755 index 47ffb781..00000000 Binary files a/7zip/Bundles/SFXWin/7z.ico and /dev/null differ diff --git a/7zip/Bundles/SFXWin/Main.cpp b/7zip/Bundles/SFXWin/Main.cpp deleted file mode 100755 index 166d58cb..00000000 --- a/7zip/Bundles/SFXWin/Main.cpp +++ /dev/null @@ -1,115 +0,0 @@ -// Main.cpp - -#include "StdAfx.h" - -#include - -#include "Common/StringConvert.h" -#include "Common/CommandLineParser.h" - -#include "Windows/FileDir.h" -#include "Windows/FileName.h" -#include "Windows/DLL.h" - -#include "../../ICoder.h" -#include "../../IPassword.h" -#include "../../Archive/IArchive.h" -#include "../../UI/Common/Extract.h" -#include "../../UI/Explorer/MyMessages.h" -#include "../../UI/GUI/ExtractGUI.h" - -HINSTANCE g_hInstance; -#ifndef _UNICODE -bool g_IsNT = false; -static inline bool IsItWindowsNT() -{ - OSVERSIONINFO versionInfo; - versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); - if (!::GetVersionEx(&versionInfo)) - return false; - return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT); -} -#endif - -int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /* lpCmdLine */, int /* nCmdShow */) -{ - g_hInstance = (HINSTANCE)hInstance; - #ifndef _UNICODE - g_IsNT = IsItWindowsNT(); - #endif - - UString password; - bool assumeYes = false; - bool outputFolderDefined = false; - UString outputFolder; - UStringVector subStrings; - NCommandLineParser::SplitCommandLine(GetCommandLineW(), subStrings); - for (int i = 1; i < subStrings.Size(); i++) - { - const UString &s = subStrings[i]; - if (s.CompareNoCase(L"-y") == 0) - assumeYes = true; - else if (s.Left(2).CompareNoCase(L"-o") == 0) - { - outputFolder = s.Mid(2); - NWindows::NFile::NName::NormalizeDirPathPrefix(outputFolder); - outputFolderDefined = !outputFolder.IsEmpty(); - } - else if (s.Left(2).CompareNoCase(L"-p") == 0) - { - password = s.Mid(2); - } - } - - UString path; - NWindows::NDLL::MyGetModuleFileName(g_hInstance, path); - - UString fullPath; - int fileNamePartStartIndex; - if (!NWindows::NFile::NDirectory::MyGetFullPathName(path, fullPath, fileNamePartStartIndex)) - { - MyMessageBox(L"Error 1329484"); - return 1; - } - - COpenCallbackGUI openCallback; - - openCallback.PasswordIsDefined = !password.IsEmpty(); - openCallback.Password = password; - - CExtractCallbackImp *ecs = new CExtractCallbackImp; - CMyComPtr extractCallback = ecs; - ecs->Init(); - ecs->PasswordIsDefined = !password.IsEmpty(); - ecs->Password = password; - - CExtractOptions eo; - eo.OutputDir = outputFolderDefined ? outputFolder : - fullPath.Left(fileNamePartStartIndex); - eo.YesToAll = assumeYes; - eo.OverwriteMode = assumeYes ? - NExtract::NOverwriteMode::kWithoutPrompt : - NExtract::NOverwriteMode::kAskBefore; - eo.PathMode = NExtract::NPathMode::kFullPathnames; - eo.TestMode = false; - - UStringVector v1, v2; - v1.Add(fullPath); - v2.Add(fullPath); - NWildcard::CCensorNode wildcardCensor; - wildcardCensor.AddItem(true, L"*", true, true, true); - - HRESULT result = ExtractGUI(v1, v2, - wildcardCensor, eo, (assumeYes ? false: true), &openCallback, ecs); - - /* - HRESULT result = ExtractArchive(NULL, path, assumeYes, !assumeYes, - outputFolderDefined ? outputFolder : - fullPath.Left(fileNamePartStartIndex)); - */ - if (result == S_FALSE) - MyMessageBox(L"Archive is not supported"); - else if (result != S_OK && result != E_ABORT) - ShowErrorMessage(0, result); - return 0; -} diff --git a/7zip/Bundles/SFXWin/SFXWin.dsp b/7zip/Bundles/SFXWin/SFXWin.dsp deleted file mode 100755 index ead66bc6..00000000 --- a/7zip/Bundles/SFXWin/SFXWin.dsp +++ /dev/null @@ -1,847 +0,0 @@ -# Microsoft Developer Studio Project File - Name="SFXWin" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=SFXWin - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "SFXWin.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "SFXWin.mak" CFG="SFXWin - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "SFXWin - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "SFXWin - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE "SFXWin - Win32 ReleaseD" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "SFXWin - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_PPMD" /D "_SFX" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"C:\Util\7z.sfx" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "SFXWin - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_PPMD" /D "_SFX" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /out:"C:\Util\7z.sfx" /pdbtype:sept - -!ELSEIF "$(CFG)" == "SFXWin - Win32 ReleaseD" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "SFXWin___Win32_ReleaseD" -# PROP BASE Intermediate_Dir "SFXWin___Win32_ReleaseD" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "SFXWin___Win32_ReleaseD" -# PROP Intermediate_Dir "SFXWin___Win32_ReleaseD" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /Gz /MT /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_PPMD" /D "_SFX" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /Yu"StdAfx.h" /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_PPMD" /D "_SFX" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"C:\Util\7z.sfx" /opt:NOWIN98 -# SUBTRACT BASE LINK32 /pdb:none -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"C:\Util\7zD.sfx" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "SFXWin - Win32 Release" -# Name "SFXWin - Win32 Debug" -# Name "SFXWin - Win32 ReleaseD" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "7z" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Archive\7z\7zDecode.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zDecode.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zExtract.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zFolderOutStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zFolderOutStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHeader.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zHeader.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zIn.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zIn.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zMethodID.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\7z\7zMethodID.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2MT.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CoderMixer2MT.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CrossThreadProgress.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\CrossThreadProgress.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\FilterCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\FilterCoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\ItemNameUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\OutStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Archive\Common\OutStreamWithCRC.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Group "LZMA" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZMA\LZMADecoder.cpp -# End Source File -# End Group -# Begin Group "Branch" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Branch\BranchCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\BranchCoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\x86.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Branch\x86_2.cpp -# End Source File -# End Group -# Begin Group "PPMD" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDContext.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDDecode.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDSubAlloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\PPMD\PPMDType.h -# End Source File -# End Group -# Begin Group "LZ" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.h -# End Source File -# End Group -# Begin Group "Copy" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# End Group -# Begin Group "Crypto" - -# PROP Default_Filter "" -# Begin Group "AES" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\AES\aes.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\AES_CBC.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\aescpp.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\aescrypt.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\aeskey.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\aesopt.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\aestab.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\MyAES.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\AES\MyAES.h -# End Source File -# End Group -# Begin Group "7zAES" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\7zAES\7zAES.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\7zAES\7zAES.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\7zAES\MySHA256.h -# End Source File -# End Group -# Begin Group "Hash" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\Hash\RotateDefs.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Sha256.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Sha256.h -# End Source File -# End Group -# End Group -# Begin Group "Dialogs" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\FileManager\Resource\MessagesDialog\MessagesDialog.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\FileManager\Resource\MessagesDialog\MessagesDialog.h -# End Source File -# Begin Source File - -SOURCE=..\..\FileManager\Resource\OverwriteDialog\OverwriteDialog.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\FileManager\Resource\OverwriteDialog\OverwriteDialog.h -# End Source File -# Begin Source File - -SOURCE=..\..\FileManager\Resource\PasswordDialog\PasswordDialog.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\FileManager\Resource\PasswordDialog\PasswordDialog.h -# End Source File -# Begin Source File - -SOURCE=..\..\FileManager\Resource\ProgressDialog\ProgressDialog.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\FileManager\Resource\ProgressDialog\ProgressDialog.h -# End Source File -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\FilePathAutoRename.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\FilePathAutoRename.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\FileStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\FileStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LockedStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LockedStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamBinder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamBinder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "File Manager" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\FileManager\ExtractCallback.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\FileManager\ExtractCallback.h -# End Source File -# Begin Source File - -SOURCE=..\..\FileManager\FormatUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\FileManager\FormatUtils.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Group "Control" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\Control\Dialog.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Control\Dialog.h -# End Source File -# End Group -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Error.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Error.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileDir.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileDir.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileIO.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileIO.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileName.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileName.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariantConversions.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariantConversions.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\ResourceString.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\ResourceString.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Shell.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Shell.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Window.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Window.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CommandLineParser.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CommandLineParser.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Wildcard.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Wildcard.h -# End Source File -# End Group -# Begin Group "UI" - -# PROP Default_Filter "" -# Begin Group "UI Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiveExtractCallback.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiveExtractCallback.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiveOpenCallback.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiveOpenCallback.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiverInfo.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ArchiverInfo.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\DefaultName.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\DefaultName.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\Extract.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\Extract.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ExtractingFilePath.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\ExtractingFilePath.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\OpenArchive.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\OpenArchive.h -# End Source File -# End Group -# Begin Group "GUI" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\UI\GUI\ExtractDialog.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\GUI\ExtractDialog.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\GUI\ExtractGUI.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\GUI\ExtractGUI.h -# End Source File -# Begin Source File - -SOURCE=..\..\UI\GUI\OpenCallbackGUI.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\GUI\OpenCallbackGUI.h -# End Source File -# End Group -# Begin Group "Explorer" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\UI\Explorer\MyMessages.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Explorer\MyMessages.h -# End Source File -# End Group -# End Group -# Begin Source File - -SOURCE=.\7z.ico -# End Source File -# Begin Source File - -SOURCE=.\7z1.ico -# End Source File -# Begin Source File - -SOURCE=.\Main.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# End Target -# End Project diff --git a/7zip/Bundles/SFXWin/SFXWin.dsw b/7zip/Bundles/SFXWin/SFXWin.dsw deleted file mode 100755 index a9926c71..00000000 --- a/7zip/Bundles/SFXWin/SFXWin.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "SFXWin"=.\SFXWin.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Bundles/SFXWin/StdAfx.cpp b/7zip/Bundles/SFXWin/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Bundles/SFXWin/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Bundles/SFXWin/StdAfx.h b/7zip/Bundles/SFXWin/StdAfx.h deleted file mode 100755 index c5f7231f..00000000 --- a/7zip/Bundles/SFXWin/StdAfx.h +++ /dev/null @@ -1,12 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" -#include "../../../Common/NewHandler.h" - -#include -#include - -#endif diff --git a/7zip/Bundles/SFXWin/makefile b/7zip/Bundles/SFXWin/makefile deleted file mode 100755 index 00d3ecc6..00000000 --- a/7zip/Bundles/SFXWin/makefile +++ /dev/null @@ -1,207 +0,0 @@ -PROG = 7z.sfx -LIBS = $(LIBS) user32.lib oleaut32.lib shell32.lib ole32.lib -CFLAGS = $(CFLAGS) -I ../../../ \ - -DEXCLUDE_COM \ - -DNO_REGISTRY \ - -DEXTRACT_ONLY \ - -D_SFX \ - -DFORMAT_7Z \ - -DCOMPRESS_BCJ_X86 \ - -DCOMPRESS_BCJ2 \ - -DCOMPRESS_COPY \ - -DCOMPRESS_LZMA \ - -DCOMPRESS_PPMD \ - -DCRYPTO_AES \ - -DCRYPTO_7ZAES \ - - -SFX_WIN_OBJS = \ - $O\Main.obj \ - -GUI_OBJS = \ - $O\ExtractDialog.obj \ - $O\ExtractGUI.obj \ - $O\OpenCallbackGUI.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\CommandLineParser.obj \ - $O\CRC.obj \ - $O\IntToString.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\Vector.obj \ - $O\Wildcard.obj \ - -WIN_OBJS = \ - $O\DLL.obj \ - $O\Error.obj \ - $O\FileDir.obj \ - $O\FileFind.obj \ - $O\FileIO.obj \ - $O\FileName.obj \ - $O\PropVariant.obj \ - $O\PropVariantConversions.obj \ - $O\ResourceString.obj \ - $O\Shell.obj \ - $O\Synchronization.obj \ - $O\Window.obj \ - -WIN_CTRL_OBJS = \ - $O\Dialog.obj \ - -7ZIP_COMMON_OBJS = \ - $O\FilePathAutoRename.obj \ - $O\FileStreams.obj \ - $O\InBuffer.obj \ - $O\LimitedStreams.obj \ - $O\LockedStream.obj \ - $O\OutBuffer.obj \ - $O\ProgressUtils.obj \ - $O\StreamBinder.obj \ - $O\StreamObjects.obj \ - $O\StreamUtils.obj \ - -UI_COMMON_OBJS = \ - $O\ArchiveExtractCallback.obj \ - $O\ArchiveOpenCallback.obj \ - $O\ArchiverInfo.obj \ - $O\DefaultName.obj \ - $O\Extract.obj \ - $O\ExtractingFilePath.obj \ - $O\OpenArchive.obj \ - -FM_OBJS = \ - $O\ExtractCallback.obj \ - $O\FormatUtils.obj \ - -AR_COMMON_OBJS = \ - $O\CoderMixer2.obj \ - $O\CoderMixer2MT.obj \ - $O\CrossThreadProgress.obj \ - $O\FilterCoder.obj \ - $O\ItemNameUtils.obj \ - $O\OutStreamWithCRC.obj \ - -7Z_OBJS = \ - $O\7zDecode.obj \ - $O\7zExtract.obj \ - $O\7zFolderOutStream.obj \ - $O\7zHandler.obj \ - $O\7zHeader.obj \ - $O\7zIn.obj \ - $O\7zMethodID.obj \ - -BRANCH_OPT_OBJS = \ - $O\BranchCoder.obj \ - $O\x86.obj \ - $O\x86_2.obj \ - -LZ_OBJS = \ - $O\LZOutWindow.obj \ - -LZMA_OPT_OBJS = \ - $O\LZMADecoder.obj \ - -PPMD_OPT_OBJS = \ - $O\PPMDDecoder.obj \ - -7ZAES_OPT_OBJS = \ - $O\7zAES.obj \ - -AES_OPT_OBJS = \ - $O\MyAES.obj \ - -AES_ORIG_OBJS = \ - $O\aescrypt.obj \ - $O\aeskey.obj \ - $O\aestab.obj \ - -CRYPTO_HASH_OBJS = \ - $O\Sha256.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(SFX_WIN_OBJS) \ - $(GUI_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(WIN_CTRL_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(UI_COMMON_OBJS) \ - $(FM_OBJS)\ - $(AR_COMMON_OBJS) \ - $(7Z_OBJS) \ - $(BRANCH_OPT_OBJS) \ - $(LZ_OBJS) \ - $(LZMA_OPT_OBJS) \ - $(PPMD_OPT_OBJS) \ - $O\CopyCoder.obj \ - $(CRYPTO_HASH_OBJS) \ - $(7ZAES_OPT_OBJS) \ - $(AES_OPT_OBJS) \ - $(AES_ORIG_OBJS) \ - $O\MyMessages.obj \ - $O\MessagesDialog.obj \ - $O\OverwriteDialog.obj \ - $O\PasswordDialog.obj \ - $O\ProgressDialog.obj \ - $O\resource.res - - -!include "../../../Build.mak" - -$(SFX_WIN_OBJS): $(*B).cpp - $(COMPL) - -$(GUI_OBJS): ../../UI/GUI/$(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(WIN_CTRL_OBJS): ../../../Windows/Control/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(UI_COMMON_OBJS): ../../UI/Common/$(*B).cpp - $(COMPL) -$(FM_OBJS): ../../FileManager/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../../Archive/Common/$(*B).cpp - $(COMPL) - -$(7Z_OBJS): ../../Archive/7z/$(*B).cpp - $(COMPL) -$(BRANCH_OPT_OBJS): ../../Compress/Branch/$(*B).cpp - $(COMPL) -$(LZ_OBJS): ../../Compress/LZ/$(*B).cpp - $(COMPL) -$(LZMA_OPT_OBJS): ../../Compress/LZMA/$(*B).cpp - $(COMPL) -$(PPMD_OPT_OBJS): ../../Compress/PPMD/$(*B).cpp - $(COMPL) - -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) - -$(CRYPTO_HASH_OBJS): ../../Crypto/Hash/$(*B).cpp - $(COMPL) -$(7ZAES_OPT_OBJS): ../../Crypto/7zAES/$(*B).cpp - $(COMPL) -$(AES_OPT_OBJS): ../../Crypto/AES/$(*B).cpp - $(COMPL) -$(AES_ORIG_OBJS): ../../Crypto/AES/$(*B).c - $(COMPL_O1_W3) - -$O\MyMessages.obj: ../../UI/Explorer/MyMessages.cpp - $(COMPL) -$O\MessagesDialog.obj: ../../FileManager/Resource/MessagesDialog/$(*B).cpp - $(COMPL) -$O\OverwriteDialog.obj: ../../FileManager/Resource/OverwriteDialog./$(*B).cpp - $(COMPL) -$O\PasswordDialog.obj: ../../FileManager/Resource/PasswordDialog/$(*B).cpp - $(COMPL) -$O\ProgressDialog.obj: ../../FileManager/Resource/ProgressDialog/$(*B).cpp - $(COMPL) diff --git a/7zip/Bundles/SFXWin/resource.h b/7zip/Bundles/SFXWin/resource.h deleted file mode 100755 index 0a460213..00000000 --- a/7zip/Bundles/SFXWin/resource.h +++ /dev/null @@ -1,7 +0,0 @@ -#define IDD_DIALOG_EXTRACT 137 - -#define IDI_ICON3 159 - -#define IDC_STATIC_EXTRACT_EXTRACT_TO 1020 -#define IDC_EXTRACT_COMBO_PATH 1021 -#define IDC_EXTRACT_BUTTON_SET_PATH 1022 diff --git a/7zip/Bundles/SFXWin/resource.rc b/7zip/Bundles/SFXWin/resource.rc deleted file mode 100755 index 60304803..00000000 --- a/7zip/Bundles/SFXWin/resource.rc +++ /dev/null @@ -1,34 +0,0 @@ -#include "../../MyVersionInfo.rc" -#include "../../GuiCommon.rc" -#include "resource.h" - -MY_VERSION_INFO_APP("7z SFX", "7z.sfx") - -#define xSize2 214 -#define ySize2 64 - -#define xSize (xSize2 + marg + marg) -#define ySize (ySize2 + marg + marg) - -#define bYPos (ySize - marg - bYSize) -#define bXPos1 (xSize - marg - bXSize) -#define bXPos2 (bXPos1 - 10 - bXSize) - -IDI_ICON3 ICON "7z.ico" - -IDD_DIALOG_EXTRACT DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE -CAPTION "7-Zip self-extracting archive" -MY_FONT -BEGIN - LTEXT "E&xtract to:", IDC_STATIC_EXTRACT_EXTRACT_TO, marg, marg, xSize2, 8 - EDITTEXT IDC_EXTRACT_COMBO_PATH, marg, 21, xSize2 - bDotsSize - 13, 14, ES_AUTOHSCROLL - PUSHBUTTON "...", IDC_EXTRACT_BUTTON_SET_PATH, xSize - marg - bDotsSize, 20, bDotsSize, bYSize, WS_GROUP - DEFPUSHBUTTON "Extract", IDOK, , bXPos2, bYPos, bXSize, bYSize, WS_GROUP - PUSHBUTTON "Cancel", IDCANCEL, bXPos1, bYPos, bXSize, bYSize -END - -#include "../../FileManager/Resource/MessagesDialog/resource.rc" -#include "../../FileManager/Resource/OverwriteDialog/resource.rc" -#include "../../FileManager/Resource/PasswordDialog/resource.rc" -#include "../../FileManager/Resource/ProgressDialog/resource.rc" -#include "../../UI/Resource/Extract/resource.rc" diff --git a/7zip/Bundles/makefile b/7zip/Bundles/makefile deleted file mode 100755 index 108cbd17..00000000 --- a/7zip/Bundles/makefile +++ /dev/null @@ -1,13 +0,0 @@ -DIRS = \ - Alone\~ \ - Alone7z\~ \ - Format7z\~ \ - Format7zExtract\~ \ - SFXCon\~ \ - SFXSetup\~ \ - SFXWin\~ \ - -all: $(DIRS) - -$(DIRS): -!include "../SubBuild.mak" diff --git a/7zip/Common/FilePathAutoRename.cpp b/7zip/Common/FilePathAutoRename.cpp deleted file mode 100755 index 3c5b910f..00000000 --- a/7zip/Common/FilePathAutoRename.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// FilePathAutoRename.cpp - -#include "StdAfx.h" -#include "FilePathAutoRename.h" - -#include "Common/Defs.h" -#include "Common/IntToString.h" - -#include "Windows/FileName.h" -#include "Windows/FileFind.h" - -using namespace NWindows; - -static bool MakeAutoName(const UString &name, - const UString &extension, int value, UString &path) -{ - wchar_t number[32]; - ConvertUInt64ToString(value, number); - path = name; - path += number; - path += extension; - return NFile::NFind::DoesFileExist(path); -} - -bool AutoRenamePath(UString &fullProcessedPath) -{ - UString path; - int dotPos = fullProcessedPath.ReverseFind(L'.'); - - int slashPos = fullProcessedPath.ReverseFind(L'/'); - #ifdef _WIN32 - int slash1Pos = fullProcessedPath.ReverseFind(L'\\'); - slashPos = MyMax(slashPos, slash1Pos); - #endif - - UString name, extension; - if (dotPos > slashPos && dotPos > 0) - { - name = fullProcessedPath.Left(dotPos); - extension = fullProcessedPath.Mid(dotPos); - } - else - name = fullProcessedPath; - name += L'_'; - int indexLeft = 1, indexRight = (1 << 30); - while (indexLeft != indexRight) - { - int indexMid = (indexLeft + indexRight) / 2; - if (MakeAutoName(name, extension, indexMid, path)) - indexLeft = indexMid + 1; - else - indexRight = indexMid; - } - if (MakeAutoName(name, extension, indexRight, fullProcessedPath)) - return false; - return true; -} diff --git a/7zip/Common/FilePathAutoRename.h b/7zip/Common/FilePathAutoRename.h deleted file mode 100755 index 99323094..00000000 --- a/7zip/Common/FilePathAutoRename.h +++ /dev/null @@ -1,10 +0,0 @@ -// Util/FilePathAutoRename.h - -#ifndef __FILEPATHAUTORENAME_H -#define __FILEPATHAUTORENAME_H - -#include "Common/String.h" - -bool AutoRenamePath(UString &fullProcessedPath); - -#endif diff --git a/7zip/Common/FileStreams.cpp b/7zip/Common/FileStreams.cpp deleted file mode 100755 index 8a000e4e..00000000 --- a/7zip/Common/FileStreams.cpp +++ /dev/null @@ -1,251 +0,0 @@ -// FileStreams.cpp - -#include "StdAfx.h" - -#ifndef _WIN32 -#include -#include -#include -#endif - -#include "FileStreams.h" - -static inline HRESULT ConvertBoolToHRESULT(bool result) -{ - // return result ? S_OK: E_FAIL; - #ifdef _WIN32 - return result ? S_OK: (::GetLastError()); - #else - return result ? S_OK: E_FAIL; - #endif -} - -bool CInFileStream::Open(LPCTSTR fileName) -{ - return File.Open(fileName); -} - -#ifdef _WIN32 -#ifndef _UNICODE -bool CInFileStream::Open(LPCWSTR fileName) -{ - return File.Open(fileName); -} -#endif -#endif - -STDMETHODIMP CInFileStream::Read(void *data, UInt32 size, UInt32 *processedSize) -{ - #ifdef _WIN32 - - UInt32 realProcessedSize; - bool result = File.ReadPart(data, size, realProcessedSize); - if(processedSize != NULL) - *processedSize = realProcessedSize; - return ConvertBoolToHRESULT(result); - - #else - - if(processedSize != NULL) - *processedSize = 0; - ssize_t res = File.Read(data, (size_t)size); - if (res == -1) - return E_FAIL; - if(processedSize != NULL) - *processedSize = (UInt32)res; - return S_OK; - - #endif -} - -#ifndef _WIN32_WCE -STDMETHODIMP CStdInFileStream::Read(void *data, UInt32 size, UInt32 *processedSize) -{ - #ifdef _WIN32 - UInt32 realProcessedSize; - BOOL res = ::ReadFile(GetStdHandle(STD_INPUT_HANDLE), - data, size, (DWORD *)&realProcessedSize, NULL); - if(processedSize != NULL) - *processedSize = realProcessedSize; - if (res == FALSE && GetLastError() == ERROR_BROKEN_PIPE) - return S_OK; - return ConvertBoolToHRESULT(res != FALSE); - - #else - - if(processedSize != NULL) - *processedSize = 0; - ssize_t res; - do - { - res = read(0, data, (size_t)size); - } - while (res < 0 && (errno == EINTR)); - if (res == -1) - return E_FAIL; - if(processedSize != NULL) - *processedSize = (UInt32)res; - return S_OK; - - #endif -} - -#endif - -STDMETHODIMP CInFileStream::Seek(Int64 offset, UInt32 seekOrigin, - UInt64 *newPosition) -{ - if(seekOrigin >= 3) - return STG_E_INVALIDFUNCTION; - - #ifdef _WIN32 - - UInt64 realNewPosition; - bool result = File.Seek(offset, seekOrigin, realNewPosition); - if(newPosition != NULL) - *newPosition = realNewPosition; - return ConvertBoolToHRESULT(result); - - #else - - off_t res = File.Seek(offset, seekOrigin); - if (res == -1) - return E_FAIL; - if(newPosition != NULL) - *newPosition = (UInt64)res; - return S_OK; - - #endif -} - -STDMETHODIMP CInFileStream::GetSize(UInt64 *size) -{ - return ConvertBoolToHRESULT(File.GetLength(*size)); -} - - -////////////////////////// -// COutFileStream - -bool COutFileStream::Create(LPCTSTR fileName, bool createAlways) -{ - return File.Create(fileName, createAlways); -} - -#ifdef _WIN32 -#ifndef _UNICODE -bool COutFileStream::Create(LPCWSTR fileName, bool createAlways) -{ - return File.Create(fileName, createAlways); -} -#endif -#endif - -STDMETHODIMP COutFileStream::Write(const void *data, UInt32 size, UInt32 *processedSize) -{ - #ifdef _WIN32 - - UInt32 realProcessedSize; - bool result = File.WritePart(data, size, realProcessedSize); - if(processedSize != NULL) - *processedSize = realProcessedSize; - return ConvertBoolToHRESULT(result); - - #else - - if(processedSize != NULL) - *processedSize = 0; - ssize_t res = File.Write(data, (size_t)size); - if (res == -1) - return E_FAIL; - if(processedSize != NULL) - *processedSize = (UInt32)res; - return S_OK; - - #endif -} - -STDMETHODIMP COutFileStream::Seek(Int64 offset, UInt32 seekOrigin, - UInt64 *newPosition) -{ - if(seekOrigin >= 3) - return STG_E_INVALIDFUNCTION; - #ifdef _WIN32 - - UInt64 realNewPosition; - bool result = File.Seek(offset, seekOrigin, realNewPosition); - if(newPosition != NULL) - *newPosition = realNewPosition; - return ConvertBoolToHRESULT(result); - - #else - - off_t res = File.Seek(offset, seekOrigin); - if (res == -1) - return E_FAIL; - if(newPosition != NULL) - *newPosition = (UInt64)res; - return S_OK; - - #endif -} - -STDMETHODIMP COutFileStream::SetSize(Int64 newSize) -{ - #ifdef _WIN32 - UInt64 currentPos; - if(!File.Seek(0, FILE_CURRENT, currentPos)) - return E_FAIL; - bool result = File.SetLength(newSize); - UInt64 currentPos2; - result = result && File.Seek(currentPos, currentPos2); - return result ? S_OK : E_FAIL; - #else - return E_FAIL; - #endif -} - -#ifndef _WIN32_WCE -STDMETHODIMP CStdOutFileStream::Write(const void *data, UInt32 size, UInt32 *processedSize) -{ - if(processedSize != NULL) - *processedSize = 0; - - #ifdef _WIN32 - UInt32 realProcessedSize; - BOOL res = TRUE; - if (size > 0) - { - // Seems that Windows doesn't like big amounts writing to stdout. - // So we limit portions by 32KB. - UInt32 sizeTemp = (1 << 15); - if (sizeTemp > size) - sizeTemp = size; - res = ::WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), - data, sizeTemp, (DWORD *)&realProcessedSize, NULL); - size -= realProcessedSize; - data = (const void *)((const Byte *)data + realProcessedSize); - if(processedSize != NULL) - *processedSize += realProcessedSize; - } - return ConvertBoolToHRESULT(res != FALSE); - - #else - - ssize_t res; - do - { - res = write(1, data, (size_t)size); - } - while (res < 0 && (errno == EINTR)); - if (res == -1) - return E_FAIL; - if(processedSize != NULL) - *processedSize = (UInt32)res; - return S_OK; - - return S_OK; - #endif -} - -#endif diff --git a/7zip/Common/FileStreams.h b/7zip/Common/FileStreams.h deleted file mode 100755 index 9326372a..00000000 --- a/7zip/Common/FileStreams.h +++ /dev/null @@ -1,98 +0,0 @@ -// FileStreams.h - -#ifndef __FILESTREAMS_H -#define __FILESTREAMS_H - -#ifdef _WIN32 -#include "../../Windows/FileIO.h" -#else -#include "../../Common/C_FileIO.h" -#endif - -#include "../IStream.h" -#include "../../Common/MyCom.h" - -class CInFileStream: - public IInStream, - public IStreamGetSize, - public CMyUnknownImp -{ -public: - #ifdef _WIN32 - NWindows::NFile::NIO::CInFile File; - #else - NC::NFile::NIO::CInFile File; - #endif - CInFileStream() {} - virtual ~CInFileStream() {} - - bool Open(LPCTSTR fileName); - #ifdef _WIN32 - #ifndef _UNICODE - bool Open(LPCWSTR fileName); - #endif - #endif - - MY_UNKNOWN_IMP2(IInStream, IStreamGetSize) - - STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); - STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition); - - STDMETHOD(GetSize)(UInt64 *size); -}; - -#ifndef _WIN32_WCE -class CStdInFileStream: - public ISequentialInStream, - public CMyUnknownImp -{ -public: - // HANDLE File; - // CStdInFileStream() File(INVALID_HANDLE_VALUE): {} - // void Open() { File = GetStdHandle(STD_INPUT_HANDLE); }; - MY_UNKNOWN_IMP - - virtual ~CStdInFileStream() {} - STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); -}; -#endif - -class COutFileStream: - public IOutStream, - public CMyUnknownImp -{ -public: - #ifdef _WIN32 - NWindows::NFile::NIO::COutFile File; - #else - NC::NFile::NIO::COutFile File; - #endif - virtual ~COutFileStream() {} - bool Create(LPCTSTR fileName, bool createAlways); - #ifdef _WIN32 - #ifndef _UNICODE - bool Create(LPCWSTR fileName, bool createAlways); - #endif - #endif - - MY_UNKNOWN_IMP1(IOutStream) - - STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); - STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition); - STDMETHOD(SetSize)(Int64 newSize); -}; - -#ifndef _WIN32_WCE -class CStdOutFileStream: - public ISequentialOutStream, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP - - virtual ~CStdOutFileStream() {} - STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); -}; -#endif - -#endif diff --git a/7zip/Common/InBuffer.cpp b/7zip/Common/InBuffer.cpp deleted file mode 100755 index 02f2adfa..00000000 --- a/7zip/Common/InBuffer.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// InBuffer.cpp - -#include "StdAfx.h" - -#include "InBuffer.h" - -#include "../../Common/Alloc.h" - -CInBuffer::CInBuffer(): - _buffer(0), - _bufferLimit(0), - _bufferBase(0), - _stream(0), - _bufferSize(0) -{} - -bool CInBuffer::Create(UInt32 bufferSize) -{ - const UInt32 kMinBlockSize = 1; - if (bufferSize < kMinBlockSize) - bufferSize = kMinBlockSize; - if (_bufferBase != 0 && _bufferSize == bufferSize) - return true; - Free(); - _bufferSize = bufferSize; - _bufferBase = (Byte *)::MidAlloc(bufferSize); - return (_bufferBase != 0); -} - -void CInBuffer::Free() -{ - ::MidFree(_bufferBase); - _bufferBase = 0; -} - -void CInBuffer::SetStream(ISequentialInStream *stream) -{ - _stream = stream; -} - -void CInBuffer::Init() -{ - _processedSize = 0; - _buffer = _bufferBase; - _bufferLimit = _buffer; - _wasFinished = false; - #ifdef _NO_EXCEPTIONS - ErrorCode = S_OK; - #endif -} - -bool CInBuffer::ReadBlock() -{ - #ifdef _NO_EXCEPTIONS - if (ErrorCode != S_OK) - return false; - #endif - if (_wasFinished) - return false; - _processedSize += (_buffer - _bufferBase); - UInt32 numProcessedBytes; - HRESULT result = _stream->Read(_bufferBase, _bufferSize, &numProcessedBytes); - #ifdef _NO_EXCEPTIONS - ErrorCode = result; - #else - if (result != S_OK) - throw CInBufferException(result); - #endif - _buffer = _bufferBase; - _bufferLimit = _buffer + numProcessedBytes; - _wasFinished = (numProcessedBytes == 0); - return (!_wasFinished); -} - -Byte CInBuffer::ReadBlock2() -{ - if(!ReadBlock()) - return 0xFF; - return *_buffer++; -} diff --git a/7zip/Common/InBuffer.h b/7zip/Common/InBuffer.h deleted file mode 100755 index 057caa16..00000000 --- a/7zip/Common/InBuffer.h +++ /dev/null @@ -1,76 +0,0 @@ -// InBuffer.h - -#ifndef __INBUFFER_H -#define __INBUFFER_H - -#include "../IStream.h" -#include "../../Common/MyCom.h" - -#ifndef _NO_EXCEPTIONS -class CInBufferException -{ -public: - HRESULT ErrorCode; - CInBufferException(HRESULT errorCode): ErrorCode(errorCode) {} -}; -#endif - -class CInBuffer -{ - Byte *_buffer; - Byte *_bufferLimit; - Byte *_bufferBase; - CMyComPtr _stream; - UInt64 _processedSize; - UInt32 _bufferSize; - bool _wasFinished; - - bool ReadBlock(); - Byte ReadBlock2(); - -public: - #ifdef _NO_EXCEPTIONS - HRESULT ErrorCode; - #endif - - CInBuffer(); - ~CInBuffer() { Free(); } - - bool Create(UInt32 bufferSize); - void Free(); - - void SetStream(ISequentialInStream *stream); - void Init(); - void ReleaseStream() { _stream.Release(); } - - bool ReadByte(Byte &b) - { - if(_buffer >= _bufferLimit) - if(!ReadBlock()) - return false; - b = *_buffer++; - return true; - } - Byte ReadByte() - { - if(_buffer >= _bufferLimit) - return ReadBlock2(); - return *_buffer++; - } - void ReadBytes(void *data, UInt32 size, UInt32 &processedSize) - { - for(processedSize = 0; processedSize < size; processedSize++) - if (!ReadByte(((Byte *)data)[processedSize])) - return; - } - bool ReadBytes(void *data, UInt32 size) - { - UInt32 processedSize; - ReadBytes(data, size, processedSize); - return (processedSize == size); - } - UInt64 GetProcessedSize() const { return _processedSize + (_buffer - _bufferBase); } - bool WasFinished() const { return _wasFinished; } -}; - -#endif diff --git a/7zip/Common/InMemStream.cpp b/7zip/Common/InMemStream.cpp deleted file mode 100755 index 036ef3bd..00000000 --- a/7zip/Common/InMemStream.cpp +++ /dev/null @@ -1,222 +0,0 @@ -// InMemStream.cpp - -#include "StdAfx.h" - -#include - -#include "Windows/Thread.h" - -#include "InMemStream.h" -#include "../../Common/Defs.h" - -void CStreamInfo::Free(IInMemStreamMtCallback *callback) -{ - for (int i = 0; i < Blocks.Size(); i++) - { - callback->FreeBlock(Blocks[i]); - Blocks[i] = 0; - } -} - -bool CInMemStreamMt::Create(int numSubStreams, UInt64 subStreamSize) -{ - Free(); - _subStreamSize = subStreamSize; - size_t blockSize = Callback->GetBlockSize(); - for (int i = 0; i < numSubStreams; i++) - { - _streams.Add(CStreamInfo()); - CStreamInfo &blocks = _streams.Back(); - blocks.Create(); - for (UInt64 j = 0; (UInt64)j * blockSize < _subStreamSize; j++) - blocks.Blocks.Add(0); - } - if (!_streamIndexAllocator.AllocateList(numSubStreams)) - return false; - return true; -} - -void CInMemStreamMt::Free() -{ - while(_streams.Size() > 0) - { - _streams.Back().Free(Callback); - _streams.DeleteBack(); - } -} - -HRESULT CInMemStreamMt::Read() -{ - for (;;) - { - // printf("\n_streamIndexAllocator.AllocateItem\n"); - int index = _streamIndexAllocator.AllocateItem(); - /* - if (_stopReading) - return E_ABORT; - */ - // printf("\nread Index = %d\n", index); - CStreamInfo &blocks = _streams[index]; - blocks.Init(); - Callback->AddStreamIndexToQueue(index); - - for (;;) - { - const Byte *p = (const Byte *)blocks.Blocks[blocks.LastBlockIndex]; - if (p == 0) - { - void **pp = &blocks.Blocks[blocks.LastBlockIndex]; - HRESULT res = Callback->AllocateBlock(pp); - p = (const Byte *)*pp; - RINOK(res); - if (p == 0) - return E_FAIL; - } - size_t blockSize = Callback->GetBlockSize(); - UInt32 curSize = (UInt32)(blockSize - blocks.LastBlockPos); - UInt32 realProcessedSize; - UInt64 pos64 = (UInt64)blocks.LastBlockIndex * blockSize + blocks.LastBlockPos; - if (curSize > _subStreamSize - pos64) - curSize = (UInt32)(_subStreamSize - pos64); - RINOK(_stream->Read((void *)(p + blocks.LastBlockPos), curSize, &realProcessedSize)); - - blocks.Cs->Enter(); - if (realProcessedSize == 0) - { - blocks.StreamWasFinished = true; - blocks.CanReadEvent->Set(); - blocks.Cs->Leave(); - - Callback->AddStreamIndexToQueue(-1); - return S_OK; - } - - blocks.LastBlockPos += realProcessedSize; - if (blocks.LastBlockPos == blockSize) - { - blocks.LastBlockPos = 0; - blocks.LastBlockIndex++; - } - pos64 += realProcessedSize; - if (pos64 >= _subStreamSize) - blocks.StreamWasFinished = true; - blocks.CanReadEvent->Set(); - blocks.Cs->Leave(); - if (pos64 >= _subStreamSize) - break; - } - } -} - -static DWORD WINAPI CoderThread(void *threadCoderInfo) -{ - ((CInMemStreamMt *)threadCoderInfo)->ReadResult = ((CInMemStreamMt *)threadCoderInfo)->Read(); - return 0; -} - -bool CInMemStreamMt::StartReadThread() -{ - // _stopReading = false; - NWindows::CThread Thread; - return Thread.Create(CoderThread, this); -} - -void CInMemStreamMt::FreeSubStream(int subStreamIndex) -{ - // printf("\nFreeSubStream\n"); - _streams[subStreamIndex].Free(Callback); - _streamIndexAllocator.FreeItem(subStreamIndex); - // printf("\nFreeSubStream end\n"); -} - -HRESULT CInMemStreamMt::ReadSubStream(int subStreamIndex, void *data, UInt32 size, UInt32 *processedSize, bool keepData) -{ - if (processedSize != NULL) - *processedSize = 0; - CStreamInfo &blocks = _streams[subStreamIndex]; - while (size > 0) - { - if (blocks.CurBlockPos == Callback->GetBlockSize()) - { - blocks.CurBlockPos = 0; - blocks.CurBlockIndex++; - } - UInt32 curSize; - UInt32 curPos = blocks.CurBlockPos; - - blocks.Cs->Enter(); - if (blocks.CurBlockIndex == blocks.LastBlockIndex) - { - curSize = blocks.LastBlockPos - curPos; - if (curSize == 0) - { - if (blocks.StreamWasFinished) - { - blocks.Cs->Leave(); - void *p = blocks.Blocks[blocks.CurBlockIndex]; - if (p != 0 && !keepData) - { - Callback->FreeBlock(p); - blocks.Blocks[blocks.CurBlockIndex] = 0; - } - return S_OK; - } - blocks.CanReadEvent->Reset(); - blocks.Cs->Leave(); - // printf("\nBlock Lock\n"); - blocks.CanReadEvent->Lock(); - // printf("\nAfter Lock\n"); - if (blocks.ExitResult != S_OK) - return blocks.ExitResult; - continue; - } - } - else - curSize = Callback->GetBlockSize() - curPos; - blocks.Cs->Leave(); - - if (curSize > size) - curSize = size; - void *p = blocks.Blocks[blocks.CurBlockIndex]; - memmove(data, (const Byte *)p + curPos, curSize); - data = (void *)((Byte *)data + curSize); - size -= curSize; - if (processedSize != NULL) - *processedSize += curSize; - curPos += curSize; - - bool needFree = false; - blocks.CurBlockPos = curPos; - - if (curPos == Callback->GetBlockSize()) - needFree = true; - blocks.Cs->Enter(); - if (blocks.CurBlockIndex == blocks.LastBlockIndex && - blocks.CurBlockPos == blocks.LastBlockPos && - blocks.StreamWasFinished) - needFree = true; - blocks.Cs->Leave(); - - if (needFree && !keepData) - { - Callback->FreeBlock(p); - blocks.Blocks[blocks.CurBlockIndex] = 0; - } - return S_OK; - } - return S_OK; -} - -STDMETHODIMP CInMemStream::Read(void *data, UInt32 size, UInt32 *processedSize) -{ - UInt32 realProcessedSize; - HRESULT result = mtStream->ReadSubStream(Index, data, size, &realProcessedSize, _keepData); - if (processedSize != NULL) - *processedSize = realProcessedSize; - if (realProcessedSize != 0) - { - // printf("\ns = %d\n", Index); - } - _size += realProcessedSize; - return result; -} diff --git a/7zip/Common/InMemStream.h b/7zip/Common/InMemStream.h deleted file mode 100755 index fcd0092d..00000000 --- a/7zip/Common/InMemStream.h +++ /dev/null @@ -1,282 +0,0 @@ -// InMemStream.h - -#ifndef __INMEMSTREAM_H -#define __INMEMSTREAM_H - -#include - -#include "../../Common/MyCom.h" -#include "MemBlocks.h" - -class CIntListCheck -{ -protected: - int *_data; -public: - CIntListCheck(): _data(0) {} - ~CIntListCheck() { FreeList(); } - - bool AllocateList(int numItems) - { - FreeList(); - if (numItems == 0) - return true; - _data = (int *)::MyAlloc(numItems * sizeof(int)); - return (_data != 0); - } - - void FreeList() - { - ::MyFree(_data); - _data = 0; - } -}; - - -class CResourceList : public CIntListCheck -{ - int _headFree; -public: - CResourceList(): _headFree(-1) {} - - bool AllocateList(int numItems) - { - FreeList(); - if (numItems == 0) - return true; - if (!CIntListCheck::AllocateList(numItems)) - return false; - for (int i = 0; i < numItems; i++) - _data[i] = i + 1; - _data[numItems - 1] = -1; - _headFree = 0; - return true; - } - - void FreeList() - { - CIntListCheck::FreeList(); - _headFree = -1; - } - - int AllocateItem() - { - int res = _headFree; - if (res >= 0) - _headFree = _data[res]; - return res; - } - - void FreeItem(int index) - { - if (index < 0) - return; - _data[index] = _headFree; - _headFree = index; - } -}; - -class CResourceListMt: public CResourceList -{ - NWindows::NSynchronization::CCriticalSection _criticalSection; -public: - NWindows::NSynchronization::CSemaphore Semaphore; - - bool AllocateList(int numItems) - { - if (!CResourceList::AllocateList(numItems)) - return false; - return Semaphore.Create((LONG)numItems, (LONG)numItems); - } - - int AllocateItem() - { - Semaphore.Lock(); - _criticalSection.Enter(); - int res = CResourceList::AllocateItem(); - _criticalSection.Leave(); - return res; - } - - void FreeItem(int index) - { - if (index < 0) - return; - _criticalSection.Enter(); - CResourceList::FreeItem(index); - _criticalSection.Leave(); - Semaphore.Release(); - } -}; - -class CIntQueueMt: public CIntListCheck -{ - int _numItems; - int _head; - int _cur; -public: - CIntQueueMt(): _numItems(0), _head(0), _cur(0) {} - NWindows::NSynchronization::CSemaphore Semaphore; - - bool AllocateList(int numItems) - { - FreeList(); - if (numItems == 0) - return true; - if (!CIntListCheck::AllocateList(numItems)) - return false; - _numItems = numItems; - return Semaphore.Create((LONG)0, (LONG)numItems); - } - - void FreeList() - { - CIntListCheck::FreeList(); - _numItems = 0; - _head = 0; - _cur = 0; - } - - void AddItem(int value) - { - _data[_head++] = value; - if (_head == _numItems) - _head = 0; - LONG previousCount; - Semaphore.Release(1, &previousCount); - // printf("\nRelease prev = %d\n", previousCount); - - } - - int GetItem() - { - // Semaphore.Lock(); - int res = _data[_cur++]; - if (_cur == _numItems) - _cur = 0; - return res; - } -}; - -struct IInMemStreamMtCallback -{ - // must be same for all calls - virtual size_t GetBlockSize() = 0; - - // Out: - // result != S_OK stops Reading - // if *p = 0, result must be != S_OK; - // Locking is allowed - virtual HRESULT AllocateBlock(void **p) = 0; - - virtual void FreeBlock(void *p) = 0; - - // It must allow to add at least numSubStreams + 1 , - // where numSubStreams is value from CInMemStreamMt::Create - // value -1 means End of stream - // Locking is not allowed - virtual void AddStreamIndexToQueue(int index) = 0; -}; - -struct CStreamInfo -{ - CRecordVector Blocks; - - int LastBlockIndex; - size_t LastBlockPos; - bool StreamWasFinished; - - int CurBlockIndex; - size_t CurBlockPos; - - NWindows::NSynchronization::CCriticalSection *Cs; - NWindows::NSynchronization::CManualResetEvent *CanReadEvent; - - HRESULT ExitResult; - - CStreamInfo(): Cs(0), CanReadEvent(0), StreamWasFinished(false) { } - ~CStreamInfo() - { - delete Cs; - delete CanReadEvent; - // Free(); - } - void Create() - { - Cs = new NWindows::NSynchronization::CCriticalSection; - CanReadEvent = new NWindows::NSynchronization::CManualResetEvent; - } - - void Free(IInMemStreamMtCallback *callback); - void Init() - { - LastBlockIndex = CurBlockIndex = 0; - CurBlockPos = LastBlockPos = 0; - StreamWasFinished = false; - ExitResult = S_OK; - } - - // res must be != S_OK - void Exit(HRESULT res) - { - ExitResult = res; - CanReadEvent->Set(); - } -}; - - -class CInMemStreamMt -{ - CMyComPtr _stream; - NWindows::NSynchronization::CCriticalSection CS; - CObjectVector _streams; - int _nextFreeStreamIndex; - int _currentStreamIndex; - UInt64 _subStreamSize; - - CResourceListMt _streamIndexAllocator; - - // bool _stopReading; - -public: - HRESULT Read(); - HRESULT ReadResult; - IInMemStreamMtCallback *Callback; - void FreeSubStream(int subStreamIndex); - HRESULT ReadSubStream(int subStreamIndex, void *data, UInt32 size, UInt32 *processedSize, bool keepData); - - // numSubStreams: min = 1, good min = numThreads - bool Create(int numSubStreams, UInt64 subStreamSize); - ~CInMemStreamMt() { Free(); } - void SetStream(ISequentialInStream *stream) { _stream = stream; } - - // to stop reading you must implement - // returning Error in IInMemStreamMtCallback::AllocateBlock - // and then you must free at least one substream - bool StartReadThread(); - - void Free(); - - // you must free at least one substream after that function to unlock waiting. - // void StopReading() { _stopReading = true; } -}; - -class CInMemStream: - public ISequentialInStream, - public CMyUnknownImp -{ - UInt64 _size; - bool _keepData; -public: - int Index; - CInMemStreamMt *mtStream; - void Init(bool keepData = false) - { - _size = 0; _keepData = keepData ; - } - MY_UNKNOWN_IMP - STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); - UInt64 GetSize() const { return _size; } -}; - -#endif diff --git a/7zip/Common/InOutTempBuffer.cpp b/7zip/Common/InOutTempBuffer.cpp deleted file mode 100755 index ffaed32c..00000000 --- a/7zip/Common/InOutTempBuffer.cpp +++ /dev/null @@ -1,122 +0,0 @@ -// InOutTempBuffer.cpp - -#include "StdAfx.h" - -#include "InOutTempBuffer.h" -#include "../../Common/Defs.h" -// #include "Windows/Defs.h" - -#include "StreamUtils.h" - -using namespace NWindows; -using namespace NFile; -using namespace NDirectory; - -static UInt32 kTmpBufferMemorySize = (1 << 20); - -static LPCTSTR kTempFilePrefixString = TEXT("iot"); - -CInOutTempBuffer::CInOutTempBuffer(): - _buffer(NULL) -{ -} - -void CInOutTempBuffer::Create() -{ - _buffer = new Byte[kTmpBufferMemorySize]; -} - -CInOutTempBuffer::~CInOutTempBuffer() -{ - delete []_buffer; -} -void CInOutTempBuffer::InitWriting() -{ - _bufferPosition = 0; - _tmpFileCreated = false; - _fileSize = 0; -} - -bool CInOutTempBuffer::WriteToFile(const void *data, UInt32 size) -{ - if (size == 0) - return true; - if(!_tmpFileCreated) - { - CSysString tempDirPath; - if(!MyGetTempPath(tempDirPath)) - return false; - if (_tempFile.Create(tempDirPath, kTempFilePrefixString, _tmpFileName) == 0) - return false; - // _outFile.SetOpenCreationDispositionCreateAlways(); - if(!_outFile.Create(_tmpFileName, true)) - return false; - _tmpFileCreated = true; - } - UInt32 processedSize; - if(!_outFile.Write(data, size, processedSize)) - return false; - _fileSize += processedSize; - return (processedSize == size); -} - -bool CInOutTempBuffer::FlushWrite() -{ - return _outFile.Close(); -} - -bool CInOutTempBuffer::Write(const void *data, UInt32 size) -{ - if(_bufferPosition < kTmpBufferMemorySize) - { - UInt32 curSize = MyMin(kTmpBufferMemorySize - _bufferPosition, size); - memmove(_buffer + _bufferPosition, (const Byte *)data, curSize); - _bufferPosition += curSize; - size -= curSize; - data = ((const Byte *)data) + curSize; - _fileSize += curSize; - } - return WriteToFile(data, size); -} - -bool CInOutTempBuffer::InitReading() -{ - _currentPositionInBuffer = 0; - if(_tmpFileCreated) - return _inFile.Open(_tmpFileName); - return true; -} - -HRESULT CInOutTempBuffer::WriteToStream(ISequentialOutStream *stream) -{ - if (_currentPositionInBuffer < _bufferPosition) - { - UInt32 sizeToWrite = _bufferPosition - _currentPositionInBuffer; - RINOK(WriteStream(stream, _buffer + _currentPositionInBuffer, sizeToWrite, NULL)); - _currentPositionInBuffer += sizeToWrite; - } - if (!_tmpFileCreated) - return true; - for (;;) - { - UInt32 localProcessedSize; - if (!_inFile.ReadPart(_buffer, kTmpBufferMemorySize, localProcessedSize)) - return E_FAIL; - if (localProcessedSize == 0) - return S_OK; - RINOK(WriteStream(stream, _buffer, localProcessedSize, NULL)); - } -} - -STDMETHODIMP CSequentialOutTempBufferImp::Write(const void *data, UInt32 size, UInt32 *processedSize) -{ - if (!_buffer->Write(data, size)) - { - if (processedSize != NULL) - *processedSize = 0; - return E_FAIL; - } - if (processedSize != NULL) - *processedSize = size; - return S_OK; -} diff --git a/7zip/Common/InOutTempBuffer.h b/7zip/Common/InOutTempBuffer.h deleted file mode 100755 index 3abe76ec..00000000 --- a/7zip/Common/InOutTempBuffer.h +++ /dev/null @@ -1,55 +0,0 @@ -// Util/InOutTempBuffer.h - -#ifndef __IN_OUT_TEMP_BUFFER_H -#define __IN_OUT_TEMP_BUFFER_H - -#include "../../Windows/FileIO.h" -#include "../../Windows/FileDir.h" -#include "../../Common/MyCom.h" - -#include "../IStream.h" - -class CInOutTempBuffer -{ - NWindows::NFile::NDirectory::CTempFile _tempFile; - NWindows::NFile::NIO::COutFile _outFile; - NWindows::NFile::NIO::CInFile _inFile; - Byte *_buffer; - UInt32 _bufferPosition; - UInt32 _currentPositionInBuffer; - CSysString _tmpFileName; - bool _tmpFileCreated; - - UInt64 _fileSize; - - bool WriteToFile(const void *data, UInt32 size); -public: - CInOutTempBuffer(); - ~CInOutTempBuffer(); - void Create(); - - void InitWriting(); - bool Write(const void *data, UInt32 size); - UInt64 GetDataSize() const { return _fileSize; } - bool FlushWrite(); - bool InitReading(); - HRESULT WriteToStream(ISequentialOutStream *stream); -}; - -class CSequentialOutTempBufferImp: - public ISequentialOutStream, - public CMyUnknownImp -{ - CInOutTempBuffer *_buffer; -public: - // CSequentialOutStreamImp(): _size(0) {} - // UInt32 _size; - void Init(CInOutTempBuffer *buffer) { _buffer = buffer; } - // UInt32 GetSize() const { return _size; } - - MY_UNKNOWN_IMP - - STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); -}; - -#endif diff --git a/7zip/Common/LSBFDecoder.cpp b/7zip/Common/LSBFDecoder.cpp deleted file mode 100755 index 51e6aa9c..00000000 --- a/7zip/Common/LSBFDecoder.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// Stream/LSBFDecoder.cpp - -#include "StdAfx.h" - -#include "LSBFDecoder.h" - -namespace NStream { -namespace NLSBF { - -Byte kInvertTable[256]; - -class CInverterTableInitializer -{ -public: - CInverterTableInitializer() - { - for(int i = 0; i < 256; i++) - { - Byte b = Byte(i); - Byte bInvert = 0; - for(int j = 0; j < 8; j++) - { - bInvert <<= 1; - if (b & 1) - bInvert |= 1; - b >>= 1; - } - kInvertTable[i] = bInvert; - } - } -} g_InverterTableInitializer; - - -}} diff --git a/7zip/Common/LSBFDecoder.h b/7zip/Common/LSBFDecoder.h deleted file mode 100755 index 75458452..00000000 --- a/7zip/Common/LSBFDecoder.h +++ /dev/null @@ -1,127 +0,0 @@ -// LSBFDecoder.h - -#ifndef __STREAM_LSBFDECODER_H -#define __STREAM_LSBFDECODER_H - -#include "../IStream.h" - -namespace NStream { -namespace NLSBF { - -const int kNumBigValueBits = 8 * 4; - -const int kNumValueBytes = 3; -const int kNumValueBits = 8 * kNumValueBytes; - -const UInt32 kMask = (1 << kNumValueBits) - 1; - -extern Byte kInvertTable[256]; -// the Least Significant Bit of byte is First - -template -class CBaseDecoder -{ -protected: - int m_BitPos; - UInt32 m_Value; - TInByte m_Stream; -public: - UInt32 NumExtraBytes; - bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); } - void SetStream(ISequentialInStream *inStream) { m_Stream.SetStream(inStream); } - void ReleaseStream() { m_Stream.ReleaseStream(); } - void Init() - { - m_Stream.Init(); - m_BitPos = kNumBigValueBits; - m_Value = 0; - NumExtraBytes = 0; - } - UInt64 GetProcessedSize() const - { return m_Stream.GetProcessedSize() - (kNumBigValueBits - m_BitPos) / 8; } - UInt64 GetProcessedBitsSize() const - { return (m_Stream.GetProcessedSize() << 3) - (kNumBigValueBits - m_BitPos); } - int GetBitPosition() const { return (m_BitPos & 7); } - - void Normalize() - { - for (;m_BitPos >= 8; m_BitPos -= 8) - { - Byte b = 0; - if (!m_Stream.ReadByte(b)) - { - b = 0xFF; // check it - NumExtraBytes++; - } - m_Value = (b << (kNumBigValueBits - m_BitPos)) | m_Value; - } - } - - UInt32 ReadBits(int numBits) - { - Normalize(); - UInt32 res = m_Value & ((1 << numBits) - 1); - m_BitPos += numBits; - m_Value >>= numBits; - return res; - } - - bool ExtraBitsWereRead() const - { - if (NumExtraBytes == 0) - return false; - return ((UInt32)(kNumBigValueBits - m_BitPos) < (NumExtraBytes << 3)); - } -}; - -template -class CDecoder: public CBaseDecoder -{ - UInt32 m_NormalValue; - -public: - void Init() - { - CBaseDecoder::Init(); - m_NormalValue = 0; - } - - void Normalize() - { - for (; this->m_BitPos >= 8; this->m_BitPos -= 8) - { - Byte b = 0; - if (!this->m_Stream.ReadByte(b)) - { - b = 0xFF; // check it - this->NumExtraBytes++; - } - m_NormalValue = (b << (kNumBigValueBits - this->m_BitPos)) | m_NormalValue; - this->m_Value = (this->m_Value << 8) | kInvertTable[b]; - } - } - - UInt32 GetValue(int numBits) - { - Normalize(); - return ((this->m_Value >> (8 - this->m_BitPos)) & kMask) >> (kNumValueBits - numBits); - } - - void MovePos(int numBits) - { - this->m_BitPos += numBits; - m_NormalValue >>= numBits; - } - - UInt32 ReadBits(int numBits) - { - Normalize(); - UInt32 res = m_NormalValue & ( (1 << numBits) - 1); - MovePos(numBits); - return res; - } -}; - -}} - -#endif diff --git a/7zip/Common/LSBFEncoder.cpp b/7zip/Common/LSBFEncoder.cpp deleted file mode 100755 index 6322cae3..00000000 --- a/7zip/Common/LSBFEncoder.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// LSBFEncoder.cpp - -#include "StdAfx.h" - -#include "LSBFEncoder.h" -#include "Common/Defs.h" - -namespace NStream { -namespace NLSBF { - -void CEncoder::WriteBits(UInt32 value, int numBits) -{ - while(numBits > 0) - { - if (numBits < m_BitPos) - { - m_CurByte |= (value & ((1 << numBits) - 1)) << (8 - m_BitPos); - m_BitPos -= numBits; - return; - } - numBits -= m_BitPos; - m_Stream.WriteByte((Byte)(m_CurByte | (value << (8 - m_BitPos)))); - value >>= m_BitPos; - m_BitPos = 8; - m_CurByte = 0; - } -} - -}} diff --git a/7zip/Common/LSBFEncoder.h b/7zip/Common/LSBFEncoder.h deleted file mode 100755 index 72c84d9f..00000000 --- a/7zip/Common/LSBFEncoder.h +++ /dev/null @@ -1,51 +0,0 @@ -// Stream/LSBFEncoder.h - -#ifndef __STREAM_LSBFENCODER_H -#define __STREAM_LSBFENCODER_H - -#include "../IStream.h" -#include "OutBuffer.h" - -namespace NStream { -namespace NLSBF { - -class CEncoder -{ - COutBuffer m_Stream; - int m_BitPos; - Byte m_CurByte; -public: - bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); } - void SetStream(ISequentialOutStream *outStream) { m_Stream.SetStream(outStream); } - void ReleaseStream() { m_Stream.ReleaseStream(); } - void Init() - { - m_Stream.Init(); - m_BitPos = 8; - m_CurByte = 0; - } - HRESULT Flush() - { - FlushByte(); - return m_Stream.Flush(); - } - - void FlushByte() - { - if(m_BitPos < 8) - m_Stream.WriteByte(m_CurByte); - m_BitPos = 8; - m_CurByte = 0; - } - - void WriteBits(UInt32 value, int numBits); - UInt32 GetBitPosition() const { return (8 - m_BitPos); } - UInt64 GetProcessedSize() const { - return m_Stream.GetProcessedSize() + (8 - m_BitPos + 7) /8; } - void WriteByte(Byte b) { m_Stream.WriteByte(b);} -}; - - -}} - -#endif diff --git a/7zip/Common/LimitedStreams.cpp b/7zip/Common/LimitedStreams.cpp deleted file mode 100755 index af721146..00000000 --- a/7zip/Common/LimitedStreams.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// LimitedStreams.cpp - -#include "StdAfx.h" - -#include "LimitedStreams.h" -#include "../../Common/Defs.h" - -STDMETHODIMP CLimitedSequentialInStream::Read(void *data, UInt32 size, UInt32 *processedSize) -{ - UInt32 realProcessedSize = 0; - UInt32 sizeToRead = (UInt32)MyMin((_size - _pos), (UInt64)size); - HRESULT result = S_OK; - if (sizeToRead > 0) - { - result = _stream->Read(data, sizeToRead, &realProcessedSize); - _pos += realProcessedSize; - if (realProcessedSize == 0) - _wasFinished = true; - } - if(processedSize != NULL) - *processedSize = realProcessedSize; - return result; -} - diff --git a/7zip/Common/LimitedStreams.h b/7zip/Common/LimitedStreams.h deleted file mode 100755 index ec4a3a70..00000000 --- a/7zip/Common/LimitedStreams.h +++ /dev/null @@ -1,33 +0,0 @@ -// LimitedStreams.h - -#ifndef __LIMITEDSTREAMS_H -#define __LIMITEDSTREAMS_H - -#include "../../Common/MyCom.h" -#include "../IStream.h" - -class CLimitedSequentialInStream: - public ISequentialInStream, - public CMyUnknownImp -{ - CMyComPtr _stream; - UInt64 _size; - UInt64 _pos; - bool _wasFinished; -public: - void SetStream(ISequentialInStream *stream) { _stream = stream; } - void Init(UInt64 streamSize) - { - _size = streamSize; - _pos = 0; - _wasFinished = false; - } - - MY_UNKNOWN_IMP - - STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); - UInt64 GetSize() const { return _pos; } - bool WasFinished() const { return _wasFinished; } -}; - -#endif diff --git a/7zip/Common/LockedStream.cpp b/7zip/Common/LockedStream.cpp deleted file mode 100755 index 36be1ceb..00000000 --- a/7zip/Common/LockedStream.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// LockedStream.cpp - -#include "StdAfx.h" - -#include "LockedStream.h" - -HRESULT CLockedInStream::Read(UInt64 startPos, void *data, UInt32 size, - UInt32 *processedSize) -{ - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); - RINOK(_stream->Seek(startPos, STREAM_SEEK_SET, NULL)); - return _stream->Read(data, size, processedSize); -} - -STDMETHODIMP CLockedSequentialInStreamImp::Read(void *data, UInt32 size, UInt32 *processedSize) -{ - UInt32 realProcessedSize = 0; - HRESULT result = _lockedInStream->Read(_pos, data, size, &realProcessedSize); - _pos += realProcessedSize; - if (processedSize != NULL) - *processedSize = realProcessedSize; - return result; -} diff --git a/7zip/Common/LockedStream.h b/7zip/Common/LockedStream.h deleted file mode 100755 index 1c1e1793..00000000 --- a/7zip/Common/LockedStream.h +++ /dev/null @@ -1,38 +0,0 @@ -// LockedStream.h - -#ifndef __LOCKEDSTREAM_H -#define __LOCKEDSTREAM_H - -#include "../../Windows/Synchronization.h" -#include "../../Common/MyCom.h" -#include "../IStream.h" - -class CLockedInStream -{ - CMyComPtr _stream; - NWindows::NSynchronization::CCriticalSection _criticalSection; -public: - void Init(IInStream *stream) - { _stream = stream; } - HRESULT Read(UInt64 startPos, void *data, UInt32 size, UInt32 *processedSize); -}; - -class CLockedSequentialInStreamImp: - public ISequentialInStream, - public CMyUnknownImp -{ - CLockedInStream *_lockedInStream; - UInt64 _pos; -public: - void Init(CLockedInStream *lockedInStream, UInt64 startPos) - { - _lockedInStream = lockedInStream; - _pos = startPos; - } - - MY_UNKNOWN_IMP - - STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); -}; - -#endif diff --git a/7zip/Common/MSBFDecoder.h b/7zip/Common/MSBFDecoder.h deleted file mode 100755 index dc80c0f7..00000000 --- a/7zip/Common/MSBFDecoder.h +++ /dev/null @@ -1,69 +0,0 @@ -// MSBFDecoder.h -// the Most Significant Bit of byte is First - -#ifndef __STREAM_MSBFDECODER_H -#define __STREAM_MSBFDECODER_H - -#include "../../Common/Types.h" -#include "../IStream.h" - -namespace NStream { -namespace NMSBF { - -const int kNumBigValueBits = 8 * 4; -const int kNumValueBytes = 3; -const int kNumValueBits = 8 * kNumValueBytes; - -const UInt32 kMask = (1 << kNumValueBits) - 1; - -template -class CDecoder -{ - UInt32 m_BitPos; - UInt32 m_Value; -public: - TInByte m_Stream; - bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); } - void SetStream(ISequentialInStream *inStream) { m_Stream.SetStream(inStream);} - void ReleaseStream() { m_Stream.ReleaseStream();} - - void Init() - { - m_Stream.Init(); - m_BitPos = kNumBigValueBits; - Normalize(); - } - - UInt64 GetProcessedSize() const - { return m_Stream.GetProcessedSize() - (kNumBigValueBits - m_BitPos) / 8; } - UInt32 GetBitPosition() const { return (m_BitPos & 7); } - - void Normalize() - { - for (;m_BitPos >= 8; m_BitPos -= 8) - m_Value = (m_Value << 8) | m_Stream.ReadByte(); - } - - UInt32 GetValue(UInt32 numBits) const - { - // return (m_Value << m_BitPos) >> (kNumBigValueBits - numBits); - return ((m_Value >> (8 - m_BitPos)) & kMask) >> (kNumValueBits - numBits); - } - - void MovePos(UInt32 numBits) - { - m_BitPos += numBits; - Normalize(); - } - - UInt32 ReadBits(UInt32 numBits) - { - UInt32 res = GetValue(numBits); - MovePos(numBits); - return res; - } -}; - -}} - -#endif diff --git a/7zip/Common/MSBFEncoder.h b/7zip/Common/MSBFEncoder.h deleted file mode 100755 index 767a0e57..00000000 --- a/7zip/Common/MSBFEncoder.h +++ /dev/null @@ -1,59 +0,0 @@ -// Stream/MSBFEncoder.h - -#ifndef __STREAM_MSBFENCODER_H -#define __STREAM_MSBFENCODER_H - -#include "Common/Defs.h" -#include "../IStream.h" -#include "OutBuffer.h" - -namespace NStream { -namespace NMSBF { - -template -class CEncoder -{ - TOutByte m_Stream; - int m_BitPos; - Byte m_CurByte; -public: - bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); } - void SetStream(ISequentialOutStream *outStream) { m_Stream.SetStream(outStream);} - void ReleaseStream() { m_Stream.ReleaseStream(); } - void Init() - { - m_Stream.Init(); - m_BitPos = 8; - m_CurByte = 0; - } - HRESULT Flush() - { - if(m_BitPos < 8) - WriteBits(0, m_BitPos); - return m_Stream.Flush(); - } - - void WriteBits(UInt32 value, int numBits) - { - while(numBits > 0) - { - if (numBits < m_BitPos) - { - m_CurByte |= ((Byte)value << (m_BitPos -= numBits)); - return; - } - numBits -= m_BitPos; - UInt32 newBits = (value >> numBits); - value -= (newBits << numBits); - m_Stream.WriteByte((Byte)(m_CurByte | newBits)); - m_BitPos = 8; - m_CurByte = 0; - } - } - UInt64 GetProcessedSize() const { - return m_Stream.GetProcessedSize() + (8 - m_BitPos + 7) / 8; } -}; - -}} - -#endif diff --git a/7zip/Common/MemBlocks.cpp b/7zip/Common/MemBlocks.cpp deleted file mode 100755 index d2b79a70..00000000 --- a/7zip/Common/MemBlocks.cpp +++ /dev/null @@ -1,184 +0,0 @@ -// MemBlocks.cpp - -#include "StdAfx.h" - -#include "Common/MyCom.h" - -#include "StreamUtils.h" -#include "MemBlocks.h" - -bool CMemBlockManager::AllocateSpace(size_t numBlocks) -{ - FreeSpace(); - if (_blockSize < sizeof(void *) || numBlocks < 1) - return false; - size_t totalSize = numBlocks * _blockSize; - if (totalSize / _blockSize != numBlocks) - return false; - _data = ::MidAlloc(totalSize); - if (_data == 0) - return false; - Byte *p = (Byte *)_data; - for (size_t i = 0; i + 1 < numBlocks; i++, p += _blockSize) - *(Byte **)p = (p + _blockSize); - *(Byte **)p = 0; - _headFree = _data; - return true; -} - -void CMemBlockManager::FreeSpace() -{ - ::MidFree(_data); - _data = 0; - _headFree= 0; -} - -void *CMemBlockManager::AllocateBlock() -{ - if (_headFree == 0) - return 0; - void *p = _headFree; - _headFree = *(void **)_headFree; - return p; -} - -void CMemBlockManager::FreeBlock(void *p) -{ - if (p == 0) - return; - *(void **)p = _headFree; - _headFree = p; -} - - -bool CMemBlockManagerMt::AllocateSpace(size_t numBlocks, size_t numNoLockBlocks) -{ - if (numNoLockBlocks > numBlocks) - return false; - if (!CMemBlockManager::AllocateSpace(numBlocks)) - return false; - size_t numLockBlocks = numBlocks - numNoLockBlocks; - return Semaphore.Create((LONG)numLockBlocks, (LONG)numLockBlocks); -} - -bool CMemBlockManagerMt::AllocateSpaceAlways(size_t desiredNumberOfBlocks, size_t numNoLockBlocks) -{ - if (numNoLockBlocks > desiredNumberOfBlocks) - return false; - for (;;) - { - if (AllocateSpace(desiredNumberOfBlocks, numNoLockBlocks)) - return true; - if (desiredNumberOfBlocks == numNoLockBlocks) - return false; - desiredNumberOfBlocks = numNoLockBlocks + ((desiredNumberOfBlocks - numNoLockBlocks) >> 1); - } -} - -void CMemBlockManagerMt::FreeSpace() -{ - Semaphore.Close(); - CMemBlockManager::FreeSpace(); -} - -void *CMemBlockManagerMt::AllocateBlock() -{ - // Semaphore.Lock(); - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); - return CMemBlockManager::AllocateBlock(); -} - -void CMemBlockManagerMt::FreeBlock(void *p, bool lockMode) -{ - if (p == 0) - return; - { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); - CMemBlockManager::FreeBlock(p); - } - if (lockMode) - Semaphore.Release(); -} - -void CMemBlocks::Free(CMemBlockManagerMt *manager) -{ - while(Blocks.Size() > 0) - { - manager->FreeBlock(Blocks.Back()); - Blocks.DeleteBack(); - } - TotalSize = 0; -} - -void CMemBlocks::FreeOpt(CMemBlockManagerMt *manager) -{ - Free(manager); - Blocks.Free(); // to reduce memory usage -} - -HRESULT CMemBlocks::WriteToStream(size_t blockSize, ISequentialOutStream *outStream) const -{ - UInt64 totalSize = TotalSize; - for (int blockIndex = 0; totalSize > 0; blockIndex++) - { - UInt32 curSize = (UInt32)blockSize; - if (totalSize < curSize) - curSize = (UInt32)totalSize; - UInt32 processedSize; - if (blockIndex >= Blocks.Size()) - return E_FAIL; - RINOK(WriteStream(outStream, Blocks[blockIndex], curSize, &processedSize)); - if (processedSize != curSize) - return E_FAIL; - totalSize -= processedSize; - } - return S_OK; -} - - -void CMemLockBlocks::FreeBlock(int index, CMemBlockManagerMt *memManager) -{ - memManager->FreeBlock(Blocks[index], LockMode); - Blocks[index] = 0; -} - -void CMemLockBlocks::Free(CMemBlockManagerMt *memManager) -{ - while (Blocks.Size() > 0) - { - FreeBlock(Blocks.Size() - 1, memManager); - Blocks.DeleteBack(); - } - TotalSize = 0; -} - -bool CMemLockBlocks::SwitchToNoLockMode(CMemBlockManagerMt *memManager) -{ - if (LockMode) - { - if (Blocks.Size() > 0) - if (!memManager->ReleaseLockedBlocks(Blocks.Size())) - return false; - LockMode = false; - } - return true; -} - -void CMemLockBlocks::Detach(CMemLockBlocks &blocks, CMemBlockManagerMt *memManager) -{ - blocks.Free(memManager); - blocks.LockMode = LockMode; - UInt64 totalSize = 0; - size_t blockSize = memManager->GetBlockSize(); - for (int i = 0; i < Blocks.Size(); i++) - { - if (totalSize < TotalSize) - blocks.Blocks.Add(Blocks[i]); - else - FreeBlock(i, memManager); - Blocks[i] = 0; - totalSize += blockSize; - } - blocks.TotalSize = TotalSize; - Free(memManager); -} diff --git a/7zip/Common/MemBlocks.h b/7zip/Common/MemBlocks.h deleted file mode 100755 index 31cd3546..00000000 --- a/7zip/Common/MemBlocks.h +++ /dev/null @@ -1,73 +0,0 @@ -// MemBlocks.h - -#ifndef __MEMBLOCKS_H -#define __MEMBLOCKS_H - -#include "Common/Alloc.h" -#include "Common/Types.h" -#include "Common/Vector.h" - -#include "Windows/Synchronization.h" - -#include "../IStream.h" - -class CMemBlockManager -{ - void *_data; - size_t _blockSize; - void *_headFree; -public: - CMemBlockManager(size_t blockSize = (1 << 20)): _data(0), _blockSize(blockSize), _headFree(0) {} - ~CMemBlockManager() { FreeSpace(); } - - bool AllocateSpace(size_t numBlocks); - void FreeSpace(); - size_t GetBlockSize() const { return _blockSize; } - void *AllocateBlock(); - void FreeBlock(void *p); -}; - - -class CMemBlockManagerMt: public CMemBlockManager -{ - NWindows::NSynchronization::CCriticalSection _criticalSection; -public: - NWindows::NSynchronization::CSemaphore Semaphore; - - CMemBlockManagerMt(size_t blockSize = (1 << 20)): CMemBlockManager(blockSize) {} - ~CMemBlockManagerMt() { FreeSpace(); } - - bool AllocateSpace(size_t numBlocks, size_t numNoLockBlocks = 0); - bool AllocateSpaceAlways(size_t desiredNumberOfBlocks, size_t numNoLockBlocks = 0); - void FreeSpace(); - void *AllocateBlock(); - void FreeBlock(void *p, bool lockMode = true); - bool ReleaseLockedBlocks(int number) { return Semaphore.Release(number); } -}; - - -class CMemBlocks -{ - void Free(CMemBlockManagerMt *manager); -public: - CRecordVector Blocks; - UInt64 TotalSize; - - CMemBlocks(): TotalSize(0) {} - - void FreeOpt(CMemBlockManagerMt *manager); - HRESULT WriteToStream(size_t blockSize, ISequentialOutStream *outStream) const; -}; - -struct CMemLockBlocks: public CMemBlocks -{ - bool LockMode; - - CMemLockBlocks(): LockMode(true) {}; - void Free(CMemBlockManagerMt *memManager); - void FreeBlock(int index, CMemBlockManagerMt *memManager); - bool SwitchToNoLockMode(CMemBlockManagerMt *memManager); - void Detach(CMemLockBlocks &blocks, CMemBlockManagerMt *memManager); -}; - -#endif diff --git a/7zip/Common/OffsetStream.cpp b/7zip/Common/OffsetStream.cpp deleted file mode 100755 index 997ccae2..00000000 --- a/7zip/Common/OffsetStream.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// OffsetStream.cpp - -#include "StdAfx.h" - -#include "Common/Defs.h" -#include "OffsetStream.h" - -HRESULT COffsetOutStream::Init(IOutStream *stream, UInt64 offset) -{ - _offset = offset; - _stream = stream; - return _stream->Seek(offset, STREAM_SEEK_SET, NULL); -} - -STDMETHODIMP COffsetOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize) -{ - return _stream->Write(data, size, processedSize); -} - -STDMETHODIMP COffsetOutStream::Seek(Int64 offset, UInt32 seekOrigin, - UInt64 *newPosition) -{ - UInt64 absoluteNewPosition; - if (seekOrigin == STREAM_SEEK_SET) - offset += _offset; - HRESULT result = _stream->Seek(offset, seekOrigin, &absoluteNewPosition); - if (newPosition != NULL) - *newPosition = absoluteNewPosition - _offset; - return result; -} - -STDMETHODIMP COffsetOutStream::SetSize(Int64 newSize) -{ - return _stream->SetSize(_offset + newSize); -} diff --git a/7zip/Common/OffsetStream.h b/7zip/Common/OffsetStream.h deleted file mode 100755 index 57a055cc..00000000 --- a/7zip/Common/OffsetStream.h +++ /dev/null @@ -1,25 +0,0 @@ -// OffsetStream.h - -#ifndef __OFFSETSTREAM_H -#define __OFFSETSTREAM_H - -#include "Common/MyCom.h" -#include "../IStream.h" - -class COffsetOutStream: - public IOutStream, - public CMyUnknownImp -{ - UInt64 _offset; - CMyComPtr _stream; -public: - HRESULT Init(IOutStream *stream, UInt64 offset); - - MY_UNKNOWN_IMP - - STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); - STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition); - STDMETHOD(SetSize)(Int64 newSize); -}; - -#endif diff --git a/7zip/Common/OutBuffer.cpp b/7zip/Common/OutBuffer.cpp deleted file mode 100755 index a73fa7c5..00000000 --- a/7zip/Common/OutBuffer.cpp +++ /dev/null @@ -1,116 +0,0 @@ -// OutByte.cpp - -#include "StdAfx.h" - -#include "OutBuffer.h" - -#include "../../Common/Alloc.h" - -bool COutBuffer::Create(UInt32 bufferSize) -{ - const UInt32 kMinBlockSize = 1; - if (bufferSize < kMinBlockSize) - bufferSize = kMinBlockSize; - if (_buffer != 0 && _bufferSize == bufferSize) - return true; - Free(); - _bufferSize = bufferSize; - _buffer = (Byte *)::MidAlloc(bufferSize); - return (_buffer != 0); -} - -void COutBuffer::Free() -{ - ::MidFree(_buffer); - _buffer = 0; -} - -void COutBuffer::SetStream(ISequentialOutStream *stream) -{ - _stream = stream; -} - -void COutBuffer::Init() -{ - _streamPos = 0; - _limitPos = _bufferSize; - _pos = 0; - _processedSize = 0; - _overDict = false; - #ifdef _NO_EXCEPTIONS - ErrorCode = S_OK; - #endif -} - -UInt64 COutBuffer::GetProcessedSize() const -{ - UInt64 res = _processedSize + _pos - _streamPos; - if (_streamPos > _pos) - res += _bufferSize; - return res; -} - - -HRESULT COutBuffer::FlushPart() -{ - // _streamPos < _bufferSize - UInt32 size = (_streamPos >= _pos) ? (_bufferSize - _streamPos) : (_pos - _streamPos); - HRESULT result = S_OK; - #ifdef _NO_EXCEPTIONS - result = ErrorCode; - #endif - if (_buffer2 != 0) - { - memmove(_buffer2, _buffer + _streamPos, size); - _buffer2 += size; - } - - if (_stream != 0 - #ifdef _NO_EXCEPTIONS - && (ErrorCode == S_OK) - #endif - ) - { - UInt32 processedSize = 0; - result = _stream->Write(_buffer + _streamPos, size, &processedSize); - size = processedSize; - } - _streamPos += size; - if (_streamPos == _bufferSize) - _streamPos = 0; - if (_pos == _bufferSize) - { - _overDict = true; - _pos = 0; - } - _limitPos = (_streamPos > _pos) ? _streamPos : _bufferSize; - _processedSize += size; - return result; -} - -HRESULT COutBuffer::Flush() -{ - #ifdef _NO_EXCEPTIONS - if (ErrorCode != S_OK) - return ErrorCode; - #endif - - while(_streamPos != _pos) - { - HRESULT result = FlushPart(); - if (result != S_OK) - return result; - } - return S_OK; -} - -void COutBuffer::FlushWithCheck() -{ - HRESULT result = FlushPart(); - #ifdef _NO_EXCEPTIONS - ErrorCode = result; - #else - if (result != S_OK) - throw COutBufferException(result); - #endif -} diff --git a/7zip/Common/OutBuffer.h b/7zip/Common/OutBuffer.h deleted file mode 100755 index 0ce54e21..00000000 --- a/7zip/Common/OutBuffer.h +++ /dev/null @@ -1,64 +0,0 @@ -// OutBuffer.h - -#ifndef __OUTBUFFER_H -#define __OUTBUFFER_H - -#include "../IStream.h" -#include "../../Common/MyCom.h" - -#ifndef _NO_EXCEPTIONS -struct COutBufferException -{ - HRESULT ErrorCode; - COutBufferException(HRESULT errorCode): ErrorCode(errorCode) {} -}; -#endif - -class COutBuffer -{ -protected: - Byte *_buffer; - UInt32 _pos; - UInt32 _limitPos; - UInt32 _streamPos; - UInt32 _bufferSize; - CMyComPtr _stream; - UInt64 _processedSize; - Byte *_buffer2; - bool _overDict; - - HRESULT FlushPart(); - void FlushWithCheck(); -public: - #ifdef _NO_EXCEPTIONS - HRESULT ErrorCode; - #endif - - COutBuffer(): _buffer(0), _pos(0), _stream(0), _buffer2(0) {} - ~COutBuffer() { Free(); } - - bool Create(UInt32 bufferSize); - void Free(); - - void SetMemStream(Byte *buffer) { _buffer2 = buffer; } - void SetStream(ISequentialOutStream *stream); - void Init(); - HRESULT Flush(); - void ReleaseStream() { _stream.Release(); } - - void WriteByte(Byte b) - { - _buffer[_pos++] = b; - if(_pos == _limitPos) - FlushWithCheck(); - } - void WriteBytes(const void *data, size_t size) - { - for (size_t i = 0; i < size; i++) - WriteByte(((const Byte *)data)[i]); - } - - UInt64 GetProcessedSize() const; -}; - -#endif diff --git a/7zip/Common/OutMemStream.cpp b/7zip/Common/OutMemStream.cpp deleted file mode 100755 index 2953afd8..00000000 --- a/7zip/Common/OutMemStream.cpp +++ /dev/null @@ -1,137 +0,0 @@ -// OutMemStream.cpp - -#include "StdAfx.h" - -#include "OutMemStream.h" - -void COutMemStream::Free() -{ - Blocks.Free(_memManager); - Blocks.LockMode = true; -} - -void COutMemStream::Init() -{ - WriteToRealStreamEvent.Reset(); - _unlockEventWasSent = false; - _realStreamMode = false; - Free(); - _curBlockPos = 0; - _curBlockIndex = 0; -} - -void COutMemStream::DetachData(CMemLockBlocks &blocks) -{ - Blocks.Detach(blocks, _memManager); - Free(); -} - - -HRESULT COutMemStream::WriteToRealStream() -{ - RINOK(Blocks.WriteToStream(_memManager->GetBlockSize(), OutSeqStream)); - Blocks.Free(_memManager); - return S_OK; -} - -STDMETHODIMP COutMemStream::Write(const void *data, UInt32 size, UInt32 *processedSize) -{ - if (_realStreamMode) - return OutSeqStream->Write(data, size, processedSize); - if (processedSize != 0) - *processedSize = 0; - while(size != 0) - { - if ((int)_curBlockIndex < Blocks.Blocks.Size()) - { - Byte *p = (Byte *)Blocks.Blocks[(int)_curBlockIndex] + _curBlockPos; - size_t curSize = _memManager->GetBlockSize() - _curBlockPos; - if (size < curSize) - curSize = size; - memmove(p, data, curSize); - if (processedSize != 0) - *processedSize += (UInt32)curSize; - data = (const void *)((const Byte *)data + curSize); - size -= (UInt32)curSize; - _curBlockPos += curSize; - - UInt64 pos64 = GetPos(); - if (pos64 > Blocks.TotalSize) - Blocks.TotalSize = pos64; - if (_curBlockPos == _memManager->GetBlockSize()) - { - _curBlockIndex++; - _curBlockPos = 0; - } - continue; - } - HANDLE events[4] = { StopWritingEvent, WriteToRealStreamEvent, NoLockEvent, _memManager->Semaphore }; - DWORD waitResult = ::WaitForMultipleObjects((Blocks.LockMode ? 4 : 2), events, FALSE, INFINITE); - switch (waitResult) - { - case (WAIT_OBJECT_0 + 0): - return StopWriteResult; - case (WAIT_OBJECT_0 + 1): - { - _realStreamMode = true; - RINOK(WriteToRealStream()); - UInt32 processedSize2; - HRESULT res = OutSeqStream->Write(data, size, &processedSize2); - if (processedSize != 0) - *processedSize += processedSize2; - return res; - } - case (WAIT_OBJECT_0 + 2): - { - if (!Blocks.SwitchToNoLockMode(_memManager)) - return E_FAIL; - break; - } - case (WAIT_OBJECT_0 + 3): - break; - default: - return E_FAIL; - } - Blocks.Blocks.Add(_memManager->AllocateBlock()); - } - return S_OK; -} - -STDMETHODIMP COutMemStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition) -{ - if (_realStreamMode) - { - if (!OutStream) - return E_FAIL; - return OutStream->Seek(offset, seekOrigin, newPosition); - } - if (seekOrigin == STREAM_SEEK_CUR) - { - if (offset != 0) - return E_NOTIMPL; - } - else if (seekOrigin == STREAM_SEEK_SET) - { - if (offset != 0) - return E_NOTIMPL; - _curBlockIndex = 0; - _curBlockPos = 0; - } - else - return E_NOTIMPL; - if (newPosition != 0) - *newPosition = GetPos(); - return S_OK; -} - -STDMETHODIMP COutMemStream::SetSize(Int64 newSize) -{ - if (_realStreamMode) - { - if (!OutStream) - return E_FAIL; - return OutStream->SetSize(newSize); - } - Blocks.TotalSize = newSize; - return S_OK; -} diff --git a/7zip/Common/OutMemStream.h b/7zip/Common/OutMemStream.h deleted file mode 100755 index ea98de17..00000000 --- a/7zip/Common/OutMemStream.h +++ /dev/null @@ -1,88 +0,0 @@ -// OutMemStream.h - -#ifndef __OUTMEMSTREAM_H -#define __OUTMEMSTREAM_H - -#include "Common/MyCom.h" -#include "MemBlocks.h" - -class COutMemStream: - public IOutStream, - public CMyUnknownImp -{ - CMemBlockManagerMt *_memManager; - size_t _curBlockIndex; - size_t _curBlockPos; - bool _realStreamMode; - - bool _unlockEventWasSent; - NWindows::NSynchronization::CAutoResetEvent StopWritingEvent; - NWindows::NSynchronization::CAutoResetEvent WriteToRealStreamEvent; - NWindows::NSynchronization::CAutoResetEvent NoLockEvent; - - HRESULT StopWriteResult; - CMemLockBlocks Blocks; - - UInt64 GetPos() const { return (UInt64)_curBlockIndex * _memManager->GetBlockSize() + _curBlockPos; } - - CMyComPtr OutSeqStream; - CMyComPtr OutStream; - -public: - - void SetOutStream(IOutStream *outStream) - { - OutStream = outStream; - OutSeqStream = outStream; - } - - void SetSeqOutStream(ISequentialOutStream *outStream) - { - OutStream = NULL; - OutSeqStream = outStream; - } - - void ReleaseOutStream() - { - OutStream.Release(); - OutSeqStream.Release(); - } - - COutMemStream(CMemBlockManagerMt *memManager): _memManager(memManager) { } - - ~COutMemStream() { Free(); } - void Free(); - - void Init(); - HRESULT WriteToRealStream(); - - void DetachData(CMemLockBlocks &blocks); - - bool WasUnlockEventSent() const { return _unlockEventWasSent; } - - void SetRealStreamMode() - { - _unlockEventWasSent = true; - WriteToRealStreamEvent.Set(); - } - - void SetNoLockMode() - { - _unlockEventWasSent = true; - NoLockEvent.Set(); - } - - void StopWriting(HRESULT res) - { - StopWriteResult = res; - StopWritingEvent.Set(); - } - - MY_UNKNOWN_IMP - - STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); - STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition); - STDMETHOD(SetSize)(Int64 newSize); -}; - -#endif diff --git a/7zip/Common/ProgressMt.cpp b/7zip/Common/ProgressMt.cpp deleted file mode 100755 index 319bd241..00000000 --- a/7zip/Common/ProgressMt.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// ProgressMt.h - -#include "StdAfx.h" - -#include "ProgressMt.h" - -void CMtCompressProgressMixer::Init(int numItems, ICompressProgressInfo *progress) -{ - NWindows::NSynchronization::CCriticalSectionLock lock(CriticalSection); - InSizes.Clear(); - OutSizes.Clear(); - for (int i = 0; i < numItems; i++) - { - InSizes.Add(0); - OutSizes.Add(0); - } - TotalInSize = 0; - TotalOutSize = 0; - _progress = progress; -} - -void CMtCompressProgressMixer::Reinit(int index) -{ - NWindows::NSynchronization::CCriticalSectionLock lock(CriticalSection); - InSizes[index] = 0; - OutSizes[index] = 0; -} - -HRESULT CMtCompressProgressMixer::SetRatioInfo(int index, const UInt64 *inSize, const UInt64 *outSize) -{ - NWindows::NSynchronization::CCriticalSectionLock lock(CriticalSection); - if (inSize != 0) - { - UInt64 diff = *inSize - InSizes[index]; - InSizes[index] = *inSize; - TotalInSize += diff; - } - if (outSize != 0) - { - UInt64 diff = *outSize - OutSizes[index]; - OutSizes[index] = *outSize; - TotalOutSize += diff; - } - if (_progress) - return _progress->SetRatioInfo(&TotalInSize, &TotalOutSize); - return S_OK; -} - - -STDMETHODIMP CMtCompressProgress::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize) -{ - return _progress->SetRatioInfo(_index, inSize, outSize); -} diff --git a/7zip/Common/ProgressMt.h b/7zip/Common/ProgressMt.h deleted file mode 100755 index c0776944..00000000 --- a/7zip/Common/ProgressMt.h +++ /dev/null @@ -1,47 +0,0 @@ -// ProgressMt.h - -#ifndef __PROGRESSMT_H -#define __PROGRESSMT_H - -#include "../../Common/MyCom.h" - -#include "../ICoder.h" -#include "../IProgress.h" - -#include "Windows/Synchronization.h" -#include "../../Common/Vector.h" - -class CMtCompressProgressMixer -{ - CMyComPtr _progress; - CRecordVector InSizes; - CRecordVector OutSizes; - UInt64 TotalInSize; - UInt64 TotalOutSize; -public: - NWindows::NSynchronization::CCriticalSection CriticalSection; - void Init(int numItems, ICompressProgressInfo *progress); - void Reinit(int index); - HRESULT SetRatioInfo(int index, const UInt64 *inSize, const UInt64 *outSize); -}; - -class CMtCompressProgress: - public ICompressProgressInfo, - public CMyUnknownImp -{ - CMtCompressProgressMixer *_progress; - int _index; -public: - void Init(CMtCompressProgressMixer *progress, int index) - { - _progress = progress; - _index = index; - } - void Reinit() { _progress->Reinit(_index); } - - MY_UNKNOWN_IMP - - STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize); -}; - -#endif diff --git a/7zip/Common/ProgressUtils.cpp b/7zip/Common/ProgressUtils.cpp deleted file mode 100755 index 40e13877..00000000 --- a/7zip/Common/ProgressUtils.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// ProgressUtils.h - -#include "StdAfx.h" - -#include "ProgressUtils.h" - -void CLocalCompressProgressInfo::Init(ICompressProgressInfo *progress, - const UInt64 *inStartValue, const UInt64 *outStartValue) -{ - _progress = progress; - _inStartValueIsAssigned = (inStartValue != NULL); - if (_inStartValueIsAssigned) - _inStartValue = *inStartValue; - _outStartValueIsAssigned = (outStartValue != NULL); - if (_outStartValueIsAssigned) - _outStartValue = *outStartValue; -} - -STDMETHODIMP CLocalCompressProgressInfo::SetRatioInfo( - const UInt64 *inSize, const UInt64 *outSize) -{ - UInt64 inSizeNew, outSizeNew; - const UInt64 *inSizeNewPointer; - const UInt64 *outSizeNewPointer; - if (_inStartValueIsAssigned && inSize != NULL) - { - inSizeNew = _inStartValue + (*inSize); - inSizeNewPointer = &inSizeNew; - } - else - inSizeNewPointer = NULL; - - if (_outStartValueIsAssigned && outSize != NULL) - { - outSizeNew = _outStartValue + (*outSize); - outSizeNewPointer = &outSizeNew; - } - else - outSizeNewPointer = NULL; - return _progress->SetRatioInfo(inSizeNewPointer, outSizeNewPointer); -} - -/////////////////////////////////// - -void CLocalProgress::Init(IProgress *progress, bool inSizeIsMain) -{ - _progress = progress; - _inSizeIsMain = inSizeIsMain; -} - -STDMETHODIMP CLocalProgress::SetRatioInfo( - const UInt64 *inSize, const UInt64 *outSize) -{ - return _progress->SetCompleted(_inSizeIsMain ? inSize : outSize); -} diff --git a/7zip/Common/ProgressUtils.h b/7zip/Common/ProgressUtils.h deleted file mode 100755 index f89839fa..00000000 --- a/7zip/Common/ProgressUtils.h +++ /dev/null @@ -1,43 +0,0 @@ -// ProgressUtils.h - -#ifndef __PROGRESSUTILS_H -#define __PROGRESSUTILS_H - -#include "../../Common/MyCom.h" - -#include "../ICoder.h" -#include "../IProgress.h" - -class CLocalCompressProgressInfo: - public ICompressProgressInfo, - public CMyUnknownImp -{ - CMyComPtr _progress; - bool _inStartValueIsAssigned; - bool _outStartValueIsAssigned; - UInt64 _inStartValue; - UInt64 _outStartValue; -public: - void Init(ICompressProgressInfo *progress, - const UInt64 *inStartValue, const UInt64 *outStartValue); - - MY_UNKNOWN_IMP - - STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize); -}; - -class CLocalProgress: - public ICompressProgressInfo, - public CMyUnknownImp -{ - CMyComPtr _progress; - bool _inSizeIsMain; -public: - void Init(IProgress *progress, bool inSizeIsMain); - - MY_UNKNOWN_IMP - - STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize); -}; - -#endif diff --git a/7zip/Common/StdAfx.h b/7zip/Common/StdAfx.h deleted file mode 100755 index 27a77b10..00000000 --- a/7zip/Common/StdAfx.h +++ /dev/null @@ -1,9 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../Common/MyWindows.h" -#include "../../Common/NewHandler.h" - -#endif diff --git a/7zip/Common/StreamBinder.cpp b/7zip/Common/StreamBinder.cpp deleted file mode 100755 index 2984c2d9..00000000 --- a/7zip/Common/StreamBinder.cpp +++ /dev/null @@ -1,162 +0,0 @@ -// StreamBinder.cpp - -#include "StdAfx.h" - -#include "StreamBinder.h" -#include "../../Common/Defs.h" -#include "../../Common/MyCom.h" - -using namespace NWindows; -using namespace NSynchronization; - -class CSequentialInStreamForBinder: - public ISequentialInStream, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP - - STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); -private: - CStreamBinder *m_StreamBinder; -public: - ~CSequentialInStreamForBinder() { m_StreamBinder->CloseRead(); } - void SetBinder(CStreamBinder *streamBinder) { m_StreamBinder = streamBinder; } -}; - -STDMETHODIMP CSequentialInStreamForBinder::Read(void *data, UInt32 size, UInt32 *processedSize) - { return m_StreamBinder->Read(data, size, processedSize); } - -class CSequentialOutStreamForBinder: - public ISequentialOutStream, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP - - STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); - -private: - CStreamBinder *m_StreamBinder; -public: - ~CSequentialOutStreamForBinder() { m_StreamBinder->CloseWrite(); } - void SetBinder(CStreamBinder *streamBinder) { m_StreamBinder = streamBinder; } -}; - -STDMETHODIMP CSequentialOutStreamForBinder::Write(const void *data, UInt32 size, UInt32 *processedSize) - { return m_StreamBinder->Write(data, size, processedSize); } - - -////////////////////////// -// CStreamBinder -// (_thereAreBytesToReadEvent && _bufferSize == 0) means that stream is finished. - -void CStreamBinder::CreateEvents() -{ - _allBytesAreWritenEvent = new CManualResetEvent(true); - _thereAreBytesToReadEvent = new CManualResetEvent(false); - _readStreamIsClosedEvent = new CManualResetEvent(false); -} - -void CStreamBinder::ReInit() -{ - _thereAreBytesToReadEvent->Reset(); - _readStreamIsClosedEvent->Reset(); - ProcessedSize = 0; -} - -CStreamBinder::~CStreamBinder() -{ - if (_allBytesAreWritenEvent != NULL) - delete _allBytesAreWritenEvent; - if (_thereAreBytesToReadEvent != NULL) - delete _thereAreBytesToReadEvent; - if (_readStreamIsClosedEvent != NULL) - delete _readStreamIsClosedEvent; -} - - - - -void CStreamBinder::CreateStreams(ISequentialInStream **inStream, - ISequentialOutStream **outStream) -{ - CSequentialInStreamForBinder *inStreamSpec = new - CSequentialInStreamForBinder; - CMyComPtr inStreamLoc(inStreamSpec); - inStreamSpec->SetBinder(this); - *inStream = inStreamLoc.Detach(); - - CSequentialOutStreamForBinder *outStreamSpec = new - CSequentialOutStreamForBinder; - CMyComPtr outStreamLoc(outStreamSpec); - outStreamSpec->SetBinder(this); - *outStream = outStreamLoc.Detach(); - - _buffer = NULL; - _bufferSize= 0; - ProcessedSize = 0; -} - -HRESULT CStreamBinder::Read(void *data, UInt32 size, UInt32 *processedSize) -{ - UInt32 sizeToRead = size; - if (size > 0) - { - if(!_thereAreBytesToReadEvent->Lock()) - return E_FAIL; - sizeToRead = MyMin(_bufferSize, size); - if (_bufferSize > 0) - { - MoveMemory(data, _buffer, sizeToRead); - _buffer = ((const Byte *)_buffer) + sizeToRead; - _bufferSize -= sizeToRead; - if (_bufferSize == 0) - { - _thereAreBytesToReadEvent->Reset(); - _allBytesAreWritenEvent->Set(); - } - } - } - if (processedSize != NULL) - *processedSize = sizeToRead; - ProcessedSize += sizeToRead; - return S_OK; -} - -void CStreamBinder::CloseRead() -{ - _readStreamIsClosedEvent->Set(); -} - -HRESULT CStreamBinder::Write(const void *data, UInt32 size, UInt32 *processedSize) -{ - if (size > 0) - { - _buffer = data; - _bufferSize = size; - _allBytesAreWritenEvent->Reset(); - _thereAreBytesToReadEvent->Set(); - - HANDLE events[2]; - events[0] = *_allBytesAreWritenEvent; - events[1] = *_readStreamIsClosedEvent; - DWORD waitResult = ::WaitForMultipleObjects(2, events, FALSE, INFINITE); - if (waitResult != WAIT_OBJECT_0 + 0) - { - // ReadingWasClosed = true; - return E_FAIL; - } - // if(!_allBytesAreWritenEvent.Lock()) - // return E_FAIL; - } - if (processedSize != NULL) - *processedSize = size; - return S_OK; -} - -void CStreamBinder::CloseWrite() -{ - // _bufferSize must be = 0 - _thereAreBytesToReadEvent->Set(); -} diff --git a/7zip/Common/StreamBinder.h b/7zip/Common/StreamBinder.h deleted file mode 100755 index a66c3acb..00000000 --- a/7zip/Common/StreamBinder.h +++ /dev/null @@ -1,37 +0,0 @@ -// StreamBinder.h - -#ifndef __STREAMBINDER_H -#define __STREAMBINDER_H - -#include "../IStream.h" -#include "../../Windows/Synchronization.h" - -class CStreamBinder -{ - NWindows::NSynchronization::CManualResetEvent *_allBytesAreWritenEvent; - NWindows::NSynchronization::CManualResetEvent *_thereAreBytesToReadEvent; - NWindows::NSynchronization::CManualResetEvent *_readStreamIsClosedEvent; - UInt32 _bufferSize; - const void *_buffer; -public: - // bool ReadingWasClosed; - UInt64 ProcessedSize; - CStreamBinder(): - _allBytesAreWritenEvent(NULL), - _thereAreBytesToReadEvent(NULL), - _readStreamIsClosedEvent(NULL) - {} - ~CStreamBinder(); - void CreateEvents(); - - void CreateStreams(ISequentialInStream **inStream, - ISequentialOutStream **outStream); - HRESULT Read(void *data, UInt32 size, UInt32 *processedSize); - void CloseRead(); - - HRESULT Write(const void *data, UInt32 size, UInt32 *processedSize); - void CloseWrite(); - void ReInit(); -}; - -#endif diff --git a/7zip/Common/StreamObjects.cpp b/7zip/Common/StreamObjects.cpp deleted file mode 100755 index 32f8f306..00000000 --- a/7zip/Common/StreamObjects.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// StreamObjects.cpp - -#include "StdAfx.h" - -#include "StreamObjects.h" -#include "../../Common/Defs.h" - - -STDMETHODIMP CSequentialInStreamImp::Read(void *data, UInt32 size, UInt32 *processedSize) -{ - UInt32 numBytesToRead = (UInt32)(MyMin(_pos + size, _size) - _pos); - memmove(data, _dataPointer + _pos, numBytesToRead); - _pos += numBytesToRead; - if(processedSize != NULL) - *processedSize = numBytesToRead; - return S_OK; -} - - -void CWriteBuffer::Write(const void *data, size_t size) -{ - size_t newCapacity = _size + size; - _buffer.EnsureCapacity(newCapacity); - memmove(_buffer + _size, data, size); - _size += size; -} - -STDMETHODIMP CSequentialOutStreamImp::Write(const void *data, UInt32 size, UInt32 *processedSize) -{ - _writeBuffer.Write(data, size); - if(processedSize != NULL) - *processedSize = size; - return S_OK; -} - -STDMETHODIMP CSequentialOutStreamImp2::Write(const void *data, UInt32 size, UInt32 *processedSize) -{ - UInt32 newSize = size; - if (_pos + size > _size) - newSize = (UInt32)(_size - _pos); - memmove(_buffer + _pos, data, newSize); - if(processedSize != NULL) - *processedSize = newSize; - _pos += newSize; - if (newSize != size) - return E_FAIL; - return S_OK; -} - -STDMETHODIMP CSequentialInStreamSizeCount::Read(void *data, UInt32 size, UInt32 *processedSize) -{ - UInt32 realProcessedSize; - HRESULT result = _stream->Read(data, size, &realProcessedSize); - _size += realProcessedSize; - if (processedSize != 0) - *processedSize = realProcessedSize; - return result; -} - -STDMETHODIMP CSequentialOutStreamSizeCount::Write(const void *data, UInt32 size, UInt32 *processedSize) -{ - UInt32 realProcessedSize; - HRESULT result = _stream->Write(data, size, &realProcessedSize); - _size += realProcessedSize; - if (processedSize != 0) - *processedSize = realProcessedSize; - return result; -} diff --git a/7zip/Common/StreamObjects.h b/7zip/Common/StreamObjects.h deleted file mode 100755 index 6f670f59..00000000 --- a/7zip/Common/StreamObjects.h +++ /dev/null @@ -1,117 +0,0 @@ -// StreamObjects.h - -#ifndef __STREAMOBJECTS_H -#define __STREAMOBJECTS_H - -#include "../../Common/DynamicBuffer.h" -#include "../../Common/MyCom.h" -#include "../IStream.h" - -class CSequentialInStreamImp: - public ISequentialInStream, - public CMyUnknownImp -{ - const Byte *_dataPointer; - size_t _size; - size_t _pos; - -public: - void Init(const Byte *dataPointer, size_t size) - { - _dataPointer = dataPointer; - _size = size; - _pos = 0; - } - - MY_UNKNOWN_IMP - - STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); -}; - - -class CWriteBuffer -{ - CByteDynamicBuffer _buffer; - size_t _size; -public: - CWriteBuffer(): _size(0) {} - void Init() { _size = 0; } - void Write(const void *data, size_t size); - size_t GetSize() const { return _size; } - const CByteDynamicBuffer& GetBuffer() const { return _buffer; } -}; - -class CSequentialOutStreamImp: - public ISequentialOutStream, - public CMyUnknownImp -{ - CWriteBuffer _writeBuffer; -public: - void Init() { _writeBuffer.Init(); } - size_t GetSize() const { return _writeBuffer.GetSize(); } - const CByteDynamicBuffer& GetBuffer() const { return _writeBuffer.GetBuffer(); } - - MY_UNKNOWN_IMP - - STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); -}; - -class CSequentialOutStreamImp2: - public ISequentialOutStream, - public CMyUnknownImp -{ - Byte *_buffer; - size_t _size; - size_t _pos; -public: - - void Init(Byte *buffer, size_t size) - { - _buffer = buffer; - _pos = 0; - _size = size; - } - - size_t GetPos() const { return _pos; } - - MY_UNKNOWN_IMP - - STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); -}; - -class CSequentialInStreamSizeCount: - public ISequentialInStream, - public CMyUnknownImp -{ - CMyComPtr _stream; - UInt64 _size; -public: - void Init(ISequentialInStream *stream) - { - _stream = stream; - _size = 0; - } - UInt64 GetSize() const { return _size; } - - MY_UNKNOWN_IMP - - STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); -}; - -class CSequentialOutStreamSizeCount: - public ISequentialOutStream, - public CMyUnknownImp -{ - CMyComPtr _stream; - UInt64 _size; -public: - void SetStream(ISequentialOutStream *stream) { _stream = stream; } - void Init() { _size = 0; } - UInt64 GetSize() const { return _size; } - - MY_UNKNOWN_IMP - - STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); -}; - -#endif diff --git a/7zip/Common/StreamUtils.cpp b/7zip/Common/StreamUtils.cpp deleted file mode 100755 index a5d9ac0e..00000000 --- a/7zip/Common/StreamUtils.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// StreamUtils.cpp - -#include "StdAfx.h" - -#include "../../Common/MyCom.h" -#include "StreamUtils.h" - -HRESULT ReadStream(ISequentialInStream *stream, void *data, UInt32 size, UInt32 *processedSize) -{ - if (processedSize != 0) - *processedSize = 0; - while(size != 0) - { - UInt32 processedSizeLoc; - HRESULT res = stream->Read(data, size, &processedSizeLoc); - if (processedSize != 0) - *processedSize += processedSizeLoc; - data = (Byte *)((Byte *)data + processedSizeLoc); - size -= processedSizeLoc; - RINOK(res); - if (processedSizeLoc == 0) - return S_OK; - } - return S_OK; -} - -HRESULT WriteStream(ISequentialOutStream *stream, const void *data, UInt32 size, UInt32 *processedSize) -{ - if (processedSize != 0) - *processedSize = 0; - while(size != 0) - { - UInt32 processedSizeLoc; - HRESULT res = stream->Write(data, size, &processedSizeLoc); - if (processedSize != 0) - *processedSize += processedSizeLoc; - data = (const void *)((const Byte *)data + processedSizeLoc); - size -= processedSizeLoc; - RINOK(res); - if (processedSizeLoc == 0) - break; - } - return S_OK; -} diff --git a/7zip/Common/StreamUtils.h b/7zip/Common/StreamUtils.h deleted file mode 100755 index 59f88733..00000000 --- a/7zip/Common/StreamUtils.h +++ /dev/null @@ -1,11 +0,0 @@ -// StreamUtils.h - -#ifndef __STREAMUTILS_H -#define __STREAMUTILS_H - -#include "../IStream.h" - -HRESULT ReadStream(ISequentialInStream *stream, void *data, UInt32 size, UInt32 *processedSize); -HRESULT WriteStream(ISequentialOutStream *stream, const void *data, UInt32 size, UInt32 *processedSize); - -#endif diff --git a/7zip/Compress/Arj/ArjDecoder1.cpp b/7zip/Compress/Arj/ArjDecoder1.cpp deleted file mode 100755 index 7f720807..00000000 --- a/7zip/Compress/Arj/ArjDecoder1.cpp +++ /dev/null @@ -1,319 +0,0 @@ -// Arj/Decoder.cpp - -#include "StdAfx.h" - -#include "ArjDecoder1.h" - -#include "Windows/Defs.h" - -namespace NCompress{ -namespace NArj { -namespace NDecoder1 { - -static const UInt32 kHistorySize = 26624; -static const UInt32 kMatchMaxLen = 256; -static const UInt32 kMatchMinLen = 3; - -static const UInt32 kNC = 255 + kMatchMaxLen + 2 - kMatchMinLen; - -void CCoder::MakeTable(int nchar, Byte *bitlen, int tablebits, - UInt32 *table, int tablesize) -{ - UInt32 count[17], weight[17], start[18], *p; - UInt32 i, k, len, ch, jutbits, avail, nextcode, mask; - - for (i = 1; i <= 16; i++) - count[i] = 0; - for (i = 0; (int)i < nchar; i++) - count[bitlen[i]]++; - - start[1] = 0; - for (i = 1; i <= 16; i++) - start[i + 1] = start[i] + (count[i] << (16 - i)); - if (start[17] != (UInt32) (1 << 16)) - throw "Data error"; - - jutbits = 16 - tablebits; - for (i = 1; (int)i <= tablebits; i++) - { - start[i] >>= jutbits; - weight[i] = 1 << (tablebits - i); - } - while (i <= 16) - { - weight[i] = 1 << (16 - i); - i++; - } - - i = start[tablebits + 1] >> jutbits; - if (i != (UInt32) (1 << 16)) - { - k = 1 << tablebits; - while (i != k) - table[i++] = 0; - } - - avail = nchar; - mask = 1 << (15 - tablebits); - for (ch = 0; (int)ch < nchar; ch++) - { - if ((len = bitlen[ch]) == 0) - continue; - k = start[len]; - nextcode = k + weight[len]; - if ((int)len <= tablebits) - { - if (nextcode > (UInt32)tablesize) - throw "Data error"; - for (i = start[len]; i < nextcode; i++) - table[i] = ch; - } - else - { - p = &table[k >> jutbits]; - i = len - tablebits; - while (i != 0) - { - if (*p == 0) - { - right[avail] = left[avail] = 0; - *p = avail++; - } - if (k & mask) - p = &right[*p]; - else - p = &left[*p]; - k <<= 1; - i--; - } - *p = ch; - } - start[len] = nextcode; - } -} - -void CCoder::read_pt_len(int nn, int nbit, int i_special) -{ - UInt32 n = m_InBitStream.ReadBits(nbit); - if (n == 0) - { - UInt32 c = m_InBitStream.ReadBits(nbit); - int i; - for (i = 0; i < nn; i++) - pt_len[i] = 0; - for (i = 0; i < 256; i++) - pt_table[i] = c; - } - else - { - UInt32 i = 0; - while (i < n) - { - UInt32 bitBuf = m_InBitStream.GetValue(16); - int c = bitBuf >> 13; - if (c == 7) - { - UInt32 mask = 1 << (12); - while (mask & bitBuf) - { - mask >>= 1; - c++; - } - } - m_InBitStream.MovePos((c < 7) ? 3 : (int)(c - 3)); - pt_len[i++] = (Byte)c; - if (i == (UInt32)i_special) - { - c = m_InBitStream.ReadBits(2); - while (--c >= 0) - pt_len[i++] = 0; - } - } - while (i < (UInt32)nn) - pt_len[i++] = 0; - MakeTable(nn, pt_len, 8, pt_table, PTABLESIZE); - } -} - -void CCoder::read_c_len() -{ - int i, c, n; - UInt32 mask; - - n = m_InBitStream.ReadBits(CBIT); - if (n == 0) - { - c = m_InBitStream.ReadBits(CBIT); - for (i = 0; i < NC; i++) - c_len[i] = 0; - for (i = 0; i < CTABLESIZE; i++) - c_table[i] = c; - } - else - { - i = 0; - while (i < n) - { - UInt32 bitBuf = m_InBitStream.GetValue(16); - c = pt_table[bitBuf >> (8)]; - if (c >= NT) - { - mask = 1 << (7); - do - { - if (bitBuf & mask) - c = right[c]; - else - c = left[c]; - mask >>= 1; - } while (c >= NT); - } - m_InBitStream.MovePos((int)(pt_len[c])); - if (c <= 2) - { - if (c == 0) - c = 1; - else if (c == 1) - c = m_InBitStream.ReadBits(4) + 3; - else - c = m_InBitStream.ReadBits(CBIT) + 20; - while (--c >= 0) - c_len[i++] = 0; - } - else - c_len[i++] = (Byte)(c - 2); - } - while (i < NC) - c_len[i++] = 0; - MakeTable(NC, c_len, 12, c_table, CTABLESIZE); - } -} - -UInt32 CCoder::decode_c() -{ - UInt32 j, mask; - UInt32 bitbuf = m_InBitStream.GetValue(16); - j = c_table[bitbuf >> 4]; - if (j >= NC) - { - mask = 1 << (3); - do - { - if (bitbuf & mask) - j = right[j]; - else - j = left[j]; - mask >>= 1; - } while (j >= NC); - } - m_InBitStream.MovePos((int)(c_len[j])); - return j; -} - -UInt32 CCoder::decode_p() -{ - UInt32 j, mask; - UInt32 bitbuf = m_InBitStream.GetValue(16); - j = pt_table[bitbuf >> (8)]; - if (j >= NP) - { - mask = 1 << (7); - do - { - if (bitbuf & mask) - j = right[j]; - else - j = left[j]; - mask >>= 1; - } while (j >= NP); - } - m_InBitStream.MovePos((int)(pt_len[j])); - if (j != 0) - { - j--; - j = (1 << j) + m_InBitStream.ReadBits((int)j); - } - return j; -} - - -STDMETHODIMP CCoder::CodeReal(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 * /* inSize */, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - if (outSize == NULL) - return E_INVALIDARG; - - if (!m_OutWindowStream.Create(kHistorySize)) - return E_OUTOFMEMORY; - if (!m_InBitStream.Create(1 << 20)) - return E_OUTOFMEMORY; - - int size1 = sizeof(c_table) / sizeof(c_table[0]); - for (int i = 0; i < size1; i++) - { - if (i % 100 == 0) - c_table[i] = 0; - - c_table[i] = 0; - } - - - UInt64 pos = 0; - m_OutWindowStream.SetStream(outStream); - m_OutWindowStream.Init(false); - m_InBitStream.SetStream(inStream); - m_InBitStream.Init(); - - CCoderReleaser coderReleaser(this); - - UInt32 blockSize = 0; - - while(pos < *outSize) - { - if (blockSize == 0) - { - if (progress != NULL) - { - UInt64 packSize = m_InBitStream.GetProcessedSize(); - RINOK(progress->SetRatioInfo(&packSize, &pos)); - } - blockSize = m_InBitStream.ReadBits(16); - read_pt_len(NT, TBIT, 3); - read_c_len(); - read_pt_len(NP, PBIT, -1); - } - blockSize--; - - UInt32 number = decode_c(); - if (number < 256) - { - m_OutWindowStream.PutByte((Byte)number); - pos++; - continue; - } - else - { - UInt32 len = number - 256 + kMatchMinLen; - UInt32 distance = decode_p(); - if (distance >= pos) - throw "data error"; - m_OutWindowStream.CopyBlock(distance, len); - pos += len; - } - } - coderReleaser.NeedFlush = false; - return m_OutWindowStream.Flush(); -} - -STDMETHODIMP CCoder::Code(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - try { return CodeReal(inStream, outStream, inSize, outSize, progress);} - catch(const CInBufferException &e) { return e.ErrorCode; } - catch(const CLZOutWindowException &e) { return e.ErrorCode; } - catch(...) { return S_FALSE; } -} - -}}} diff --git a/7zip/Compress/Arj/ArjDecoder1.h b/7zip/Compress/Arj/ArjDecoder1.h deleted file mode 100755 index 434a0a41..00000000 --- a/7zip/Compress/Arj/ArjDecoder1.h +++ /dev/null @@ -1,105 +0,0 @@ -// Arj/Decoder1.h - -#ifndef __COMPRESS_ARJ_DECODER1_H -#define __COMPRESS_ARJ_DECODER1_H - -#include "../../../Common/MyCom.h" -#include "../../ICoder.h" -#include "../../Common/MSBFDecoder.h" -#include "../../Common/InBuffer.h" -#include "../LZ/LZOutWindow.h" - -/* -// {23170F69-40C1-278B-0404-010000000000} -DEFINE_GUID(CLSID_CCompressArjDecoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00); -*/ - -namespace NCompress { -namespace NArj { -namespace NDecoder1 { - -#define CODE_BIT 16 - -#define THRESHOLD 3 -#define DDICSIZ 26624 -#define MAXDICBIT 16 -#define MATCHBIT 8 -#define MAXMATCH 256 -#define NC (0xFF + MAXMATCH + 2 - THRESHOLD) -#define NP (MAXDICBIT + 1) -#define CBIT 9 -#define NT (CODE_BIT + 3) -#define PBIT 5 -#define TBIT 5 - -#if NT > NP -#define NPT NT -#else -#define NPT NP -#endif - -#define CTABLESIZE 4096 -#define PTABLESIZE 256 - - -class CCoder : - public ICompressCoder, - public CMyUnknownImp -{ - CLZOutWindow m_OutWindowStream; - NStream::NMSBF::CDecoder m_InBitStream; - - UInt32 left[2 * NC - 1]; - UInt32 right[2 * NC - 1]; - Byte c_len[NC]; - Byte pt_len[NPT]; - - UInt32 c_table[CTABLESIZE]; - UInt32 pt_table[PTABLESIZE]; - - void ReleaseStreams() - { - m_OutWindowStream.ReleaseStream(); - m_InBitStream.ReleaseStream(); - } - - class CCoderReleaser - { - CCoder *m_Coder; - public: - bool NeedFlush; - CCoderReleaser(CCoder *coder): m_Coder(coder), NeedFlush(true) {} - ~CCoderReleaser() - { - if (NeedFlush) - m_Coder->m_OutWindowStream.Flush(); - m_Coder->ReleaseStreams(); - } - }; - friend class CCoderReleaser; - - void MakeTable(int nchar, Byte *bitlen, int tablebits, UInt32 *table, int tablesize); - - void read_c_len(); - void read_pt_len(int nn, int nbit, int i_special); - UInt32 decode_c(); - UInt32 decode_p(); - -public: - - MY_UNKNOWN_IMP - - STDMETHOD(CodeReal)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - STDMETHOD(Code)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - -}; - -}}} - -#endif diff --git a/7zip/Compress/Arj/ArjDecoder2.cpp b/7zip/Compress/Arj/ArjDecoder2.cpp deleted file mode 100755 index a734d1b4..00000000 --- a/7zip/Compress/Arj/ArjDecoder2.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// Arj/Decoder2.cpp - -#include "StdAfx.h" - -#include "ArjDecoder2.h" - -namespace NCompress{ -namespace NArj { -namespace NDecoder2 { - -static const UInt32 kHistorySize = 26624; -static const UInt32 kMatchMaxLen = 256; -static const UInt32 kMatchMinLen = 3; - -STDMETHODIMP CCoder::CodeReal(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 * /* inSize */, const UInt64 *outSize, - ICompressProgressInfo * /* progress */) -{ - if (outSize == NULL) - return E_INVALIDARG; - - if (!m_OutWindowStream.Create(kHistorySize)) - return E_OUTOFMEMORY; - if (!m_InBitStream.Create(1 << 20)) - return E_OUTOFMEMORY; - - UInt64 pos = 0; - m_OutWindowStream.SetStream(outStream); - m_OutWindowStream.Init(false); - m_InBitStream.SetStream(inStream); - m_InBitStream.Init(); - CCoderReleaser coderReleaser(this); - - while(pos < *outSize) - { - const UInt32 kStartWidth = 0; - const UInt32 kStopWidth = 7; - UInt32 power = 1 << kStartWidth; - UInt32 width; - UInt32 len = 0; - for (width = kStartWidth; width < kStopWidth; width++) - { - if (m_InBitStream.ReadBits(1) == 0) - break; - len += power; - power <<= 1; - } - if (width != 0) - len += m_InBitStream.ReadBits(width); - if (len == 0) - { - m_OutWindowStream.PutByte((Byte)m_InBitStream.ReadBits(8)); - pos++; - continue; - } - else - { - len = len - 1 + kMatchMinLen; - const UInt32 kStartWidth = 9; - const UInt32 kStopWidth = 13; - UInt32 power = 1 << kStartWidth; - UInt32 width; - UInt32 distance = 0; - for (width = kStartWidth; width < kStopWidth; width++) - { - if (m_InBitStream.ReadBits(1) == 0) - break; - distance += power; - power <<= 1; - } - if (width != 0) - distance += m_InBitStream.ReadBits(width); - if (distance >= pos) - throw "data error"; - m_OutWindowStream.CopyBlock(distance, len); - pos += len; - } - } - coderReleaser.NeedFlush = false; - return m_OutWindowStream.Flush(); -} - -STDMETHODIMP CCoder::Code(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - try { return CodeReal(inStream, outStream, inSize, outSize, progress);} - catch(const CInBufferException &e) { return e.ErrorCode; } - catch(const CLZOutWindowException &e) { return e.ErrorCode; } - catch(...) { return S_FALSE; } -} - -}}} diff --git a/7zip/Compress/Arj/ArjDecoder2.h b/7zip/Compress/Arj/ArjDecoder2.h deleted file mode 100755 index 7a33f6bd..00000000 --- a/7zip/Compress/Arj/ArjDecoder2.h +++ /dev/null @@ -1,65 +0,0 @@ -// Arj/Decoder2.h - -#ifndef __COMPRESS_ARJ_DECODER2_H -#define __COMPRESS_ARJ_DECODER2_H - -#include "../../../Common/MyCom.h" -#include "../../ICoder.h" -#include "../../Common/MSBFDecoder.h" -#include "../../Common/InBuffer.h" -#include "../LZ/LZOutWindow.h" - -/* -// {23170F69-40C1-278B-0404-020000000000} -DEFINE_GUID(CLSID_CCompressArj2Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x04, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00); -*/ - -namespace NCompress { -namespace NArj { -namespace NDecoder2 { - -class CCoder : - public ICompressCoder, - public CMyUnknownImp -{ - CLZOutWindow m_OutWindowStream; - NStream::NMSBF::CDecoder m_InBitStream; - - void ReleaseStreams() - { - m_OutWindowStream.ReleaseStream(); - m_InBitStream.ReleaseStream(); - } - - class CCoderReleaser - { - CCoder *m_Coder; - public: - bool NeedFlush; - CCoderReleaser(CCoder *coder): m_Coder(coder), NeedFlush(true) {} - ~CCoderReleaser() - { - if (NeedFlush) - m_Coder->m_OutWindowStream.Flush(); - m_Coder->ReleaseStreams(); - } - }; - friend class CCoderReleaser; - -public: - MY_UNKNOWN_IMP - - STDMETHOD(CodeReal)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - STDMETHOD(Code)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - -}; - -}}} - -#endif diff --git a/7zip/Compress/Arj/StdAfx.h b/7zip/Compress/Arj/StdAfx.h deleted file mode 100755 index e7fb6986..00000000 --- a/7zip/Compress/Arj/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Compress/BWT/BlockSort.cpp b/7zip/Compress/BWT/BlockSort.cpp deleted file mode 100755 index ffe7dd9d..00000000 --- a/7zip/Compress/BWT/BlockSort.cpp +++ /dev/null @@ -1,288 +0,0 @@ -// BlockSort.cpp - -#include "StdAfx.h" - -#include "BlockSort.h" - -#include "Common/Alloc.h" - -namespace NCompress { - -static const int kNumHashBytes = 2; -static const UInt32 kNumHashValues = 1 << (kNumHashBytes * 8); - -static const int kNumFlagsBits = 5; // 32 Flags in UInt32 word -static const UInt32 kNumFlagsInWord = (1 << kNumFlagsBits); -static const UInt32 kFlagsMask = kNumFlagsInWord - 1; -static const UInt32 kAllFlags = 0xFFFFFFFF; - -bool CBlockSorter::Create(UInt32 blockSizeMax) -{ - if (Indices != 0 && blockSizeMax == BlockSizeMax) - return true; - Free(); - BlockSizeMax = blockSizeMax; - Indices = (UInt32 *)::BigAlloc((blockSizeMax * 2 + - ((blockSizeMax + kFlagsMask) >> kNumFlagsBits) + kNumHashValues) * sizeof(UInt32)); - return (Indices != 0); -} - -void CBlockSorter::Free() -{ - ::BigFree(Indices); - Indices = 0; -} - -// SortGroup - is recursive Radix-Range-Sort function with Bubble-Sort optimization -// It uses both mask & maskSize (Range-Sort), since it can change values (Groups) -// during sorting -// returns: 0 - if there are groups, 1 - no more groups -UInt32 CBlockSorter::SortGroup(UInt32 groupOffset, UInt32 groupSize, UInt32 mask, UInt32 maskSize) -{ - if (groupSize <= 2) - { - if (groupSize <= 1) - return 0; - UInt32 *ind2 = Indices + groupOffset; - UInt32 stringPos = ind2[0] + NumSortedBytes; - if (stringPos >= BlockSize) - stringPos -= BlockSize; - UInt32 group = Groups[stringPos]; - stringPos = ind2[1] + NumSortedBytes; - if (stringPos >= BlockSize) - stringPos -= BlockSize; - if (group == Groups[stringPos]) - return 1; - if (group > Groups[stringPos]) - { - UInt32 temp = ind2[0]; - ind2[0] = ind2[1]; - ind2[1] = temp; - } - Flags[groupOffset >> kNumFlagsBits] &= ~(1 << (groupOffset & kFlagsMask)); - Groups[ind2[1]] = groupOffset + 1; - return 0; - } - - // Check that all strings are in one group (cannot sort) - UInt32 *ind2 = Indices + groupOffset; - { - UInt32 stringPos = ind2[0] + NumSortedBytes; - if (stringPos >= BlockSize) - stringPos -= BlockSize; - UInt32 group = Groups[stringPos]; - UInt32 j; - for (j = 1; j < groupSize; j++) - { - stringPos = ind2[j] + NumSortedBytes; - if (stringPos >= BlockSize) - stringPos -= BlockSize; - if (Groups[stringPos] != group) - break; - } - if (j == groupSize) - return 1; - } - - if (groupSize <= 15) - { - // Bubble-Sort - UInt32 lastChange = groupSize; - do - { - UInt32 stringPos = ind2[0] + NumSortedBytes; - if (stringPos >= BlockSize) - stringPos -= BlockSize; - UInt32 group = Groups[stringPos]; - - UInt32 sortSize = lastChange; - lastChange = 0; - for (UInt32 j = 1; j < sortSize; j++) - { - stringPos = ind2[j] + NumSortedBytes; - if (stringPos >= BlockSize) - stringPos -= BlockSize; - if (Groups[stringPos] < group) - { - UInt32 temp = ind2[j]; - ind2[j] = ind2[j - 1]; - ind2[j - 1] = temp; - lastChange = j; - } - else - group = Groups[stringPos]; - } - } - while(lastChange > 1); - - // Write Flags - UInt32 stringPos = ind2[0] + NumSortedBytes; - if (stringPos >= BlockSize) - stringPos -= BlockSize; - UInt32 group = Groups[stringPos]; - - UInt32 j; - for (j = 1; j < groupSize; j++) - { - stringPos = ind2[j] + NumSortedBytes; - if (stringPos >= BlockSize) - stringPos -= BlockSize; - if (Groups[stringPos] != group) - { - group = Groups[stringPos]; - UInt32 t = groupOffset + j - 1; - Flags[t >> kNumFlagsBits] &= ~(1 << (t & kFlagsMask)); - } - } - - // Write new Groups values and Check that there are groups - UInt32 thereAreGroups = 0; - for (j = 0; j < groupSize; j++) - { - UInt32 group = groupOffset + j; - for (;;) - { - Groups[ind2[j]] = group; - if ((Flags[(groupOffset + j) >> kNumFlagsBits] & (1 << ((groupOffset + j) & kFlagsMask))) == 0) - break; - j++; - thereAreGroups = 1; - } - } - return thereAreGroups; - } - - // Radix-Range Sort - UInt32 i; - for (;;) - { - if (maskSize == 0) - return 1; - UInt32 j = groupSize; - i = 0; - do - { - UInt32 stringPos = ind2[i] + NumSortedBytes; - if (stringPos >= BlockSize) - stringPos -= BlockSize; - if (Groups[stringPos] >= mask) - { - for (j--; j > i; j--) - { - stringPos = ind2[j] + NumSortedBytes; - if (stringPos >= BlockSize) - stringPos -= BlockSize; - if (Groups[stringPos] < mask) - { - UInt32 temp = ind2[i]; - ind2[i] = ind2[j]; - ind2[j] = temp; - break; - } - } - if (i >= j) - break; - } - } - while(++i < j); - maskSize >>= 1; - if (i == 0) - mask += maskSize; - else if (i == groupSize) - mask -= maskSize; - else - break; - } - UInt32 t = (groupOffset + i - 1); - Flags[t >> kNumFlagsBits] &= ~(1 << (t & kFlagsMask)); - - for (UInt32 j = i; j < groupSize; j++) - Groups[ind2[j]] = groupOffset + i; - - UInt32 res = SortGroup(groupOffset, i, mask - maskSize, maskSize); - return res | SortGroup(groupOffset + i, groupSize - i, mask + maskSize, maskSize); -} - -UInt32 CBlockSorter::Sort(const Byte *data, UInt32 blockSize) -{ - BlockSize = blockSize; - UInt32 *counters = Indices + blockSize; - Groups = counters + kNumHashValues; - Flags = Groups + blockSize; - UInt32 i; - - // Radix-Sort for 2 bytes - for (i = 0; i < kNumHashValues; i++) - counters[i] = 0; - for (i = 0; i < blockSize - 1; i++) - counters[((UInt32)data[i] << 8) | data[i + 1]]++; - counters[((UInt32)data[i] << 8) | data[0]]++; - - { - { - UInt32 numWords = (blockSize + kFlagsMask) >> kNumFlagsBits; - for (i = 0; i < numWords; i++) - Flags[i] = kAllFlags; - } - - UInt32 sum = 0; - for (i = 0; i < kNumHashValues; i++) - { - UInt32 groupSize = counters[i]; - if (groupSize > 0) - { - UInt32 t = sum + groupSize - 1; - Flags[t >> kNumFlagsBits] &= ~(1 << (t & kFlagsMask)); - sum += groupSize; - } - counters[i] = sum - groupSize; - } - - for (i = 0; i < blockSize - 1; i++) - Groups[i] = counters[((UInt32)data[i] << 8) | data[i + 1]]; - Groups[i] = counters[((UInt32)data[i] << 8) | data[0]]; - - for (i = 0; i < blockSize - 1; i++) - Indices[counters[((UInt32)data[i] << 8) | data[i + 1]]++] = i; - Indices[counters[((UInt32)data[i] << 8) | data[0]]++] = i; - } - - UInt32 mask; - for (mask = 2; mask < blockSize; mask <<= 1); - mask >>= 1; - for (NumSortedBytes = kNumHashBytes; ; NumSortedBytes <<= 1) - { - UInt32 newLimit = 0; - for (i = 0; i < blockSize;) - { - if ((Flags[i >> kNumFlagsBits] & (1 << (i & kFlagsMask))) == 0) - { - i++; - continue; - } - UInt32 groupSize; - for(groupSize = 1; - (Flags[(i + groupSize) >> kNumFlagsBits] & (1 << ((i + groupSize) & kFlagsMask))) != 0; - groupSize++); - - groupSize++; - - if (NumSortedBytes >= blockSize) - for (UInt32 j = 0; j < groupSize; j++) - { - UInt32 t = (i + j); - Flags[t >> kNumFlagsBits] &= ~(1 << (t & kFlagsMask)); - Groups[Indices[t]] = t; - } - else - if (SortGroup(i, groupSize, mask, mask) != 0) - newLimit = i + groupSize; - i += groupSize; - } - if (newLimit == 0) - break; - } - return Groups[0]; -} - -} diff --git a/7zip/Compress/BWT/BlockSort.h b/7zip/Compress/BWT/BlockSort.h deleted file mode 100755 index 599c3b60..00000000 --- a/7zip/Compress/BWT/BlockSort.h +++ /dev/null @@ -1,29 +0,0 @@ -// BlockSort.h - -#ifndef __BLOCKSORT_H -#define __BLOCKSORT_H - -#include "Common/Types.h" - -namespace NCompress { - -class CBlockSorter -{ - UInt32 *Groups; - UInt32 *Flags; - UInt32 BlockSize; - UInt32 NumSortedBytes; - UInt32 BlockSizeMax; - UInt32 SortGroup(UInt32 groupOffset, UInt32 groupSize, UInt32 mask, UInt32 maskSize); -public: - UInt32 *Indices; - CBlockSorter(): Indices(0) {} - ~CBlockSorter() { Free(); } - bool Create(UInt32 blockSizeMax); - void Free(); - UInt32 Sort(const Byte *data, UInt32 blockSize); -}; - -} - -#endif diff --git a/7zip/Compress/BWT/Mtf8.h b/7zip/Compress/BWT/Mtf8.h deleted file mode 100755 index d6c1c41a..00000000 --- a/7zip/Compress/BWT/Mtf8.h +++ /dev/null @@ -1,140 +0,0 @@ -// Mtf8.h - -#ifndef __MTF8_H -#define __MTF8_H - -#include "Common/Types.h" - -namespace NCompress { - -class CMtf8Encoder -{ -public: - Byte Buffer[256]; - int FindAndMove(Byte v) - { - int pos; - for (pos = 0; Buffer[pos] != v; pos++); - int resPos = pos; - for (; pos >= 8; pos -= 8) - { - Buffer[pos] = Buffer[pos - 1]; - Buffer[pos - 1] = Buffer[pos - 2]; - Buffer[pos - 2] = Buffer[pos - 3]; - Buffer[pos - 3] = Buffer[pos - 4]; - Buffer[pos - 4] = Buffer[pos - 5]; - Buffer[pos - 5] = Buffer[pos - 6]; - Buffer[pos - 6] = Buffer[pos - 7]; - Buffer[pos - 7] = Buffer[pos - 8]; - } - for (; pos > 0; pos--) - Buffer[pos] = Buffer[pos - 1]; - Buffer[0] = v; - return resPos; - } -}; - -class CMtf8Decoder -{ -public: - Byte Buffer[256]; - void Init(int /* size */) {}; - Byte GetHead() const { return Buffer[0]; } - Byte GetAndMove(int pos) - { - Byte res = Buffer[pos]; - for (; pos >= 8; pos -= 8) - { - Buffer[pos] = Buffer[pos - 1]; - Buffer[pos - 1] = Buffer[pos - 2]; - Buffer[pos - 2] = Buffer[pos - 3]; - Buffer[pos - 3] = Buffer[pos - 4]; - Buffer[pos - 4] = Buffer[pos - 5]; - Buffer[pos - 5] = Buffer[pos - 6]; - Buffer[pos - 6] = Buffer[pos - 7]; - Buffer[pos - 7] = Buffer[pos - 8]; - } - for (; pos > 0; pos--) - Buffer[pos] = Buffer[pos - 1]; - Buffer[0] = res; - return res; - } -}; - -/* -const int kSmallSize = 64; -class CMtf8Decoder -{ - Byte SmallBuffer[kSmallSize]; - int SmallSize; - Byte Counts[16]; - int Size; -public: - Byte Buffer[256]; - - Byte GetHead() const - { - if (SmallSize > 0) - return SmallBuffer[kSmallSize - SmallSize]; - return Buffer[0]; - } - - void Init(int size) - { - Size = size; - SmallSize = 0; - for (int i = 0; i < 16; i++) - { - Counts[i] = ((size >= 16) ? 16 : size); - size -= Counts[i]; - } - } - - Byte GetAndMove(int pos) - { - if (pos < SmallSize) - { - Byte *p = SmallBuffer + kSmallSize - SmallSize; - Byte res = p[pos]; - for (; pos > 0; pos--) - p[pos] = p[pos - 1]; - SmallBuffer[kSmallSize - SmallSize] = res; - return res; - } - if (SmallSize == kSmallSize) - { - int i = Size - 1; - int g = 16; - do - { - g--; - int offset = (g << 4); - for (int t = Counts[g] - 1; t >= 0; t--, i--) - Buffer[i] = Buffer[offset + t]; - } - while(g != 0); - - for (i = kSmallSize - 1; i >= 0; i--) - Buffer[i] = SmallBuffer[i]; - Init(Size); - } - pos -= SmallSize; - int g; - for (g = 0; pos >= Counts[g]; g++) - pos -= Counts[g]; - int offset = (g << 4); - Byte res = Buffer[offset + pos]; - for (pos; pos < 16 - 1; pos++) - Buffer[offset + pos] = Buffer[offset + pos + 1]; - - SmallSize++; - SmallBuffer[kSmallSize - SmallSize] = res; - - Counts[g]--; - return res; - } -}; -*/ - -} -#endif diff --git a/7zip/Compress/BWT/StdAfx.h b/7zip/Compress/BWT/StdAfx.h deleted file mode 100755 index b637fd40..00000000 --- a/7zip/Compress/BWT/StdAfx.h +++ /dev/null @@ -1,6 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#endif diff --git a/7zip/Compress/BZip2/BZip2.dsp b/7zip/Compress/BZip2/BZip2.dsp deleted file mode 100755 index c8d1bd1e..00000000 --- a/7zip/Compress/BZip2/BZip2.dsp +++ /dev/null @@ -1,281 +0,0 @@ -# Microsoft Developer Studio Project File - Name="BZip2" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=BZip2 - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "BZip2.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "BZip2.mak" CFG="BZip2 - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "BZip2 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "BZip2 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "BZip2 - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZIP2_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "BZ_NO_STDIO" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZIP2_EXPORTS" /D "COMPRESS_BZIP2_MT" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Codecs\BZip2.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "BZip2 - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZIP2_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZIP2_EXPORTS" /D "COMPRESS_BZIP2_MT" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Codecs\BZip2.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "BZip2 - Win32 Release" -# Name "BZip2 - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Codec.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# End Group -# Begin Group "Huffman" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Huffman\HuffmanDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\Huffman\HuffmanEncoder.cpp - -!IF "$(CFG)" == "BZip2 - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "BZip2 - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\Huffman\HuffmanEncoder.h -# End Source File -# End Group -# Begin Group "7-Zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\MSBFDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\MSBFEncoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# End Group -# Begin Group "BWT" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\BWT\BlockSort.cpp - -!IF "$(CFG)" == "BZip2 - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "BZip2 - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\BWT\BlockSort.h -# End Source File -# Begin Source File - -SOURCE=..\BWT\Mtf8.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Thread.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\BZip2Const.h -# End Source File -# Begin Source File - -SOURCE=.\BZip2CRC.cpp -# End Source File -# Begin Source File - -SOURCE=.\BZip2CRC.h -# End Source File -# Begin Source File - -SOURCE=.\BZip2Decoder.cpp - -!IF "$(CFG)" == "BZip2 - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "BZip2 - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\BZip2Decoder.h -# End Source File -# Begin Source File - -SOURCE=.\BZip2Encoder.cpp - -!IF "$(CFG)" == "BZip2 - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "BZip2 - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\BZip2Encoder.h -# End Source File -# End Target -# End Project diff --git a/7zip/Compress/BZip2/BZip2.dsw b/7zip/Compress/BZip2/BZip2.dsw deleted file mode 100755 index 697e5095..00000000 --- a/7zip/Compress/BZip2/BZip2.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "BZip2"=.\BZip2.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Compress/BZip2/BZip2CRC.cpp b/7zip/Compress/BZip2/BZip2CRC.cpp deleted file mode 100755 index ba9ddb7e..00000000 --- a/7zip/Compress/BZip2/BZip2CRC.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// BZip2CRC.cpp - -#include "StdAfx.h" - -#include "BZip2CRC.h" - -UInt32 CBZip2CRC::Table[256]; - -static const UInt32 kBZip2CRCPoly = 0x04c11db7; /* AUTODIN II, Ethernet, & FDDI */ - -void CBZip2CRC::InitTable() -{ - for (UInt32 i = 0; i < 256; i++) - { - UInt32 r = (i << 24); - for (int j = 8; j > 0; j--) - r = (r & 0x80000000) ? ((r << 1) ^ kBZip2CRCPoly) : (r << 1); - Table[i] = r; - } -} - -class CBZip2CRCTableInit -{ -public: - CBZip2CRCTableInit() { CBZip2CRC::InitTable(); } -} g_BZip2CRCTableInit; diff --git a/7zip/Compress/BZip2/BZip2CRC.h b/7zip/Compress/BZip2/BZip2CRC.h deleted file mode 100755 index 7170fb1a..00000000 --- a/7zip/Compress/BZip2/BZip2CRC.h +++ /dev/null @@ -1,30 +0,0 @@ -// BZip2CRC.h - -#ifndef __BZIP2_CRC_H -#define __BZIP2_CRC_H - -#include "Common/Types.h" - -class CBZip2CRC -{ - UInt32 _value; - static UInt32 Table[256]; -public: - static void InitTable(); - CBZip2CRC(): _value(0xFFFFFFFF) {}; - void Init() { _value = 0xFFFFFFFF; } - void UpdateByte(Byte b) { _value = Table[(_value >> 24) ^ b] ^ (_value << 8); } - UInt32 GetDigest() const { return _value ^ 0xFFFFFFFF; } -}; - -class CBZip2CombinedCRC -{ - UInt32 _value; -public: - CBZip2CombinedCRC(): _value(0){}; - void Init() { _value = 0; } - void Update(UInt32 v) { _value = ((_value << 1) | (_value >> 31)) ^ v; } - UInt32 GetDigest() const { return _value ; } -}; - -#endif diff --git a/7zip/Compress/BZip2/BZip2Const.h b/7zip/Compress/BZip2/BZip2Const.h deleted file mode 100755 index 62427aa6..00000000 --- a/7zip/Compress/BZip2/BZip2Const.h +++ /dev/null @@ -1,54 +0,0 @@ -// Compress/BZip2Const.h - -#ifndef __COMPRESS_BZIP2_CONST_H -#define __COMPRESS_BZIP2_CONST_H - -namespace NCompress { -namespace NBZip2 { - -const Byte kArSig0 = 'B'; -const Byte kArSig1 = 'Z'; -const Byte kArSig2 = 'h'; -const Byte kArSig3 = '0'; - -const Byte kFinSig0 = 0x17; -const Byte kFinSig1 = 0x72; -const Byte kFinSig2 = 0x45; -const Byte kFinSig3 = 0x38; -const Byte kFinSig4 = 0x50; -const Byte kFinSig5 = 0x90; - -const Byte kBlockSig0 = 0x31; -const Byte kBlockSig1 = 0x41; -const Byte kBlockSig2 = 0x59; -const Byte kBlockSig3 = 0x26; -const Byte kBlockSig4 = 0x53; -const Byte kBlockSig5 = 0x59; - -const int kNumOrigBits = 24; - -const int kNumTablesBits = 3; -const int kNumTablesMin = 2; -const int kNumTablesMax = 6; - -const int kNumLevelsBits = 5; - -const int kMaxHuffmanLen = 20; // Check it - -const int kMaxAlphaSize = 258; - -const int kGroupSize = 50; - -const int kBlockSizeMultMin = 1; -const int kBlockSizeMultMax = 9; -const UInt32 kBlockSizeStep = 100000; -const UInt32 kBlockSizeMax = kBlockSizeMultMax * kBlockSizeStep; - -const int kNumSelectorsBits = 15; -const UInt32 kNumSelectorsMax = (2 + (kBlockSizeMax / kGroupSize)); - -const int kRleModeRepSize = 4; - -}} - -#endif diff --git a/7zip/Compress/BZip2/BZip2Decoder.cpp b/7zip/Compress/BZip2/BZip2Decoder.cpp deleted file mode 100755 index 3f45e665..00000000 --- a/7zip/Compress/BZip2/BZip2Decoder.cpp +++ /dev/null @@ -1,648 +0,0 @@ -// BZip2Decoder.cpp - -#include "StdAfx.h" - -#include "BZip2Decoder.h" - -#include "../../../Common/Alloc.h" -#include "../../../Common/Defs.h" -#include "../BWT/Mtf8.h" -#include "BZip2CRC.h" - -namespace NCompress { -namespace NBZip2 { - -const UInt32 kNumThreadsMax = 4; - -static const UInt32 kBufferSize = (1 << 17); - -static Int16 kRandNums[512] = { - 619, 720, 127, 481, 931, 816, 813, 233, 566, 247, - 985, 724, 205, 454, 863, 491, 741, 242, 949, 214, - 733, 859, 335, 708, 621, 574, 73, 654, 730, 472, - 419, 436, 278, 496, 867, 210, 399, 680, 480, 51, - 878, 465, 811, 169, 869, 675, 611, 697, 867, 561, - 862, 687, 507, 283, 482, 129, 807, 591, 733, 623, - 150, 238, 59, 379, 684, 877, 625, 169, 643, 105, - 170, 607, 520, 932, 727, 476, 693, 425, 174, 647, - 73, 122, 335, 530, 442, 853, 695, 249, 445, 515, - 909, 545, 703, 919, 874, 474, 882, 500, 594, 612, - 641, 801, 220, 162, 819, 984, 589, 513, 495, 799, - 161, 604, 958, 533, 221, 400, 386, 867, 600, 782, - 382, 596, 414, 171, 516, 375, 682, 485, 911, 276, - 98, 553, 163, 354, 666, 933, 424, 341, 533, 870, - 227, 730, 475, 186, 263, 647, 537, 686, 600, 224, - 469, 68, 770, 919, 190, 373, 294, 822, 808, 206, - 184, 943, 795, 384, 383, 461, 404, 758, 839, 887, - 715, 67, 618, 276, 204, 918, 873, 777, 604, 560, - 951, 160, 578, 722, 79, 804, 96, 409, 713, 940, - 652, 934, 970, 447, 318, 353, 859, 672, 112, 785, - 645, 863, 803, 350, 139, 93, 354, 99, 820, 908, - 609, 772, 154, 274, 580, 184, 79, 626, 630, 742, - 653, 282, 762, 623, 680, 81, 927, 626, 789, 125, - 411, 521, 938, 300, 821, 78, 343, 175, 128, 250, - 170, 774, 972, 275, 999, 639, 495, 78, 352, 126, - 857, 956, 358, 619, 580, 124, 737, 594, 701, 612, - 669, 112, 134, 694, 363, 992, 809, 743, 168, 974, - 944, 375, 748, 52, 600, 747, 642, 182, 862, 81, - 344, 805, 988, 739, 511, 655, 814, 334, 249, 515, - 897, 955, 664, 981, 649, 113, 974, 459, 893, 228, - 433, 837, 553, 268, 926, 240, 102, 654, 459, 51, - 686, 754, 806, 760, 493, 403, 415, 394, 687, 700, - 946, 670, 656, 610, 738, 392, 760, 799, 887, 653, - 978, 321, 576, 617, 626, 502, 894, 679, 243, 440, - 680, 879, 194, 572, 640, 724, 926, 56, 204, 700, - 707, 151, 457, 449, 797, 195, 791, 558, 945, 679, - 297, 59, 87, 824, 713, 663, 412, 693, 342, 606, - 134, 108, 571, 364, 631, 212, 174, 643, 304, 329, - 343, 97, 430, 751, 497, 314, 983, 374, 822, 928, - 140, 206, 73, 263, 980, 736, 876, 478, 430, 305, - 170, 514, 364, 692, 829, 82, 855, 953, 676, 246, - 369, 970, 294, 750, 807, 827, 150, 790, 288, 923, - 804, 378, 215, 828, 592, 281, 565, 555, 710, 82, - 896, 831, 547, 261, 524, 462, 293, 465, 502, 56, - 661, 821, 976, 991, 658, 869, 905, 758, 745, 193, - 768, 550, 608, 933, 378, 286, 215, 979, 792, 961, - 61, 688, 793, 644, 986, 403, 106, 366, 905, 644, - 372, 567, 466, 434, 645, 210, 389, 550, 919, 135, - 780, 773, 635, 389, 707, 100, 626, 958, 165, 504, - 920, 176, 193, 713, 857, 265, 203, 50, 668, 108, - 645, 990, 626, 197, 510, 357, 358, 850, 858, 364, - 936, 638 -}; - -bool CState::Alloc() -{ - if (tt == 0) - tt = (UInt32 *)BigAlloc(kBlockSizeMax * sizeof(UInt32)); - return (tt != 0); -} - -void CState::Free() -{ - ::BigFree(tt); - tt = 0; -} - -#ifdef COMPRESS_BZIP2_MT -void CState::FinishStream(bool needLeave) -{ - Decoder->StreamWasFinished = true; - StreamWasFinishedEvent.Set(); - if (needLeave) - Decoder->CS.Leave(); - Decoder->CanStartWaitingEvent.Lock(); - WaitingWasStartedEvent.Set(); -} - -DWORD CState::ThreadFunc() -{ - for (;;) - { - Decoder->CS.Enter(); - if (Decoder->CloseThreads) - { - Decoder->CS.Leave(); - return 0; - } - if (Decoder->StreamWasFinished) - { - FinishStream(true); - continue; - } - HRESULT res = S_OK; - bool neadLeave = true; - try - { - UInt32 blockIndex = Decoder->NextBlockIndex; - UInt32 nextBlockIndex = blockIndex + 1; - if (nextBlockIndex == Decoder->NumThreads) - nextBlockIndex = 0; - Decoder->NextBlockIndex = nextBlockIndex; - - bool wasFinished; - UInt32 crc; - res = Decoder->ReadSignatures(wasFinished, crc); - if (res != S_OK) - { - Decoder->Result = res; - FinishStream(true); - continue; - } - if (wasFinished) - { - Decoder->Result = res; - FinishStream(true); - continue; - } - - res = Decoder->ReadBlock(Decoder->BlockSizeMax, *this); - UInt64 packSize = Decoder->m_InStream.GetProcessedSize(); - if (res != S_OK) - { - Decoder->Result = res; - FinishStream(true); - continue; - } - neadLeave = false; - Decoder->CS.Leave(); - - DecodeBlock1(); - - Decoder->m_States[blockIndex].CanWriteEvent.Lock(); - - if (DecodeBlock2(Decoder->m_OutStream) != crc) - { - Decoder->Result = S_FALSE; - FinishStream(neadLeave); - continue; - } - - if (Decoder->Progress) - { - UInt64 unpackSize = Decoder->m_OutStream.GetProcessedSize(); - res = Decoder->Progress->SetRatioInfo(&packSize, &unpackSize); - } - - Decoder->m_States[nextBlockIndex].CanWriteEvent.Set(); - } - catch(const CInBufferException &e) { res = e.ErrorCode; } - catch(const COutBufferException &e) { res = e.ErrorCode; } - catch(...) { res = E_FAIL; } - if (res != S_OK) - { - Decoder->Result = res; - FinishStream(neadLeave); - continue; - } - } -} - -static DWORD WINAPI MFThread(void *threadCoderInfo) -{ - return ((CState *)threadCoderInfo)->ThreadFunc(); -} -#endif - -UInt32 CDecoder::ReadBits(int numBits) { return m_InStream.ReadBits(numBits); } -Byte CDecoder::ReadByte() {return (Byte)ReadBits(8); } -bool CDecoder::ReadBit() { return ReadBits(1) != 0; } - -UInt32 CDecoder::ReadCRC() -{ - UInt32 crc = 0; - for (int i = 0; i < 4; i++) - { - crc <<= 8; - crc |= ReadByte(); - } - return crc; -} - -HRESULT CDecoder::ReadBlock(UInt32 blockSizeMax, CState &state) -{ - state.BlockRandomised = ReadBit(); - state.OrigPtr = ReadBits(kNumOrigBits); - - // in original code it compares OrigPtr to (UInt32)(10 + blockSizeMax)) : why ? - if (state.OrigPtr >= blockSizeMax) - return S_FALSE; - - CMtf8Decoder mtf; - int numInUse = 0; - { - bool inUse16[16]; - int i; - for (i = 0; i < 16; i++) - inUse16[i] = ReadBit(); - for (i = 0; i < 256; i++) - if (inUse16[i >> 4]) - if (ReadBit()) - mtf.Buffer[numInUse++] = (Byte)i; - if (numInUse == 0) - return S_FALSE; - mtf.Init(numInUse); - } - int alphaSize = numInUse + 2; - - int numTables = ReadBits(kNumTablesBits); - if (numTables < kNumTablesMin || numTables > kNumTablesMax) - return S_FALSE; - - UInt32 numSelectors = ReadBits(kNumSelectorsBits); - if (numSelectors < 1 || numSelectors > kNumSelectorsMax) - return S_FALSE; - - { - Byte mtfPos[kNumTablesMax]; - int t = 0; - do - mtfPos[t] = (Byte)t; - while(++t < numTables); - UInt32 i = 0; - do - { - int j = 0; - while (ReadBit()) - if (++j >= numTables) - return S_FALSE; - Byte tmp = mtfPos[j]; - for (;j > 0; j--) - mtfPos[j] = mtfPos[j - 1]; - state.m_Selectors[i] = mtfPos[0] = tmp; - } - while(++i < numSelectors); - } - - int t = 0; - do - { - Byte lens[kMaxAlphaSize]; - int len = (int)ReadBits(kNumLevelsBits); - int i; - for (i = 0; i < alphaSize; i++) - { - for (;;) - { - if (len < 1 || len > kMaxHuffmanLen) - return S_FALSE; - if (!ReadBit()) - break; - if (ReadBit()) - len--; - else - len++; - } - lens[i] = (Byte)len; - } - for (; i < kMaxAlphaSize; i++) - lens[i] = 0; - if(!m_HuffmanDecoders[t].SetCodeLengths(lens)) - return S_FALSE; - } - while(++t < numTables); - - { - for (int i = 0; i < 256; i++) - state.CharCounters[i] = 0; - } - - UInt32 blockSize = 0; - { - UInt32 groupIndex = 0; - UInt32 groupSize = 0; - CHuffmanDecoder *huffmanDecoder = 0; - int runPower = 0; - UInt32 runCounter = 0; - - for (;;) - { - if (groupSize == 0) - { - if (groupIndex >= numSelectors) - return S_FALSE; - groupSize = kGroupSize; - huffmanDecoder = &m_HuffmanDecoders[state.m_Selectors[groupIndex++]]; - } - groupSize--; - - UInt32 nextSym = huffmanDecoder->DecodeSymbol(&m_InStream); - - if (nextSym < 2) - { - runCounter += ((UInt32)(nextSym + 1) << runPower++); - if (blockSizeMax - blockSize < runCounter) - return S_FALSE; - continue; - } - if (runCounter != 0) - { - Byte b = mtf.GetHead(); - state.CharCounters[b] += runCounter; - do - state.tt[blockSize++] = (UInt32)b; - while(--runCounter != 0); - runPower = 0; - } - if (nextSym <= (UInt32)numInUse) - { - Byte b = mtf.GetAndMove((int)nextSym - 1); - if (blockSize >= blockSizeMax) - return S_FALSE; - state.CharCounters[b]++; - state.tt[blockSize++] = (UInt32)b; - } - else if (nextSym == (UInt32)numInUse + 1) - break; - else - return S_FALSE; - } - } - if (state.OrigPtr >= blockSize) - return S_FALSE; - state.BlockSize = blockSize; - return S_OK; -} - -void CState::DecodeBlock1() -{ - UInt32 *charCounters = this->CharCounters; - { - UInt32 sum = 0; - for (UInt32 i = 0; i < 256; i++) - { - sum += charCounters[i]; - charCounters[i] = sum - charCounters[i]; - } - } - - // Compute the T^(-1) vector - UInt32 blockSize = this->BlockSize; - UInt32 i = 0; - do - tt[charCounters[tt[i] & 0xFF]++] |= (i << 8); - while(++i < blockSize); -} - -UInt32 CState::DecodeBlock2(COutBuffer &m_OutStream) -{ - UInt32 blockSize = this->BlockSize; - - CBZip2CRC crc; - - UInt32 randIndex = 1; - UInt32 randToGo = kRandNums[0] - 2; - - int numReps = 0; - - // it's for speed optimization: prefetch & prevByte_init; - UInt32 tPos = tt[tt[OrigPtr] >> 8]; - Byte prevByte = (Byte)(tPos & 0xFF); - - do - { - Byte b = (Byte)(tPos & 0xFF); - tPos = tt[tPos >> 8]; - - if (BlockRandomised) - { - if (randToGo == 0) - { - b ^= 1; - randToGo = kRandNums[randIndex++]; - randIndex &= 0x1FF; - } - randToGo--; - } - - if (numReps == kRleModeRepSize) - { - for (; b > 0; b--) - { - crc.UpdateByte(prevByte); - m_OutStream.WriteByte(prevByte); - } - numReps = 0; - continue; - } - if (prevByte == b) - numReps++; - else - { - numReps = 1; - prevByte = b; - } - crc.UpdateByte(b); - m_OutStream.WriteByte(b); - } - while(--blockSize != 0); - return crc.GetDigest(); -} - -#ifdef COMPRESS_BZIP2_MT -CDecoder::CDecoder(): - m_States(0) -{ - m_NumThreadsPrev = 0; - NumThreads = 1; - CS.Enter(); -} - -CDecoder::~CDecoder() -{ - Free(); -} - -bool CDecoder::Create() -{ - try - { - if (m_States != 0 && m_NumThreadsPrev == NumThreads) - return true; - Free(); - MtMode = (NumThreads > 1); - m_NumThreadsPrev = NumThreads; - m_States = new CState[NumThreads]; - if (m_States == 0) - return false; - #ifdef COMPRESS_BZIP2_MT - for (UInt32 t = 0; t < NumThreads; t++) - { - CState &ti = m_States[t]; - ti.Decoder = this; - if (MtMode) - if (!ti.Thread.Create(MFThread, &ti)) - { - NumThreads = t; - Free(); - return false; - } - } - #endif - } - catch(...) { return false; } - return true; -} - -void CDecoder::Free() -{ - if (!m_States) - return; - CloseThreads = true; - CS.Leave(); - for (UInt32 t = 0; t < NumThreads; t++) - { - CState &s = m_States[t]; - if (MtMode) - s.Thread.Wait(); - s.Free(); - } - delete []m_States; - m_States = 0; -} -#endif - -HRESULT CDecoder::ReadSignatures(bool &wasFinished, UInt32 &crc) -{ - wasFinished = false; - Byte s[6]; - for (int i = 0; i < 6; i++) - s[i] = ReadByte(); - crc = ReadCRC(); - if (s[0] == kFinSig0) - { - if (s[1] != kFinSig1 || - s[2] != kFinSig2 || - s[3] != kFinSig3 || - s[4] != kFinSig4 || - s[5] != kFinSig5) - return S_FALSE; - - wasFinished = true; - return (crc == CombinedCRC.GetDigest()) ? S_OK : S_FALSE; - } - if (s[0] != kBlockSig0 || - s[1] != kBlockSig1 || - s[2] != kBlockSig2 || - s[3] != kBlockSig3 || - s[4] != kBlockSig4 || - s[5] != kBlockSig5) - return S_FALSE; - CombinedCRC.Update(crc); - return S_OK; -} - -HRESULT CDecoder::DecodeFile(bool &isBZ, ICompressProgressInfo *progress) -{ - #ifdef COMPRESS_BZIP2_MT - Progress = progress; - if (!Create()) - return E_FAIL; - for (UInt32 t = 0; t < NumThreads; t++) - { - CState &s = m_States[t]; - if (!s.Alloc()) - return E_OUTOFMEMORY; - s.StreamWasFinishedEvent.Reset(); - s.WaitingWasStartedEvent.Reset(); - s.CanWriteEvent.Reset(); - } - #else - if (!m_States[0].Alloc()) - return E_OUTOFMEMORY; - #endif - - isBZ = false; - Byte s[6]; - int i; - for (i = 0; i < 4; i++) - s[i] = ReadByte(); - if (s[0] != kArSig0 || - s[1] != kArSig1 || - s[2] != kArSig2 || - s[3] <= kArSig3 || - s[3] > kArSig3 + kBlockSizeMultMax) - return S_OK; - isBZ = true; - UInt32 dicSize = (UInt32)(s[3] - kArSig3) * kBlockSizeStep; - - CombinedCRC.Init(); - #ifdef COMPRESS_BZIP2_MT - if (MtMode) - { - NextBlockIndex = 0; - StreamWasFinished = false; - CloseThreads = false; - CanStartWaitingEvent.Reset(); - m_States[0].CanWriteEvent.Set(); - BlockSizeMax = dicSize; - Result = S_OK; - CS.Leave(); - UInt32 t; - for (t = 0; t < NumThreads; t++) - m_States[t].StreamWasFinishedEvent.Lock(); - CS.Enter(); - CanStartWaitingEvent.Set(); - for (t = 0; t < NumThreads; t++) - m_States[t].WaitingWasStartedEvent.Lock(); - CanStartWaitingEvent.Reset(); - RINOK(Result); - } - else - #endif - { - CState &state = m_States[0]; - for (;;) - { - if (progress) - { - UInt64 packSize = m_InStream.GetProcessedSize(); - UInt64 unpackSize = m_OutStream.GetProcessedSize(); - RINOK(progress->SetRatioInfo(&packSize, &unpackSize)); - } - bool wasFinished; - UInt32 crc; - RINOK(ReadSignatures(wasFinished, crc)); - if (wasFinished) - return S_OK; - - RINOK(ReadBlock(dicSize, state)); - state.DecodeBlock1(); - if (state.DecodeBlock2(m_OutStream) != crc) - return S_FALSE; - } - } - return S_OK; -} - -HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 * /* inSize */, const UInt64 * /* outSize */, - ICompressProgressInfo *progress) -{ - if (!m_InStream.Create(kBufferSize)) - return E_OUTOFMEMORY; - if (!m_OutStream.Create(kBufferSize)) - return E_OUTOFMEMORY; - - m_InStream.SetStream(inStream); - m_InStream.Init(); - - m_OutStream.SetStream(outStream); - m_OutStream.Init(); - - CDecoderFlusher flusher(this); - - bool isBZ; - RINOK(DecodeFile(isBZ, progress)); - return isBZ ? S_OK: S_FALSE; -} - -STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - try { return CodeReal(inStream, outStream, inSize, outSize, progress); } - catch(...) { return S_FALSE; } -} - -STDMETHODIMP CDecoder::GetInStreamProcessedSize(UInt64 *value) -{ - if (value == NULL) - return E_INVALIDARG; - *value = m_InStream.GetProcessedSize(); - return S_OK; -} - -#ifdef COMPRESS_BZIP2_MT -STDMETHODIMP CDecoder::SetNumberOfThreads(UInt32 numThreads) -{ - NumThreads = numThreads; - if (NumThreads < 1) - NumThreads = 1; - if (NumThreads > kNumThreadsMax) - NumThreads = kNumThreadsMax; - return S_OK; -} -#endif - -}} diff --git a/7zip/Compress/BZip2/BZip2Decoder.h b/7zip/Compress/BZip2/BZip2Decoder.h deleted file mode 100755 index c59819b4..00000000 --- a/7zip/Compress/BZip2/BZip2Decoder.h +++ /dev/null @@ -1,162 +0,0 @@ -// Compress/BZip2/Decoder.h - -#ifndef __COMPRESS_BZIP2_DECODER_H -#define __COMPRESS_BZIP2_DECODER_H - -#include "../../ICoder.h" -#include "../../../Common/MyCom.h" -#include "../../Common/MSBFDecoder.h" -#include "../../Common/InBuffer.h" -#include "../../Common/OutBuffer.h" -#include "../Huffman/HuffmanDecoder.h" -#include "BZip2Const.h" -#include "BZip2CRC.h" - -#ifdef COMPRESS_BZIP2_MT -#include "../../../Windows/Thread.h" -#include "../../../Windows/Synchronization.h" -#endif - -namespace NCompress { -namespace NBZip2 { - -typedef NCompress::NHuffman::CDecoder CHuffmanDecoder; - -class CDecoder; - -struct CState -{ - UInt32 *tt; - bool BlockRandomised; - UInt32 OrigPtr; - UInt32 BlockSize; - UInt32 CharCounters[256]; - Byte m_Selectors[kNumSelectorsMax]; - - #ifdef COMPRESS_BZIP2_MT - - CDecoder *Decoder; - NWindows::CThread Thread; - bool m_OptimizeNumTables; - - NWindows::NSynchronization::CAutoResetEvent StreamWasFinishedEvent; - NWindows::NSynchronization::CAutoResetEvent WaitingWasStartedEvent; - - // it's not member of this thread. We just need one event per thread - NWindows::NSynchronization::CAutoResetEvent CanWriteEvent; - - Byte MtPad[1 << 8]; // It's pad for Multi-Threading. Must be >= Cache_Line_Size. - - void FinishStream(bool needLeave); - DWORD ThreadFunc(); - - #endif - - CState(): tt(0) {} - ~CState() { Free(); } - bool Alloc(); - void Free(); - void DecodeBlock1(); - UInt32 DecodeBlock2(COutBuffer &m_OutStream); -}; - -class CDecoder : - public ICompressCoder, - #ifdef COMPRESS_BZIP2_MT - public ICompressSetCoderMt, - #endif - public ICompressGetInStreamProcessedSize, - public CMyUnknownImp -{ -public: - COutBuffer m_OutStream; - Byte MtPad[1 << 8]; // It's pad for Multi-Threading. Must be >= Cache_Line_Size. - NStream::NMSBF::CDecoder m_InStream; -private: - CHuffmanDecoder m_HuffmanDecoders[kNumTablesMax]; - - UInt32 m_NumThreadsPrev; - - UInt32 ReadBits(int numBits); - Byte ReadByte(); - bool ReadBit(); - UInt32 ReadCRC(); - HRESULT PrepareBlock(CState &state); - HRESULT DecodeFile(bool &isBZ, ICompressProgressInfo *progress); - HRESULT CodeReal(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - class CDecoderFlusher - { - CDecoder *_decoder; - public: - bool NeedFlush; - CDecoderFlusher(CDecoder *decoder): _decoder(decoder), NeedFlush(true) {} - ~CDecoderFlusher() - { - if (NeedFlush) - _decoder->Flush(); - _decoder->ReleaseStreams(); - } - }; - -public: - CBZip2CombinedCRC CombinedCRC; - - #ifdef COMPRESS_BZIP2_MT - ICompressProgressInfo *Progress; - CState *m_States; - - NWindows::NSynchronization::CCriticalSection CS; - UInt32 NumThreads; - bool MtMode; - UInt32 NextBlockIndex; - bool CloseThreads; - bool StreamWasFinished; - NWindows::NSynchronization::CManualResetEvent CanStartWaitingEvent; - - HRESULT Result; - - UInt32 BlockSizeMax; - CDecoder(); - ~CDecoder(); - bool Create(); - void Free(); - - #else - CState m_States[1]; - #endif - - HRESULT ReadBlock(UInt32 blockSizeMax, CState &state); - - HRESULT ReadSignatures(bool &wasFinished, UInt32 &crc); - - - HRESULT Flush() { return m_OutStream.Flush(); } - void ReleaseStreams() - { - m_InStream.ReleaseStream(); - m_OutStream.ReleaseStream(); - } - - #ifdef COMPRESS_BZIP2_MT - MY_UNKNOWN_IMP2(ICompressSetCoderMt, ICompressGetInStreamProcessedSize) - #else - MY_UNKNOWN_IMP1(ICompressGetInStreamProcessedSize) - #endif - - - STDMETHOD(Code)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - STDMETHOD(GetInStreamProcessedSize)(UInt64 *value); - - #ifdef COMPRESS_BZIP2_MT - STDMETHOD(SetNumberOfThreads)(UInt32 numThreads); - #endif -}; - -}} - -#endif diff --git a/7zip/Compress/BZip2/BZip2Encoder.cpp b/7zip/Compress/BZip2/BZip2Encoder.cpp deleted file mode 100755 index 97009041..00000000 --- a/7zip/Compress/BZip2/BZip2Encoder.cpp +++ /dev/null @@ -1,876 +0,0 @@ -// BZip2Encoder.cpp - -#include "StdAfx.h" - -#include "../../../Common/Alloc.h" - -#include "BZip2Encoder.h" - -#include "../BWT/Mtf8.h" -#include "BZip2CRC.h" - -namespace NCompress { -namespace NBZip2 { - -static const UInt32 kBufferSize = (1 << 17); -static const int kNumHuffPasses = 4; - -bool CThreadInfo::Create() -{ - if (!m_BlockSorter.Create(kBlockSizeMax)) - return false; - - if (m_Block == 0) - { - m_Block = (Byte *)::BigAlloc(kBlockSizeMax * 5 + kBlockSizeMax / 10 + (20 << 10)); - if (m_Block == 0) - return false; - m_MtfArray = m_Block + kBlockSizeMax; - m_TempArray = m_MtfArray + kBlockSizeMax * 2 + 2; - } - if (m_NeedHuffmanCreate) - { - for (int i = 0; i < kNumTablesMax; i++) - if (!m_HuffEncoders[i].Create(kMaxAlphaSize, 0, 0, kMaxHuffmanLen)) - return false; - m_NeedHuffmanCreate = false; - } - return true; -} - -void CThreadInfo::Free() -{ - m_BlockSorter.Free(); - ::BigFree(m_Block); - m_Block = 0; -} - -#ifdef COMPRESS_BZIP2_MT -void CThreadInfo::FinishStream(bool needLeave) -{ - Encoder->StreamWasFinished = true; - StreamWasFinishedEvent.Set(); - if (needLeave) - Encoder->CS.Leave(); - Encoder->CanStartWaitingEvent.Lock(); - WaitingWasStartedEvent.Set(); -} - -DWORD CThreadInfo::ThreadFunc() -{ - for (;;) - { - Encoder->CS.Enter(); - if (Encoder->CloseThreads) - { - Encoder->CS.Leave(); - return 0; - } - if (Encoder->StreamWasFinished) - { - FinishStream(true); - continue; - } - HRESULT res = S_OK; - bool needLeave = true; - try - { - UInt32 blockSize = Encoder->ReadRleBlock(m_Block); - m_PackSize = Encoder->m_InStream.GetProcessedSize(); - m_BlockIndex = Encoder->NextBlockIndex; - if (++Encoder->NextBlockIndex == Encoder->NumThreads) - Encoder->NextBlockIndex = 0; - if (blockSize == 0) - { - FinishStream(true); - continue; - } - Encoder->CS.Leave(); - needLeave = false; - res = EncodeBlock3(blockSize); - } - catch(const CInBufferException &e) { res = e.ErrorCode; } - catch(const COutBufferException &e) { res = e.ErrorCode; } - catch(...) { res = E_FAIL; } - if (res != S_OK) - { - Encoder->Result = res; - FinishStream(needLeave); - continue; - } - } -} - -static DWORD WINAPI MFThread(void *threadCoderInfo) -{ - return ((CThreadInfo *)threadCoderInfo)->ThreadFunc(); -} -#endif - -CEncoder::CEncoder(): - NumPasses(1), - m_OptimizeNumTables(false), - m_BlockSizeMult(kBlockSizeMultMax) -{ - #ifdef COMPRESS_BZIP2_MT - ThreadsInfo = 0; - m_NumThreadsPrev = 0; - NumThreads = 1; - CS.Enter(); - #endif -} - -#ifdef COMPRESS_BZIP2_MT -CEncoder::~CEncoder() -{ - Free(); -} - -bool CEncoder::Create() -{ - try - { - if (ThreadsInfo != 0 && m_NumThreadsPrev == NumThreads) - return true; - Free(); - MtMode = (NumThreads > 1); - m_NumThreadsPrev = NumThreads; - ThreadsInfo = new CThreadInfo[NumThreads]; - if (ThreadsInfo == 0) - return false; - for (UInt32 t = 0; t < NumThreads; t++) - { - CThreadInfo &ti = ThreadsInfo[t]; - ti.Encoder = this; - if (MtMode) - if (!ti.Thread.Create(MFThread, &ti)) - { - NumThreads = t; - Free(); - return false; - } - } - } - catch(...) { return false; } - return true; -} - -void CEncoder::Free() -{ - if (!ThreadsInfo) - return; - CloseThreads = true; - CS.Leave(); - for (UInt32 t = 0; t < NumThreads; t++) - { - CThreadInfo &ti = ThreadsInfo[t]; - if (MtMode) - ti.Thread.Wait(); - ti.Free(); - } - delete []ThreadsInfo; - ThreadsInfo = 0; -} -#endif - -UInt32 CEncoder::ReadRleBlock(Byte *buffer) -{ - UInt32 i = 0; - Byte prevByte; - if (m_InStream.ReadByte(prevByte)) - { - UInt32 blockSize = m_BlockSizeMult * kBlockSizeStep - 1; - int numReps = 1; - buffer[i++] = prevByte; - while (i < blockSize) // "- 1" to support RLE - { - Byte b; - if (!m_InStream.ReadByte(b)) - break; - if (b != prevByte) - { - if (numReps >= kRleModeRepSize) - buffer[i++] = (Byte)(numReps - kRleModeRepSize); - buffer[i++] = b; - numReps = 1; - prevByte = b; - continue; - } - numReps++; - if (numReps <= kRleModeRepSize) - buffer[i++] = b; - else if (numReps == kRleModeRepSize + 255) - { - buffer[i++] = (Byte)(numReps - kRleModeRepSize); - numReps = 0; - } - } - // it's to support original BZip2 decoder - if (numReps >= kRleModeRepSize) - buffer[i++] = (Byte)(numReps - kRleModeRepSize); - } - return i; -} - -void CThreadInfo::WriteBits2(UInt32 value, UInt32 numBits) - { m_OutStreamCurrent->WriteBits(value, numBits); } -void CThreadInfo::WriteByte2(Byte b) { WriteBits2(b , 8); } -void CThreadInfo::WriteBit2(bool v) { WriteBits2((v ? 1 : 0), 1); } -void CThreadInfo::WriteCRC2(UInt32 v) -{ - for (int i = 0; i < 4; i++) - WriteByte2(((Byte)(v >> (24 - i * 8)))); -} - -void CEncoder::WriteBits(UInt32 value, UInt32 numBits) - { m_OutStream.WriteBits(value, numBits); } -void CEncoder::WriteByte(Byte b) { WriteBits(b , 8); } -void CEncoder::WriteBit(bool v) { WriteBits((v ? 1 : 0), 1); } -void CEncoder::WriteCRC(UInt32 v) -{ - for (int i = 0; i < 4; i++) - WriteByte(((Byte)(v >> (24 - i * 8)))); -} - - -// blockSize > 0 -void CThreadInfo::EncodeBlock(Byte *block, UInt32 blockSize) -{ - WriteBit2(false); // Randomised = false - - { - UInt32 origPtr = m_BlockSorter.Sort(block, blockSize); - WriteBits2(origPtr, kNumOrigBits); - } - - CMtf8Encoder mtf; - int numInUse = 0; - { - bool inUse[256]; - bool inUse16[16]; - UInt32 i; - for (i = 0; i < 256; i++) - inUse[i] = false; - for (i = 0; i < 16; i++) - inUse16[i] = false; - for (i = 0; i < blockSize; i++) - inUse[block[i]] = true; - for (i = 0; i < 256; i++) - if (inUse[i]) - { - inUse16[i >> 4] = true; - mtf.Buffer[numInUse++] = (Byte)i; - } - for (i = 0; i < 16; i++) - WriteBit2(inUse16[i]); - for (i = 0; i < 256; i++) - if (inUse16[i >> 4]) - WriteBit2(inUse[i]); - } - int alphaSize = numInUse + 2; - - Byte *mtfs = m_MtfArray; - UInt32 mtfArraySize = 0; - UInt32 symbolCounts[kMaxAlphaSize]; - { - for (int i = 0; i < kMaxAlphaSize; i++) - symbolCounts[i] = 0; - } - - { - UInt32 rleSize = 0; - UInt32 i = 0; - do - { - UInt32 index = m_BlockSorter.Indices[i]; - if (index == 0) - index = blockSize - 1; - else - index--; - int pos = mtf.FindAndMove(block[index]); - if (pos == 0) - rleSize++; - else - { - while (rleSize != 0) - { - rleSize--; - mtfs[mtfArraySize++] = (Byte)(rleSize & 1); - symbolCounts[rleSize & 1]++; - rleSize >>= 1; - } - if (pos >= 0xFE) - { - mtfs[mtfArraySize++] = 0xFF; - mtfs[mtfArraySize++] = (Byte)(pos - 0xFE); - } - else - mtfs[mtfArraySize++] = (Byte)(pos + 1); - symbolCounts[pos + 1]++; - } - } - while (++i < blockSize); - - while (rleSize != 0) - { - rleSize--; - mtfs[mtfArraySize++] = (Byte)(rleSize & 1); - symbolCounts[rleSize & 1]++; - rleSize >>= 1; - } - - if (alphaSize < 256) - mtfs[mtfArraySize++] = (Byte)(alphaSize - 1); - else - { - mtfs[mtfArraySize++] = 0xFF; - mtfs[mtfArraySize++] = (Byte)(alphaSize - 256); - } - symbolCounts[alphaSize - 1]++; - } - - UInt32 numSymbols = 0; - { - for (int i = 0; i < kMaxAlphaSize; i++) - numSymbols += symbolCounts[i]; - } - - int bestNumTables = kNumTablesMin; - UInt32 bestPrice = 0xFFFFFFFF; - UInt32 startPos = m_OutStreamCurrent->GetPos(); - Byte startCurByte = m_OutStreamCurrent->GetCurByte(); - for (int nt = kNumTablesMin; nt <= kNumTablesMax + 1; nt++) - { - int numTables; - - if(m_OptimizeNumTables) - { - m_OutStreamCurrent->SetPos(startPos); - m_OutStreamCurrent->SetCurState((startPos & 7), startCurByte); - if (nt <= kNumTablesMax) - numTables = nt; - else - numTables = bestNumTables; - } - else - { - if (numSymbols < 200) numTables = 2; - else if (numSymbols < 600) numTables = 3; - else if (numSymbols < 1200) numTables = 4; - else if (numSymbols < 2400) numTables = 5; - else numTables = 6; - } - - WriteBits2(numTables, kNumTablesBits); - - UInt32 numSelectors = (numSymbols + kGroupSize - 1) / kGroupSize; - WriteBits2(numSelectors, kNumSelectorsBits); - - { - UInt32 remFreq = numSymbols; - int gs = 0; - int t = numTables; - do - { - UInt32 tFreq = remFreq / t; - int ge = gs; - UInt32 aFreq = 0; - while (aFreq < tFreq) // && ge < alphaSize) - aFreq += symbolCounts[ge++]; - - if (ge - 1 > gs && t != numTables && t != 1 && (((numTables - t) & 1) == 1)) - aFreq -= symbolCounts[--ge]; - - NCompression::NHuffman::CEncoder &huffEncoder = m_HuffEncoders[t - 1]; - int i = 0; - do - huffEncoder.m_Items[i].Len = (i >= gs && i < ge) ? 0 : 1; - while (++i < alphaSize); - gs = ge; - remFreq -= aFreq; - } - while(--t != 0); - } - - - for (int pass = 0; pass < kNumHuffPasses; pass++) - { - { - int t = 0; - do - m_HuffEncoders[t].StartNewBlock(); - while(++t < numTables); - } - - { - UInt32 mtfPos = 0; - UInt32 g = 0; - do - { - UInt32 symbols[kGroupSize]; - int i = 0; - do - { - UInt32 symbol = mtfs[mtfPos++]; - if (symbol >= 0xFF) - symbol += mtfs[mtfPos++]; - symbols[i] = symbol; - } - while (++i < kGroupSize && mtfPos < mtfArraySize); - - UInt32 bestPrice = 0xFFFFFFFF; - int t = 0; - do - { - NCompression::NHuffman::CItem *items = m_HuffEncoders[t].m_Items; - UInt32 price = 0; - int j = 0; - do - price += items[symbols[j]].Len; - while (++j < i); - if (price < bestPrice) - { - m_Selectors[g] = (Byte)t; - bestPrice = price; - } - } - while(++t < numTables); - NCompression::NHuffman::CEncoder &huffEncoder = m_HuffEncoders[m_Selectors[g++]]; - int j = 0; - do - huffEncoder.AddSymbol(symbols[j]); - while (++j < i); - } - while (mtfPos < mtfArraySize); - } - - int t = 0; - do - { - NCompression::NHuffman::CEncoder &huffEncoder = m_HuffEncoders[t]; - int i = 0; - do - if (huffEncoder.m_Items[i].Freq == 0) - huffEncoder.m_Items[i].Freq = 1; - while(++i < alphaSize); - Byte levels[kMaxAlphaSize]; - huffEncoder.BuildTree(levels); - } - while(++t < numTables); - } - - { - Byte mtfSel[kNumTablesMax]; - { - int t = 0; - do - mtfSel[t] = (Byte)t; - while(++t < numTables); - } - - UInt32 i = 0; - do - { - Byte sel = m_Selectors[i]; - int pos; - for (pos = 0; mtfSel[pos] != sel; pos++) - WriteBit2(true); - WriteBit2(false); - for (; pos > 0; pos--) - mtfSel[pos] = mtfSel[pos - 1]; - mtfSel[0] = sel; - } - while(++i < numSelectors); - } - - { - int t = 0; - do - { - NCompression::NHuffman::CItem *items = m_HuffEncoders[t].m_Items; - UInt32 len = items[0].Len; - WriteBits2(len, kNumLevelsBits); - int i = 0; - do - { - UInt32 level = items[i].Len; - while (len != level) - { - WriteBit2(true); - if (len < level) - { - WriteBit2(false); - len++; - } - else - { - WriteBit2(true); - len--; - } - } - WriteBit2(false); - } - while (++i < alphaSize); - } - while(++t < numTables); - } - - { - UInt32 groupSize = 0; - UInt32 groupIndex = 0; - NCompression::NHuffman::CEncoder *huffEncoder = 0; - UInt32 mtfPos = 0; - do - { - UInt32 symbol = mtfs[mtfPos++]; - if (symbol >= 0xFF) - symbol += mtfs[mtfPos++]; - if (groupSize == 0) - { - groupSize = kGroupSize; - huffEncoder = &m_HuffEncoders[m_Selectors[groupIndex++]]; - } - groupSize--; \ - huffEncoder->CodeOneValue(m_OutStreamCurrent, symbol); - } - while (mtfPos < mtfArraySize); - } - - if (!m_OptimizeNumTables) - break; - UInt32 price = m_OutStreamCurrent->GetPos() - startPos; - if (price <= bestPrice) - { - if (nt == kNumTablesMax) - break; - bestPrice = price; - bestNumTables = nt; - } - } -} - -// blockSize > 0 -UInt32 CThreadInfo::EncodeBlockWithHeaders(Byte *block, UInt32 blockSize) -{ - WriteByte2(kBlockSig0); - WriteByte2(kBlockSig1); - WriteByte2(kBlockSig2); - WriteByte2(kBlockSig3); - WriteByte2(kBlockSig4); - WriteByte2(kBlockSig5); - - CBZip2CRC crc; - int numReps = 0; - Byte prevByte = block[0]; - UInt32 i = 0; - do - { - Byte b = block[i]; - if (numReps == kRleModeRepSize) - { - for (; b > 0; b--) - crc.UpdateByte(prevByte); - numReps = 0; - continue; - } - if (prevByte == b) - numReps++; - else - { - numReps = 1; - prevByte = b; - } - crc.UpdateByte(b); - } - while (++i < blockSize); - UInt32 crcRes = crc.GetDigest(); - WriteCRC2(crcRes); - EncodeBlock(block, blockSize); - return crcRes; -} - -void CThreadInfo::EncodeBlock2(Byte *block, UInt32 blockSize, UInt32 numPasses) -{ - UInt32 numCrcs = m_NumCrcs; - bool needCompare = false; - - UInt32 startBytePos = m_OutStreamCurrent->GetBytePos(); - UInt32 startPos = m_OutStreamCurrent->GetPos(); - Byte startCurByte = m_OutStreamCurrent->GetCurByte(); - Byte endCurByte = 0; - UInt32 endPos = 0; - if (numPasses > 1 && blockSize >= (1 << 10)) - { - UInt32 blockSize0 = blockSize / 2; - for (;(block[blockSize0] == block[blockSize0 - 1] || - block[blockSize0 - 1] == block[blockSize0 - 2]) && - blockSize0 < blockSize; blockSize0++); - if (blockSize0 < blockSize) - { - EncodeBlock2(block, blockSize0, numPasses - 1); - EncodeBlock2(block + blockSize0, blockSize - blockSize0, numPasses - 1); - endPos = m_OutStreamCurrent->GetPos(); - endCurByte = m_OutStreamCurrent->GetCurByte(); - if ((endPos & 7) > 0) - WriteBits2(0, 8 - (endPos & 7)); - m_OutStreamCurrent->SetCurState((startPos & 7), startCurByte); - needCompare = true; - } - } - - UInt32 startBytePos2 = m_OutStreamCurrent->GetBytePos(); - UInt32 startPos2 = m_OutStreamCurrent->GetPos(); - UInt32 crcVal = EncodeBlockWithHeaders(block, blockSize); - UInt32 endPos2 = m_OutStreamCurrent->GetPos(); - - if (needCompare) - { - UInt32 size2 = endPos2 - startPos2; - if (size2 < endPos - startPos) - { - UInt32 numBytes = m_OutStreamCurrent->GetBytePos() - startBytePos2; - Byte *buffer = m_OutStreamCurrent->GetStream(); - for (UInt32 i = 0; i < numBytes; i++) - buffer[startBytePos + i] = buffer[startBytePos2 + i]; - m_OutStreamCurrent->SetPos(startPos + endPos2 - startPos2); - m_NumCrcs = numCrcs; - m_CRCs[m_NumCrcs++] = crcVal; - } - else - { - m_OutStreamCurrent->SetPos(endPos); - m_OutStreamCurrent->SetCurState((endPos & 7), endCurByte); - } - } - else - { - m_NumCrcs = numCrcs; - m_CRCs[m_NumCrcs++] = crcVal; - } -} - -HRESULT CThreadInfo::EncodeBlock3(UInt32 blockSize) -{ - CMsbfEncoderTemp outStreamTemp; - outStreamTemp.SetStream(m_TempArray); - outStreamTemp.Init(); - m_OutStreamCurrent = &outStreamTemp; - - m_NumCrcs = 0; - - EncodeBlock2(m_Block, blockSize, Encoder->NumPasses); - - #ifdef COMPRESS_BZIP2_MT - if (Encoder->MtMode) - Encoder->ThreadsInfo[m_BlockIndex].CanWriteEvent.Lock(); - #endif - for (UInt32 i = 0; i < m_NumCrcs; i++) - Encoder->CombinedCRC.Update(m_CRCs[i]); - Encoder->WriteBytes(m_TempArray, outStreamTemp.GetPos(), outStreamTemp.GetCurByte()); - HRESULT res = S_OK; - #ifdef COMPRESS_BZIP2_MT - if (Encoder->MtMode) - { - UInt32 blockIndex = m_BlockIndex + 1; - if (blockIndex == Encoder->NumThreads) - blockIndex = 0; - - if (Encoder->Progress) - { - UInt64 unpackSize = Encoder->m_OutStream.GetProcessedSize(); - res = Encoder->Progress->SetRatioInfo(&m_PackSize, &unpackSize); - } - - Encoder->ThreadsInfo[blockIndex].CanWriteEvent.Set(); - } - #endif - return res; -} - -void CEncoder::WriteBytes(const Byte *data, UInt32 sizeInBits, Byte lastByte) -{ - UInt32 bytesSize = (sizeInBits / 8); - for (UInt32 i = 0; i < bytesSize; i++) - m_OutStream.WriteBits(data[i], 8); - WriteBits(lastByte, (sizeInBits & 7)); -} - - -HRESULT CEncoder::CodeReal(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 * /* inSize */, const UInt64 * /* outSize */, - ICompressProgressInfo *progress) -{ - #ifdef COMPRESS_BZIP2_MT - Progress = progress; - if (!Create()) - return E_FAIL; - for (UInt32 t = 0; t < NumThreads; t++) - #endif - { - #ifdef COMPRESS_BZIP2_MT - CThreadInfo &ti = ThreadsInfo[t]; - ti.StreamWasFinishedEvent.Reset(); - ti.WaitingWasStartedEvent.Reset(); - ti.CanWriteEvent.Reset(); - #else - CThreadInfo &ti = ThreadsInfo; - ti.Encoder = this; - #endif - - ti.m_OptimizeNumTables = m_OptimizeNumTables; - - if (!ti.Create()) - return E_OUTOFMEMORY; - } - - - if (!m_InStream.Create(kBufferSize)) - return E_OUTOFMEMORY; - if (!m_OutStream.Create(kBufferSize)) - return E_OUTOFMEMORY; - - - m_InStream.SetStream(inStream); - m_InStream.Init(); - - m_OutStream.SetStream(outStream); - m_OutStream.Init(); - - CFlusher flusher(this); - - CombinedCRC.Init(); - #ifdef COMPRESS_BZIP2_MT - NextBlockIndex = 0; - StreamWasFinished = false; - CloseThreads = false; - CanStartWaitingEvent.Reset(); - #endif - - WriteByte(kArSig0); - WriteByte(kArSig1); - WriteByte(kArSig2); - WriteByte((Byte)(kArSig3 + m_BlockSizeMult)); - - #ifdef COMPRESS_BZIP2_MT - - if (MtMode) - { - ThreadsInfo[0].CanWriteEvent.Set(); - Result = S_OK; - CS.Leave(); - UInt32 t; - for (t = 0; t < NumThreads; t++) - ThreadsInfo[t].StreamWasFinishedEvent.Lock(); - CS.Enter(); - CanStartWaitingEvent.Set(); - for (t = 0; t < NumThreads; t++) - ThreadsInfo[t].WaitingWasStartedEvent.Lock(); - CanStartWaitingEvent.Reset(); - RINOK(Result); - } - else - #endif - { - for (;;) - { - CThreadInfo &ti = - #ifdef COMPRESS_BZIP2_MT - ThreadsInfo[0]; - #else - ThreadsInfo; - #endif - UInt32 blockSize = ReadRleBlock(ti.m_Block); - if (blockSize == 0) - break; - RINOK(ti.EncodeBlock3(blockSize)); - if (progress) - { - UInt64 packSize = m_InStream.GetProcessedSize(); - UInt64 unpackSize = m_OutStream.GetProcessedSize(); - RINOK(progress->SetRatioInfo(&packSize, &unpackSize)); - } - } - } - WriteByte(kFinSig0); - WriteByte(kFinSig1); - WriteByte(kFinSig2); - WriteByte(kFinSig3); - WriteByte(kFinSig4); - WriteByte(kFinSig5); - - WriteCRC(CombinedCRC.GetDigest()); - return S_OK; -} - -STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - try { return CodeReal(inStream, outStream, inSize, outSize, progress); } - catch(const CInBufferException &e) { return e.ErrorCode; } - catch(const COutBufferException &e) { return e.ErrorCode; } - catch(...) { return S_FALSE; } -} - -HRESULT CEncoder::SetCoderProperties(const PROPID *propIDs, - const PROPVARIANT *properties, UInt32 numProperties) -{ - for(UInt32 i = 0; i < numProperties; i++) - { - const PROPVARIANT &property = properties[i]; - switch(propIDs[i]) - { - case NCoderPropID::kNumPasses: - { - if (property.vt != VT_UI4) - return E_INVALIDARG; - UInt32 numPasses = property.ulVal; - if (numPasses == 0) - numPasses = 1; - if (numPasses > kNumPassesMax) - numPasses = kNumPassesMax; - NumPasses = numPasses; - m_OptimizeNumTables = (NumPasses > 1); - break; - } - case NCoderPropID::kDictionarySize: - { - if (property.vt != VT_UI4) - return E_INVALIDARG; - UInt32 dictionary = property.ulVal / kBlockSizeStep; - if (dictionary < kBlockSizeMultMin) - dictionary = kBlockSizeMultMin; - else if (dictionary > kBlockSizeMultMax) - dictionary = kBlockSizeMultMax; - m_BlockSizeMult = dictionary; - break; - } - case NCoderPropID::kNumThreads: - { - #ifdef COMPRESS_BZIP2_MT - if (property.vt != VT_UI4) - return E_INVALIDARG; - NumThreads = property.ulVal; - if (NumThreads < 1) - NumThreads = 1; - #endif - break; - } - default: - return E_INVALIDARG; - } - } - return S_OK; -} - -#ifdef COMPRESS_BZIP2_MT -STDMETHODIMP CEncoder::SetNumberOfThreads(UInt32 numThreads) -{ - NumThreads = numThreads; - if (NumThreads < 1) - NumThreads = 1; - return S_OK; -} -#endif - -}} diff --git a/7zip/Compress/BZip2/BZip2Encoder.h b/7zip/Compress/BZip2/BZip2Encoder.h deleted file mode 100755 index b1a73c59..00000000 --- a/7zip/Compress/BZip2/BZip2Encoder.h +++ /dev/null @@ -1,247 +0,0 @@ -// Compress/BZip2/Encoder.h - -#ifndef __COMPRESS_BZIP2_ENCODER_H -#define __COMPRESS_BZIP2_ENCODER_H - -#include "../../ICoder.h" -#include "../../../Common/MyCom.h" -#include "../../Common/MSBFEncoder.h" -#include "../../Common/InBuffer.h" -#include "../../Common/OutBuffer.h" -#include "../Huffman/HuffmanEncoder.h" -#include "../BWT/BlockSort.h" -#include "BZip2Const.h" -#include "BZip2CRC.h" - -#ifdef COMPRESS_BZIP2_MT -#include "../../../Windows/Thread.h" -#include "../../../Windows/Synchronization.h" -#endif - -namespace NCompress { -namespace NBZip2 { - -class CMsbfEncoderTemp -{ - UInt32 m_Pos; - int m_BitPos; - Byte m_CurByte; - Byte *Buffer; -public: - void SetStream(Byte *buffer) { Buffer = buffer; } - Byte *GetStream() const { return Buffer; } - - void Init() - { - m_Pos = 0; - m_BitPos = 8; - m_CurByte = 0; - } - - void Flush() - { - if(m_BitPos < 8) - WriteBits(0, m_BitPos); - } - - void WriteBits(UInt32 value, int numBits) - { - while(numBits > 0) - { - int numNewBits = MyMin(numBits, m_BitPos); - numBits -= numNewBits; - - m_CurByte <<= numNewBits; - UInt32 newBits = value >> numBits; - m_CurByte |= Byte(newBits); - value -= (newBits << numBits); - - m_BitPos -= numNewBits; - - if (m_BitPos == 0) - { - Buffer[m_Pos++] = m_CurByte; - m_BitPos = 8; - } - } - } - - UInt32 GetBytePos() const { return m_Pos ; } - UInt32 GetPos() const { return m_Pos * 8 + (8 - m_BitPos); } - Byte GetCurByte() const { return m_CurByte; } - void SetPos(UInt32 bitPos) - { - m_Pos = bitPos / 8; - m_BitPos = 8 - (bitPos & 7); - } - void SetCurState(UInt32 bitPos, Byte curByte) - { - m_BitPos = 8 - bitPos; - m_CurByte = curByte; - } -}; - -class CEncoder; - -const int kNumPassesMax = 10; - -class CThreadInfo -{ -public: - Byte *m_Block; -private: - Byte *m_MtfArray; - Byte *m_TempArray; - CBlockSorter m_BlockSorter; - - CMsbfEncoderTemp *m_OutStreamCurrent; - - NCompression::NHuffman::CEncoder m_HuffEncoders[kNumTablesMax]; - Byte m_Selectors[kNumSelectorsMax]; - - bool m_NeedHuffmanCreate; - - UInt32 m_CRCs[1 << kNumPassesMax]; - UInt32 m_NumCrcs; - - int m_BlockIndex; - - void FinishStream(bool needLeave); - - void WriteBits2(UInt32 value, UInt32 numBits); - void WriteByte2(Byte b); - void WriteBit2(bool v); - void WriteCRC2(UInt32 v); - - void EncodeBlock(Byte *block, UInt32 blockSize); - UInt32 EncodeBlockWithHeaders(Byte *block, UInt32 blockSize); - void EncodeBlock2(Byte *block, UInt32 blockSize, UInt32 numPasses); -public: - bool m_OptimizeNumTables; - CEncoder *Encoder; - #ifdef COMPRESS_BZIP2_MT - NWindows::CThread Thread; - - NWindows::NSynchronization::CAutoResetEvent StreamWasFinishedEvent; - NWindows::NSynchronization::CAutoResetEvent WaitingWasStartedEvent; - - // it's not member of this thread. We just need one event per thread - NWindows::NSynchronization::CAutoResetEvent CanWriteEvent; - - UInt64 m_PackSize; - - Byte MtPad[1 << 8]; // It's pad for Multi-Threading. Must be >= Cache_Line_Size. - #endif - - CThreadInfo(): m_Block(0), m_NeedHuffmanCreate(true) {} - ~CThreadInfo() { Free(); } - bool Create(); - void Free(); - - HRESULT EncodeBlock3(UInt32 blockSize); - DWORD ThreadFunc(); -}; - -class CEncoder : - public ICompressCoder, - public ICompressSetCoderProperties, - #ifdef COMPRESS_BZIP2_MT - public ICompressSetCoderMt, - #endif - public CMyUnknownImp -{ - UInt32 m_BlockSizeMult; - bool m_OptimizeNumTables; - - UInt32 m_NumPassesPrev; - - UInt32 m_NumThreadsPrev; -public: - CInBuffer m_InStream; - Byte MtPad[1 << 8]; // It's pad for Multi-Threading. Must be >= Cache_Line_Size. - NStream::NMSBF::CEncoder m_OutStream; - UInt32 NumPasses; - CBZip2CombinedCRC CombinedCRC; - - #ifdef COMPRESS_BZIP2_MT - CThreadInfo *ThreadsInfo; - NWindows::NSynchronization::CCriticalSection CS; - UInt32 NumThreads; - bool MtMode; - UInt32 NextBlockIndex; - - bool CloseThreads; - bool StreamWasFinished; - NWindows::NSynchronization::CManualResetEvent CanStartWaitingEvent; - - HRESULT Result; - ICompressProgressInfo *Progress; - #else - CThreadInfo ThreadsInfo; - #endif - - UInt32 ReadRleBlock(Byte *buffer); - void WriteBytes(const Byte *data, UInt32 sizeInBits, Byte lastByte); - - void WriteBits(UInt32 value, UInt32 numBits); - void WriteByte(Byte b); - void WriteBit(bool v); - void WriteCRC(UInt32 v); - - #ifdef COMPRESS_BZIP2_MT - bool Create(); - void Free(); - #endif - -public: - CEncoder(); - #ifdef COMPRESS_BZIP2_MT - ~CEncoder(); - #endif - - HRESULT Flush() { return m_OutStream.Flush(); } - - void ReleaseStreams() - { - m_InStream.ReleaseStream(); - m_OutStream.ReleaseStream(); - } - - class CFlusher - { - CEncoder *_coder; - public: - bool NeedFlush; - CFlusher(CEncoder *coder): _coder(coder), NeedFlush(true) {} - ~CFlusher() - { - if (NeedFlush) - _coder->Flush(); - _coder->ReleaseStreams(); - } - }; - - #ifdef COMPRESS_BZIP2_MT - MY_UNKNOWN_IMP2(ICompressSetCoderMt, ICompressSetCoderProperties) - #else - MY_UNKNOWN_IMP1(ICompressGetInStreamProcessedSize) - #endif - - HRESULT CodeReal(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - STDMETHOD(Code)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - STDMETHOD(SetCoderProperties)(const PROPID *propIDs, - const PROPVARIANT *properties, UInt32 numProperties); - - #ifdef COMPRESS_BZIP2_MT - STDMETHOD(SetNumberOfThreads)(UInt32 numThreads); - #endif -}; - -}} - -#endif diff --git a/7zip/Compress/BZip2/DllExports.cpp b/7zip/Compress/BZip2/DllExports.cpp deleted file mode 100755 index c528e98c..00000000 --- a/7zip/Compress/BZip2/DllExports.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#ifdef _WIN32 -#include "Common/Alloc.h" -#endif - -#include "BZip2Encoder.h" -#include "BZip2Decoder.h" - -// {23170F69-40C1-278B-0402-020000000000} -DEFINE_GUID(CLSID_CCompressBZip2Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0402-020000000100} -DEFINE_GUID(CLSID_CCompressBZip2Encoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD dwReason, LPVOID /*lpReserved*/) -{ - #ifdef _WIN32 - if (dwReason == DLL_PROCESS_ATTACH) - SetLargePageSize(); - #endif - return TRUE; -} - -STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - int correctInterface = (*iid == IID_ICompressCoder); - CMyComPtr coder; - if (*clsid == CLSID_CCompressBZip2Decoder) - { - if (!correctInterface) - return E_NOINTERFACE; - coder = (ICompressCoder *)new NCompress::NBZip2::CDecoder; - } - else if (*clsid == CLSID_CCompressBZip2Encoder) - { - if (!correctInterface) - return E_NOINTERFACE; - coder = (ICompressCoder *)new NCompress::NBZip2::CEncoder; - } - else - return CLASS_E_CLASSNOTAVAILABLE; - *outObject = coder.Detach(); - COM_TRY_END - return S_OK; -} - -STDAPI GetNumberOfMethods(UINT32 *numMethods) -{ - *numMethods = 1; - return S_OK; -} - -STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value) -{ - if (index != 0) - return E_INVALIDARG; - ::VariantClear((tagVARIANT *)value); - switch(propID) - { - case NMethodPropID::kID: - { - const char id[] = { 0x04, 0x02, 0x02 }; - if ((value->bstrVal = ::SysAllocStringByteLen(id, sizeof(id))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NMethodPropID::kName: - if ((value->bstrVal = ::SysAllocString(L"BZip2")) != 0) - value->vt = VT_BSTR; - return S_OK; - case NMethodPropID::kDecoder: - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CCompressBZip2Decoder, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - case NMethodPropID::kEncoder: - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CCompressBZip2Encoder, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - return S_OK; -} diff --git a/7zip/Compress/BZip2/StdAfx.cpp b/7zip/Compress/BZip2/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Compress/BZip2/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Compress/BZip2/StdAfx.h b/7zip/Compress/BZip2/StdAfx.h deleted file mode 100755 index e7fb6986..00000000 --- a/7zip/Compress/BZip2/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Compress/BZip2/makefile b/7zip/Compress/BZip2/makefile deleted file mode 100755 index f355e7d9..00000000 --- a/7zip/Compress/BZip2/makefile +++ /dev/null @@ -1,50 +0,0 @@ -PROG = BZip2.dll -DEF_FILE = ../Codec.def -CFLAGS = $(CFLAGS) -I ../../../ -DCOMPRESS_BZIP2_MT -LIBS = $(LIBS) oleaut32.lib - -BZIP2_OBJS = \ - $O\DllExports.obj \ - $O\BZip2CRC.obj \ - -BZIP2_OPT_OBJS = \ - $O\BZip2Decoder.obj \ - $O\BZip2Encoder.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - -WIN_OBJS = \ - $O\Synchronization.obj - -7ZIP_COMMON_OBJS = \ - $O\InBuffer.obj \ - $O\OutBuffer.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(BZIP2_OBJS) \ - $(BZIP2_OPT_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $O\BlockSort.obj \ - $O\HuffmanEncoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(BZIP2_OBJS): $(*B).cpp - $(COMPL) -$(BZIP2_OPT_OBJS): $(*B).cpp - $(COMPL_O2) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$O\BlockSort.obj: ../BWT/$(*B).cpp - $(COMPL_O2) -$O\HuffmanEncoder.obj: ../Huffman/$(*B).cpp - $(COMPL_O2) diff --git a/7zip/Compress/BZip2/resource.rc b/7zip/Compress/BZip2/resource.rc deleted file mode 100755 index c5bea782..00000000 --- a/7zip/Compress/BZip2/resource.rc +++ /dev/null @@ -1,3 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("BZip2 Codec", "BZip2") diff --git a/7zip/Compress/BZip2Original/BZip2Decoder.cpp b/7zip/Compress/BZip2Original/BZip2Decoder.cpp deleted file mode 100755 index 5fb77d01..00000000 --- a/7zip/Compress/BZip2Original/BZip2Decoder.cpp +++ /dev/null @@ -1,131 +0,0 @@ -// BZip2Decoder.cpp - -#include "StdAfx.h" - -#include "BZip2Decoder.h" - -#include "../../../Common/Alloc.h" -#include "Original/bzlib.h" - -namespace NCompress { -namespace NBZip2 { - -static const UInt32 kBufferSize = (1 << 20); - -CDecoder::~CDecoder() -{ - BigFree(m_InBuffer); -} - -struct CBZip2Decompressor: public bz_stream -{ - int Init(int verbosity, int small) { return BZ2_bzDecompressInit(this, verbosity, small); } - int Decompress() { return BZ2_bzDecompress(this); } - int End() { return BZ2_bzDecompressEnd(this); } - UInt64 GetTotalIn() const { return (UInt64(total_in_hi32) << 32) + total_in_lo32; } - UInt64 GetTotalOut() const { return (UInt64(total_out_hi32) << 32) + total_out_lo32; } -}; - -class CBZip2DecompressorReleaser -{ - CBZip2Decompressor *m_Decompressor; -public: - CBZip2DecompressorReleaser(CBZip2Decompressor *decompressor): m_Decompressor(decompressor) {} - void Diable() { m_Decompressor = NULL; } - ~CBZip2DecompressorReleaser() { if (m_Decompressor != NULL) m_Decompressor->End(); } -}; - -STDMETHODIMP CDecoder::CodeReal(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - m_InSize = 0; - if (m_InBuffer == 0) - { - m_InBuffer = (Byte *)BigAlloc(kBufferSize * 2); - if (m_InBuffer == 0) - return E_OUTOFMEMORY; - } - Byte *outBuffer = m_InBuffer + kBufferSize; - - CBZip2Decompressor bzStream; - bzStream.bzalloc = NULL; - bzStream.bzfree = NULL; - bzStream.opaque = NULL; - - int result = bzStream.Init(0, 0); - switch(result) - { - case BZ_OK: - break; - case BZ_MEM_ERROR: - return E_OUTOFMEMORY; - default: - return E_FAIL; - } - CBZip2DecompressorReleaser releaser(&bzStream); - bzStream.avail_in = 0; - for (;;) - { - if (bzStream.avail_in == 0) - { - bzStream.next_in = (char *)m_InBuffer; - UInt32 processedSize; - RINOK(inStream->Read(m_InBuffer, kBufferSize, &processedSize)); - bzStream.avail_in = processedSize; - } - - bzStream.next_out = (char *)outBuffer; - bzStream.avail_out = kBufferSize; - result = bzStream.Decompress(); - UInt32 numBytesToWrite = kBufferSize - bzStream.avail_out; - if (numBytesToWrite > 0) - { - UInt32 processedSize; - RINOK(outStream->Write(outBuffer, numBytesToWrite, &processedSize)); - if (numBytesToWrite != processedSize) - return E_FAIL; - } - - if (result == BZ_STREAM_END) - break; - switch(result) - { - case BZ_DATA_ERROR: - case BZ_DATA_ERROR_MAGIC: - return S_FALSE; - case BZ_OK: - break; - case BZ_MEM_ERROR: - return E_OUTOFMEMORY; - default: - return E_FAIL; - } - if (progress != NULL) - { - UInt64 totalIn = bzStream.GetTotalIn(); - UInt64 totalOut = bzStream.GetTotalOut(); - RINOK(progress->SetRatioInfo(&totalIn, &totalOut)); - } - } - m_InSize = bzStream.GetTotalIn(); - return S_OK; -} - -STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - try { return CodeReal(inStream, outStream, inSize, outSize, progress); } - catch(...) { return S_FALSE; } -} - -STDMETHODIMP CDecoder::GetInStreamProcessedSize(UInt64 *value) -{ - if (value == NULL) - return E_INVALIDARG; - *value = m_InSize; - return S_OK; -} - -}} diff --git a/7zip/Compress/BZip2Original/BZip2Decoder.h b/7zip/Compress/BZip2Original/BZip2Decoder.h deleted file mode 100755 index e41f730f..00000000 --- a/7zip/Compress/BZip2Original/BZip2Decoder.h +++ /dev/null @@ -1,38 +0,0 @@ -// Compress/BZip2/Decoder.h - -#ifndef __COMPRESS_BZIP2_DECODER_H -#define __COMPRESS_BZIP2_DECODER_H - -#include "../../ICoder.h" -#include "../../../Common/MyCom.h" - -namespace NCompress { -namespace NBZip2 { - -class CDecoder : - public ICompressCoder, - public ICompressGetInStreamProcessedSize, - public CMyUnknownImp -{ - Byte *m_InBuffer; - UInt64 m_InSize; -public: - CDecoder(): m_InBuffer(0), m_InSize(0) {}; - ~CDecoder(); - - MY_UNKNOWN_IMP1(ICompressGetInStreamProcessedSize) - - STDMETHOD(CodeReal)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - STDMETHOD(Code)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - STDMETHOD(GetInStreamProcessedSize)(UInt64 *value); -}; - -}} - -#endif diff --git a/7zip/Compress/BZip2Original/BZip2Encoder.cpp b/7zip/Compress/BZip2Original/BZip2Encoder.cpp deleted file mode 100755 index bcd7dec0..00000000 --- a/7zip/Compress/BZip2Original/BZip2Encoder.cpp +++ /dev/null @@ -1,120 +0,0 @@ -// BZip2Encoder.cpp - -#include "StdAfx.h" - -#include "BZip2Encoder.h" - -#include "../../../Common/Alloc.h" -#include "Original/bzlib.h" - -namespace NCompress { -namespace NBZip2 { - -static const UInt32 kBufferSize = (1 << 20); - -CEncoder::~CEncoder() -{ - BigFree(m_InBuffer); -} - -struct CBZip2Compressor: public bz_stream -{ - int Init(int blockSize100k, int verbosity, int small) - { return BZ2_bzCompressInit(this, blockSize100k, verbosity, small); } - int Compress(int action ) { return BZ2_bzCompress(this, action ); } - int End() { return BZ2_bzCompressEnd(this); } - UInt64 GetTotalIn() const { return (UInt64(total_in_hi32) << 32) + total_in_lo32; } - UInt64 GetTotalOut() const { return (UInt64(total_out_hi32) << 32) + total_out_lo32; } -}; - -class CBZip2CompressorReleaser -{ - CBZip2Compressor *m_Compressor; -public: - CBZip2CompressorReleaser(CBZip2Compressor *compressor): m_Compressor(compressor) {} - void Disable() { m_Compressor = NULL; } - ~CBZip2CompressorReleaser() { if (m_Compressor != NULL) m_Compressor->End(); } -}; - - -STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - if (m_InBuffer == 0) - { - m_InBuffer = (Byte *)BigAlloc(kBufferSize * 2); - if (m_InBuffer == 0) - return E_OUTOFMEMORY; - } - Byte *outBuffer = m_InBuffer + kBufferSize; - - CBZip2Compressor bzStream; - bzStream.bzalloc = NULL; - bzStream.bzfree = NULL; - bzStream.opaque = NULL; - - int result = bzStream.Init(9, 0, 0); - switch(result) - { - case BZ_OK: - break; - case BZ_MEM_ERROR: - return E_OUTOFMEMORY; - default: - return E_FAIL; - } - CBZip2CompressorReleaser releaser(&bzStream); - bzStream.avail_in = 0; - for (;;) - { - if (bzStream.avail_in == 0) - { - bzStream.next_in = (char *)m_InBuffer; - UInt32 processedSize; - RINOK(inStream->Read(m_InBuffer, kBufferSize, &processedSize)); - bzStream.avail_in = processedSize; - } - - bzStream.next_out = (char *)outBuffer; - bzStream.avail_out = kBufferSize; - bool askFinish = (bzStream.avail_in == 0); - result = bzStream.Compress(askFinish ? BZ_FINISH : BZ_RUN); - UInt32 numBytesToWrite = kBufferSize - bzStream.avail_out; - if (numBytesToWrite > 0) - { - UInt32 processedSize; - RINOK(outStream->Write(outBuffer, numBytesToWrite, &processedSize)); - if (numBytesToWrite != processedSize) - return E_FAIL; - } - - if (result == BZ_STREAM_END) - break; - switch(result) - { - case BZ_RUN_OK: - if (!askFinish) - break; - return E_FAIL; - case BZ_FINISH_OK: - if (askFinish) - break; - return E_FAIL; - case BZ_MEM_ERROR: - return E_OUTOFMEMORY; - default: - return E_FAIL; - } - if (progress != NULL) - { - UInt64 totalIn = bzStream.GetTotalIn(); - UInt64 totalOut = bzStream.GetTotalOut(); - RINOK(progress->SetRatioInfo(&totalIn, &totalOut)); - } - } - // result = bzStream.End(); - return S_OK; -} - -}} diff --git a/7zip/Compress/BZip2Original/BZip2Encoder.h b/7zip/Compress/BZip2Original/BZip2Encoder.h deleted file mode 100755 index c451a08d..00000000 --- a/7zip/Compress/BZip2Original/BZip2Encoder.h +++ /dev/null @@ -1,30 +0,0 @@ -// Compress/BZip2/Encoder.h - -#ifndef __COMPRESS_BZIP2_ENCODER_H -#define __COMPRESS_BZIP2_ENCODER_H - -#include "../../ICoder.h" -#include "../../../Common/MyCom.h" - -namespace NCompress { -namespace NBZip2 { - -class CEncoder : - public ICompressCoder, - public CMyUnknownImp -{ - Byte *m_InBuffer; -public: - CEncoder(): m_InBuffer(0) {}; - ~CEncoder(); - - MY_UNKNOWN_IMP - - STDMETHOD(Code)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); -}; - -}} - -#endif diff --git a/7zip/Compress/BZip2Original/BZip2Error.cpp b/7zip/Compress/BZip2Original/BZip2Error.cpp deleted file mode 100755 index c8a912dc..00000000 --- a/7zip/Compress/BZip2Original/BZip2Error.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "StdAfx.h" - -#include "Original/bzlib.h" - -extern "C" - -void bz_internal_error (int errcode) -{ - throw "error"; -} \ No newline at end of file diff --git a/7zip/Compress/BZip2Original/DllExports.cpp b/7zip/Compress/BZip2Original/DllExports.cpp deleted file mode 100755 index 1f28a07c..00000000 --- a/7zip/Compress/BZip2Original/DllExports.cpp +++ /dev/null @@ -1,86 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" - -#include "BZip2Encoder.h" -#include "BZip2Decoder.h" - -// {23170F69-40C1-278B-0402-020000000000} -DEFINE_GUID(CLSID_CCompressBZip2Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0402-020000000100} -DEFINE_GUID(CLSID_CCompressBZip2Encoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - return TRUE; -} - -STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - int correctInterface = (*iid == IID_ICompressCoder); - CMyComPtr coder; - if (*clsid == CLSID_CCompressBZip2Decoder) - { - if (!correctInterface) - return E_NOINTERFACE; - coder = (ICompressCoder *)new NCompress::NBZip2::CDecoder; - } - else if (*clsid == CLSID_CCompressBZip2Encoder) - { - if (!correctInterface) - return E_NOINTERFACE; - coder = (ICompressCoder *)new NCompress::NBZip2::CEncoder; - } - else - return CLASS_E_CLASSNOTAVAILABLE; - *outObject = coder.Detach(); - COM_TRY_END - return S_OK; -} - -STDAPI GetNumberOfMethods(UINT32 *numMethods) -{ - *numMethods = 1; - return S_OK; -} - -STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value) -{ - if (index != 0) - return E_INVALIDARG; - ::VariantClear((tagVARIANT *)value); - switch(propID) - { - case NMethodPropID::kID: - { - const char id[] = { 0x04, 0x02, 0x02 }; - if ((value->bstrVal = ::SysAllocStringByteLen(id, sizeof(id))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NMethodPropID::kName: - if ((value->bstrVal = ::SysAllocString(L"BZip2")) != 0) - value->vt = VT_BSTR; - return S_OK; - case NMethodPropID::kDecoder: - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CCompressBZip2Decoder, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - case NMethodPropID::kEncoder: - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CCompressBZip2Encoder, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - return S_OK; -} diff --git a/7zip/Compress/BZip2Original/StdAfx.cpp b/7zip/Compress/BZip2Original/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Compress/BZip2Original/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Compress/BZip2Original/StdAfx.h b/7zip/Compress/BZip2Original/StdAfx.h deleted file mode 100755 index e7fb6986..00000000 --- a/7zip/Compress/BZip2Original/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Compress/Branch/ARM.cpp b/7zip/Compress/Branch/ARM.cpp deleted file mode 100755 index 4bd5e183..00000000 --- a/7zip/Compress/Branch/ARM.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// ARM.cpp - -#include "StdAfx.h" -#include "ARM.h" - -#include "BranchARM.c" - -UInt32 CBC_ARM_Encoder::SubFilter(Byte *data, UInt32 size) -{ - return ::ARM_Convert(data, size, _bufferPos, 1); -} - -UInt32 CBC_ARM_Decoder::SubFilter(Byte *data, UInt32 size) -{ - return ::ARM_Convert(data, size, _bufferPos, 0); -} diff --git a/7zip/Compress/Branch/ARM.h b/7zip/Compress/Branch/ARM.h deleted file mode 100755 index 5561299b..00000000 --- a/7zip/Compress/Branch/ARM.h +++ /dev/null @@ -1,10 +0,0 @@ -// ARM.h - -#ifndef __ARM_H -#define __ARM_H - -#include "BranchCoder.h" - -MyClassA(BC_ARM, 0x05, 1) - -#endif diff --git a/7zip/Compress/Branch/ARMThumb.cpp b/7zip/Compress/Branch/ARMThumb.cpp deleted file mode 100755 index fbd25701..00000000 --- a/7zip/Compress/Branch/ARMThumb.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// ARMThumb.cpp - -#include "StdAfx.h" -#include "ARMThumb.h" - -#include "BranchARMThumb.c" - -UInt32 CBC_ARMThumb_Encoder::SubFilter(Byte *data, UInt32 size) -{ - return ::ARMThumb_Convert(data, size, _bufferPos, 1); -} - -UInt32 CBC_ARMThumb_Decoder::SubFilter(Byte *data, UInt32 size) -{ - return ::ARMThumb_Convert(data, size, _bufferPos, 0); -} diff --git a/7zip/Compress/Branch/ARMThumb.h b/7zip/Compress/Branch/ARMThumb.h deleted file mode 100755 index 601e40bf..00000000 --- a/7zip/Compress/Branch/ARMThumb.h +++ /dev/null @@ -1,10 +0,0 @@ -// ARMThumb.h - -#ifndef __ARMTHUMB_H -#define __ARMTHUMB_H - -#include "BranchCoder.h" - -MyClassA(BC_ARMThumb, 0x07, 1) - -#endif diff --git a/7zip/Compress/Branch/Branch.dsp b/7zip/Compress/Branch/Branch.dsp deleted file mode 100755 index 220cb8ab..00000000 --- a/7zip/Compress/Branch/Branch.dsp +++ /dev/null @@ -1,298 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Branch" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Branch - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Branch.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Branch.mak" CFG="Branch - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Branch - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Branch - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Branch - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BRANCH_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O2 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BRANCH_EXPORTS" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Codecs\Branch.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Branch - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BRANCH_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BRANCH_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Codecs\Branch.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Branch - Win32 Release" -# Name "Branch - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Codec.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Methods" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\ARM.cpp - -!IF "$(CFG)" == "Branch - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Branch - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\ARM.h -# End Source File -# Begin Source File - -SOURCE=.\ARMThumb.cpp - -!IF "$(CFG)" == "Branch - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Branch - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\ARMThumb.h -# End Source File -# Begin Source File - -SOURCE=.\BranchCoder.cpp -# End Source File -# Begin Source File - -SOURCE=.\BranchCoder.h -# End Source File -# Begin Source File - -SOURCE=.\BranchTypes.h -# End Source File -# Begin Source File - -SOURCE=.\BranchX86.h -# End Source File -# Begin Source File - -SOURCE=.\IA64.cpp - -!IF "$(CFG)" == "Branch - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Branch - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\IA64.h -# End Source File -# Begin Source File - -SOURCE=.\PPC.cpp - -!IF "$(CFG)" == "Branch - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Branch - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\PPC.h -# End Source File -# Begin Source File - -SOURCE=.\SPARC.cpp -# End Source File -# Begin Source File - -SOURCE=.\SPARC.h -# End Source File -# Begin Source File - -SOURCE=.\x86.cpp - -!IF "$(CFG)" == "Branch - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Branch - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\x86.h -# End Source File -# Begin Source File - -SOURCE=.\x86_2.cpp - -!IF "$(CFG)" == "Branch - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Branch - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\x86_2.h -# End Source File -# End Group -# Begin Group "Stream" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# End Group -# Begin Group "RangeCoder" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\RangeCoder\RangeCoder.h -# End Source File -# Begin Source File - -SOURCE=..\RangeCoder\RangeCoderBit.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# End Group -# End Target -# End Project diff --git a/7zip/Compress/Branch/Branch.dsw b/7zip/Compress/Branch/Branch.dsw deleted file mode 100755 index 841c85a3..00000000 --- a/7zip/Compress/Branch/Branch.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Branch"=.\Branch.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Compress/Branch/BranchARM.c b/7zip/Compress/Branch/BranchARM.c deleted file mode 100755 index 6d4e3672..00000000 --- a/7zip/Compress/Branch/BranchARM.c +++ /dev/null @@ -1,26 +0,0 @@ -/* BranchARM.c */ - -#include "BranchARM.h" - -UInt32 ARM_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding) -{ - UInt32 i; - for (i = 0; i + 4 <= size; i += 4) - { - if (data[i + 3] == 0xEB) - { - UInt32 src = (data[i + 2] << 16) | (data[i + 1] << 8) | (data[i + 0]); - src <<= 2; - UInt32 dest; - if (encoding) - dest = nowPos + i + 8 + src; - else - dest = src - (nowPos + i + 8); - dest >>= 2; - data[i + 2] = (Byte)(dest >> 16); - data[i + 1] = (Byte)(dest >> 8); - data[i + 0] = (Byte)dest; - } - } - return i; -} diff --git a/7zip/Compress/Branch/BranchARM.h b/7zip/Compress/Branch/BranchARM.h deleted file mode 100755 index 02eb1b47..00000000 --- a/7zip/Compress/Branch/BranchARM.h +++ /dev/null @@ -1,10 +0,0 @@ -// BranchARM.h - -#ifndef __BRANCH_ARM_H -#define __BRANCH_ARM_H - -#include "BranchTypes.h" - -UInt32 ARM_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding); - -#endif diff --git a/7zip/Compress/Branch/BranchARMThumb.c b/7zip/Compress/Branch/BranchARMThumb.c deleted file mode 100755 index aab9c7a1..00000000 --- a/7zip/Compress/Branch/BranchARMThumb.c +++ /dev/null @@ -1,35 +0,0 @@ -/* BranchARMThumb.c */ - -#include "BranchARMThumb.h" - -UInt32 ARMThumb_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding) -{ - UInt32 i; - for (i = 0; i + 4 <= size; i += 2) - { - if ((data[i + 1] & 0xF8) == 0xF0 && - (data[i + 3] & 0xF8) == 0xF8) - { - UInt32 src = - ((data[i + 1] & 0x7) << 19) | - (data[i + 0] << 11) | - ((data[i + 3] & 0x7) << 8) | - (data[i + 2]); - - src <<= 1; - UInt32 dest; - if (encoding) - dest = nowPos + i + 4 + src; - else - dest = src - (nowPos + i + 4); - dest >>= 1; - - data[i + 1] = (Byte)(0xF0 | ((dest >> 19) & 0x7)); - data[i + 0] = (Byte)(dest >> 11); - data[i + 3] = (Byte)(0xF8 | ((dest >> 8) & 0x7)); - data[i + 2] = (Byte)dest; - i += 2; - } - } - return i; -} diff --git a/7zip/Compress/Branch/BranchARMThumb.h b/7zip/Compress/Branch/BranchARMThumb.h deleted file mode 100755 index d67e6e5a..00000000 --- a/7zip/Compress/Branch/BranchARMThumb.h +++ /dev/null @@ -1,10 +0,0 @@ -// BranchARMThumb.h - -#ifndef __BRANCH_ARM_THUMB_H -#define __BRANCH_ARM_THUMB_H - -#include "BranchTypes.h" - -UInt32 ARMThumb_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding); - -#endif diff --git a/7zip/Compress/Branch/BranchCoder.cpp b/7zip/Compress/Branch/BranchCoder.cpp deleted file mode 100755 index 8d25f0d5..00000000 --- a/7zip/Compress/Branch/BranchCoder.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// BranchCoder.cpp - -#include "StdAfx.h" -#include "BranchCoder.h" - -STDMETHODIMP CBranchConverter::Init() -{ - _bufferPos = 0; - SubInit(); - return S_OK; -} - -STDMETHODIMP_(UInt32) CBranchConverter::Filter(Byte *data, UInt32 size) -{ - UInt32 processedSize = SubFilter(data, size); - _bufferPos += processedSize; - return processedSize; -} diff --git a/7zip/Compress/Branch/BranchCoder.h b/7zip/Compress/Branch/BranchCoder.h deleted file mode 100755 index 4b53b6cb..00000000 --- a/7zip/Compress/Branch/BranchCoder.h +++ /dev/null @@ -1,54 +0,0 @@ -// BranchCoder.h - -#ifndef __BRANCH_CODER_H -#define __BRANCH_CODER_H - -#include "Common/MyCom.h" -#include "Common/Types.h" -#include "Common/Alloc.h" - -#include "../../ICoder.h" - -class CBranchConverter: - public ICompressFilter, - public CMyUnknownImp -{ -protected: - UInt32 _bufferPos; - virtual void SubInit() {} - virtual UInt32 SubFilter(Byte *data, UInt32 size) = 0; -public: - MY_UNKNOWN_IMP; - STDMETHOD(Init)(); - STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size); -}; - -#define MyClassEncoderA(Name) class C ## Name: public CBranchConverter \ - { public: UInt32 SubFilter(Byte *data, UInt32 size); }; - -#define MyClassDecoderA(Name) class C ## Name: public CBranchConverter \ - { public: UInt32 SubFilter(Byte *data, UInt32 size); }; - -#define MyClassEncoderB(Name, ADD_ITEMS, ADD_INIT) class C ## Name: public CBranchConverter, public ADD_ITEMS \ - { public: UInt32 SubFilter(Byte *data, UInt32 size); ADD_INIT}; - -#define MyClassDecoderB(Name, ADD_ITEMS, ADD_INIT) class C ## Name: public CBranchConverter, public ADD_ITEMS \ - { public: UInt32 SubFilter(Byte *data, UInt32 size); ADD_INIT}; - -#define MyClass2b(Name, id, subId, encodingId) \ -DEFINE_GUID(CLSID_CCompressConvert ## Name, \ -0x23170F69, 0x40C1, 0x278B, 0x03, 0x03, id, subId, 0x00, 0x00, encodingId, 0x00); - -#define MyClassA(Name, id, subId) \ -MyClass2b(Name ## _Encoder, id, subId, 0x01) \ -MyClassEncoderA(Name ## _Encoder) \ -MyClass2b(Name ## _Decoder, id, subId, 0x00) \ -MyClassDecoderA(Name ## _Decoder) - -#define MyClassB(Name, id, subId, ADD_ITEMS, ADD_INIT) \ -MyClass2b(Name ## _Encoder, id, subId, 0x01) \ -MyClassEncoderB(Name ## _Encoder, ADD_ITEMS, ADD_INIT) \ -MyClass2b(Name ## _Decoder, id, subId, 0x00) \ -MyClassDecoderB(Name ## _Decoder, ADD_ITEMS, ADD_INIT) - -#endif diff --git a/7zip/Compress/Branch/BranchIA64.c b/7zip/Compress/Branch/BranchIA64.c deleted file mode 100755 index e7775564..00000000 --- a/7zip/Compress/Branch/BranchIA64.c +++ /dev/null @@ -1,63 +0,0 @@ -/* BranchIA64.c */ - -#include "BranchIA64.h" - -const Byte kBranchTable[32] = -{ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 4, 4, 6, 6, 0, 0, 7, 7, - 4, 4, 0, 0, 4, 4, 0, 0 -}; - -UInt32 IA64_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding) -{ - UInt32 i; - for (i = 0; i + 16 <= size; i += 16) - { - UInt32 instrTemplate = data[i] & 0x1F; - UInt32 mask = kBranchTable[instrTemplate]; - UInt32 bitPos = 5; - for (int slot = 0; slot < 3; slot++, bitPos += 41) - { - if (((mask >> slot) & 1) == 0) - continue; - UInt32 bytePos = (bitPos >> 3); - UInt32 bitRes = bitPos & 0x7; - UInt64 instruction = 0; - int j; - for (j = 0; j < 6; j++) - instruction += (UInt64)(data[i + j + bytePos]) << (8 * j); - - UInt64 instNorm = instruction >> bitRes; - if (((instNorm >> 37) & 0xF) == 0x5 - && ((instNorm >> 9) & 0x7) == 0 - /* && (instNorm & 0x3F)== 0 */ - ) - { - UInt32 src = UInt32((instNorm >> 13) & 0xFFFFF); - src |= ((instNorm >> 36) & 1) << 20; - - src <<= 4; - - UInt32 dest; - if (encoding) - dest = nowPos + i + src; - else - dest = src - (nowPos + i); - - dest >>= 4; - - instNorm &= ~(UInt64(0x8FFFFF) << 13); - instNorm |= (UInt64(dest & 0xFFFFF) << 13); - instNorm |= (UInt64(dest & 0x100000) << (36 - 20)); - - instruction &= (1 << bitRes) - 1; - instruction |= (instNorm << bitRes); - for (j = 0; j < 6; j++) - data[i + j + bytePos] = Byte(instruction >> (8 * j)); - } - } - } - return i; -} diff --git a/7zip/Compress/Branch/BranchIA64.h b/7zip/Compress/Branch/BranchIA64.h deleted file mode 100755 index b7757fe9..00000000 --- a/7zip/Compress/Branch/BranchIA64.h +++ /dev/null @@ -1,10 +0,0 @@ -// BranchIA64.h - -#ifndef __BRANCH_IA64_H -#define __BRANCH_IA64_H - -#include "BranchTypes.h" - -UInt32 IA64_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding); - -#endif diff --git a/7zip/Compress/Branch/BranchPPC.c b/7zip/Compress/Branch/BranchPPC.c deleted file mode 100755 index b3e5703f..00000000 --- a/7zip/Compress/Branch/BranchPPC.c +++ /dev/null @@ -1,36 +0,0 @@ -/* BranchPPC.c */ - -#include "BranchPPC.h" - -UInt32 PPC_B_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding) -{ - UInt32 i; - for (i = 0; i + 4 <= size; i += 4) - { - /* PowerPC branch 6(48) 24(Offset) 1(Abs) 1(Link) */ - if ((data[i] >> 2) == 0x12 && - ( - (data[i + 3] & 3) == 1 - /* || (data[i+3] & 3) == 3 */ - ) - ) - { - UInt32 src = ((data[i + 0] & 3) << 24) | - (data[i + 1] << 16) | - (data[i + 2] << 8) | - (data[i + 3] & (~3)); - - UInt32 dest; - if (encoding) - dest = nowPos + i + src; - else - dest = src - (nowPos + i); - data[i + 0] = (Byte)(0x48 | ((dest >> 24) & 0x3)); - data[i + 1] = (Byte)(dest >> 16); - data[i + 2] = (Byte)(dest >> 8); - data[i + 3] &= 0x3; - data[i + 3] |= dest; - } - } - return i; -} diff --git a/7zip/Compress/Branch/BranchPPC.h b/7zip/Compress/Branch/BranchPPC.h deleted file mode 100755 index c02bba19..00000000 --- a/7zip/Compress/Branch/BranchPPC.h +++ /dev/null @@ -1,10 +0,0 @@ -// BranchPPC.h - -#ifndef __BRANCH_PPC_H -#define __BRANCH_PPC_H - -#include "BranchTypes.h" - -UInt32 PPC_B_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding); - -#endif diff --git a/7zip/Compress/Branch/BranchSPARC.c b/7zip/Compress/Branch/BranchSPARC.c deleted file mode 100755 index c175875b..00000000 --- a/7zip/Compress/Branch/BranchSPARC.c +++ /dev/null @@ -1,36 +0,0 @@ -/* BranchSPARC.c */ - -#include "BranchSPARC.h" - -UInt32 SPARC_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding) -{ - UInt32 i; - for (i = 0; i + 4 <= size; i += 4) - { - if (data[i] == 0x40 && (data[i + 1] & 0xC0) == 0x00 || - data[i] == 0x7F && (data[i + 1] & 0xC0) == 0xC0) - { - UInt32 src = - ((UInt32)data[i + 0] << 24) | - ((UInt32)data[i + 1] << 16) | - ((UInt32)data[i + 2] << 8) | - ((UInt32)data[i + 3]); - - src <<= 2; - UInt32 dest; - if (encoding) - dest = nowPos + i + src; - else - dest = src - (nowPos + i); - dest >>= 2; - - dest = (((0 - ((dest >> 22) & 1)) << 22) & 0x3FFFFFFF) | (dest & 0x3FFFFF) | 0x40000000; - - data[i + 0] = (Byte)(dest >> 24); - data[i + 1] = (Byte)(dest >> 16); - data[i + 2] = (Byte)(dest >> 8); - data[i + 3] = (Byte)dest; - } - } - return i; -} diff --git a/7zip/Compress/Branch/BranchSPARC.h b/7zip/Compress/Branch/BranchSPARC.h deleted file mode 100755 index fbe9e673..00000000 --- a/7zip/Compress/Branch/BranchSPARC.h +++ /dev/null @@ -1,10 +0,0 @@ -// BranchSPARC.h - -#ifndef __BRANCH_SPARC_H -#define __BRANCH_SPARC_H - -#include "BranchTypes.h" - -UInt32 SPARC_B_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding); - -#endif diff --git a/7zip/Compress/Branch/BranchTypes.h b/7zip/Compress/Branch/BranchTypes.h deleted file mode 100755 index f7ad3abc..00000000 --- a/7zip/Compress/Branch/BranchTypes.h +++ /dev/null @@ -1,25 +0,0 @@ -/* BranchTypes.h */ - -#ifndef __BRANCHTYPES_H -#define __BRANCHTYPES_H - -#ifndef _7ZIP_BYTE_DEFINED -#define _7ZIP_BYTE_DEFINED -typedef unsigned char Byte; -#endif - -#ifndef _7ZIP_UINT16_DEFINED -#define _7ZIP_UINT16_DEFINED -typedef unsigned short UInt16; -#endif - -#ifndef _7ZIP_UINT32_DEFINED -#define _7ZIP_UINT32_DEFINED -#ifdef _LZMA_UINT32_IS_ULONG -typedef unsigned long UInt32; -#else -typedef unsigned int UInt32; -#endif -#endif - -#endif diff --git a/7zip/Compress/Branch/BranchX86.c b/7zip/Compress/Branch/BranchX86.c deleted file mode 100755 index c3f455b8..00000000 --- a/7zip/Compress/Branch/BranchX86.c +++ /dev/null @@ -1,101 +0,0 @@ -/* BranchX86.c */ - -#include "BranchX86.h" - -/* -static int inline Test86MSByte(Byte b) -{ - return (b == 0 || b == 0xFF); -} -*/ -#define Test86MSByte(b) ((b) == 0 || (b) == 0xFF) - -const int kMaskToAllowedStatus[8] = {1, 1, 1, 0, 1, 0, 0, 0}; -const Byte kMaskToBitNumber[8] = {0, 1, 2, 2, 3, 3, 3, 3}; - -/* -void x86_Convert_Init(UInt32 *prevMask, UInt32 *prevPos) -{ - *prevMask = 0; - *prevPos = (UInt32)(-5); -} -*/ - -UInt32 x86_Convert(Byte *buffer, UInt32 endPos, UInt32 nowPos, - UInt32 *prevMask, UInt32 *prevPos, int encoding) -{ - UInt32 bufferPos = 0; - UInt32 limit; - - if (endPos < 5) - return 0; - - if (nowPos - *prevPos > 5) - *prevPos = nowPos - 5; - - limit = endPos - 5; - while(bufferPos <= limit) - { - Byte b = buffer[bufferPos]; - UInt32 offset; - if (b != 0xE8 && b != 0xE9) - { - bufferPos++; - continue; - } - offset = (nowPos + bufferPos - *prevPos); - *prevPos = (nowPos + bufferPos); - if (offset > 5) - *prevMask = 0; - else - { - UInt32 i; - for (i = 0; i < offset; i++) - { - *prevMask &= 0x77; - *prevMask <<= 1; - } - } - b = buffer[bufferPos + 4]; - if (Test86MSByte(b) && kMaskToAllowedStatus[(*prevMask >> 1) & 0x7] && - (*prevMask >> 1) < 0x10) - { - UInt32 src = - ((UInt32)(b) << 24) | - ((UInt32)(buffer[bufferPos + 3]) << 16) | - ((UInt32)(buffer[bufferPos + 2]) << 8) | - (buffer[bufferPos + 1]); - - UInt32 dest; - for (;;) - { - UInt32 index; - if (encoding) - dest = (nowPos + bufferPos + 5) + src; - else - dest = src - (nowPos + bufferPos + 5); - if (*prevMask == 0) - break; - index = kMaskToBitNumber[*prevMask >> 1]; - b = (Byte)(dest >> (24 - index * 8)); - if (!Test86MSByte(b)) - break; - src = dest ^ ((1 << (32 - index * 8)) - 1); - } - buffer[bufferPos + 4] = (Byte)(~(((dest >> 24) & 1) - 1)); - buffer[bufferPos + 3] = (Byte)(dest >> 16); - buffer[bufferPos + 2] = (Byte)(dest >> 8); - buffer[bufferPos + 1] = (Byte)dest; - bufferPos += 5; - *prevMask = 0; - } - else - { - bufferPos++; - *prevMask |= 1; - if (Test86MSByte(b)) - *prevMask |= 0x10; - } - } - return bufferPos; -} diff --git a/7zip/Compress/Branch/BranchX86.h b/7zip/Compress/Branch/BranchX86.h deleted file mode 100755 index 25c1ae51..00000000 --- a/7zip/Compress/Branch/BranchX86.h +++ /dev/null @@ -1,13 +0,0 @@ -/* BranchX86.h */ - -#ifndef __BRANCHX86_H -#define __BRANCHX86_H - -#include "BranchTypes.h" - -#define x86_Convert_Init(prevMask, prevPos) { prevMask = 0; prevPos = (UInt32)(-5); } - -UInt32 x86_Convert(Byte *buffer, UInt32 endPos, UInt32 nowPos, - UInt32 *prevMask, UInt32 *prevPos, int encoding); - -#endif diff --git a/7zip/Compress/Branch/DllExports.cpp b/7zip/Compress/Branch/DllExports.cpp deleted file mode 100755 index e7928f75..00000000 --- a/7zip/Compress/Branch/DllExports.cpp +++ /dev/null @@ -1,152 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" - -#include "x86.h" -#include "PPC.h" -#include "IA64.h" -#include "ARM.h" -#include "ARMThumb.h" -#include "x86_2.h" -#include "SPARC.h" - -#define MY_CreateClass0(n) \ -if (*clsid == CLSID_CCompressConvert ## n ## _Encoder) { \ - if (!correctInterface) \ - return E_NOINTERFACE; \ - filter = (ICompressFilter *)new C ## n ## _Encoder(); \ - } else if (*clsid == CLSID_CCompressConvert ## n ## _Decoder){ \ - if (!correctInterface) \ - return E_NOINTERFACE; \ - filter = (ICompressFilter *)new C ## n ## _Decoder(); \ - } - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /*lpReserved*/) -{ - return TRUE; -} - -STDAPI CreateObject( - const GUID *clsid, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - int correctInterface = (*interfaceID == IID_ICompressFilter); - CMyComPtr filter; - MY_CreateClass0(BCJ_x86) - else - MY_CreateClass0(BC_ARM) - else - MY_CreateClass0(BC_PPC_B) - else - MY_CreateClass0(BC_IA64) - else - MY_CreateClass0(BC_ARMThumb) - else - MY_CreateClass0(BC_SPARC) - else - { - CMyComPtr coder2; - correctInterface = (*interfaceID == IID_ICompressCoder2); - if (*clsid == CLSID_CCompressConvertBCJ2_x86_Encoder) - { - if (!correctInterface) - return E_NOINTERFACE; - coder2 = (ICompressCoder2 *)new CBCJ2_x86_Encoder(); - } - else if (*clsid == CLSID_CCompressConvertBCJ2_x86_Decoder) - { - if (!correctInterface) - return E_NOINTERFACE; - coder2 = (ICompressCoder2 *)new CBCJ2_x86_Decoder(); - } - else - return CLASS_E_CLASSNOTAVAILABLE; - *outObject = coder2.Detach(); - return S_OK; - } - *outObject = filter.Detach(); - return S_OK; - - COM_TRY_END -} - -struct CBranchMethodItem -{ - char ID[4]; - const wchar_t *UserName; - const GUID *Decoder; - const GUID *Encoder; - UINT32 NumInStreams; -}; - -#define METHOD_ITEM(Name, id, subId, UserName, NumInStreams) \ - { { 0x03, 0x03, id, subId }, UserName, \ - &CLSID_CCompressConvert ## Name ## _Decoder, \ - &CLSID_CCompressConvert ## Name ## _Encoder, NumInStreams } - - -static CBranchMethodItem g_Methods[] = -{ - METHOD_ITEM(BCJ_x86, 0x01, 0x03, L"BCJ", 1), - METHOD_ITEM(BCJ2_x86, 0x01, 0x1B, L"BCJ2", 4), - METHOD_ITEM(BC_PPC_B, 0x02, 0x05, L"BC_PPC_B", 1), - // METHOD_ITEM(BC_Alpha, 0x03, 1, L"BC_Alpha", 1), - METHOD_ITEM(BC_IA64, 0x04, 1, L"BC_IA64", 1), - METHOD_ITEM(BC_ARM, 0x05, 1, L"BC_ARM", 1), - // METHOD_ITEM(BC_M68_B, 0x06, 5, L"BC_M68_B", 1), - METHOD_ITEM(BC_ARMThumb, 0x07, 1, L"BC_ARMThumb", 1), - METHOD_ITEM(BC_SPARC, 0x08, 0x05, L"BC_SPARC", 1) -}; - -STDAPI GetNumberOfMethods(UINT32 *numMethods) -{ - *numMethods = sizeof(g_Methods) / sizeof(g_Methods[1]); - return S_OK; -} - -STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value) -{ - if (index > sizeof(g_Methods) / sizeof(g_Methods[1])) - return E_INVALIDARG; - VariantClear((tagVARIANT *)value); - const CBranchMethodItem &method = g_Methods[index]; - switch(propID) - { - case NMethodPropID::kID: - if ((value->bstrVal = ::SysAllocStringByteLen(method.ID, - sizeof(method.ID))) != 0) - value->vt = VT_BSTR; - return S_OK; - case NMethodPropID::kName: - if ((value->bstrVal = ::SysAllocString(method.UserName)) != 0) - value->vt = VT_BSTR; - return S_OK; - case NMethodPropID::kDecoder: - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)method.Decoder, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - case NMethodPropID::kEncoder: - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)method.Encoder, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - case NMethodPropID::kInStreams: - { - if (method.NumInStreams != 1) - { - value->vt = VT_UI4; - value->ulVal = method.NumInStreams; - } - return S_OK; - } - } - return S_OK; -} diff --git a/7zip/Compress/Branch/IA64.cpp b/7zip/Compress/Branch/IA64.cpp deleted file mode 100755 index 75dfdcba..00000000 --- a/7zip/Compress/Branch/IA64.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// IA64.cpp - -#include "StdAfx.h" -#include "IA64.h" - -#include "BranchIA64.c" - -UInt32 CBC_IA64_Encoder::SubFilter(Byte *data, UInt32 size) -{ - return ::IA64_Convert(data, size, _bufferPos, 1); -} - -UInt32 CBC_IA64_Decoder::SubFilter(Byte *data, UInt32 size) -{ - return ::IA64_Convert(data, size, _bufferPos, 0); -} diff --git a/7zip/Compress/Branch/IA64.h b/7zip/Compress/Branch/IA64.h deleted file mode 100755 index 7fe715ed..00000000 --- a/7zip/Compress/Branch/IA64.h +++ /dev/null @@ -1,10 +0,0 @@ -// IA64.h - -#ifndef __IA64_H -#define __IA64_H - -#include "BranchCoder.h" - -MyClassA(BC_IA64, 0x04, 1) - -#endif diff --git a/7zip/Compress/Branch/PPC.cpp b/7zip/Compress/Branch/PPC.cpp deleted file mode 100755 index 197a8e58..00000000 --- a/7zip/Compress/Branch/PPC.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// PPC.cpp - -#include "StdAfx.h" -#include "PPC.h" - -#include "Windows/Defs.h" -#include "BranchPPC.c" - -UInt32 CBC_PPC_B_Encoder::SubFilter(Byte *data, UInt32 size) -{ - return ::PPC_B_Convert(data, size, _bufferPos, 1); -} - -UInt32 CBC_PPC_B_Decoder::SubFilter(Byte *data, UInt32 size) -{ - return ::PPC_B_Convert(data, size, _bufferPos, 0); -} diff --git a/7zip/Compress/Branch/PPC.h b/7zip/Compress/Branch/PPC.h deleted file mode 100755 index a0e33444..00000000 --- a/7zip/Compress/Branch/PPC.h +++ /dev/null @@ -1,10 +0,0 @@ -// PPC.h - -#ifndef __PPC_H -#define __PPC_H - -#include "BranchCoder.h" - -MyClassA(BC_PPC_B, 0x02, 5) - -#endif diff --git a/7zip/Compress/Branch/SPARC.cpp b/7zip/Compress/Branch/SPARC.cpp deleted file mode 100755 index d054eaaf..00000000 --- a/7zip/Compress/Branch/SPARC.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// SPARC.cpp - -#include "StdAfx.h" -#include "SPARC.h" - -#include "Windows/Defs.h" -#include "BranchSPARC.c" - -UInt32 CBC_SPARC_Encoder::SubFilter(Byte *data, UInt32 size) -{ - return ::SPARC_Convert(data, size, _bufferPos, 1); -} - -UInt32 CBC_SPARC_Decoder::SubFilter(Byte *data, UInt32 size) -{ - return ::SPARC_Convert(data, size, _bufferPos, 0); -} diff --git a/7zip/Compress/Branch/SPARC.h b/7zip/Compress/Branch/SPARC.h deleted file mode 100755 index e0a682ef..00000000 --- a/7zip/Compress/Branch/SPARC.h +++ /dev/null @@ -1,10 +0,0 @@ -// SPARC.h - -#ifndef __SPARC_H -#define __SPARC_H - -#include "BranchCoder.h" - -MyClassA(BC_SPARC, 0x08, 5) - -#endif diff --git a/7zip/Compress/Branch/StdAfx.cpp b/7zip/Compress/Branch/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Compress/Branch/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Compress/Branch/StdAfx.h b/7zip/Compress/Branch/StdAfx.h deleted file mode 100755 index e7fb6986..00000000 --- a/7zip/Compress/Branch/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Compress/Branch/makefile b/7zip/Compress/Branch/makefile deleted file mode 100755 index 6857d39f..00000000 --- a/7zip/Compress/Branch/makefile +++ /dev/null @@ -1,48 +0,0 @@ -PROG = Branch.dll -DEF_FILE = ../Codec.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib - -BRANCH_OBJS = \ - $O\DllExports.obj \ - -BRANCH_OPT_OBJS = \ - $O\ARM.obj \ - $O\ARMThumb.obj \ - $O\BranchCoder.obj \ - $O\IA64.obj \ - $O\PPC.obj \ - $O\SPARC.obj \ - $O\x86.obj \ - $O\x86_2.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - -7ZIP_COMMON_OBJS = \ - $O\InBuffer.obj \ - $O\OutBuffer.obj \ - - -OBJS = \ - $O\StdAfx.obj \ - $(BRANCH_OBJS) \ - $(BRANCH_OPT_OBJS) \ - $(COMMON_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $O\RangeCoderBit.obj \ - $O\resource.res - - -!include "../../../Build.mak" - -$(BRANCH_OBJS): $(*B).cpp - $(COMPL) -$(BRANCH_OPT_OBJS): $(*B).cpp - $(COMPL_O2) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$O\RangeCoderBit.obj: ../RangeCoder/$(*B).cpp - $(COMPL) diff --git a/7zip/Compress/Branch/resource.rc b/7zip/Compress/Branch/resource.rc deleted file mode 100755 index 5476d4fa..00000000 --- a/7zip/Compress/Branch/resource.rc +++ /dev/null @@ -1,3 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Branch Filter", "Branch") diff --git a/7zip/Compress/Branch/x86.cpp b/7zip/Compress/Branch/x86.cpp deleted file mode 100755 index 013e42b6..00000000 --- a/7zip/Compress/Branch/x86.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// x86.cpp - -#include "StdAfx.h" -#include "x86.h" - -#include "Windows/Defs.h" - -#include "BranchX86.c" - -UInt32 CBCJ_x86_Encoder::SubFilter(Byte *data, UInt32 size) -{ - return ::x86_Convert(data, size, _bufferPos, &_prevMask, &_prevPos, 1); -} - -UInt32 CBCJ_x86_Decoder::SubFilter(Byte *data, UInt32 size) -{ - return ::x86_Convert(data, size, _bufferPos, &_prevMask, &_prevPos, 0); -} diff --git a/7zip/Compress/Branch/x86.h b/7zip/Compress/Branch/x86.h deleted file mode 100755 index 10d03982..00000000 --- a/7zip/Compress/Branch/x86.h +++ /dev/null @@ -1,19 +0,0 @@ -// x86.h - -#ifndef __X86_H -#define __X86_H - -#include "BranchCoder.h" -#include "BranchX86.h" - -struct CBranch86 -{ - UInt32 _prevMask; - UInt32 _prevPos; - void x86Init() { x86_Convert_Init(_prevMask, _prevPos); } -}; - -MyClassB(BCJ_x86, 0x01, 3, CBranch86 , - virtual void SubInit() { x86Init(); }) - -#endif diff --git a/7zip/Compress/Branch/x86_2.cpp b/7zip/Compress/Branch/x86_2.cpp deleted file mode 100755 index ca37ab83..00000000 --- a/7zip/Compress/Branch/x86_2.cpp +++ /dev/null @@ -1,412 +0,0 @@ -// x86_2.cpp - -#include "StdAfx.h" -#include "x86_2.h" - -#include "../../../Common/Alloc.h" - -static const int kBufferSize = 1 << 17; - -inline bool IsJcc(Byte b0, Byte b1) -{ - return (b0 == 0x0F && (b1 & 0xF0) == 0x80); -} - -#ifndef EXTRACT_ONLY - -static bool inline Test86MSByte(Byte b) -{ - return (b == 0 || b == 0xFF); -} - -bool CBCJ2_x86_Encoder::Create() -{ - if (!_mainStream.Create(1 << 16)) - return false; - if (!_callStream.Create(1 << 20)) - return false; - if (!_jumpStream.Create(1 << 20)) - return false; - if (!_rangeEncoder.Create(1 << 20)) - return false; - if (_buffer == 0) - { - _buffer = (Byte *)MidAlloc(kBufferSize); - if (_buffer == 0) - return false; - } - return true; -} - -CBCJ2_x86_Encoder::~CBCJ2_x86_Encoder() -{ - ::MidFree(_buffer); -} - -HRESULT CBCJ2_x86_Encoder::Flush() -{ - RINOK(_mainStream.Flush()); - RINOK(_callStream.Flush()); - RINOK(_jumpStream.Flush()); - _rangeEncoder.FlushData(); - return _rangeEncoder.FlushStream(); -} - -const UInt32 kDefaultLimit = (1 << 24); - -HRESULT CBCJ2_x86_Encoder::CodeReal(ISequentialInStream **inStreams, - const UInt64 **inSizes, - UInt32 numInStreams, - ISequentialOutStream **outStreams, - const UInt64 ** /* outSizes */, - UInt32 numOutStreams, - ICompressProgressInfo *progress) -{ - if (numInStreams != 1 || numOutStreams != 4) - return E_INVALIDARG; - - if (!Create()) - return E_OUTOFMEMORY; - - bool sizeIsDefined = false; - UInt64 inSize = 0; - if (inSizes != NULL) - if (inSizes[0] != NULL) - { - inSize = *inSizes[0]; - if (inSize <= kDefaultLimit) - sizeIsDefined = true; - } - - ISequentialInStream *inStream = inStreams[0]; - - _mainStream.SetStream(outStreams[0]); - _mainStream.Init(); - _callStream.SetStream(outStreams[1]); - _callStream.Init(); - _jumpStream.SetStream(outStreams[2]); - _jumpStream.Init(); - _rangeEncoder.SetStream(outStreams[3]); - _rangeEncoder.Init(); - for (int i = 0; i < 256; i++) - _statusE8Encoder[i].Init(); - _statusE9Encoder.Init(); - _statusJccEncoder.Init(); - CCoderReleaser releaser(this); - - CMyComPtr getSubStreamSize; - { - inStream->QueryInterface(IID_ICompressGetSubStreamSize, (void **)&getSubStreamSize); - } - - UInt32 nowPos = 0; - UInt64 nowPos64 = 0; - UInt32 bufferPos = 0; - - Byte prevByte = 0; - - UInt64 subStreamIndex = 0; - UInt64 subStreamStartPos = 0; - UInt64 subStreamEndPos = 0; - - for (;;) - { - UInt32 processedSize = 0; - for (;;) - { - UInt32 size = kBufferSize - (bufferPos + processedSize); - UInt32 processedSizeLoc; - if (size == 0) - break; - RINOK(inStream->Read(_buffer + bufferPos + processedSize, size, &processedSizeLoc)); - if (processedSizeLoc == 0) - break; - processedSize += processedSizeLoc; - } - UInt32 endPos = bufferPos + processedSize; - - if (endPos < 5) - { - // change it - for (bufferPos = 0; bufferPos < endPos; bufferPos++) - { - Byte b = _buffer[bufferPos]; - _mainStream.WriteByte(b); - if (b == 0xE8) - _statusE8Encoder[prevByte].Encode(&_rangeEncoder, 0); - else if (b == 0xE9) - _statusE9Encoder.Encode(&_rangeEncoder, 0); - else if (IsJcc(prevByte, b)) - _statusJccEncoder.Encode(&_rangeEncoder, 0); - prevByte = b; - } - return Flush(); - } - - bufferPos = 0; - - UInt32 limit = endPos - 5; - while(bufferPos <= limit) - { - Byte b = _buffer[bufferPos]; - _mainStream.WriteByte(b); - if (b != 0xE8 && b != 0xE9 && !IsJcc(prevByte, b)) - { - bufferPos++; - prevByte = b; - continue; - } - Byte nextByte = _buffer[bufferPos + 4]; - UInt32 src = - (UInt32(nextByte) << 24) | - (UInt32(_buffer[bufferPos + 3]) << 16) | - (UInt32(_buffer[bufferPos + 2]) << 8) | - (_buffer[bufferPos + 1]); - UInt32 dest = (nowPos + bufferPos + 5) + src; - // if (Test86MSByte(nextByte)) - bool convert; - if (getSubStreamSize != NULL) - { - UInt64 currentPos = (nowPos64 + bufferPos); - while (subStreamEndPos < currentPos) - { - UInt64 subStreamSize; - HRESULT result = getSubStreamSize->GetSubStreamSize(subStreamIndex, &subStreamSize); - if (result == S_OK) - { - subStreamStartPos = subStreamEndPos; - subStreamEndPos += subStreamSize; - subStreamIndex++; - } - else if (result == S_FALSE || result == E_NOTIMPL) - { - getSubStreamSize.Release(); - subStreamStartPos = 0; - subStreamEndPos = subStreamStartPos - 1; - } - else - return result; - } - if (getSubStreamSize == NULL) - { - if (sizeIsDefined) - convert = (dest < inSize); - else - convert = Test86MSByte(nextByte); - } - else if (subStreamEndPos - subStreamStartPos > kDefaultLimit) - convert = Test86MSByte(nextByte); - else - { - UInt64 dest64 = (currentPos + 5) + Int64(Int32(src)); - convert = (dest64 >= subStreamStartPos && dest64 < subStreamEndPos); - } - } - else if (sizeIsDefined) - convert = (dest < inSize); - else - convert = Test86MSByte(nextByte); - if (convert) - { - if (b == 0xE8) - _statusE8Encoder[prevByte].Encode(&_rangeEncoder, 1); - else if (b == 0xE9) - _statusE9Encoder.Encode(&_rangeEncoder, 1); - else - _statusJccEncoder.Encode(&_rangeEncoder, 1); - - bufferPos += 5; - if (b == 0xE8) - { - _callStream.WriteByte((Byte)(dest >> 24)); - _callStream.WriteByte((Byte)(dest >> 16)); - _callStream.WriteByte((Byte)(dest >> 8)); - _callStream.WriteByte((Byte)(dest)); - } - else - { - _jumpStream.WriteByte((Byte)(dest >> 24)); - _jumpStream.WriteByte((Byte)(dest >> 16)); - _jumpStream.WriteByte((Byte)(dest >> 8)); - _jumpStream.WriteByte((Byte)(dest)); - } - prevByte = nextByte; - } - else - { - if (b == 0xE8) - _statusE8Encoder[prevByte].Encode(&_rangeEncoder, 0); - else if (b == 0xE9) - _statusE9Encoder.Encode(&_rangeEncoder, 0); - else - _statusJccEncoder.Encode(&_rangeEncoder, 0); - bufferPos++; - prevByte = b; - } - } - nowPos += bufferPos; - nowPos64 += bufferPos; - - if (progress != NULL) - { - RINOK(progress->SetRatioInfo(&nowPos64, NULL)); - } - - UInt32 i = 0; - while(bufferPos < endPos) - _buffer[i++] = _buffer[bufferPos++]; - bufferPos = i; - } -} - -STDMETHODIMP CBCJ2_x86_Encoder::Code(ISequentialInStream **inStreams, - const UInt64 **inSizes, - UInt32 numInStreams, - ISequentialOutStream **outStreams, - const UInt64 **outSizes, - UInt32 numOutStreams, - ICompressProgressInfo *progress) -{ - try - { - return CodeReal(inStreams, inSizes, numInStreams, - outStreams, outSizes,numOutStreams, progress); - } - catch(const COutBufferException &e) { return e.ErrorCode; } - catch(...) { return S_FALSE; } -} - -#endif - -HRESULT CBCJ2_x86_Decoder::CodeReal(ISequentialInStream **inStreams, - const UInt64 ** /* inSizes */, - UInt32 numInStreams, - ISequentialOutStream **outStreams, - const UInt64 ** /* outSizes */, - UInt32 numOutStreams, - ICompressProgressInfo *progress) -{ - if (numInStreams != 4 || numOutStreams != 1) - return E_INVALIDARG; - - if (!_mainInStream.Create(1 << 16)) - return E_OUTOFMEMORY; - if (!_callStream.Create(1 << 20)) - return E_OUTOFMEMORY; - if (!_jumpStream.Create(1 << 16)) - return E_OUTOFMEMORY; - if (!_rangeDecoder.Create(1 << 20)) - return E_OUTOFMEMORY; - if (!_outStream.Create(1 << 16)) - return E_OUTOFMEMORY; - - _mainInStream.SetStream(inStreams[0]); - _callStream.SetStream(inStreams[1]); - _jumpStream.SetStream(inStreams[2]); - _rangeDecoder.SetStream(inStreams[3]); - _outStream.SetStream(outStreams[0]); - - _mainInStream.Init(); - _callStream.Init(); - _jumpStream.Init(); - _rangeDecoder.Init(); - _outStream.Init(); - - for (int i = 0; i < 256; i++) - _statusE8Decoder[i].Init(); - _statusE9Decoder.Init(); - _statusJccDecoder.Init(); - - CCoderReleaser releaser(this); - - Byte prevByte = 0; - UInt32 processedBytes = 0; - for (;;) - { - if (processedBytes > (1 << 20) && progress != NULL) - { - UInt64 nowPos64 = _outStream.GetProcessedSize(); - RINOK(progress->SetRatioInfo(NULL, &nowPos64)); - processedBytes = 0; - } - processedBytes++; - Byte b; - if (!_mainInStream.ReadByte(b)) - return Flush(); - _outStream.WriteByte(b); - if (b != 0xE8 && b != 0xE9 && !IsJcc(prevByte, b)) - { - prevByte = b; - continue; - } - bool status; - if (b == 0xE8) - status = (_statusE8Decoder[prevByte].Decode(&_rangeDecoder) == 1); - else if (b == 0xE9) - status = (_statusE9Decoder.Decode(&_rangeDecoder) == 1); - else - status = (_statusJccDecoder.Decode(&_rangeDecoder) == 1); - if (status) - { - UInt32 src; - if (b == 0xE8) - { - Byte b0; - if(!_callStream.ReadByte(b0)) - return S_FALSE; - src = ((UInt32)b0) << 24; - if(!_callStream.ReadByte(b0)) - return S_FALSE; - src |= ((UInt32)b0) << 16; - if(!_callStream.ReadByte(b0)) - return S_FALSE; - src |= ((UInt32)b0) << 8; - if(!_callStream.ReadByte(b0)) - return S_FALSE; - src |= ((UInt32)b0); - } - else - { - Byte b0; - if(!_jumpStream.ReadByte(b0)) - return S_FALSE; - src = ((UInt32)b0) << 24; - if(!_jumpStream.ReadByte(b0)) - return S_FALSE; - src |= ((UInt32)b0) << 16; - if(!_jumpStream.ReadByte(b0)) - return S_FALSE; - src |= ((UInt32)b0) << 8; - if(!_jumpStream.ReadByte(b0)) - return S_FALSE; - src |= ((UInt32)b0); - } - UInt32 dest = src - (UInt32(_outStream.GetProcessedSize()) + 4) ; - _outStream.WriteByte((Byte)(dest)); - _outStream.WriteByte((Byte)(dest >> 8)); - _outStream.WriteByte((Byte)(dest >> 16)); - _outStream.WriteByte((Byte)(dest >> 24)); - prevByte = (Byte)(dest >> 24); - processedBytes += 4; - } - else - prevByte = b; - } -} - -STDMETHODIMP CBCJ2_x86_Decoder::Code(ISequentialInStream **inStreams, - const UInt64 **inSizes, - UInt32 numInStreams, - ISequentialOutStream **outStreams, - const UInt64 **outSizes, - UInt32 numOutStreams, - ICompressProgressInfo *progress) -{ - try - { - return CodeReal(inStreams, inSizes, numInStreams, - outStreams, outSizes,numOutStreams, progress); - } - catch(const COutBufferException &e) { return e.ErrorCode; } - catch(...) { return S_FALSE; } -} diff --git a/7zip/Compress/Branch/x86_2.h b/7zip/Compress/Branch/x86_2.h deleted file mode 100755 index 3d34eb8d..00000000 --- a/7zip/Compress/Branch/x86_2.h +++ /dev/null @@ -1,133 +0,0 @@ -// x86_2.h - -#ifndef __BRANCH_X86_2_H -#define __BRANCH_X86_2_H - -#include "../../../Common/MyCom.h" -#include "../RangeCoder/RangeCoderBit.h" -#include "../../ICoder.h" - -// {23170F69-40C1-278B-0303-010100000100} -#define MyClass2_a(Name, id, subId, encodingId) \ -DEFINE_GUID(CLSID_CCompressConvert ## Name, \ -0x23170F69, 0x40C1, 0x278B, 0x03, 0x03, id, subId, 0x00, 0x00, encodingId, 0x00); - -#define MyClass_a(Name, id, subId) \ -MyClass2_a(Name ## _Encoder, id, subId, 0x01) \ -MyClass2_a(Name ## _Decoder, id, subId, 0x00) - -MyClass_a(BCJ2_x86, 0x01, 0x1B) - -const int kNumMoveBits = 5; - -#ifndef EXTRACT_ONLY - -class CBCJ2_x86_Encoder: - public ICompressCoder2, - public CMyUnknownImp -{ - Byte *_buffer; -public: - CBCJ2_x86_Encoder(): _buffer(0) {}; - ~CBCJ2_x86_Encoder(); - bool Create(); - - COutBuffer _mainStream; - COutBuffer _callStream; - COutBuffer _jumpStream; - NCompress::NRangeCoder::CEncoder _rangeEncoder; - NCompress::NRangeCoder::CBitEncoder _statusE8Encoder[256]; - NCompress::NRangeCoder::CBitEncoder _statusE9Encoder; - NCompress::NRangeCoder::CBitEncoder _statusJccEncoder; - - HRESULT Flush(); - void ReleaseStreams() - { - _mainStream.ReleaseStream(); - _callStream.ReleaseStream(); - _jumpStream.ReleaseStream(); - _rangeEncoder.ReleaseStream(); - } - - class CCoderReleaser - { - CBCJ2_x86_Encoder *_coder; - public: - CCoderReleaser(CBCJ2_x86_Encoder *coder): _coder(coder) {} - ~CCoderReleaser() { _coder->ReleaseStreams(); } - }; - -public: - - MY_UNKNOWN_IMP - - HRESULT CodeReal(ISequentialInStream **inStreams, - const UInt64 **inSizes, - UInt32 numInStreams, - ISequentialOutStream **outStreams, - const UInt64 **outSizes, - UInt32 numOutStreams, - ICompressProgressInfo *progress); - STDMETHOD(Code)(ISequentialInStream **inStreams, - const UInt64 **inSizes, - UInt32 numInStreams, - ISequentialOutStream **outStreams, - const UInt64 **outSizes, - UInt32 numOutStreams, - ICompressProgressInfo *progress); -}; - -#endif - -class CBCJ2_x86_Decoder: - public ICompressCoder2, - public CMyUnknownImp -{ -public: - CInBuffer _mainInStream; - CInBuffer _callStream; - CInBuffer _jumpStream; - NCompress::NRangeCoder::CDecoder _rangeDecoder; - NCompress::NRangeCoder::CBitDecoder _statusE8Decoder[256]; - NCompress::NRangeCoder::CBitDecoder _statusE9Decoder; - NCompress::NRangeCoder::CBitDecoder _statusJccDecoder; - - COutBuffer _outStream; - - void ReleaseStreams() - { - _mainInStream.ReleaseStream(); - _callStream.ReleaseStream(); - _jumpStream.ReleaseStream(); - _rangeDecoder.ReleaseStream(); - _outStream.ReleaseStream(); - } - - HRESULT Flush() { return _outStream.Flush(); } - class CCoderReleaser - { - CBCJ2_x86_Decoder *_coder; - public: - CCoderReleaser(CBCJ2_x86_Decoder *coder): _coder(coder) {} - ~CCoderReleaser() { _coder->ReleaseStreams(); } - }; - -public: - MY_UNKNOWN_IMP - HRESULT CodeReal(ISequentialInStream **inStreams, - const UInt64 **inSizes, - UInt32 numInStreams, - ISequentialOutStream **outStreams, - const UInt64 **outSizes, - UInt32 numOutStreams, - ICompressProgressInfo *progress); - STDMETHOD(Code)(ISequentialInStream **inStreams, - const UInt64 **inSizes, - UInt32 numInStreams, - ISequentialOutStream **outStreams, - const UInt64 **outSizes, - UInt32 numOutStreams, - ICompressProgressInfo *progress); -}; - -#endif diff --git a/7zip/Compress/ByteSwap/ByteSwap.cpp b/7zip/Compress/ByteSwap/ByteSwap.cpp deleted file mode 100755 index 3f252f2c..00000000 --- a/7zip/Compress/ByteSwap/ByteSwap.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// ByteSwap.cpp - -#include "StdAfx.h" - -#include "ByteSwap.h" - -STDMETHODIMP CByteSwap2::Init() { return S_OK; } - -STDMETHODIMP_(UInt32) CByteSwap2::Filter(Byte *data, UInt32 size) -{ - const UInt32 kStep = 2; - UInt32 i; - for (i = 0; i + kStep <= size; i += kStep) - { - Byte b = data[i]; - data[i] = data[i + 1]; - data[i + 1] = b; - } - return i; -} - -STDMETHODIMP CByteSwap4::Init() { return S_OK; } - -STDMETHODIMP_(UInt32) CByteSwap4::Filter(Byte *data, UInt32 size) -{ - const UInt32 kStep = 4; - UInt32 i; - for (i = 0; i + kStep <= size; i += kStep) - { - Byte b0 = data[i]; - Byte b1 = data[i + 1]; - data[i] = data[i + 3]; - data[i + 1] = data[i + 2]; - data[i + 2] = b1; - data[i + 3] = b0; - } - return i; -} diff --git a/7zip/Compress/ByteSwap/ByteSwap.dsp b/7zip/Compress/ByteSwap/ByteSwap.dsp deleted file mode 100755 index 1a73d67f..00000000 --- a/7zip/Compress/ByteSwap/ByteSwap.dsp +++ /dev/null @@ -1,125 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ByteSwap" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=ByteSwap - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ByteSwap.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ByteSwap.mak" CFG="ByteSwap - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ByteSwap - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "ByteSwap - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ByteSwap - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BYTESWAP_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BYTESWAP_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Codecs\Swap.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "ByteSwap - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BYTESWAP_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BYTESWAP_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Codecs\Swap.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "ByteSwap - Win32 Release" -# Name "ByteSwap - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Codec.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\ByteSwap.cpp -# End Source File -# Begin Source File - -SOURCE=.\ByteSwap.h -# End Source File -# End Target -# End Project diff --git a/7zip/Compress/ByteSwap/ByteSwap.dsw b/7zip/Compress/ByteSwap/ByteSwap.dsw deleted file mode 100755 index 413d7e6e..00000000 --- a/7zip/Compress/ByteSwap/ByteSwap.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "ByteSwap"=.\ByteSwap.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Compress/ByteSwap/ByteSwap.h b/7zip/Compress/ByteSwap/ByteSwap.h deleted file mode 100755 index 00303063..00000000 --- a/7zip/Compress/ByteSwap/ByteSwap.h +++ /dev/null @@ -1,37 +0,0 @@ -// ByteSwap.h - -#ifndef __BYTESWAP_H -#define __BYTESWAP_H - -#include "../../ICoder.h" -#include "Common/MyCom.h" - -// {23170F69-40C1-278B-0203-020000000000} -DEFINE_GUID(CLSID_CCompressConvertByteSwap2, -0x23170F69, 0x40C1, 0x278B, 0x02, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0203-040000000000} -DEFINE_GUID(CLSID_CCompressConvertByteSwap4, -0x23170F69, 0x40C1, 0x278B, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00); - -class CByteSwap2: - public ICompressFilter, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP - STDMETHOD(Init)(); - STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size); -}; - -class CByteSwap4: - public ICompressFilter, - public CMyUnknownImp -{ -public: - MY_UNKNOWN_IMP - STDMETHOD(Init)(); - STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size); -}; - -#endif diff --git a/7zip/Compress/ByteSwap/DllExports.cpp b/7zip/Compress/ByteSwap/DllExports.cpp deleted file mode 100755 index cc737590..00000000 --- a/7zip/Compress/ByteSwap/DllExports.cpp +++ /dev/null @@ -1,91 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "ByteSwap.h" -#include "../../ICoder.h" - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /*lpReserved*/) -{ - return TRUE; -} - -STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - int correctInterface = (*iid == IID_ICompressFilter); - CMyComPtr coder; - if (*clsid == CLSID_CCompressConvertByteSwap2) - { - if (!correctInterface) - return E_NOINTERFACE; - coder = (ICompressFilter *)new CByteSwap2(); - } - else if (*clsid == CLSID_CCompressConvertByteSwap4) - { - if (!correctInterface) - return E_NOINTERFACE; - coder = (ICompressFilter *)new CByteSwap4(); - } - else - return CLASS_E_CLASSNOTAVAILABLE; - *outObject = coder.Detach(); - COM_TRY_END - return S_OK; -} - -struct CSwapMethodInfo -{ - char ID[3]; - const wchar_t *Name; - const GUID *clsid; -}; - -static CSwapMethodInfo g_Methods[] = -{ - { { 0x2, 0x03, 0x02 }, L"Swap2", &CLSID_CCompressConvertByteSwap2 }, - { { 0x2, 0x03, 0x04 }, L"Swap4", &CLSID_CCompressConvertByteSwap4 } -}; - -STDAPI GetNumberOfMethods(UINT32 *numMethods) -{ - *numMethods = sizeof(g_Methods) / sizeof(g_Methods[1]); - return S_OK; -} - -STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value) -{ - if (index > sizeof(g_Methods) / sizeof(g_Methods[1])) - return E_INVALIDARG; - ::VariantClear((tagVARIANT *)value); - const CSwapMethodInfo &method = g_Methods[index]; - switch(propID) - { - case NMethodPropID::kID: - { - if ((value->bstrVal = ::SysAllocStringByteLen(method.ID, - sizeof(method.ID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NMethodPropID::kName: - { - if ((value->bstrVal = ::SysAllocString(method.Name)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NMethodPropID::kDecoder: - case NMethodPropID::kEncoder: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)method.clsid, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - } - return S_OK; -} diff --git a/7zip/Compress/ByteSwap/StdAfx.cpp b/7zip/Compress/ByteSwap/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Compress/ByteSwap/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Compress/ByteSwap/StdAfx.h b/7zip/Compress/ByteSwap/StdAfx.h deleted file mode 100755 index e7fb6986..00000000 --- a/7zip/Compress/ByteSwap/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Compress/ByteSwap/makefile b/7zip/Compress/ByteSwap/makefile deleted file mode 100755 index f73a8079..00000000 --- a/7zip/Compress/ByteSwap/makefile +++ /dev/null @@ -1,23 +0,0 @@ -PROG = Swap.dll -DEF_FILE = ../Codec.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib - -SWAP_OBJS = \ - $O\DllExports.obj \ - -SWAP_OPT_OBJS = \ - $O\ByteSwap.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(SWAP_OBJS) \ - $(SWAP_OPT_OBJS) \ - $O\resource.res - -!include "../../../Build.mak" - -$(SWAP_OBJS): $(*B).cpp - $(COMPL) -$(SWAP_OPT_OBJS): $(*B).cpp - $(COMPL_O2) diff --git a/7zip/Compress/ByteSwap/resource.rc b/7zip/Compress/ByteSwap/resource.rc deleted file mode 100755 index 21c0c505..00000000 --- a/7zip/Compress/ByteSwap/resource.rc +++ /dev/null @@ -1,3 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("SWAP filter Codec", "SWAP") diff --git a/7zip/Compress/Codec.def b/7zip/Compress/Codec.def deleted file mode 100755 index ebf73a3b..00000000 --- a/7zip/Compress/Codec.def +++ /dev/null @@ -1,4 +0,0 @@ -EXPORTS - CreateObject PRIVATE - GetNumberOfMethods PRIVATE - GetMethodProperty PRIVATE diff --git a/7zip/Compress/Copy/Copy.dsp b/7zip/Compress/Copy/Copy.dsp deleted file mode 100755 index 099a433d..00000000 --- a/7zip/Compress/Copy/Copy.dsp +++ /dev/null @@ -1,149 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Copy" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Copy - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Copy.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Copy.mak" CFG="Copy - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Copy - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Copy - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Copy - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COPY_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COPY_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-zip\Codecs\Copy.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Copy - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COPY_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COPY_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-zip\Codecs\Copy.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Copy - Win32 Release" -# Name "Copy - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Codec.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# End Group -# Begin Group "7-Zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=.\CopyCoder.h -# End Source File -# End Target -# End Project diff --git a/7zip/Compress/Copy/Copy.dsw b/7zip/Compress/Copy/Copy.dsw deleted file mode 100755 index 53ddf6cf..00000000 --- a/7zip/Compress/Copy/Copy.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Copy"=".\Copy.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Compress/Copy/CopyCoder.cpp b/7zip/Compress/Copy/CopyCoder.cpp deleted file mode 100755 index ce1bde03..00000000 --- a/7zip/Compress/Copy/CopyCoder.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// Compress/CopyCoder.cpp - -#include "StdAfx.h" - -#include "CopyCoder.h" -#include "../../../Common/Alloc.h" -#include "../../Common/StreamUtils.h" - -namespace NCompress { - -static const UInt32 kBufferSize = 1 << 17; - -CCopyCoder::~CCopyCoder() -{ - ::MidFree(_buffer); -} - -STDMETHODIMP CCopyCoder::Code(ISequentialInStream *inStream, - ISequentialOutStream *outStream, - const UInt64 * /* inSize */, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - if (_buffer == 0) - { - _buffer = (Byte *)::MidAlloc(kBufferSize); - if (_buffer == 0) - return E_OUTOFMEMORY; - } - - TotalSize = 0; - for (;;) - { - UInt32 realProcessedSize; - UInt32 size = kBufferSize; - if (outSize != 0) - if (size > *outSize - TotalSize) - size = (UInt32)(*outSize - TotalSize); - RINOK(inStream->Read(_buffer, size, &realProcessedSize)); - if(realProcessedSize == 0) - break; - RINOK(WriteStream(outStream, _buffer, realProcessedSize, NULL)); - TotalSize += realProcessedSize; - if (progress != NULL) - { - RINOK(progress->SetRatioInfo(&TotalSize, &TotalSize)); - } - } - return S_OK; -} - -} - diff --git a/7zip/Compress/Copy/CopyCoder.h b/7zip/Compress/Copy/CopyCoder.h deleted file mode 100755 index d2a26a89..00000000 --- a/7zip/Compress/Copy/CopyCoder.h +++ /dev/null @@ -1,31 +0,0 @@ -// Compress/CopyCoder.h - -#ifndef __COMPRESS_COPYCODER_H -#define __COMPRESS_COPYCODER_H - -#include "../../ICoder.h" -#include "../../../Common/MyCom.h" - -namespace NCompress { - -class CCopyCoder: - public ICompressCoder, - public CMyUnknownImp -{ - Byte *_buffer; -public: - UInt64 TotalSize; - CCopyCoder(): TotalSize(0) , _buffer(0) {}; - ~CCopyCoder(); - - MY_UNKNOWN_IMP - - STDMETHOD(Code)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, - const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); -}; - -} - -#endif diff --git a/7zip/Compress/Copy/DllExports.cpp b/7zip/Compress/Copy/DllExports.cpp deleted file mode 100755 index 756dcc9c..00000000 --- a/7zip/Compress/Copy/DllExports.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "../../../Common/MyInitGuid.h" -#include "../../../Common/ComTry.h" - -#include "CopyCoder.h" - -// {23170F69-40C1-278B-0000-000000000000} -DEFINE_GUID(CLSID_CCompressCopyCoder, -0x23170F69, 0x40C1, 0x278B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /*lpReserved*/) -{ - return TRUE; -} - -STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*clsid != CLSID_CCompressCopyCoder) - return CLASS_E_CLASSNOTAVAILABLE; - if (*iid != IID_ICompressCoder) - return E_NOINTERFACE; - CMyComPtr coder = (ICompressCoder *)new NCompress::CCopyCoder(); - *outObject = coder.Detach(); - COM_TRY_END - return S_OK; -} - -STDAPI GetNumberOfMethods(UINT32 *numMethods) -{ - *numMethods = 1; - return S_OK; -} - -STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value) -{ - if (index != 0) - return E_INVALIDARG; - // ::VariantClear((tagVARIANT *)value); - switch(propID) - { - case NMethodPropID::kID: - { - const char id[] = { 0x0 }; - if ((value->bstrVal = ::SysAllocStringByteLen(id, sizeof(id))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NMethodPropID::kName: - { - if ((value->bstrVal = ::SysAllocString(L"Copy")) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NMethodPropID::kDecoder: - case NMethodPropID::kEncoder: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CCompressCopyCoder, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - } - return S_OK; -} diff --git a/7zip/Compress/Copy/StdAfx.cpp b/7zip/Compress/Copy/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Compress/Copy/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Compress/Copy/StdAfx.h b/7zip/Compress/Copy/StdAfx.h deleted file mode 100755 index 92239aeb..00000000 --- a/7zip/Compress/Copy/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Compress/Copy/makefile b/7zip/Compress/Copy/makefile deleted file mode 100755 index 8c108fbc..00000000 --- a/7zip/Compress/Copy/makefile +++ /dev/null @@ -1,30 +0,0 @@ -PROG = Copy.dll -DEF_FILE = ../Codec.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib - -COPY_OBJS = \ - $O\DllExports.obj \ - $O\CopyCoder.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - -7ZIP_COMMON_OBJS = \ - $O\StreamUtils.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(COPY_OBJS) \ - $(COMMON_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $O\resource.res - -!include "../../../Build.mak" - -$(COPY_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) diff --git a/7zip/Compress/Copy/resource.rc b/7zip/Compress/Copy/resource.rc deleted file mode 100755 index 234c85bf..00000000 --- a/7zip/Compress/Copy/resource.rc +++ /dev/null @@ -1,3 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Copy Codec", "Copy") diff --git a/7zip/Compress/Deflate/Deflate.dsp b/7zip/Compress/Deflate/Deflate.dsp deleted file mode 100755 index ef33fb8c..00000000 --- a/7zip/Compress/Deflate/Deflate.dsp +++ /dev/null @@ -1,295 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Deflate" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Deflate - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Deflate.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Deflate.mak" CFG="Deflate - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Deflate - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Deflate - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Deflate - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DEFLATE_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DEFLATE_EXPORTS" /D "_ST_MODE" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Codecs\Deflate.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Deflate - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DEFLATE_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DEFLATE_EXPORTS" /D "_ST_MODE" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Codecs\Deflate.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Deflate - Win32 Release" -# Name "Deflate - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Codec.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Huffman" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Huffman\HuffmanDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\Huffman\HuffmanEncoder.cpp - -!IF "$(CFG)" == "Deflate - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Deflate - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\Huffman\HuffmanEncoder.h -# End Source File -# End Group -# Begin Group "Interface" - -# PROP Default_Filter "" -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LSBFDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LSBFDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LSBFEncoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LSBFEncoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# End Group -# Begin Group "LZ" - -# PROP Default_Filter "" -# Begin Group "BinTree" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\LZ\BinTree\BinTree.h -# End Source File -# Begin Source File - -SOURCE=..\LZ\BinTree\BinTree3Z.h -# End Source File -# Begin Source File - -SOURCE=..\LZ\BinTree\BinTreeMain.h -# End Source File -# End Group -# Begin Source File - -SOURCE=..\LZ\IMatchFinder.h -# End Source File -# Begin Source File - -SOURCE=..\LZ\LZInWindow.cpp -# End Source File -# Begin Source File - -SOURCE=..\LZ\LZInWindow.h -# End Source File -# Begin Source File - -SOURCE=..\LZ\LZOutWindow.cpp -# End Source File -# Begin Source File - -SOURCE=..\LZ\LZOutWindow.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\DeflateConst.h -# End Source File -# Begin Source File - -SOURCE=.\DeflateDecoder.cpp - -!IF "$(CFG)" == "Deflate - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Deflate - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\DeflateDecoder.h -# End Source File -# Begin Source File - -SOURCE=.\DeflateEncoder.cpp - -!IF "$(CFG)" == "Deflate - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Deflate - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\DeflateEncoder.h -# End Source File -# End Target -# End Project diff --git a/7zip/Compress/Deflate/Deflate.dsw b/7zip/Compress/Deflate/Deflate.dsw deleted file mode 100755 index f17203ed..00000000 --- a/7zip/Compress/Deflate/Deflate.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Deflate"=.\Deflate.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Compress/Deflate/DeflateConst.h b/7zip/Compress/Deflate/DeflateConst.h deleted file mode 100755 index 766b589a..00000000 --- a/7zip/Compress/Deflate/DeflateConst.h +++ /dev/null @@ -1,134 +0,0 @@ -// DeflateConst.h - -#ifndef __DEFLATE_CONST_H -#define __DEFLATE_CONST_H - -namespace NCompress { -namespace NDeflate { - -const int kNumHuffmanBits = 15; - -const UInt32 kHistorySize32 = (1 << 15); -const UInt32 kHistorySize64 = (1 << 16); - -const UInt32 kDistTableSize32 = 30; -const UInt32 kDistTableSize64 = 32; - -const UInt32 kNumLenSymbols32 = 256; -const UInt32 kNumLenSymbols64 = 255; // don't change it. It must be <= 255. -const UInt32 kNumLenSymbolsMax = kNumLenSymbols32; - -const UInt32 kNumLenSlots = 29; - -const UInt32 kFixedDistTableSize = 32; -const UInt32 kFixedLenTableSize = 31; - -const UInt32 kSymbolEndOfBlock = 0x100; -const UInt32 kSymbolMatch = kSymbolEndOfBlock + 1; - -const UInt32 kMainTableSize = kSymbolMatch + kNumLenSlots; -const UInt32 kFixedMainTableSize = kSymbolMatch + kFixedLenTableSize; - -const UInt32 kLevelTableSize = 19; - -const UInt32 kTableDirectLevels = 16; -const UInt32 kTableLevelRepNumber = kTableDirectLevels; -const UInt32 kTableLevel0Number = kTableLevelRepNumber + 1; -const UInt32 kTableLevel0Number2 = kTableLevel0Number + 1; - -const UInt32 kLevelMask = 0xF; - -const Byte kLenStart32[kFixedLenTableSize] = - {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, 255, 0, 0}; -const Byte kLenStart64[kFixedLenTableSize] = - {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, 0, 0, 0}; - -const Byte kLenDirectBits32[kFixedLenTableSize] = - {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, 0, 0, 0}; -const Byte kLenDirectBits64[kFixedLenTableSize] = - {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, 16, 0, 0}; - -const UInt32 kDistStart[kDistTableSize64] = - {0,1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256,384,512,768, - 1024,1536,2048,3072,4096,6144,8192,12288,16384,24576,32768,49152}; -const Byte kDistDirectBits[kDistTableSize64] = - {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}; - -const Byte kLevelDirectBits[3] = {2, 3, 7}; - -const Byte kCodeLengthAlphabetOrder[kLevelTableSize] = {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - -const UInt32 kMatchMinLen = 3; -const UInt32 kMatchMaxLen32 = kNumLenSymbols32 + kMatchMinLen - 1; //256 + 2 -const UInt32 kMatchMaxLen64 = kNumLenSymbols64 + kMatchMinLen - 1; //255 + 2 -const UInt32 kMatchMaxLen = kMatchMaxLen32; - -const int kFinalBlockFieldSize = 1; - -namespace NFinalBlockField -{ - enum - { - kNotFinalBlock = 0, - kFinalBlock = 1 - }; -} - -const int kBlockTypeFieldSize = 2; - -namespace NBlockType -{ - enum - { - kStored = 0, - kFixedHuffman = 1, - kDynamicHuffman = 2 - }; -} - -const int kNumLenCodesFieldSize = 5; -const int kNumDistCodesFieldSize = 5; -const int kNumLevelCodesFieldSize = 4; - -const UInt32 kNumLitLenCodesMin = 257; -const UInt32 kNumDistCodesMin = 1; -const UInt32 kNumLevelCodesMin = 4; - -const int kLevelFieldSize = 3; - -const int kStoredBlockLengthFieldSize = 16; - -struct CLevels -{ - Byte litLenLevels[kFixedMainTableSize]; - Byte distLevels[kFixedDistTableSize]; - - void SubClear() - { - UInt32 i; - for(i = kNumLitLenCodesMin; i < kFixedMainTableSize; i++) - litLenLevels[i] = 0; - for(i = 0; i < kFixedDistTableSize; i++) - distLevels[i] = 0; - } - - void SetFixedLevels() - { - int i; - - for (i = 0; i < 144; i++) - litLenLevels[i] = 8; - for (; i < 256; i++) - litLenLevels[i] = 9; - for (; i < 280; i++) - litLenLevels[i] = 7; - for (; i < 288; i++) - litLenLevels[i] = 8; - for (i = 0; i < kFixedDistTableSize; i++) // test it: InfoZip only uses kDistTableSize - distLevels[i] = 5; - } -}; - -}} - -#endif diff --git a/7zip/Compress/Deflate/DeflateDecoder.cpp b/7zip/Compress/Deflate/DeflateDecoder.cpp deleted file mode 100755 index 0de5534b..00000000 --- a/7zip/Compress/Deflate/DeflateDecoder.cpp +++ /dev/null @@ -1,339 +0,0 @@ -// DeflateDecoder.cpp - -#include "StdAfx.h" - -#include "DeflateDecoder.h" - -namespace NCompress { -namespace NDeflate { -namespace NDecoder { - -static const int kLenIdFinished = -1; -static const int kLenIdNeedInit = -2; - -CCoder::CCoder(bool deflate64Mode, bool deflateNSIS): - _deflate64Mode(deflate64Mode), - _deflateNSIS(deflateNSIS), - _keepHistory(false) {} - -UInt32 CCoder::ReadBits(int numBits) -{ - return m_InBitStream.ReadBits(numBits); -} - -bool CCoder::DeCodeLevelTable(Byte *values, int numSymbols) -{ - int i = 0; - do - { - UInt32 number = m_LevelDecoder.DecodeSymbol(&m_InBitStream); - if (number < kTableDirectLevels) - values[i++] = (Byte)number; - else if (number < kLevelTableSize) - { - if (number == kTableLevelRepNumber) - { - if (i == 0) - return false; - int num = ReadBits(2) + 3; - for (; num > 0 && i < numSymbols; num--, i++) - values[i] = values[i - 1]; - } - else - { - int num; - if (number == kTableLevel0Number) - num = ReadBits(3) + 3; - else - num = ReadBits(7) + 11; - for (;num > 0 && i < numSymbols; num--) - values[i++] = 0; - } - } - else - return false; - } - while(i < numSymbols); - return true; -} - -#define RIF(x) { if (!(x)) return false; } - -bool CCoder::ReadTables(void) -{ - m_FinalBlock = (ReadBits(kFinalBlockFieldSize) == NFinalBlockField::kFinalBlock); - UInt32 blockType = ReadBits(kBlockTypeFieldSize); - if (blockType > NBlockType::kDynamicHuffman) - return false; - - if (blockType == NBlockType::kStored) - { - m_StoredMode = true; - UInt32 currentBitPosition = m_InBitStream.GetBitPosition(); - int numBitsForAlign = (int)(currentBitPosition > 0 ? (8 - currentBitPosition): 0); - ReadBits(numBitsForAlign); - m_StoredBlockSize = ReadBits(kStoredBlockLengthFieldSize); - if (_deflateNSIS) - return true; - return (m_StoredBlockSize == (UInt16)~ReadBits(kStoredBlockLengthFieldSize)); - } - - m_StoredMode = false; - - CLevels levels; - if (blockType == NBlockType::kFixedHuffman) - { - levels.SetFixedLevels(); - _numDistLevels = _deflate64Mode ? kDistTableSize64 : kDistTableSize32; - } - else - { - int numLitLenLevels = ReadBits(kNumLenCodesFieldSize) + kNumLitLenCodesMin; - _numDistLevels = ReadBits(kNumDistCodesFieldSize) + kNumDistCodesMin; - int numLevelCodes = ReadBits(kNumLevelCodesFieldSize) + kNumLevelCodesMin; - - if (!_deflate64Mode) - if (_numDistLevels > kDistTableSize32) - return false; - - Byte levelLevels[kLevelTableSize]; - for (int i = 0; i < kLevelTableSize; i++) - { - int position = kCodeLengthAlphabetOrder[i]; - if(i < numLevelCodes) - levelLevels[position] = (Byte)ReadBits(kLevelFieldSize); - else - levelLevels[position] = 0; - } - - RIF(m_LevelDecoder.SetCodeLengths(levelLevels)); - - Byte tmpLevels[kFixedMainTableSize + kFixedDistTableSize]; - if (!DeCodeLevelTable(tmpLevels, numLitLenLevels + _numDistLevels)) - return false; - - levels.SubClear(); - memcpy(levels.litLenLevels, tmpLevels, numLitLenLevels); - memcpy(levels.distLevels, tmpLevels + numLitLenLevels, _numDistLevels); - } - RIF(m_MainDecoder.SetCodeLengths(levels.litLenLevels)); - return m_DistDecoder.SetCodeLengths(levels.distLevels); -} - -HRESULT CCoder::CodeSpec(UInt32 curSize) -{ - if (_remainLen == kLenIdFinished) - return S_OK; - if (_remainLen == kLenIdNeedInit) - { - if (!_keepHistory) - if (!m_OutWindowStream.Create(_deflate64Mode ? kHistorySize64: kHistorySize32)) - return E_OUTOFMEMORY; - if (!m_InBitStream.Create(1 << 17)) - return E_OUTOFMEMORY; - m_OutWindowStream.Init(_keepHistory); - m_InBitStream.Init(); - m_FinalBlock = false; - _remainLen = 0; - _needReadTable = true; - } - - if (curSize == 0) - return S_OK; - - while(_remainLen > 0 && curSize > 0) - { - _remainLen--; - Byte b = m_OutWindowStream.GetByte(_rep0); - m_OutWindowStream.PutByte(b); - curSize--; - } - - while(curSize > 0) - { - if (_needReadTable) - { - if (m_FinalBlock) - { - _remainLen = kLenIdFinished; - break; - } - if (!ReadTables()) - return S_FALSE; - _needReadTable = false; - } - - if(m_StoredMode) - { - for (; m_StoredBlockSize > 0 && curSize > 0; m_StoredBlockSize--, curSize--) - m_OutWindowStream.PutByte((Byte)m_InBitStream.ReadBits(8)); - _needReadTable = (m_StoredBlockSize == 0); - continue; - } - while(curSize > 0) - { - if (m_InBitStream.NumExtraBytes > 4) - return S_FALSE; - - UInt32 number = m_MainDecoder.DecodeSymbol(&m_InBitStream); - if (number < 0x100) - { - m_OutWindowStream.PutByte((Byte)number); - curSize--; - continue; - } - else if (number == kSymbolEndOfBlock) - { - _needReadTable = true; - break; - } - else if (number < kMainTableSize) - { - number -= kSymbolMatch; - UInt32 len; - { - int numBits; - if (_deflate64Mode) - { - len = kLenStart64[number]; - numBits = kLenDirectBits64[number]; - } - else - { - len = kLenStart32[number]; - numBits = kLenDirectBits32[number]; - } - len += kMatchMinLen + m_InBitStream.ReadBits(numBits); - } - UInt32 locLen = len; - if (locLen > curSize) - locLen = (UInt32)curSize; - number = m_DistDecoder.DecodeSymbol(&m_InBitStream); - if (number >= _numDistLevels) - return S_FALSE; - UInt32 distance = kDistStart[number] + m_InBitStream.ReadBits(kDistDirectBits[number]); - if (!m_OutWindowStream.CopyBlock(distance, locLen)) - return S_FALSE; - curSize -= locLen; - len -= locLen; - if (len != 0) - { - _remainLen = (Int32)len; - _rep0 = distance; - break; - } - } - else - return S_FALSE; - } - } - return S_OK; -} - -HRESULT CCoder::CodeReal(ISequentialInStream *inStream, - ISequentialOutStream *outStream, - const UInt64 *, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - SetInStream(inStream); - m_OutWindowStream.SetStream(outStream); - SetOutStreamSize(outSize); - CCoderReleaser flusher(this); - - const UInt64 start = m_OutWindowStream.GetProcessedSize(); - for (;;) - { - UInt32 curSize = 1 << 18; - if (outSize != 0) - { - const UInt64 rem = *outSize - (m_OutWindowStream.GetProcessedSize() - start); - if (curSize > rem) - curSize = (UInt32)rem; - } - if (curSize == 0) - break; - RINOK(CodeSpec(curSize)); - if (_remainLen == kLenIdFinished) - break; - if (progress != NULL) - { - const UInt64 inSize = m_InBitStream.GetProcessedSize(); - const UInt64 nowPos64 = m_OutWindowStream.GetProcessedSize() - start; - RINOK(progress->SetRatioInfo(&inSize, &nowPos64)); - } - } - flusher.NeedFlush = false; - return Flush(); -} - - -#ifdef _NO_EXCEPTIONS - -#define DEFLATE_TRY_BEGIN -#define DEFLATE_TRY_END - -#else - -#define DEFLATE_TRY_BEGIN try { -#define DEFLATE_TRY_END } \ - catch(const CInBufferException &e) { return e.ErrorCode; } \ - catch(const CLZOutWindowException &e) { return e.ErrorCode; } \ - catch(...) { return S_FALSE; } - -#endif - -HRESULT CCoder::Code(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - DEFLATE_TRY_BEGIN - return CodeReal(inStream, outStream, inSize, outSize, progress); - DEFLATE_TRY_END -} - -STDMETHODIMP CCoder::GetInStreamProcessedSize(UInt64 *value) -{ - if (value == NULL) - return E_INVALIDARG; - *value = m_InBitStream.GetProcessedSize(); - return S_OK; -} - -STDMETHODIMP CCoder::SetInStream(ISequentialInStream *inStream) -{ - m_InBitStream.SetStream(inStream); - return S_OK; -} - -STDMETHODIMP CCoder::ReleaseInStream() -{ - m_InBitStream.ReleaseStream(); - return S_OK; -} - -STDMETHODIMP CCoder::SetOutStreamSize(const UInt64 * /* outSize */) -{ - _remainLen = kLenIdNeedInit; - m_OutWindowStream.Init(_keepHistory); - return S_OK; -} - -#ifdef _ST_MODE - -STDMETHODIMP CCoder::Read(void *data, UInt32 size, UInt32 *processedSize) -{ - DEFLATE_TRY_BEGIN - if (processedSize) - *processedSize = 0; - const UInt64 startPos = m_OutWindowStream.GetProcessedSize(); - m_OutWindowStream.SetMemStream((Byte *)data); - RINOK(CodeSpec(size)); - if (processedSize) - *processedSize = (UInt32)(m_OutWindowStream.GetProcessedSize() - startPos); - return Flush(); - DEFLATE_TRY_END -} - -#endif - -}}} diff --git a/7zip/Compress/Deflate/DeflateDecoder.h b/7zip/Compress/Deflate/DeflateDecoder.h deleted file mode 100755 index 99928b72..00000000 --- a/7zip/Compress/Deflate/DeflateDecoder.h +++ /dev/null @@ -1,134 +0,0 @@ -// DeflateDecoder.h - -#ifndef __DEFLATE_DECODER_H -#define __DEFLATE_DECODER_H - -#include "../../../Common/MyCom.h" - -#include "../../ICoder.h" -#include "../../Common/LSBFDecoder.h" -#include "../../Common/InBuffer.h" -#include "../LZ/LZOutWindow.h" -#include "../Huffman/HuffmanDecoder.h" - -#include "DeflateConst.h" - -namespace NCompress { -namespace NDeflate { -namespace NDecoder { - -class CCoder: - public ICompressCoder, - public ICompressGetInStreamProcessedSize, - #ifdef _ST_MODE - public ICompressSetInStream, - public ICompressSetOutStreamSize, - public ISequentialInStream, - #endif - public CMyUnknownImp -{ - CLZOutWindow m_OutWindowStream; - NStream::NLSBF::CDecoder m_InBitStream; - NCompress::NHuffman::CDecoder m_MainDecoder; - NCompress::NHuffman::CDecoder m_DistDecoder; - NCompress::NHuffman::CDecoder m_LevelDecoder; - - UInt32 m_StoredBlockSize; - - bool m_FinalBlock; - bool m_StoredMode; - UInt32 _numDistLevels; - - - bool _deflateNSIS; - bool _deflate64Mode; - bool _keepHistory; - Int32 _remainLen; - UInt32 _rep0; - bool _needReadTable; - - UInt32 ReadBits(int numBits); - - bool DeCodeLevelTable(Byte *values, int numSymbols); - bool ReadTables(); - - void ReleaseStreams() - { - m_OutWindowStream.ReleaseStream(); - ReleaseInStream(); - } - - HRESULT Flush() { return m_OutWindowStream.Flush(); } - class CCoderReleaser - { - CCoder *m_Coder; - public: - bool NeedFlush; - CCoderReleaser(CCoder *coder): m_Coder(coder), NeedFlush(true) {} - ~CCoderReleaser() - { - if (NeedFlush) - m_Coder->Flush(); - m_Coder->ReleaseStreams(); - } - }; - friend class CCoderReleaser; - - HRESULT CodeSpec(UInt32 curSize); -public: - CCoder(bool deflate64Mode, bool deflateNSIS = false); - void SetKeepHistory(bool keepHistory) { _keepHistory = keepHistory; } - - HRESULT CodeReal(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - #ifdef _ST_MODE - MY_UNKNOWN_IMP4( - ICompressGetInStreamProcessedSize, - ICompressSetInStream, - ICompressSetOutStreamSize, - ISequentialInStream - ) - #else - MY_UNKNOWN_IMP1( - ICompressGetInStreamProcessedSize) - #endif - - STDMETHOD(Code)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - STDMETHOD(SetInStream)(ISequentialInStream *inStream); - STDMETHOD(ReleaseInStream)(); - STDMETHOD(SetOutStreamSize)(const UInt64 *outSize); - - #ifdef _ST_MODE - STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); - #endif - - // IGetInStreamProcessedSize - STDMETHOD(GetInStreamProcessedSize)(UInt64 *value); -}; - -class CCOMCoder : public CCoder -{ -public: - CCOMCoder(): CCoder(false) {} -}; - -class CNsisCOMCoder : public CCoder -{ -public: - CNsisCOMCoder(): CCoder(false, true) {} -}; - -class CCOMCoder64 : public CCoder -{ -public: - CCOMCoder64(): CCoder(true) {} -}; - -}}} - -#endif diff --git a/7zip/Compress/Deflate/DeflateEncoder.cpp b/7zip/Compress/Deflate/DeflateEncoder.cpp deleted file mode 100755 index 8a0f4746..00000000 --- a/7zip/Compress/Deflate/DeflateEncoder.cpp +++ /dev/null @@ -1,885 +0,0 @@ -// DeflateEncoder.cpp - -#include "StdAfx.h" - -#include "DeflateEncoder.h" - -#include "Windows/Defs.h" -#include "Common/ComTry.h" -#include "../../../Common/Alloc.h" -#include "../LZ/BinTree/BinTree3Z.h" - -namespace NCompress { -namespace NDeflate { -namespace NEncoder { - -const int kNumDivPassesMax = 10; // [0, 16); ratio/speed/ram tradeoff; use big value for better compression ratio. -const UInt32 kNumTables = (1 << kNumDivPassesMax); - -static UInt32 kFixedHuffmanCodeBlockSizeMax = (1 << 8); // [0, (1 << 32)); ratio/speed tradeoff; use big value for better compression ratio. -static UInt32 kDivideCodeBlockSizeMin = (1 << 6); // [1, (1 << 32)); ratio/speed tradeoff; use small value for better compression ratio. -static UInt32 kDivideBlockSizeMin = (1 << 6); // [1, (1 << 32)); ratio/speed tradeoff; use small value for better compression ratio. - -static const UInt32 kMaxUncompressedBlockSize = ((1 << 16) - 1) * 1; // [1, (1 << 32)) -static const UInt32 kMatchArraySize = kMaxUncompressedBlockSize * 10; // [kMatchMaxLen * 2, (1 << 32)) -static const UInt32 kMatchArrayLimit = kMatchArraySize - kMatchMaxLen * 4 * sizeof(UInt16); -static const UInt32 kBlockUncompressedSizeThreshold = kMaxUncompressedBlockSize - - kMatchMaxLen - kNumOpts; - -static const int kMaxCodeBitLength = 15; -static const int kMaxLevelBitLength = 7; - -struct CMatchFinderException -{ - HRESULT ErrorCode; - CMatchFinderException(HRESULT errorCode): ErrorCode(errorCode) {} -}; - -static Byte kNoLiteralStatPrice = 13; -static Byte kNoLenStatPrice = 13; -static Byte kNoPosStatPrice = 6; - -static Byte g_LenSlots[kNumLenSymbolsMax]; -static Byte g_FastPos[1 << 9]; - -class CFastPosInit -{ -public: - CFastPosInit() - { - int i; - for(i = 0; i < kNumLenSlots; i++) - { - int c = kLenStart32[i]; - int j = 1 << kLenDirectBits32[i]; - for(int k = 0; k < j; k++, c++) - g_LenSlots[c] = (Byte)i; - } - - const int kFastSlots = 18; - int c = 0; - for (Byte slotFast = 0; slotFast < kFastSlots; slotFast++) - { - UInt32 k = (1 << kDistDirectBits[slotFast]); - for (UInt32 j = 0; j < k; j++, c++) - g_FastPos[c] = slotFast; - } - } -}; - -static CFastPosInit g_FastPosInit; - - -inline UInt32 GetPosSlot(UInt32 pos) -{ - if (pos < 0x200) - return g_FastPos[pos]; - return g_FastPos[pos >> 8] + 16; -} - -CCoder::CCoder(bool deflate64Mode): - m_Deflate64Mode(deflate64Mode), - m_NumPasses(1), - m_NumDivPasses(1), - m_NumFastBytes(32), - m_OnePosMatchesMemory(0), - m_DistanceMemory(0), - m_Created(false), - m_Values(0), - m_Tables(0), - m_MatchFinderCycles(0), - m_SetMfPasses(0) -{ - m_MatchMaxLen = deflate64Mode ? kMatchMaxLen64 : kMatchMaxLen32; - m_NumLenCombinations = deflate64Mode ? kNumLenSymbols64 : kNumLenSymbols32; - m_LenStart = deflate64Mode ? kLenStart64 : kLenStart32; - m_LenDirectBits = deflate64Mode ? kLenDirectBits64 : kLenDirectBits32; -} - -HRESULT CCoder::Create() -{ - COM_TRY_BEGIN - if (!m_MatchFinder) - { - NBT3Z::CMatchFinder *matchFinderSpec = new NBT3Z::CMatchFinder; - m_SetMfPasses = matchFinderSpec; - m_MatchFinder = matchFinderSpec; - if (m_MatchFinder == 0) - return E_OUTOFMEMORY; - } - if (m_Values == 0) - { - m_Values = (CCodeValue *)MyAlloc((kMaxUncompressedBlockSize) * sizeof(CCodeValue)); - if (m_Values == 0) - return E_OUTOFMEMORY; - } - if (m_Tables == 0) - { - m_Tables = (CTables *)MyAlloc((kNumTables) * sizeof(CTables)); - if (m_Tables == 0) - return E_OUTOFMEMORY; - } - - if (m_IsMultiPass) - { - if (m_OnePosMatchesMemory == 0) - { - m_OnePosMatchesMemory = (UInt16 *)::MidAlloc(kMatchArraySize * sizeof(UInt16)); - if (m_OnePosMatchesMemory == 0) - return E_OUTOFMEMORY; - } - } - else - { - if (m_DistanceMemory == 0) - { - m_DistanceMemory = (UInt16 *)MyAlloc((kMatchMaxLen + 2) * 2 * sizeof(UInt16)); - if (m_DistanceMemory == 0) - return E_OUTOFMEMORY; - m_MatchDistances = m_DistanceMemory; - } - } - - if (!m_Created) - { - RINOK(m_MatchFinder->Create(m_Deflate64Mode ? kHistorySize64 : kHistorySize32, - kNumOpts + kMaxUncompressedBlockSize, m_NumFastBytes, m_MatchMaxLen - m_NumFastBytes)); - if (!m_OutStream.Create(1 << 20)) - return E_OUTOFMEMORY; - if (!MainCoder.Create(kFixedMainTableSize, m_LenDirectBits, kSymbolMatch, kMaxCodeBitLength)) - return E_OUTOFMEMORY; - if (!DistCoder.Create(kDistTableSize64, kDistDirectBits, 0, kMaxCodeBitLength)) - return E_OUTOFMEMORY; - if (!LevelCoder.Create(kLevelTableSize, kLevelDirectBits, kTableDirectLevels, kMaxLevelBitLength)) - return E_OUTOFMEMORY; - } - if (m_MatchFinderCycles != 0 && m_SetMfPasses != 0) - m_SetMfPasses->SetNumPasses(m_MatchFinderCycles); - m_Created = true; - return S_OK; - COM_TRY_END -} - -// ICompressSetEncoderProperties2 -HRESULT CCoder::BaseSetEncoderProperties2(const PROPID *propIDs, - const PROPVARIANT *properties, UInt32 numProperties) -{ - for(UInt32 i = 0; i < numProperties; i++) - { - const PROPVARIANT &prop = properties[i]; - switch(propIDs[i]) - { - case NCoderPropID::kNumPasses: - if (prop.vt != VT_UI4) - return E_INVALIDARG; - m_NumDivPasses = prop.ulVal; - if (m_NumDivPasses == 0) - m_NumDivPasses = 1; - if (m_NumDivPasses == 1) - m_NumPasses = 1; - else if (m_NumDivPasses <= kNumDivPassesMax) - m_NumPasses = 2; - else - { - m_NumPasses = 2 + (m_NumDivPasses - kNumDivPassesMax); - m_NumDivPasses = kNumDivPassesMax; - } - break; - case NCoderPropID::kNumFastBytes: - if (prop.vt != VT_UI4) - return E_INVALIDARG; - m_NumFastBytes = prop.ulVal; - if(m_NumFastBytes < kMatchMinLen || m_NumFastBytes > m_MatchMaxLen) - return E_INVALIDARG; - break; - case NCoderPropID::kMatchFinderCycles: - { - if (prop.vt != VT_UI4) - return E_INVALIDARG; - m_MatchFinderCycles = prop.ulVal; - break; - } - default: - return E_INVALIDARG; - } - } - return S_OK; -} - -void CCoder::Free() -{ - ::MidFree(m_OnePosMatchesMemory); - m_OnePosMatchesMemory = 0; - ::MyFree(m_DistanceMemory); - m_DistanceMemory = 0; - ::MyFree(m_Values); - m_Values = 0; - ::MyFree(m_Tables); - m_Tables = 0; -} - -CCoder::~CCoder() -{ - Free(); -} - -void CCoder::GetMatches() -{ - if (m_IsMultiPass) - { - m_MatchDistances = m_OnePosMatchesMemory + m_Pos; - if (m_SecondPass) - { - m_Pos += *m_MatchDistances + 1; - return; - } - } - - UInt32 distanceTmp[kMatchMaxLen * 2 + 3]; - - HRESULT result = m_MatchFinder->GetMatches(distanceTmp); - if (result != S_OK) - throw CMatchFinderException(result); - UInt32 numPairs = distanceTmp[0]; - - *m_MatchDistances = (UInt16)numPairs; - - if (numPairs > 0) - { - UInt32 i = 1; - for(i = 1; i < numPairs; i += 2) - { - m_MatchDistances[i] = (UInt16)distanceTmp[i]; - m_MatchDistances[i + 1] = (UInt16)distanceTmp[i + 1]; - } - UInt32 len = distanceTmp[1 + numPairs - 2]; - if (len == m_NumFastBytes && m_NumFastBytes != m_MatchMaxLen) - m_MatchDistances[i - 2] = (UInt16)(len + m_MatchFinder->GetMatchLen(len - 1, - distanceTmp[1 + numPairs - 1], m_MatchMaxLen - len)); - } - if (m_IsMultiPass) - m_Pos += numPairs + 1; - if (!m_SecondPass) - m_AdditionalOffset++; -} - -void CCoder::MovePos(UInt32 num) -{ - if (!m_SecondPass && num > 0) - { - HRESULT result = m_MatchFinder->Skip(num); - if (result != S_OK) - throw CMatchFinderException(result); - m_AdditionalOffset += num; - } -} - -static const UInt32 kIfinityPrice = 0xFFFFFFF; - -UInt32 CCoder::Backward(UInt32 &backRes, UInt32 cur) -{ - m_OptimumEndIndex = cur; - UInt32 posMem = m_Optimum[cur].PosPrev; - UInt16 backMem = m_Optimum[cur].BackPrev; - do - { - UInt32 posPrev = posMem; - UInt16 backCur = backMem; - backMem = m_Optimum[posPrev].BackPrev; - posMem = m_Optimum[posPrev].PosPrev; - m_Optimum[posPrev].BackPrev = backCur; - m_Optimum[posPrev].PosPrev = (UInt16)cur; - cur = posPrev; - } - while(cur > 0); - backRes = m_Optimum[0].BackPrev; - m_OptimumCurrentIndex = m_Optimum[0].PosPrev; - return m_OptimumCurrentIndex; -} - -UInt32 CCoder::GetOptimal(UInt32 &backRes) -{ - if(m_OptimumEndIndex != m_OptimumCurrentIndex) - { - UInt32 len = m_Optimum[m_OptimumCurrentIndex].PosPrev - m_OptimumCurrentIndex; - backRes = m_Optimum[m_OptimumCurrentIndex].BackPrev; - m_OptimumCurrentIndex = m_Optimum[m_OptimumCurrentIndex].PosPrev; - return len; - } - m_OptimumCurrentIndex = m_OptimumEndIndex = 0; - - GetMatches(); - - UInt32 numDistancePairs = m_MatchDistances[0]; - if(numDistancePairs == 0) - return 1; - - const UInt16 *matchDistances = m_MatchDistances + 1; - UInt32 lenMain = matchDistances[numDistancePairs - 2]; - - if(lenMain > m_NumFastBytes) - { - backRes = matchDistances[numDistancePairs - 1]; - MovePos(lenMain - 1); - return lenMain; - } - m_Optimum[1].Price = m_LiteralPrices[m_MatchFinder->GetIndexByte(0 - m_AdditionalOffset)]; - m_Optimum[1].PosPrev = 0; - - m_Optimum[2].Price = kIfinityPrice; - m_Optimum[2].PosPrev = 1; - - - UInt32 offs = 0; - for(UInt32 i = kMatchMinLen; i <= lenMain; i++) - { - UInt32 distance = matchDistances[offs + 1]; - m_Optimum[i].PosPrev = 0; - m_Optimum[i].BackPrev = (UInt16)distance; - m_Optimum[i].Price = m_LenPrices[i - kMatchMinLen] + m_PosPrices[GetPosSlot(distance)]; - if (i == matchDistances[offs]) - offs += 2; - } - - UInt32 cur = 0; - UInt32 lenEnd = lenMain; - for (;;) - { - ++cur; - if(cur == lenEnd || cur == kNumOptsBase || m_Pos >= kMatchArrayLimit) - return Backward(backRes, cur); - GetMatches(); - matchDistances = m_MatchDistances + 1; - - UInt32 numDistancePairs = m_MatchDistances[0]; - UInt32 newLen = 0; - if(numDistancePairs != 0) - { - newLen = matchDistances[numDistancePairs - 2]; - if(newLen > m_NumFastBytes) - { - UInt32 len = Backward(backRes, cur); - m_Optimum[cur].BackPrev = matchDistances[numDistancePairs - 1]; - m_OptimumEndIndex = cur + newLen; - m_Optimum[cur].PosPrev = (UInt16)m_OptimumEndIndex; - MovePos(newLen - 1); - return len; - } - } - UInt32 curPrice = m_Optimum[cur].Price; - UInt32 curAnd1Price = curPrice + m_LiteralPrices[m_MatchFinder->GetIndexByte(cur - m_AdditionalOffset)]; - COptimal &optimum = m_Optimum[cur + 1]; - if (curAnd1Price < optimum.Price) - { - optimum.Price = curAnd1Price; - optimum.PosPrev = (UInt16)cur; - } - if(numDistancePairs == 0) - continue; - while(lenEnd < cur + newLen) - m_Optimum[++lenEnd].Price = kIfinityPrice; - offs = 0; - UInt32 distance = matchDistances[offs + 1]; - curPrice += m_PosPrices[GetPosSlot(distance)]; - for(UInt32 lenTest = kMatchMinLen; ; lenTest++) - { - UInt32 curAndLenPrice = curPrice + m_LenPrices[lenTest - kMatchMinLen]; - COptimal &optimum = m_Optimum[cur + lenTest]; - if (curAndLenPrice < optimum.Price) - { - optimum.Price = curAndLenPrice; - optimum.PosPrev = (UInt16)cur; - optimum.BackPrev = (UInt16)distance; - } - if (lenTest == matchDistances[offs]) - { - offs += 2; - if (offs == numDistancePairs) - break; - curPrice -= m_PosPrices[GetPosSlot(distance)]; - distance = matchDistances[offs + 1]; - curPrice += m_PosPrices[GetPosSlot(distance)]; - } - } - } -} - -void CTables::InitStructures() -{ - UInt32 i; - for(i = 0; i < 256; i++) - litLenLevels[i] = 8; - litLenLevels[i++] = 13; - for(;i < kFixedMainTableSize; i++) - litLenLevels[i] = 5; - for(i = 0; i < kFixedDistTableSize; i++) - distLevels[i] = 5; -} - -void CCoder::CodeLevelTable(NStream::NLSBF::CEncoder *outStream, const Byte *levels, int numLevels) -{ - int prevLen = 0xFF; - int nextLen = levels[0]; - int count = 0; - int maxCount = 7; - int minCount = 4; - if (nextLen == 0) - { - maxCount = 138; - minCount = 3; - } - for (int n = 0; n < numLevels; n++) - { - int curLen = nextLen; - nextLen = (n < numLevels - 1) ? levels[n + 1] : 0xFF; - count++; - if (count < maxCount && curLen == nextLen) - continue; - - if (count < minCount) - for(int i = 0; i < count; i++) - if (outStream != 0) - LevelCoder.CodeOneValue(outStream, curLen); - else - LevelCoder.AddSymbol(curLen); - else if (curLen != 0) - { - if (curLen != prevLen) - { - if (outStream != 0) - LevelCoder.CodeOneValue(outStream, curLen); - else - LevelCoder.AddSymbol(curLen); - count--; - } - if (outStream != 0) - { - LevelCoder.CodeOneValue(outStream, kTableLevelRepNumber); - outStream->WriteBits(count - 3, 2); - } - else - LevelCoder.AddSymbol(kTableLevelRepNumber); - } - else if (count <= 10) - if (outStream != 0) - { - LevelCoder.CodeOneValue(outStream, kTableLevel0Number); - outStream->WriteBits(count - 3, 3); - } - else - LevelCoder.AddSymbol(kTableLevel0Number); - else - if (outStream != 0) - { - LevelCoder.CodeOneValue(outStream, kTableLevel0Number2); - outStream->WriteBits(count - 11, 7); - } - else - LevelCoder.AddSymbol(kTableLevel0Number2); - - count = 0; - prevLen = curLen; - - if (nextLen == 0) - { - maxCount = 138; - minCount = 3; - } - else if (curLen == nextLen) - { - maxCount = 6; - minCount = 3; - } - else - { - maxCount = 7; - minCount = 4; - } - } -} - -void CCoder::MakeTables() -{ - MainCoder.BuildTree(m_NewLevels.litLenLevels); - DistCoder.BuildTree(m_NewLevels.distLevels); - MainCoder.ReverseBits(); - DistCoder.ReverseBits(); -} - -UInt32 CCoder::GetLzBlockPrice() -{ - LevelCoder.StartNewBlock(); - - m_NumLitLenLevels = kMainTableSize; - while(m_NumLitLenLevels > kNumLitLenCodesMin && m_NewLevels.litLenLevels[m_NumLitLenLevels - 1] == 0) - m_NumLitLenLevels--; - - m_NumDistLevels = kDistTableSize64; - while(m_NumDistLevels > kNumDistCodesMin && m_NewLevels.distLevels[m_NumDistLevels - 1] == 0) - m_NumDistLevels--; - - CodeLevelTable(0, m_NewLevels.litLenLevels, m_NumLitLenLevels); - CodeLevelTable(0, m_NewLevels.distLevels, m_NumDistLevels); - - Byte levelLevels[kLevelTableSize]; - LevelCoder.BuildTree(levelLevels); - LevelCoder.ReverseBits(); - - m_NumLevelCodes = kNumLevelCodesMin; - for (UInt32 i = 0; i < kLevelTableSize; i++) - { - Byte level = levelLevels[kCodeLengthAlphabetOrder[i]]; - if (level > 0 && i >= m_NumLevelCodes) - m_NumLevelCodes = i + 1; - m_LevelLevels[i] = level; - } - - return MainCoder.GetBlockBitLength() + DistCoder.GetBlockBitLength() + LevelCoder.GetBlockBitLength() + - kNumLenCodesFieldSize + kNumDistCodesFieldSize + kNumLevelCodesFieldSize + - m_NumLevelCodes * kLevelFieldSize + kFinalBlockFieldSize + kBlockTypeFieldSize; -} - -void CCoder::TryBlock(bool staticMode) -{ - MainCoder.StartNewBlock(); - DistCoder.StartNewBlock(); - m_ValueIndex = 0; - UInt32 blockSize = BlockSizeRes; - BlockSizeRes = 0; - for (;;) - { - if (m_OptimumCurrentIndex == m_OptimumEndIndex) - { - if (m_Pos >= kMatchArrayLimit || BlockSizeRes >= blockSize || !m_SecondPass && - ((m_MatchFinder->GetNumAvailableBytes() == 0) || m_ValueIndex >= m_ValueBlockSize)) - break; - } - UInt32 pos; - UInt32 len = GetOptimal(pos); - CCodeValue &codeValue = m_Values[m_ValueIndex++]; - if (len >= kMatchMinLen) - { - UInt32 newLen = len - kMatchMinLen; - codeValue.Len = (UInt16)newLen; - MainCoder.AddSymbol(kSymbolMatch + g_LenSlots[newLen]); - codeValue.Pos = (UInt16)pos; - DistCoder.AddSymbol(GetPosSlot(pos)); - } - else - { - Byte b = m_MatchFinder->GetIndexByte(0 - m_AdditionalOffset); - MainCoder.AddSymbol(b); - codeValue.SetAsLiteral(); - codeValue.Pos = b; - } - m_AdditionalOffset -= len; - BlockSizeRes += len; - } - MainCoder.AddSymbol(kSymbolEndOfBlock); - if (!staticMode) - { - MakeTables(); - SetPrices(m_NewLevels); - } - m_AdditionalOffset += BlockSizeRes; - m_SecondPass = true; -} - -void CCoder::SetPrices(const CLevels &levels) -{ - UInt32 i; - for(i = 0; i < 256; i++) - { - Byte price = levels.litLenLevels[i]; - m_LiteralPrices[i] = ((price != 0) ? price : kNoLiteralStatPrice); - } - - for(i = 0; i < m_NumLenCombinations; i++) - { - UInt32 slot = g_LenSlots[i]; - Byte price = levels.litLenLevels[kSymbolMatch + slot]; - m_LenPrices[i] = (Byte)(((price != 0) ? price : kNoLenStatPrice) + m_LenDirectBits[slot]); - } - - for(i = 0; i < kDistTableSize64; i++) - { - Byte price = levels.distLevels[i]; - m_PosPrices[i] = (Byte)(((price != 0) ? price: kNoPosStatPrice) + kDistDirectBits[i]); - } -} - -void CCoder::WriteBlock() -{ - for (UInt32 i = 0; i < m_ValueIndex; i++) - { - const CCodeValue &codeValue = m_Values[i]; - if (codeValue.IsLiteral()) - MainCoder.CodeOneValue(&m_OutStream, codeValue.Pos); - else - { - UInt32 len = codeValue.Len; - UInt32 lenSlot = g_LenSlots[len]; - MainCoder.CodeOneValue(&m_OutStream, kSymbolMatch + lenSlot); - m_OutStream.WriteBits(len - m_LenStart[lenSlot], m_LenDirectBits[lenSlot]); - UInt32 dist = codeValue.Pos; - UInt32 posSlot = GetPosSlot(dist); - DistCoder.CodeOneValue(&m_OutStream, posSlot); - m_OutStream.WriteBits(dist - kDistStart[posSlot], kDistDirectBits[posSlot]); - } - } - MainCoder.CodeOneValue(&m_OutStream, kSymbolEndOfBlock); -} - -void CCoder::WriteDynBlock(bool finalBlock) -{ - m_OutStream.WriteBits((finalBlock ? NFinalBlockField::kFinalBlock: NFinalBlockField::kNotFinalBlock), kFinalBlockFieldSize); - m_OutStream.WriteBits(NBlockType::kDynamicHuffman, kBlockTypeFieldSize); - m_OutStream.WriteBits(m_NumLitLenLevels - kNumLitLenCodesMin, kNumLenCodesFieldSize); - m_OutStream.WriteBits(m_NumDistLevels - kNumDistCodesMin, kNumDistCodesFieldSize); - m_OutStream.WriteBits(m_NumLevelCodes - kNumLevelCodesMin, kNumLevelCodesFieldSize); - - for (UInt32 i = 0; i < m_NumLevelCodes; i++) - m_OutStream.WriteBits(m_LevelLevels[i], kLevelFieldSize); - - CodeLevelTable(&m_OutStream, m_NewLevels.litLenLevels, m_NumLitLenLevels); - CodeLevelTable(&m_OutStream, m_NewLevels.distLevels, m_NumDistLevels); - - WriteBlock(); -} - -void CCoder::WriteFixedBlock(bool finalBlock) -{ - int i; - for (i = 0; i < kFixedMainTableSize; i++) - MainCoder.SetFreq(i, (UInt32)1 << (kNumHuffmanBits - m_NewLevels.litLenLevels[i])); - for (i = 0; i < kFixedDistTableSize; i++) - DistCoder.SetFreq(i, (UInt32)1 << (kNumHuffmanBits - m_NewLevels.distLevels[i])); - MakeTables(); - - m_OutStream.WriteBits((finalBlock ? NFinalBlockField::kFinalBlock: NFinalBlockField::kNotFinalBlock), kFinalBlockFieldSize); - m_OutStream.WriteBits(NBlockType::kFixedHuffman, kBlockTypeFieldSize); - WriteBlock(); -} - -static UInt32 GetStorePrice(UInt32 blockSize, int bitPosition) -{ - UInt32 price = 0; - do - { - UInt32 nextBitPosition = (bitPosition + kFinalBlockFieldSize + kBlockTypeFieldSize) & 7; - int numBitsForAlign = nextBitPosition > 0 ? (8 - nextBitPosition): 0; - UInt32 curBlockSize = (blockSize < (1 << 16)) ? blockSize : (1 << 16) - 1; - price += kFinalBlockFieldSize + kBlockTypeFieldSize + numBitsForAlign + (2 + 2) * 8 + curBlockSize * 8; - bitPosition = 0; - blockSize -= curBlockSize; - } - while(blockSize != 0); - return price; -} - -void CCoder::WriteStoreBlock(UInt32 blockSize, UInt32 additionalOffset, bool finalBlock) -{ - do - { - UInt32 curBlockSize = (blockSize < (1 << 16)) ? blockSize : (1 << 16) - 1; - blockSize -= curBlockSize; - m_OutStream.WriteBits((finalBlock && (blockSize == 0) ? NFinalBlockField::kFinalBlock: NFinalBlockField::kNotFinalBlock), kFinalBlockFieldSize); - m_OutStream.WriteBits(NBlockType::kStored, kBlockTypeFieldSize); - m_OutStream.FlushByte(); - m_OutStream.WriteBits((UInt16)curBlockSize, kStoredBlockLengthFieldSize); - m_OutStream.WriteBits((UInt16)~curBlockSize, kStoredBlockLengthFieldSize); - const Byte *data = m_MatchFinder->GetPointerToCurrentPos() - additionalOffset; - for(UInt32 i = 0; i < curBlockSize; i++) - m_OutStream.WriteByte(data[i]); - additionalOffset -= curBlockSize; - } - while(blockSize != 0); -} - -UInt32 CCoder::TryDynBlock(int tableIndex, UInt32 numPasses) -{ - CTables &t = m_Tables[tableIndex]; - BlockSizeRes = t.BlockSizeRes; - m_Pos = t.m_Pos; - SetPrices(t); - - for (UInt32 p = 0; p < numPasses; p++) - { - UInt32 posTemp = m_Pos; - TryBlock(false); - if (p != numPasses - 1) - m_Pos = posTemp; - } - const UInt32 lzPrice = GetLzBlockPrice(); - (CLevels &)t = m_NewLevels; - return lzPrice; -} - -UInt32 CCoder::TryFixedBlock(int tableIndex) -{ - CTables &t = m_Tables[tableIndex]; - BlockSizeRes = t.BlockSizeRes; - m_Pos = t.m_Pos; - m_NewLevels.SetFixedLevels(); - SetPrices(m_NewLevels); - - TryBlock(true); - return kFinalBlockFieldSize + kBlockTypeFieldSize + - MainCoder.GetPrice(m_NewLevels.litLenLevels) + - DistCoder.GetPrice(m_NewLevels.distLevels); -} - -UInt32 CCoder::GetBlockPrice(int tableIndex, int numDivPasses) -{ - CTables &t = m_Tables[tableIndex]; - t.StaticMode = false; - UInt32 price = TryDynBlock(tableIndex, m_NumPasses); - t.BlockSizeRes = BlockSizeRes; - UInt32 numValues = m_ValueIndex; - UInt32 posTemp = m_Pos; - UInt32 additionalOffsetEnd = m_AdditionalOffset; - - if (m_CheckStatic && m_ValueIndex <= kFixedHuffmanCodeBlockSizeMax) - { - const UInt32 fixedPrice = TryFixedBlock(tableIndex); - t.StaticMode = (fixedPrice < price); - if (t.StaticMode) - price = fixedPrice; - } - - const UInt32 storePrice = GetStorePrice(BlockSizeRes, 0); // bitPosition - t.StoreMode = (storePrice <= price); - if (t.StoreMode) - price = storePrice; - - t.UseSubBlocks = false; - - if (numDivPasses > 1 && numValues >= kDivideCodeBlockSizeMin) - { - CTables &t0 = m_Tables[(tableIndex << 1)]; - (CLevels &)t0 = t; - t0.BlockSizeRes = t.BlockSizeRes >> 1; - t0.m_Pos = t.m_Pos; - UInt32 subPrice = GetBlockPrice((tableIndex << 1), numDivPasses - 1); - - UInt32 blockSize2 = t.BlockSizeRes - t0.BlockSizeRes; - if (t0.BlockSizeRes >= kDivideBlockSizeMin && blockSize2 >= kDivideBlockSizeMin) - { - CTables &t1 = m_Tables[(tableIndex << 1) + 1]; - (CLevels &)t1 = t; - t1.BlockSizeRes = blockSize2; - t1.m_Pos = m_Pos; - m_AdditionalOffset -= t0.BlockSizeRes; - subPrice += GetBlockPrice((tableIndex << 1) + 1, numDivPasses - 1); - t.UseSubBlocks = (subPrice < price); - if (t.UseSubBlocks) - price = subPrice; - } - } - m_AdditionalOffset = additionalOffsetEnd; - m_Pos = posTemp; - return price; -} - -void CCoder::CodeBlock(int tableIndex, bool finalBlock) -{ - CTables &t = m_Tables[tableIndex]; - if (t.UseSubBlocks) - { - CodeBlock((tableIndex << 1), false); - CodeBlock((tableIndex << 1) + 1, finalBlock); - } - else - { - if (t.StoreMode) - WriteStoreBlock(t.BlockSizeRes, m_AdditionalOffset, finalBlock); - else - if (t.StaticMode) - { - TryFixedBlock(tableIndex); - WriteFixedBlock(finalBlock); - } - else - { - if (m_NumDivPasses > 1 || m_CheckStatic) - TryDynBlock(tableIndex, 1); - WriteDynBlock(finalBlock); - } - m_AdditionalOffset -= t.BlockSizeRes; - } -} - -HRESULT CCoder::CodeReal(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 * /* inSize */ , const UInt64 * /* outSize */ , - ICompressProgressInfo *progress) -{ - m_CheckStatic = (m_NumPasses != 1 || m_NumDivPasses != 1); - m_IsMultiPass = (m_CheckStatic || (m_NumPasses != 1 || m_NumDivPasses != 1)); - - RINOK(Create()); - - m_ValueBlockSize = (1 << 13) + (1 << 12) * m_NumDivPasses; - - UInt64 nowPos = 0; - - RINOK(m_MatchFinder->SetStream(inStream)); - RINOK(m_MatchFinder->Init()); - m_OutStream.SetStream(outStream); - m_OutStream.Init(); - - CCoderReleaser coderReleaser(this); - - m_OptimumEndIndex = m_OptimumCurrentIndex = 0; - - CTables &t = m_Tables[1]; - t.m_Pos = 0; - t.InitStructures(); - - m_AdditionalOffset = 0; - do - { - t.BlockSizeRes = kBlockUncompressedSizeThreshold; - m_SecondPass = false; - GetBlockPrice(1, m_NumDivPasses); - CodeBlock(1, m_MatchFinder->GetNumAvailableBytes() == 0); - nowPos += m_Tables[1].BlockSizeRes; - if (progress != NULL) - { - UInt64 packSize = m_OutStream.GetProcessedSize(); - RINOK(progress->SetRatioInfo(&nowPos, &packSize)); - } - } - while(m_MatchFinder->GetNumAvailableBytes() != 0); - return m_OutStream.Flush(); -} - -HRESULT CCoder::BaseCode(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - try { return CodeReal(inStream, outStream, inSize, outSize, progress); } - catch(CMatchFinderException &e) { return e.ErrorCode; } - catch(const COutBufferException &e) { return e.ErrorCode; } - catch(...) { return E_FAIL; } -} - -STDMETHODIMP CCOMCoder::Code(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress) - { return BaseCode(inStream, outStream, inSize, outSize, progress); } - -STDMETHODIMP CCOMCoder::SetCoderProperties(const PROPID *propIDs, - const PROPVARIANT *properties, UInt32 numProperties) - { return BaseSetEncoderProperties2(propIDs, properties, numProperties); } - -STDMETHODIMP CCOMCoder64::Code(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress) - { return BaseCode(inStream, outStream, inSize, outSize, progress); } - -STDMETHODIMP CCOMCoder64::SetCoderProperties(const PROPID *propIDs, - const PROPVARIANT *properties, UInt32 numProperties) - { return BaseSetEncoderProperties2(propIDs, properties, numProperties); } - -}}} - diff --git a/7zip/Compress/Deflate/DeflateEncoder.h b/7zip/Compress/Deflate/DeflateEncoder.h deleted file mode 100755 index eb2ffbf1..00000000 --- a/7zip/Compress/Deflate/DeflateEncoder.h +++ /dev/null @@ -1,210 +0,0 @@ -// DeflateEncoder.h - -#ifndef __DEFLATE_ENCODER_H -#define __DEFLATE_ENCODER_H - -#include "Common/MyCom.h" - -#include "../../ICoder.h" -#include "../../Common/LSBFEncoder.h" -#include "../LZ/IMatchFinder.h" -#include "../Huffman/HuffmanEncoder.h" - -#include "DeflateConst.h" - -namespace NCompress { -namespace NDeflate { -namespace NEncoder { - -struct CCodeValue -{ - UInt16 Len; - UInt16 Pos; - void SetAsLiteral() { Len = (1 << 15); } - bool IsLiteral() const { return ((Len & (1 << 15)) != 0); } -}; - -struct COptimal -{ - UInt32 Price; - UInt16 PosPrev; - UInt16 BackPrev; -}; - -const UInt32 kNumOptsBase = 1 << 12; -const UInt32 kNumOpts = kNumOptsBase + kMatchMaxLen; - -class CCoder; - -struct CTables: public CLevels -{ - bool UseSubBlocks; - bool StoreMode; - bool StaticMode; - UInt32 BlockSizeRes; - UInt32 m_Pos; - void InitStructures(); -}; - -class CCoder -{ - CMyComPtr m_MatchFinder; - NStream::NLSBF::CEncoder m_OutStream; - -public: - CCodeValue *m_Values; - - UInt16 *m_MatchDistances; - UInt32 m_NumFastBytes; - - UInt16 *m_OnePosMatchesMemory; - UInt16 *m_DistanceMemory; - - UInt32 m_Pos; - - int m_NumPasses; - int m_NumDivPasses; - bool m_CheckStatic; - bool m_IsMultiPass; - UInt32 m_ValueBlockSize; - - UInt32 m_NumLenCombinations; - UInt32 m_MatchMaxLen; - const Byte *m_LenStart; - const Byte *m_LenDirectBits; - - bool m_Created; - bool m_Deflate64Mode; - - NCompression::NHuffman::CEncoder MainCoder; - NCompression::NHuffman::CEncoder DistCoder; - NCompression::NHuffman::CEncoder LevelCoder; - - Byte m_LevelLevels[kLevelTableSize]; - int m_NumLitLenLevels; - int m_NumDistLevels; - UInt32 m_NumLevelCodes; - UInt32 m_ValueIndex; - - bool m_SecondPass; - UInt32 m_AdditionalOffset; - - UInt32 m_OptimumEndIndex; - UInt32 m_OptimumCurrentIndex; - - Byte m_LiteralPrices[256]; - Byte m_LenPrices[kNumLenSymbolsMax]; - Byte m_PosPrices[kDistTableSize64]; - - CLevels m_NewLevels; - UInt32 BlockSizeRes; - - CTables *m_Tables; - COptimal m_Optimum[kNumOpts]; - - UInt32 m_MatchFinderCycles; - IMatchFinderSetNumPasses *m_SetMfPasses; - - void GetMatches(); - void MovePos(UInt32 num); - UInt32 Backward(UInt32 &backRes, UInt32 cur); - UInt32 GetOptimal(UInt32 &backRes); - - void CodeLevelTable(NStream::NLSBF::CEncoder *outStream, const Byte *levels, int numLevels); - - void MakeTables(); - UInt32 GetLzBlockPrice(); - void TryBlock(bool staticMode); - UInt32 TryDynBlock(int tableIndex, UInt32 numPasses); - - UInt32 TryFixedBlock(int tableIndex); - - void SetPrices(const CLevels &levels); - void WriteBlock(); - void WriteDynBlock(bool finalBlock); - void WriteFixedBlock(bool finalBlock); - - - - HRESULT Create(); - void Free(); - - void WriteStoreBlock(UInt32 blockSize, UInt32 additionalOffset, bool finalBlock); - void WriteTables(bool writeMode, bool finalBlock); - - void WriteBlockData(bool writeMode, bool finalBlock); - - void ReleaseStreams() - { - // m_MatchFinder.ReleaseStream(); - m_OutStream.ReleaseStream(); - } - class CCoderReleaser - { - CCoder *m_Coder; - public: - CCoderReleaser(CCoder *coder): m_Coder(coder) {} - ~CCoderReleaser() { m_Coder->ReleaseStreams(); } - }; - friend class CCoderReleaser; - - UInt32 GetBlockPrice(int tableIndex, int numDivPasses); - void CodeBlock(int tableIndex, bool finalBlock); - -public: - CCoder(bool deflate64Mode = false); - ~CCoder(); - - HRESULT CodeReal(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - HRESULT BaseCode(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - // ICompressSetCoderProperties - HRESULT BaseSetEncoderProperties2(const PROPID *propIDs, - const PROPVARIANT *properties, UInt32 numProperties); -}; - -/////////////////////////////////////////////////////////////// - -class CCOMCoder : - public ICompressCoder, - public ICompressSetCoderProperties, - public CMyUnknownImp, - public CCoder -{ -public: - MY_UNKNOWN_IMP1(ICompressSetCoderProperties) - CCOMCoder(): CCoder(false) {}; - STDMETHOD(Code)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - // ICompressSetCoderProperties - STDMETHOD(SetCoderProperties)(const PROPID *propIDs, - const PROPVARIANT *properties, UInt32 numProperties); -}; - -class CCOMCoder64 : - public ICompressCoder, - public ICompressSetCoderProperties, - public CMyUnknownImp, - public CCoder -{ -public: - MY_UNKNOWN_IMP1(ICompressSetCoderProperties) - CCOMCoder64(): CCoder(true) {}; - STDMETHOD(Code)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - // ICompressSetCoderProperties - STDMETHOD(SetCoderProperties)(const PROPID *propIDs, - const PROPVARIANT *properties, UInt32 numProperties); -}; - - -}}} - -#endif diff --git a/7zip/Compress/Deflate/DllExports.cpp b/7zip/Compress/Deflate/DllExports.cpp deleted file mode 100755 index acc431ff..00000000 --- a/7zip/Compress/Deflate/DllExports.cpp +++ /dev/null @@ -1,145 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" - -#include "DeflateEncoder.h" -#include "DeflateDecoder.h" - - -// {23170F69-40C1-278B-0401-080000000000} -DEFINE_GUID(CLSID_CCompressDeflateDecoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0401-090000000000} -DEFINE_GUID(CLSID_CCompressDeflate64Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0401-080000000100} -DEFINE_GUID(CLSID_CCompressDeflateEncoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00); - -// {23170F69-40C1-278B-0401-090000000100} -DEFINE_GUID(CLSID_CCompressDeflate64Encoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00); - - -// {23170F69-40C1-278B-0409-010000000000} -DEFINE_GUID(CLSID_CCompressDeflateNsisDecoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x09, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /*lpReserved*/) -{ - return TRUE; -} - -STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - int correctInterface = (*iid == IID_ICompressCoder); - CMyComPtr coder; - if (*clsid == CLSID_CCompressDeflateDecoder) - { - if (!correctInterface) - return E_NOINTERFACE; - coder = (ICompressCoder *)new NCompress::NDeflate::NDecoder::CCOMCoder(); - } - else if (*clsid == CLSID_CCompressDeflateNsisDecoder) - { - if (!correctInterface) - return E_NOINTERFACE; - coder = (ICompressCoder *)new NCompress::NDeflate::NDecoder::CNsisCOMCoder(); - } - else if (*clsid == CLSID_CCompressDeflateEncoder) - { - if (!correctInterface) - return E_NOINTERFACE; - coder = (ICompressCoder *)new NCompress::NDeflate::NEncoder::CCOMCoder(); - } - else if (*clsid == CLSID_CCompressDeflate64Decoder) - { - if (!correctInterface) - return E_NOINTERFACE; - coder = (ICompressCoder *)new NCompress::NDeflate::NDecoder::CCOMCoder64(); - } - else if (*clsid == CLSID_CCompressDeflate64Encoder) - { - if (!correctInterface) - return E_NOINTERFACE; - coder = (ICompressCoder *)new NCompress::NDeflate::NEncoder::CCOMCoder64(); - } - else - return CLASS_E_CLASSNOTAVAILABLE; - *outObject = coder.Detach(); - COM_TRY_END - return S_OK; -} - -struct CDeflateMethodItem -{ - char ID[3]; - const wchar_t *UserName; - const GUID *Decoder; - const GUID *Encoder; -}; - -#define METHOD_ITEM(Name, id, UserName) \ - { { 0x04, 0x01, id }, UserName, \ - &CLSID_CCompress ## Name ## Decoder, \ - &CLSID_CCompress ## Name ## Encoder } - -#define METHOD_ITEM_DE(Name, id1, id2, UserName) \ - { { 0x04, id1, id2 }, UserName, \ - &CLSID_CCompress ## Name ## Decoder, NULL } - - -static CDeflateMethodItem g_Methods[] = -{ - METHOD_ITEM(Deflate, 0x08, L"Deflate"), - METHOD_ITEM(Deflate64, 0x09, L"Deflate64"), - METHOD_ITEM_DE(DeflateNsis, 0x09, 0x01, L"DeflateNSIS") -}; - -STDAPI GetNumberOfMethods(UINT32 *numMethods) -{ - *numMethods = sizeof(g_Methods) / sizeof(g_Methods[0]); - return S_OK; -} - -STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value) -{ - if (index > sizeof(g_Methods) / sizeof(g_Methods[0])) - return E_INVALIDARG; - VariantClear((tagVARIANT *)value); - const CDeflateMethodItem &method = g_Methods[index]; - switch(propID) - { - case NMethodPropID::kID: - if ((value->bstrVal = ::SysAllocStringByteLen(method.ID, - sizeof(method.ID))) != 0) - value->vt = VT_BSTR; - return S_OK; - case NMethodPropID::kName: - if ((value->bstrVal = ::SysAllocString(method.UserName)) != 0) - value->vt = VT_BSTR; - return S_OK; - case NMethodPropID::kDecoder: - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)method.Decoder, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - case NMethodPropID::kEncoder: - if (method.Encoder) - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)method.Encoder, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - } - return S_OK; - } - return S_OK; -} diff --git a/7zip/Compress/Deflate/StdAfx.cpp b/7zip/Compress/Deflate/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Compress/Deflate/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Compress/Deflate/StdAfx.h b/7zip/Compress/Deflate/StdAfx.h deleted file mode 100755 index e7fb6986..00000000 --- a/7zip/Compress/Deflate/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Compress/Deflate/makefile b/7zip/Compress/Deflate/makefile deleted file mode 100755 index 74e243d6..00000000 --- a/7zip/Compress/Deflate/makefile +++ /dev/null @@ -1,51 +0,0 @@ -PROG = Deflate.dll -DEF_FILE = ../Codec.def -CFLAGS = $(CFLAGS) -I ../../../ -D_ST_MODE -LIBS = $(LIBS) oleaut32.lib - -DEFLATE_OBJS = \ - $O\DllExports.obj \ - -DEFLATE_OPT_OBJS = \ - $O\DeflateDecoder.obj \ - $O\DeflateEncoder.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\CRC.obj \ - -7ZIP_COMMON_OBJS = \ - $O\InBuffer.obj \ - $O\OutBuffer.obj \ - $O\LSBFDecoder.obj \ - $O\LSBFEncoder.obj \ - -LZ_OBJS = \ - $O\LZInWindow.obj \ - $O\LZOutWindow.obj \ - - -OBJS = \ - $O\StdAfx.obj \ - $(DEFLATE_OBJS) \ - $(DEFLATE_OPT_OBJS) \ - $(COMMON_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(LZ_OBJS) \ - $O\HuffmanEncoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(DEFLATE_OBJS): $(*B).cpp - $(COMPL) -$(DEFLATE_OPT_OBJS): $(*B).cpp - $(COMPL_O2) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(LZ_OBJS): ../LZ/$(*B).cpp - $(COMPL) -$O\HuffmanEncoder.obj: ../Huffman/$(*B).cpp - $(COMPL_O2) diff --git a/7zip/Compress/Deflate/resource.rc b/7zip/Compress/Deflate/resource.rc deleted file mode 100755 index 910bc281..00000000 --- a/7zip/Compress/Deflate/resource.rc +++ /dev/null @@ -1,3 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Deflate Codec", "Deflate") diff --git a/7zip/Compress/Huffman/HuffmanDecoder.h b/7zip/Compress/Huffman/HuffmanDecoder.h deleted file mode 100755 index 57115197..00000000 --- a/7zip/Compress/Huffman/HuffmanDecoder.h +++ /dev/null @@ -1,88 +0,0 @@ -// Compress/HuffmanDecoder.h - -#ifndef __COMPRESS_HUFFMANDECODER_H -#define __COMPRESS_HUFFMANDECODER_H - -#include "../../../Common/Types.h" - -namespace NCompress { -namespace NHuffman { - -const int kNumTableBits = 9; - -template -class CDecoder -{ - UInt32 m_Limits[kNumBitsMax + 1]; // m_Limits[i] = value limit for symbols with length = i - UInt32 m_Positions[kNumBitsMax + 1]; // m_Positions[i] = index in m_Symbols[] of first symbol with length = i - UInt32 m_Symbols[m_NumSymbols]; - Byte m_Lengths[1 << kNumTableBits]; // Table oh length for short codes. - -public: - - bool SetCodeLengths(const Byte *codeLengths) - { - int lenCounts[kNumBitsMax + 1], tmpPositions[kNumBitsMax + 1]; - int i; - for(i = 1; i <= kNumBitsMax; i++) - lenCounts[i] = 0; - UInt32 symbol; - for (symbol = 0; symbol < m_NumSymbols; symbol++) - { - int len = codeLengths[symbol]; - if (len > kNumBitsMax) - return false; - lenCounts[len]++; - m_Symbols[symbol] = 0xFFFFFFFF; - } - lenCounts[0] = 0; - m_Positions[0] = m_Limits[0] = 0; - UInt32 startPos = 0; - UInt32 index = 0; - const UInt32 kMaxValue = (1 << kNumBitsMax); - for (i = 1; i <= kNumBitsMax; i++) - { - startPos += lenCounts[i] << (kNumBitsMax - i); - if (startPos > kMaxValue) - return false; - m_Limits[i] = (i == kNumBitsMax) ? kMaxValue : startPos; - m_Positions[i] = m_Positions[i - 1] + lenCounts[i - 1]; - tmpPositions[i] = m_Positions[i]; - if(i <= kNumTableBits) - { - UInt32 limit = (m_Limits[i] >> (kNumBitsMax - kNumTableBits)); - for (; index < limit; index++) - m_Lengths[index] = (Byte)i; - } - } - for (symbol = 0; symbol < m_NumSymbols; symbol++) - { - int len = codeLengths[symbol]; - if (len != 0) - m_Symbols[tmpPositions[len]++] = symbol; - } - return true; - } - - template - UInt32 DecodeSymbol(TBitDecoder *bitStream) - { - int numBits; - UInt32 value = bitStream->GetValue(kNumBitsMax); - if (value < m_Limits[kNumTableBits]) - numBits = m_Lengths[value >> (kNumBitsMax - kNumTableBits)]; - else - for (numBits = kNumTableBits + 1; value >= m_Limits[numBits]; numBits++); - bitStream->MovePos(numBits); - UInt32 index = m_Positions[numBits] + - ((value - m_Limits[numBits - 1]) >> (kNumBitsMax - numBits)); - if (index >= m_NumSymbols) - // throw CDecoderException(); // test it - return 0xFFFFFFFF; - return m_Symbols[index]; - } -}; - -}} - -#endif diff --git a/7zip/Compress/Huffman/HuffmanEncoder.cpp b/7zip/Compress/Huffman/HuffmanEncoder.cpp deleted file mode 100755 index c0e42799..00000000 --- a/7zip/Compress/Huffman/HuffmanEncoder.cpp +++ /dev/null @@ -1,325 +0,0 @@ -// Compression/HuffmanEncoder.cpp - -#include "StdAfx.h" - -#include "HuffmanEncoder.h" -#include "Common/Defs.h" -#include "Common/Alloc.h" - -namespace NCompression { -namespace NHuffman { - -static const char *kIncorrectBitLenCountsMessage = "Incorrect bit len counts"; - -CEncoder::CEncoder(): - m_Items(0), - m_Heap(0), - m_Depth(0) -{} - -void CEncoder::Free() -{ - MyFree(m_Items); - MyFree(m_Heap); - MyFree(m_Depth); - m_Items = 0; - m_Heap = 0; - m_Depth = 0; -} - -bool CEncoder::Create(UInt32 numSymbols, - const Byte *extraBits, UInt32 extraBase, UInt32 maxLength) -{ - m_NumSymbols = numSymbols; - m_ExtraBits = extraBits; - m_ExtraBase = extraBase; - m_MaxLength = maxLength; - m_HeapSize = numSymbols * 2 + 1; - Free(); - m_Items = (CItem *)MyAlloc(m_HeapSize * sizeof(CItem)); - m_Heap = (UInt32 *)MyAlloc(m_HeapSize * sizeof(UInt32)); - m_Depth = (Byte *)MyAlloc(m_HeapSize * sizeof(Byte)); - if (m_Items == 0 || m_Heap == 0 || m_Depth == 0) - { - Free(); - return false; - } - return true; -} - -CEncoder::~CEncoder() -{ - Free(); -} - -void CEncoder::StartNewBlock() -{ - for (UInt32 i = 0; i < m_NumSymbols; i++) - m_Items[i].Freq = 0; -} - -static const int kSmallest = 1; - -// =========================================================================== -// Remove the smallest element from the heap and recreate the heap with -// one less element. Updates heap and m_HeapLength. - -UInt32 CEncoder::RemoveSmallest() -{ - UInt32 top = m_Heap[kSmallest]; - m_Heap[kSmallest] = m_Heap[m_HeapLength--]; - DownHeap(kSmallest); - return top; -} - -// =========================================================================== -// Compares to subtrees, using the tree m_Depth as tie breaker when -// the subtrees have equal frequency. This minimizes the worst case length. - -bool CEncoder::Smaller(int n, int m) -{ - return (m_Items[n].Freq < m_Items[m].Freq || - (m_Items[n].Freq == m_Items[m].Freq && m_Depth[n] <= m_Depth[m])); -} - -// =========================================================================== -// Restore the m_Heap property by moving down the tree starting at node k, -// exchanging a node with the smallest of its two sons if necessary, stopping -// when the m_Heap property is re-established (each father CompareFreqs than its -// two sons). - -void CEncoder::DownHeap(UInt32 k) -{ - UInt32 symbol = m_Heap[k]; - for (UInt32 j = k << 1; j <= m_HeapLength;) // j: left son of k - { - // Set j to the smallest of the two sons: - if (j < m_HeapLength && Smaller(m_Heap[j+1], m_Heap[j])) - j++; - UInt32 htemp = m_Heap[j]; // htemp required because of bug in SASC compiler - if (Smaller(symbol, htemp)) // Exit if v is smaller than both sons - break; - m_Heap[k] = htemp; // Exchange v with the smallest son - k = j; - j <<= 1; // And continue down the tree, setting j to the left son of k - } - m_Heap[k] = symbol; -} - -// =========================================================================== -// Compute the optimal bit lengths for a tree and update the total bit length -// for the current block. -// IN assertion: the fields freq and dad are set, heap[heapMax] and -// above are the tree nodes sorted by increasing frequency. -// OUT assertions: the field len is set to the optimal bit length, the -// array m_BitLenCounters contains the frequencies for each bit length. -// The length m_BlockBitLength is updated; static_len is also updated if stree is -// not null. - -void CEncoder::GenerateBitLen(UInt32 maxCode, UInt32 heapMax) -{ - int overflow = 0; // number of elements with bit length too large - - for (UInt32 i = 0; i <= kNumBitsInLongestCode; i++) - m_BitLenCounters[i] = 0; - - /* In a first pass, compute the optimal bit lengths (which may - * overflow in the case of the bit length tree). - */ - m_Items[m_Heap[heapMax]].Len = 0; /* root of the heap */ - UInt32 h; /* heap index */ - for (h = heapMax+1; h < m_HeapSize; h++) - { - UInt32 symbol = m_Heap[h]; - UInt32 len = m_Items[m_Items[symbol].Dad].Len + 1; - if (len > m_MaxLength) - { - len = m_MaxLength; - overflow++; - } - m_Items[symbol].Len = len; // We overwrite m_Items[symbol].Dad which is no longer needed - if (symbol > maxCode) - continue; // not a leaf node - m_BitLenCounters[len]++; - UInt32 extraBits; - if (m_ExtraBits != 0 && symbol >= m_ExtraBase) - extraBits = m_ExtraBits[symbol - m_ExtraBase]; - else - extraBits = 0; - m_BlockBitLength += (m_Items[symbol].Freq * (len + extraBits)); - } - if (overflow == 0) - return; - - // This happens for example on obj2 and pic of the Calgary corpus - // Find the first bit length which could increase: - do - { - UInt32 bits = m_MaxLength-1; - while (m_BitLenCounters[bits] == 0) - bits--; - m_BitLenCounters[bits]--; // move one leaf down the m_Items - m_BitLenCounters[bits + 1] += 2; // move one overflow item as its brother - m_BitLenCounters[m_MaxLength]--; - // The brother of the overflow item also moves one step up, - // but this does not affect m_BitLenCounters[m_MaxLength] - overflow -= 2; - } - while (overflow > 0); - - // Now recompute all bit lengths, scanning in increasing frequency. - // h is still equal to HEAP_SIZE. (It is simpler to reconstruct all - // lengths instead of fixing only the wrong ones. This idea is taken - // from 'ar' written by Haruhiko Okumura.) - for (UInt32 bits = m_MaxLength; bits != 0; bits--) - { - UInt32 numNodes = m_BitLenCounters[bits]; - while (numNodes != 0) - { - UInt32 m = m_Heap[--h]; - if (m > maxCode) - continue; - if (m_Items[m].Len != (unsigned) bits) - { - m_BlockBitLength += ((long)bits - (long)m_Items[m].Len) * (long)m_Items[m].Freq; - m_Items[m].Len = bits; - } - numNodes--; - } - } -} - - -// =========================================================================== -// Generate the codes for a given tree and bit counts (which need not be -// optimal). -// IN assertion: the array m_BitLenCounters contains the bit length statistics for -// the given tree and the field len is set for all tree elements. -// OUT assertion: the field code is set for all tree elements of non -// zero code length. - -// UInt32 maxCode = largest code with non zero frequency - - -void CEncoder::GenerateCodes(UInt32 maxCode) -{ - UInt32 nextCodes[kNumBitsInLongestCode + 1]; // next code value for each bit length - UInt32 code = 0; // running code value - // The distribution counts are first used to generate the code values - // without bit reversal. - for (UInt32 bits = 1; bits <= kNumBitsInLongestCode; bits++) - nextCodes[bits] = code = (code + m_BitLenCounters[bits - 1]) << 1; - // Check that the bit counts in m_BitLenCounters are consistent. The last code - // must be all ones. - if (code + m_BitLenCounters[kNumBitsInLongestCode] - 1 != (1 << kNumBitsInLongestCode) - 1) - throw kIncorrectBitLenCountsMessage; - for (UInt32 n = 0; n <= maxCode; n++) - { - int len = m_Items[n].Len; - if (len == 0) - continue; - m_Items[n].Code = nextCodes[len]++; - } -} - - -// =========================================================================== -// Construct one Huffman tree and assigns the code bit strings and lengths. -// Update the total bit length for the current block. -// IN assertion: the field freq is set for all tree elements. -// OUT assertions: the fields len and code are set to the optimal bit length -// and corresponding code. The length m_BlockBitLength is updated; static_len is -// also updated if stree is not null. The field max_code is set. - -void CEncoder::BuildTree(Byte *levels) -{ - m_BlockBitLength = 0; - int maxCode = -1; // WAS = -1; largest code with non zero frequency */ - - // Construct the initial m_Heap, with least frequent element in - // m_Heap[kSmallest]. The sons of m_Heap[n] are m_Heap[2*n] and m_Heap[2*n+1]. - // m_Heap[0] is not used. - // - - m_HeapLength = 0; - UInt32 n; // iterate over m_Heap elements - for (n = 0; n < m_NumSymbols; n++) - { - if (m_Items[n].Freq != 0) - { - m_Heap[++m_HeapLength] = maxCode = n; - m_Depth[n] = 0; - } - else - m_Items[n].Len = 0; - } - - // The pkzip format requires that at least one distance code exists, - // and that at least one bit should be sent even if there is only one - // possible code. So to avoid special checks later on we force at least - // two codes of non zero frequency. - while (m_HeapLength < 2) - { - int aNewNode = m_Heap[++m_HeapLength] = (maxCode < 2 ? ++maxCode : 0); - m_Items[aNewNode].Freq = 1; - m_Depth[aNewNode] = 0; - m_BlockBitLength--; - // if (stree) static_len -= stree[aNewNode].Len; - // aNewNode is 0 or 1 so it does not have m_ExtraBits bits - } - - // The elements m_Heap[m_HeapLength/2+1 .. m_HeapLength] are leaves of the m_Items, - // establish sub-heaps of increasing lengths: - for (n = m_HeapLength / 2; n >= 1; n--) - DownHeap(n); - - // Construct the Huffman tree by repeatedly combining the least two - // frequent nodes. - int node = m_NumSymbols; // next internal node of the tree - UInt32 heapMax = m_NumSymbols * 2+ 1; - do - { - n = RemoveSmallest(); /* n = node of least frequency */ - UInt32 m = m_Heap[kSmallest]; /* m = node of next least frequency */ - - m_Heap[--heapMax] = n; /* keep the nodes sorted by frequency */ - m_Heap[--heapMax] = m; - - // Create a new node father of n and m - m_Items[node].Freq = m_Items[n].Freq + m_Items[m].Freq; - m_Depth[node] = (Byte) (MyMax(m_Depth[n], m_Depth[m]) + 1); - m_Items[n].Dad = m_Items[m].Dad = node; - // and insert the new node in the m_Heap - m_Heap[kSmallest] = node++; - DownHeap(kSmallest); - - } - while (m_HeapLength >= 2); - - m_Heap[--heapMax] = m_Heap[kSmallest]; - - // At this point, the fields freq and dad are set. We can now - // generate the bit lengths. - GenerateBitLen(maxCode, heapMax); - - // The field len is now set, we can generate the bit codes - GenerateCodes (maxCode); - - for (n = 0; n < m_NumSymbols; n++) - levels[n] = Byte(m_Items[n].Len); -} - -void CEncoder::ReverseBits() -{ - for (UInt32 symbol = 0; symbol < m_NumSymbols; symbol++) - { - CItem &item = m_Items[symbol]; - UInt32 value = item.Code; - UInt32 reverseValue = 0; - for(UInt32 i = item.Len; i != 0; i--, value >>= 1) - reverseValue = (reverseValue << 1) | (value & 1); - item.Code = reverseValue; - } -} - -}} diff --git a/7zip/Compress/Huffman/HuffmanEncoder.h b/7zip/Compress/Huffman/HuffmanEncoder.h deleted file mode 100755 index 76304a45..00000000 --- a/7zip/Compress/Huffman/HuffmanEncoder.h +++ /dev/null @@ -1,82 +0,0 @@ -// Compression/HuffmanEncoder.h - -#ifndef __COMPRESSION_HUFFMANENCODER_H -#define __COMPRESSION_HUFFMANENCODER_H - -#include "../../../Common/Types.h" - -namespace NCompression { -namespace NHuffman { - -const int kNumBitsInLongestCode = 20; - -struct CItem -{ - UInt32 Freq; - UInt32 Code; - UInt32 Dad; - UInt32 Len; -}; - -class CEncoder -{ -public: - UInt32 m_NumSymbols; // number of symbols in adwSymbol - - CItem *m_Items; - UInt32 *m_Heap; - UInt32 m_HeapSize; - Byte *m_Depth; - const Byte *m_ExtraBits; - UInt32 m_ExtraBase; - UInt32 m_MaxLength; - - UInt32 m_HeapLength; - UInt32 m_BitLenCounters[kNumBitsInLongestCode + 1]; - - UInt32 RemoveSmallest(); - bool Smaller(int n, int m); - void DownHeap(UInt32 k); - void GenerateBitLen(UInt32 maxCode, UInt32 heapMax); - void GenerateCodes(UInt32 maxCode); - - UInt32 m_BlockBitLength; - - void Free(); - -public: - - CEncoder(); - ~CEncoder(); - bool Create(UInt32 numSymbols, const Byte *extraBits, - UInt32 extraBase, UInt32 maxLength); - void StartNewBlock(); - - void AddSymbol(UInt32 symbol) { m_Items[symbol].Freq++; } - - UInt32 GetPrice(const Byte *length) const - { - UInt32 price = 0; - for (UInt32 i = 0; i < m_NumSymbols; i++) - { - price += length[i] * m_Items[i].Freq; - if (m_ExtraBits && i >= m_ExtraBase) - price += m_ExtraBits[i - m_ExtraBase] * m_Items[i].Freq; - } - return price; - }; - void SetFreq(UInt32 symbol, UInt32 value) { m_Items[symbol].Freq = value; }; - - void BuildTree(Byte *levels); - UInt32 GetBlockBitLength() const { return m_BlockBitLength; } - - template - void CodeOneValue(TBitEncoder *bitEncoder, UInt32 symbol) - { bitEncoder->WriteBits(m_Items[symbol].Code, m_Items[symbol].Len); } - - void ReverseBits(); -}; - -}} - -#endif diff --git a/7zip/Compress/Huffman/StdAfx.h b/7zip/Compress/Huffman/StdAfx.h deleted file mode 100755 index b637fd40..00000000 --- a/7zip/Compress/Huffman/StdAfx.h +++ /dev/null @@ -1,6 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#endif diff --git a/7zip/Compress/Implode/DllExports.cpp b/7zip/Compress/Implode/DllExports.cpp deleted file mode 100755 index 4560af3a..00000000 --- a/7zip/Compress/Implode/DllExports.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "ImplodeDecoder.h" - -// {23170F69-40C1-278B-0401-060000000000} -DEFINE_GUID(CLSID_CCompressImplodeDecoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - return TRUE; -} - -STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*clsid != CLSID_CCompressImplodeDecoder) - return CLASS_E_CLASSNOTAVAILABLE; - if (*iid != IID_ICompressCoder) - return E_NOINTERFACE; - CMyComPtr coder = (ICompressCoder *)new - NCompress::NImplode::NDecoder::CCoder; - *outObject = coder.Detach(); - COM_TRY_END - return S_OK; -} - -STDAPI GetNumberOfMethods(UINT32 *numMethods) -{ - *numMethods = 1; - return S_OK; -} - -STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value) -{ - if (index != 0) - return E_INVALIDARG; - ::VariantClear((tagVARIANT *)value); - switch(propID) - { - case NMethodPropID::kID: - { - const char id[] = { 0x04, 0x01, 0x06 }; - if ((value->bstrVal = ::SysAllocStringByteLen(id, sizeof(id))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NMethodPropID::kName: - if ((value->bstrVal = ::SysAllocString(L"Implode")) != 0) - value->vt = VT_BSTR; - return S_OK; - case NMethodPropID::kDecoder: - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CCompressImplodeDecoder, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - return S_OK; -} diff --git a/7zip/Compress/Implode/ImplodeDecoder.cpp b/7zip/Compress/Implode/ImplodeDecoder.cpp deleted file mode 100755 index 19634c5c..00000000 --- a/7zip/Compress/Implode/ImplodeDecoder.cpp +++ /dev/null @@ -1,222 +0,0 @@ -// Implode/Decoder.cpp - -#include "StdAfx.h" - -#include "ImplodeDecoder.h" -#include "Common/Defs.h" - -namespace NCompress { -namespace NImplode { -namespace NDecoder { - -class CException -{ -public: - enum ECauseType - { - kData - } m_Cause; - CException(ECauseType cause): m_Cause(cause) {} -}; - -static const int kNumDistanceLowDirectBitsForBigDict = 7; -static const int kNumDistanceLowDirectBitsForSmallDict = 6; - -static const int kNumBitsInByte = 8; - -static const int kLevelStructuresNumberFieldSize = kNumBitsInByte; -static const int kLevelStructuresNumberAdditionalValue = 1; - -static const int kNumLevelStructureLevelBits = 4; -static const int kLevelStructureLevelAdditionalValue = 1; - -static const int kNumLevelStructureRepNumberBits = 4; -static const int kLevelStructureRepNumberAdditionalValue = 1; - - -static const int kLiteralTableSize = (1 << kNumBitsInByte); -static const int kDistanceTableSize = 64; -static const int kLengthTableSize = 64; - -static const UInt32 kHistorySize = - (1 << MyMax(kNumDistanceLowDirectBitsForBigDict, - kNumDistanceLowDirectBitsForSmallDict)) * - kDistanceTableSize; // = 8 KB; - -static const int kNumAdditionalLengthBits = 8; - -static const UInt32 kMatchMinLenWhenLiteralsOn = 3; -static const UInt32 kMatchMinLenWhenLiteralsOff = 2; - -static const UInt32 kMatchMinLenMax = MyMax(kMatchMinLenWhenLiteralsOn, - kMatchMinLenWhenLiteralsOff); // 3 - -static const UInt32 kMatchMaxLenMax = kMatchMinLenMax + - (kLengthTableSize - 1) + (1 << kNumAdditionalLengthBits) - 1; // or 2 - -enum -{ - kMatchId = 0, - kLiteralId = 1 -}; - - -CCoder::CCoder(): - m_LiteralDecoder(kLiteralTableSize), - m_LengthDecoder(kLengthTableSize), - m_DistanceDecoder(kDistanceTableSize) -{ -} - -void CCoder::ReleaseStreams() -{ - m_OutWindowStream.ReleaseStream(); - m_InBitStream.ReleaseStream(); -} - -bool CCoder::ReadLevelItems(NImplode::NHuffman::CDecoder &decoder, - Byte *levels, int numLevelItems) -{ - int numCodedStructures = m_InBitStream.ReadBits(kNumBitsInByte) + - kLevelStructuresNumberAdditionalValue; - int currentIndex = 0; - for(int i = 0; i < numCodedStructures; i++) - { - int level = m_InBitStream.ReadBits(kNumLevelStructureLevelBits) + - kLevelStructureLevelAdditionalValue; - int rep = m_InBitStream.ReadBits(kNumLevelStructureRepNumberBits) + - kLevelStructureRepNumberAdditionalValue; - if (currentIndex + rep > numLevelItems) - throw CException(CException::kData); - for(int j = 0; j < rep; j++) - levels[currentIndex++] = (Byte)level; - } - if (currentIndex != numLevelItems) - return false; - return decoder.SetCodeLengths(levels); -} - - -bool CCoder::ReadTables(void) -{ - if (m_LiteralsOn) - { - Byte literalLevels[kLiteralTableSize]; - if (!ReadLevelItems(m_LiteralDecoder, literalLevels, kLiteralTableSize)) - return false; - } - - Byte lengthLevels[kLengthTableSize]; - if (!ReadLevelItems(m_LengthDecoder, lengthLevels, kLengthTableSize)) - return false; - - Byte distanceLevels[kDistanceTableSize]; - return ReadLevelItems(m_DistanceDecoder, distanceLevels, kDistanceTableSize); -} - -class CCoderReleaser -{ - CCoder *m_Coder; -public: - CCoderReleaser(CCoder *coder): m_Coder(coder) {} - ~CCoderReleaser() { m_Coder->ReleaseStreams(); } -}; - -STDMETHODIMP CCoder::CodeReal(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 * /* inSize */, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - if (!m_InBitStream.Create(1 << 20)) - return E_OUTOFMEMORY; - if (!m_OutWindowStream.Create(kHistorySize)) - return E_OUTOFMEMORY; - if (outSize == NULL) - return E_INVALIDARG; - UInt64 pos = 0, unPackSize = *outSize; - - m_OutWindowStream.SetStream(outStream); - m_OutWindowStream.Init(false); - m_InBitStream.SetStream(inStream); - m_InBitStream.Init(); - CCoderReleaser coderReleaser(this); - - if (!ReadTables()) - return S_FALSE; - - while(pos < unPackSize) - { - if (progress != NULL && pos % (1 << 16) == 0) - { - UInt64 packSize = m_InBitStream.GetProcessedSize(); - RINOK(progress->SetRatioInfo(&packSize, &pos)); - } - if(m_InBitStream.ReadBits(1) == kMatchId) // match - { - UInt32 lowDistBits = m_InBitStream.ReadBits(m_NumDistanceLowDirectBits); - UInt32 distance = m_DistanceDecoder.DecodeSymbol(&m_InBitStream); - if (distance >= kDistanceTableSize) - return S_FALSE; - distance = (distance << m_NumDistanceLowDirectBits) + lowDistBits; - UInt32 lengthSymbol = m_LengthDecoder.DecodeSymbol(&m_InBitStream); - if (lengthSymbol >= kLengthTableSize) - return S_FALSE; - UInt32 length = lengthSymbol + m_MinMatchLength; - if (lengthSymbol == kLengthTableSize - 1) // special symbol = 63 - length += m_InBitStream.ReadBits(kNumAdditionalLengthBits); - while(distance >= pos && length > 0) - { - m_OutWindowStream.PutByte(0); - pos++; - length--; - } - if (length > 0) - m_OutWindowStream.CopyBlock(distance, length); - pos += length; - } - else - { - Byte b; - if (m_LiteralsOn) - { - UInt32 temp = m_LiteralDecoder.DecodeSymbol(&m_InBitStream); - if (temp >= kLiteralTableSize) - return S_FALSE; - b = (Byte)temp; - } - else - b = (Byte)m_InBitStream.ReadBits(kNumBitsInByte); - m_OutWindowStream.PutByte(b); - pos++; - } - } - if (pos > unPackSize) - throw CException(CException::kData); - return m_OutWindowStream.Flush(); -} - -STDMETHODIMP CCoder::Code(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - try { return CodeReal(inStream, outStream, inSize, outSize, progress); } - catch(const CLZOutWindowException &e) { return e.ErrorCode; } - catch(...) { return S_FALSE; } -} - -STDMETHODIMP CCoder::SetDecoderProperties2(const Byte *data, UInt32 size) -{ - if (size < 1) - return E_INVALIDARG; - Byte flag = data[0]; - m_BigDictionaryOn = ((flag & 2) != 0); - m_NumDistanceLowDirectBits = m_BigDictionaryOn ? - kNumDistanceLowDirectBitsForBigDict: - kNumDistanceLowDirectBitsForSmallDict; - m_LiteralsOn = ((flag & 4) != 0); - m_MinMatchLength = m_LiteralsOn ? - kMatchMinLenWhenLiteralsOn : - kMatchMinLenWhenLiteralsOff; - return S_OK; -} - -}}} diff --git a/7zip/Compress/Implode/ImplodeDecoder.h b/7zip/Compress/Implode/ImplodeDecoder.h deleted file mode 100755 index 627edba4..00000000 --- a/7zip/Compress/Implode/ImplodeDecoder.h +++ /dev/null @@ -1,60 +0,0 @@ -// ImplodeDecoder.h - -#ifndef __IMPLODE_DECODER_H -#define __IMPLODE_DECODER_H - -#include "../../../Common/MyCom.h" - -#include "../../ICoder.h" -#include "../LZ/LZOutWindow.h" - -#include "ImplodeHuffmanDecoder.h" - -namespace NCompress { -namespace NImplode { -namespace NDecoder { - -class CCoder : - public ICompressCoder, - public ICompressSetDecoderProperties2, - public CMyUnknownImp -{ - CLZOutWindow m_OutWindowStream; - NStream::NLSBF::CDecoder m_InBitStream; - - NImplode::NHuffman::CDecoder m_LiteralDecoder; - NImplode::NHuffman::CDecoder m_LengthDecoder; - NImplode::NHuffman::CDecoder m_DistanceDecoder; - - bool m_BigDictionaryOn; - bool m_LiteralsOn; - - int m_NumDistanceLowDirectBits; - UInt32 m_MinMatchLength; - - bool ReadLevelItems(NImplode::NHuffman::CDecoder &table, Byte *levels, int numLevelItems); - bool ReadTables(); - void DeCodeLevelTable(Byte *newLevels, int numLevels); -public: - CCoder(); - - MY_UNKNOWN_IMP1(ICompressSetDecoderProperties2) - - void ReleaseStreams(); - HRESULT (Flush)() { return m_OutWindowStream.Flush(); } - - STDMETHOD(CodeReal)(ISequentialInStream *inStream, ISequentialOutStream *outStream, - const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream, - const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - // ICompressSetDecoderProperties - STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size); -}; - -}}} - -#endif diff --git a/7zip/Compress/Implode/ImplodeHuffmanDecoder.cpp b/7zip/Compress/Implode/ImplodeHuffmanDecoder.cpp deleted file mode 100755 index ad2061c3..00000000 --- a/7zip/Compress/Implode/ImplodeHuffmanDecoder.cpp +++ /dev/null @@ -1,89 +0,0 @@ -// ImplodeHuffmanDecoder.cpp - -#include "StdAfx.h" - -#include "ImplodeHuffmanDecoder.h" - -namespace NCompress { -namespace NImplode { -namespace NHuffman { - -CDecoder::CDecoder(UInt32 numSymbols): - m_NumSymbols(numSymbols) -{ - m_Symbols = new UInt32[m_NumSymbols]; -} - -CDecoder::~CDecoder() -{ - delete []m_Symbols; -} - -bool CDecoder::SetCodeLengths(const Byte *codeLengths) -{ - // int lenCounts[kNumBitsInLongestCode + 1], tmpPositions[kNumBitsInLongestCode + 1]; - int lenCounts[kNumBitsInLongestCode + 2], tmpPositions[kNumBitsInLongestCode + 1]; - int i; - for(i = 0; i <= kNumBitsInLongestCode; i++) - lenCounts[i] = 0; - UInt32 symbolIndex; - for (symbolIndex = 0; symbolIndex < m_NumSymbols; symbolIndex++) - lenCounts[codeLengths[symbolIndex]]++; - // lenCounts[0] = 0; - - // tmpPositions[0] = m_Positions[0] = m_Limitits[0] = 0; - m_Limitits[kNumBitsInLongestCode + 1] = 0; - m_Positions[kNumBitsInLongestCode + 1] = 0; - lenCounts[kNumBitsInLongestCode + 1] = 0; - - - UInt32 startPos = 0; - static const UInt32 kMaxValue = (1 << kNumBitsInLongestCode); - - for (i = kNumBitsInLongestCode; i > 0; i--) - { - startPos += lenCounts[i] << (kNumBitsInLongestCode - i); - if (startPos > kMaxValue) - return false; - m_Limitits[i] = startPos; - m_Positions[i] = m_Positions[i + 1] + lenCounts[i + 1]; - tmpPositions[i] = m_Positions[i] + lenCounts[i]; - - } - - // if _ZIP_MODE do not throw exception for trees containing only one node - // #ifndef _ZIP_MODE - if (startPos != kMaxValue) - return false; - // #endif - - for (symbolIndex = 0; symbolIndex < m_NumSymbols; symbolIndex++) - if (codeLengths[symbolIndex] != 0) - m_Symbols[--tmpPositions[codeLengths[symbolIndex]]] = symbolIndex; - return true; -} - -UInt32 CDecoder::DecodeSymbol(CInBit *inStream) -{ - UInt32 numBits = 0; - UInt32 value = inStream->GetValue(kNumBitsInLongestCode); - int i; - for(i = kNumBitsInLongestCode; i > 0; i--) - { - if (value < m_Limitits[i]) - { - numBits = i; - break; - } - } - if (i == 0) - return 0xFFFFFFFF; - inStream->MovePos(numBits); - UInt32 index = m_Positions[numBits] + - ((value - m_Limitits[numBits + 1]) >> (kNumBitsInLongestCode - numBits)); - if (index >= m_NumSymbols) - return 0xFFFFFFFF; - return m_Symbols[index]; -} - -}}} diff --git a/7zip/Compress/Implode/ImplodeHuffmanDecoder.h b/7zip/Compress/Implode/ImplodeHuffmanDecoder.h deleted file mode 100755 index 9f7aeca1..00000000 --- a/7zip/Compress/Implode/ImplodeHuffmanDecoder.h +++ /dev/null @@ -1,33 +0,0 @@ -// ImplodeHuffmanDecoder.h - -#ifndef __IMPLODE_HUFFMAN_DECODER_H -#define __IMPLODE_HUFFMAN_DECODER_H - -#include "../../Common/LSBFDecoder.h" -#include "../../Common/InBuffer.h" - -namespace NCompress { -namespace NImplode { -namespace NHuffman { - -const int kNumBitsInLongestCode = 16; - -typedef NStream::NLSBF::CDecoder CInBit; - -class CDecoder -{ - UInt32 m_Limitits[kNumBitsInLongestCode + 2]; // m_Limitits[i] = value limit for symbols with length = i - UInt32 m_Positions[kNumBitsInLongestCode + 2]; // m_Positions[i] = index in m_Symbols[] of first symbol with length = i - UInt32 m_NumSymbols; // number of symbols in m_Symbols - UInt32 *m_Symbols; // symbols: at first with len=1 then 2, ... 15. -public: - CDecoder(UInt32 numSymbols); - ~CDecoder(); - - bool SetCodeLengths(const Byte *codeLengths); - UInt32 DecodeSymbol(CInBit *inStream); -}; - -}}} - -#endif diff --git a/7zip/Compress/Implode/StdAfx.cpp b/7zip/Compress/Implode/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Compress/Implode/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Compress/Implode/StdAfx.h b/7zip/Compress/Implode/StdAfx.h deleted file mode 100755 index e7fb6986..00000000 --- a/7zip/Compress/Implode/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Compress/LZ/BinTree/BinTree.h b/7zip/Compress/LZ/BinTree/BinTree.h deleted file mode 100755 index b3b3f13a..00000000 --- a/7zip/Compress/LZ/BinTree/BinTree.h +++ /dev/null @@ -1,54 +0,0 @@ -// BinTree.h - -#include "../LZInWindow.h" -#include "../IMatchFinder.h" - -namespace BT_NAMESPACE { - -typedef UInt32 CIndex; -const UInt32 kMaxValForNormalize = (UInt32(1) << 31) - 1; - -class CMatchFinder: - public IMatchFinder, - public CLZInWindow, - public CMyUnknownImp, - public IMatchFinderSetNumPasses -{ - UInt32 _cyclicBufferPos; - UInt32 _cyclicBufferSize; // it must be historySize + 1 - UInt32 _matchMaxLen; - CIndex *_hash; - CIndex *_son; - UInt32 _hashMask; - UInt32 _cutValue; - UInt32 _hashSizeSum; - - void Normalize(); - void FreeThisClassMemory(); - void FreeMemory(); - - MY_UNKNOWN_IMP - - STDMETHOD(SetStream)(ISequentialInStream *inStream); - STDMETHOD_(void, ReleaseStream)(); - STDMETHOD(Init)(); - HRESULT MovePos(); - STDMETHOD_(Byte, GetIndexByte)(Int32 index); - STDMETHOD_(UInt32, GetMatchLen)(Int32 index, UInt32 back, UInt32 limit); - STDMETHOD_(UInt32, GetNumAvailableBytes)(); - STDMETHOD_(const Byte *, GetPointerToCurrentPos)(); - STDMETHOD_(Int32, NeedChangeBufferPos)(UInt32 numCheckBytes); - STDMETHOD_(void, ChangeBufferPos)(); - - STDMETHOD(Create)(UInt32 historySize, UInt32 keepAddBufferBefore, - UInt32 matchMaxLen, UInt32 keepAddBufferAfter); - STDMETHOD(GetMatches)(UInt32 *distances); - STDMETHOD(Skip)(UInt32 num); - -public: - CMatchFinder(); - virtual ~CMatchFinder(); - virtual void SetNumPasses(UInt32 numPasses) { _cutValue = numPasses; } -}; - -} diff --git a/7zip/Compress/LZ/BinTree/BinTree2.h b/7zip/Compress/LZ/BinTree/BinTree2.h deleted file mode 100755 index 74ca8d9d..00000000 --- a/7zip/Compress/LZ/BinTree/BinTree2.h +++ /dev/null @@ -1,12 +0,0 @@ -// BinTree2.h - -#ifndef __BINTREE2_H -#define __BINTREE2_H - -#define BT_NAMESPACE NBT2 - -#include "BinTreeMain.h" - -#undef BT_NAMESPACE - -#endif diff --git a/7zip/Compress/LZ/BinTree/BinTree3.h b/7zip/Compress/LZ/BinTree/BinTree3.h deleted file mode 100755 index 76bd9ddd..00000000 --- a/7zip/Compress/LZ/BinTree/BinTree3.h +++ /dev/null @@ -1,16 +0,0 @@ -// BinTree3.h - -#ifndef __BINTREE3_H -#define __BINTREE3_H - -#define BT_NAMESPACE NBT3 - -#define HASH_ARRAY_2 - -#include "BinTreeMain.h" - -#undef HASH_ARRAY_2 - -#undef BT_NAMESPACE - -#endif diff --git a/7zip/Compress/LZ/BinTree/BinTree3Z.h b/7zip/Compress/LZ/BinTree/BinTree3Z.h deleted file mode 100755 index d2c092b4..00000000 --- a/7zip/Compress/LZ/BinTree/BinTree3Z.h +++ /dev/null @@ -1,16 +0,0 @@ -// BinTree3Z.h - -#ifndef __BINTREE3Z_H -#define __BINTREE3Z_H - -#define BT_NAMESPACE NBT3Z - -#define HASH_ZIP - -#include "BinTreeMain.h" - -#undef HASH_ZIP - -#undef BT_NAMESPACE - -#endif diff --git a/7zip/Compress/LZ/BinTree/BinTree4.h b/7zip/Compress/LZ/BinTree/BinTree4.h deleted file mode 100755 index 08e2d1ce..00000000 --- a/7zip/Compress/LZ/BinTree/BinTree4.h +++ /dev/null @@ -1,18 +0,0 @@ -// BinTree4.h - -#ifndef __BINTREE4_H -#define __BINTREE4_H - -#define BT_NAMESPACE NBT4 - -#define HASH_ARRAY_2 -#define HASH_ARRAY_3 - -#include "BinTreeMain.h" - -#undef HASH_ARRAY_2 -#undef HASH_ARRAY_3 - -#undef BT_NAMESPACE - -#endif diff --git a/7zip/Compress/LZ/BinTree/BinTreeMain.h b/7zip/Compress/LZ/BinTree/BinTreeMain.h deleted file mode 100755 index ef9f6ce2..00000000 --- a/7zip/Compress/LZ/BinTree/BinTreeMain.h +++ /dev/null @@ -1,531 +0,0 @@ -// BinTreeMain.h - -#include "../../../../Common/Defs.h" -#include "../../../../Common/CRC.h" -#include "../../../../Common/Alloc.h" - -#include "BinTree.h" - -// #include -// It's for prefetch -// But prefetch doesn't give big gain in K8. - -namespace BT_NAMESPACE { - -#ifdef HASH_ARRAY_2 - static const UInt32 kHash2Size = 1 << 10; - #define kNumHashDirectBytes 0 - #ifdef HASH_ARRAY_3 - static const UInt32 kNumHashBytes = 4; - static const UInt32 kHash3Size = 1 << 16; - #else - static const UInt32 kNumHashBytes = 3; - #endif - static const UInt32 kHashSize = 0; - static const UInt32 kMinMatchCheck = kNumHashBytes; - static const UInt32 kStartMaxLen = 1; -#else - #ifdef HASH_ZIP - #define kNumHashDirectBytes 0 - static const UInt32 kNumHashBytes = 3; - static const UInt32 kHashSize = 1 << 16; - static const UInt32 kMinMatchCheck = kNumHashBytes; - static const UInt32 kStartMaxLen = 1; - #else - #define kNumHashDirectBytes 2 - static const UInt32 kNumHashBytes = 2; - static const UInt32 kHashSize = 1 << (8 * kNumHashBytes); - static const UInt32 kMinMatchCheck = kNumHashBytes + 1; - static const UInt32 kStartMaxLen = 1; - #endif -#endif - -#ifdef HASH_ARRAY_2 -#ifdef HASH_ARRAY_3 -static const UInt32 kHash3Offset = kHash2Size; -#endif -#endif - -static const UInt32 kFixHashSize = 0 - #ifdef HASH_ARRAY_2 - + kHash2Size - #ifdef HASH_ARRAY_3 - + kHash3Size - #endif - #endif - ; - -CMatchFinder::CMatchFinder(): - _hash(0) -{ -} - -void CMatchFinder::FreeThisClassMemory() -{ - BigFree(_hash); - _hash = 0; -} - -void CMatchFinder::FreeMemory() -{ - FreeThisClassMemory(); - CLZInWindow::Free(); -} - -CMatchFinder::~CMatchFinder() -{ - FreeMemory(); -} - -STDMETHODIMP CMatchFinder::Create(UInt32 historySize, UInt32 keepAddBufferBefore, - UInt32 matchMaxLen, UInt32 keepAddBufferAfter) -{ - if (historySize > kMaxValForNormalize - 256) - { - FreeMemory(); - return E_INVALIDARG; - } - _cutValue = - #ifdef _HASH_CHAIN - 8 + (matchMaxLen >> 2); - #else - 16 + (matchMaxLen >> 1); - #endif - UInt32 sizeReserv = (historySize + keepAddBufferBefore + - matchMaxLen + keepAddBufferAfter) / 2 + 256; - if (CLZInWindow::Create(historySize + keepAddBufferBefore, - matchMaxLen + keepAddBufferAfter, sizeReserv)) - { - _matchMaxLen = matchMaxLen; - UInt32 newCyclicBufferSize = historySize + 1; - if (_hash != 0 && newCyclicBufferSize == _cyclicBufferSize) - return S_OK; - FreeThisClassMemory(); - _cyclicBufferSize = newCyclicBufferSize; // don't change it - - UInt32 hs = kHashSize; - - #ifdef HASH_ARRAY_2 - hs = historySize - 1; - hs |= (hs >> 1); - hs |= (hs >> 2); - hs |= (hs >> 4); - hs |= (hs >> 8); - hs >>= 1; - hs |= 0xFFFF; - if (hs > (1 << 24)) - { - #ifdef HASH_ARRAY_3 - hs >>= 1; - #else - hs = (1 << 24) - 1; - #endif - } - _hashMask = hs; - hs++; - #endif - _hashSizeSum = hs + kFixHashSize; - UInt32 numItems = _hashSizeSum + _cyclicBufferSize - #ifndef _HASH_CHAIN - * 2 - #endif - ; - size_t sizeInBytes = (size_t)numItems * sizeof(CIndex); - if (sizeInBytes / sizeof(CIndex) != numItems) - return E_OUTOFMEMORY; - _hash = (CIndex *)BigAlloc(sizeInBytes); - _son = _hash + _hashSizeSum; - if (_hash != 0) - return S_OK; - } - FreeMemory(); - return E_OUTOFMEMORY; -} - -static const UInt32 kEmptyHashValue = 0; - -STDMETHODIMP CMatchFinder::SetStream(ISequentialInStream *stream) -{ - CLZInWindow::SetStream(stream); - return S_OK; -} - -STDMETHODIMP CMatchFinder::Init() -{ - RINOK(CLZInWindow::Init()); - for(UInt32 i = 0; i < _hashSizeSum; i++) - _hash[i] = kEmptyHashValue; - _cyclicBufferPos = 0; - ReduceOffsets(-1); - return S_OK; -} - -STDMETHODIMP_(void) CMatchFinder::ReleaseStream() -{ - // ReleaseStream(); -} - -#ifdef HASH_ARRAY_2 -#ifdef HASH_ARRAY_3 - -#define HASH_CALC { \ - UInt32 temp = CCRC::Table[cur[0]] ^ cur[1]; \ - hash2Value = temp & (kHash2Size - 1); \ - hash3Value = (temp ^ (UInt32(cur[2]) << 8)) & (kHash3Size - 1); \ - hashValue = (temp ^ (UInt32(cur[2]) << 8) ^ (CCRC::Table[cur[3]] << 5)) & _hashMask; } - -#else // no HASH_ARRAY_3 -#define HASH_CALC { \ - UInt32 temp = CCRC::Table[cur[0]] ^ cur[1]; \ - hash2Value = temp & (kHash2Size - 1); \ - hashValue = (temp ^ (UInt32(cur[2]) << 8)) & _hashMask; } -#endif // HASH_ARRAY_3 -#else // no HASH_ARRAY_2 -#ifdef HASH_ZIP -inline UInt32 Hash(const Byte *pointer) -{ - return ((UInt32(pointer[0]) << 8) ^ CCRC::Table[pointer[1]] ^ pointer[2]) & (kHashSize - 1); -} -#else // no HASH_ZIP -inline UInt32 Hash(const Byte *pointer) -{ - return pointer[0] ^ (UInt32(pointer[1]) << 8); -} -#endif // HASH_ZIP -#endif // HASH_ARRAY_2 - -STDMETHODIMP CMatchFinder::GetMatches(UInt32 *distances) -{ - UInt32 lenLimit; - if (_pos + _matchMaxLen <= _streamPos) - lenLimit = _matchMaxLen; - else - { - lenLimit = _streamPos - _pos; - if(lenLimit < kMinMatchCheck) - { - distances[0] = 0; - return MovePos(); - } - } - - int offset = 1; - - UInt32 matchMinPos = (_pos > _cyclicBufferSize) ? (_pos - _cyclicBufferSize) : 0; - const Byte *cur = _buffer + _pos; - - UInt32 maxLen = kStartMaxLen; // to avoid items for len < hashSize; - - #ifdef HASH_ARRAY_2 - UInt32 hash2Value; - #ifdef HASH_ARRAY_3 - UInt32 hash3Value; - #endif - UInt32 hashValue; - HASH_CALC; - #else - UInt32 hashValue = Hash(cur); - #endif - - UInt32 curMatch = _hash[kFixHashSize + hashValue]; - #ifdef HASH_ARRAY_2 - UInt32 curMatch2 = _hash[hash2Value]; - #ifdef HASH_ARRAY_3 - UInt32 curMatch3 = _hash[kHash3Offset + hash3Value]; - #endif - _hash[hash2Value] = _pos; - if(curMatch2 > matchMinPos) - if (_buffer[curMatch2] == cur[0]) - { - distances[offset++] = maxLen = 2; - distances[offset++] = _pos - curMatch2 - 1; - } - - #ifdef HASH_ARRAY_3 - _hash[kHash3Offset + hash3Value] = _pos; - if(curMatch3 > matchMinPos) - if (_buffer[curMatch3] == cur[0]) - { - if (curMatch3 == curMatch2) - offset -= 2; - distances[offset++] = maxLen = 3; - distances[offset++] = _pos - curMatch3 - 1; - curMatch2 = curMatch3; - } - #endif - if (offset != 1 && curMatch2 == curMatch) - { - offset -= 2; - maxLen = kStartMaxLen; - } - #endif - - _hash[kFixHashSize + hashValue] = _pos; - - CIndex *son = _son; - - #ifdef _HASH_CHAIN - son[_cyclicBufferPos] = curMatch; - #else - CIndex *ptr0 = son + (_cyclicBufferPos << 1) + 1; - CIndex *ptr1 = son + (_cyclicBufferPos << 1); - - UInt32 len0, len1; - len0 = len1 = kNumHashDirectBytes; - #endif - - #if kNumHashDirectBytes != 0 - if(curMatch > matchMinPos) - { - if (_buffer[curMatch + kNumHashDirectBytes] != cur[kNumHashDirectBytes]) - { - distances[offset++] = maxLen = kNumHashDirectBytes; - distances[offset++] = _pos - curMatch - 1; - } - } - #endif - UInt32 count = _cutValue; - for (;;) - { - if(curMatch <= matchMinPos || count-- == 0) - { - #ifndef _HASH_CHAIN - *ptr0 = *ptr1 = kEmptyHashValue; - #endif - break; - } - UInt32 delta = _pos - curMatch; - UInt32 cyclicPos = (delta <= _cyclicBufferPos) ? - (_cyclicBufferPos - delta): - (_cyclicBufferPos - delta + _cyclicBufferSize); - CIndex *pair = son + - #ifdef _HASH_CHAIN - cyclicPos; - #else - (cyclicPos << 1); - #endif - - // _mm_prefetch((const char *)pair, _MM_HINT_T0); - - const Byte *pb = _buffer + curMatch; - UInt32 len = - #ifdef _HASH_CHAIN - kNumHashDirectBytes; - if (pb[maxLen] == cur[maxLen]) - #else - MyMin(len0, len1); - #endif - if (pb[len] == cur[len]) - { - while(++len != lenLimit) - if (pb[len] != cur[len]) - break; - if (maxLen < len) - { - distances[offset++] = maxLen = len; - distances[offset++] = delta - 1; - if (len == lenLimit) - { - #ifndef _HASH_CHAIN - *ptr1 = pair[0]; - *ptr0 = pair[1]; - #endif - break; - } - } - } - #ifdef _HASH_CHAIN - curMatch = *pair; - #else - if (pb[len] < cur[len]) - { - *ptr1 = curMatch; - ptr1 = pair + 1; - curMatch = *ptr1; - len1 = len; - } - else - { - *ptr0 = curMatch; - ptr0 = pair; - curMatch = *ptr0; - len0 = len; - } - #endif - } - distances[0] = offset - 1; - if (++_cyclicBufferPos == _cyclicBufferSize) - _cyclicBufferPos = 0; - RINOK(CLZInWindow::MovePos()); - if (_pos == kMaxValForNormalize) - Normalize(); - return S_OK; -} - -STDMETHODIMP CMatchFinder::Skip(UInt32 num) -{ - do - { - #ifdef _HASH_CHAIN - if (_streamPos - _pos < kNumHashBytes) - { - RINOK(MovePos()); - continue; - } - #else - UInt32 lenLimit; - if (_pos + _matchMaxLen <= _streamPos) - lenLimit = _matchMaxLen; - else - { - lenLimit = _streamPos - _pos; - if(lenLimit < kMinMatchCheck) - { - RINOK(MovePos()); - continue; - } - } - UInt32 matchMinPos = (_pos > _cyclicBufferSize) ? (_pos - _cyclicBufferSize) : 0; - #endif - const Byte *cur = _buffer + _pos; - - #ifdef HASH_ARRAY_2 - UInt32 hash2Value; - #ifdef HASH_ARRAY_3 - UInt32 hash3Value; - UInt32 hashValue; - HASH_CALC; - _hash[kHash3Offset + hash3Value] = _pos; - #else - UInt32 hashValue; - HASH_CALC; - #endif - _hash[hash2Value] = _pos; - #else - UInt32 hashValue = Hash(cur); - #endif - - UInt32 curMatch = _hash[kFixHashSize + hashValue]; - _hash[kFixHashSize + hashValue] = _pos; - - #ifdef _HASH_CHAIN - _son[_cyclicBufferPos] = curMatch; - #else - CIndex *son = _son; - CIndex *ptr0 = son + (_cyclicBufferPos << 1) + 1; - CIndex *ptr1 = son + (_cyclicBufferPos << 1); - - UInt32 len0, len1; - len0 = len1 = kNumHashDirectBytes; - UInt32 count = _cutValue; - for (;;) - { - if(curMatch <= matchMinPos || count-- == 0) - { - *ptr0 = *ptr1 = kEmptyHashValue; - break; - } - - UInt32 delta = _pos - curMatch; - UInt32 cyclicPos = (delta <= _cyclicBufferPos) ? - (_cyclicBufferPos - delta): - (_cyclicBufferPos - delta + _cyclicBufferSize); - CIndex *pair = son + (cyclicPos << 1); - - // _mm_prefetch((const char *)pair, _MM_HINT_T0); - - const Byte *pb = _buffer + curMatch; - UInt32 len = MyMin(len0, len1); - - if (pb[len] == cur[len]) - { - while(++len != lenLimit) - if (pb[len] != cur[len]) - break; - if (len == lenLimit) - { - *ptr1 = pair[0]; - *ptr0 = pair[1]; - break; - } - } - if (pb[len] < cur[len]) - { - *ptr1 = curMatch; - ptr1 = pair + 1; - curMatch = *ptr1; - len1 = len; - } - else - { - *ptr0 = curMatch; - ptr0 = pair; - curMatch = *ptr0; - len0 = len; - } - } - #endif - if (++_cyclicBufferPos == _cyclicBufferSize) - _cyclicBufferPos = 0; - RINOK(CLZInWindow::MovePos()); - if (_pos == kMaxValForNormalize) - Normalize(); - } - while(--num != 0); - return S_OK; -} - -void CMatchFinder::Normalize() -{ - UInt32 subValue = _pos - _cyclicBufferSize; - CIndex *items = _hash; - UInt32 numItems = (_hashSizeSum + _cyclicBufferSize - #ifndef _HASH_CHAIN - * 2 - #endif - ); - for (UInt32 i = 0; i < numItems; i++) - { - UInt32 value = items[i]; - if (value <= subValue) - value = kEmptyHashValue; - else - value -= subValue; - items[i] = value; - } - ReduceOffsets(subValue); -} - -HRESULT CMatchFinder::MovePos() -{ - if (++_cyclicBufferPos == _cyclicBufferSize) - _cyclicBufferPos = 0; - RINOK(CLZInWindow::MovePos()); - if (_pos == kMaxValForNormalize) - Normalize(); - return S_OK; -} - -STDMETHODIMP_(Byte) CMatchFinder::GetIndexByte(Int32 index) - { return CLZInWindow::GetIndexByte(index); } - -STDMETHODIMP_(UInt32) CMatchFinder::GetMatchLen(Int32 index, - UInt32 back, UInt32 limit) - { return CLZInWindow::GetMatchLen(index, back, limit); } - -STDMETHODIMP_(UInt32) CMatchFinder::GetNumAvailableBytes() - { return CLZInWindow::GetNumAvailableBytes(); } - -STDMETHODIMP_(const Byte *) CMatchFinder::GetPointerToCurrentPos() - { return CLZInWindow::GetPointerToCurrentPos(); } - -STDMETHODIMP_(Int32) CMatchFinder::NeedChangeBufferPos(UInt32 numCheckBytes) - { return CLZInWindow::NeedMove(numCheckBytes) ? 1: 0; } - -STDMETHODIMP_(void) CMatchFinder::ChangeBufferPos() - { CLZInWindow::MoveBlock();} - -#undef HASH_CALC -#undef kNumHashDirectBytes - -} diff --git a/7zip/Compress/LZ/HashChain/HC2.h b/7zip/Compress/LZ/HashChain/HC2.h deleted file mode 100755 index d8e61a74..00000000 --- a/7zip/Compress/LZ/HashChain/HC2.h +++ /dev/null @@ -1,13 +0,0 @@ -// HC2.h - -#ifndef __HC2_H -#define __HC2_H - -#define BT_NAMESPACE NHC2 - -#include "HCMain.h" - -#undef BT_NAMESPACE - -#endif - diff --git a/7zip/Compress/LZ/HashChain/HC3.h b/7zip/Compress/LZ/HashChain/HC3.h deleted file mode 100755 index 263690af..00000000 --- a/7zip/Compress/LZ/HashChain/HC3.h +++ /dev/null @@ -1,16 +0,0 @@ -// HC3.h - -#ifndef __HC3_H -#define __HC3_H - -#define BT_NAMESPACE NHC3 - -#define HASH_ARRAY_2 - -#include "HCMain.h" - -#undef HASH_ARRAY_2 -#undef BT_NAMESPACE - -#endif - diff --git a/7zip/Compress/LZ/HashChain/HC4.h b/7zip/Compress/LZ/HashChain/HC4.h deleted file mode 100755 index 1fda4ac6..00000000 --- a/7zip/Compress/LZ/HashChain/HC4.h +++ /dev/null @@ -1,19 +0,0 @@ -// HC4.h - -#ifndef __HC4_H -#define __HC4_H - -#define BT_NAMESPACE NHC4 - -#define HASH_ARRAY_2 -#define HASH_ARRAY_3 - -#include "HCMain.h" - -#undef HASH_ARRAY_2 -#undef HASH_ARRAY_3 - -#undef BT_NAMESPACE - -#endif - diff --git a/7zip/Compress/LZ/HashChain/HCMain.h b/7zip/Compress/LZ/HashChain/HCMain.h deleted file mode 100755 index d509befe..00000000 --- a/7zip/Compress/LZ/HashChain/HCMain.h +++ /dev/null @@ -1,6 +0,0 @@ -// HCMain.h - -#define _HASH_CHAIN -#include "../BinTree/BinTreeMain.h" -#undef _HASH_CHAIN - diff --git a/7zip/Compress/LZ/IMatchFinder.h b/7zip/Compress/LZ/IMatchFinder.h deleted file mode 100755 index 528b7b1c..00000000 --- a/7zip/Compress/LZ/IMatchFinder.h +++ /dev/null @@ -1,32 +0,0 @@ -// MatchFinders/IMatchFinder.h - -#ifndef __IMATCHFINDER_H -#define __IMATCHFINDER_H - -struct IInWindowStream: public IUnknown -{ - STDMETHOD(SetStream)(ISequentialInStream *inStream) PURE; - STDMETHOD_(void, ReleaseStream)() PURE; - STDMETHOD(Init)() PURE; - STDMETHOD_(Byte, GetIndexByte)(Int32 index) PURE; - STDMETHOD_(UInt32, GetMatchLen)(Int32 index, UInt32 distance, UInt32 limit) PURE; - STDMETHOD_(UInt32, GetNumAvailableBytes)() PURE; - STDMETHOD_(const Byte *, GetPointerToCurrentPos)() PURE; - STDMETHOD_(Int32, NeedChangeBufferPos)(UInt32 numCheckBytes) PURE; - STDMETHOD_(void, ChangeBufferPos)() PURE; -}; - -struct IMatchFinder: public IInWindowStream -{ - STDMETHOD(Create)(UInt32 historySize, UInt32 keepAddBufferBefore, - UInt32 matchMaxLen, UInt32 keepAddBufferAfter) PURE; - STDMETHOD(GetMatches)(UInt32 *distances) PURE; - STDMETHOD(Skip)(UInt32 num) PURE; -}; - -struct IMatchFinderSetNumPasses -{ - virtual void SetNumPasses(UInt32 numPasses) PURE; -}; - -#endif diff --git a/7zip/Compress/LZ/LZInWindow.cpp b/7zip/Compress/LZ/LZInWindow.cpp deleted file mode 100755 index aacaea9d..00000000 --- a/7zip/Compress/LZ/LZInWindow.cpp +++ /dev/null @@ -1,105 +0,0 @@ -// LZInWindow.cpp - -#include "StdAfx.h" - -#include "LZInWindow.h" -#include "../../../Common/MyCom.h" -#include "../../../Common/Alloc.h" - -void CLZInWindow::Free() -{ - ::BigFree(_bufferBase); - _bufferBase = 0; -} - -bool CLZInWindow::Create(UInt32 keepSizeBefore, UInt32 keepSizeAfter, UInt32 keepSizeReserv) -{ - _keepSizeBefore = keepSizeBefore; - _keepSizeAfter = keepSizeAfter; - UInt32 blockSize = keepSizeBefore + keepSizeAfter + keepSizeReserv; - if (_bufferBase == 0 || _blockSize != blockSize) - { - Free(); - _blockSize = blockSize; - if (_blockSize != 0) - _bufferBase = (Byte *)::BigAlloc(_blockSize); - } - _pointerToLastSafePosition = _bufferBase + _blockSize - keepSizeAfter; - if (_blockSize == 0) - return true; - return (_bufferBase != 0); -} - -void CLZInWindow::SetStream(ISequentialInStream *stream) -{ - _stream = stream; -} - -HRESULT CLZInWindow::Init() -{ - _buffer = _bufferBase; - _pos = 0; - _streamPos = 0; - _streamEndWasReached = false; - return ReadBlock(); -} - -/* -void CLZInWindow::ReleaseStream() -{ - _stream.Release(); -} -*/ - -/////////////////////////////////////////// -// ReadBlock - -// In State: -// (_buffer + _streamPos) <= (_bufferBase + _blockSize) -// Out State: -// _posLimit <= _blockSize - _keepSizeAfter; -// if(_streamEndWasReached == false): -// _streamPos >= _pos + _keepSizeAfter -// _posLimit = _streamPos - _keepSizeAfter; -// else -// - -HRESULT CLZInWindow::ReadBlock() -{ - if(_streamEndWasReached) - return S_OK; - for (;;) - { - UInt32 size = (UInt32)(_bufferBase - _buffer) + _blockSize - _streamPos; - if(size == 0) - return S_OK; - UInt32 numReadBytes; - RINOK(_stream->Read(_buffer + _streamPos, size, &numReadBytes)); - if(numReadBytes == 0) - { - _posLimit = _streamPos; - const Byte *pointerToPostion = _buffer + _posLimit; - if(pointerToPostion > _pointerToLastSafePosition) - _posLimit = (UInt32)(_pointerToLastSafePosition - _buffer); - _streamEndWasReached = true; - return S_OK; - } - _streamPos += numReadBytes; - if(_streamPos >= _pos + _keepSizeAfter) - { - _posLimit = _streamPos - _keepSizeAfter; - return S_OK; - } - } -} - -void CLZInWindow::MoveBlock() -{ - UInt32 offset = (UInt32)(_buffer - _bufferBase) + _pos - _keepSizeBefore; - // we need one additional byte, since MovePos moves on 1 byte. - if (offset > 0) - offset--; - UInt32 numBytes = (UInt32)(_buffer - _bufferBase) + _streamPos - offset; - memmove(_bufferBase, _bufferBase + offset, numBytes); - _buffer -= offset; -} diff --git a/7zip/Compress/LZ/LZInWindow.h b/7zip/Compress/LZ/LZInWindow.h deleted file mode 100755 index 20e0331b..00000000 --- a/7zip/Compress/LZ/LZInWindow.h +++ /dev/null @@ -1,87 +0,0 @@ -// LZInWindow.h - -#ifndef __LZ_IN_WINDOW_H -#define __LZ_IN_WINDOW_H - -#include "../../IStream.h" - -class CLZInWindow -{ - Byte *_bufferBase; // pointer to buffer with data - ISequentialInStream *_stream; - UInt32 _posLimit; // offset (from _buffer) when new block reading must be done - bool _streamEndWasReached; // if (true) then _streamPos shows real end of stream - const Byte *_pointerToLastSafePosition; -protected: - Byte *_buffer; // Pointer to virtual Buffer begin - UInt32 _blockSize; // Size of Allocated memory block - UInt32 _pos; // offset (from _buffer) of curent byte - UInt32 _keepSizeBefore; // how many BYTEs must be kept in buffer before _pos - UInt32 _keepSizeAfter; // how many BYTEs must be kept buffer after _pos - UInt32 _streamPos; // offset (from _buffer) of first not read byte from Stream - - void MoveBlock(); - HRESULT ReadBlock(); - void Free(); -public: - CLZInWindow(): _bufferBase(0) {} - virtual ~CLZInWindow() { Free(); } - - // keepSizeBefore + keepSizeAfter + keepSizeReserv < 4G) - bool Create(UInt32 keepSizeBefore, UInt32 keepSizeAfter, UInt32 keepSizeReserv = (1<<17)); - - void SetStream(ISequentialInStream *stream); - HRESULT Init(); - // void ReleaseStream(); - - Byte *GetBuffer() const { return _buffer; } - - const Byte *GetPointerToCurrentPos() const { return _buffer + _pos; } - - HRESULT MovePos() - { - _pos++; - if (_pos > _posLimit) - { - const Byte *pointerToPostion = _buffer + _pos; - if(pointerToPostion > _pointerToLastSafePosition) - MoveBlock(); - return ReadBlock(); - } - else - return S_OK; - } - Byte GetIndexByte(Int32 index) const { return _buffer[(size_t)_pos + index]; } - - // index + limit have not to exceed _keepSizeAfter; - // -2G <= index < 2G - UInt32 GetMatchLen(Int32 index, UInt32 distance, UInt32 limit) const - { - if(_streamEndWasReached) - if ((_pos + index) + limit > _streamPos) - limit = _streamPos - (_pos + index); - distance++; - const Byte *pby = _buffer + (size_t)_pos + index; - UInt32 i; - for(i = 0; i < limit && pby[i] == pby[(size_t)i - distance]; i++); - return i; - } - - UInt32 GetNumAvailableBytes() const { return _streamPos - _pos; } - - void ReduceOffsets(Int32 subValue) - { - _buffer += subValue; - _posLimit -= subValue; - _pos -= subValue; - _streamPos -= subValue; - } - - bool NeedMove(UInt32 numCheckBytes) - { - size_t reserv = (size_t)(_pointerToLastSafePosition - (_buffer + _pos)); - return (reserv <= numCheckBytes); - } -}; - -#endif diff --git a/7zip/Compress/LZ/LZOutWindow.cpp b/7zip/Compress/LZ/LZOutWindow.cpp deleted file mode 100755 index e2d6aba1..00000000 --- a/7zip/Compress/LZ/LZOutWindow.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// LZOutWindow.cpp - -#include "StdAfx.h" - -#include "../../../Common/Alloc.h" -#include "LZOutWindow.h" - -void CLZOutWindow::Init(bool solid) -{ - if(!solid) - COutBuffer::Init(); - #ifdef _NO_EXCEPTIONS - ErrorCode = S_OK; - #endif -} - - diff --git a/7zip/Compress/LZ/LZOutWindow.h b/7zip/Compress/LZ/LZOutWindow.h deleted file mode 100755 index 3c50c6e7..00000000 --- a/7zip/Compress/LZ/LZOutWindow.h +++ /dev/null @@ -1,56 +0,0 @@ -// LZOutWindow.h - -#ifndef __LZ_OUT_WINDOW_H -#define __LZ_OUT_WINDOW_H - -#include "../../IStream.h" -#include "../../Common/OutBuffer.h" - -#ifndef _NO_EXCEPTIONS -typedef COutBufferException CLZOutWindowException; -#endif - -class CLZOutWindow: public COutBuffer -{ -public: - void Init(bool solid = false); - - // distance >= 0, len > 0, - bool CopyBlock(UInt32 distance, UInt32 len) - { - UInt32 pos = _pos - distance - 1; - if (distance >= _pos) - { - if (!_overDict || distance >= _bufferSize) - return false; - pos += _bufferSize; - } - do - { - if (pos == _bufferSize) - pos = 0; - _buffer[_pos++] = _buffer[pos++]; - if (_pos == _limitPos) - FlushWithCheck(); - } - while(--len != 0); - return true; - } - - void PutByte(Byte b) - { - _buffer[_pos++] = b; - if (_pos == _limitPos) - FlushWithCheck(); - } - - Byte GetByte(UInt32 distance) const - { - UInt32 pos = _pos - distance - 1; - if (pos >= _bufferSize) - pos += _bufferSize; - return _buffer[pos]; - } -}; - -#endif diff --git a/7zip/Compress/LZ/MT/MT.cpp b/7zip/Compress/LZ/MT/MT.cpp deleted file mode 100755 index b0ac456d..00000000 --- a/7zip/Compress/LZ/MT/MT.cpp +++ /dev/null @@ -1,295 +0,0 @@ -// MT.cpp - -#include "StdAfx.h" - -#include "../../../../Common/Alloc.h" - -#include "MT.h" - -static const UInt32 kBlockSize = (1 << 14); - -static DWORD WINAPI MFThread(void *threadCoderInfo) -{ - return ((CMatchFinderMT *)threadCoderInfo)->ThreadFunc(); -} - -CMatchFinderMT::CMatchFinderMT(): - m_Buffer(0), - m_NeedStart(true) -{ - m_BlockIndex = kNumMTBlocks - 1; - m_CS[m_BlockIndex].Enter(); - if (!m_Thread.Create(MFThread, this)) - throw 271826; -} - -CMatchFinderMT::~CMatchFinderMT() -{ - m_Exit = true; - m_CS[m_BlockIndex].Leave(); - m_CanChangeBufferPos.Set(); - if (m_NeedStart) - m_MtCanStart.Set(); - m_Thread.Wait(); - FreeMem(); -} - -void CMatchFinderMT::FreeMem() -{ - ::MyFree(m_Buffer); - m_Buffer = 0; -} - -STDMETHODIMP CMatchFinderMT::Create(UInt32 sizeHistory, UInt32 keepAddBufferBefore, - UInt32 matchMaxLen, UInt32 keepAddBufferAfter) -{ - FreeMem(); - m_MatchMaxLen = matchMaxLen; - if (kBlockSize <= matchMaxLen * 4) - return E_INVALIDARG; - UInt32 bufferSize = kBlockSize * kNumMTBlocks; - m_Buffer = (UInt32 *)::MyAlloc(bufferSize * sizeof(UInt32)); - if (m_Buffer == 0) - return E_OUTOFMEMORY; - keepAddBufferBefore += bufferSize; - keepAddBufferAfter += (kBlockSize + 1); - return m_MatchFinder->Create(sizeHistory, keepAddBufferBefore, matchMaxLen, keepAddBufferAfter); -} - -// UInt32 blockSizeMult = 800 -HRESULT CMatchFinderMT::SetMatchFinder(IMatchFinder *matchFinder) -{ - m_MatchFinder = matchFinder; - return S_OK; -} - -STDMETHODIMP CMatchFinderMT::SetStream(ISequentialInStream *s) -{ - return m_MatchFinder->SetStream(s); -} - -// Call it after ReleaseStream / SetStream -STDMETHODIMP CMatchFinderMT::Init() -{ - m_NeedStart = true; - m_Pos = 0; - m_PosLimit = 0; - - HRESULT result = m_MatchFinder->Init(); - if (result == S_OK) - m_DataCurrentPos = m_MatchFinder->GetPointerToCurrentPos(); - m_NumAvailableBytes = m_MatchFinder->GetNumAvailableBytes(); - return result; -} - -// ReleaseStream is required to finish multithreading -STDMETHODIMP_(void) CMatchFinderMT::ReleaseStream() -{ - m_StopWriting = true; - m_CS[m_BlockIndex].Leave(); - if (!m_NeedStart) - { - m_CanChangeBufferPos.Set(); - m_MtWasStopped.Lock(); - m_NeedStart = true; - } - m_MatchFinder->ReleaseStream(); - m_BlockIndex = kNumMTBlocks - 1; - m_CS[m_BlockIndex].Enter(); -} - -STDMETHODIMP_(Byte) CMatchFinderMT::GetIndexByte(Int32 index) -{ - return m_DataCurrentPos[index]; -} - -STDMETHODIMP_(UInt32) CMatchFinderMT::GetMatchLen(Int32 index, UInt32 distance, UInt32 limit) -{ - if ((Int32)(index + limit) > m_NumAvailableBytes) - limit = m_NumAvailableBytes - (index); - distance++; - const Byte *pby = m_DataCurrentPos + index; - UInt32 i; - for(i = 0; i < limit && pby[i] == pby[(size_t)i - distance]; i++); - return i; -} - -STDMETHODIMP_(const Byte *) CMatchFinderMT::GetPointerToCurrentPos() -{ - return m_DataCurrentPos; -} - -STDMETHODIMP_(UInt32) CMatchFinderMT::GetNumAvailableBytes() -{ - return m_NumAvailableBytes; -} - -void CMatchFinderMT::GetNextBlock() -{ - if (m_NeedStart) - { - m_NeedStart = false; - for (UInt32 i = 0; i < kNumMTBlocks; i++) - m_StopReading[i] = false; - m_StopWriting = false; - m_Exit = false; - m_MtWasStarted.Reset(); - m_MtWasStopped.Reset(); - m_CanChangeBufferPos.Reset(); - m_BufferPosWasChanged.Reset(); - m_MtCanStart.Set(); - m_MtWasStarted.Lock(); - m_Result = S_OK; - } - for (;;) - { - UInt32 nextIndex = (m_BlockIndex == kNumMTBlocks - 1) ? 0 : m_BlockIndex + 1; - m_CS[nextIndex].Enter(); - if (!m_StopReading[nextIndex]) - { - m_CS[m_BlockIndex].Leave(); - m_BlockIndex = nextIndex; - break; - } - m_StopReading[nextIndex] = false; - m_CS[nextIndex].Leave(); - m_CanChangeBufferPos.Set(); - m_BufferPosWasChanged.Lock(); - m_CS[nextIndex].Enter(); - m_CS[m_BlockIndex].Leave(); - m_BlockIndex = nextIndex; - } - m_Pos = m_BlockIndex * kBlockSize; - m_PosLimit = m_Buffer[m_Pos++]; - m_NumAvailableBytes = m_Buffer[m_Pos++]; - m_Result = m_Results[m_BlockIndex]; -} - -STDMETHODIMP CMatchFinderMT::GetMatches(UInt32 *distances) -{ - if (m_Pos == m_PosLimit) - GetNextBlock(); - - if (m_Result != S_OK) - return m_Result; - m_NumAvailableBytes--; - m_DataCurrentPos++; - - const UInt32 *buffer = m_Buffer + m_Pos; - UInt32 len = *buffer++; - *distances++ = len; - m_Pos += 1 + len; - for (UInt32 i = 0; i != len; i += 2) - { - distances[i] = buffer[i]; - distances[i + 1] = buffer[i + 1]; - } - return S_OK; -} - -STDMETHODIMP CMatchFinderMT::Skip(UInt32 num) -{ - do - { - if (m_Pos == m_PosLimit) - GetNextBlock(); - - if (m_Result != S_OK) - return m_Result; - m_NumAvailableBytes--; - m_DataCurrentPos++; - - UInt32 len = m_Buffer[m_Pos++]; - m_Pos += len; - } - while(--num != 0); - return S_OK; -} - -STDMETHODIMP_(Int32) CMatchFinderMT::NeedChangeBufferPos(UInt32 /* numCheckBytes */) -{ - throw 1; -} - -STDMETHODIMP_(void) CMatchFinderMT::ChangeBufferPos() -{ - throw 1; -} - - -DWORD CMatchFinderMT::ThreadFunc() -{ - for (;;) - { - bool needStartEvent = true; - m_MtCanStart.Lock(); - HRESULT result = S_OK; - UInt32 blockIndex = 0; - for (;;) - { - m_CS[blockIndex].Enter(); - if (needStartEvent) - { - m_MtWasStarted.Set(); - needStartEvent = false; - } - else - m_CS[(blockIndex == 0) ? kNumMTBlocks - 1 : blockIndex - 1].Leave(); - if (m_Exit) - return 0; - if (m_StopWriting) - { - m_MtWasStopped.Set(); - m_CS[blockIndex].Leave(); - break; - } - if (result == S_OK) - { - IMatchFinder *mf = m_MatchFinder; - if (mf->NeedChangeBufferPos(kBlockSize) != 0) - { - // m_AskChangeBufferPos.Set(); - m_StopReading[blockIndex] = true; - m_CS[blockIndex].Leave(); - m_CanChangeBufferPos.Lock(); - m_CS[blockIndex].Enter(); - const Byte *bufferPosBefore = mf->GetPointerToCurrentPos(); - mf->ChangeBufferPos(); - m_DataCurrentPos += mf->GetPointerToCurrentPos() - bufferPosBefore; - m_BufferPosWasChanged.Set(); - } - else - { - UInt32 curPos = blockIndex * kBlockSize; - UInt32 limit = curPos + kBlockSize - m_MatchMaxLen - m_MatchMaxLen - 1; - UInt32 *buffer = m_Buffer; - m_Results[blockIndex] = S_OK; - curPos++; - UInt32 numAvailableBytes = mf->GetNumAvailableBytes(); - buffer[curPos++] = numAvailableBytes; - - while (numAvailableBytes-- != 0 && curPos < limit) - { - result = mf->GetMatches(buffer + curPos); - if (result != S_OK) - { - m_Results[blockIndex] = result; - break; - } - curPos += buffer[curPos] + 1; - } - buffer[blockIndex * kBlockSize] = curPos; - } - } - else - { - UInt32 curPos = blockIndex * kBlockSize; - m_Buffer[curPos] = curPos + 2; // size of buffer - m_Buffer[curPos + 1] = 0; // NumAvailableBytes - m_Results[blockIndex] = result; // error - } - if (++blockIndex == kNumMTBlocks) - blockIndex = 0; - } - } -} diff --git a/7zip/Compress/LZ/MT/MT.h b/7zip/Compress/LZ/MT/MT.h deleted file mode 100755 index 1ba7b7c9..00000000 --- a/7zip/Compress/LZ/MT/MT.h +++ /dev/null @@ -1,79 +0,0 @@ -// LZ/MT.h - -#ifndef __LZ_MT_H -#define __LZ_MT_H - -#include "../../../../Common/MyCom.h" - -#include "../../../../Windows/Thread.h" -#include "../../../../Windows/Synchronization.h" - -#include "../../../ICoder.h" -#include "../IMatchFinder.h" - -const UInt32 kNumMTBlocks = (1 << 6); - -class CMatchFinderMT: - public IMatchFinder, - public CMyUnknownImp -{ - MY_UNKNOWN_IMP - - STDMETHOD(SetStream)(ISequentialInStream *inStream); - STDMETHOD_(void, ReleaseStream)(); - STDMETHOD(Init)(); - STDMETHOD_(Byte, GetIndexByte)(Int32 index); - STDMETHOD_(UInt32, GetMatchLen)(Int32 index, UInt32 distance, UInt32 limit); - STDMETHOD_(UInt32, GetNumAvailableBytes)(); - STDMETHOD_(const Byte *, GetPointerToCurrentPos)(); - STDMETHOD(Create)(UInt32 sizeHistory, UInt32 keepAddBufferBefore, - UInt32 matchMaxLen, UInt32 keepAddBufferAfter); - STDMETHOD(GetMatches)(UInt32 *distances); - STDMETHOD(Skip)(UInt32 num); - - STDMETHOD_(Int32, NeedChangeBufferPos)(UInt32 numCheckBytes); - STDMETHOD_(void, ChangeBufferPos)(); - - UInt32 m_Pos; - UInt32 m_PosLimit; - UInt32 m_MatchMaxLen; - - UInt32 *m_Buffer; - - bool m_NeedStart; - UInt32 m_BlockIndex; - HRESULT m_Result; - UInt32 m_NumAvailableBytes; - const Byte *m_DataCurrentPos; - - // Common variables - - CMyComPtr m_MatchFinder; - NWindows::CThread m_Thread; - NWindows::NSynchronization::CAutoResetEvent m_MtCanStart; - NWindows::NSynchronization::CAutoResetEvent m_MtWasStarted; - NWindows::NSynchronization::CAutoResetEvent m_MtWasStopped; - NWindows::NSynchronization::CAutoResetEvent m_CanChangeBufferPos; - NWindows::NSynchronization::CAutoResetEvent m_BufferPosWasChanged; - - NWindows::NSynchronization::CCriticalSection m_CS[kNumMTBlocks]; - - HRESULT m_Results[kNumMTBlocks]; - bool m_StopReading[kNumMTBlocks]; - bool m_Exit; - bool m_StopWriting; - - //////////////////////////// - - void FreeMem(); - void GetNextBlock(); -public: - - DWORD ThreadFunc(); - - CMatchFinderMT(); - ~CMatchFinderMT(); - HRESULT SetMatchFinder(IMatchFinder *matchFinder); -}; - -#endif diff --git a/7zip/Compress/LZ/MT/StdAfx.h b/7zip/Compress/LZ/MT/StdAfx.h deleted file mode 100755 index a2f1e97b..00000000 --- a/7zip/Compress/LZ/MT/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Compress/LZ/StdAfx.h b/7zip/Compress/LZ/StdAfx.h deleted file mode 100755 index 3ff6d8a2..00000000 --- a/7zip/Compress/LZ/StdAfx.h +++ /dev/null @@ -1,6 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#endif diff --git a/7zip/Compress/LZMA/DllExports.cpp b/7zip/Compress/LZMA/DllExports.cpp deleted file mode 100755 index 92260f9b..00000000 --- a/7zip/Compress/LZMA/DllExports.cpp +++ /dev/null @@ -1,101 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "../../../Common/MyInitGuid.h" -#include "../../../Common/ComTry.h" -#ifdef _WIN32 -#include "../../../Common/Alloc.h" -#endif - -#include "LZMAEncoder.h" -#include "LZMADecoder.h" -// #include "../../../Common/CRC.h" - -// {23170F69-40C1-278B-0301-010000000000} -DEFINE_GUID(CLSID_CLZMADecoder, -0x23170F69, 0x40C1, 0x278B, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0301-010000000100} -DEFINE_GUID(CLSID_CLZMAEncoder, -0x23170F69, 0x40C1, 0x278B, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD dwReason, LPVOID /*lpReserved*/) -{ - if (dwReason == DLL_PROCESS_ATTACH) - { - // NCompress::NRangeCoder::g_PriceTables.Init(); - // CCRC::InitTable(); - #ifdef _WIN32 - SetLargePageSize(); - #endif - } - return TRUE; -} - -STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject) -{ - // NCompress::NRangeCoder::g_PriceTables.Init(); - // CCRC::InitTable(); - COM_TRY_BEGIN - *outObject = 0; - int correctInterface = (*iid == IID_ICompressCoder); - CMyComPtr coder; - if (*clsid == CLSID_CLZMADecoder) - { - if (!correctInterface) - return E_NOINTERFACE; - coder = (ICompressCoder *)new NCompress::NLZMA::CDecoder(); - } - else if (*clsid == CLSID_CLZMAEncoder) - { - if (!correctInterface) - return E_NOINTERFACE; - coder = (ICompressCoder *)new NCompress::NLZMA::CEncoder(); - } - else - return CLASS_E_CLASSNOTAVAILABLE; - *outObject = coder.Detach(); - COM_TRY_END - return S_OK; -} - -STDAPI GetNumberOfMethods(UINT32 *numMethods) -{ - *numMethods = 1; - return S_OK; -} - -STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value) -{ - if (index != 0) - return E_INVALIDARG; - // ::VariantClear((tagVARIANT *)value); - switch(propID) - { - case NMethodPropID::kID: - { - const char id[] = { 0x03, 0x01, 0x01 }; - if ((value->bstrVal = ::SysAllocStringByteLen(id, sizeof(id))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NMethodPropID::kName: - if ((value->bstrVal = ::SysAllocString(L"LZMA")) != 0) - value->vt = VT_BSTR; - return S_OK; - case NMethodPropID::kDecoder: - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CLZMADecoder, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - case NMethodPropID::kEncoder: - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CLZMAEncoder, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - return S_OK; -} - diff --git a/7zip/Compress/LZMA/LZMA.dsp b/7zip/Compress/LZMA/LZMA.dsp deleted file mode 100755 index 12842272..00000000 --- a/7zip/Compress/LZMA/LZMA.dsp +++ /dev/null @@ -1,387 +0,0 @@ -# Microsoft Developer Studio Project File - Name="LZMA" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=LZMA - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "LZMA.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "LZMA.mak" CFG="LZMA - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "LZMA - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "LZMA - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "LZMA - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMA_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "../../../" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMA_EXPORTS" /D "COMPRESS_MF_MT" /D "_ST_MODE" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-zip\Codecs\LZMA.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none /debug - -!ELSEIF "$(CFG)" == "LZMA - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMA_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "../../../" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMA_EXPORTS" /D "COMPRESS_MF_MT" /D "_ST_MODE" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-zip\Codecs\LZMA.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "LZMA - Win32 Release" -# Name "LZMA - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Codec.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "7-zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "RangeCoder" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\RangeCoder\RangeCoder.h -# End Source File -# Begin Source File - -SOURCE=..\RangeCoder\RangeCoderBit.cpp -# End Source File -# Begin Source File - -SOURCE=..\RangeCoder\RangeCoderBit.h -# End Source File -# Begin Source File - -SOURCE=..\RangeCoder\RangeCoderBitTree.h -# End Source File -# Begin Source File - -SOURCE=..\RangeCoder\RangeCoderOpt.h -# End Source File -# End Group -# Begin Group "Interface" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\ICoder.h -# End Source File -# Begin Source File - -SOURCE=..\MatchFinders\IMatchFinder.h -# End Source File -# Begin Source File - -SOURCE=..\..\IStream.h -# End Source File -# End Group -# Begin Group "LZ" - -# PROP Default_Filter "" -# Begin Group "MT" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\LZ\MT\MT.cpp - -!IF "$(CFG)" == "LZMA - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "LZMA - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\LZ\MT\MT.h -# End Source File -# End Group -# Begin Group "BT" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\LZ\BinTree\BinTree.h -# End Source File -# Begin Source File - -SOURCE=..\LZ\BinTree\BinTree2.h -# End Source File -# Begin Source File - -SOURCE=..\LZ\BinTree\BinTree3.h -# End Source File -# Begin Source File - -SOURCE=..\LZ\BinTree\BinTree4.h -# End Source File -# Begin Source File - -SOURCE=..\LZ\BinTree\BinTreeMain.h -# End Source File -# End Group -# Begin Group "HC" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\LZ\HashChain\HC4.h -# End Source File -# Begin Source File - -SOURCE=..\LZ\HashChain\HCMain.h -# End Source File -# End Group -# Begin Source File - -SOURCE=..\LZ\IMatchFinder.h -# End Source File -# Begin Source File - -SOURCE=..\LZ\LZInWindow.cpp -# End Source File -# Begin Source File - -SOURCE=..\LZ\LZInWindow.h -# End Source File -# Begin Source File - -SOURCE=..\LZ\LZOutWindow.cpp -# End Source File -# Begin Source File - -SOURCE=..\LZ\LZOutWindow.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\AlignedBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\AlignedBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\ComTry.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Defs.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Exception.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\MyCom.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\MyUnknown.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\MyWindows.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\Handle.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Thread.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\LZMA.h -# End Source File -# Begin Source File - -SOURCE=.\LZMADecoder.cpp - -!IF "$(CFG)" == "LZMA - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "LZMA - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\LZMADecoder.h -# End Source File -# Begin Source File - -SOURCE=.\LZMAEncoder.cpp - -!IF "$(CFG)" == "LZMA - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "LZMA - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\LZMAEncoder.h -# End Source File -# End Target -# End Project diff --git a/7zip/Compress/LZMA/LZMA.dsw b/7zip/Compress/LZMA/LZMA.dsw deleted file mode 100755 index f750e453..00000000 --- a/7zip/Compress/LZMA/LZMA.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "LZMA"=".\LZMA.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Compress/LZMA/LZMA.h b/7zip/Compress/LZMA/LZMA.h deleted file mode 100755 index 7bc4c438..00000000 --- a/7zip/Compress/LZMA/LZMA.h +++ /dev/null @@ -1,82 +0,0 @@ -// LZMA.h - -#ifndef __LZMA_H -#define __LZMA_H - -namespace NCompress { -namespace NLZMA { - -const UInt32 kNumRepDistances = 4; - -const int kNumStates = 12; - -const Byte kLiteralNextStates[kNumStates] = {0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5}; -const Byte kMatchNextStates[kNumStates] = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10}; -const Byte kRepNextStates[kNumStates] = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11}; -const Byte kShortRepNextStates[kNumStates]= {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11}; - -class CState -{ -public: - Byte Index; - void Init() { Index = 0; } - void UpdateChar() { Index = kLiteralNextStates[Index]; } - void UpdateMatch() { Index = kMatchNextStates[Index]; } - void UpdateRep() { Index = kRepNextStates[Index]; } - void UpdateShortRep() { Index = kShortRepNextStates[Index]; } - bool IsCharState() const { return Index < 7; } -}; - -const int kNumPosSlotBits = 6; -const int kDicLogSizeMin = 0; -const int kDicLogSizeMax = 32; -const int kDistTableSizeMax = kDicLogSizeMax * 2; - -const UInt32 kNumLenToPosStates = 4; - -inline UInt32 GetLenToPosState(UInt32 len) -{ - len -= 2; - if (len < kNumLenToPosStates) - return len; - return kNumLenToPosStates - 1; -} - -namespace NLength { - -const int kNumPosStatesBitsMax = 4; -const UInt32 kNumPosStatesMax = (1 << kNumPosStatesBitsMax); - -const int kNumPosStatesBitsEncodingMax = 4; -const UInt32 kNumPosStatesEncodingMax = (1 << kNumPosStatesBitsEncodingMax); - -const int kNumLowBits = 3; -const int kNumMidBits = 3; -const int kNumHighBits = 8; -const UInt32 kNumLowSymbols = 1 << kNumLowBits; -const UInt32 kNumMidSymbols = 1 << kNumMidBits; -const UInt32 kNumSymbolsTotal = kNumLowSymbols + kNumMidSymbols + (1 << kNumHighBits); - -} - -const UInt32 kMatchMinLen = 2; -const UInt32 kMatchMaxLen = kMatchMinLen + NLength::kNumSymbolsTotal - 1; - -const int kNumAlignBits = 4; -const UInt32 kAlignTableSize = 1 << kNumAlignBits; -const UInt32 kAlignMask = (kAlignTableSize - 1); - -const UInt32 kStartPosModelIndex = 4; -const UInt32 kEndPosModelIndex = 14; -const UInt32 kNumPosModels = kEndPosModelIndex - kStartPosModelIndex; - -const UInt32 kNumFullDistances = 1 << (kEndPosModelIndex / 2); - -const int kNumLitPosStatesBitsEncodingMax = 4; -const int kNumLitContextBitsMax = 8; - -const int kNumMoveBits = 5; - -}} - -#endif diff --git a/7zip/Compress/LZMA/LZMADecoder.cpp b/7zip/Compress/LZMA/LZMADecoder.cpp deleted file mode 100755 index 75de2245..00000000 --- a/7zip/Compress/LZMA/LZMADecoder.cpp +++ /dev/null @@ -1,338 +0,0 @@ -// LZMADecoder.cpp - -#include "StdAfx.h" - -#include "LZMADecoder.h" -#include "../../../Common/Defs.h" - -namespace NCompress { -namespace NLZMA { - -const int kLenIdFinished = -1; -const int kLenIdNeedInit = -2; - -void CDecoder::Init() -{ - { - for(int i = 0; i < kNumStates; i++) - { - for (UInt32 j = 0; j <= _posStateMask; j++) - { - _isMatch[i][j].Init(); - _isRep0Long[i][j].Init(); - } - _isRep[i].Init(); - _isRepG0[i].Init(); - _isRepG1[i].Init(); - _isRepG2[i].Init(); - } - } - { - for (UInt32 i = 0; i < kNumLenToPosStates; i++) - _posSlotDecoder[i].Init(); - } - { - for(UInt32 i = 0; i < kNumFullDistances - kEndPosModelIndex; i++) - _posDecoders[i].Init(); - } - _posAlignDecoder.Init(); - _lenDecoder.Init(_posStateMask + 1); - _repMatchLenDecoder.Init(_posStateMask + 1); - _literalDecoder.Init(); - - _state.Init(); - _reps[0] = _reps[1] = _reps[2] = _reps[3] = 0; -} - -HRESULT CDecoder::CodeSpec(UInt32 curSize) -{ - if (_outSizeDefined) - { - const UInt64 rem = _outSize - _outWindowStream.GetProcessedSize(); - if (curSize > rem) - curSize = (UInt32)rem; - } - - if (_remainLen == kLenIdFinished) - return S_OK; - if (_remainLen == kLenIdNeedInit) - { - _rangeDecoder.Init(); - Init(); - _remainLen = 0; - } - if (curSize == 0) - return S_OK; - - UInt32 rep0 = _reps[0]; - UInt32 rep1 = _reps[1]; - UInt32 rep2 = _reps[2]; - UInt32 rep3 = _reps[3]; - CState state = _state; - Byte previousByte; - - while(_remainLen > 0 && curSize > 0) - { - previousByte = _outWindowStream.GetByte(rep0); - _outWindowStream.PutByte(previousByte); - _remainLen--; - curSize--; - } - UInt64 nowPos64 = _outWindowStream.GetProcessedSize(); - if (nowPos64 == 0) - previousByte = 0; - else - previousByte = _outWindowStream.GetByte(0); - - while(curSize > 0) - { - { - #ifdef _NO_EXCEPTIONS - if (_rangeDecoder.Stream.ErrorCode != S_OK) - return _rangeDecoder.Stream.ErrorCode; - #endif - if (_rangeDecoder.Stream.WasFinished()) - return S_FALSE; - UInt32 posState = UInt32(nowPos64) & _posStateMask; - if (_isMatch[state.Index][posState].Decode(&_rangeDecoder) == 0) - { - if(!state.IsCharState()) - previousByte = _literalDecoder.DecodeWithMatchByte(&_rangeDecoder, - (UInt32)nowPos64, previousByte, _outWindowStream.GetByte(rep0)); - else - previousByte = _literalDecoder.DecodeNormal(&_rangeDecoder, - (UInt32)nowPos64, previousByte); - _outWindowStream.PutByte(previousByte); - state.UpdateChar(); - curSize--; - nowPos64++; - } - else - { - UInt32 len; - if(_isRep[state.Index].Decode(&_rangeDecoder) == 1) - { - len = 0; - if(_isRepG0[state.Index].Decode(&_rangeDecoder) == 0) - { - if(_isRep0Long[state.Index][posState].Decode(&_rangeDecoder) == 0) - { - state.UpdateShortRep(); - len = 1; - } - } - else - { - UInt32 distance; - if(_isRepG1[state.Index].Decode(&_rangeDecoder) == 0) - distance = rep1; - else - { - if (_isRepG2[state.Index].Decode(&_rangeDecoder) == 0) - distance = rep2; - else - { - distance = rep3; - rep3 = rep2; - } - rep2 = rep1; - } - rep1 = rep0; - rep0 = distance; - } - if (len == 0) - { - len = _repMatchLenDecoder.Decode(&_rangeDecoder, posState) + kMatchMinLen; - state.UpdateRep(); - } - } - else - { - rep3 = rep2; - rep2 = rep1; - rep1 = rep0; - len = kMatchMinLen + _lenDecoder.Decode(&_rangeDecoder, posState); - state.UpdateMatch(); - UInt32 posSlot = _posSlotDecoder[GetLenToPosState(len)].Decode(&_rangeDecoder); - if (posSlot >= kStartPosModelIndex) - { - UInt32 numDirectBits = (posSlot >> 1) - 1; - rep0 = ((2 | (posSlot & 1)) << numDirectBits); - - if (posSlot < kEndPosModelIndex) - rep0 += NRangeCoder::ReverseBitTreeDecode(_posDecoders + - rep0 - posSlot - 1, &_rangeDecoder, numDirectBits); - else - { - rep0 += (_rangeDecoder.DecodeDirectBits( - numDirectBits - kNumAlignBits) << kNumAlignBits); - rep0 += _posAlignDecoder.ReverseDecode(&_rangeDecoder); - if (rep0 == 0xFFFFFFFF) - { - _remainLen = kLenIdFinished; - return S_OK; - } - } - } - else - rep0 = posSlot; - } - UInt32 locLen = len; - if (len > curSize) - locLen = (UInt32)curSize; - if (!_outWindowStream.CopyBlock(rep0, locLen)) - return S_FALSE; - previousByte = _outWindowStream.GetByte(0); - curSize -= locLen; - nowPos64 += locLen; - len -= locLen; - if (len != 0) - { - _remainLen = (Int32)len; - break; - } - - #ifdef _NO_EXCEPTIONS - if (_outWindowStream.ErrorCode != S_OK) - return _outWindowStream.ErrorCode; - #endif - } - } - } - if (_rangeDecoder.Stream.WasFinished()) - return S_FALSE; - _reps[0] = rep0; - _reps[1] = rep1; - _reps[2] = rep2; - _reps[3] = rep3; - _state = state; - - return S_OK; -} - -STDMETHODIMP CDecoder::CodeReal(ISequentialInStream *inStream, - ISequentialOutStream *outStream, - const UInt64 *, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - SetInStream(inStream); - _outWindowStream.SetStream(outStream); - SetOutStreamSize(outSize); - CDecoderFlusher flusher(this); - - for (;;) - { - UInt32 curSize = 1 << 18; - RINOK(CodeSpec(curSize)); - if (_remainLen == kLenIdFinished) - break; - if (progress != NULL) - { - UInt64 inSize = _rangeDecoder.GetProcessedSize(); - UInt64 nowPos64 = _outWindowStream.GetProcessedSize(); - RINOK(progress->SetRatioInfo(&inSize, &nowPos64)); - } - if (_outSizeDefined) - if (_outWindowStream.GetProcessedSize() >= _outSize) - break; - } - flusher.NeedFlush = false; - return Flush(); -} - - -#ifdef _NO_EXCEPTIONS - -#define LZMA_TRY_BEGIN -#define LZMA_TRY_END - -#else - -#define LZMA_TRY_BEGIN try { -#define LZMA_TRY_END } \ - catch(const CInBufferException &e) { return e.ErrorCode; } \ - catch(const CLZOutWindowException &e) { return e.ErrorCode; } \ - catch(...) { return S_FALSE; } - -#endif - - -STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - LZMA_TRY_BEGIN - return CodeReal(inStream, outStream, inSize, outSize, progress); - LZMA_TRY_END -} - -STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *properties, UInt32 size) -{ - if (size < 5) - return E_INVALIDARG; - int lc = properties[0] % 9; - Byte remainder = (Byte)(properties[0] / 9); - int lp = remainder % 5; - int pb = remainder / 5; - if (pb > NLength::kNumPosStatesBitsMax) - return E_INVALIDARG; - _posStateMask = (1 << pb) - 1; - UInt32 dictionarySize = 0; - for (int i = 0; i < 4; i++) - dictionarySize += ((UInt32)(properties[1 + i])) << (i * 8); - if (!_outWindowStream.Create(dictionarySize)) - return E_OUTOFMEMORY; - if (!_literalDecoder.Create(lp, lc)) - return E_OUTOFMEMORY; - if (!_rangeDecoder.Create(1 << 20)) - return E_OUTOFMEMORY; - return S_OK; -} - -STDMETHODIMP CDecoder::GetInStreamProcessedSize(UInt64 *value) -{ - *value = _rangeDecoder.GetProcessedSize(); - return S_OK; -} - -STDMETHODIMP CDecoder::SetInStream(ISequentialInStream *inStream) -{ - _rangeDecoder.SetStream(inStream); - return S_OK; -} - -STDMETHODIMP CDecoder::ReleaseInStream() -{ - _rangeDecoder.ReleaseStream(); - return S_OK; -} - -STDMETHODIMP CDecoder::SetOutStreamSize(const UInt64 *outSize) -{ - _outSizeDefined = (outSize != NULL); - if (_outSizeDefined) - _outSize = *outSize; - _remainLen = kLenIdNeedInit; - _outWindowStream.Init(); - return S_OK; -} - -#ifdef _ST_MODE - -STDMETHODIMP CDecoder::Read(void *data, UInt32 size, UInt32 *processedSize) -{ - LZMA_TRY_BEGIN - if (processedSize) - *processedSize = 0; - const UInt64 startPos = _outWindowStream.GetProcessedSize(); - _outWindowStream.SetMemStream((Byte *)data); - RINOK(CodeSpec(size)); - if (processedSize) - *processedSize = (UInt32)(_outWindowStream.GetProcessedSize() - startPos); - return Flush(); - LZMA_TRY_END -} - -#endif - -}} diff --git a/7zip/Compress/LZMA/LZMADecoder.h b/7zip/Compress/LZMA/LZMADecoder.h deleted file mode 100755 index 1c10409f..00000000 --- a/7zip/Compress/LZMA/LZMADecoder.h +++ /dev/null @@ -1,251 +0,0 @@ -// LZMA/Decoder.h - -#ifndef __LZMA_DECODER_H -#define __LZMA_DECODER_H - -#include "../../../Common/MyCom.h" -#include "../../../Common/Alloc.h" -#include "../../ICoder.h" -#include "../LZ/LZOutWindow.h" -#include "../RangeCoder/RangeCoderBitTree.h" - -#include "LZMA.h" - -namespace NCompress { -namespace NLZMA { - -typedef NRangeCoder::CBitDecoder CMyBitDecoder; - -class CLiteralDecoder2 -{ - CMyBitDecoder _decoders[0x300]; -public: - void Init() - { - for (int i = 0; i < 0x300; i++) - _decoders[i].Init(); - } - Byte DecodeNormal(NRangeCoder::CDecoder *rangeDecoder) - { - UInt32 symbol = 1; - RC_INIT_VAR - do - { - // symbol = (symbol << 1) | _decoders[0][symbol].Decode(rangeDecoder); - RC_GETBIT(kNumMoveBits, _decoders[symbol].Prob, symbol) - } - while (symbol < 0x100); - RC_FLUSH_VAR - return (Byte)symbol; - } - Byte DecodeWithMatchByte(NRangeCoder::CDecoder *rangeDecoder, Byte matchByte) - { - UInt32 symbol = 1; - RC_INIT_VAR - do - { - UInt32 matchBit = (matchByte >> 7) & 1; - matchByte <<= 1; - // UInt32 bit = _decoders[1 + matchBit][symbol].Decode(rangeDecoder); - // symbol = (symbol << 1) | bit; - UInt32 bit; - RC_GETBIT2(kNumMoveBits, _decoders[0x100 + (matchBit << 8) + symbol].Prob, symbol, - bit = 0, bit = 1) - if (matchBit != bit) - { - while (symbol < 0x100) - { - // symbol = (symbol << 1) | _decoders[0][symbol].Decode(rangeDecoder); - RC_GETBIT(kNumMoveBits, _decoders[symbol].Prob, symbol) - } - break; - } - } - while (symbol < 0x100); - RC_FLUSH_VAR - return (Byte)symbol; - } -}; - -class CLiteralDecoder -{ - CLiteralDecoder2 *_coders; - int _numPrevBits; - int _numPosBits; - UInt32 _posMask; -public: - CLiteralDecoder(): _coders(0) {} - ~CLiteralDecoder() { Free(); } - void Free() - { - MyFree(_coders); - _coders = 0; - } - bool Create(int numPosBits, int numPrevBits) - { - if (_coders == 0 || (numPosBits + numPrevBits) != - (_numPrevBits + _numPosBits) ) - { - Free(); - UInt32 numStates = 1 << (numPosBits + numPrevBits); - _coders = (CLiteralDecoder2 *)MyAlloc(numStates * sizeof(CLiteralDecoder2)); - } - _numPosBits = numPosBits; - _posMask = (1 << numPosBits) - 1; - _numPrevBits = numPrevBits; - return (_coders != 0); - } - void Init() - { - UInt32 numStates = 1 << (_numPrevBits + _numPosBits); - for (UInt32 i = 0; i < numStates; i++) - _coders[i].Init(); - } - UInt32 GetState(UInt32 pos, Byte prevByte) const - { return ((pos & _posMask) << _numPrevBits) + (prevByte >> (8 - _numPrevBits)); } - Byte DecodeNormal(NRangeCoder::CDecoder *rangeDecoder, UInt32 pos, Byte prevByte) - { return _coders[GetState(pos, prevByte)].DecodeNormal(rangeDecoder); } - Byte DecodeWithMatchByte(NRangeCoder::CDecoder *rangeDecoder, UInt32 pos, Byte prevByte, Byte matchByte) - { return _coders[GetState(pos, prevByte)].DecodeWithMatchByte(rangeDecoder, matchByte); } -}; - -namespace NLength { - -class CDecoder -{ - CMyBitDecoder _choice; - CMyBitDecoder _choice2; - NRangeCoder::CBitTreeDecoder _lowCoder[kNumPosStatesMax]; - NRangeCoder::CBitTreeDecoder _midCoder[kNumPosStatesMax]; - NRangeCoder::CBitTreeDecoder _highCoder; -public: - void Init(UInt32 numPosStates) - { - _choice.Init(); - _choice2.Init(); - for (UInt32 posState = 0; posState < numPosStates; posState++) - { - _lowCoder[posState].Init(); - _midCoder[posState].Init(); - } - _highCoder.Init(); - } - UInt32 Decode(NRangeCoder::CDecoder *rangeDecoder, UInt32 posState) - { - if(_choice.Decode(rangeDecoder) == 0) - return _lowCoder[posState].Decode(rangeDecoder); - if(_choice2.Decode(rangeDecoder) == 0) - return kNumLowSymbols + _midCoder[posState].Decode(rangeDecoder); - return kNumLowSymbols + kNumMidSymbols + _highCoder.Decode(rangeDecoder); - } -}; - -} - -class CDecoder: - public ICompressCoder, - public ICompressSetDecoderProperties2, - public ICompressGetInStreamProcessedSize, - #ifdef _ST_MODE - public ICompressSetInStream, - public ICompressSetOutStreamSize, - public ISequentialInStream, - #endif - public CMyUnknownImp -{ - CLZOutWindow _outWindowStream; - NRangeCoder::CDecoder _rangeDecoder; - - CMyBitDecoder _isMatch[kNumStates][NLength::kNumPosStatesMax]; - CMyBitDecoder _isRep[kNumStates]; - CMyBitDecoder _isRepG0[kNumStates]; - CMyBitDecoder _isRepG1[kNumStates]; - CMyBitDecoder _isRepG2[kNumStates]; - CMyBitDecoder _isRep0Long[kNumStates][NLength::kNumPosStatesMax]; - - NRangeCoder::CBitTreeDecoder _posSlotDecoder[kNumLenToPosStates]; - - CMyBitDecoder _posDecoders[kNumFullDistances - kEndPosModelIndex]; - NRangeCoder::CBitTreeDecoder _posAlignDecoder; - - NLength::CDecoder _lenDecoder; - NLength::CDecoder _repMatchLenDecoder; - - CLiteralDecoder _literalDecoder; - - UInt32 _posStateMask; - - /////////////////// - // State - UInt32 _reps[4]; - CState _state; - Int32 _remainLen; // -1 means end of stream. // -2 means need Init - UInt64 _outSize; - bool _outSizeDefined; - - void Init(); - HRESULT CodeSpec(UInt32 size); -public: - - #ifdef _ST_MODE - MY_UNKNOWN_IMP5( - ICompressSetDecoderProperties2, - ICompressGetInStreamProcessedSize, - ICompressSetInStream, - ICompressSetOutStreamSize, - ISequentialInStream) - #else - MY_UNKNOWN_IMP2( - ICompressSetDecoderProperties2, - ICompressGetInStreamProcessedSize) - #endif - - void ReleaseStreams() - { - _outWindowStream.ReleaseStream(); - ReleaseInStream(); - } - - class CDecoderFlusher - { - CDecoder *_decoder; - public: - bool NeedFlush; - CDecoderFlusher(CDecoder *decoder): _decoder(decoder), NeedFlush(true) {} - ~CDecoderFlusher() - { - if (NeedFlush) - _decoder->Flush(); - _decoder->ReleaseStreams(); - } - }; - - HRESULT Flush() { return _outWindowStream.Flush(); } - - STDMETHOD(CodeReal)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - STDMETHOD(Code)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size); - - STDMETHOD(GetInStreamProcessedSize)(UInt64 *value); - - STDMETHOD(SetInStream)(ISequentialInStream *inStream); - STDMETHOD(ReleaseInStream)(); - STDMETHOD(SetOutStreamSize)(const UInt64 *outSize); - - #ifdef _ST_MODE - STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); - #endif - - CDecoder(): _outSizeDefined(false) {} - virtual ~CDecoder() {} -}; - -}} - -#endif diff --git a/7zip/Compress/LZMA/LZMAEncoder.cpp b/7zip/Compress/LZMA/LZMAEncoder.cpp deleted file mode 100755 index 4f0bcf0f..00000000 --- a/7zip/Compress/LZMA/LZMAEncoder.cpp +++ /dev/null @@ -1,1565 +0,0 @@ -// LZMA/Encoder.cpp - -#include "StdAfx.h" - -#include "../../../Common/Defs.h" -#include "../../Common/StreamUtils.h" - -#include "LZMAEncoder.h" - -// for minimal compressing code size define these: -// #define COMPRESS_MF_BT -// #define COMPRESS_MF_BT4 - -#if !defined(COMPRESS_MF_BT) && !defined(COMPRESS_MF_HC) -#define COMPRESS_MF_BT -#define COMPRESS_MF_HC -#endif - -#ifdef COMPRESS_MF_BT -#if !defined(COMPRESS_MF_BT2) && !defined(COMPRESS_MF_BT3) && !defined(COMPRESS_MF_BT4) -#define COMPRESS_MF_BT2 -#define COMPRESS_MF_BT3 -#define COMPRESS_MF_BT4 -#endif -#ifdef COMPRESS_MF_BT2 -#include "../LZ/BinTree/BinTree2.h" -#endif -#ifdef COMPRESS_MF_BT3 -#include "../LZ/BinTree/BinTree3.h" -#endif -#ifdef COMPRESS_MF_BT4 -#include "../LZ/BinTree/BinTree4.h" -#endif -#endif - -#ifdef COMPRESS_MF_HC -#include "../LZ/HashChain/HC4.h" -#endif - -#ifdef COMPRESS_MF_MT -#include "../LZ/MT/MT.h" -#endif - -namespace NCompress { -namespace NLZMA { - -const int kDefaultDictionaryLogSize = 22; -const UInt32 kNumFastBytesDefault = 0x20; - -enum -{ - kBT2, - kBT3, - kBT4, - kHC4 -}; - -static const wchar_t *kMatchFinderIDs[] = -{ - L"BT2", - L"BT3", - L"BT4", - L"HC4" -}; - -Byte g_FastPos[1 << 11]; - -class CFastPosInit -{ -public: - CFastPosInit() { Init(); } - void Init() - { - const Byte kFastSlots = 22; - int c = 2; - g_FastPos[0] = 0; - g_FastPos[1] = 1; - - for (Byte slotFast = 2; slotFast < kFastSlots; slotFast++) - { - UInt32 k = (1 << ((slotFast >> 1) - 1)); - for (UInt32 j = 0; j < k; j++, c++) - g_FastPos[c] = slotFast; - } - } -} g_FastPosInit; - - -void CLiteralEncoder2::Encode(NRangeCoder::CEncoder *rangeEncoder, Byte symbol) -{ - UInt32 context = 1; - int i = 8; - do - { - i--; - UInt32 bit = (symbol >> i) & 1; - _encoders[context].Encode(rangeEncoder, bit); - context = (context << 1) | bit; - } - while(i != 0); -} - -void CLiteralEncoder2::EncodeMatched(NRangeCoder::CEncoder *rangeEncoder, - Byte matchByte, Byte symbol) -{ - UInt32 context = 1; - int i = 8; - do - { - i--; - UInt32 bit = (symbol >> i) & 1; - UInt32 matchBit = (matchByte >> i) & 1; - _encoders[0x100 + (matchBit << 8) + context].Encode(rangeEncoder, bit); - context = (context << 1) | bit; - if (matchBit != bit) - { - while(i != 0) - { - i--; - UInt32 bit = (symbol >> i) & 1; - _encoders[context].Encode(rangeEncoder, bit); - context = (context << 1) | bit; - } - break; - } - } - while(i != 0); -} - -UInt32 CLiteralEncoder2::GetPrice(bool matchMode, Byte matchByte, Byte symbol) const -{ - UInt32 price = 0; - UInt32 context = 1; - int i = 8; - if (matchMode) - { - do - { - i--; - UInt32 matchBit = (matchByte >> i) & 1; - UInt32 bit = (symbol >> i) & 1; - price += _encoders[0x100 + (matchBit << 8) + context].GetPrice(bit); - context = (context << 1) | bit; - if (matchBit != bit) - break; - } - while (i != 0); - } - while(i != 0) - { - i--; - UInt32 bit = (symbol >> i) & 1; - price += _encoders[context].GetPrice(bit); - context = (context << 1) | bit; - } - return price; -}; - - -namespace NLength { - -void CEncoder::Init(UInt32 numPosStates) -{ - _choice.Init(); - _choice2.Init(); - for (UInt32 posState = 0; posState < numPosStates; posState++) - { - _lowCoder[posState].Init(); - _midCoder[posState].Init(); - } - _highCoder.Init(); -} - -void CEncoder::Encode(NRangeCoder::CEncoder *rangeEncoder, UInt32 symbol, UInt32 posState) -{ - if(symbol < kNumLowSymbols) - { - _choice.Encode(rangeEncoder, 0); - _lowCoder[posState].Encode(rangeEncoder, symbol); - } - else - { - _choice.Encode(rangeEncoder, 1); - if(symbol < kNumLowSymbols + kNumMidSymbols) - { - _choice2.Encode(rangeEncoder, 0); - _midCoder[posState].Encode(rangeEncoder, symbol - kNumLowSymbols); - } - else - { - _choice2.Encode(rangeEncoder, 1); - _highCoder.Encode(rangeEncoder, symbol - kNumLowSymbols - kNumMidSymbols); - } - } -} - -void CEncoder::SetPrices(UInt32 posState, UInt32 numSymbols, UInt32 *prices) const -{ - UInt32 a0 = _choice.GetPrice0(); - UInt32 a1 = _choice.GetPrice1(); - UInt32 b0 = a1 + _choice2.GetPrice0(); - UInt32 b1 = a1 + _choice2.GetPrice1(); - UInt32 i = 0; - for (i = 0; i < kNumLowSymbols; i++) - { - if (i >= numSymbols) - return; - prices[i] = a0 + _lowCoder[posState].GetPrice(i); - } - for (; i < kNumLowSymbols + kNumMidSymbols; i++) - { - if (i >= numSymbols) - return; - prices[i] = b0 + _midCoder[posState].GetPrice(i - kNumLowSymbols); - } - for (; i < numSymbols; i++) - prices[i] = b1 + _highCoder.GetPrice(i - kNumLowSymbols - kNumMidSymbols); -} - -} -CEncoder::CEncoder(): - _numFastBytes(kNumFastBytesDefault), - _distTableSize(kDefaultDictionaryLogSize * 2), - _posStateBits(2), - _posStateMask(4 - 1), - _numLiteralPosStateBits(0), - _numLiteralContextBits(3), - _dictionarySize(1 << kDefaultDictionaryLogSize), - _dictionarySizePrev(UInt32(-1)), - _numFastBytesPrev(UInt32(-1)), - _matchFinderCycles(0), - _matchFinderIndex(kBT4), - #ifdef COMPRESS_MF_MT - _multiThread(false), - #endif - _writeEndMark(false), - setMfPasses(0) -{ - // _maxMode = false; - _fastMode = false; -} - -HRESULT CEncoder::Create() -{ - if (!_rangeEncoder.Create(1 << 20)) - return E_OUTOFMEMORY; - if (!_matchFinder) - { - switch(_matchFinderIndex) - { - #ifdef COMPRESS_MF_BT - #ifdef COMPRESS_MF_BT2 - case kBT2: - { - NBT2::CMatchFinder *mfSpec = new NBT2::CMatchFinder; - setMfPasses = mfSpec; - _matchFinder = mfSpec; - break; - } - #endif - #ifdef COMPRESS_MF_BT3 - case kBT3: - { - NBT3::CMatchFinder *mfSpec = new NBT3::CMatchFinder; - setMfPasses = mfSpec; - _matchFinder = mfSpec; - break; - } - #endif - #ifdef COMPRESS_MF_BT4 - case kBT4: - { - NBT4::CMatchFinder *mfSpec = new NBT4::CMatchFinder; - setMfPasses = mfSpec; - _matchFinder = mfSpec; - break; - } - #endif - #endif - - #ifdef COMPRESS_MF_HC - case kHC4: - { - NHC4::CMatchFinder *mfSpec = new NHC4::CMatchFinder; - setMfPasses = mfSpec; - _matchFinder = mfSpec; - break; - } - #endif - } - if (_matchFinder == 0) - return E_OUTOFMEMORY; - - #ifdef COMPRESS_MF_MT - if (_multiThread && !(_fastMode && (_matchFinderIndex == kHC4))) - { - CMatchFinderMT *mfSpec = new CMatchFinderMT; - if (mfSpec == 0) - return E_OUTOFMEMORY; - CMyComPtr mf = mfSpec; - RINOK(mfSpec->SetMatchFinder(_matchFinder)); - _matchFinder.Release(); - _matchFinder = mf; - } - #endif - } - - if (!_literalEncoder.Create(_numLiteralPosStateBits, _numLiteralContextBits)) - return E_OUTOFMEMORY; - - if (_dictionarySize == _dictionarySizePrev && _numFastBytesPrev == _numFastBytes) - return S_OK; - RINOK(_matchFinder->Create(_dictionarySize, kNumOpts, _numFastBytes, kMatchMaxLen + 1)); // actually it's + _numFastBytes - _numFastBytes - if (_matchFinderCycles != 0 && setMfPasses != 0) - setMfPasses->SetNumPasses(_matchFinderCycles); - _dictionarySizePrev = _dictionarySize; - _numFastBytesPrev = _numFastBytes; - return S_OK; -} - -static bool AreStringsEqual(const wchar_t *base, const wchar_t *testString) -{ - for (;;) - { - wchar_t c = *testString; - if (c >= 'a' && c <= 'z') - c -= 0x20; - if (*base != c) - return false; - if (c == 0) - return true; - base++; - testString++; - } -} - -static int FindMatchFinder(const wchar_t *s) -{ - for (int m = 0; m < (int)(sizeof(kMatchFinderIDs) / sizeof(kMatchFinderIDs[0])); m++) - if (AreStringsEqual(kMatchFinderIDs[m], s)) - return m; - return -1; -} - -STDMETHODIMP CEncoder::SetCoderProperties(const PROPID *propIDs, - const PROPVARIANT *properties, UInt32 numProperties) -{ - for (UInt32 i = 0; i < numProperties; i++) - { - const PROPVARIANT &prop = properties[i]; - switch(propIDs[i]) - { - case NCoderPropID::kNumFastBytes: - { - if (prop.vt != VT_UI4) - return E_INVALIDARG; - UInt32 numFastBytes = prop.ulVal; - if(numFastBytes < 5 || numFastBytes > kMatchMaxLen) - return E_INVALIDARG; - _numFastBytes = numFastBytes; - break; - } - case NCoderPropID::kMatchFinderCycles: - { - if (prop.vt != VT_UI4) - return E_INVALIDARG; - _matchFinderCycles = prop.ulVal; - break; - } - case NCoderPropID::kAlgorithm: - { - if (prop.vt != VT_UI4) - return E_INVALIDARG; - UInt32 maximize = prop.ulVal; - _fastMode = (maximize == 0); - // _maxMode = (maximize >= 2); - break; - } - case NCoderPropID::kMatchFinder: - { - if (prop.vt != VT_BSTR) - return E_INVALIDARG; - int matchFinderIndexPrev = _matchFinderIndex; - int m = FindMatchFinder(prop.bstrVal); - if (m < 0) - return E_INVALIDARG; - _matchFinderIndex = m; - if (_matchFinder && matchFinderIndexPrev != _matchFinderIndex) - { - _dictionarySizePrev = (UInt32)-1; - ReleaseMatchFinder(); - } - break; - } - #ifdef COMPRESS_MF_MT - case NCoderPropID::kMultiThread: - { - if (prop.vt != VT_BOOL) - return E_INVALIDARG; - bool newMultiThread = (prop.boolVal == VARIANT_TRUE); - if (newMultiThread != _multiThread) - { - _dictionarySizePrev = (UInt32)-1; - ReleaseMatchFinder(); - _multiThread = newMultiThread; - } - break; - } - case NCoderPropID::kNumThreads: - { - if (prop.vt != VT_UI4) - return E_INVALIDARG; - bool newMultiThread = (prop.ulVal > 1); - if (newMultiThread != _multiThread) - { - _dictionarySizePrev = (UInt32)-1; - ReleaseMatchFinder(); - _multiThread = newMultiThread; - } - break; - } - #endif - case NCoderPropID::kDictionarySize: - { - const int kDicLogSizeMaxCompress = 30; - if (prop.vt != VT_UI4) - return E_INVALIDARG; - UInt32 dictionarySize = prop.ulVal; - if (dictionarySize < UInt32(1 << kDicLogSizeMin) || - dictionarySize > UInt32(1 << kDicLogSizeMaxCompress)) - return E_INVALIDARG; - _dictionarySize = dictionarySize; - UInt32 dicLogSize; - for(dicLogSize = 0; dicLogSize < (UInt32)kDicLogSizeMaxCompress; dicLogSize++) - if (dictionarySize <= (UInt32(1) << dicLogSize)) - break; - _distTableSize = dicLogSize * 2; - break; - } - case NCoderPropID::kPosStateBits: - { - if (prop.vt != VT_UI4) - return E_INVALIDARG; - UInt32 value = prop.ulVal; - if (value > (UInt32)NLength::kNumPosStatesBitsEncodingMax) - return E_INVALIDARG; - _posStateBits = value; - _posStateMask = (1 << _posStateBits) - 1; - break; - } - case NCoderPropID::kLitPosBits: - { - if (prop.vt != VT_UI4) - return E_INVALIDARG; - UInt32 value = prop.ulVal; - if (value > (UInt32)kNumLitPosStatesBitsEncodingMax) - return E_INVALIDARG; - _numLiteralPosStateBits = value; - break; - } - case NCoderPropID::kLitContextBits: - { - if (prop.vt != VT_UI4) - return E_INVALIDARG; - UInt32 value = prop.ulVal; - if (value > (UInt32)kNumLitContextBitsMax) - return E_INVALIDARG; - _numLiteralContextBits = value; - break; - } - case NCoderPropID::kEndMarker: - { - if (prop.vt != VT_BOOL) - return E_INVALIDARG; - SetWriteEndMarkerMode(prop.boolVal == VARIANT_TRUE); - break; - } - default: - return E_INVALIDARG; - } - } - return S_OK; -} - -STDMETHODIMP CEncoder::WriteCoderProperties(ISequentialOutStream *outStream) -{ - const UInt32 kPropSize = 5; - Byte properties[kPropSize]; - properties[0] = (Byte)((_posStateBits * 5 + _numLiteralPosStateBits) * 9 + _numLiteralContextBits); - for (int i = 0; i < 4; i++) - properties[1 + i] = Byte(_dictionarySize >> (8 * i)); - return WriteStream(outStream, properties, kPropSize, NULL); -} - -STDMETHODIMP CEncoder::SetOutStream(ISequentialOutStream *outStream) -{ - _rangeEncoder.SetStream(outStream); - return S_OK; -} - -STDMETHODIMP CEncoder::ReleaseOutStream() -{ - _rangeEncoder.ReleaseStream(); - return S_OK; -} - -HRESULT CEncoder::Init() -{ - CBaseState::Init(); - - // RINOK(_matchFinder->Init(inStream)); - _rangeEncoder.Init(); - - for(int i = 0; i < kNumStates; i++) - { - for (UInt32 j = 0; j <= _posStateMask; j++) - { - _isMatch[i][j].Init(); - _isRep0Long[i][j].Init(); - } - _isRep[i].Init(); - _isRepG0[i].Init(); - _isRepG1[i].Init(); - _isRepG2[i].Init(); - } - - _literalEncoder.Init(); - - { - for(UInt32 i = 0; i < kNumLenToPosStates; i++) - _posSlotEncoder[i].Init(); - } - { - for(UInt32 i = 0; i < kNumFullDistances - kEndPosModelIndex; i++) - _posEncoders[i].Init(); - } - - _lenEncoder.Init(1 << _posStateBits); - _repMatchLenEncoder.Init(1 << _posStateBits); - - _posAlignEncoder.Init(); - - _longestMatchWasFound = false; - _optimumEndIndex = 0; - _optimumCurrentIndex = 0; - _additionalOffset = 0; - - return S_OK; -} - -HRESULT CEncoder::MovePos(UInt32 num) -{ - if (num == 0) - return S_OK; - _additionalOffset += num; - return _matchFinder->Skip(num); -} - -UInt32 CEncoder::Backward(UInt32 &backRes, UInt32 cur) -{ - _optimumEndIndex = cur; - UInt32 posMem = _optimum[cur].PosPrev; - UInt32 backMem = _optimum[cur].BackPrev; - do - { - if (_optimum[cur].Prev1IsChar) - { - _optimum[posMem].MakeAsChar(); - _optimum[posMem].PosPrev = posMem - 1; - if (_optimum[cur].Prev2) - { - _optimum[posMem - 1].Prev1IsChar = false; - _optimum[posMem - 1].PosPrev = _optimum[cur].PosPrev2; - _optimum[posMem - 1].BackPrev = _optimum[cur].BackPrev2; - } - } - UInt32 posPrev = posMem; - UInt32 backCur = backMem; - - backMem = _optimum[posPrev].BackPrev; - posMem = _optimum[posPrev].PosPrev; - - _optimum[posPrev].BackPrev = backCur; - _optimum[posPrev].PosPrev = cur; - cur = posPrev; - } - while(cur != 0); - backRes = _optimum[0].BackPrev; - _optimumCurrentIndex = _optimum[0].PosPrev; - return _optimumCurrentIndex; -} - -/* -Out: - (lenRes == 1) && (backRes == 0xFFFFFFFF) means Literal -*/ - -HRESULT CEncoder::GetOptimum(UInt32 position, UInt32 &backRes, UInt32 &lenRes) -{ - if(_optimumEndIndex != _optimumCurrentIndex) - { - const COptimal &optimum = _optimum[_optimumCurrentIndex]; - lenRes = optimum.PosPrev - _optimumCurrentIndex; - backRes = optimum.BackPrev; - _optimumCurrentIndex = optimum.PosPrev; - return S_OK; - } - _optimumCurrentIndex = _optimumEndIndex = 0; - - UInt32 lenMain, numDistancePairs; - if (!_longestMatchWasFound) - { - RINOK(ReadMatchDistances(lenMain, numDistancePairs)); - } - else - { - lenMain = _longestMatchLength; - numDistancePairs = _numDistancePairs; - _longestMatchWasFound = false; - } - - const Byte *data = _matchFinder->GetPointerToCurrentPos() - 1; - UInt32 numAvailableBytes = _matchFinder->GetNumAvailableBytes() + 1; - if (numAvailableBytes < 2) - { - backRes = (UInt32)(-1); - lenRes = 1; - return S_OK; - } - if (numAvailableBytes > kMatchMaxLen) - numAvailableBytes = kMatchMaxLen; - - UInt32 reps[kNumRepDistances]; - UInt32 repLens[kNumRepDistances]; - UInt32 repMaxIndex = 0; - UInt32 i; - for(i = 0; i < kNumRepDistances; i++) - { - reps[i] = _repDistances[i]; - UInt32 backOffset = reps[i] + 1; - if (data[0] != data[(size_t)0 - backOffset] || data[1] != data[(size_t)1 - backOffset]) - { - repLens[i] = 0; - continue; - } - UInt32 lenTest; - for (lenTest = 2; lenTest < numAvailableBytes && - data[lenTest] == data[(size_t)lenTest - backOffset]; lenTest++); - repLens[i] = lenTest; - if (lenTest > repLens[repMaxIndex]) - repMaxIndex = i; - } - if(repLens[repMaxIndex] >= _numFastBytes) - { - backRes = repMaxIndex; - lenRes = repLens[repMaxIndex]; - return MovePos(lenRes - 1); - } - - UInt32 *matchDistances = _matchDistances + 1; - if(lenMain >= _numFastBytes) - { - backRes = matchDistances[numDistancePairs - 1] + kNumRepDistances; - lenRes = lenMain; - return MovePos(lenMain - 1); - } - Byte currentByte = *data; - Byte matchByte = data[(size_t)0 - reps[0] - 1]; - - if(lenMain < 2 && currentByte != matchByte && repLens[repMaxIndex] < 2) - { - backRes = (UInt32)-1; - lenRes = 1; - return S_OK; - } - - _optimum[0].State = _state; - - UInt32 posState = (position & _posStateMask); - - _optimum[1].Price = _isMatch[_state.Index][posState].GetPrice0() + - _literalEncoder.GetSubCoder(position, _previousByte)->GetPrice(!_state.IsCharState(), matchByte, currentByte); - _optimum[1].MakeAsChar(); - - UInt32 matchPrice = _isMatch[_state.Index][posState].GetPrice1(); - UInt32 repMatchPrice = matchPrice + _isRep[_state.Index].GetPrice1(); - - if(matchByte == currentByte) - { - UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(_state, posState); - if(shortRepPrice < _optimum[1].Price) - { - _optimum[1].Price = shortRepPrice; - _optimum[1].MakeAsShortRep(); - } - } - UInt32 lenEnd = ((lenMain >= repLens[repMaxIndex]) ? lenMain : repLens[repMaxIndex]); - - if(lenEnd < 2) - { - backRes = _optimum[1].BackPrev; - lenRes = 1; - return S_OK; - } - - _optimum[1].PosPrev = 0; - for (i = 0; i < kNumRepDistances; i++) - _optimum[0].Backs[i] = reps[i]; - - UInt32 len = lenEnd; - do - _optimum[len--].Price = kIfinityPrice; - while (len >= 2); - - for(i = 0; i < kNumRepDistances; i++) - { - UInt32 repLen = repLens[i]; - if (repLen < 2) - continue; - UInt32 price = repMatchPrice + GetPureRepPrice(i, _state, posState); - do - { - UInt32 curAndLenPrice = price + _repMatchLenEncoder.GetPrice(repLen - 2, posState); - COptimal &optimum = _optimum[repLen]; - if (curAndLenPrice < optimum.Price) - { - optimum.Price = curAndLenPrice; - optimum.PosPrev = 0; - optimum.BackPrev = i; - optimum.Prev1IsChar = false; - } - } - while(--repLen >= 2); - } - - UInt32 normalMatchPrice = matchPrice + _isRep[_state.Index].GetPrice0(); - - len = ((repLens[0] >= 2) ? repLens[0] + 1 : 2); - if (len <= lenMain) - { - UInt32 offs = 0; - while (len > matchDistances[offs]) - offs += 2; - for(; ; len++) - { - UInt32 distance = matchDistances[offs + 1]; - UInt32 curAndLenPrice = normalMatchPrice + GetPosLenPrice(distance, len, posState); - COptimal &optimum = _optimum[len]; - if (curAndLenPrice < optimum.Price) - { - optimum.Price = curAndLenPrice; - optimum.PosPrev = 0; - optimum.BackPrev = distance + kNumRepDistances; - optimum.Prev1IsChar = false; - } - if (len == matchDistances[offs]) - { - offs += 2; - if (offs == numDistancePairs) - break; - } - } - } - - UInt32 cur = 0; - - for (;;) - { - cur++; - if(cur == lenEnd) - { - lenRes = Backward(backRes, cur); - return S_OK; - } - UInt32 newLen, numDistancePairs; - RINOK(ReadMatchDistances(newLen, numDistancePairs)); - if(newLen >= _numFastBytes) - { - _numDistancePairs = numDistancePairs; - _longestMatchLength = newLen; - _longestMatchWasFound = true; - lenRes = Backward(backRes, cur); - return S_OK; - } - position++; - COptimal &curOptimum = _optimum[cur]; - UInt32 posPrev = curOptimum.PosPrev; - CState state; - if (curOptimum.Prev1IsChar) - { - posPrev--; - if (curOptimum.Prev2) - { - state = _optimum[curOptimum.PosPrev2].State; - if (curOptimum.BackPrev2 < kNumRepDistances) - state.UpdateRep(); - else - state.UpdateMatch(); - } - else - state = _optimum[posPrev].State; - state.UpdateChar(); - } - else - state = _optimum[posPrev].State; - if (posPrev == cur - 1) - { - if (curOptimum.IsShortRep()) - state.UpdateShortRep(); - else - state.UpdateChar(); - } - else - { - UInt32 pos; - if (curOptimum.Prev1IsChar && curOptimum.Prev2) - { - posPrev = curOptimum.PosPrev2; - pos = curOptimum.BackPrev2; - state.UpdateRep(); - } - else - { - pos = curOptimum.BackPrev; - if (pos < kNumRepDistances) - state.UpdateRep(); - else - state.UpdateMatch(); - } - const COptimal &prevOptimum = _optimum[posPrev]; - if (pos < kNumRepDistances) - { - reps[0] = prevOptimum.Backs[pos]; - UInt32 i; - for(i = 1; i <= pos; i++) - reps[i] = prevOptimum.Backs[i - 1]; - for(; i < kNumRepDistances; i++) - reps[i] = prevOptimum.Backs[i]; - } - else - { - reps[0] = (pos - kNumRepDistances); - for(UInt32 i = 1; i < kNumRepDistances; i++) - reps[i] = prevOptimum.Backs[i - 1]; - } - } - curOptimum.State = state; - for(UInt32 i = 0; i < kNumRepDistances; i++) - curOptimum.Backs[i] = reps[i]; - UInt32 curPrice = curOptimum.Price; - const Byte *data = _matchFinder->GetPointerToCurrentPos() - 1; - const Byte currentByte = *data; - const Byte matchByte = data[(size_t)0 - reps[0] - 1]; - - UInt32 posState = (position & _posStateMask); - - UInt32 curAnd1Price = curPrice + - _isMatch[state.Index][posState].GetPrice0() + - _literalEncoder.GetSubCoder(position, data[(size_t)0 - 1])->GetPrice(!state.IsCharState(), matchByte, currentByte); - - COptimal &nextOptimum = _optimum[cur + 1]; - - bool nextIsChar = false; - if (curAnd1Price < nextOptimum.Price) - { - nextOptimum.Price = curAnd1Price; - nextOptimum.PosPrev = cur; - nextOptimum.MakeAsChar(); - nextIsChar = true; - } - - UInt32 matchPrice = curPrice + _isMatch[state.Index][posState].GetPrice1(); - UInt32 repMatchPrice = matchPrice + _isRep[state.Index].GetPrice1(); - - if(matchByte == currentByte && - !(nextOptimum.PosPrev < cur && nextOptimum.BackPrev == 0)) - { - UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(state, posState); - if(shortRepPrice <= nextOptimum.Price) - { - nextOptimum.Price = shortRepPrice; - nextOptimum.PosPrev = cur; - nextOptimum.MakeAsShortRep(); - nextIsChar = true; - } - } - /* - if(newLen == 2 && matchDistances[2] >= kDistLimit2) // test it maybe set 2000 ? - continue; - */ - - UInt32 numAvailableBytesFull = _matchFinder->GetNumAvailableBytes() + 1; - numAvailableBytesFull = MyMin(kNumOpts - 1 - cur, numAvailableBytesFull); - UInt32 numAvailableBytes = numAvailableBytesFull; - - if (numAvailableBytes < 2) - continue; - if (numAvailableBytes > _numFastBytes) - numAvailableBytes = _numFastBytes; - if (!nextIsChar && matchByte != currentByte) // speed optimization - { - // try Literal + rep0 - UInt32 backOffset = reps[0] + 1; - UInt32 limit = MyMin(numAvailableBytesFull, _numFastBytes + 1); - UInt32 temp; - for (temp = 1; temp < limit && - data[temp] == data[(size_t)temp - backOffset]; temp++); - UInt32 lenTest2 = temp - 1; - if (lenTest2 >= 2) - { - CState state2 = state; - state2.UpdateChar(); - UInt32 posStateNext = (position + 1) & _posStateMask; - UInt32 nextRepMatchPrice = curAnd1Price + - _isMatch[state2.Index][posStateNext].GetPrice1() + - _isRep[state2.Index].GetPrice1(); - // for (; lenTest2 >= 2; lenTest2--) - { - UInt32 offset = cur + 1 + lenTest2; - while(lenEnd < offset) - _optimum[++lenEnd].Price = kIfinityPrice; - UInt32 curAndLenPrice = nextRepMatchPrice + GetRepPrice( - 0, lenTest2, state2, posStateNext); - COptimal &optimum = _optimum[offset]; - if (curAndLenPrice < optimum.Price) - { - optimum.Price = curAndLenPrice; - optimum.PosPrev = cur + 1; - optimum.BackPrev = 0; - optimum.Prev1IsChar = true; - optimum.Prev2 = false; - } - } - } - } - - UInt32 startLen = 2; // speed optimization - for(UInt32 repIndex = 0; repIndex < kNumRepDistances; repIndex++) - { - // UInt32 repLen = _matchFinder->GetMatchLen(0 - 1, reps[repIndex], newLen); // test it; - UInt32 backOffset = reps[repIndex] + 1; - if (data[0] != data[(size_t)0 - backOffset] || - data[1] != data[(size_t)1 - backOffset]) - continue; - UInt32 lenTest; - for (lenTest = 2; lenTest < numAvailableBytes && - data[lenTest] == data[(size_t)lenTest - backOffset]; lenTest++); - while(lenEnd < cur + lenTest) - _optimum[++lenEnd].Price = kIfinityPrice; - UInt32 lenTestTemp = lenTest; - UInt32 price = repMatchPrice + GetPureRepPrice(repIndex, state, posState); - do - { - UInt32 curAndLenPrice = price + _repMatchLenEncoder.GetPrice(lenTest - 2, posState); - COptimal &optimum = _optimum[cur + lenTest]; - if (curAndLenPrice < optimum.Price) - { - optimum.Price = curAndLenPrice; - optimum.PosPrev = cur; - optimum.BackPrev = repIndex; - optimum.Prev1IsChar = false; - } - } - while(--lenTest >= 2); - lenTest = lenTestTemp; - - if (repIndex == 0) - startLen = lenTest + 1; - - // if (_maxMode) - { - UInt32 lenTest2 = lenTest + 1; - UInt32 limit = MyMin(numAvailableBytesFull, lenTest2 + _numFastBytes); - for (; lenTest2 < limit && - data[lenTest2] == data[(size_t)lenTest2 - backOffset]; lenTest2++); - lenTest2 -= lenTest + 1; - if (lenTest2 >= 2) - { - CState state2 = state; - state2.UpdateRep(); - UInt32 posStateNext = (position + lenTest) & _posStateMask; - UInt32 curAndLenCharPrice = - price + _repMatchLenEncoder.GetPrice(lenTest - 2, posState) + - _isMatch[state2.Index][posStateNext].GetPrice0() + - _literalEncoder.GetSubCoder(position + lenTest, data[(size_t)lenTest - 1])->GetPrice( - true, data[(size_t)lenTest - backOffset], data[lenTest]); - state2.UpdateChar(); - posStateNext = (position + lenTest + 1) & _posStateMask; - UInt32 nextRepMatchPrice = curAndLenCharPrice + - _isMatch[state2.Index][posStateNext].GetPrice1() + - _isRep[state2.Index].GetPrice1(); - - // for(; lenTest2 >= 2; lenTest2--) - { - UInt32 offset = cur + lenTest + 1 + lenTest2; - while(lenEnd < offset) - _optimum[++lenEnd].Price = kIfinityPrice; - UInt32 curAndLenPrice = nextRepMatchPrice + GetRepPrice( - 0, lenTest2, state2, posStateNext); - COptimal &optimum = _optimum[offset]; - if (curAndLenPrice < optimum.Price) - { - optimum.Price = curAndLenPrice; - optimum.PosPrev = cur + lenTest + 1; - optimum.BackPrev = 0; - optimum.Prev1IsChar = true; - optimum.Prev2 = true; - optimum.PosPrev2 = cur; - optimum.BackPrev2 = repIndex; - } - } - } - } - } - - // for(UInt32 lenTest = 2; lenTest <= newLen; lenTest++) - if (newLen > numAvailableBytes) - { - newLen = numAvailableBytes; - for (numDistancePairs = 0; newLen > matchDistances[numDistancePairs]; numDistancePairs += 2); - matchDistances[numDistancePairs] = newLen; - numDistancePairs += 2; - } - if (newLen >= startLen) - { - UInt32 normalMatchPrice = matchPrice + _isRep[state.Index].GetPrice0(); - while(lenEnd < cur + newLen) - _optimum[++lenEnd].Price = kIfinityPrice; - - UInt32 offs = 0; - while(startLen > matchDistances[offs]) - offs += 2; - UInt32 curBack = matchDistances[offs + 1]; - UInt32 posSlot = GetPosSlot2(curBack); - for(UInt32 lenTest = /*2*/ startLen; ; lenTest++) - { - UInt32 curAndLenPrice = normalMatchPrice; - UInt32 lenToPosState = GetLenToPosState(lenTest); - if (curBack < kNumFullDistances) - curAndLenPrice += _distancesPrices[lenToPosState][curBack]; - else - curAndLenPrice += _posSlotPrices[lenToPosState][posSlot] + _alignPrices[curBack & kAlignMask]; - - curAndLenPrice += _lenEncoder.GetPrice(lenTest - kMatchMinLen, posState); - - COptimal &optimum = _optimum[cur + lenTest]; - if (curAndLenPrice < optimum.Price) - { - optimum.Price = curAndLenPrice; - optimum.PosPrev = cur; - optimum.BackPrev = curBack + kNumRepDistances; - optimum.Prev1IsChar = false; - } - - if (/*_maxMode && */lenTest == matchDistances[offs]) - { - // Try Match + Literal + Rep0 - UInt32 backOffset = curBack + 1; - UInt32 lenTest2 = lenTest + 1; - UInt32 limit = MyMin(numAvailableBytesFull, lenTest2 + _numFastBytes); - for (; lenTest2 < limit && - data[lenTest2] == data[(size_t)lenTest2 - backOffset]; lenTest2++); - lenTest2 -= lenTest + 1; - if (lenTest2 >= 2) - { - CState state2 = state; - state2.UpdateMatch(); - UInt32 posStateNext = (position + lenTest) & _posStateMask; - UInt32 curAndLenCharPrice = curAndLenPrice + - _isMatch[state2.Index][posStateNext].GetPrice0() + - _literalEncoder.GetSubCoder(position + lenTest, data[(size_t)lenTest - 1])->GetPrice( - true, data[(size_t)lenTest - backOffset], data[lenTest]); - state2.UpdateChar(); - posStateNext = (posStateNext + 1) & _posStateMask; - UInt32 nextRepMatchPrice = curAndLenCharPrice + - _isMatch[state2.Index][posStateNext].GetPrice1() + - _isRep[state2.Index].GetPrice1(); - - // for(; lenTest2 >= 2; lenTest2--) - { - UInt32 offset = cur + lenTest + 1 + lenTest2; - while(lenEnd < offset) - _optimum[++lenEnd].Price = kIfinityPrice; - UInt32 curAndLenPrice = nextRepMatchPrice + GetRepPrice(0, lenTest2, state2, posStateNext); - COptimal &optimum = _optimum[offset]; - if (curAndLenPrice < optimum.Price) - { - optimum.Price = curAndLenPrice; - optimum.PosPrev = cur + lenTest + 1; - optimum.BackPrev = 0; - optimum.Prev1IsChar = true; - optimum.Prev2 = true; - optimum.PosPrev2 = cur; - optimum.BackPrev2 = curBack + kNumRepDistances; - } - } - } - offs += 2; - if (offs == numDistancePairs) - break; - curBack = matchDistances[offs + 1]; - if (curBack >= kNumFullDistances) - posSlot = GetPosSlot2(curBack); - } - } - } - } -} - -static inline bool ChangePair(UInt32 smallDist, UInt32 bigDist) -{ - return ((bigDist >> 7) > smallDist); -} - - -HRESULT CEncoder::ReadMatchDistances(UInt32 &lenRes, UInt32 &numDistancePairs) -{ - lenRes = 0; - RINOK(_matchFinder->GetMatches(_matchDistances)); - numDistancePairs = _matchDistances[0]; - if (numDistancePairs > 0) - { - lenRes = _matchDistances[1 + numDistancePairs - 2]; - if (lenRes == _numFastBytes) - lenRes += _matchFinder->GetMatchLen(lenRes - 1, _matchDistances[1 + numDistancePairs - 1], - kMatchMaxLen - lenRes); - } - _additionalOffset++; - return S_OK; -} - -HRESULT CEncoder::GetOptimumFast(UInt32 &backRes, UInt32 &lenRes) -{ - UInt32 lenMain, numDistancePairs; - if (!_longestMatchWasFound) - { - RINOK(ReadMatchDistances(lenMain, numDistancePairs)); - } - else - { - lenMain = _longestMatchLength; - numDistancePairs = _numDistancePairs; - _longestMatchWasFound = false; - } - - const Byte *data = _matchFinder->GetPointerToCurrentPos() - 1; - UInt32 numAvailableBytes = _matchFinder->GetNumAvailableBytes() + 1; - if (numAvailableBytes > kMatchMaxLen) - numAvailableBytes = kMatchMaxLen; - if (numAvailableBytes < 2) - { - backRes = (UInt32)(-1); - lenRes = 1; - return S_OK; - } - - UInt32 repLens[kNumRepDistances]; - UInt32 repMaxIndex = 0; - - for(UInt32 i = 0; i < kNumRepDistances; i++) - { - UInt32 backOffset = _repDistances[i] + 1; - if (data[0] != data[(size_t)0 - backOffset] || data[1] != data[(size_t)1 - backOffset]) - { - repLens[i] = 0; - continue; - } - UInt32 len; - for (len = 2; len < numAvailableBytes && data[len] == data[(size_t)len - backOffset]; len++); - if(len >= _numFastBytes) - { - backRes = i; - lenRes = len; - return MovePos(lenRes - 1); - } - repLens[i] = len; - if (len > repLens[repMaxIndex]) - repMaxIndex = i; - } - UInt32 *matchDistances = _matchDistances + 1; - if(lenMain >= _numFastBytes) - { - backRes = matchDistances[numDistancePairs - 1] + kNumRepDistances; - lenRes = lenMain; - return MovePos(lenMain - 1); - } - - UInt32 backMain = 0; // for GCC - if (lenMain >= 2) - { - backMain = matchDistances[numDistancePairs - 1]; - while (numDistancePairs > 2 && lenMain == matchDistances[numDistancePairs - 4] + 1) - { - if (!ChangePair(matchDistances[numDistancePairs - 3], backMain)) - break; - numDistancePairs -= 2; - lenMain = matchDistances[numDistancePairs - 2]; - backMain = matchDistances[numDistancePairs - 1]; - } - if (lenMain == 2 && backMain >= 0x80) - lenMain = 1; - } - - if (repLens[repMaxIndex] >= 2) - { - if (repLens[repMaxIndex] + 1 >= lenMain || - repLens[repMaxIndex] + 2 >= lenMain && (backMain > (1 << 9)) || - repLens[repMaxIndex] + 3 >= lenMain && (backMain > (1 << 15))) - { - backRes = repMaxIndex; - lenRes = repLens[repMaxIndex]; - return MovePos(lenRes - 1); - } - } - - if (lenMain >= 2 && numAvailableBytes > 2) - { - RINOK(ReadMatchDistances(_longestMatchLength, _numDistancePairs)); - if (_longestMatchLength >= 2) - { - UInt32 newDistance = matchDistances[_numDistancePairs - 1]; - if (_longestMatchLength >= lenMain && newDistance < backMain || - _longestMatchLength == lenMain + 1 && !ChangePair(backMain, newDistance) || - _longestMatchLength > lenMain + 1 || - _longestMatchLength + 1 >= lenMain && lenMain >= 3 && ChangePair(newDistance, backMain)) - { - _longestMatchWasFound = true; - backRes = UInt32(-1); - lenRes = 1; - return S_OK; - } - } - data++; - numAvailableBytes--; - for(UInt32 i = 0; i < kNumRepDistances; i++) - { - UInt32 backOffset = _repDistances[i] + 1; - if (data[1] != data[(size_t)1 - backOffset] || data[2] != data[(size_t)2 - backOffset]) - { - repLens[i] = 0; - continue; - } - UInt32 len; - for (len = 2; len < numAvailableBytes && data[len] == data[(size_t)len - backOffset]; len++); - if (len + 1 >= lenMain) - { - _longestMatchWasFound = true; - backRes = UInt32(-1); - lenRes = 1; - return S_OK; - } - } - backRes = backMain + kNumRepDistances; - lenRes = lenMain; - return MovePos(lenMain - 2); - } - backRes = UInt32(-1); - lenRes = 1; - return S_OK; -} - -HRESULT CEncoder::Flush(UInt32 nowPos) -{ - ReleaseMFStream(); - WriteEndMarker(nowPos & _posStateMask); - _rangeEncoder.FlushData(); - return _rangeEncoder.FlushStream(); -} - -void CEncoder::WriteEndMarker(UInt32 posState) -{ - // This function for writing End Mark for stream version of LZMA. - // In current version this feature is not used. - if (!_writeEndMark) - return; - - _isMatch[_state.Index][posState].Encode(&_rangeEncoder, 1); - _isRep[_state.Index].Encode(&_rangeEncoder, 0); - _state.UpdateMatch(); - UInt32 len = kMatchMinLen; // kMatchMaxLen; - _lenEncoder.Encode(&_rangeEncoder, len - kMatchMinLen, posState, !_fastMode); - UInt32 posSlot = (1 << kNumPosSlotBits) - 1; - UInt32 lenToPosState = GetLenToPosState(len); - _posSlotEncoder[lenToPosState].Encode(&_rangeEncoder, posSlot); - UInt32 footerBits = 30; - UInt32 posReduced = (UInt32(1) << footerBits) - 1; - _rangeEncoder.EncodeDirectBits(posReduced >> kNumAlignBits, footerBits - kNumAlignBits); - _posAlignEncoder.ReverseEncode(&_rangeEncoder, posReduced & kAlignMask); -} - -HRESULT CEncoder::CodeReal(ISequentialInStream *inStream, - ISequentialOutStream *outStream, - const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - _needReleaseMFStream = false; - CCoderReleaser coderReleaser(this); - RINOK(SetStreams(inStream, outStream, inSize, outSize)); - for (;;) - { - UInt64 processedInSize; - UInt64 processedOutSize; - Int32 finished; - RINOK(CodeOneBlock(&processedInSize, &processedOutSize, &finished)); - if (finished != 0) - break; - if (progress != 0) - { - RINOK(progress->SetRatioInfo(&processedInSize, &processedOutSize)); - } - } - return S_OK; -} - -HRESULT CEncoder::SetStreams(ISequentialInStream *inStream, - ISequentialOutStream *outStream, - const UInt64 * /* inSize */, const UInt64 * /* outSize */) -{ - _inStream = inStream; - _finished = false; - RINOK(Create()); - RINOK(SetOutStream(outStream)); - RINOK(Init()); - - // CCoderReleaser releaser(this); - - /* - if (_matchFinder->GetNumAvailableBytes() == 0) - return Flush(); - */ - - if (!_fastMode) - { - FillDistancesPrices(); - FillAlignPrices(); - } - - _lenEncoder.SetTableSize(_numFastBytes + 1 - kMatchMinLen); - _lenEncoder.UpdateTables(1 << _posStateBits); - _repMatchLenEncoder.SetTableSize(_numFastBytes + 1 - kMatchMinLen); - _repMatchLenEncoder.UpdateTables(1 << _posStateBits); - - nowPos64 = 0; - return S_OK; -} - -HRESULT CEncoder::CodeOneBlock(UInt64 *inSize, UInt64 *outSize, Int32 *finished) -{ - if (_inStream != 0) - { - RINOK(_matchFinder->SetStream(_inStream)); - RINOK(_matchFinder->Init()); - _needReleaseMFStream = true; - _inStream = 0; - } - - - *finished = 1; - if (_finished) - return S_OK; - _finished = true; - - if (nowPos64 == 0) - { - if (_matchFinder->GetNumAvailableBytes() == 0) - return Flush(UInt32(nowPos64)); - UInt32 len, numDistancePairs; - RINOK(ReadMatchDistances(len, numDistancePairs)); - UInt32 posState = UInt32(nowPos64) & _posStateMask; - _isMatch[_state.Index][posState].Encode(&_rangeEncoder, 0); - _state.UpdateChar(); - Byte curByte = _matchFinder->GetIndexByte(0 - _additionalOffset); - _literalEncoder.GetSubCoder(UInt32(nowPos64), _previousByte)->Encode(&_rangeEncoder, curByte); - _previousByte = curByte; - _additionalOffset--; - nowPos64++; - } - - UInt32 nowPos32 = (UInt32)nowPos64; - UInt32 progressPosValuePrev = nowPos32; - - if (_matchFinder->GetNumAvailableBytes() == 0) - return Flush(nowPos32); - - for (;;) - { - #ifdef _NO_EXCEPTIONS - if (_rangeEncoder.Stream.ErrorCode != S_OK) - return _rangeEncoder.Stream.ErrorCode; - #endif - UInt32 pos, len; - HRESULT result; - if (_fastMode) - result = GetOptimumFast(pos, len); - else - result = GetOptimum(nowPos32, pos, len); - RINOK(result); - - UInt32 posState = nowPos32 & _posStateMask; - if(len == 1 && pos == 0xFFFFFFFF) - { - _isMatch[_state.Index][posState].Encode(&_rangeEncoder, 0); - Byte curByte = _matchFinder->GetIndexByte(0 - _additionalOffset); - CLiteralEncoder2 *subCoder = _literalEncoder.GetSubCoder(nowPos32, _previousByte); - if(_state.IsCharState()) - subCoder->Encode(&_rangeEncoder, curByte); - else - { - Byte matchByte = _matchFinder->GetIndexByte(0 - _repDistances[0] - 1 - _additionalOffset); - subCoder->EncodeMatched(&_rangeEncoder, matchByte, curByte); - } - _state.UpdateChar(); - _previousByte = curByte; - } - else - { - _isMatch[_state.Index][posState].Encode(&_rangeEncoder, 1); - if(pos < kNumRepDistances) - { - _isRep[_state.Index].Encode(&_rangeEncoder, 1); - if(pos == 0) - { - _isRepG0[_state.Index].Encode(&_rangeEncoder, 0); - _isRep0Long[_state.Index][posState].Encode(&_rangeEncoder, ((len == 1) ? 0 : 1)); - } - else - { - UInt32 distance = _repDistances[pos]; - _isRepG0[_state.Index].Encode(&_rangeEncoder, 1); - if (pos == 1) - _isRepG1[_state.Index].Encode(&_rangeEncoder, 0); - else - { - _isRepG1[_state.Index].Encode(&_rangeEncoder, 1); - _isRepG2[_state.Index].Encode(&_rangeEncoder, pos - 2); - if (pos == 3) - _repDistances[3] = _repDistances[2]; - _repDistances[2] = _repDistances[1]; - } - _repDistances[1] = _repDistances[0]; - _repDistances[0] = distance; - } - if (len == 1) - _state.UpdateShortRep(); - else - { - _repMatchLenEncoder.Encode(&_rangeEncoder, len - kMatchMinLen, posState, !_fastMode); - _state.UpdateRep(); - } - } - else - { - _isRep[_state.Index].Encode(&_rangeEncoder, 0); - _state.UpdateMatch(); - _lenEncoder.Encode(&_rangeEncoder, len - kMatchMinLen, posState, !_fastMode); - pos -= kNumRepDistances; - UInt32 posSlot = GetPosSlot(pos); - _posSlotEncoder[GetLenToPosState(len)].Encode(&_rangeEncoder, posSlot); - - if (posSlot >= kStartPosModelIndex) - { - UInt32 footerBits = ((posSlot >> 1) - 1); - UInt32 base = ((2 | (posSlot & 1)) << footerBits); - UInt32 posReduced = pos - base; - - if (posSlot < kEndPosModelIndex) - NRangeCoder::ReverseBitTreeEncode(_posEncoders + base - posSlot - 1, - &_rangeEncoder, footerBits, posReduced); - else - { - _rangeEncoder.EncodeDirectBits(posReduced >> kNumAlignBits, footerBits - kNumAlignBits); - _posAlignEncoder.ReverseEncode(&_rangeEncoder, posReduced & kAlignMask); - _alignPriceCount++; - } - } - _repDistances[3] = _repDistances[2]; - _repDistances[2] = _repDistances[1]; - _repDistances[1] = _repDistances[0]; - _repDistances[0] = pos; - _matchPriceCount++; - } - _previousByte = _matchFinder->GetIndexByte(len - 1 - _additionalOffset); - } - _additionalOffset -= len; - nowPos32 += len; - if (_additionalOffset == 0) - { - if (!_fastMode) - { - if (_matchPriceCount >= (1 << 7)) - FillDistancesPrices(); - if (_alignPriceCount >= kAlignTableSize) - FillAlignPrices(); - } - if (_matchFinder->GetNumAvailableBytes() == 0) - return Flush(nowPos32); - if (nowPos32 - progressPosValuePrev >= (1 << 14)) - { - nowPos64 += nowPos32 - progressPosValuePrev; - *inSize = nowPos64; - *outSize = _rangeEncoder.GetProcessedSize(); - _finished = false; - *finished = 0; - return S_OK; - } - } - } -} - -STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - #ifndef _NO_EXCEPTIONS - try - { - #endif - return CodeReal(inStream, outStream, inSize, outSize, progress); - #ifndef _NO_EXCEPTIONS - } - catch(const COutBufferException &e) { return e.ErrorCode; } - catch(...) { return E_FAIL; } - #endif -} - -void CEncoder::FillDistancesPrices() -{ - UInt32 tempPrices[kNumFullDistances]; - for (UInt32 i = kStartPosModelIndex; i < kNumFullDistances; i++) - { - UInt32 posSlot = GetPosSlot(i); - UInt32 footerBits = ((posSlot >> 1) - 1); - UInt32 base = ((2 | (posSlot & 1)) << footerBits); - tempPrices[i] = NRangeCoder::ReverseBitTreeGetPrice(_posEncoders + - base - posSlot - 1, footerBits, i - base); - } - - for (UInt32 lenToPosState = 0; lenToPosState < kNumLenToPosStates; lenToPosState++) - { - UInt32 posSlot; - NRangeCoder::CBitTreeEncoder &encoder = _posSlotEncoder[lenToPosState]; - UInt32 *posSlotPrices = _posSlotPrices[lenToPosState]; - for (posSlot = 0; posSlot < _distTableSize; posSlot++) - posSlotPrices[posSlot] = encoder.GetPrice(posSlot); - for (posSlot = kEndPosModelIndex; posSlot < _distTableSize; posSlot++) - posSlotPrices[posSlot] += ((((posSlot >> 1) - 1) - kNumAlignBits) << NRangeCoder::kNumBitPriceShiftBits); - - UInt32 *distancesPrices = _distancesPrices[lenToPosState]; - UInt32 i; - for (i = 0; i < kStartPosModelIndex; i++) - distancesPrices[i] = posSlotPrices[i]; - for (; i < kNumFullDistances; i++) - distancesPrices[i] = posSlotPrices[GetPosSlot(i)] + tempPrices[i]; - } - _matchPriceCount = 0; -} - -void CEncoder::FillAlignPrices() -{ - for (UInt32 i = 0; i < kAlignTableSize; i++) - _alignPrices[i] = _posAlignEncoder.ReverseGetPrice(i); - _alignPriceCount = 0; -} - -}} diff --git a/7zip/Compress/LZMA/LZMAEncoder.h b/7zip/Compress/LZMA/LZMAEncoder.h deleted file mode 100755 index 26d2033d..00000000 --- a/7zip/Compress/LZMA/LZMAEncoder.h +++ /dev/null @@ -1,411 +0,0 @@ -// LZMA/Encoder.h - -#ifndef __LZMA_ENCODER_H -#define __LZMA_ENCODER_H - -#include "../../../Common/MyCom.h" -#include "../../../Common/Alloc.h" -#include "../../ICoder.h" -#include "../LZ/IMatchFinder.h" -#include "../RangeCoder/RangeCoderBitTree.h" - -#include "LZMA.h" - -namespace NCompress { -namespace NLZMA { - -typedef NRangeCoder::CBitEncoder CMyBitEncoder; - -class CBaseState -{ -protected: - CState _state; - Byte _previousByte; - UInt32 _repDistances[kNumRepDistances]; - void Init() - { - _state.Init(); - _previousByte = 0; - for(UInt32 i = 0 ; i < kNumRepDistances; i++) - _repDistances[i] = 0; - } -}; - -struct COptimal -{ - CState State; - - bool Prev1IsChar; - bool Prev2; - - UInt32 PosPrev2; - UInt32 BackPrev2; - - UInt32 Price; - UInt32 PosPrev; // posNext; - UInt32 BackPrev; - UInt32 Backs[kNumRepDistances]; - void MakeAsChar() { BackPrev = UInt32(-1); Prev1IsChar = false; } - void MakeAsShortRep() { BackPrev = 0; ; Prev1IsChar = false; } - bool IsShortRep() { return (BackPrev == 0); } -}; - - -extern Byte g_FastPos[1 << 11]; -inline UInt32 GetPosSlot(UInt32 pos) -{ - if (pos < (1 << 11)) - return g_FastPos[pos]; - if (pos < (1 << 21)) - return g_FastPos[pos >> 10] + 20; - return g_FastPos[pos >> 20] + 40; -} - -inline UInt32 GetPosSlot2(UInt32 pos) -{ - if (pos < (1 << 17)) - return g_FastPos[pos >> 6] + 12; - if (pos < (1 << 27)) - return g_FastPos[pos >> 16] + 32; - return g_FastPos[pos >> 26] + 52; -} - -const UInt32 kIfinityPrice = 0xFFFFFFF; - -const UInt32 kNumOpts = 1 << 12; - - -class CLiteralEncoder2 -{ - CMyBitEncoder _encoders[0x300]; -public: - void Init() - { - for (int i = 0; i < 0x300; i++) - _encoders[i].Init(); - } - void Encode(NRangeCoder::CEncoder *rangeEncoder, Byte symbol); - void EncodeMatched(NRangeCoder::CEncoder *rangeEncoder, Byte matchByte, Byte symbol); - UInt32 GetPrice(bool matchMode, Byte matchByte, Byte symbol) const; -}; - -class CLiteralEncoder -{ - CLiteralEncoder2 *_coders; - int _numPrevBits; - int _numPosBits; - UInt32 _posMask; -public: - CLiteralEncoder(): _coders(0) {} - ~CLiteralEncoder() { Free(); } - void Free() - { - MyFree(_coders); - _coders = 0; - } - bool Create(int numPosBits, int numPrevBits) - { - if (_coders == 0 || (numPosBits + numPrevBits) != (_numPrevBits + _numPosBits)) - { - Free(); - UInt32 numStates = 1 << (numPosBits + numPrevBits); - _coders = (CLiteralEncoder2 *)MyAlloc(numStates * sizeof(CLiteralEncoder2)); - } - _numPosBits = numPosBits; - _posMask = (1 << numPosBits) - 1; - _numPrevBits = numPrevBits; - return (_coders != 0); - } - void Init() - { - UInt32 numStates = 1 << (_numPrevBits + _numPosBits); - for (UInt32 i = 0; i < numStates; i++) - _coders[i].Init(); - } - CLiteralEncoder2 *GetSubCoder(UInt32 pos, Byte prevByte) - { return &_coders[((pos & _posMask) << _numPrevBits) + (prevByte >> (8 - _numPrevBits))]; } -}; - -namespace NLength { - -class CEncoder -{ - CMyBitEncoder _choice; - CMyBitEncoder _choice2; - NRangeCoder::CBitTreeEncoder _lowCoder[kNumPosStatesEncodingMax]; - NRangeCoder::CBitTreeEncoder _midCoder[kNumPosStatesEncodingMax]; - NRangeCoder::CBitTreeEncoder _highCoder; -public: - void Init(UInt32 numPosStates); - void Encode(NRangeCoder::CEncoder *rangeEncoder, UInt32 symbol, UInt32 posState); - void SetPrices(UInt32 posState, UInt32 numSymbols, UInt32 *prices) const; -}; - -const UInt32 kNumSpecSymbols = kNumLowSymbols + kNumMidSymbols; - -class CPriceTableEncoder: public CEncoder -{ - UInt32 _prices[kNumPosStatesEncodingMax][kNumSymbolsTotal]; - UInt32 _tableSize; - UInt32 _counters[kNumPosStatesEncodingMax]; -public: - void SetTableSize(UInt32 tableSize) { _tableSize = tableSize; } - UInt32 GetPrice(UInt32 symbol, UInt32 posState) const { return _prices[posState][symbol]; } - void UpdateTable(UInt32 posState) - { - SetPrices(posState, _tableSize, _prices[posState]); - _counters[posState] = _tableSize; - } - void UpdateTables(UInt32 numPosStates) - { - for (UInt32 posState = 0; posState < numPosStates; posState++) - UpdateTable(posState); - } - void Encode(NRangeCoder::CEncoder *rangeEncoder, UInt32 symbol, UInt32 posState, bool updatePrice) - { - CEncoder::Encode(rangeEncoder, symbol, posState); - if (updatePrice) - if (--_counters[posState] == 0) - UpdateTable(posState); - } -}; - -} - -class CEncoder : - public ICompressCoder, - public ICompressSetOutStream, - public ICompressSetCoderProperties, - public ICompressWriteCoderProperties, - public CBaseState, - public CMyUnknownImp -{ - COptimal _optimum[kNumOpts]; - CMyComPtr _matchFinder; // test it - NRangeCoder::CEncoder _rangeEncoder; - - CMyBitEncoder _isMatch[kNumStates][NLength::kNumPosStatesEncodingMax]; - CMyBitEncoder _isRep[kNumStates]; - CMyBitEncoder _isRepG0[kNumStates]; - CMyBitEncoder _isRepG1[kNumStates]; - CMyBitEncoder _isRepG2[kNumStates]; - CMyBitEncoder _isRep0Long[kNumStates][NLength::kNumPosStatesEncodingMax]; - - NRangeCoder::CBitTreeEncoder _posSlotEncoder[kNumLenToPosStates]; - - CMyBitEncoder _posEncoders[kNumFullDistances - kEndPosModelIndex]; - NRangeCoder::CBitTreeEncoder _posAlignEncoder; - - NLength::CPriceTableEncoder _lenEncoder; - NLength::CPriceTableEncoder _repMatchLenEncoder; - - CLiteralEncoder _literalEncoder; - - UInt32 _matchDistances[kMatchMaxLen * 2 + 2 + 1]; - - bool _fastMode; - // bool _maxMode; - UInt32 _numFastBytes; - UInt32 _longestMatchLength; - UInt32 _numDistancePairs; - - UInt32 _additionalOffset; - - UInt32 _optimumEndIndex; - UInt32 _optimumCurrentIndex; - - bool _longestMatchWasFound; - - UInt32 _posSlotPrices[kNumLenToPosStates][kDistTableSizeMax]; - - UInt32 _distancesPrices[kNumLenToPosStates][kNumFullDistances]; - - UInt32 _alignPrices[kAlignTableSize]; - UInt32 _alignPriceCount; - - UInt32 _distTableSize; - - UInt32 _posStateBits; - UInt32 _posStateMask; - UInt32 _numLiteralPosStateBits; - UInt32 _numLiteralContextBits; - - UInt32 _dictionarySize; - - UInt32 _dictionarySizePrev; - UInt32 _numFastBytesPrev; - - UInt32 _matchPriceCount; - UInt64 nowPos64; - bool _finished; - ISequentialInStream *_inStream; - - UInt32 _matchFinderCycles; - int _matchFinderIndex; - #ifdef COMPRESS_MF_MT - bool _multiThread; - #endif - - bool _writeEndMark; - - bool _needReleaseMFStream; - - IMatchFinderSetNumPasses *setMfPasses; - - void ReleaseMatchFinder() - { - setMfPasses = 0; - _matchFinder.Release(); - } - - HRESULT ReadMatchDistances(UInt32 &len, UInt32 &numDistancePairs); - - HRESULT MovePos(UInt32 num); - UInt32 GetRepLen1Price(CState state, UInt32 posState) const - { - return _isRepG0[state.Index].GetPrice0() + - _isRep0Long[state.Index][posState].GetPrice0(); - } - - UInt32 GetPureRepPrice(UInt32 repIndex, CState state, UInt32 posState) const - { - UInt32 price; - if(repIndex == 0) - { - price = _isRepG0[state.Index].GetPrice0(); - price += _isRep0Long[state.Index][posState].GetPrice1(); - } - else - { - price = _isRepG0[state.Index].GetPrice1(); - if (repIndex == 1) - price += _isRepG1[state.Index].GetPrice0(); - else - { - price += _isRepG1[state.Index].GetPrice1(); - price += _isRepG2[state.Index].GetPrice(repIndex - 2); - } - } - return price; - } - UInt32 GetRepPrice(UInt32 repIndex, UInt32 len, CState state, UInt32 posState) const - { - return _repMatchLenEncoder.GetPrice(len - kMatchMinLen, posState) + - GetPureRepPrice(repIndex, state, posState); - } - /* - UInt32 GetPosLen2Price(UInt32 pos, UInt32 posState) const - { - if (pos >= kNumFullDistances) - return kIfinityPrice; - return _distancesPrices[0][pos] + _lenEncoder.GetPrice(0, posState); - } - UInt32 GetPosLen3Price(UInt32 pos, UInt32 len, UInt32 posState) const - { - UInt32 price; - UInt32 lenToPosState = GetLenToPosState(len); - if (pos < kNumFullDistances) - price = _distancesPrices[lenToPosState][pos]; - else - price = _posSlotPrices[lenToPosState][GetPosSlot2(pos)] + - _alignPrices[pos & kAlignMask]; - return price + _lenEncoder.GetPrice(len - kMatchMinLen, posState); - } - */ - UInt32 GetPosLenPrice(UInt32 pos, UInt32 len, UInt32 posState) const - { - UInt32 price; - UInt32 lenToPosState = GetLenToPosState(len); - if (pos < kNumFullDistances) - price = _distancesPrices[lenToPosState][pos]; - else - price = _posSlotPrices[lenToPosState][GetPosSlot2(pos)] + - _alignPrices[pos & kAlignMask]; - return price + _lenEncoder.GetPrice(len - kMatchMinLen, posState); - } - - UInt32 Backward(UInt32 &backRes, UInt32 cur); - HRESULT GetOptimum(UInt32 position, UInt32 &backRes, UInt32 &lenRes); - HRESULT GetOptimumFast(UInt32 &backRes, UInt32 &lenRes); - - void FillDistancesPrices(); - void FillAlignPrices(); - - void ReleaseMFStream() - { - if (_matchFinder && _needReleaseMFStream) - { - _matchFinder->ReleaseStream(); - _needReleaseMFStream = false; - } - } - - void ReleaseStreams() - { - ReleaseMFStream(); - ReleaseOutStream(); - } - - HRESULT Flush(UInt32 nowPos); - class CCoderReleaser - { - CEncoder *_coder; - public: - CCoderReleaser(CEncoder *coder): _coder(coder) {} - ~CCoderReleaser() - { - _coder->ReleaseStreams(); - } - }; - friend class CCoderReleaser; - - void WriteEndMarker(UInt32 posState); - -public: - CEncoder(); - void SetWriteEndMarkerMode(bool writeEndMarker) - { _writeEndMark= writeEndMarker; } - - HRESULT Create(); - - MY_UNKNOWN_IMP3( - ICompressSetOutStream, - ICompressSetCoderProperties, - ICompressWriteCoderProperties - ) - - HRESULT Init(); - - // ICompressCoder interface - HRESULT SetStreams(ISequentialInStream *inStream, - ISequentialOutStream *outStream, - const UInt64 *inSize, const UInt64 *outSize); - HRESULT CodeOneBlock(UInt64 *inSize, UInt64 *outSize, Int32 *finished); - - HRESULT CodeReal(ISequentialInStream *inStream, - ISequentialOutStream *outStream, - const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - // ICompressCoder interface - STDMETHOD(Code)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, - const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - // ICompressSetCoderProperties2 - STDMETHOD(SetCoderProperties)(const PROPID *propIDs, - const PROPVARIANT *properties, UInt32 numProperties); - - // ICompressWriteCoderProperties - STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream); - - STDMETHOD(SetOutStream)(ISequentialOutStream *outStream); - STDMETHOD(ReleaseOutStream)(); - - virtual ~CEncoder() {} -}; - -}} - -#endif diff --git a/7zip/Compress/LZMA/StdAfx.cpp b/7zip/Compress/LZMA/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Compress/LZMA/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Compress/LZMA/StdAfx.h b/7zip/Compress/LZMA/StdAfx.h deleted file mode 100755 index e7fb6986..00000000 --- a/7zip/Compress/LZMA/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Compress/LZMA/makefile b/7zip/Compress/LZMA/makefile deleted file mode 100755 index aae16966..00000000 --- a/7zip/Compress/LZMA/makefile +++ /dev/null @@ -1,59 +0,0 @@ -PROG = LZMA.dll -DEF_FILE = ../Codec.def -CFLAGS = $(CFLAGS) -I ../../../ -DCOMPRESS_MF_MT -D_ST_MODE -LIBS = $(LIBS) oleaut32.lib - -LZMA_OBJS = \ - $O\DllExports.obj \ - -LZMA_OPT_OBJS = \ - $O\LZMADecoder.obj \ - $O\LZMAEncoder.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\CRC.obj \ - -WIN_OBJS = \ - $O\Synchronization.obj - -7ZIP_COMMON_OBJS = \ - $O\InBuffer.obj \ - $O\OutBuffer.obj \ - $O\StreamUtils.obj \ - -LZ_OBJS = \ - $O\LZInWindow.obj \ - $O\LZOutWindow.obj \ - - -OBJS = \ - $O\StdAfx.obj \ - $(LZMA_OBJS) \ - $(LZMA_OPT_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(LZ_OBJS) \ - $O\MT.obj \ - $O\RangeCoderBit.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(LZMA_OBJS): $(*B).cpp - $(COMPL) -$(LZMA_OPT_OBJS): $(*B).cpp - $(COMPL_O2) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(LZ_OBJS): ../LZ/$(*B).cpp - $(COMPL) -$O\MT.obj: ../LZ/MT/$(*B).cpp - $(COMPL_O2) -$O\RangeCoderBit.obj: ../RangeCoder/$(*B).cpp - $(COMPL) diff --git a/7zip/Compress/LZMA/resource.rc b/7zip/Compress/LZMA/resource.rc deleted file mode 100755 index 1b2b6abb..00000000 --- a/7zip/Compress/LZMA/resource.rc +++ /dev/null @@ -1,3 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("LZMA Codec", "LZMA") diff --git a/7zip/Compress/LZMA_Alone/AloneLZMA.dsp b/7zip/Compress/LZMA_Alone/AloneLZMA.dsp deleted file mode 100755 index dace1476..00000000 --- a/7zip/Compress/LZMA_Alone/AloneLZMA.dsp +++ /dev/null @@ -1,475 +0,0 @@ -# Microsoft Developer Studio Project File - Name="AloneLZMA" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=AloneLZMA - Win32 DebugU -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "AloneLZMA.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "AloneLZMA.mak" CFG="AloneLZMA - Win32 DebugU" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "AloneLZMA - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "AloneLZMA - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE "AloneLZMA - Win32 ReleaseU" (based on "Win32 (x86) Console Application") -!MESSAGE "AloneLZMA - Win32 DebugU" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "AloneLZMA - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /Yu"StdAfx.h" /FD /c -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"c:\UTIL\lzma.exe" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "AloneLZMA - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"c:\UTIL\lzma.exe" /pdbtype:sept - -!ELSEIF "$(CFG)" == "AloneLZMA - Win32 ReleaseU" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ReleaseU" -# PROP BASE Intermediate_Dir "ReleaseU" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ReleaseU" -# PROP Intermediate_Dir "ReleaseU" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_PAT" /D "COMPRESS_MF_BT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /Yu"StdAfx.h" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\\" /D "NDEBUG" /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "_CONSOLE" /Yu"StdAfx.h" /FD /c -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"c:\UTIL\7za2.exe" /opt:NOWIN98 -# SUBTRACT BASE LINK32 /pdb:none -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"c:\UTIL\lzma.exe" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "AloneLZMA - Win32 DebugU" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "DebugU" -# PROP BASE Intermediate_Dir "DebugU" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "DebugU" -# PROP Intermediate_Dir "DebugU" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_PAT" /D "COMPRESS_MF_BT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /D "_MBCS" /Yu"StdAfx.h" /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"c:\UTIL\7za2.exe" /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"c:\UTIL\lzma.exe" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "AloneLZMA - Win32 Release" -# Name "AloneLZMA - Win32 Debug" -# Name "AloneLZMA - Win32 ReleaseU" -# Name "AloneLZMA - Win32 DebugU" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Group "LZMA" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\LZMA\LZMA.h -# End Source File -# Begin Source File - -SOURCE=..\LZMA\LZMADecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\LZMA\LZMADecoder.h -# End Source File -# Begin Source File - -SOURCE=..\LZMA\LZMAEncoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\LZMA\LZMAEncoder.h -# End Source File -# End Group -# Begin Group "RangeCoder" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\RangeCoder\RangeCoder.h -# End Source File -# Begin Source File - -SOURCE=..\RangeCoder\RangeCoderBit.cpp -# End Source File -# Begin Source File - -SOURCE=..\RangeCoder\RangeCoderBit.h -# End Source File -# Begin Source File - -SOURCE=..\RangeCoder\RangeCoderBitTree.h -# End Source File -# Begin Source File - -SOURCE=..\RangeCoder\RangeCoderOpt.h -# End Source File -# End Group -# Begin Group "LZ" - -# PROP Default_Filter "" -# Begin Group "BT" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\LZ\BinTree\BinTree.h -# End Source File -# Begin Source File - -SOURCE=..\LZ\BinTree\BinTree2.h -# End Source File -# Begin Source File - -SOURCE=..\LZ\BinTree\BinTree3.h -# End Source File -# Begin Source File - -SOURCE=..\LZ\BinTree\BinTree3Z.h -# End Source File -# Begin Source File - -SOURCE=..\LZ\BinTree\BinTree4.h -# End Source File -# Begin Source File - -SOURCE=..\LZ\BinTree\BinTreeMain.h -# End Source File -# End Group -# Begin Group "HC" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\LZ\HashChain\HC4.h -# End Source File -# Begin Source File - -SOURCE=..\LZ\HashChain\HCMain.h -# End Source File -# End Group -# Begin Source File - -SOURCE=..\LZ\IMatchFinder.h -# End Source File -# Begin Source File - -SOURCE=..\LZ\LZInWindow.cpp -# End Source File -# Begin Source File - -SOURCE=..\LZ\LZInWindow.h -# End Source File -# Begin Source File - -SOURCE=..\LZ\LZOutWindow.cpp -# End Source File -# Begin Source File - -SOURCE=..\LZ\LZOutWindow.h -# End Source File -# End Group -# Begin Group "Branch" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Branch\BranchTypes.h -# End Source File -# Begin Source File - -SOURCE=..\Branch\BranchX86.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\Branch\BranchX86.h -# End Source File -# End Group -# Begin Group "LZMA_C" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\LZMA_C\LzmaDecode.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\LZMA_C\LzmaDecode.h -# End Source File -# Begin Source File - -SOURCE=..\LZMA_C\LzmaTypes.h -# End Source File -# End Group -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\FileIO.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileIO.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CommandLineParser.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CommandLineParser.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Defs.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Defs.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\MyCom.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\MyWindows.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Types.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\FileStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\FileStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Source File - -SOURCE=..\..\ICoder.h -# End Source File -# Begin Source File - -SOURCE=.\LzmaAlone.cpp -# End Source File -# Begin Source File - -SOURCE=.\LzmaBench.cpp -# End Source File -# Begin Source File - -SOURCE=.\LzmaBench.h -# End Source File -# Begin Source File - -SOURCE=.\LzmaRam.cpp -# End Source File -# Begin Source File - -SOURCE=.\LzmaRam.h -# End Source File -# Begin Source File - -SOURCE=.\LzmaRamDecode.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=.\LzmaRamDecode.h -# End Source File -# End Target -# End Project diff --git a/7zip/Compress/LZMA_Alone/AloneLZMA.dsw b/7zip/Compress/LZMA_Alone/AloneLZMA.dsw deleted file mode 100755 index d7482d8a..00000000 --- a/7zip/Compress/LZMA_Alone/AloneLZMA.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "AloneLZMA"=.\AloneLZMA.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Compress/LZMA_Alone/LzmaAlone.cpp b/7zip/Compress/LZMA_Alone/LzmaAlone.cpp deleted file mode 100755 index 16f80414..00000000 --- a/7zip/Compress/LZMA_Alone/LzmaAlone.cpp +++ /dev/null @@ -1,526 +0,0 @@ -// LzmaAlone.cpp - -#include "StdAfx.h" - -#include "../../../Common/MyWindows.h" -#include "../../../Common/MyInitGuid.h" - -#include - -#if defined(_WIN32) || defined(OS2) || defined(MSDOS) -#include -#include -#define MY_SET_BINARY_MODE(file) _setmode(_fileno(file), O_BINARY) -#else -#define MY_SET_BINARY_MODE(file) -#endif - -#include "../../../Common/CommandLineParser.h" -#include "../../../Common/StringConvert.h" -#include "../../../Common/StringToInt.h" - -#include "../../Common/FileStreams.h" -#include "../../Common/StreamUtils.h" - -#include "../LZMA/LZMADecoder.h" -#include "../LZMA/LZMAEncoder.h" - -#include "LzmaBench.h" -#include "LzmaRam.h" - -extern "C" -{ -#include "LzmaRamDecode.h" -} - -using namespace NCommandLineParser; - -#ifdef _WIN32 -bool g_IsNT = false; -static inline bool IsItWindowsNT() -{ - OSVERSIONINFO versionInfo; - versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); - if (!::GetVersionEx(&versionInfo)) - return false; - return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT); -} -#endif - -static const char *kCantAllocate = "Can not allocate memory"; -static const char *kReadError = "Read error"; -static const char *kWriteError = "Write error"; - -namespace NKey { -enum Enum -{ - kHelp1 = 0, - kHelp2, - kMode, - kDictionary, - kFastBytes, - kMatchFinderCycles, - kLitContext, - kLitPos, - kPosBits, - kMatchFinder, - kEOS, - kStdIn, - kStdOut, - kFilter86 -}; -} - -static const CSwitchForm kSwitchForms[] = -{ - { L"?", NSwitchType::kSimple, false }, - { L"H", NSwitchType::kSimple, false }, - { L"A", NSwitchType::kUnLimitedPostString, false, 1 }, - { L"D", NSwitchType::kUnLimitedPostString, false, 1 }, - { L"FB", NSwitchType::kUnLimitedPostString, false, 1 }, - { L"MC", NSwitchType::kUnLimitedPostString, false, 1 }, - { L"LC", NSwitchType::kUnLimitedPostString, false, 1 }, - { L"LP", NSwitchType::kUnLimitedPostString, false, 1 }, - { L"PB", NSwitchType::kUnLimitedPostString, false, 1 }, - { L"MF", NSwitchType::kUnLimitedPostString, false, 1 }, - { L"EOS", NSwitchType::kSimple, false }, - { L"SI", NSwitchType::kSimple, false }, - { L"SO", NSwitchType::kSimple, false }, - { L"F86", NSwitchType::kSimple, false } -}; - -static const int kNumSwitches = sizeof(kSwitchForms) / sizeof(kSwitchForms[0]); - -static void PrintHelp() -{ - fprintf(stderr, "\nUsage: LZMA inputFile outputFile [...]\n" - " e: encode file\n" - " d: decode file\n" - " b: Benchmark\n" - "\n" - " -a{N}: set compression mode - [0, 1], default: 1 (max)\n" - " -d{N}: set dictionary - [0,30], default: 23 (8MB)\n" - " -fb{N}: set number of fast bytes - [5, 273], default: 128\n" - " -mc{N}: set number of cycles for match finder\n" - " -lc{N}: set number of literal context bits - [0, 8], default: 3\n" - " -lp{N}: set number of literal pos bits - [0, 4], default: 0\n" - " -pb{N}: set number of pos bits - [0, 4], default: 2\n" - " -mf{MF_ID}: set Match Finder: [bt2, bt3, bt4, hc4], default: bt4\n" - " -eos: write End Of Stream marker\n" - " -si: read data from stdin\n" - " -so: write data to stdout\n" - ); -} - -static void PrintHelpAndExit(const char *s) -{ - fprintf(stderr, "\nError: %s\n\n", s); - PrintHelp(); - throw -1; -} - -static void IncorrectCommand() -{ - PrintHelpAndExit("Incorrect command"); -} - -static void WriteArgumentsToStringList(int numArguments, const char *arguments[], - UStringVector &strings) -{ - for(int i = 1; i < numArguments; i++) - strings.Add(MultiByteToUnicodeString(arguments[i])); -} - -static bool GetNumber(const wchar_t *s, UInt32 &value) -{ - value = 0; - if (MyStringLen(s) == 0) - return false; - const wchar_t *end; - UInt64 res = ConvertStringToUInt64(s, &end); - if (*end != L'\0') - return false; - if (res > 0xFFFFFFFF) - return false; - value = UInt32(res); - return true; -} - -int main2(int n, const char *args[]) -{ - #ifdef _WIN32 - g_IsNT = IsItWindowsNT(); - #endif - - fprintf(stderr, "\nLZMA 4.43 Copyright (c) 1999-2006 Igor Pavlov 2006-08-08\n"); - - if (n == 1) - { - PrintHelp(); - return 0; - } - - bool unsupportedTypes = (sizeof(Byte) != 1 || sizeof(UInt32) < 4 || sizeof(UInt64) < 4); - if (unsupportedTypes) - { - fprintf(stderr, "Unsupported base types. Edit Common/Types.h and recompile"); - return 1; - } - - UStringVector commandStrings; - WriteArgumentsToStringList(n, args, commandStrings); - CParser parser(kNumSwitches); - try - { - parser.ParseStrings(kSwitchForms, commandStrings); - } - catch(...) - { - IncorrectCommand(); - } - - if(parser[NKey::kHelp1].ThereIs || parser[NKey::kHelp2].ThereIs) - { - PrintHelp(); - return 0; - } - const UStringVector &nonSwitchStrings = parser.NonSwitchStrings; - - int paramIndex = 0; - if (paramIndex >= nonSwitchStrings.Size()) - IncorrectCommand(); - const UString &command = nonSwitchStrings[paramIndex++]; - - bool dictionaryIsDefined = false; - UInt32 dictionary = 1 << 21; - if(parser[NKey::kDictionary].ThereIs) - { - UInt32 dicLog; - if (!GetNumber(parser[NKey::kDictionary].PostStrings[0], dicLog)) - IncorrectCommand(); - dictionary = 1 << dicLog; - dictionaryIsDefined = true; - } - UString mf = L"BT4"; - if (parser[NKey::kMatchFinder].ThereIs) - mf = parser[NKey::kMatchFinder].PostStrings[0]; - - if (command.CompareNoCase(L"b") == 0) - { - const UInt32 kNumDefaultItereations = 10; - UInt32 numIterations = kNumDefaultItereations; - { - if (paramIndex < nonSwitchStrings.Size()) - if (!GetNumber(nonSwitchStrings[paramIndex++], numIterations)) - numIterations = kNumDefaultItereations; - } - return LzmaBenchmark(stderr, numIterations, dictionary); - } - - bool encodeMode = false; - if (command.CompareNoCase(L"e") == 0) - encodeMode = true; - else if (command.CompareNoCase(L"d") == 0) - encodeMode = false; - else - IncorrectCommand(); - - bool stdInMode = parser[NKey::kStdIn].ThereIs; - bool stdOutMode = parser[NKey::kStdOut].ThereIs; - - CMyComPtr inStream; - CInFileStream *inStreamSpec = 0; - if (stdInMode) - { - inStream = new CStdInFileStream; - MY_SET_BINARY_MODE(stdin); - } - else - { - if (paramIndex >= nonSwitchStrings.Size()) - IncorrectCommand(); - const UString &inputName = nonSwitchStrings[paramIndex++]; - inStreamSpec = new CInFileStream; - inStream = inStreamSpec; - if (!inStreamSpec->Open(GetSystemString(inputName))) - { - fprintf(stderr, "\nError: can not open input file %s\n", - (const char *)GetOemString(inputName)); - return 1; - } - } - - CMyComPtr outStream; - if (stdOutMode) - { - outStream = new CStdOutFileStream; - MY_SET_BINARY_MODE(stdout); - } - else - { - if (paramIndex >= nonSwitchStrings.Size()) - IncorrectCommand(); - const UString &outputName = nonSwitchStrings[paramIndex++]; - COutFileStream *outStreamSpec = new COutFileStream; - outStream = outStreamSpec; - if (!outStreamSpec->Create(GetSystemString(outputName), true)) - { - fprintf(stderr, "\nError: can not open output file %s\n", - (const char *)GetOemString(outputName)); - return 1; - } - } - - if (parser[NKey::kFilter86].ThereIs) - { - // -f86 switch is for x86 filtered mode: BCJ + LZMA. - if (parser[NKey::kEOS].ThereIs || stdInMode) - throw "Can not use stdin in this mode"; - UInt64 fileSize; - inStreamSpec->File.GetLength(fileSize); - if (fileSize > 0xF0000000) - throw "File is too big"; - UInt32 inSize = (UInt32)fileSize; - Byte *inBuffer = 0; - if (inSize != 0) - { - inBuffer = (Byte *)MyAlloc((size_t)inSize); - if (inBuffer == 0) - throw kCantAllocate; - } - - UInt32 processedSize; - if (ReadStream(inStream, inBuffer, (UInt32)inSize, &processedSize) != S_OK) - throw "Can not read"; - if ((UInt32)inSize != processedSize) - throw "Read size error"; - - Byte *outBuffer = 0; - size_t outSizeProcessed; - if (encodeMode) - { - // we allocate 105% of original size for output buffer - size_t outSize = (size_t)fileSize / 20 * 21 + (1 << 16); - if (outSize != 0) - { - outBuffer = (Byte *)MyAlloc((size_t)outSize); - if (outBuffer == 0) - throw kCantAllocate; - } - if (!dictionaryIsDefined) - dictionary = 1 << 23; - int res = LzmaRamEncode(inBuffer, inSize, outBuffer, outSize, &outSizeProcessed, - dictionary, SZ_FILTER_AUTO); - if (res != 0) - { - fprintf(stderr, "\nEncoder error = %d\n", (int)res); - return 1; - } - } - else - { - size_t outSize; - if (LzmaRamGetUncompressedSize(inBuffer, inSize, &outSize) != 0) - throw "data error"; - if (outSize != 0) - { - outBuffer = (Byte *)MyAlloc(outSize); - if (outBuffer == 0) - throw kCantAllocate; - } - int res = LzmaRamDecompress(inBuffer, inSize, outBuffer, outSize, &outSizeProcessed, malloc, free); - if (res != 0) - throw "LzmaDecoder error"; - } - if (WriteStream(outStream, outBuffer, (UInt32)outSizeProcessed, &processedSize) != S_OK) - throw kWriteError; - MyFree(outBuffer); - MyFree(inBuffer); - return 0; - } - - - UInt64 fileSize; - if (encodeMode) - { - NCompress::NLZMA::CEncoder *encoderSpec = - new NCompress::NLZMA::CEncoder; - CMyComPtr encoder = encoderSpec; - - if (!dictionaryIsDefined) - dictionary = 1 << 23; - - UInt32 posStateBits = 2; - UInt32 litContextBits = 3; // for normal files - // UInt32 litContextBits = 0; // for 32-bit data - UInt32 litPosBits = 0; - // UInt32 litPosBits = 2; // for 32-bit data - UInt32 algorithm = 2; - UInt32 numFastBytes = 128; - UInt32 matchFinderCycles = 16 + numFastBytes / 2; - bool matchFinderCyclesDefined = false; - - bool eos = parser[NKey::kEOS].ThereIs || stdInMode; - - if(parser[NKey::kMode].ThereIs) - if (!GetNumber(parser[NKey::kMode].PostStrings[0], algorithm)) - IncorrectCommand(); - - if(parser[NKey::kFastBytes].ThereIs) - if (!GetNumber(parser[NKey::kFastBytes].PostStrings[0], numFastBytes)) - IncorrectCommand(); - matchFinderCyclesDefined = parser[NKey::kMatchFinderCycles].ThereIs; - if (matchFinderCyclesDefined) - if (!GetNumber(parser[NKey::kMatchFinderCycles].PostStrings[0], matchFinderCycles)) - IncorrectCommand(); - if(parser[NKey::kLitContext].ThereIs) - if (!GetNumber(parser[NKey::kLitContext].PostStrings[0], litContextBits)) - IncorrectCommand(); - if(parser[NKey::kLitPos].ThereIs) - if (!GetNumber(parser[NKey::kLitPos].PostStrings[0], litPosBits)) - IncorrectCommand(); - if(parser[NKey::kPosBits].ThereIs) - if (!GetNumber(parser[NKey::kPosBits].PostStrings[0], posStateBits)) - IncorrectCommand(); - - PROPID propIDs[] = - { - NCoderPropID::kDictionarySize, - NCoderPropID::kPosStateBits, - NCoderPropID::kLitContextBits, - NCoderPropID::kLitPosBits, - NCoderPropID::kAlgorithm, - NCoderPropID::kNumFastBytes, - NCoderPropID::kMatchFinder, - NCoderPropID::kEndMarker, - NCoderPropID::kMatchFinderCycles - }; - const int kNumPropsMax = sizeof(propIDs) / sizeof(propIDs[0]); - /* - NWindows::NCOM::CPropVariant properties[kNumProps]; - properties[0] = UInt32(dictionary); - properties[1] = UInt32(posStateBits); - properties[2] = UInt32(litContextBits); - - properties[3] = UInt32(litPosBits); - properties[4] = UInt32(algorithm); - properties[5] = UInt32(numFastBytes); - properties[6] = mf; - properties[7] = eos; - */ - PROPVARIANT properties[kNumPropsMax]; - for (int p = 0; p < 6; p++) - properties[p].vt = VT_UI4; - - properties[0].ulVal = UInt32(dictionary); - properties[1].ulVal = UInt32(posStateBits); - properties[2].ulVal = UInt32(litContextBits); - properties[3].ulVal = UInt32(litPosBits); - properties[4].ulVal = UInt32(algorithm); - properties[5].ulVal = UInt32(numFastBytes); - - properties[8].vt = VT_UI4; - properties[8].ulVal = UInt32(matchFinderCycles); - - properties[6].vt = VT_BSTR; - properties[6].bstrVal = (BSTR)(const wchar_t *)mf; - - properties[7].vt = VT_BOOL; - properties[7].boolVal = eos ? VARIANT_TRUE : VARIANT_FALSE; - - int numProps = kNumPropsMax; - if (!matchFinderCyclesDefined) - numProps--; - - if (encoderSpec->SetCoderProperties(propIDs, properties, numProps) != S_OK) - IncorrectCommand(); - encoderSpec->WriteCoderProperties(outStream); - - if (eos || stdInMode) - fileSize = (UInt64)(Int64)-1; - else - inStreamSpec->File.GetLength(fileSize); - - for (int i = 0; i < 8; i++) - { - Byte b = Byte(fileSize >> (8 * i)); - if (outStream->Write(&b, 1, 0) != S_OK) - { - fprintf(stderr, kWriteError); - return 1; - } - } - HRESULT result = encoder->Code(inStream, outStream, 0, 0, 0); - if (result == E_OUTOFMEMORY) - { - fprintf(stderr, "\nError: Can not allocate memory\n"); - return 1; - } - else if (result != S_OK) - { - fprintf(stderr, "\nEncoder error = %X\n", (unsigned int)result); - return 1; - } - } - else - { - NCompress::NLZMA::CDecoder *decoderSpec = - new NCompress::NLZMA::CDecoder; - CMyComPtr decoder = decoderSpec; - const UInt32 kPropertiesSize = 5; - Byte properties[kPropertiesSize]; - UInt32 processedSize; - if (ReadStream(inStream, properties, kPropertiesSize, &processedSize) != S_OK) - { - fprintf(stderr, kReadError); - return 1; - } - if (processedSize != kPropertiesSize) - { - fprintf(stderr, kReadError); - return 1; - } - if (decoderSpec->SetDecoderProperties2(properties, kPropertiesSize) != S_OK) - { - fprintf(stderr, "SetDecoderProperties error"); - return 1; - } - fileSize = 0; - for (int i = 0; i < 8; i++) - { - Byte b; - if (inStream->Read(&b, 1, &processedSize) != S_OK) - { - fprintf(stderr, kReadError); - return 1; - } - if (processedSize != 1) - { - fprintf(stderr, kReadError); - return 1; - } - fileSize |= ((UInt64)b) << (8 * i); - } - if (decoder->Code(inStream, outStream, 0, &fileSize, 0) != S_OK) - { - fprintf(stderr, "Decoder error"); - return 1; - } - } - return 0; -} - -int main(int n, const char *args[]) -{ - try { return main2(n, args); } - catch(const char *s) - { - fprintf(stderr, "\nError: %s\n", s); - return 1; - } - catch(...) - { - fprintf(stderr, "\nError\n"); - return 1; - } -} diff --git a/7zip/Compress/LZMA_Alone/LzmaBench.cpp b/7zip/Compress/LZMA_Alone/LzmaBench.cpp deleted file mode 100755 index f9924165..00000000 --- a/7zip/Compress/LZMA_Alone/LzmaBench.cpp +++ /dev/null @@ -1,506 +0,0 @@ -// LzmaBench.cpp - -#include "StdAfx.h" - -#include "LzmaBench.h" - -#ifndef _WIN32 -#include -#endif - -#include "../../../Common/CRC.h" -#include "../LZMA/LZMADecoder.h" -#include "../LZMA/LZMAEncoder.h" - -static const UInt32 kAdditionalSize = -#ifdef _WIN32_WCE -(1 << 20); -#else -(6 << 20); -#endif - -static const UInt32 kCompressedAdditionalSize = (1 << 10); -static const UInt32 kMaxLzmaPropSize = 10; - -class CRandomGenerator -{ - UInt32 A1; - UInt32 A2; -public: - CRandomGenerator() { Init(); } - void Init() { A1 = 362436069; A2 = 521288629;} - UInt32 GetRnd() - { - return - ((A1 = 36969 * (A1 & 0xffff) + (A1 >> 16)) << 16) ^ - ((A2 = 18000 * (A2 & 0xffff) + (A2 >> 16)) ); - } -}; - -class CBitRandomGenerator -{ - CRandomGenerator RG; - UInt32 Value; - int NumBits; -public: - void Init() - { - Value = 0; - NumBits = 0; - } - UInt32 GetRnd(int numBits) - { - if (NumBits > numBits) - { - UInt32 result = Value & ((1 << numBits) - 1); - Value >>= numBits; - NumBits -= numBits; - return result; - } - numBits -= NumBits; - UInt32 result = (Value << numBits); - Value = RG.GetRnd(); - result |= Value & ((1 << numBits) - 1); - Value >>= numBits; - NumBits = 32 - numBits; - return result; - } -}; - -class CBenchRandomGenerator -{ - CBitRandomGenerator RG; - UInt32 Pos; - UInt32 Rep0; -public: - UInt32 BufferSize; - Byte *Buffer; - CBenchRandomGenerator(): Buffer(0) {} - ~CBenchRandomGenerator() { Free(); } - void Free() - { - ::MidFree(Buffer); - Buffer = 0; - } - bool Alloc(UInt32 bufferSize) - { - if (Buffer != 0 && BufferSize == bufferSize) - return true; - Free(); - Buffer = (Byte *)::MidAlloc(bufferSize); - Pos = 0; - BufferSize = bufferSize; - return (Buffer != 0); - } - UInt32 GetRndBit() { return RG.GetRnd(1); } - /* - UInt32 GetLogRand(int maxLen) - { - UInt32 len = GetRnd() % (maxLen + 1); - return GetRnd() & ((1 << len) - 1); - } - */ - UInt32 GetLogRandBits(int numBits) - { - UInt32 len = RG.GetRnd(numBits); - return RG.GetRnd(len); - } - UInt32 GetOffset() - { - if (GetRndBit() == 0) - return GetLogRandBits(4); - return (GetLogRandBits(4) << 10) | RG.GetRnd(10); - } - UInt32 GetLen1() { return RG.GetRnd(1 + (int)RG.GetRnd(2)); } - UInt32 GetLen2() { return RG.GetRnd(2 + (int)RG.GetRnd(2)); } - void Generate() - { - RG.Init(); - Rep0 = 1; - while(Pos < BufferSize) - { - if (GetRndBit() == 0 || Pos < 1) - Buffer[Pos++] = (Byte)RG.GetRnd(8); - else - { - UInt32 len; - if (RG.GetRnd(3) == 0) - len = 1 + GetLen1(); - else - { - do - Rep0 = GetOffset(); - while (Rep0 >= Pos); - Rep0++; - len = 2 + GetLen2(); - } - for (UInt32 i = 0; i < len && Pos < BufferSize; i++, Pos++) - Buffer[Pos] = Buffer[Pos - Rep0]; - } - } - } -}; - -class CBenchmarkInStream: - public ISequentialInStream, - public CMyUnknownImp -{ - const Byte *Data; - UInt32 Pos; - UInt32 Size; -public: - MY_UNKNOWN_IMP - void Init(const Byte *data, UInt32 size) - { - Data = data; - Size = size; - Pos = 0; - } - STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); -}; - -STDMETHODIMP CBenchmarkInStream::Read(void *data, UInt32 size, UInt32 *processedSize) -{ - UInt32 remain = Size - Pos; - if (size > remain) - size = remain; - for (UInt32 i = 0; i < size; i++) - ((Byte *)data)[i] = Data[Pos + i]; - Pos += size; - if(processedSize != NULL) - *processedSize = size; - return S_OK; -} - -class CBenchmarkOutStream: - public ISequentialOutStream, - public CMyUnknownImp -{ - UInt32 BufferSize; - FILE *_f; -public: - UInt32 Pos; - Byte *Buffer; - CBenchmarkOutStream(): _f(0), Buffer(0) {} - virtual ~CBenchmarkOutStream() { delete []Buffer; } - void Init(FILE *f, UInt32 bufferSize) - { - delete []Buffer; - Buffer = 0; - Buffer = new Byte[bufferSize]; - Pos = 0; - BufferSize = bufferSize; - _f = f; - } - MY_UNKNOWN_IMP - STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); -}; - -STDMETHODIMP CBenchmarkOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize) -{ - UInt32 i; - for (i = 0; i < size && Pos < BufferSize; i++) - Buffer[Pos++] = ((const Byte *)data)[i]; - if(processedSize != NULL) - *processedSize = i; - if (i != size) - { - fprintf(_f, "\nERROR: Buffer is full\n"); - return E_FAIL; - } - return S_OK; -} - -class CCrcOutStream: - public ISequentialOutStream, - public CMyUnknownImp -{ -public: - CCRC CRC; - MY_UNKNOWN_IMP - void Init() { CRC.Init(); } - STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); -}; - -STDMETHODIMP CCrcOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize) -{ - CRC.Update(data, size); - if(processedSize != NULL) - *processedSize = size; - return S_OK; -} - -static UInt64 GetTimeCount() -{ - #ifdef _WIN32 - LARGE_INTEGER value; - if (::QueryPerformanceCounter(&value)) - return value.QuadPart; - return GetTickCount(); - #else - return clock(); - #endif -} - -static UInt64 GetFreq() -{ - #ifdef _WIN32 - LARGE_INTEGER value; - if (::QueryPerformanceFrequency(&value)) - return value.QuadPart; - return 1000; - #else - return CLOCKS_PER_SEC; - #endif -} - -struct CProgressInfo: - public ICompressProgressInfo, - public CMyUnknownImp -{ - UInt64 ApprovedStart; - UInt64 InSize; - UInt64 Time; - void Init() - { - InSize = 0; - Time = 0; - } - MY_UNKNOWN_IMP - STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize); -}; - -STDMETHODIMP CProgressInfo::SetRatioInfo(const UInt64 *inSize, const UInt64 * /* outSize */) -{ - if (*inSize >= ApprovedStart && InSize == 0) - { - Time = ::GetTimeCount(); - InSize = *inSize; - } - return S_OK; -} - -static const int kSubBits = 8; - -static UInt32 GetLogSize(UInt32 size) -{ - for (int i = kSubBits; i < 32; i++) - for (UInt32 j = 0; j < (1 << kSubBits); j++) - if (size <= (((UInt32)1) << i) + (j << (i - kSubBits))) - return (i << kSubBits) + j; - return (32 << kSubBits); -} - -static UInt64 MyMultDiv64(UInt64 value, UInt64 elapsedTime) -{ - UInt64 freq = GetFreq(); - UInt64 elTime = elapsedTime; - while(freq > 1000000) - { - freq >>= 1; - elTime >>= 1; - } - if (elTime == 0) - elTime = 1; - return value * freq / elTime; -} - -static UInt64 GetCompressRating(UInt32 dictionarySize, UInt64 elapsedTime, UInt64 size) -{ - UInt64 t = GetLogSize(dictionarySize) - (18 << kSubBits); - UInt64 numCommandsForOne = 1060 + ((t * t * 10) >> (2 * kSubBits)); - UInt64 numCommands = (UInt64)(size) * numCommandsForOne; - return MyMultDiv64(numCommands, elapsedTime); -} - -static UInt64 GetDecompressRating(UInt64 elapsedTime, - UInt64 outSize, UInt64 inSize) -{ - UInt64 numCommands = inSize * 220 + outSize * 20; - return MyMultDiv64(numCommands, elapsedTime); -} - -/* -static UInt64 GetTotalRating( - UInt32 dictionarySize, - bool isBT4, - UInt64 elapsedTimeEn, UInt64 sizeEn, - UInt64 elapsedTimeDe, - UInt64 inSizeDe, UInt64 outSizeDe) -{ - return (GetCompressRating(dictionarySize, isBT4, elapsedTimeEn, sizeEn) + - GetDecompressRating(elapsedTimeDe, inSizeDe, outSizeDe)) / 2; -} -*/ - -static void PrintRating(FILE *f, UInt64 rating) -{ - fprintf(f, "%5d MIPS", (unsigned int)(rating / 1000000)); -} - -static void PrintResults( - FILE *f, - UInt32 dictionarySize, - UInt64 elapsedTime, - UInt64 size, - bool decompressMode, UInt64 secondSize) -{ - UInt64 speed = MyMultDiv64(size, elapsedTime); - fprintf(f, "%6d KB/s ", (unsigned int)(speed / 1024)); - UInt64 rating; - if (decompressMode) - rating = GetDecompressRating(elapsedTime, size, secondSize); - else - rating = GetCompressRating(dictionarySize, elapsedTime, size); - PrintRating(f, rating); -} - -static void ThrowError(FILE *f, HRESULT result, const char *s) -{ - fprintf(f, "\nError: "); - if (result == E_ABORT) - fprintf(f, "User break"); - if (result == E_OUTOFMEMORY) - fprintf(f, "Can not allocate memory"); - else - fprintf(f, s); - fprintf(f, "\n"); -} - -const wchar_t *bt2 = L"BT2"; -const wchar_t *bt4 = L"BT4"; - -int LzmaBenchmark(FILE *f, UInt32 numIterations, UInt32 dictionarySize) -{ - if (numIterations == 0) - return 0; - if (dictionarySize < (1 << 18)) - { - fprintf(f, "\nError: dictionary size for benchmark must be >= 19 (512 KB)\n"); - return 1; - } - fprintf(f, "\n Compressing Decompressing\n\n"); - NCompress::NLZMA::CEncoder *encoderSpec = new NCompress::NLZMA::CEncoder; - CMyComPtr encoder = encoderSpec; - - NCompress::NLZMA::CDecoder *decoderSpec = new NCompress::NLZMA::CDecoder; - CMyComPtr decoder = decoderSpec; - - CBenchmarkOutStream *propStreamSpec = new CBenchmarkOutStream; - CMyComPtr propStream = propStreamSpec; - propStreamSpec->Init(f, kMaxLzmaPropSize); - - PROPID propIDs[] = - { - NCoderPropID::kDictionarySize - }; - const int kNumProps = sizeof(propIDs) / sizeof(propIDs[0]); - PROPVARIANT properties[kNumProps]; - properties[0].vt = VT_UI4; - properties[0].ulVal = UInt32(dictionarySize); - - const UInt32 kBufferSize = dictionarySize + kAdditionalSize; - const UInt32 kCompressedBufferSize = (kBufferSize / 2) + kCompressedAdditionalSize; - - if (encoderSpec->SetCoderProperties(propIDs, properties, kNumProps) != S_OK) - { - fprintf(f, "\nError: Incorrect command\n"); - return 1; - } - encoderSpec->WriteCoderProperties(propStream); - - CBenchRandomGenerator rg; - if (!rg.Alloc(kBufferSize)) - { - fprintf(f, "\nError: Can't allocate memory\n"); - return 1; - } - - rg.Generate(); - CCRC crc; - crc.Update(rg.Buffer, rg.BufferSize); - - CProgressInfo *progressInfoSpec = new CProgressInfo; - CMyComPtr progressInfo = progressInfoSpec; - - progressInfoSpec->ApprovedStart = dictionarySize; - - UInt64 totalBenchSize = 0; - UInt64 totalEncodeTime = 0; - UInt64 totalDecodeTime = 0; - UInt64 totalCompressedSize = 0; - - for (UInt32 i = 0; i < numIterations; i++) - { - progressInfoSpec->Init(); - CBenchmarkInStream *inStreamSpec = new CBenchmarkInStream; - inStreamSpec->Init(rg.Buffer, rg.BufferSize); - CMyComPtr inStream = inStreamSpec; - CBenchmarkOutStream *outStreamSpec = new CBenchmarkOutStream; - outStreamSpec->Init(f, kCompressedBufferSize); - CMyComPtr outStream = outStreamSpec; - HRESULT result = encoder->Code(inStream, outStream, 0, 0, progressInfo); - UInt64 encodeTime = ::GetTimeCount() - progressInfoSpec->Time; - UInt32 compressedSize = outStreamSpec->Pos; - if(result != S_OK) - { - ThrowError(f, result, "Encoder Error"); - return 1; - } - if (progressInfoSpec->InSize == 0) - { - fprintf(f, "\nError: Internal ERROR 1282\n"); - return 1; - } - - /////////////////////// - // Decompressing - - CCrcOutStream *crcOutStreamSpec = new CCrcOutStream; - CMyComPtr crcOutStream = crcOutStreamSpec; - - UInt64 decodeTime = 0; - for (int j = 0; j < 2; j++) - { - inStreamSpec->Init(outStreamSpec->Buffer, compressedSize); - crcOutStreamSpec->Init(); - - if (decoderSpec->SetDecoderProperties2(propStreamSpec->Buffer, propStreamSpec->Pos) != S_OK) - { - fprintf(f, "\nError: Set Decoder Properties Error\n"); - return 1; - } - UInt64 outSize = kBufferSize; - UInt64 startTime = ::GetTimeCount(); - result = decoder->Code(inStream, crcOutStream, 0, &outSize, 0); - decodeTime = ::GetTimeCount() - startTime; - if(result != S_OK) - { - ThrowError(f, result, "Decode Error"); - return 1; - } - if (crcOutStreamSpec->CRC.GetDigest() != crc.GetDigest()) - { - fprintf(f, "\nError: CRC Error\n"); - return 1; - } - } - UInt64 benchSize = kBufferSize - progressInfoSpec->InSize; - PrintResults(f, dictionarySize, encodeTime, benchSize, false, 0); - fprintf(f, " "); - PrintResults(f, dictionarySize, decodeTime, kBufferSize, true, compressedSize); - fprintf(f, "\n"); - - totalBenchSize += benchSize; - totalEncodeTime += encodeTime; - totalDecodeTime += decodeTime; - totalCompressedSize += compressedSize; - } - fprintf(f, "---------------------------------------------------\n"); - PrintResults(f, dictionarySize, totalEncodeTime, totalBenchSize, false, 0); - fprintf(f, " "); - PrintResults(f, dictionarySize, totalDecodeTime, - kBufferSize * numIterations, true, totalCompressedSize); - fprintf(f, " Average\n"); - return 0; -} diff --git a/7zip/Compress/LZMA_Alone/LzmaBench.h b/7zip/Compress/LZMA_Alone/LzmaBench.h deleted file mode 100755 index a6a0e82e..00000000 --- a/7zip/Compress/LZMA_Alone/LzmaBench.h +++ /dev/null @@ -1,11 +0,0 @@ -// LzmaBench.h - -#ifndef __LzmaBench_h -#define __LzmaBench_h - -#include -#include "../../../Common/Types.h" - -int LzmaBenchmark(FILE *f, UInt32 numIterations, UInt32 dictionarySize); - -#endif diff --git a/7zip/Compress/LZMA_Alone/LzmaRam.cpp b/7zip/Compress/LZMA_Alone/LzmaRam.cpp deleted file mode 100755 index eb66211a..00000000 --- a/7zip/Compress/LZMA_Alone/LzmaRam.cpp +++ /dev/null @@ -1,227 +0,0 @@ -// LzmaRam.cpp - -#include "StdAfx.h" -#include "../../../Common/Types.h" -#include "../LZMA/LZMADecoder.h" -#include "../LZMA/LZMAEncoder.h" -#include "LzmaRam.h" - -extern "C" -{ -#include "../Branch/BranchX86.h" -} - -class CInStreamRam: - public ISequentialInStream, - public CMyUnknownImp -{ - const Byte *Data; - size_t Size; - size_t Pos; -public: - MY_UNKNOWN_IMP - void Init(const Byte *data, size_t size) - { - Data = data; - Size = size; - Pos = 0; - } - STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); -}; - -STDMETHODIMP CInStreamRam::Read(void *data, UInt32 size, UInt32 *processedSize) -{ - if (size > (Size - Pos)) - size = (UInt32)(Size - Pos); - for (UInt32 i = 0; i < size; i++) - ((Byte *)data)[i] = Data[Pos + i]; - Pos += size; - if(processedSize != NULL) - *processedSize = size; - return S_OK; -} - -class COutStreamRam: - public ISequentialOutStream, - public CMyUnknownImp -{ - size_t Size; -public: - Byte *Data; - size_t Pos; - bool Overflow; - void Init(Byte *data, size_t size) - { - Data = data; - Size = size; - Pos = 0; - Overflow = false; - } - void SetPos(size_t pos) - { - Overflow = false; - Pos = pos; - } - MY_UNKNOWN_IMP - HRESULT WriteByte(Byte b) - { - if (Pos >= Size) - { - Overflow = true; - return E_FAIL; - } - Data[Pos++] = b; - return S_OK; - } - STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); -}; - -STDMETHODIMP COutStreamRam::Write(const void *data, UInt32 size, UInt32 *processedSize) -{ - UInt32 i; - for (i = 0; i < size && Pos < Size; i++) - Data[Pos++] = ((const Byte *)data)[i]; - if(processedSize != NULL) - *processedSize = i; - if (i != size) - { - Overflow = true; - return E_FAIL; - } - return S_OK; -} - -#define SZE_FAIL (1) -#define SZE_OUTOFMEMORY (2) -#define SZE_OUT_OVERFLOW (3) - -int LzmaRamEncode( - const Byte *inBuffer, size_t inSize, - Byte *outBuffer, size_t outSize, size_t *outSizeProcessed, - UInt32 dictionarySize, ESzFilterMode filterMode) -{ - #ifndef _NO_EXCEPTIONS - try { - #endif - - *outSizeProcessed = 0; - const size_t kIdSize = 1; - const size_t kLzmaPropsSize = 5; - const size_t kMinDestSize = kIdSize + kLzmaPropsSize + 8; - if (outSize < kMinDestSize) - return SZE_OUT_OVERFLOW; - NCompress::NLZMA::CEncoder *encoderSpec = new NCompress::NLZMA::CEncoder; - CMyComPtr encoder = encoderSpec; - - PROPID propIDs[] = - { - NCoderPropID::kAlgorithm, - NCoderPropID::kDictionarySize, - NCoderPropID::kNumFastBytes, - }; - const int kNumProps = sizeof(propIDs) / sizeof(propIDs[0]); - PROPVARIANT properties[kNumProps]; - properties[0].vt = VT_UI4; - properties[1].vt = VT_UI4; - properties[2].vt = VT_UI4; - properties[0].ulVal = (UInt32)2; - properties[1].ulVal = (UInt32)dictionarySize; - properties[2].ulVal = (UInt32)64; - - if (encoderSpec->SetCoderProperties(propIDs, properties, kNumProps) != S_OK) - return 1; - - COutStreamRam *outStreamSpec = new COutStreamRam; - if (outStreamSpec == 0) - return SZE_OUTOFMEMORY; - CMyComPtr outStream = outStreamSpec; - CInStreamRam *inStreamSpec = new CInStreamRam; - if (inStreamSpec == 0) - return SZE_OUTOFMEMORY; - CMyComPtr inStream = inStreamSpec; - - outStreamSpec->Init(outBuffer, outSize); - if (outStreamSpec->WriteByte(0) != S_OK) - return SZE_OUT_OVERFLOW; - - if (encoderSpec->WriteCoderProperties(outStream) != S_OK) - return SZE_OUT_OVERFLOW; - if (outStreamSpec->Pos != kIdSize + kLzmaPropsSize) - return 1; - - int i; - for (i = 0; i < 8; i++) - { - UInt64 t = (UInt64)(inSize); - if (outStreamSpec->WriteByte((Byte)((t) >> (8 * i))) != S_OK) - return SZE_OUT_OVERFLOW; - } - - Byte *filteredStream = 0; - - bool useFilter = (filterMode != SZ_FILTER_NO); - if (useFilter) - { - if (inSize != 0) - { - filteredStream = (Byte *)MyAlloc(inSize); - if (filteredStream == 0) - return SZE_OUTOFMEMORY; - memmove(filteredStream, inBuffer, inSize); - } - UInt32 _prevMask; - UInt32 _prevPos; - x86_Convert_Init(_prevMask, _prevPos); - x86_Convert(filteredStream, (UInt32)inSize, 0, &_prevMask, &_prevPos, 1); - } - - size_t minSize = 0; - int numPasses = (filterMode == SZ_FILTER_AUTO) ? 3 : 1; - bool bestIsFiltered = false; - int mainResult = 0; - size_t startPos = outStreamSpec->Pos; - for (i = 0; i < numPasses; i++) - { - if (numPasses > 1 && i == numPasses - 1 && !bestIsFiltered) - break; - outStreamSpec->SetPos(startPos); - bool curModeIsFiltered = false; - if (useFilter && i == 0) - curModeIsFiltered = true; - if (numPasses > 1 && i == numPasses - 1) - curModeIsFiltered = true; - - inStreamSpec->Init(curModeIsFiltered ? filteredStream : inBuffer, inSize); - - HRESULT lzmaResult = encoder->Code(inStream, outStream, 0, 0, 0); - - mainResult = 0; - if (lzmaResult == E_OUTOFMEMORY) - { - mainResult = SZE_OUTOFMEMORY; - break; - } - if (i == 0 || outStreamSpec->Pos <= minSize) - { - minSize = outStreamSpec->Pos; - bestIsFiltered = curModeIsFiltered; - } - if (outStreamSpec->Overflow) - mainResult = SZE_OUT_OVERFLOW; - else if (lzmaResult != S_OK) - { - mainResult = SZE_FAIL; - break; - } - } - *outSizeProcessed = outStreamSpec->Pos; - if (bestIsFiltered) - outBuffer[0] = 1; - if (useFilter) - MyFree(filteredStream); - return mainResult; - - #ifndef _NO_EXCEPTIONS - } catch(...) { return SZE_OUTOFMEMORY; } - #endif -} diff --git a/7zip/Compress/LZMA_Alone/LzmaRam.h b/7zip/Compress/LZMA_Alone/LzmaRam.h deleted file mode 100755 index 1244dc86..00000000 --- a/7zip/Compress/LZMA_Alone/LzmaRam.h +++ /dev/null @@ -1,46 +0,0 @@ -// LzmaRam.h - -#ifndef __LzmaRam_h -#define __LzmaRam_h - -#include -#include "../../../Common/Types.h" - -/* -LzmaRamEncode: BCJ + LZMA RAM->RAM compressing. -It uses .lzma format, but it writes one additional byte to .lzma file: - 0: - no filter - 1: - x86(BCJ) filter. - -To provide best compression ratio dictionarySize mustbe >= inSize - -LzmaRamEncode allocates Data with MyAlloc/BigAlloc functions. -RAM Requirements: - RamSize = dictionarySize * 9.5 + 6MB + FilterBlockSize - FilterBlockSize = 0, if useFilter == false - FilterBlockSize = inSize, if useFilter == true - - Return code: - 0 - OK - 1 - Unspecified Error - 2 - Memory allocating error - 3 - Output buffer OVERFLOW - -If you use SZ_FILTER_AUTO mode, then encoder will use 2 or 3 passes: - 2 passes when FILTER_NO provides better compression. - 3 passes when FILTER_YES provides better compression. -*/ - -enum ESzFilterMode -{ - SZ_FILTER_NO, - SZ_FILTER_YES, - SZ_FILTER_AUTO -}; - -int LzmaRamEncode( - const Byte *inBuffer, size_t inSize, - Byte *outBuffer, size_t outSize, size_t *outSizeProcessed, - UInt32 dictionarySize, ESzFilterMode filterMode); - -#endif diff --git a/7zip/Compress/LZMA_Alone/LzmaRamDecode.c b/7zip/Compress/LZMA_Alone/LzmaRamDecode.c deleted file mode 100755 index ed1784d6..00000000 --- a/7zip/Compress/LZMA_Alone/LzmaRamDecode.c +++ /dev/null @@ -1,79 +0,0 @@ -/* LzmaRamDecode.c */ - -#include "LzmaRamDecode.h" -#ifdef _SZ_ONE_DIRECTORY -#include "LzmaDecode.h" -#include "BranchX86.h" -#else -#include "../LZMA_C/LzmaDecode.h" -#include "../Branch/BranchX86.h" -#endif - -#define LZMA_PROPS_SIZE 14 -#define LZMA_SIZE_OFFSET 6 - -int LzmaRamGetUncompressedSize( - const unsigned char *inBuffer, - size_t inSize, - size_t *outSize) -{ - unsigned int i; - if (inSize < LZMA_PROPS_SIZE) - return 1; - *outSize = 0; - for(i = 0; i < sizeof(size_t); i++) - *outSize += ((size_t)inBuffer[LZMA_SIZE_OFFSET + i]) << (8 * i); - for(; i < 8; i++) - if (inBuffer[LZMA_SIZE_OFFSET + i] != 0) - return 1; - return 0; -} - -#define SZE_DATA_ERROR (1) -#define SZE_OUTOFMEMORY (2) - -int LzmaRamDecompress( - const unsigned char *inBuffer, - size_t inSize, - unsigned char *outBuffer, - size_t outSize, - size_t *outSizeProcessed, - void * (*allocFunc)(size_t size), - void (*freeFunc)(void *)) -{ - CLzmaDecoderState state; /* it's about 24 bytes structure, if int is 32-bit */ - int result; - SizeT outSizeProcessedLoc; - SizeT inProcessed; - int useFilter; - - if (inSize < LZMA_PROPS_SIZE) - return 1; - useFilter = inBuffer[0]; - - *outSizeProcessed = 0; - if (useFilter > 1) - return 1; - - if (LzmaDecodeProperties(&state.Properties, inBuffer + 1, LZMA_PROPERTIES_SIZE) != LZMA_RESULT_OK) - return 1; - state.Probs = (CProb *)allocFunc(LzmaGetNumProbs(&state.Properties) * sizeof(CProb)); - if (state.Probs == 0) - return SZE_OUTOFMEMORY; - - result = LzmaDecode(&state, - inBuffer + LZMA_PROPS_SIZE, (SizeT)inSize - LZMA_PROPS_SIZE, &inProcessed, - outBuffer, (SizeT)outSize, &outSizeProcessedLoc); - freeFunc(state.Probs); - if (result != LZMA_RESULT_OK) - return 1; - *outSizeProcessed = (size_t)outSizeProcessedLoc; - if (useFilter == 1) - { - UInt32 _prevMask; - UInt32 _prevPos; - x86_Convert_Init(_prevMask, _prevPos); - x86_Convert(outBuffer, (UInt32)outSizeProcessedLoc, 0, &_prevMask, &_prevPos, 0); - } - return 0; -} diff --git a/7zip/Compress/LZMA_Alone/LzmaRamDecode.h b/7zip/Compress/LZMA_Alone/LzmaRamDecode.h deleted file mode 100755 index 7e641c55..00000000 --- a/7zip/Compress/LZMA_Alone/LzmaRamDecode.h +++ /dev/null @@ -1,55 +0,0 @@ -/* LzmaRamDecode.h */ - -#ifndef __LzmaRamDecode_h -#define __LzmaRamDecode_h - -#include - -/* -LzmaRamGetUncompressedSize: - In: - inBuffer - input data - inSize - input data size - Out: - outSize - uncompressed size - Return code: - 0 - OK - 1 - Error in headers -*/ - -int LzmaRamGetUncompressedSize( - const unsigned char *inBuffer, - size_t inSize, - size_t *outSize); - - -/* -LzmaRamDecompress: - In: - inBuffer - input data - inSize - input data size - outBuffer - output data - outSize - output size - allocFunc - alloc function (can be malloc) - freeFunc - free function (can be free) - Out: - outSizeProcessed - processed size - Return code: - 0 - OK - 1 - Error in headers / data stream - 2 - Memory allocating error - -Memory requirements depend from properties of LZMA stream. -With default lzma settings it's about 16 KB. -*/ - -int LzmaRamDecompress( - const unsigned char *inBuffer, - size_t inSize, - unsigned char *outBuffer, - size_t outSize, - size_t *outSizeProcessed, - void * (*allocFunc)(size_t size), - void (*freeFunc)(void *)); - -#endif diff --git a/7zip/Compress/LZMA_Alone/StdAfx.cpp b/7zip/Compress/LZMA_Alone/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Compress/LZMA_Alone/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Compress/LZMA_Alone/StdAfx.h b/7zip/Compress/LZMA_Alone/StdAfx.h deleted file mode 100755 index e7fb6986..00000000 --- a/7zip/Compress/LZMA_Alone/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Compress/LZMA_Alone/makefile b/7zip/Compress/LZMA_Alone/makefile deleted file mode 100755 index 135c54b0..00000000 --- a/7zip/Compress/LZMA_Alone/makefile +++ /dev/null @@ -1,114 +0,0 @@ -PROG = lzma.exe -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib user32.lib - -!IFDEF CPU -LIBS = $(LIBS) bufferoverflowU.lib -CFLAGS = $(CFLAGS) -GS- -Zc:forScope -W4 -Wp64 -DUNICODE -D_UNICODE -!ENDIF - -!IFNDEF O -!IFDEF CPU -O=$(CPU) -!ELSE -O=O -!ENDIF -!ENDIF - -!IFDEF MY_STATIC_LINK -!IFNDEF MY_SINGLE_THREAD -CFLAGS = $(CFLAGS) -MT -!ENDIF -!ELSE -CFLAGS = $(CFLAGS) -MD -!ENDIF - - -CFLAGS = $(CFLAGS) -nologo -EHsc -c -Fo$O/ -WX -CFLAGS_O1 = $(CFLAGS) -O1 -CFLAGS_O2 = $(CFLAGS) -O2 - -LFLAGS = $(LFLAGS) -nologo -OPT:NOWIN98 - -PROGPATH = $O\$(PROG) - -COMPL_O1 = $(CPP) $(CFLAGS_O1) $** -COMPL_O2 = $(CPP) $(CFLAGS_O2) $** -COMPL = $(CPP) $(CFLAGS_O1) $** - - -LZMA_OBJS = \ - $O\LzmaAlone.obj \ - $O\LzmaBench.obj \ - $O\LzmaRam.obj \ - -LZMA_OPT_OBJS = \ - $O\LZMADecoder.obj \ - $O\LZMAEncoder.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\CRC.obj \ - $O\CommandLineParser.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\StringToInt.obj \ - $O\Vector.obj - -7ZIP_COMMON_OBJS = \ - $O\InBuffer.obj \ - $O\OutBuffer.obj \ - $O\StreamUtils.obj \ - -LZ_OBJS = \ - $O\LZInWindow.obj \ - $O\LZOutWindow.obj \ - - -OBJS = \ - $(LZMA_OBJS) \ - $(LZMA_OPT_OBJS) \ - $(COMMON_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(LZ_OBJS) \ - $O\LzmaRamDecode.obj \ - $O\LzmaDecode.obj \ - $O\FileStreams.obj \ - $O\FileIO.obj \ - $O\RangeCoderBit.obj \ - $O\BranchX86.obj \ - -all: $(PROGPATH) - -clean: - -del /Q $(PROGPATH) $O\*.exe $O\*.dll $O\*.obj $O\*.lib $O\*.exp $O\*.res $O\*.pch - -$O: - if not exist "$O" mkdir "$O" - -$(PROGPATH): $O $(OBJS) - link $(LFLAGS) -out:$(PROGPATH) $(OBJS) $(LIBS) - - -$(LZMA_OBJS): $(*B).cpp - $(COMPL) -$(LZMA_OPT_OBJS): ../LZMA/$(*B).cpp - $(COMPL_O2) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(LZ_OBJS): ../LZ/$(*B).cpp - $(COMPL) -$O\RangeCoderBit.obj: ../RangeCoder/$(*B).cpp - $(COMPL) -$O\LzmaRamDecode.obj: LzmaRamDecode.c - $(COMPL_O1) -$O\LzmaDecode.obj: ../LZMA_C/LzmaDecode.c - $(COMPL_O2) -$O\BranchX86.obj: ../Branch/BranchX86.c - $(COMPL_O2) -$O\FileStreams.obj: ../../Common/FileStreams.cpp - $(COMPL) -$O\FileIO.obj: ../../../Windows/FileIO.cpp - $(COMPL) diff --git a/7zip/Compress/LZMA_Alone/makefile.gcc b/7zip/Compress/LZMA_Alone/makefile.gcc deleted file mode 100755 index 1e180742..00000000 --- a/7zip/Compress/LZMA_Alone/makefile.gcc +++ /dev/null @@ -1,113 +0,0 @@ -PROG = lzma -CXX = g++ -O2 -Wall -CXX_C = gcc -O2 -Wall -LIB = -lm -RM = rm -f -CFLAGS = -c -I ../../../ - -OBJS = \ - LzmaAlone.o \ - LzmaBench.o \ - LzmaRam.o \ - LzmaRamDecode.o \ - LzmaDecode.o \ - BranchX86.o \ - LZMADecoder.o \ - LZMAEncoder.o \ - LZInWindow.o \ - LZOutWindow.o \ - RangeCoderBit.o \ - InBuffer.o \ - OutBuffer.o \ - FileStreams.o \ - StreamUtils.o \ - Alloc.o \ - C_FileIO.o \ - CommandLineParser.o \ - CRC.o \ - String.o \ - StringConvert.o \ - StringToInt.o \ - Vector.o \ - - -all: $(PROG) - -$(PROG): $(OBJS) - $(CXX) -o $(PROG) $(LDFLAGS) $(OBJS) $(LIB) - -LzmaAlone.o: LzmaAlone.cpp - $(CXX) $(CFLAGS) LzmaAlone.cpp - -LzmaBench.o: LzmaBench.cpp - $(CXX) $(CFLAGS) LzmaBench.cpp - -LzmaRam.o: LzmaRam.cpp - $(CXX) $(CFLAGS) LzmaRam.cpp - -LzmaRamDecode.o: LzmaRamDecode.c - $(CXX_C) $(CFLAGS) LzmaRamDecode.c - -LzmaDecode.o: ../LZMA_C/LzmaDecode.c - $(CXX_C) $(CFLAGS) ../LZMA_C/LzmaDecode.c - -BranchX86.o: ../Branch/BranchX86.c - $(CXX_C) $(CFLAGS) ../Branch/BranchX86.c - -LZMADecoder.o: ../LZMA/LZMADecoder.cpp - $(CXX) $(CFLAGS) ../LZMA/LZMADecoder.cpp - -LZMAEncoder.o: ../LZMA/LZMAEncoder.cpp - $(CXX) $(CFLAGS) ../LZMA/LZMAEncoder.cpp - -LZInWindow.o: ../LZ/LZInWindow.cpp - $(CXX) $(CFLAGS) ../LZ/LZInWindow.cpp - -LZOutWindow.o: ../LZ/LZOutWindow.cpp - $(CXX) $(CFLAGS) ../LZ/LZOutWindow.cpp - -RangeCoderBit.o: ../RangeCoder/RangeCoderBit.cpp - $(CXX) $(CFLAGS) ../RangeCoder/RangeCoderBit.cpp - -InBuffer.o: ../../Common/InBuffer.cpp - $(CXX) $(CFLAGS) ../../Common/InBuffer.cpp - -OutBuffer.o: ../../Common/OutBuffer.cpp - $(CXX) $(CFLAGS) ../../Common/OutBuffer.cpp - -FileStreams.o: ../../Common/FileStreams.cpp - $(CXX) $(CFLAGS) ../../Common/FileStreams.cpp - -StreamUtils.o: ../../Common/StreamUtils.cpp - $(CXX) $(CFLAGS) ../../Common/StreamUtils.cpp - -Alloc.o: ../../../Common/Alloc.cpp - $(CXX) $(CFLAGS) ../../../Common/Alloc.cpp - -C_FileIO.o: ../../../Common/C_FileIO.cpp - $(CXX) $(CFLAGS) ../../../Common/C_FileIO.cpp - -CommandLineParser.o: ../../../Common/CommandLineParser.cpp - $(CXX) $(CFLAGS) ../../../Common/CommandLineParser.cpp - -CRC.o: ../../../Common/CRC.cpp - $(CXX) $(CFLAGS) ../../../Common/CRC.cpp - -MyWindows.o: ../../../Common/MyWindows.cpp - $(CXX) $(CFLAGS) ../../../Common/MyWindows.cpp - -String.o: ../../../Common/String.cpp - $(CXX) $(CFLAGS) ../../../Common/String.cpp - -StringConvert.o: ../../../Common/StringConvert.cpp - $(CXX) $(CFLAGS) ../../../Common/StringConvert.cpp - -StringToInt.o: ../../../Common/StringToInt.cpp - $(CXX) $(CFLAGS) ../../../Common/StringToInt.cpp - -Vector.o: ../../../Common/Vector.cpp - $(CXX) $(CFLAGS) ../../../Common/Vector.cpp - -clean: - -$(RM) $(PROG) $(OBJS) - diff --git a/7zip/Compress/LZMA_C/LzmaDecode.c b/7zip/Compress/LZMA_C/LzmaDecode.c deleted file mode 100755 index cb834537..00000000 --- a/7zip/Compress/LZMA_C/LzmaDecode.c +++ /dev/null @@ -1,584 +0,0 @@ -/* - LzmaDecode.c - LZMA Decoder (optimized for Speed version) - - LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01) - http://www.7-zip.org/ - - LZMA SDK is licensed under two licenses: - 1) GNU Lesser General Public License (GNU LGPL) - 2) Common Public License (CPL) - It means that you can select one of these two licenses and - follow rules of that license. - - SPECIAL EXCEPTION: - Igor Pavlov, as the author of this Code, expressly permits you to - statically or dynamically link your Code (or bind by name) to the - interfaces of this file without subjecting your linked Code to the - terms of the CPL or GNU LGPL. Any modifications or additions - to this file, however, are subject to the LGPL or CPL terms. -*/ - -#include "LzmaDecode.h" - -#define kNumTopBits 24 -#define kTopValue ((UInt32)1 << kNumTopBits) - -#define kNumBitModelTotalBits 11 -#define kBitModelTotal (1 << kNumBitModelTotalBits) -#define kNumMoveBits 5 - -#define RC_READ_BYTE (*Buffer++) - -#define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \ - { int i; for(i = 0; i < 5; i++) { RC_TEST; Code = (Code << 8) | RC_READ_BYTE; }} - -#ifdef _LZMA_IN_CB - -#define RC_TEST { if (Buffer == BufferLim) \ - { SizeT size; int result = InCallback->Read(InCallback, &Buffer, &size); if (result != LZMA_RESULT_OK) return result; \ - BufferLim = Buffer + size; if (size == 0) return LZMA_RESULT_DATA_ERROR; }} - -#define RC_INIT Buffer = BufferLim = 0; RC_INIT2 - -#else - -#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; } - -#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2 - -#endif - -#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; } - -#define IfBit0(p) RC_NORMALIZE; bound = (Range >> kNumBitModelTotalBits) * *(p); if (Code < bound) -#define UpdateBit0(p) Range = bound; *(p) += (kBitModelTotal - *(p)) >> kNumMoveBits; -#define UpdateBit1(p) Range -= bound; Code -= bound; *(p) -= (*(p)) >> kNumMoveBits; - -#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \ - { UpdateBit0(p); mi <<= 1; A0; } else \ - { UpdateBit1(p); mi = (mi + mi) + 1; A1; } - -#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;) - -#define RangeDecoderBitTreeDecode(probs, numLevels, res) \ - { int i = numLevels; res = 1; \ - do { CProb *p = probs + res; RC_GET_BIT(p, res) } while(--i != 0); \ - res -= (1 << numLevels); } - - -#define kNumPosBitsMax 4 -#define kNumPosStatesMax (1 << kNumPosBitsMax) - -#define kLenNumLowBits 3 -#define kLenNumLowSymbols (1 << kLenNumLowBits) -#define kLenNumMidBits 3 -#define kLenNumMidSymbols (1 << kLenNumMidBits) -#define kLenNumHighBits 8 -#define kLenNumHighSymbols (1 << kLenNumHighBits) - -#define LenChoice 0 -#define LenChoice2 (LenChoice + 1) -#define LenLow (LenChoice2 + 1) -#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) -#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) -#define kNumLenProbs (LenHigh + kLenNumHighSymbols) - - -#define kNumStates 12 -#define kNumLitStates 7 - -#define kStartPosModelIndex 4 -#define kEndPosModelIndex 14 -#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) - -#define kNumPosSlotBits 6 -#define kNumLenToPosStates 4 - -#define kNumAlignBits 4 -#define kAlignTableSize (1 << kNumAlignBits) - -#define kMatchMinLen 2 - -#define IsMatch 0 -#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) -#define IsRepG0 (IsRep + kNumStates) -#define IsRepG1 (IsRepG0 + kNumStates) -#define IsRepG2 (IsRepG1 + kNumStates) -#define IsRep0Long (IsRepG2 + kNumStates) -#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) -#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) -#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) -#define LenCoder (Align + kAlignTableSize) -#define RepLenCoder (LenCoder + kNumLenProbs) -#define Literal (RepLenCoder + kNumLenProbs) - -#if Literal != LZMA_BASE_SIZE -StopCompilingDueBUG -#endif - -int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size) -{ - unsigned char prop0; - if (size < LZMA_PROPERTIES_SIZE) - return LZMA_RESULT_DATA_ERROR; - prop0 = propsData[0]; - if (prop0 >= (9 * 5 * 5)) - return LZMA_RESULT_DATA_ERROR; - { - for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5)); - for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9); - propsRes->lc = prop0; - /* - unsigned char remainder = (unsigned char)(prop0 / 9); - propsRes->lc = prop0 % 9; - propsRes->pb = remainder / 5; - propsRes->lp = remainder % 5; - */ - } - - #ifdef _LZMA_OUT_READ - { - int i; - propsRes->DictionarySize = 0; - for (i = 0; i < 4; i++) - propsRes->DictionarySize += (UInt32)(propsData[1 + i]) << (i * 8); - if (propsRes->DictionarySize == 0) - propsRes->DictionarySize = 1; - } - #endif - return LZMA_RESULT_OK; -} - -#define kLzmaStreamWasFinishedId (-1) - -int LzmaDecode(CLzmaDecoderState *vs, - #ifdef _LZMA_IN_CB - ILzmaInCallback *InCallback, - #else - const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, - #endif - unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed) -{ - CProb *p = vs->Probs; - SizeT nowPos = 0; - Byte previousByte = 0; - UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1; - UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1; - int lc = vs->Properties.lc; - - #ifdef _LZMA_OUT_READ - - UInt32 Range = vs->Range; - UInt32 Code = vs->Code; - #ifdef _LZMA_IN_CB - const Byte *Buffer = vs->Buffer; - const Byte *BufferLim = vs->BufferLim; - #else - const Byte *Buffer = inStream; - const Byte *BufferLim = inStream + inSize; - #endif - int state = vs->State; - UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3]; - int len = vs->RemainLen; - UInt32 globalPos = vs->GlobalPos; - UInt32 distanceLimit = vs->DistanceLimit; - - Byte *dictionary = vs->Dictionary; - UInt32 dictionarySize = vs->Properties.DictionarySize; - UInt32 dictionaryPos = vs->DictionaryPos; - - Byte tempDictionary[4]; - - #ifndef _LZMA_IN_CB - *inSizeProcessed = 0; - #endif - *outSizeProcessed = 0; - if (len == kLzmaStreamWasFinishedId) - return LZMA_RESULT_OK; - - if (dictionarySize == 0) - { - dictionary = tempDictionary; - dictionarySize = 1; - tempDictionary[0] = vs->TempDictionary[0]; - } - - if (len == kLzmaNeedInitId) - { - { - UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); - UInt32 i; - for (i = 0; i < numProbs; i++) - p[i] = kBitModelTotal >> 1; - rep0 = rep1 = rep2 = rep3 = 1; - state = 0; - globalPos = 0; - distanceLimit = 0; - dictionaryPos = 0; - dictionary[dictionarySize - 1] = 0; - #ifdef _LZMA_IN_CB - RC_INIT; - #else - RC_INIT(inStream, inSize); - #endif - } - len = 0; - } - while(len != 0 && nowPos < outSize) - { - UInt32 pos = dictionaryPos - rep0; - if (pos >= dictionarySize) - pos += dictionarySize; - outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos]; - if (++dictionaryPos == dictionarySize) - dictionaryPos = 0; - len--; - } - if (dictionaryPos == 0) - previousByte = dictionary[dictionarySize - 1]; - else - previousByte = dictionary[dictionaryPos - 1]; - - #else /* if !_LZMA_OUT_READ */ - - int state = 0; - UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1; - int len = 0; - const Byte *Buffer; - const Byte *BufferLim; - UInt32 Range; - UInt32 Code; - - #ifndef _LZMA_IN_CB - *inSizeProcessed = 0; - #endif - *outSizeProcessed = 0; - - { - UInt32 i; - UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); - for (i = 0; i < numProbs; i++) - p[i] = kBitModelTotal >> 1; - } - - #ifdef _LZMA_IN_CB - RC_INIT; - #else - RC_INIT(inStream, inSize); - #endif - - #endif /* _LZMA_OUT_READ */ - - while(nowPos < outSize) - { - CProb *prob; - UInt32 bound; - int posState = (int)( - (nowPos - #ifdef _LZMA_OUT_READ - + globalPos - #endif - ) - & posStateMask); - - prob = p + IsMatch + (state << kNumPosBitsMax) + posState; - IfBit0(prob) - { - int symbol = 1; - UpdateBit0(prob) - prob = p + Literal + (LZMA_LIT_SIZE * - ((( - (nowPos - #ifdef _LZMA_OUT_READ - + globalPos - #endif - ) - & literalPosMask) << lc) + (previousByte >> (8 - lc)))); - - if (state >= kNumLitStates) - { - int matchByte; - #ifdef _LZMA_OUT_READ - UInt32 pos = dictionaryPos - rep0; - if (pos >= dictionarySize) - pos += dictionarySize; - matchByte = dictionary[pos]; - #else - matchByte = outStream[nowPos - rep0]; - #endif - do - { - int bit; - CProb *probLit; - matchByte <<= 1; - bit = (matchByte & 0x100); - probLit = prob + 0x100 + bit + symbol; - RC_GET_BIT2(probLit, symbol, if (bit != 0) break, if (bit == 0) break) - } - while (symbol < 0x100); - } - while (symbol < 0x100) - { - CProb *probLit = prob + symbol; - RC_GET_BIT(probLit, symbol) - } - previousByte = (Byte)symbol; - - outStream[nowPos++] = previousByte; - #ifdef _LZMA_OUT_READ - if (distanceLimit < dictionarySize) - distanceLimit++; - - dictionary[dictionaryPos] = previousByte; - if (++dictionaryPos == dictionarySize) - dictionaryPos = 0; - #endif - if (state < 4) state = 0; - else if (state < 10) state -= 3; - else state -= 6; - } - else - { - UpdateBit1(prob); - prob = p + IsRep + state; - IfBit0(prob) - { - UpdateBit0(prob); - rep3 = rep2; - rep2 = rep1; - rep1 = rep0; - state = state < kNumLitStates ? 0 : 3; - prob = p + LenCoder; - } - else - { - UpdateBit1(prob); - prob = p + IsRepG0 + state; - IfBit0(prob) - { - UpdateBit0(prob); - prob = p + IsRep0Long + (state << kNumPosBitsMax) + posState; - IfBit0(prob) - { - #ifdef _LZMA_OUT_READ - UInt32 pos; - #endif - UpdateBit0(prob); - - #ifdef _LZMA_OUT_READ - if (distanceLimit == 0) - #else - if (nowPos == 0) - #endif - return LZMA_RESULT_DATA_ERROR; - - state = state < kNumLitStates ? 9 : 11; - #ifdef _LZMA_OUT_READ - pos = dictionaryPos - rep0; - if (pos >= dictionarySize) - pos += dictionarySize; - previousByte = dictionary[pos]; - dictionary[dictionaryPos] = previousByte; - if (++dictionaryPos == dictionarySize) - dictionaryPos = 0; - #else - previousByte = outStream[nowPos - rep0]; - #endif - outStream[nowPos++] = previousByte; - #ifdef _LZMA_OUT_READ - if (distanceLimit < dictionarySize) - distanceLimit++; - #endif - - continue; - } - else - { - UpdateBit1(prob); - } - } - else - { - UInt32 distance; - UpdateBit1(prob); - prob = p + IsRepG1 + state; - IfBit0(prob) - { - UpdateBit0(prob); - distance = rep1; - } - else - { - UpdateBit1(prob); - prob = p + IsRepG2 + state; - IfBit0(prob) - { - UpdateBit0(prob); - distance = rep2; - } - else - { - UpdateBit1(prob); - distance = rep3; - rep3 = rep2; - } - rep2 = rep1; - } - rep1 = rep0; - rep0 = distance; - } - state = state < kNumLitStates ? 8 : 11; - prob = p + RepLenCoder; - } - { - int numBits, offset; - CProb *probLen = prob + LenChoice; - IfBit0(probLen) - { - UpdateBit0(probLen); - probLen = prob + LenLow + (posState << kLenNumLowBits); - offset = 0; - numBits = kLenNumLowBits; - } - else - { - UpdateBit1(probLen); - probLen = prob + LenChoice2; - IfBit0(probLen) - { - UpdateBit0(probLen); - probLen = prob + LenMid + (posState << kLenNumMidBits); - offset = kLenNumLowSymbols; - numBits = kLenNumMidBits; - } - else - { - UpdateBit1(probLen); - probLen = prob + LenHigh; - offset = kLenNumLowSymbols + kLenNumMidSymbols; - numBits = kLenNumHighBits; - } - } - RangeDecoderBitTreeDecode(probLen, numBits, len); - len += offset; - } - - if (state < 4) - { - int posSlot; - state += kNumLitStates; - prob = p + PosSlot + - ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << - kNumPosSlotBits); - RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot); - if (posSlot >= kStartPosModelIndex) - { - int numDirectBits = ((posSlot >> 1) - 1); - rep0 = (2 | ((UInt32)posSlot & 1)); - if (posSlot < kEndPosModelIndex) - { - rep0 <<= numDirectBits; - prob = p + SpecPos + rep0 - posSlot - 1; - } - else - { - numDirectBits -= kNumAlignBits; - do - { - RC_NORMALIZE - Range >>= 1; - rep0 <<= 1; - if (Code >= Range) - { - Code -= Range; - rep0 |= 1; - } - } - while (--numDirectBits != 0); - prob = p + Align; - rep0 <<= kNumAlignBits; - numDirectBits = kNumAlignBits; - } - { - int i = 1; - int mi = 1; - do - { - CProb *prob3 = prob + mi; - RC_GET_BIT2(prob3, mi, ; , rep0 |= i); - i <<= 1; - } - while(--numDirectBits != 0); - } - } - else - rep0 = posSlot; - if (++rep0 == (UInt32)(0)) - { - /* it's for stream version */ - len = kLzmaStreamWasFinishedId; - break; - } - } - - len += kMatchMinLen; - #ifdef _LZMA_OUT_READ - if (rep0 > distanceLimit) - #else - if (rep0 > nowPos) - #endif - return LZMA_RESULT_DATA_ERROR; - - #ifdef _LZMA_OUT_READ - if (dictionarySize - distanceLimit > (UInt32)len) - distanceLimit += len; - else - distanceLimit = dictionarySize; - #endif - - do - { - #ifdef _LZMA_OUT_READ - UInt32 pos = dictionaryPos - rep0; - if (pos >= dictionarySize) - pos += dictionarySize; - previousByte = dictionary[pos]; - dictionary[dictionaryPos] = previousByte; - if (++dictionaryPos == dictionarySize) - dictionaryPos = 0; - #else - previousByte = outStream[nowPos - rep0]; - #endif - len--; - outStream[nowPos++] = previousByte; - } - while(len != 0 && nowPos < outSize); - } - } - RC_NORMALIZE; - - #ifdef _LZMA_OUT_READ - vs->Range = Range; - vs->Code = Code; - vs->DictionaryPos = dictionaryPos; - vs->GlobalPos = globalPos + (UInt32)nowPos; - vs->DistanceLimit = distanceLimit; - vs->Reps[0] = rep0; - vs->Reps[1] = rep1; - vs->Reps[2] = rep2; - vs->Reps[3] = rep3; - vs->State = state; - vs->RemainLen = len; - vs->TempDictionary[0] = tempDictionary[0]; - #endif - - #ifdef _LZMA_IN_CB - vs->Buffer = Buffer; - vs->BufferLim = BufferLim; - #else - *inSizeProcessed = (SizeT)(Buffer - inStream); - #endif - *outSizeProcessed = nowPos; - return LZMA_RESULT_OK; -} diff --git a/7zip/Compress/LZMA_C/LzmaDecode.h b/7zip/Compress/LZMA_C/LzmaDecode.h deleted file mode 100755 index 2870eeb9..00000000 --- a/7zip/Compress/LZMA_C/LzmaDecode.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - LzmaDecode.h - LZMA Decoder interface - - LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01) - http://www.7-zip.org/ - - LZMA SDK is licensed under two licenses: - 1) GNU Lesser General Public License (GNU LGPL) - 2) Common Public License (CPL) - It means that you can select one of these two licenses and - follow rules of that license. - - SPECIAL EXCEPTION: - Igor Pavlov, as the author of this code, expressly permits you to - statically or dynamically link your code (or bind by name) to the - interfaces of this file without subjecting your linked code to the - terms of the CPL or GNU LGPL. Any modifications or additions - to this file, however, are subject to the LGPL or CPL terms. -*/ - -#ifndef __LZMADECODE_H -#define __LZMADECODE_H - -#include "LzmaTypes.h" - -/* #define _LZMA_IN_CB */ -/* Use callback for input data */ - -/* #define _LZMA_OUT_READ */ -/* Use read function for output data */ - -/* #define _LZMA_PROB32 */ -/* It can increase speed on some 32-bit CPUs, - but memory usage will be doubled in that case */ - -/* #define _LZMA_LOC_OPT */ -/* Enable local speed optimizations inside code */ - -#ifdef _LZMA_PROB32 -#define CProb UInt32 -#else -#define CProb UInt16 -#endif - -#define LZMA_RESULT_OK 0 -#define LZMA_RESULT_DATA_ERROR 1 - -#ifdef _LZMA_IN_CB -typedef struct _ILzmaInCallback -{ - int (*Read)(void *object, const unsigned char **buffer, SizeT *bufferSize); -} ILzmaInCallback; -#endif - -#define LZMA_BASE_SIZE 1846 -#define LZMA_LIT_SIZE 768 - -#define LZMA_PROPERTIES_SIZE 5 - -typedef struct _CLzmaProperties -{ - int lc; - int lp; - int pb; - #ifdef _LZMA_OUT_READ - UInt32 DictionarySize; - #endif -}CLzmaProperties; - -int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size); - -#define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((Properties)->lc + (Properties)->lp))) - -#define kLzmaNeedInitId (-2) - -typedef struct _CLzmaDecoderState -{ - CLzmaProperties Properties; - CProb *Probs; - - #ifdef _LZMA_IN_CB - const unsigned char *Buffer; - const unsigned char *BufferLim; - #endif - - #ifdef _LZMA_OUT_READ - unsigned char *Dictionary; - UInt32 Range; - UInt32 Code; - UInt32 DictionaryPos; - UInt32 GlobalPos; - UInt32 DistanceLimit; - UInt32 Reps[4]; - int State; - int RemainLen; - unsigned char TempDictionary[4]; - #endif -} CLzmaDecoderState; - -#ifdef _LZMA_OUT_READ -#define LzmaDecoderInit(vs) { (vs)->RemainLen = kLzmaNeedInitId; } -#endif - -int LzmaDecode(CLzmaDecoderState *vs, - #ifdef _LZMA_IN_CB - ILzmaInCallback *inCallback, - #else - const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, - #endif - unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed); - -#endif diff --git a/7zip/Compress/LZMA_C/LzmaDecodeSize.c b/7zip/Compress/LZMA_C/LzmaDecodeSize.c deleted file mode 100755 index a3a5eb9d..00000000 --- a/7zip/Compress/LZMA_C/LzmaDecodeSize.c +++ /dev/null @@ -1,712 +0,0 @@ -/* - LzmaDecodeSize.c - LZMA Decoder (optimized for Size version) - - LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01) - http://www.7-zip.org/ - - LZMA SDK is licensed under two licenses: - 1) GNU Lesser General Public License (GNU LGPL) - 2) Common Public License (CPL) - It means that you can select one of these two licenses and - follow rules of that license. - - SPECIAL EXCEPTION: - Igor Pavlov, as the author of this code, expressly permits you to - statically or dynamically link your code (or bind by name) to the - interfaces of this file without subjecting your linked code to the - terms of the CPL or GNU LGPL. Any modifications or additions - to this file, however, are subject to the LGPL or CPL terms. -*/ - -#include "LzmaDecode.h" - -#define kNumTopBits 24 -#define kTopValue ((UInt32)1 << kNumTopBits) - -#define kNumBitModelTotalBits 11 -#define kBitModelTotal (1 << kNumBitModelTotalBits) -#define kNumMoveBits 5 - -typedef struct _CRangeDecoder -{ - const Byte *Buffer; - const Byte *BufferLim; - UInt32 Range; - UInt32 Code; - #ifdef _LZMA_IN_CB - ILzmaInCallback *InCallback; - int Result; - #endif - int ExtraBytes; -} CRangeDecoder; - -Byte RangeDecoderReadByte(CRangeDecoder *rd) -{ - if (rd->Buffer == rd->BufferLim) - { - #ifdef _LZMA_IN_CB - SizeT size; - rd->Result = rd->InCallback->Read(rd->InCallback, &rd->Buffer, &size); - rd->BufferLim = rd->Buffer + size; - if (size == 0) - #endif - { - rd->ExtraBytes = 1; - return 0xFF; - } - } - return (*rd->Buffer++); -} - -/* #define ReadByte (*rd->Buffer++) */ -#define ReadByte (RangeDecoderReadByte(rd)) - -void RangeDecoderInit(CRangeDecoder *rd - #ifndef _LZMA_IN_CB - , const Byte *stream, SizeT bufferSize - #endif - ) -{ - int i; - #ifdef _LZMA_IN_CB - rd->Buffer = rd->BufferLim = 0; - #else - rd->Buffer = stream; - rd->BufferLim = stream + bufferSize; - #endif - rd->ExtraBytes = 0; - rd->Code = 0; - rd->Range = (0xFFFFFFFF); - for(i = 0; i < 5; i++) - rd->Code = (rd->Code << 8) | ReadByte; -} - -#define RC_INIT_VAR UInt32 range = rd->Range; UInt32 code = rd->Code; -#define RC_FLUSH_VAR rd->Range = range; rd->Code = code; -#define RC_NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | ReadByte; } - -UInt32 RangeDecoderDecodeDirectBits(CRangeDecoder *rd, int numTotalBits) -{ - RC_INIT_VAR - UInt32 result = 0; - int i; - for (i = numTotalBits; i != 0; i--) - { - /* UInt32 t; */ - range >>= 1; - - result <<= 1; - if (code >= range) - { - code -= range; - result |= 1; - } - /* - t = (code - range) >> 31; - t &= 1; - code -= range & (t - 1); - result = (result + result) | (1 - t); - */ - RC_NORMALIZE - } - RC_FLUSH_VAR - return result; -} - -int RangeDecoderBitDecode(CProb *prob, CRangeDecoder *rd) -{ - UInt32 bound = (rd->Range >> kNumBitModelTotalBits) * *prob; - if (rd->Code < bound) - { - rd->Range = bound; - *prob += (kBitModelTotal - *prob) >> kNumMoveBits; - if (rd->Range < kTopValue) - { - rd->Code = (rd->Code << 8) | ReadByte; - rd->Range <<= 8; - } - return 0; - } - else - { - rd->Range -= bound; - rd->Code -= bound; - *prob -= (*prob) >> kNumMoveBits; - if (rd->Range < kTopValue) - { - rd->Code = (rd->Code << 8) | ReadByte; - rd->Range <<= 8; - } - return 1; - } -} - -#define RC_GET_BIT2(prob, mi, A0, A1) \ - UInt32 bound = (range >> kNumBitModelTotalBits) * *prob; \ - if (code < bound) \ - { A0; range = bound; *prob += (kBitModelTotal - *prob) >> kNumMoveBits; mi <<= 1; } \ - else \ - { A1; range -= bound; code -= bound; *prob -= (*prob) >> kNumMoveBits; mi = (mi + mi) + 1; } \ - RC_NORMALIZE - -#define RC_GET_BIT(prob, mi) RC_GET_BIT2(prob, mi, ; , ;) - -int RangeDecoderBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd) -{ - int mi = 1; - int i; - #ifdef _LZMA_LOC_OPT - RC_INIT_VAR - #endif - for(i = numLevels; i != 0; i--) - { - #ifdef _LZMA_LOC_OPT - CProb *prob = probs + mi; - RC_GET_BIT(prob, mi) - #else - mi = (mi + mi) + RangeDecoderBitDecode(probs + mi, rd); - #endif - } - #ifdef _LZMA_LOC_OPT - RC_FLUSH_VAR - #endif - return mi - (1 << numLevels); -} - -int RangeDecoderReverseBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd) -{ - int mi = 1; - int i; - int symbol = 0; - #ifdef _LZMA_LOC_OPT - RC_INIT_VAR - #endif - for(i = 0; i < numLevels; i++) - { - #ifdef _LZMA_LOC_OPT - CProb *prob = probs + mi; - RC_GET_BIT2(prob, mi, ; , symbol |= (1 << i)) - #else - int bit = RangeDecoderBitDecode(probs + mi, rd); - mi = mi + mi + bit; - symbol |= (bit << i); - #endif - } - #ifdef _LZMA_LOC_OPT - RC_FLUSH_VAR - #endif - return symbol; -} - -Byte LzmaLiteralDecode(CProb *probs, CRangeDecoder *rd) -{ - int symbol = 1; - #ifdef _LZMA_LOC_OPT - RC_INIT_VAR - #endif - do - { - #ifdef _LZMA_LOC_OPT - CProb *prob = probs + symbol; - RC_GET_BIT(prob, symbol) - #else - symbol = (symbol + symbol) | RangeDecoderBitDecode(probs + symbol, rd); - #endif - } - while (symbol < 0x100); - #ifdef _LZMA_LOC_OPT - RC_FLUSH_VAR - #endif - return symbol; -} - -Byte LzmaLiteralDecodeMatch(CProb *probs, CRangeDecoder *rd, Byte matchByte) -{ - int symbol = 1; - #ifdef _LZMA_LOC_OPT - RC_INIT_VAR - #endif - do - { - int bit; - int matchBit = (matchByte >> 7) & 1; - matchByte <<= 1; - #ifdef _LZMA_LOC_OPT - { - CProb *prob = probs + 0x100 + (matchBit << 8) + symbol; - RC_GET_BIT2(prob, symbol, bit = 0, bit = 1) - } - #else - bit = RangeDecoderBitDecode(probs + 0x100 + (matchBit << 8) + symbol, rd); - symbol = (symbol << 1) | bit; - #endif - if (matchBit != bit) - { - while (symbol < 0x100) - { - #ifdef _LZMA_LOC_OPT - CProb *prob = probs + symbol; - RC_GET_BIT(prob, symbol) - #else - symbol = (symbol + symbol) | RangeDecoderBitDecode(probs + symbol, rd); - #endif - } - break; - } - } - while (symbol < 0x100); - #ifdef _LZMA_LOC_OPT - RC_FLUSH_VAR - #endif - return symbol; -} - -#define kNumPosBitsMax 4 -#define kNumPosStatesMax (1 << kNumPosBitsMax) - -#define kLenNumLowBits 3 -#define kLenNumLowSymbols (1 << kLenNumLowBits) -#define kLenNumMidBits 3 -#define kLenNumMidSymbols (1 << kLenNumMidBits) -#define kLenNumHighBits 8 -#define kLenNumHighSymbols (1 << kLenNumHighBits) - -#define LenChoice 0 -#define LenChoice2 (LenChoice + 1) -#define LenLow (LenChoice2 + 1) -#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) -#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) -#define kNumLenProbs (LenHigh + kLenNumHighSymbols) - -int LzmaLenDecode(CProb *p, CRangeDecoder *rd, int posState) -{ - if(RangeDecoderBitDecode(p + LenChoice, rd) == 0) - return RangeDecoderBitTreeDecode(p + LenLow + - (posState << kLenNumLowBits), kLenNumLowBits, rd); - if(RangeDecoderBitDecode(p + LenChoice2, rd) == 0) - return kLenNumLowSymbols + RangeDecoderBitTreeDecode(p + LenMid + - (posState << kLenNumMidBits), kLenNumMidBits, rd); - return kLenNumLowSymbols + kLenNumMidSymbols + - RangeDecoderBitTreeDecode(p + LenHigh, kLenNumHighBits, rd); -} - -#define kNumStates 12 -#define kNumLitStates 7 - -#define kStartPosModelIndex 4 -#define kEndPosModelIndex 14 -#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) - -#define kNumPosSlotBits 6 -#define kNumLenToPosStates 4 - -#define kNumAlignBits 4 -#define kAlignTableSize (1 << kNumAlignBits) - -#define kMatchMinLen 2 - -#define IsMatch 0 -#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) -#define IsRepG0 (IsRep + kNumStates) -#define IsRepG1 (IsRepG0 + kNumStates) -#define IsRepG2 (IsRepG1 + kNumStates) -#define IsRep0Long (IsRepG2 + kNumStates) -#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) -#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) -#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) -#define LenCoder (Align + kAlignTableSize) -#define RepLenCoder (LenCoder + kNumLenProbs) -#define Literal (RepLenCoder + kNumLenProbs) - -#if Literal != LZMA_BASE_SIZE -StopCompilingDueBUG -#endif - -int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size) -{ - unsigned char prop0; - if (size < LZMA_PROPERTIES_SIZE) - return LZMA_RESULT_DATA_ERROR; - prop0 = propsData[0]; - if (prop0 >= (9 * 5 * 5)) - return LZMA_RESULT_DATA_ERROR; - { - for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5)); - for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9); - propsRes->lc = prop0; - /* - unsigned char remainder = (unsigned char)(prop0 / 9); - propsRes->lc = prop0 % 9; - propsRes->pb = remainder / 5; - propsRes->lp = remainder % 5; - */ - } - - #ifdef _LZMA_OUT_READ - { - int i; - propsRes->DictionarySize = 0; - for (i = 0; i < 4; i++) - propsRes->DictionarySize += (UInt32)(propsData[1 + i]) << (i * 8); - if (propsRes->DictionarySize == 0) - propsRes->DictionarySize = 1; - } - #endif - return LZMA_RESULT_OK; -} - -#define kLzmaStreamWasFinishedId (-1) - -int LzmaDecode(CLzmaDecoderState *vs, - #ifdef _LZMA_IN_CB - ILzmaInCallback *InCallback, - #else - const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, - #endif - unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed) -{ - CProb *p = vs->Probs; - SizeT nowPos = 0; - Byte previousByte = 0; - UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1; - UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1; - int lc = vs->Properties.lc; - CRangeDecoder rd; - - #ifdef _LZMA_OUT_READ - - int state = vs->State; - UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3]; - int len = vs->RemainLen; - UInt32 globalPos = vs->GlobalPos; - UInt32 distanceLimit = vs->DistanceLimit; - - Byte *dictionary = vs->Dictionary; - UInt32 dictionarySize = vs->Properties.DictionarySize; - UInt32 dictionaryPos = vs->DictionaryPos; - - Byte tempDictionary[4]; - - rd.Range = vs->Range; - rd.Code = vs->Code; - #ifdef _LZMA_IN_CB - rd.InCallback = InCallback; - rd.Buffer = vs->Buffer; - rd.BufferLim = vs->BufferLim; - #else - rd.Buffer = inStream; - rd.BufferLim = inStream + inSize; - #endif - - #ifndef _LZMA_IN_CB - *inSizeProcessed = 0; - #endif - *outSizeProcessed = 0; - if (len == kLzmaStreamWasFinishedId) - return LZMA_RESULT_OK; - - if (dictionarySize == 0) - { - dictionary = tempDictionary; - dictionarySize = 1; - tempDictionary[0] = vs->TempDictionary[0]; - } - - if (len == kLzmaNeedInitId) - { - { - UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); - UInt32 i; - for (i = 0; i < numProbs; i++) - p[i] = kBitModelTotal >> 1; - rep0 = rep1 = rep2 = rep3 = 1; - state = 0; - globalPos = 0; - distanceLimit = 0; - dictionaryPos = 0; - dictionary[dictionarySize - 1] = 0; - RangeDecoderInit(&rd - #ifndef _LZMA_IN_CB - , inStream, inSize - #endif - ); - #ifdef _LZMA_IN_CB - if (rd.Result != LZMA_RESULT_OK) - return rd.Result; - #endif - if (rd.ExtraBytes != 0) - return LZMA_RESULT_DATA_ERROR; - } - len = 0; - } - while(len != 0 && nowPos < outSize) - { - UInt32 pos = dictionaryPos - rep0; - if (pos >= dictionarySize) - pos += dictionarySize; - outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos]; - if (++dictionaryPos == dictionarySize) - dictionaryPos = 0; - len--; - } - if (dictionaryPos == 0) - previousByte = dictionary[dictionarySize - 1]; - else - previousByte = dictionary[dictionaryPos - 1]; - - #ifdef _LZMA_IN_CB - rd.Result = LZMA_RESULT_OK; - #endif - rd.ExtraBytes = 0; - - #else /* if !_LZMA_OUT_READ */ - - int state = 0; - UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1; - int len = 0; - - #ifndef _LZMA_IN_CB - *inSizeProcessed = 0; - #endif - *outSizeProcessed = 0; - - { - UInt32 i; - UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); - for (i = 0; i < numProbs; i++) - p[i] = kBitModelTotal >> 1; - } - - #ifdef _LZMA_IN_CB - rd.InCallback = InCallback; - #endif - RangeDecoderInit(&rd - #ifndef _LZMA_IN_CB - , inStream, inSize - #endif - ); - - #ifdef _LZMA_IN_CB - if (rd.Result != LZMA_RESULT_OK) - return rd.Result; - #endif - if (rd.ExtraBytes != 0) - return LZMA_RESULT_DATA_ERROR; - - #endif /* _LZMA_OUT_READ */ - - - while(nowPos < outSize) - { - int posState = (int)( - (nowPos - #ifdef _LZMA_OUT_READ - + globalPos - #endif - ) - & posStateMask); - #ifdef _LZMA_IN_CB - if (rd.Result != LZMA_RESULT_OK) - return rd.Result; - #endif - if (rd.ExtraBytes != 0) - return LZMA_RESULT_DATA_ERROR; - if (RangeDecoderBitDecode(p + IsMatch + (state << kNumPosBitsMax) + posState, &rd) == 0) - { - CProb *probs = p + Literal + (LZMA_LIT_SIZE * - ((( - (nowPos - #ifdef _LZMA_OUT_READ - + globalPos - #endif - ) - & literalPosMask) << lc) + (previousByte >> (8 - lc)))); - - if (state >= kNumLitStates) - { - Byte matchByte; - #ifdef _LZMA_OUT_READ - UInt32 pos = dictionaryPos - rep0; - if (pos >= dictionarySize) - pos += dictionarySize; - matchByte = dictionary[pos]; - #else - matchByte = outStream[nowPos - rep0]; - #endif - previousByte = LzmaLiteralDecodeMatch(probs, &rd, matchByte); - } - else - previousByte = LzmaLiteralDecode(probs, &rd); - outStream[nowPos++] = previousByte; - #ifdef _LZMA_OUT_READ - if (distanceLimit < dictionarySize) - distanceLimit++; - - dictionary[dictionaryPos] = previousByte; - if (++dictionaryPos == dictionarySize) - dictionaryPos = 0; - #endif - if (state < 4) state = 0; - else if (state < 10) state -= 3; - else state -= 6; - } - else - { - if (RangeDecoderBitDecode(p + IsRep + state, &rd) == 1) - { - if (RangeDecoderBitDecode(p + IsRepG0 + state, &rd) == 0) - { - if (RangeDecoderBitDecode(p + IsRep0Long + (state << kNumPosBitsMax) + posState, &rd) == 0) - { - #ifdef _LZMA_OUT_READ - UInt32 pos; - #endif - - #ifdef _LZMA_OUT_READ - if (distanceLimit == 0) - #else - if (nowPos == 0) - #endif - return LZMA_RESULT_DATA_ERROR; - - state = state < 7 ? 9 : 11; - #ifdef _LZMA_OUT_READ - pos = dictionaryPos - rep0; - if (pos >= dictionarySize) - pos += dictionarySize; - previousByte = dictionary[pos]; - dictionary[dictionaryPos] = previousByte; - if (++dictionaryPos == dictionarySize) - dictionaryPos = 0; - #else - previousByte = outStream[nowPos - rep0]; - #endif - outStream[nowPos++] = previousByte; - - #ifdef _LZMA_OUT_READ - if (distanceLimit < dictionarySize) - distanceLimit++; - #endif - continue; - } - } - else - { - UInt32 distance; - if(RangeDecoderBitDecode(p + IsRepG1 + state, &rd) == 0) - distance = rep1; - else - { - if(RangeDecoderBitDecode(p + IsRepG2 + state, &rd) == 0) - distance = rep2; - else - { - distance = rep3; - rep3 = rep2; - } - rep2 = rep1; - } - rep1 = rep0; - rep0 = distance; - } - len = LzmaLenDecode(p + RepLenCoder, &rd, posState); - state = state < 7 ? 8 : 11; - } - else - { - int posSlot; - rep3 = rep2; - rep2 = rep1; - rep1 = rep0; - state = state < 7 ? 7 : 10; - len = LzmaLenDecode(p + LenCoder, &rd, posState); - posSlot = RangeDecoderBitTreeDecode(p + PosSlot + - ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << - kNumPosSlotBits), kNumPosSlotBits, &rd); - if (posSlot >= kStartPosModelIndex) - { - int numDirectBits = ((posSlot >> 1) - 1); - rep0 = ((2 | ((UInt32)posSlot & 1)) << numDirectBits); - if (posSlot < kEndPosModelIndex) - { - rep0 += RangeDecoderReverseBitTreeDecode( - p + SpecPos + rep0 - posSlot - 1, numDirectBits, &rd); - } - else - { - rep0 += RangeDecoderDecodeDirectBits(&rd, - numDirectBits - kNumAlignBits) << kNumAlignBits; - rep0 += RangeDecoderReverseBitTreeDecode(p + Align, kNumAlignBits, &rd); - } - } - else - rep0 = posSlot; - if (++rep0 == (UInt32)(0)) - { - /* it's for stream version */ - len = kLzmaStreamWasFinishedId; - break; - } - } - - len += kMatchMinLen; - #ifdef _LZMA_OUT_READ - if (rep0 > distanceLimit) - #else - if (rep0 > nowPos) - #endif - return LZMA_RESULT_DATA_ERROR; - - #ifdef _LZMA_OUT_READ - if (dictionarySize - distanceLimit > (UInt32)len) - distanceLimit += len; - else - distanceLimit = dictionarySize; - #endif - - do - { - #ifdef _LZMA_OUT_READ - UInt32 pos = dictionaryPos - rep0; - if (pos >= dictionarySize) - pos += dictionarySize; - previousByte = dictionary[pos]; - dictionary[dictionaryPos] = previousByte; - if (++dictionaryPos == dictionarySize) - dictionaryPos = 0; - #else - previousByte = outStream[nowPos - rep0]; - #endif - len--; - outStream[nowPos++] = previousByte; - } - while(len != 0 && nowPos < outSize); - } - } - - - #ifdef _LZMA_OUT_READ - vs->Range = rd.Range; - vs->Code = rd.Code; - vs->DictionaryPos = dictionaryPos; - vs->GlobalPos = globalPos + (UInt32)nowPos; - vs->DistanceLimit = distanceLimit; - vs->Reps[0] = rep0; - vs->Reps[1] = rep1; - vs->Reps[2] = rep2; - vs->Reps[3] = rep3; - vs->State = state; - vs->RemainLen = len; - vs->TempDictionary[0] = tempDictionary[0]; - #endif - - #ifdef _LZMA_IN_CB - vs->Buffer = rd.Buffer; - vs->BufferLim = rd.BufferLim; - #else - *inSizeProcessed = (SizeT)(rd.Buffer - inStream); - #endif - *outSizeProcessed = nowPos; - return LZMA_RESULT_OK; -} diff --git a/7zip/Compress/LZMA_C/LzmaStateDecode.c b/7zip/Compress/LZMA_C/LzmaStateDecode.c deleted file mode 100755 index e50f88b5..00000000 --- a/7zip/Compress/LZMA_C/LzmaStateDecode.c +++ /dev/null @@ -1,521 +0,0 @@ -/* - LzmaStateDecode.c - LZMA Decoder (State version) - - LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01) - http://www.7-zip.org/ - - LZMA SDK is licensed under two licenses: - 1) GNU Lesser General Public License (GNU LGPL) - 2) Common Public License (CPL) - It means that you can select one of these two licenses and - follow rules of that license. - - SPECIAL EXCEPTION: - Igor Pavlov, as the author of this Code, expressly permits you to - statically or dynamically link your Code (or bind by name) to the - interfaces of this file without subjecting your linked Code to the - terms of the CPL or GNU LGPL. Any modifications or additions - to this file, however, are subject to the LGPL or CPL terms. -*/ - -#include "LzmaStateDecode.h" - -#define kNumTopBits 24 -#define kTopValue ((UInt32)1 << kNumTopBits) - -#define kNumBitModelTotalBits 11 -#define kBitModelTotal (1 << kNumBitModelTotalBits) -#define kNumMoveBits 5 - -#define RC_READ_BYTE (*Buffer++) - -#define RC_INIT Code = 0; Range = 0xFFFFFFFF; \ - { int i; for(i = 0; i < 5; i++) { Code = (Code << 8) | RC_READ_BYTE; }} - -#define RC_NORMALIZE if (Range < kTopValue) { Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; } - -#define IfBit0(p) RC_NORMALIZE; bound = (Range >> kNumBitModelTotalBits) * *(p); if (Code < bound) -#define UpdateBit0(p) Range = bound; *(p) += (kBitModelTotal - *(p)) >> kNumMoveBits; -#define UpdateBit1(p) Range -= bound; Code -= bound; *(p) -= (*(p)) >> kNumMoveBits; - -#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \ - { UpdateBit0(p); mi <<= 1; A0; } else \ - { UpdateBit1(p); mi = (mi + mi) + 1; A1; } - -#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;) - -#define RangeDecoderBitTreeDecode(probs, numLevels, res) \ - { int i = numLevels; res = 1; \ - do { CProb *p = probs + res; RC_GET_BIT(p, res) } while(--i != 0); \ - res -= (1 << numLevels); } - - -#define kNumPosBitsMax 4 -#define kNumPosStatesMax (1 << kNumPosBitsMax) - -#define kLenNumLowBits 3 -#define kLenNumLowSymbols (1 << kLenNumLowBits) -#define kLenNumMidBits 3 -#define kLenNumMidSymbols (1 << kLenNumMidBits) -#define kLenNumHighBits 8 -#define kLenNumHighSymbols (1 << kLenNumHighBits) - -#define LenChoice 0 -#define LenChoice2 (LenChoice + 1) -#define LenLow (LenChoice2 + 1) -#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) -#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) -#define kNumLenProbs (LenHigh + kLenNumHighSymbols) - - -#define kNumStates 12 -#define kNumLitStates 7 - -#define kStartPosModelIndex 4 -#define kEndPosModelIndex 14 -#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) - -#define kNumPosSlotBits 6 -#define kNumLenToPosStates 4 - -#define kNumAlignBits 4 -#define kAlignTableSize (1 << kNumAlignBits) - -#define kMatchMinLen 2 - -#define IsMatch 0 -#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) -#define IsRepG0 (IsRep + kNumStates) -#define IsRepG1 (IsRepG0 + kNumStates) -#define IsRepG2 (IsRepG1 + kNumStates) -#define IsRep0Long (IsRepG2 + kNumStates) -#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) -#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) -#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) -#define LenCoder (Align + kAlignTableSize) -#define RepLenCoder (LenCoder + kNumLenProbs) -#define Literal (RepLenCoder + kNumLenProbs) - -#if Literal != LZMA_BASE_SIZE -StopCompilingDueBUG -#endif - -/* kRequiredInBufferSize = number of required input bytes for worst case: - longest match with longest distance. - kLzmaInBufferSize must be larger than kRequiredInBufferSize - 23 bits = 2 (match select) + 10 (len) + 6 (distance) + 4(align) + 1 (RC_NORMALIZE) -*/ - -#define kRequiredInBufferSize ((23 * (kNumBitModelTotalBits - kNumMoveBits + 1) + 26 + 9) / 8) - -#define kLzmaStreamWasFinishedId (-1) - -int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size) -{ - unsigned char prop0; - if (size < LZMA_PROPERTIES_SIZE) - return LZMA_RESULT_DATA_ERROR; - prop0 = propsData[0]; - if (prop0 >= (9 * 5 * 5)) - return LZMA_RESULT_DATA_ERROR; - { - for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5)); - for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9); - propsRes->lc = prop0; - /* - unsigned char remainder = (unsigned char)(prop0 / 9); - propsRes->lc = prop0 % 9; - propsRes->pb = remainder / 5; - propsRes->lp = remainder % 5; - */ - } - - { - int i; - propsRes->DictionarySize = 0; - for (i = 0; i < 4; i++) - propsRes->DictionarySize += (UInt32)(propsData[1 + i]) << (i * 8); - if (propsRes->DictionarySize == 0) - propsRes->DictionarySize = 1; - return LZMA_RESULT_OK; - } -} - -int LzmaDecode( - CLzmaDecoderState *vs, - const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, - unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed, - int finishDecoding) -{ - UInt32 Range = vs->Range; - UInt32 Code = vs->Code; - - unsigned char *Buffer = vs->Buffer; - int BufferSize = vs->BufferSize; /* don't change it to unsigned int */ - CProb *p = vs->Probs; - - int state = vs->State; - unsigned char previousByte; - UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3]; - SizeT nowPos = 0; - UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1; - UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1; - int lc = vs->Properties.lc; - int len = vs->RemainLen; - UInt32 globalPos = vs->GlobalPos; - UInt32 distanceLimit = vs->DistanceLimit; - - unsigned char *dictionary = vs->Dictionary; - UInt32 dictionarySize = vs->Properties.DictionarySize; - UInt32 dictionaryPos = vs->DictionaryPos; - - unsigned char tempDictionary[4]; - - (*inSizeProcessed) = 0; - (*outSizeProcessed) = 0; - if (len == kLzmaStreamWasFinishedId) - return LZMA_RESULT_OK; - - if (dictionarySize == 0) - { - dictionary = tempDictionary; - dictionarySize = 1; - tempDictionary[0] = vs->TempDictionary[0]; - } - - if (len == kLzmaNeedInitId) - { - while (inSize > 0 && BufferSize < kLzmaInBufferSize) - { - Buffer[BufferSize++] = *inStream++; - (*inSizeProcessed)++; - inSize--; - } - if (BufferSize < 5) - { - vs->BufferSize = BufferSize; - return finishDecoding ? LZMA_RESULT_DATA_ERROR : LZMA_RESULT_OK; - } - { - UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); - UInt32 i; - for (i = 0; i < numProbs; i++) - p[i] = kBitModelTotal >> 1; - rep0 = rep1 = rep2 = rep3 = 1; - state = 0; - globalPos = 0; - distanceLimit = 0; - dictionaryPos = 0; - dictionary[dictionarySize - 1] = 0; - RC_INIT; - } - len = 0; - } - while(len != 0 && nowPos < outSize) - { - UInt32 pos = dictionaryPos - rep0; - if (pos >= dictionarySize) - pos += dictionarySize; - outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos]; - if (++dictionaryPos == dictionarySize) - dictionaryPos = 0; - len--; - } - if (dictionaryPos == 0) - previousByte = dictionary[dictionarySize - 1]; - else - previousByte = dictionary[dictionaryPos - 1]; - - while(1) - { - int bufferPos = (int)(Buffer - vs->Buffer); - if (BufferSize - bufferPos < kRequiredInBufferSize) - { - int i; - BufferSize -= bufferPos; - if (BufferSize < 0) - return LZMA_RESULT_DATA_ERROR; - for (i = 0; i < BufferSize; i++) - vs->Buffer[i] = Buffer[i]; - Buffer = vs->Buffer; - while (inSize > 0 && BufferSize < kLzmaInBufferSize) - { - Buffer[BufferSize++] = *inStream++; - (*inSizeProcessed)++; - inSize--; - } - if (BufferSize < kRequiredInBufferSize && !finishDecoding) - break; - } - if (nowPos >= outSize) - break; - { - CProb *prob; - UInt32 bound; - int posState = (int)((nowPos + globalPos) & posStateMask); - - prob = p + IsMatch + (state << kNumPosBitsMax) + posState; - IfBit0(prob) - { - int symbol = 1; - UpdateBit0(prob) - prob = p + Literal + (LZMA_LIT_SIZE * - ((((nowPos + globalPos)& literalPosMask) << lc) + (previousByte >> (8 - lc)))); - - if (state >= kNumLitStates) - { - int matchByte; - UInt32 pos = dictionaryPos - rep0; - if (pos >= dictionarySize) - pos += dictionarySize; - matchByte = dictionary[pos]; - do - { - int bit; - CProb *probLit; - matchByte <<= 1; - bit = (matchByte & 0x100); - probLit = prob + 0x100 + bit + symbol; - RC_GET_BIT2(probLit, symbol, if (bit != 0) break, if (bit == 0) break) - } - while (symbol < 0x100); - } - while (symbol < 0x100) - { - CProb *probLit = prob + symbol; - RC_GET_BIT(probLit, symbol) - } - previousByte = (unsigned char)symbol; - - outStream[nowPos++] = previousByte; - if (distanceLimit < dictionarySize) - distanceLimit++; - - dictionary[dictionaryPos] = previousByte; - if (++dictionaryPos == dictionarySize) - dictionaryPos = 0; - if (state < 4) state = 0; - else if (state < 10) state -= 3; - else state -= 6; - } - else - { - UpdateBit1(prob); - prob = p + IsRep + state; - IfBit0(prob) - { - UpdateBit0(prob); - rep3 = rep2; - rep2 = rep1; - rep1 = rep0; - state = state < kNumLitStates ? 0 : 3; - prob = p + LenCoder; - } - else - { - UpdateBit1(prob); - prob = p + IsRepG0 + state; - IfBit0(prob) - { - UpdateBit0(prob); - prob = p + IsRep0Long + (state << kNumPosBitsMax) + posState; - IfBit0(prob) - { - UInt32 pos; - UpdateBit0(prob); - if (distanceLimit == 0) - return LZMA_RESULT_DATA_ERROR; - if (distanceLimit < dictionarySize) - distanceLimit++; - state = state < kNumLitStates ? 9 : 11; - pos = dictionaryPos - rep0; - if (pos >= dictionarySize) - pos += dictionarySize; - previousByte = dictionary[pos]; - dictionary[dictionaryPos] = previousByte; - if (++dictionaryPos == dictionarySize) - dictionaryPos = 0; - outStream[nowPos++] = previousByte; - continue; - } - else - { - UpdateBit1(prob); - } - } - else - { - UInt32 distance; - UpdateBit1(prob); - prob = p + IsRepG1 + state; - IfBit0(prob) - { - UpdateBit0(prob); - distance = rep1; - } - else - { - UpdateBit1(prob); - prob = p + IsRepG2 + state; - IfBit0(prob) - { - UpdateBit0(prob); - distance = rep2; - } - else - { - UpdateBit1(prob); - distance = rep3; - rep3 = rep2; - } - rep2 = rep1; - } - rep1 = rep0; - rep0 = distance; - } - state = state < kNumLitStates ? 8 : 11; - prob = p + RepLenCoder; - } - { - int numBits, offset; - CProb *probLen = prob + LenChoice; - IfBit0(probLen) - { - UpdateBit0(probLen); - probLen = prob + LenLow + (posState << kLenNumLowBits); - offset = 0; - numBits = kLenNumLowBits; - } - else - { - UpdateBit1(probLen); - probLen = prob + LenChoice2; - IfBit0(probLen) - { - UpdateBit0(probLen); - probLen = prob + LenMid + (posState << kLenNumMidBits); - offset = kLenNumLowSymbols; - numBits = kLenNumMidBits; - } - else - { - UpdateBit1(probLen); - probLen = prob + LenHigh; - offset = kLenNumLowSymbols + kLenNumMidSymbols; - numBits = kLenNumHighBits; - } - } - RangeDecoderBitTreeDecode(probLen, numBits, len); - len += offset; - } - - if (state < 4) - { - int posSlot; - state += kNumLitStates; - prob = p + PosSlot + - ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << - kNumPosSlotBits); - RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot); - if (posSlot >= kStartPosModelIndex) - { - int numDirectBits = ((posSlot >> 1) - 1); - rep0 = (2 | ((UInt32)posSlot & 1)); - if (posSlot < kEndPosModelIndex) - { - rep0 <<= numDirectBits; - prob = p + SpecPos + rep0 - posSlot - 1; - } - else - { - numDirectBits -= kNumAlignBits; - do - { - RC_NORMALIZE - Range >>= 1; - rep0 <<= 1; - if (Code >= Range) - { - Code -= Range; - rep0 |= 1; - } - } - while (--numDirectBits != 0); - prob = p + Align; - rep0 <<= kNumAlignBits; - numDirectBits = kNumAlignBits; - } - { - int i = 1; - int mi = 1; - do - { - CProb *prob3 = prob + mi; - RC_GET_BIT2(prob3, mi, ; , rep0 |= i); - i <<= 1; - } - while(--numDirectBits != 0); - } - } - else - rep0 = posSlot; - if (++rep0 == (UInt32)(0)) - { - /* it's for stream version */ - len = kLzmaStreamWasFinishedId; - break; - } - } - - len += kMatchMinLen; - if (rep0 > distanceLimit) - return LZMA_RESULT_DATA_ERROR; - if (dictionarySize - distanceLimit > (UInt32)len) - distanceLimit += len; - else - distanceLimit = dictionarySize; - - do - { - UInt32 pos = dictionaryPos - rep0; - if (pos >= dictionarySize) - pos += dictionarySize; - previousByte = dictionary[pos]; - dictionary[dictionaryPos] = previousByte; - if (++dictionaryPos == dictionarySize) - dictionaryPos = 0; - len--; - outStream[nowPos++] = previousByte; - } - while(len != 0 && nowPos < outSize); - } - } - } - RC_NORMALIZE; - - BufferSize -= (int)(Buffer - vs->Buffer); - if (BufferSize < 0) - return LZMA_RESULT_DATA_ERROR; - { - int i; - for (i = 0; i < BufferSize; i++) - vs->Buffer[i] = Buffer[i]; - } - vs->BufferSize = BufferSize; - vs->Range = Range; - vs->Code = Code; - vs->DictionaryPos = dictionaryPos; - vs->GlobalPos = (UInt32)(globalPos + nowPos); - vs->DistanceLimit = distanceLimit; - vs->Reps[0] = rep0; - vs->Reps[1] = rep1; - vs->Reps[2] = rep2; - vs->Reps[3] = rep3; - vs->State = state; - vs->RemainLen = len; - vs->TempDictionary[0] = tempDictionary[0]; - - (*outSizeProcessed) = nowPos; - return LZMA_RESULT_OK; -} diff --git a/7zip/Compress/LZMA_C/LzmaStateDecode.h b/7zip/Compress/LZMA_C/LzmaStateDecode.h deleted file mode 100755 index 26490d61..00000000 --- a/7zip/Compress/LZMA_C/LzmaStateDecode.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - LzmaStateDecode.h - LZMA Decoder interface (State version) - - LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01) - http://www.7-zip.org/ - - LZMA SDK is licensed under two licenses: - 1) GNU Lesser General Public License (GNU LGPL) - 2) Common Public License (CPL) - It means that you can select one of these two licenses and - follow rules of that license. - - SPECIAL EXCEPTION: - Igor Pavlov, as the author of this code, expressly permits you to - statically or dynamically link your code (or bind by name) to the - interfaces of this file without subjecting your linked code to the - terms of the CPL or GNU LGPL. Any modifications or additions - to this file, however, are subject to the LGPL or CPL terms. -*/ - -#ifndef __LZMASTATEDECODE_H -#define __LZMASTATEDECODE_H - -#include "LzmaTypes.h" - -/* #define _LZMA_PROB32 */ -/* It can increase speed on some 32-bit CPUs, - but memory usage will be doubled in that case */ - -#ifdef _LZMA_PROB32 -#define CProb UInt32 -#else -#define CProb UInt16 -#endif - -#define LZMA_RESULT_OK 0 -#define LZMA_RESULT_DATA_ERROR 1 - -#define LZMA_BASE_SIZE 1846 -#define LZMA_LIT_SIZE 768 - -#define LZMA_PROPERTIES_SIZE 5 - -typedef struct _CLzmaProperties -{ - int lc; - int lp; - int pb; - UInt32 DictionarySize; -}CLzmaProperties; - -int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size); - -#define LzmaGetNumProbs(lzmaProps) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((lzmaProps)->lc + (lzmaProps)->lp))) - -#define kLzmaInBufferSize 64 /* don't change it. it must be larger than kRequiredInBufferSize */ - -#define kLzmaNeedInitId (-2) - -typedef struct _CLzmaDecoderState -{ - CLzmaProperties Properties; - CProb *Probs; - unsigned char *Dictionary; - - unsigned char Buffer[kLzmaInBufferSize]; - int BufferSize; - - UInt32 Range; - UInt32 Code; - UInt32 DictionaryPos; - UInt32 GlobalPos; - UInt32 DistanceLimit; - UInt32 Reps[4]; - int State; - int RemainLen; /* -2: decoder needs internal initialization - -1: stream was finished, - 0: ok - > 0: need to write RemainLen bytes as match Reps[0], - */ - unsigned char TempDictionary[4]; /* it's required when DictionarySize = 0 */ -} CLzmaDecoderState; - -#define LzmaDecoderInit(vs) { (vs)->RemainLen = kLzmaNeedInitId; (vs)->BufferSize = 0; } - -/* LzmaDecode: decoding from input stream to output stream. - If finishDecoding != 0, then there are no more bytes in input stream - after inStream[inSize - 1]. */ - -int LzmaDecode(CLzmaDecoderState *vs, - const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, - unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed, - int finishDecoding); - -#endif diff --git a/7zip/Compress/LZMA_C/LzmaStateTest.c b/7zip/Compress/LZMA_C/LzmaStateTest.c deleted file mode 100755 index 5df4e438..00000000 --- a/7zip/Compress/LZMA_C/LzmaStateTest.c +++ /dev/null @@ -1,195 +0,0 @@ -/* -LzmaStateTest.c -Test application for LZMA Decoder (State version) - -This file written and distributed to public domain by Igor Pavlov. -This file is part of LZMA SDK 4.26 (2005-08-02) -*/ - -#include -#include -#include - -#include "LzmaStateDecode.h" - -const char *kCantReadMessage = "Can not read input file"; -const char *kCantWriteMessage = "Can not write output file"; -const char *kCantAllocateMessage = "Can not allocate memory"; - -#define kInBufferSize (1 << 15) -#define kOutBufferSize (1 << 15) - -unsigned char g_InBuffer[kInBufferSize]; -unsigned char g_OutBuffer[kOutBufferSize]; - -size_t MyReadFile(FILE *file, void *data, size_t size) - { return fread(data, 1, size, file); } - -int MyReadFileAndCheck(FILE *file, void *data, size_t size) - { return (MyReadFile(file, data, size) == size); } - -int PrintError(char *buffer, const char *message) -{ - sprintf(buffer + strlen(buffer), "\nError: "); - sprintf(buffer + strlen(buffer), message); - return 1; -} - -int main3(FILE *inFile, FILE *outFile, char *rs) -{ - /* We use two 32-bit integers to construct 64-bit integer for file size. - You can remove outSizeHigh, if you don't need >= 4GB supporting, - or you can use UInt64 outSize, if your compiler supports 64-bit integers*/ - UInt32 outSize = 0; - UInt32 outSizeHigh = 0; - - int waitEOS = 1; - /* waitEOS = 1, if there is no uncompressed size in headers, - so decoder will wait EOS (End of Stream Marker) in compressed stream */ - - int i; - int res = 0; - CLzmaDecoderState state; /* it's about 140 bytes structure, if int is 32-bit */ - unsigned char properties[LZMA_PROPERTIES_SIZE]; - SizeT inAvail = 0; - unsigned char *inBuffer = 0; - - if (sizeof(UInt32) < 4) - return PrintError(rs, "LZMA decoder needs correct UInt32"); - - /* Read LZMA properties for compressed stream */ - - if (!MyReadFileAndCheck(inFile, properties, sizeof(properties))) - return PrintError(rs, kCantReadMessage); - - /* Read uncompressed size */ - - for (i = 0; i < 8; i++) - { - unsigned char b; - if (!MyReadFileAndCheck(inFile, &b, 1)) - return PrintError(rs, kCantReadMessage); - if (b != 0xFF) - waitEOS = 0; - if (i < 4) - outSize += (UInt32)(b) << (i * 8); - else - outSizeHigh += (UInt32)(b) << ((i - 4) * 8); - } - - /* Decode LZMA properties and allocate memory */ - - if (LzmaDecodeProperties(&state.Properties, properties, LZMA_PROPERTIES_SIZE) != LZMA_RESULT_OK) - return PrintError(rs, "Incorrect stream properties"); - state.Probs = (CProb *)malloc(LzmaGetNumProbs(&state.Properties) * sizeof(CProb)); - if (state.Probs == 0) - return PrintError(rs, kCantAllocateMessage); - - if (state.Properties.DictionarySize == 0) - state.Dictionary = 0; - else - { - state.Dictionary = (unsigned char *)malloc(state.Properties.DictionarySize); - if (state.Dictionary == 0) - { - free(state.Probs); - return PrintError(rs, kCantAllocateMessage); - } - } - - /* Decompress */ - - LzmaDecoderInit(&state); - - do - { - SizeT inProcessed, outProcessed; - int finishDecoding; - UInt32 outAvail = kOutBufferSize; - if (!waitEOS && outSizeHigh == 0 && outAvail > outSize) - outAvail = outSize; - if (inAvail == 0) - { - inAvail = (SizeT)MyReadFile(inFile, g_InBuffer, kInBufferSize); - inBuffer = g_InBuffer; - } - finishDecoding = (inAvail == 0); - res = LzmaDecode(&state, - inBuffer, inAvail, &inProcessed, - g_OutBuffer, outAvail, &outProcessed, - finishDecoding); - if (res != 0) - { - sprintf(rs + strlen(rs), "\nDecoding error = %d\n", res); - res = 1; - break; - } - inAvail -= inProcessed; - inBuffer += inProcessed; - - if (outFile != 0) - if (fwrite(g_OutBuffer, 1, outProcessed, outFile) != outProcessed) - { - PrintError(rs, kCantWriteMessage); - res = 1; - break; - } - - if (outSize < outProcessed) - outSizeHigh--; - outSize -= (UInt32)outProcessed; - outSize &= 0xFFFFFFFF; - - if (outProcessed == 0 && finishDecoding) - { - if (!waitEOS && (outSize != 0 || outSizeHigh != 0)) - res = 1; - break; - } - } - while ((outSize != 0 && outSizeHigh == 0) || outSizeHigh != 0 || waitEOS); - - free(state.Dictionary); - free(state.Probs); - return res; -} - -int main2(int numArgs, const char *args[], char *rs) -{ - FILE *inFile = 0; - FILE *outFile = 0; - int res; - - sprintf(rs + strlen(rs), "\nLZMA Decoder 4.26 Copyright (c) 1999-2005 Igor Pavlov 2005-08-02\n"); - if (numArgs < 2 || numArgs > 3) - { - sprintf(rs + strlen(rs), "\nUsage: lzmadec file.lzma [outFile]\n"); - return 1; - } - - inFile = fopen(args[1], "rb"); - if (inFile == 0) - return PrintError(rs, "Can not open input file"); - - if (numArgs > 2) - { - outFile = fopen(args[2], "wb+"); - if (outFile == 0) - return PrintError(rs, "Can not open output file"); - } - - res = main3(inFile, outFile, rs); - - if (outFile != 0) - fclose(outFile); - fclose(inFile); - return res; -} - -int main(int numArgs, const char *args[]) -{ - char rs[800] = { 0 }; - int res = main2(numArgs, args, rs); - printf(rs); - return res; -} diff --git a/7zip/Compress/LZMA_C/LzmaTest.c b/7zip/Compress/LZMA_C/LzmaTest.c deleted file mode 100755 index f95a753b..00000000 --- a/7zip/Compress/LZMA_C/LzmaTest.c +++ /dev/null @@ -1,342 +0,0 @@ -/* -LzmaTest.c -Test application for LZMA Decoder - -This file written and distributed to public domain by Igor Pavlov. -This file is part of LZMA SDK 4.26 (2005-08-05) -*/ - -#include -#include -#include - -#include "LzmaDecode.h" - -const char *kCantReadMessage = "Can not read input file"; -const char *kCantWriteMessage = "Can not write output file"; -const char *kCantAllocateMessage = "Can not allocate memory"; - -size_t MyReadFile(FILE *file, void *data, size_t size) -{ - if (size == 0) - return 0; - return fread(data, 1, size, file); -} - -int MyReadFileAndCheck(FILE *file, void *data, size_t size) - { return (MyReadFile(file, data, size) == size);} - -size_t MyWriteFile(FILE *file, const void *data, size_t size) -{ - if (size == 0) - return 0; - return fwrite(data, 1, size, file); -} - -int MyWriteFileAndCheck(FILE *file, const void *data, size_t size) - { return (MyWriteFile(file, data, size) == size); } - -#ifdef _LZMA_IN_CB -#define kInBufferSize (1 << 15) -typedef struct _CBuffer -{ - ILzmaInCallback InCallback; - FILE *File; - unsigned char Buffer[kInBufferSize]; -} CBuffer; - -int LzmaReadCompressed(void *object, const unsigned char **buffer, SizeT *size) -{ - CBuffer *b = (CBuffer *)object; - *buffer = b->Buffer; - *size = (SizeT)MyReadFile(b->File, b->Buffer, kInBufferSize); - return LZMA_RESULT_OK; -} -CBuffer g_InBuffer; - -#endif - -#ifdef _LZMA_OUT_READ -#define kOutBufferSize (1 << 15) -unsigned char g_OutBuffer[kOutBufferSize]; -#endif - -int PrintError(char *buffer, const char *message) -{ - sprintf(buffer + strlen(buffer), "\nError: "); - sprintf(buffer + strlen(buffer), message); - return 1; -} - -int main3(FILE *inFile, FILE *outFile, char *rs) -{ - /* We use two 32-bit integers to construct 64-bit integer for file size. - You can remove outSizeHigh, if you don't need >= 4GB supporting, - or you can use UInt64 outSize, if your compiler supports 64-bit integers*/ - UInt32 outSize = 0; - UInt32 outSizeHigh = 0; - #ifndef _LZMA_OUT_READ - SizeT outSizeFull; - unsigned char *outStream; - #endif - - int waitEOS = 1; - /* waitEOS = 1, if there is no uncompressed size in headers, - so decoder will wait EOS (End of Stream Marker) in compressed stream */ - - #ifndef _LZMA_IN_CB - SizeT compressedSize; - unsigned char *inStream; - #endif - - CLzmaDecoderState state; /* it's about 24-80 bytes structure, if int is 32-bit */ - unsigned char properties[LZMA_PROPERTIES_SIZE]; - - int res; - - #ifdef _LZMA_IN_CB - g_InBuffer.File = inFile; - #endif - - if (sizeof(UInt32) < 4) - return PrintError(rs, "LZMA decoder needs correct UInt32"); - - #ifndef _LZMA_IN_CB - { - long length; - fseek(inFile, 0, SEEK_END); - length = ftell(inFile); - fseek(inFile, 0, SEEK_SET); - if ((long)(SizeT)length != length) - return PrintError(rs, "Too big compressed stream"); - compressedSize = (SizeT)(length - (LZMA_PROPERTIES_SIZE + 8)); - } - #endif - - /* Read LZMA properties for compressed stream */ - - if (!MyReadFileAndCheck(inFile, properties, sizeof(properties))) - return PrintError(rs, kCantReadMessage); - - /* Read uncompressed size */ - - { - int i; - for (i = 0; i < 8; i++) - { - unsigned char b; - if (!MyReadFileAndCheck(inFile, &b, 1)) - return PrintError(rs, kCantReadMessage); - if (b != 0xFF) - waitEOS = 0; - if (i < 4) - outSize += (UInt32)(b) << (i * 8); - else - outSizeHigh += (UInt32)(b) << ((i - 4) * 8); - } - - #ifndef _LZMA_OUT_READ - if (waitEOS) - return PrintError(rs, "Stream with EOS marker is not supported"); - outSizeFull = (SizeT)outSize; - if (sizeof(SizeT) >= 8) - outSizeFull |= (((SizeT)outSizeHigh << 16) << 16); - else if (outSizeHigh != 0 || (UInt32)(SizeT)outSize != outSize) - return PrintError(rs, "Too big uncompressed stream"); - #endif - } - - /* Decode LZMA properties and allocate memory */ - - if (LzmaDecodeProperties(&state.Properties, properties, LZMA_PROPERTIES_SIZE) != LZMA_RESULT_OK) - return PrintError(rs, "Incorrect stream properties"); - state.Probs = (CProb *)malloc(LzmaGetNumProbs(&state.Properties) * sizeof(CProb)); - - #ifdef _LZMA_OUT_READ - if (state.Properties.DictionarySize == 0) - state.Dictionary = 0; - else - state.Dictionary = (unsigned char *)malloc(state.Properties.DictionarySize); - #else - if (outSizeFull == 0) - outStream = 0; - else - outStream = (unsigned char *)malloc(outSizeFull); - #endif - - #ifndef _LZMA_IN_CB - if (compressedSize == 0) - inStream = 0; - else - inStream = (unsigned char *)malloc(compressedSize); - #endif - - if (state.Probs == 0 - #ifdef _LZMA_OUT_READ - || (state.Dictionary == 0 && state.Properties.DictionarySize != 0) - #else - || (outStream == 0 && outSizeFull != 0) - #endif - #ifndef _LZMA_IN_CB - || (inStream == 0 && compressedSize != 0) - #endif - ) - { - free(state.Probs); - #ifdef _LZMA_OUT_READ - free(state.Dictionary); - #else - free(outStream); - #endif - #ifndef _LZMA_IN_CB - free(inStream); - #endif - return PrintError(rs, kCantAllocateMessage); - } - - /* Decompress */ - - #ifdef _LZMA_IN_CB - g_InBuffer.InCallback.Read = LzmaReadCompressed; - #else - if (!MyReadFileAndCheck(inFile, inStream, compressedSize)) - return PrintError(rs, kCantReadMessage); - #endif - - #ifdef _LZMA_OUT_READ - { - #ifndef _LZMA_IN_CB - SizeT inAvail = compressedSize; - const unsigned char *inBuffer = inStream; - #endif - LzmaDecoderInit(&state); - do - { - #ifndef _LZMA_IN_CB - SizeT inProcessed; - #endif - SizeT outProcessed; - SizeT outAvail = kOutBufferSize; - if (!waitEOS && outSizeHigh == 0 && outAvail > outSize) - outAvail = (SizeT)outSize; - res = LzmaDecode(&state, - #ifdef _LZMA_IN_CB - &g_InBuffer.InCallback, - #else - inBuffer, inAvail, &inProcessed, - #endif - g_OutBuffer, outAvail, &outProcessed); - if (res != 0) - { - sprintf(rs + strlen(rs), "\nDecoding error = %d\n", res); - res = 1; - break; - } - #ifndef _LZMA_IN_CB - inAvail -= inProcessed; - inBuffer += inProcessed; - #endif - - if (outFile != 0) - if (!MyWriteFileAndCheck(outFile, g_OutBuffer, (size_t)outProcessed)) - { - PrintError(rs, kCantWriteMessage); - res = 1; - break; - } - - if (outSize < outProcessed) - outSizeHigh--; - outSize -= (UInt32)outProcessed; - outSize &= 0xFFFFFFFF; - - if (outProcessed == 0) - { - if (!waitEOS && (outSize != 0 || outSizeHigh != 0)) - res = 1; - break; - } - } - while ((outSize != 0 && outSizeHigh == 0) || outSizeHigh != 0 || waitEOS); - } - - #else - { - #ifndef _LZMA_IN_CB - SizeT inProcessed; - #endif - SizeT outProcessed; - res = LzmaDecode(&state, - #ifdef _LZMA_IN_CB - &g_InBuffer.InCallback, - #else - inStream, compressedSize, &inProcessed, - #endif - outStream, outSizeFull, &outProcessed); - if (res != 0) - { - sprintf(rs + strlen(rs), "\nDecoding error = %d\n", res); - res = 1; - } - else if (outFile != 0) - { - if (!MyWriteFileAndCheck(outFile, outStream, (size_t)outProcessed)) - { - PrintError(rs, kCantWriteMessage); - res = 1; - } - } - } - #endif - - free(state.Probs); - #ifdef _LZMA_OUT_READ - free(state.Dictionary); - #else - free(outStream); - #endif - #ifndef _LZMA_IN_CB - free(inStream); - #endif - return res; -} - -int main2(int numArgs, const char *args[], char *rs) -{ - FILE *inFile = 0; - FILE *outFile = 0; - int res; - - sprintf(rs + strlen(rs), "\nLZMA Decoder 4.26 Copyright (c) 1999-2005 Igor Pavlov 2005-08-05\n"); - if (numArgs < 2 || numArgs > 3) - { - sprintf(rs + strlen(rs), "\nUsage: lzmadec file.lzma [outFile]\n"); - return 1; - } - - inFile = fopen(args[1], "rb"); - if (inFile == 0) - return PrintError(rs, "Can not open input file"); - - if (numArgs > 2) - { - outFile = fopen(args[2], "wb+"); - if (outFile == 0) - return PrintError(rs, "Can not open output file"); - } - - res = main3(inFile, outFile, rs); - - if (outFile != 0) - fclose(outFile); - fclose(inFile); - return res; -} - -int main(int numArgs, const char *args[]) -{ - char rs[800] = { 0 }; - int res = main2(numArgs, args, rs); - printf(rs); - return res; -} diff --git a/7zip/Compress/LZMA_C/LzmaTypes.h b/7zip/Compress/LZMA_C/LzmaTypes.h deleted file mode 100755 index 288c5e45..00000000 --- a/7zip/Compress/LZMA_C/LzmaTypes.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -LzmaTypes.h - -Types for LZMA Decoder - -This file written and distributed to public domain by Igor Pavlov. -This file is part of LZMA SDK 4.40 (2006-05-01) -*/ - -#ifndef __LZMATYPES_H -#define __LZMATYPES_H - -#ifndef _7ZIP_BYTE_DEFINED -#define _7ZIP_BYTE_DEFINED -typedef unsigned char Byte; -#endif - -#ifndef _7ZIP_UINT16_DEFINED -#define _7ZIP_UINT16_DEFINED -typedef unsigned short UInt16; -#endif - -#ifndef _7ZIP_UINT32_DEFINED -#define _7ZIP_UINT32_DEFINED -#ifdef _LZMA_UINT32_IS_ULONG -typedef unsigned long UInt32; -#else -typedef unsigned int UInt32; -#endif -#endif - -/* #define _LZMA_SYSTEM_SIZE_T */ -/* Use system's size_t. You can use it to enable 64-bit sizes supporting */ - -#ifndef _7ZIP_SIZET_DEFINED -#define _7ZIP_SIZET_DEFINED -#ifdef _LZMA_SYSTEM_SIZE_T -#include -typedef size_t SizeT; -#else -typedef UInt32 SizeT; -#endif -#endif - -#endif diff --git a/7zip/Compress/Lzh/LzhDecoder.cpp b/7zip/Compress/Lzh/LzhDecoder.cpp deleted file mode 100755 index 846a4163..00000000 --- a/7zip/Compress/Lzh/LzhDecoder.cpp +++ /dev/null @@ -1,216 +0,0 @@ -// LzhDecoder.cpp - -#include "StdAfx.h" - -#include "LzhDecoder.h" - -#include "Windows/Defs.h" - -namespace NCompress{ -namespace NLzh { -namespace NDecoder { - -static const UInt32 kHistorySize = (1 << 16); - -static const int kBlockSizeBits = 16; -static const int kNumCBits = 9; -static const int kNumLevelBits = 5; // smallest integer such that (1 << kNumLevelBits) > kNumLevelSymbols/ - -UInt32 CCoder::ReadBits(int numBits) { return m_InBitStream.ReadBits(numBits); } - -HRESULT CCoder::ReadLevelTable() -{ - int n = ReadBits(kNumLevelBits); - if (n == 0) - { - m_LevelHuffman.Symbol = ReadBits(kNumLevelBits); - if (m_LevelHuffman.Symbol >= kNumLevelSymbols) - return S_FALSE; - } - else - { - if (n > kNumLevelSymbols) - return S_FALSE; - m_LevelHuffman.Symbol = -1; - Byte lens[kNumLevelSymbols]; - int i = 0; - while (i < n) - { - int c = m_InBitStream.ReadBits(3); - if (c == 7) - while (ReadBits(1)) - if (c++ > kMaxHuffmanLen) - return S_FALSE; - lens[i++] = (Byte)c; - if (i == kNumSpecLevelSymbols) - { - c = ReadBits(2); - while (--c >= 0) - lens[i++] = 0; - } - } - while (i < kNumLevelSymbols) - lens[i++] = 0; - m_LevelHuffman.SetCodeLengths(lens); - } - return S_OK; -} - -HRESULT CCoder::ReadPTable(int numBits) -{ - int n = ReadBits(numBits); - if (n == 0) - { - m_PHuffmanDecoder.Symbol = ReadBits(numBits); - if (m_PHuffmanDecoder.Symbol >= kNumDistanceSymbols) - return S_FALSE; - } - else - { - if (n > kNumDistanceSymbols) - return S_FALSE; - m_PHuffmanDecoder.Symbol = -1; - Byte lens[kNumDistanceSymbols]; - int i = 0; - while (i < n) - { - int c = m_InBitStream.ReadBits(3); - if (c == 7) - while (ReadBits(1)) - { - if (c > kMaxHuffmanLen) - return S_FALSE; - c++; - } - lens[i++] = (Byte)c; - } - while (i < kNumDistanceSymbols) - lens[i++] = 0; - m_PHuffmanDecoder.SetCodeLengths(lens); - } - return S_OK; -} - -HRESULT CCoder::ReadCTable() -{ - int n = ReadBits(kNumCBits); - if (n == 0) - { - m_CHuffmanDecoder.Symbol = ReadBits(kNumCBits); - if (m_CHuffmanDecoder.Symbol >= kNumCSymbols) - return S_FALSE; - } - else - { - if (n > kNumCSymbols) - return S_FALSE; - m_CHuffmanDecoder.Symbol = -1; - Byte lens[kNumCSymbols]; - int i = 0; - while (i < n) - { - int c = m_LevelHuffman.Decode(&m_InBitStream); - if (c < kNumSpecLevelSymbols) - { - if (c == 0) - c = 1; - else if (c == 1) - c = ReadBits(4) + 3; - else - c = ReadBits(kNumCBits) + 20; - while (--c >= 0) - { - if (i > kNumCSymbols) - return S_FALSE; - lens[i++] = 0; - } - } - else - lens[i++] = (Byte)(c - 2); - } - while (i < kNumCSymbols) - lens[i++] = 0; - m_CHuffmanDecoder.SetCodeLengths(lens); - } - return S_OK; -} - -STDMETHODIMP CCoder::CodeReal(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 * /* inSize */, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - if (outSize == NULL) - return E_INVALIDARG; - - if (!m_OutWindowStream.Create(kHistorySize)) - return E_OUTOFMEMORY; - if (!m_InBitStream.Create(1 << 20)) - return E_OUTOFMEMORY; - - UInt64 pos = 0; - m_OutWindowStream.SetStream(outStream); - m_OutWindowStream.Init(false); - m_InBitStream.SetStream(inStream); - m_InBitStream.Init(); - - CCoderReleaser coderReleaser(this); - - int pbit; - if (m_NumDictBits <= 13) - pbit = 4; - else - pbit = 5; - - UInt32 blockSize = 0; - - while(pos < *outSize) - { - // for (i = 0; i < dictSize; i++) dtext[i] = 0x20; - - if (blockSize == 0) - { - if (progress != NULL) - { - UInt64 packSize = m_InBitStream.GetProcessedSize(); - RINOK(progress->SetRatioInfo(&packSize, &pos)); - } - blockSize = ReadBits(kBlockSizeBits); - ReadLevelTable(); - ReadCTable(); - RINOK(ReadPTable(pbit)); - } - blockSize--; - UInt32 c = m_CHuffmanDecoder.Decode(&m_InBitStream); - if (c < 256) - { - m_OutWindowStream.PutByte((Byte)c); - pos++; - } - else - { - // offset = (interface->method == LARC_METHOD_NUM) ? 0x100 - 2 : 0x100 - 3; - UInt32 len = c - 256 + kMinMatch; - UInt32 distance = m_PHuffmanDecoder.Decode(&m_InBitStream); - if (distance != 0) - distance = (1 << (distance - 1)) + ReadBits(distance - 1); - pos += len; - if (distance >= pos) - throw 1; - m_OutWindowStream.CopyBlock(distance, len); - } - } - coderReleaser.NeedFlush = false; - return m_OutWindowStream.Flush(); -} - -STDMETHODIMP CCoder::Code(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - try { return CodeReal(inStream, outStream, inSize, outSize, progress);} - catch(const CInBufferException &e) { return e.ErrorCode; } - catch(const CLZOutWindowException &e) { return e.ErrorCode; } - catch(...) { return S_FALSE; } -} - -}}} diff --git a/7zip/Compress/Lzh/LzhDecoder.h b/7zip/Compress/Lzh/LzhDecoder.h deleted file mode 100755 index 79f71b88..00000000 --- a/7zip/Compress/Lzh/LzhDecoder.h +++ /dev/null @@ -1,103 +0,0 @@ -// LzhDecoder.h - -#ifndef __COMPRESS_LZH_DECODER_H -#define __COMPRESS_LZH_DECODER_H - -#include "../../../Common/MyCom.h" -#include "../../ICoder.h" -#include "../../Common/MSBFDecoder.h" -#include "../../Common/InBuffer.h" -#include "../Huffman/HuffmanDecoder.h" -#include "../LZ/LZOutWindow.h" - -namespace NCompress { -namespace NLzh { -namespace NDecoder { - -const int kMaxHuffmanLen = 16; // Check it - -const int kNumSpecLevelSymbols = 3; -const int kNumLevelSymbols = kNumSpecLevelSymbols + kMaxHuffmanLen; - -const int kDictBitsMax = 16; -const int kNumDistanceSymbols = kDictBitsMax + 1; - -const int kMaxMatch = 256; -const int kMinMatch = 3; -const int kNumCSymbols = 256 + kMaxMatch + 2 - kMinMatch; - -template -class CHuffmanDecoder:public NCompress::NHuffman::CDecoder -{ -public: - int Symbol; - template - UInt32 Decode(TBitDecoder *bitStream) - { - if (Symbol >= 0) - return (UInt32)Symbol; - return DecodeSymbol(bitStream); - } -}; - -class CCoder : - public ICompressCoder, - public CMyUnknownImp -{ - CLZOutWindow m_OutWindowStream; - NStream::NMSBF::CDecoder m_InBitStream; - - int m_NumDictBits; - - CHuffmanDecoder m_LevelHuffman; - CHuffmanDecoder m_PHuffmanDecoder; - CHuffmanDecoder m_CHuffmanDecoder; - - void ReleaseStreams() - { - m_OutWindowStream.ReleaseStream(); - m_InBitStream.ReleaseStream(); - } - - class CCoderReleaser - { - CCoder *m_Coder; - public: - bool NeedFlush; - CCoderReleaser(CCoder *coder): m_Coder(coder), NeedFlush(true) {} - ~CCoderReleaser() - { - if (NeedFlush) - m_Coder->m_OutWindowStream.Flush(); - m_Coder->ReleaseStreams(); - } - }; - friend class CCoderReleaser; - - void MakeTable(int nchar, Byte *bitlen, int tablebits, - UInt32 *table, int tablesize); - - UInt32 ReadBits(int numBits); - HRESULT ReadLevelTable(); - HRESULT ReadPTable(int numBits); - HRESULT ReadCTable(); - -public: - - MY_UNKNOWN_IMP - - STDMETHOD(CodeReal)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - STDMETHOD(Code)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - void SetDictionary(int numDictBits) { m_NumDictBits = numDictBits; } - CCoder(): m_NumDictBits(0) {} -}; - -}}} - -#endif diff --git a/7zip/Compress/Lzx/Lzx.h b/7zip/Compress/Lzx/Lzx.h deleted file mode 100755 index 386a17c3..00000000 --- a/7zip/Compress/Lzx/Lzx.h +++ /dev/null @@ -1,61 +0,0 @@ -// Lzx.h - -#ifndef __COMPRESS_LZX_H -#define __COMPRESS_LZX_H - -namespace NCompress { -namespace NLzx { - -const int kNumHuffmanBits = 16; -const UInt32 kNumRepDistances = 3; - -const UInt32 kNumLenSlots = 8; -const UInt32 kMatchMinLen = 2; -const UInt32 kNumLenSymbols = 249; -const UInt32 kMatchMaxLen = kMatchMinLen + (kNumLenSlots - 1) + kNumLenSymbols - 1; - -const int kNumAlignBits = 3; -const UInt32 kAlignTableSize = 1 << kNumAlignBits; - -const UInt32 kNumPosSlots = 50; -const UInt32 kNumPosLenSlots = kNumPosSlots * kNumLenSlots; - -const UInt32 kMainTableSize = 256 + kNumPosLenSlots; -const UInt32 kLevelTableSize = 20; -const UInt32 kMaxTableSize = kMainTableSize; - -const int kNumBlockTypeBits = 3; -const int kBlockTypeVerbatim = 1; -const int kBlockTypeAligned = 2; -const int kBlockTypeUncompressed = 3; - -const int kUncompressedBlockSizeNumBits = 24; - -const int kNumBitsForPreTreeLevel = 4; - -const int kLevelSymbolZeros = 17; -const int kLevelSymbolZerosBig = 18; -const int kLevelSymbolSame = 19; - -const int kLevelSymbolZerosStartValue = 4; -const int kLevelSymbolZerosNumBits = 4; - -const int kLevelSymbolZerosBigStartValue = kLevelSymbolZerosStartValue + - (1 << kLevelSymbolZerosNumBits); -const int kLevelSymbolZerosBigNumBits = 5; - -const int kLevelSymbolSameNumBits = 1; -const int kLevelSymbolSameStartValue = 4; - -const int kNumBitsForAlignLevel = 3; - -const int kNumDictionaryBitsMin = 15; -const int kNumDictionaryBitsMax = 21; -const UInt32 kDictionarySizeMax = (1 << kNumDictionaryBitsMax); - -const int kNumLinearPosSlotBits = 17; -const UInt32 kNumPowerPosSlots = 0x26; - -}} - -#endif diff --git a/7zip/Compress/Lzx/Lzx86Converter.cpp b/7zip/Compress/Lzx/Lzx86Converter.cpp deleted file mode 100755 index 1265dba0..00000000 --- a/7zip/Compress/Lzx/Lzx86Converter.cpp +++ /dev/null @@ -1,90 +0,0 @@ -// Lzx86Converter.cpp - -#include "StdAfx.h" - -#include "Common/Defs.h" - -#include "Lzx86Converter.h" - -namespace NCompress { -namespace NLzx { - -static const int kResidue = 6 + 4; - -void Cx86ConvertOutStream::MakeTranslation() -{ - if (m_Pos <= kResidue) - return; - UInt32 numBytes = m_Pos - kResidue; - Byte *buffer = m_Buffer; - for (UInt32 i = 0; i < numBytes;) - { - if (buffer[i++] == 0xE8) - { - Int32 absValue = 0; - int j; - for(j = 0; j < 4; j++) - absValue += (UInt32)buffer[i + j] << (j * 8); - Int32 pos = (Int32)(m_ProcessedSize + i - 1); - if (absValue >= -pos && absValue < (Int32)m_TranslationSize) - { - UInt32 offset = (absValue >= 0) ? - absValue - pos : - absValue + m_TranslationSize; - for(j = 0; j < 4; j++) - { - buffer[i + j] = (Byte)(offset & 0xFF); - offset >>= 8; - } - } - i += 4; - } - } -} - -STDMETHODIMP Cx86ConvertOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize) -{ - if (processedSize != NULL) - *processedSize = 0; - if (!m_TranslationMode) - return m_Stream->Write(data, size, processedSize); - UInt32 realProcessedSize = 0; - while (realProcessedSize < size) - { - UInt32 writeSize = MyMin(size - realProcessedSize, kUncompressedBlockSize - m_Pos); - memmove(m_Buffer + m_Pos, (const Byte *)data + realProcessedSize, writeSize); - m_Pos += writeSize; - realProcessedSize += writeSize; - if (m_Pos == kUncompressedBlockSize) - { - RINOK(Flush()); - } - } - if (processedSize != NULL) - *processedSize = realProcessedSize; - return S_OK; -} - -HRESULT Cx86ConvertOutStream::Flush() -{ - if (m_Pos == 0) - return S_OK; - if (m_TranslationMode) - MakeTranslation(); - UInt32 pos = 0; - do - { - UInt32 processed; - RINOK(m_Stream->Write(m_Buffer + pos, m_Pos - pos, &processed)); - if (processed == 0) - return E_FAIL; - pos += processed; - } - while(pos < m_Pos); - m_ProcessedSize += m_Pos; - m_Pos = 0; - m_TranslationMode = (m_TranslationMode && (m_ProcessedSize < (1 << 30))); - return S_OK; -} - -}} diff --git a/7zip/Compress/Lzx/Lzx86Converter.h b/7zip/Compress/Lzx/Lzx86Converter.h deleted file mode 100755 index b507a612..00000000 --- a/7zip/Compress/Lzx/Lzx86Converter.h +++ /dev/null @@ -1,45 +0,0 @@ -// Lzx/x86Converter.h - -#ifndef __LZX_X86CONVERTER_H -#define __LZX_X86CONVERTER_H - -#include "Common/MyCom.h" -#include "../../IStream.h" - -namespace NCompress { -namespace NLzx { - -const int kUncompressedBlockSize = 1 << 15; - -class Cx86ConvertOutStream: - public ISequentialOutStream, - public CMyUnknownImp -{ - CMyComPtr m_Stream; - UInt32 m_ProcessedSize; - UInt32 m_Pos; - UInt32 m_TranslationSize; - bool m_TranslationMode; - Byte m_Buffer[kUncompressedBlockSize]; - - void MakeTranslation(); -public: - void SetStream(ISequentialOutStream *outStream) { m_Stream = outStream; } - void ReleaseStream() { m_Stream.Release(); } - void Init(bool translationMode, UInt32 translationSize) - { - m_TranslationMode = translationMode; - m_TranslationSize = translationSize; - m_ProcessedSize = 0; - m_Pos = 0; - } - HRESULT Flush(); - - MY_UNKNOWN_IMP - - STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); -}; - -}} - -#endif diff --git a/7zip/Compress/Lzx/LzxDecoder.cpp b/7zip/Compress/Lzx/LzxDecoder.cpp deleted file mode 100755 index e854af32..00000000 --- a/7zip/Compress/Lzx/LzxDecoder.cpp +++ /dev/null @@ -1,382 +0,0 @@ -// LzxDecoder.cpp - -#include "StdAfx.h" - -#include "LzxDecoder.h" - -#include "Common/Defs.h" -#include "Common/Alloc.h" -#include "Windows/Defs.h" - -namespace NCompress { -namespace NLzx { - -const int kLenIdNeedInit = -2; - -CDecoder::CDecoder(): - _keepHistory(false), - m_AlignPos(0) -{ - m_x86ConvertOutStreamSpec = new Cx86ConvertOutStream; - m_x86ConvertOutStream = m_x86ConvertOutStreamSpec; -} - -void CDecoder::ReleaseStreams() -{ - m_OutWindowStream.ReleaseStream(); - m_InBitStream.ReleaseStream(); - m_x86ConvertOutStreamSpec->ReleaseStream(); -} - -STDMETHODIMP CDecoder::Flush() -{ - RINOK(m_OutWindowStream.Flush()); - return m_x86ConvertOutStreamSpec->Flush(); -} - -UInt32 CDecoder::ReadBits(UInt32 numBits) { return m_InBitStream.ReadBits(numBits); } - -#define RIF(x) { if (!(x)) return false; } - -bool CDecoder::ReadTable(Byte *lastLevels, Byte *newLevels, UInt32 numSymbols) -{ - Byte levelLevels[kLevelTableSize]; - UInt32 i; - for (i = 0; i < kLevelTableSize; i++) - levelLevels[i] = (Byte)ReadBits(kNumBitsForPreTreeLevel); - RIF(m_LevelDecoder.SetCodeLengths(levelLevels)); - int num = 0; - Byte symbol = 0; - for (i = 0; i < numSymbols;) - { - if (num != 0) - { - lastLevels[i] = newLevels[i] = symbol; - i++; - num--; - continue; - } - UInt32 number = m_LevelDecoder.DecodeSymbol(&m_InBitStream); - if (number == kLevelSymbolZeros) - { - num = kLevelSymbolZerosStartValue + ReadBits(kLevelSymbolZerosNumBits); - symbol = 0; - } - else if (number == kLevelSymbolZerosBig) - { - num = kLevelSymbolZerosBigStartValue + ReadBits(kLevelSymbolZerosBigNumBits); - symbol = 0; - } - else if (number == kLevelSymbolSame || number <= kNumHuffmanBits) - { - if (number <= kNumHuffmanBits) - num = 1; - else - { - num = kLevelSymbolSameStartValue + ReadBits(kLevelSymbolSameNumBits); - number = m_LevelDecoder.DecodeSymbol(&m_InBitStream); - if (number > kNumHuffmanBits) - return false; - } - symbol = Byte((17 + lastLevels[i] - number) % (kNumHuffmanBits + 1)); - } - else - return false; - } - return true; -} - -bool CDecoder::ReadTables(void) -{ - Byte newLevels[kMaxTableSize]; - { - int blockType = (int)ReadBits(kNumBlockTypeBits); - if (blockType > kBlockTypeUncompressed) - return false; - m_UnCompressedBlockSize = m_InBitStream.ReadBitsBig(kUncompressedBlockSizeNumBits); - - m_IsUncompressedBlock = (blockType == kBlockTypeUncompressed); - if (m_IsUncompressedBlock) - { - m_InBitStream.ReadBits(16 - m_InBitStream.GetBitPosition()); - if (!m_InBitStream.ReadUInt32(m_RepDistances[0])) - return false; - m_RepDistances[0]--; - for (int i = 1; i < kNumRepDistances; i++) - { - UInt32 rep = 0; - for (int j = 0; j < 4; j++) - rep |= (UInt32)m_InBitStream.DirectReadByte() << (8 * j); - m_RepDistances[i] = rep - 1; - } - return true; - } - m_AlignIsUsed = (blockType == kBlockTypeAligned); - if (m_AlignIsUsed) - { - for(int i = 0; i < kAlignTableSize; i++) - newLevels[i] = (Byte)ReadBits(kNumBitsForAlignLevel); - RIF(m_AlignDecoder.SetCodeLengths(newLevels)); - } - } - - RIF(ReadTable(m_LastMainLevels, newLevels, 256)); - RIF(ReadTable(m_LastMainLevels + 256, newLevels + 256, m_NumPosLenSlots)); - for (UInt32 i = 256 + m_NumPosLenSlots; i < kMainTableSize; i++) - newLevels[i] = 0; - RIF(m_MainDecoder.SetCodeLengths(newLevels)); - - RIF(ReadTable(m_LastLenLevels, newLevels, kNumLenSymbols)); - return m_LenDecoder.SetCodeLengths(newLevels); -} - -class CDecoderFlusher -{ - CDecoder *m_Decoder; -public: - bool NeedFlush; - CDecoderFlusher(CDecoder *decoder): m_Decoder(decoder), NeedFlush(true) {} - ~CDecoderFlusher() - { - if (NeedFlush) - m_Decoder->Flush(); - m_Decoder->ReleaseStreams(); - } -}; - - -void CDecoder::ClearPrevLevels() -{ - int i; - for (i = 0; i < kMainTableSize; i++) - m_LastMainLevels[i] = 0; - for (i = 0; i < kNumLenSymbols; i++) - m_LastLenLevels[i] = 0; -}; - - -HRESULT CDecoder::CodeSpec(UInt32 curSize) -{ - if (_remainLen == kLenIdNeedInit) - { - _remainLen = 0; - if (_keepHistory && m_IsUncompressedBlock && m_UnCompressedBlockSize > 0) - m_InBitStream.InitDirect(); - else - m_InBitStream.InitNormal(); - if (!_keepHistory) - { - m_UnCompressedBlockSize = 0; - ClearPrevLevels(); - UInt32 i86TranslationSize = 0; - bool translationMode = (ReadBits(1) != 0); - if (translationMode) - { - i86TranslationSize = ReadBits(16) << 16; - i86TranslationSize |= ReadBits(16); - } - m_x86ConvertOutStreamSpec->Init(translationMode, i86TranslationSize); - - for(int i = 0 ; i < kNumRepDistances; i++) - m_RepDistances[i] = 0; - } - } - - if (curSize == 0) - return S_OK; - - while(_remainLen > 0 && curSize > 0) - { - m_OutWindowStream.PutByte(m_OutWindowStream.GetByte(m_RepDistances[0])); - _remainLen--; - curSize--; - } - - while(curSize > 0) - { - if (m_UnCompressedBlockSize == 0) - if (!ReadTables()) - return S_FALSE; - UInt32 next = (Int32)MyMin(m_UnCompressedBlockSize, curSize); - curSize -= next; - m_UnCompressedBlockSize -= next; - if (m_IsUncompressedBlock) - { - while(next > 0) - { - m_OutWindowStream.PutByte(m_InBitStream.DirectReadByte()); - next--; - } - if (m_UnCompressedBlockSize == 0) - { - m_InBitStream.Align(m_AlignPos); - // m_AlignPos = 0; - } - } - else while(next > 0) - { - UInt32 number = m_MainDecoder.DecodeSymbol(&m_InBitStream); - if (number < 256) - { - m_OutWindowStream.PutByte((Byte)number); - next--; - } - else - { - UInt32 posLenSlot = number - 256; - if (posLenSlot >= m_NumPosLenSlots) - return S_FALSE; - UInt32 posSlot = posLenSlot / kNumLenSlots; - UInt32 lenSlot = posLenSlot % kNumLenSlots; - UInt32 len = kMatchMinLen + lenSlot; - if (lenSlot == kNumLenSlots - 1) - { - UInt32 lenTemp = m_LenDecoder.DecodeSymbol(&m_InBitStream); - if (lenTemp >= kNumLenSymbols) - return S_FALSE; - len += lenTemp; - } - - if (posSlot < kNumRepDistances) - { - UInt32 distance = m_RepDistances[posSlot]; - m_RepDistances[posSlot] = m_RepDistances[0]; - m_RepDistances[0] = distance; - } - else - { - UInt32 distance; - int numDirectBits; - if (posSlot < kNumPowerPosSlots) - { - numDirectBits = (posSlot >> 1) - 1; - distance = ((2 | (posSlot & 1)) << numDirectBits); - } - else - { - numDirectBits = kNumLinearPosSlotBits; - distance = ((posSlot - 0x22) << kNumLinearPosSlotBits); - } - - if (m_AlignIsUsed && numDirectBits >= kNumAlignBits) - { - distance += (m_InBitStream.ReadBits(numDirectBits - kNumAlignBits) << kNumAlignBits); - UInt32 alignTemp = m_AlignDecoder.DecodeSymbol(&m_InBitStream); - if (alignTemp >= kAlignTableSize) - return S_FALSE; - distance += alignTemp; - } - else - distance += m_InBitStream.ReadBits(numDirectBits); - m_RepDistances[2] = m_RepDistances[1]; - m_RepDistances[1] = m_RepDistances[0]; - m_RepDistances[0] = distance - kNumRepDistances; - } - - UInt32 locLen = len; - if (locLen > next) - locLen = next; - - if (!m_OutWindowStream.CopyBlock(m_RepDistances[0], locLen)) - return S_FALSE; - - len -= locLen; - next -= locLen; - if (len != 0) - { - _remainLen = len; - return S_OK; - } - } - } - } - return S_OK; -} - -HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, - ISequentialOutStream *outStream, - const UInt64 *, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - if (outSize == NULL) - return E_INVALIDARG; - UInt64 size = *outSize; - - RINOK(SetInStream(inStream)); - m_x86ConvertOutStreamSpec->SetStream(outStream); - m_OutWindowStream.SetStream(m_x86ConvertOutStream); - RINOK(SetOutStreamSize(outSize)); - - CDecoderFlusher flusher(this); - - const UInt64 start = m_OutWindowStream.GetProcessedSize(); - for (;;) - { - UInt32 curSize = 1 << 18; - UInt64 rem = size - (m_OutWindowStream.GetProcessedSize() - start); - if (curSize > rem) - curSize = (UInt32)rem; - if (curSize == 0) - break; - RINOK(CodeSpec(curSize)); - if (progress != NULL) - { - UInt64 inSize = m_InBitStream.GetProcessedSize(); - UInt64 nowPos64 = m_OutWindowStream.GetProcessedSize() - start; - RINOK(progress->SetRatioInfo(&inSize, &nowPos64)); - } - } - flusher.NeedFlush = false; - return Flush(); -} - -HRESULT CDecoder::Code(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - try { return CodeReal(inStream, outStream, inSize, outSize, progress); } - catch(const CLZOutWindowException &e) { return e.ErrorCode; } - catch(...) { return S_FALSE; } -} - -STDMETHODIMP CDecoder::SetInStream(ISequentialInStream *inStream) -{ - m_InBitStream.SetStream(inStream); - return S_OK; -} - -STDMETHODIMP CDecoder::ReleaseInStream() -{ - m_InBitStream.ReleaseStream(); - return S_OK; -} - -STDMETHODIMP CDecoder::SetOutStreamSize(const UInt64 *outSize) -{ - if (outSize == NULL) - return E_FAIL; - _remainLen = kLenIdNeedInit; - m_OutWindowStream.Init(_keepHistory); - return S_OK; -} - -HRESULT CDecoder::SetParams(int numDictBits) -{ - if (numDictBits < kNumDictionaryBitsMin || numDictBits > kNumDictionaryBitsMax) - return E_INVALIDARG; - UInt32 numPosSlots; - if (numDictBits < 20) - numPosSlots = 30 + (numDictBits - 15) * 2; - else if (numDictBits == 20) - numPosSlots = 42; - else - numPosSlots = 50; - m_NumPosLenSlots = numPosSlots * kNumLenSlots; - if (!m_OutWindowStream.Create(kDictionarySizeMax)) - return E_OUTOFMEMORY; - if (!m_InBitStream.Create(1 << 16)) - return E_OUTOFMEMORY; - return S_OK; -} - -}} diff --git a/7zip/Compress/Lzx/LzxDecoder.h b/7zip/Compress/Lzx/LzxDecoder.h deleted file mode 100755 index a62662ec..00000000 --- a/7zip/Compress/Lzx/LzxDecoder.h +++ /dev/null @@ -1,181 +0,0 @@ -// LzxDecoder.h - -#ifndef __LZXDECODER_H -#define __LZXDECODER_H - -#include "../../ICoder.h" - -#include "../../Compress/Huffman/HuffmanDecoder.h" -#include "../../Compress/LZ/LZOutWindow.h" -#include "../../Common/InBuffer.h" - -#include "Lzx.h" -#include "Lzx86Converter.h" - -namespace NCompress { -namespace NLzx { - -namespace NBitStream { - -const int kNumBigValueBits = 8 * 4; -const int kNumValueBits = 17; -const UInt32 kBitDecoderValueMask = (1 << kNumValueBits) - 1; - -class CDecoder -{ - CInBuffer m_Stream; - UInt32 m_Value; - int m_BitPos; -public: - CDecoder() {} - bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); } - - void SetStream(ISequentialInStream *s) { m_Stream.SetStream(s); } - void ReleaseStream() { m_Stream.ReleaseStream(); } - - void InitNormal() - { - m_Stream.Init(); - m_BitPos = kNumBigValueBits; - Normalize(); - } - - void InitDirect() - { - m_Stream.Init(); - m_BitPos = kNumBigValueBits; - } - - UInt64 GetProcessedSize() const - { return m_Stream.GetProcessedSize() - (kNumBigValueBits - m_BitPos) / 8; } - - int GetBitPosition() const { return m_BitPos & 0xF; } - - void Normalize() - { - for (;m_BitPos >= 16; m_BitPos -= 16) - { - Byte b0 = m_Stream.ReadByte(); - Byte b1 = m_Stream.ReadByte(); - m_Value = (m_Value << 8) | b1; - m_Value = (m_Value << 8) | b0; - } - } - - UInt32 GetValue(int numBits) const - { - return ((m_Value >> ((32 - kNumValueBits) - m_BitPos)) & kBitDecoderValueMask) >> - (kNumValueBits - numBits); - } - - void MovePos(UInt32 numBits) - { - m_BitPos += numBits; - Normalize(); - } - - UInt32 ReadBits(int numBits) - { - UInt32 res = GetValue(numBits); - MovePos(numBits); - return res; - } - - UInt32 ReadBitsBig(int numBits) - { - UInt32 numBits0 = numBits / 2; - UInt32 numBits1 = numBits - numBits0; - UInt32 res = ReadBits(numBits0) << numBits1; - return res + ReadBits(numBits1); - } - - bool ReadUInt32(UInt32 &v) - { - if (m_BitPos != 0) - return false; - v = ((m_Value >> 16) & 0xFFFF) | ((m_Value << 16) & 0xFFFF0000); - m_BitPos = kNumBigValueBits; - return true; - } - - Byte DirectReadByte() { return m_Stream.ReadByte(); } - - void Align(int alignPos) - { - if (((m_Stream.GetProcessedSize() + alignPos) & 1) != 0) - m_Stream.ReadByte(); - Normalize(); - } -}; -} - -class CDecoder : - public ICompressCoder, - public CMyUnknownImp -{ - NBitStream::CDecoder m_InBitStream; - CLZOutWindow m_OutWindowStream; - - UInt32 m_RepDistances[kNumRepDistances]; - UInt32 m_NumPosLenSlots; - - bool m_IsUncompressedBlock; - bool m_AlignIsUsed; - - NCompress::NHuffman::CDecoder m_MainDecoder; - NCompress::NHuffman::CDecoder m_LenDecoder; - NCompress::NHuffman::CDecoder m_AlignDecoder; - NCompress::NHuffman::CDecoder m_LevelDecoder; - - Byte m_LastMainLevels[kMainTableSize]; - Byte m_LastLenLevels[kNumLenSymbols]; - - Cx86ConvertOutStream *m_x86ConvertOutStreamSpec; - CMyComPtr m_x86ConvertOutStream; - - UInt32 m_UnCompressedBlockSize; - - bool _keepHistory; - int _remainLen; - int m_AlignPos; - - UInt32 ReadBits(UInt32 numBits); - bool ReadTable(Byte *lastLevels, Byte *newLevels, UInt32 numSymbols); - bool ReadTables(); - void ClearPrevLevels(); - - HRESULT CodeSpec(UInt32 size); - - HRESULT CodeReal(ISequentialInStream *inStream, - ISequentialOutStream *outStream, - const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); -public: - CDecoder(); - - MY_UNKNOWN_IMP - - void ReleaseStreams(); - STDMETHOD(Flush)(); - - // ICompressCoder interface - STDMETHOD(Code)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, - const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - STDMETHOD(SetInStream)(ISequentialInStream *inStream); - STDMETHOD(ReleaseInStream)(); - STDMETHOD(SetOutStreamSize)(const UInt64 *outSize); - - HRESULT SetParams(int numDictBits); - void SetKeepHistory(bool keepHistory, int alignPos) - { - _keepHistory = keepHistory; - m_AlignPos = alignPos; - } -}; - -}} - -#endif diff --git a/7zip/Compress/Lzx/StdAfx.h b/7zip/Compress/Lzx/StdAfx.h deleted file mode 100755 index e7fb6986..00000000 --- a/7zip/Compress/Lzx/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Compress/PPMD/DllExports.cpp b/7zip/Compress/PPMD/DllExports.cpp deleted file mode 100755 index c4a4fc61..00000000 --- a/7zip/Compress/PPMD/DllExports.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#ifdef _WIN32 -#include "Common/Alloc.h" -#endif - -#include "PPMDEncoder.h" -#include "PPMDDecoder.h" - -// {23170F69-40C1-278B-0304-010000000000} -DEFINE_GUID(CLSID_CCompressPPMDDecoder, -0x23170F69, 0x40C1, 0x278B, 0x03, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0304-010000000100} -DEFINE_GUID(CLSID_CCompressPPMDEncoder, -0x23170F69, 0x40C1, 0x278B, 0x03, 0x04, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD dwReason, LPVOID /*lpReserved*/) -{ - #ifdef _WIN32 - if (dwReason == DLL_PROCESS_ATTACH) - SetLargePageSize(); - #endif - return TRUE; -} - -STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - int correctInterface = (*iid == IID_ICompressCoder); - CMyComPtr coder; - if (*clsid == CLSID_CCompressPPMDDecoder) - { - if (!correctInterface) - return E_NOINTERFACE; - coder = (ICompressCoder *)new NCompress::NPPMD::CDecoder(); - } - else if (*clsid == CLSID_CCompressPPMDEncoder) - { - if (!correctInterface) - return E_NOINTERFACE; - coder = (ICompressCoder *)new NCompress::NPPMD::CEncoder(); - } - else - return CLASS_E_CLASSNOTAVAILABLE; - *outObject = coder.Detach(); - COM_TRY_END - return S_OK; -} - -STDAPI GetNumberOfMethods(UINT32 *numMethods) -{ - *numMethods = 1; - return S_OK; -} - -STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value) -{ - if (index != 0) - return E_INVALIDARG; - ::VariantClear((tagVARIANT *)value); - switch(propID) - { - case NMethodPropID::kID: - { - const char id[] = { 0x03, 0x04, 0x01 }; - if ((value->bstrVal = ::SysAllocStringByteLen(id, sizeof(id))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NMethodPropID::kName: - if ((value->bstrVal = ::SysAllocString(L"PPMD")) != 0) - value->vt = VT_BSTR; - return S_OK; - case NMethodPropID::kDecoder: - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CCompressPPMDDecoder, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - case NMethodPropID::kEncoder: - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CCompressPPMDEncoder, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - return S_OK; -} diff --git a/7zip/Compress/PPMD/PPMD.dsp b/7zip/Compress/PPMD/PPMD.dsp deleted file mode 100755 index 9e512f6c..00000000 --- a/7zip/Compress/PPMD/PPMD.dsp +++ /dev/null @@ -1,229 +0,0 @@ -# Microsoft Developer Studio Project File - Name="PPMD" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=PPMD - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "PPMD.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "PPMD.mak" CFG="PPMD - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "PPMD - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "PPMD - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "PPMD - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PPMD_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PPMD_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Codecs\PPMd.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "PPMD - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PPMD_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PPMD_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Codecs\PPMd.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "PPMD - Win32 Release" -# Name "PPMD - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Codec.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "PPMD" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\PPMDContext.h -# End Source File -# Begin Source File - -SOURCE=.\PPMDDecode.h -# End Source File -# Begin Source File - -SOURCE=.\PPMDDecoder.cpp - -!IF "$(CFG)" == "PPMD - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "PPMD - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\PPMDDecoder.h -# End Source File -# Begin Source File - -SOURCE=.\PPMDEncode.h -# End Source File -# Begin Source File - -SOURCE=.\PPMDEncoder.cpp - -!IF "$(CFG)" == "PPMD - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "PPMD - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\PPMDEncoder.h -# End Source File -# Begin Source File - -SOURCE=.\PPMDSubAlloc.h -# End Source File -# Begin Source File - -SOURCE=.\PPMDType.h -# End Source File -# End Group -# Begin Group "7zip common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "RangeCoder" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\RangeCoder\RangeCoder.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Types.h -# End Source File -# End Group -# End Target -# End Project diff --git a/7zip/Compress/PPMD/PPMD.dsw b/7zip/Compress/PPMD/PPMD.dsw deleted file mode 100755 index 8032f3db..00000000 --- a/7zip/Compress/PPMD/PPMD.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "PPMD"=.\PPMD.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/7zip/Compress/PPMD/PPMDContext.h b/7zip/Compress/PPMD/PPMDContext.h deleted file mode 100755 index a6a8dd60..00000000 --- a/7zip/Compress/PPMD/PPMDContext.h +++ /dev/null @@ -1,489 +0,0 @@ -// Compress/PPMD/Context.h -// This code is based on Dmitry Shkarin's PPMdH code - -#ifndef __COMPRESS_PPMD_CONTEXT_H -#define __COMPRESS_PPMD_CONTEXT_H - -#include "../../../Common/Types.h" - -#include "../RangeCoder/RangeCoder.h" -#include "PPMDSubAlloc.h" - -namespace NCompress { -namespace NPPMD { - -const int INT_BITS=7, PERIOD_BITS=7, TOT_BITS=INT_BITS+PERIOD_BITS, - INTERVAL=1 << INT_BITS, BIN_SCALE=1 << TOT_BITS, MAX_FREQ=124; - -struct SEE2_CONTEXT -{ - // SEE-contexts for PPM-contexts with masked symbols - UInt16 Summ; - Byte Shift, Count; - void init(int InitVal) { Summ = (UInt16)(InitVal << (Shift=PERIOD_BITS-4)); Count=4; } - unsigned int getMean() - { - unsigned int RetVal=(Summ >> Shift); - Summ = (UInt16)(Summ - RetVal); - return RetVal+(RetVal == 0); - } - void update() - { - if (Shift < PERIOD_BITS && --Count == 0) - { - Summ <<= 1; - Count = (Byte)(3 << Shift++); - } - } -}; - -struct PPM_CONTEXT -{ - UInt16 NumStats; // sizeof(UInt16) > sizeof(Byte) - UInt16 SummFreq; - - struct STATE - { - Byte Symbol, Freq; - UInt16 SuccessorLow; - UInt16 SuccessorHigh; - - UInt32 GetSuccessor() const { return SuccessorLow | ((UInt32)SuccessorHigh << 16); } - void SetSuccessor(UInt32 v) - { - SuccessorLow = (UInt16)(v & 0xFFFF); - SuccessorHigh = (UInt16)((v >> 16) & 0xFFFF); - } - }; - - UInt32 Stats; - UInt32 Suffix; - - PPM_CONTEXT* createChild(CSubAllocator &subAllocator, STATE* pStats, STATE& FirstState) - { - PPM_CONTEXT* pc = (PPM_CONTEXT*) subAllocator.AllocContext(); - if (pc) - { - pc->NumStats = 1; - pc->oneState() = FirstState; - pc->Suffix = subAllocator.GetOffset(this); - pStats->SetSuccessor(subAllocator.GetOffsetNoCheck(pc)); - } - return pc; - } - - STATE& oneState() const { return (STATE&) SummFreq; } -}; - -///////////////////////////////// - -const UInt16 InitBinEsc[] = - {0x3CDD, 0x1F3F, 0x59BF, 0x48F3, 0x64A1, 0x5ABC, 0x6632, 0x6051}; - -struct CInfo -{ - CSubAllocator SubAllocator; - SEE2_CONTEXT SEE2Cont[25][16], DummySEE2Cont; - PPM_CONTEXT * MinContext, * MaxContext; - - PPM_CONTEXT::STATE* FoundState; // found next state transition - int NumMasked, InitEsc, OrderFall, RunLength, InitRL, MaxOrder; - Byte CharMask[256], NS2Indx[256], NS2BSIndx[256], HB2Flag[256]; - Byte EscCount, PrintCount, PrevSuccess, HiBitsFlag; - UInt16 BinSumm[128][64]; // binary SEE-contexts - - UInt16 &GetBinSumm(const PPM_CONTEXT::STATE &rs, int numStates) - { - HiBitsFlag = HB2Flag[FoundState->Symbol]; - return BinSumm[rs.Freq - 1][ - PrevSuccess + NS2BSIndx[numStates - 1] + - HiBitsFlag + 2 * HB2Flag[rs.Symbol] + - ((RunLength >> 26) & 0x20)]; - } - - PPM_CONTEXT *GetContext(UInt32 offset) const { return (PPM_CONTEXT *)SubAllocator.GetPtr(offset); } - PPM_CONTEXT *GetContextNoCheck(UInt32 offset) const { return (PPM_CONTEXT *)SubAllocator.GetPtrNoCheck(offset); } - PPM_CONTEXT::STATE *GetState(UInt32 offset) const { return (PPM_CONTEXT::STATE *)SubAllocator.GetPtr(offset); } - PPM_CONTEXT::STATE *GetStateNoCheck(UInt32 offset) const { return (PPM_CONTEXT::STATE *)SubAllocator.GetPtr(offset); } - - void RestartModelRare() - { - int i, k, m; - memset(CharMask,0,sizeof(CharMask)); - SubAllocator.InitSubAllocator(); - InitRL = -((MaxOrder < 12) ? MaxOrder : 12) - 1; - MinContext = MaxContext = (PPM_CONTEXT*) SubAllocator.AllocContext(); - MinContext->Suffix = 0; - OrderFall = MaxOrder; - MinContext->SummFreq = (UInt16)((MinContext->NumStats = 256) + 1); - FoundState = (PPM_CONTEXT::STATE*)SubAllocator.AllocUnits(256 / 2); - MinContext->Stats = SubAllocator.GetOffsetNoCheck(FoundState); - PrevSuccess = 0; - for (RunLength = InitRL, i = 0; i < 256; i++) - { - PPM_CONTEXT::STATE &state = FoundState[i]; - state.Symbol = (Byte)i; - state.Freq = 1; - state.SetSuccessor(0); - } - for (i = 0; i < 128; i++) - for (k = 0; k < 8; k++) - for ( m=0; m < 64; m += 8) - BinSumm[i][k + m] = (UInt16)(BIN_SCALE - InitBinEsc[k] / (i + 2)); - for (i = 0; i < 25; i++) - for (k = 0; k < 16; k++) - SEE2Cont[i][k].init(5*i+10); - } - - void StartModelRare(int MaxOrder) - { - int i, k, m ,Step; - EscCount=PrintCount=1; - if (MaxOrder < 2) - { - memset(CharMask,0,sizeof(CharMask)); - OrderFall = this->MaxOrder; - MinContext = MaxContext; - while (MinContext->Suffix != 0) - { - MinContext = GetContextNoCheck(MinContext->Suffix); - OrderFall--; - } - FoundState = GetState(MinContext->Stats); - MinContext = MaxContext; - } - else - { - this->MaxOrder = MaxOrder; - RestartModelRare(); - NS2BSIndx[0] = 2 * 0; - NS2BSIndx[1] = 2 * 1; - memset(NS2BSIndx + 2, 2 * 2, 9); - memset(NS2BSIndx + 11, 2 * 3, 256 - 11); - for (i = 0; i < 3; i++) - NS2Indx[i] = (Byte)i; - for (m = i, k = Step = 1; i < 256; i++) - { - NS2Indx[i] = (Byte)m; - if ( !--k ) - { - k = ++Step; - m++; - } - } - memset(HB2Flag, 0, 0x40); - memset(HB2Flag + 0x40, 0x08, 0x100 - 0x40); - DummySEE2Cont.Shift = PERIOD_BITS; - } - } - - PPM_CONTEXT* CreateSuccessors(bool skip, PPM_CONTEXT::STATE* p1) - { - // static UpState declaration bypasses IntelC bug - // static PPM_CONTEXT::STATE UpState; - PPM_CONTEXT::STATE UpState; - - PPM_CONTEXT *pc = MinContext; - PPM_CONTEXT *UpBranch = GetContext(FoundState->GetSuccessor()); - PPM_CONTEXT::STATE * p, * ps[MAX_O], ** pps = ps; - if ( !skip ) - { - *pps++ = FoundState; - if ( !pc->Suffix ) - goto NO_LOOP; - } - if ( p1 ) - { - p = p1; - pc = GetContext(pc->Suffix); - goto LOOP_ENTRY; - } - do - { - pc = GetContext(pc->Suffix); - if (pc->NumStats != 1) - { - if ((p = GetStateNoCheck(pc->Stats))->Symbol != FoundState->Symbol) - do { p++; } while (p->Symbol != FoundState->Symbol); - } - else - p = &(pc->oneState()); -LOOP_ENTRY: - if (GetContext(p->GetSuccessor()) != UpBranch) - { - pc = GetContext(p->GetSuccessor()); - break; - } - *pps++ = p; - } - while ( pc->Suffix ); -NO_LOOP: - if (pps == ps) - return pc; - UpState.Symbol = *(Byte*) UpBranch; - UpState.SetSuccessor(SubAllocator.GetOffset(UpBranch) + 1); - if (pc->NumStats != 1) - { - if ((p = GetStateNoCheck(pc->Stats))->Symbol != UpState.Symbol) - do { p++; } while (p->Symbol != UpState.Symbol); - unsigned int cf = p->Freq-1; - unsigned int s0 = pc->SummFreq - pc->NumStats - cf; - UpState.Freq = (Byte)(1 + ((2 * cf <= s0) ? (5 * cf > s0) : - ((2 * cf + 3 * s0 - 1) / (2 * s0)))); - } - else - UpState.Freq = pc->oneState().Freq; - do - { - pc = pc->createChild(SubAllocator, *--pps, UpState); - if ( !pc ) - return NULL; - } - while (pps != ps); - return pc; - } - - void UpdateModel() - { - PPM_CONTEXT::STATE fs = *FoundState, * p = NULL; - PPM_CONTEXT* pc, * Successor; - unsigned int ns1, ns, cf, sf, s0; - if (fs.Freq < MAX_FREQ / 4 && MinContext->Suffix != 0) - { - pc = GetContextNoCheck(MinContext->Suffix); - - if (pc->NumStats != 1) - { - if ((p = GetStateNoCheck(pc->Stats))->Symbol != fs.Symbol) - { - do { p++; } while (p->Symbol != fs.Symbol); - if (p[0].Freq >= p[-1].Freq) - { - _PPMD_SWAP(p[0],p[-1]); - p--; - } - } - if (p->Freq < MAX_FREQ-9) - { - p->Freq += 2; - pc->SummFreq += 2; - } - } - else - { - p = &(pc->oneState()); - p->Freq = (Byte)(p->Freq + ((p->Freq < 32) ? 1 : 0)); - } - } - if ( !OrderFall ) - { - MinContext = MaxContext = CreateSuccessors(true, p); - FoundState->SetSuccessor(SubAllocator.GetOffset(MinContext)); - if (MinContext == 0) - goto RESTART_MODEL; - return; - } - *SubAllocator.pText++ = fs.Symbol; - Successor = (PPM_CONTEXT*) SubAllocator.pText; - if (SubAllocator.pText >= SubAllocator.UnitsStart) - goto RESTART_MODEL; - if (fs.GetSuccessor() != 0) - { - if ((Byte *)GetContext(fs.GetSuccessor()) <= SubAllocator.pText) - { - PPM_CONTEXT* cs = CreateSuccessors(false, p); - fs.SetSuccessor(SubAllocator.GetOffset(cs)); - if (cs == NULL) - goto RESTART_MODEL; - } - if ( !--OrderFall ) - { - Successor = GetContext(fs.GetSuccessor()); - SubAllocator.pText -= (MaxContext != MinContext); - } - } - else - { - FoundState->SetSuccessor(SubAllocator.GetOffsetNoCheck(Successor)); - fs.SetSuccessor(SubAllocator.GetOffsetNoCheck(MinContext)); - } - s0 = MinContext->SummFreq - (ns = MinContext->NumStats) - (fs.Freq - 1); - for (pc = MaxContext; pc != MinContext; pc = GetContext(pc->Suffix)) - { - if ((ns1 = pc->NumStats) != 1) - { - if ((ns1 & 1) == 0) - { - void *ppp = SubAllocator.ExpandUnits(GetState(pc->Stats), ns1 >> 1); - pc->Stats = SubAllocator.GetOffset(ppp); - if (!ppp) - goto RESTART_MODEL; - } - pc->SummFreq = (UInt16)(pc->SummFreq + (2 * ns1 < ns) + 2 * ((4 * ns1 <= ns) & - (pc->SummFreq <= 8 * ns1))); - } - else - { - p = (PPM_CONTEXT::STATE*) SubAllocator.AllocUnits(1); - if ( !p ) - goto RESTART_MODEL; - *p = pc->oneState(); - pc->Stats = SubAllocator.GetOffsetNoCheck(p); - if (p->Freq < MAX_FREQ / 4 - 1) - p->Freq <<= 1; - else - p->Freq = MAX_FREQ - 4; - pc->SummFreq = (UInt16)(p->Freq + InitEsc + (ns > 3)); - } - cf = 2 * fs.Freq * (pc->SummFreq+6); - sf = s0 + pc->SummFreq; - if (cf < 6 * sf) - { - cf = 1 + (cf > sf)+(cf >= 4 * sf); - pc->SummFreq += 3; - } - else - { - cf = 4 + (cf >= 9 * sf) + (cf >= 12 * sf) + (cf >= 15 * sf); - pc->SummFreq = (UInt16)(pc->SummFreq + cf); - } - p = GetState(pc->Stats) + ns1; - p->SetSuccessor(SubAllocator.GetOffset(Successor)); - p->Symbol = fs.Symbol; - p->Freq = (Byte)cf; - pc->NumStats = (UInt16)++ns1; - } - MaxContext = MinContext = GetContext(fs.GetSuccessor()); - return; -RESTART_MODEL: - RestartModelRare(); - EscCount = 0; - PrintCount = 0xFF; - } - - void ClearMask() - { - EscCount = 1; - memset(CharMask, 0, sizeof(CharMask)); - // if (++PrintCount == 0) - // PrintInfo(DecodedFile,EncodedFile); - } - - void update1(PPM_CONTEXT::STATE* p) - { - (FoundState = p)->Freq += 4; - MinContext->SummFreq += 4; - if (p[0].Freq > p[-1].Freq) - { - _PPMD_SWAP(p[0],p[-1]); - FoundState = --p; - if (p->Freq > MAX_FREQ) - rescale(); - } - } - - - void update2(PPM_CONTEXT::STATE* p) - { - (FoundState = p)->Freq += 4; - MinContext->SummFreq += 4; - if (p->Freq > MAX_FREQ) - rescale(); - EscCount++; - RunLength = InitRL; - } - - SEE2_CONTEXT* makeEscFreq2(int Diff, UInt32 &scale) - { - SEE2_CONTEXT* psee2c; - if (MinContext->NumStats != 256) - { - psee2c = SEE2Cont[NS2Indx[Diff-1]] + - (Diff < (GetContext(MinContext->Suffix))->NumStats - MinContext->NumStats) + - 2 * (MinContext->SummFreq < 11 * MinContext->NumStats) + - 4 * (NumMasked > Diff) + - HiBitsFlag; - scale = psee2c->getMean(); - } - else - { - psee2c = &DummySEE2Cont; - scale = 1; - } - return psee2c; - } - - - - void rescale() - { - int OldNS = MinContext->NumStats, i = MinContext->NumStats - 1, Adder, EscFreq; - PPM_CONTEXT::STATE* p1, * p; - PPM_CONTEXT::STATE *stats = GetStateNoCheck(MinContext->Stats); - for (p = FoundState; p != stats; p--) - _PPMD_SWAP(p[0], p[-1]); - stats->Freq += 4; - MinContext->SummFreq += 4; - EscFreq = MinContext->SummFreq - p->Freq; - Adder = (OrderFall != 0); - p->Freq = (Byte)((p->Freq + Adder) >> 1); - MinContext->SummFreq = p->Freq; - do - { - EscFreq -= (++p)->Freq; - p->Freq = (Byte)((p->Freq + Adder) >> 1); - MinContext->SummFreq = (UInt16)(MinContext->SummFreq + p->Freq); - if (p[0].Freq > p[-1].Freq) - { - PPM_CONTEXT::STATE tmp = *(p1 = p); - do - { - p1[0] = p1[-1]; - } - while (--p1 != stats && tmp.Freq > p1[-1].Freq); - *p1 = tmp; - } - } - while ( --i ); - if (p->Freq == 0) - { - do { i++; } while ((--p)->Freq == 0); - EscFreq += i; - MinContext->NumStats = (UInt16)(MinContext->NumStats - i); - if (MinContext->NumStats == 1) - { - PPM_CONTEXT::STATE tmp = *stats; - do { tmp.Freq = (Byte)(tmp.Freq - (tmp.Freq >> 1)); EscFreq >>= 1; } while (EscFreq > 1); - SubAllocator.FreeUnits(stats, (OldNS+1) >> 1); - *(FoundState = &MinContext->oneState()) = tmp; return; - } - } - EscFreq -= (EscFreq >> 1); - MinContext->SummFreq = (UInt16)(MinContext->SummFreq + EscFreq); - int n0 = (OldNS+1) >> 1, n1 = (MinContext->NumStats + 1) >> 1; - if (n0 != n1) - MinContext->Stats = SubAllocator.GetOffset(SubAllocator.ShrinkUnits(stats, n0, n1)); - FoundState = GetState(MinContext->Stats); - } - - void NextContext() - { - PPM_CONTEXT *c = GetContext(FoundState->GetSuccessor()); - if (!OrderFall && (Byte *)c > SubAllocator.pText) - MinContext = MaxContext = c; - else - { - UpdateModel(); - if (EscCount == 0) - ClearMask(); - } - } -}; - -// Tabulated escapes for exponential symbol distribution -const Byte ExpEscape[16]={ 25,14, 9, 7, 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 2 }; -#define GET_MEAN(SUMM,SHIFT,ROUND) ((SUMM+(1 << (SHIFT-ROUND))) >> (SHIFT)) - -}} - -#endif diff --git a/7zip/Compress/PPMD/PPMDDecode.h b/7zip/Compress/PPMD/PPMDDecode.h deleted file mode 100755 index 5eddcdf4..00000000 --- a/7zip/Compress/PPMD/PPMDDecode.h +++ /dev/null @@ -1,137 +0,0 @@ -// PPMDDecode.h -// This code is based on Dmitry Shkarin's PPMdH code - -#ifndef __COMPRESS_PPMD_DECODE_H -#define __COMPRESS_PPMD_DECODE_H - -#include "PPMDContext.h" - -namespace NCompress { -namespace NPPMD { - -struct CDecodeInfo: public CInfo -{ - void DecodeBinSymbol(NRangeCoder::CDecoder *rangeDecoder) - { - PPM_CONTEXT::STATE& rs = MinContext->oneState(); - UInt16& bs = GetBinSumm(rs, GetContextNoCheck(MinContext->Suffix)->NumStats); - if (rangeDecoder->DecodeBit(bs, TOT_BITS) == 0) - { - FoundState = &rs; - rs.Freq = (Byte)(rs.Freq + (rs.Freq < 128 ? 1: 0)); - bs = (UInt16)(bs + INTERVAL - GET_MEAN(bs, PERIOD_BITS, 2)); - PrevSuccess = 1; - RunLength++; - } - else - { - bs = (UInt16)(bs - GET_MEAN(bs, PERIOD_BITS, 2)); - InitEsc = ExpEscape[bs >> 10]; - NumMasked = 1; - CharMask[rs.Symbol] = EscCount; - PrevSuccess = 0; - FoundState = NULL; - } - } - - void DecodeSymbol1(NRangeCoder::CDecoder *rangeDecoder) - { - PPM_CONTEXT::STATE* p = GetStateNoCheck(MinContext->Stats); - int i, count, hiCnt; - if ((count = rangeDecoder->GetThreshold(MinContext->SummFreq)) < (hiCnt = p->Freq)) - { - PrevSuccess = (2 * hiCnt > MinContext->SummFreq); - RunLength += PrevSuccess; - rangeDecoder->Decode(0, p->Freq); // MinContext->SummFreq); - (FoundState = p)->Freq = (Byte)(hiCnt += 4); - MinContext->SummFreq += 4; - if (hiCnt > MAX_FREQ) - rescale(); - return; - } - PrevSuccess = 0; - i = MinContext->NumStats - 1; - while ((hiCnt += (++p)->Freq) <= count) - if (--i == 0) - { - HiBitsFlag = HB2Flag[FoundState->Symbol]; - rangeDecoder->Decode(hiCnt, MinContext->SummFreq - hiCnt); // , MinContext->SummFreq); - CharMask[p->Symbol] = EscCount; - i = (NumMasked = MinContext->NumStats)-1; - FoundState = NULL; - do { CharMask[(--p)->Symbol] = EscCount; } while ( --i ); - return; - } - rangeDecoder->Decode(hiCnt - p->Freq, p->Freq); // , MinContext->SummFreq); - update1(p); - } - - - void DecodeSymbol2(NRangeCoder::CDecoder *rangeDecoder) - { - int count, hiCnt, i = MinContext->NumStats - NumMasked; - UInt32 freqSum; - SEE2_CONTEXT* psee2c = makeEscFreq2(i, freqSum); - PPM_CONTEXT::STATE* ps[256], ** pps = ps, * p = GetStateNoCheck(MinContext->Stats)-1; - hiCnt = 0; - do - { - do { p++; } while (CharMask[p->Symbol] == EscCount); - hiCnt += p->Freq; - *pps++ = p; - } - while ( --i ); - - freqSum += hiCnt; - count = rangeDecoder->GetThreshold(freqSum); - - p = *(pps = ps); - if (count < hiCnt) - { - hiCnt = 0; - while ((hiCnt += p->Freq) <= count) - p=*++pps; - rangeDecoder->Decode(hiCnt - p->Freq, p->Freq); // , freqSum); - - psee2c->update(); - update2(p); - } - else - { - rangeDecoder->Decode(hiCnt, freqSum - hiCnt); // , freqSum); - - i = MinContext->NumStats - NumMasked; - pps--; - do { CharMask[(*++pps)->Symbol] = EscCount; } while ( --i ); - psee2c->Summ = (UInt16)(psee2c->Summ + freqSum); - NumMasked = MinContext->NumStats; - } - } - - int DecodeSymbol(NRangeCoder::CDecoder *rangeDecoder) - { - if (MinContext->NumStats != 1) - DecodeSymbol1(rangeDecoder); - else - DecodeBinSymbol(rangeDecoder); - while ( !FoundState ) - { - do - { - OrderFall++; - MinContext = GetContext(MinContext->Suffix); - if (MinContext == 0) - return -1; - } - while (MinContext->NumStats == NumMasked); - DecodeSymbol2(rangeDecoder); - } - Byte symbol = FoundState->Symbol; - NextContext(); - return symbol; - } -}; - -}} - -#endif diff --git a/7zip/Compress/PPMD/PPMDDecoder.cpp b/7zip/Compress/PPMD/PPMDDecoder.cpp deleted file mode 100755 index f5f9b06c..00000000 --- a/7zip/Compress/PPMD/PPMDDecoder.cpp +++ /dev/null @@ -1,183 +0,0 @@ -// PPMDDecoder.cpp - -#include "StdAfx.h" - -#include "Common/Defs.h" -#include "Windows/Defs.h" - -#include "PPMDDecoder.h" - -namespace NCompress { -namespace NPPMD { - -const int kLenIdFinished = -1; -const int kLenIdNeedInit = -2; - -STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *properties, UInt32 size) -{ - if (size < 5) - return E_INVALIDARG; - _order = properties[0]; - _usedMemorySize = 0; - for (int i = 0; i < 4; i++) - _usedMemorySize += ((UInt32)(properties[1 + i])) << (i * 8); - - if (_usedMemorySize > kMaxMemBlockSize) - return E_NOTIMPL; - - if (!_rangeDecoder.Create(1 << 20)) - return E_OUTOFMEMORY; - if (!_info.SubAllocator.StartSubAllocator(_usedMemorySize)) - return E_OUTOFMEMORY; - - return S_OK; -} - -class CDecoderFlusher -{ - CDecoder *_coder; -public: - bool NeedFlush; - CDecoderFlusher(CDecoder *coder): _coder(coder), NeedFlush(true) {} - ~CDecoderFlusher() - { - if (NeedFlush) - _coder->Flush(); - _coder->ReleaseStreams(); - } -}; - -HRESULT CDecoder::CodeSpec(UInt32 size, Byte *memStream) -{ - const UInt32 startSize = size; - if (_outSizeDefined) - { - const UInt64 rem = _outSize - _processedSize; - if (size > rem) - size = (UInt32)rem; - } - - if (_remainLen == kLenIdFinished) - return S_OK; - if (_remainLen == kLenIdNeedInit) - { - _rangeDecoder.Init(); - _remainLen = 0; - _info.MaxOrder = 0; - _info.StartModelRare(_order); - } - while (size != 0) - { - int symbol = _info.DecodeSymbol(&_rangeDecoder); - if (symbol < 0) - { - _remainLen = kLenIdFinished; - break; - } - if (memStream != 0) - *memStream++ = (Byte)symbol; - else - _outStream.WriteByte((Byte)symbol); - size--; - } - _processedSize += startSize - size; - return S_OK; -} - -STDMETHODIMP CDecoder::CodeReal(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 * /* inSize */, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - if (!_outStream.Create(1 << 20)) - return E_OUTOFMEMORY; - - SetInStream(inStream); - _outStream.SetStream(outStream); - SetOutStreamSize(outSize); - CDecoderFlusher flusher(this); - - for (;;) - { - _processedSize = _outStream.GetProcessedSize(); - UInt32 curSize = (1 << 18); - RINOK(CodeSpec(curSize, NULL)); - if (_remainLen == kLenIdFinished) - break; - if (progress != NULL) - { - UInt64 inSize = _rangeDecoder.GetProcessedSize(); - RINOK(progress->SetRatioInfo(&inSize, &_processedSize)); - } - if (_outSizeDefined) - if (_outStream.GetProcessedSize() >= _outSize) - break; - } - flusher.NeedFlush = false; - return Flush(); -} - -#ifdef _NO_EXCEPTIONS - -#define PPMD_TRY_BEGIN -#define PPMD_TRY_END - -#else - -#define PPMD_TRY_BEGIN try { -#define PPMD_TRY_END } \ - catch(const CInBufferException &e) { return e.ErrorCode; } \ - catch(const COutBufferException &e) { return e.ErrorCode; } \ - catch(...) { return S_FALSE; } - -#endif - - -STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - PPMD_TRY_BEGIN - return CodeReal(inStream, outStream, inSize, outSize, progress); - PPMD_TRY_END -} - -STDMETHODIMP CDecoder::SetInStream(ISequentialInStream *inStream) -{ - _rangeDecoder.SetStream(inStream); - return S_OK; -} - -STDMETHODIMP CDecoder::ReleaseInStream() -{ - _rangeDecoder.ReleaseStream(); - return S_OK; -} - -STDMETHODIMP CDecoder::SetOutStreamSize(const UInt64 *outSize) -{ - _outSizeDefined = (outSize != NULL); - if (_outSizeDefined) - _outSize = *outSize; - _remainLen = kLenIdNeedInit; - _outStream.Init(); - return S_OK; -} - -#ifdef _ST_MODE - -STDMETHODIMP CDecoder::Read(void *data, UInt32 size, UInt32 *processedSize) -{ - PPMD_TRY_BEGIN - if (processedSize) - *processedSize = 0; - const UInt64 startPos = _processedSize; - RINOK(CodeSpec(size, (Byte *)data)); - if (processedSize) - *processedSize = (UInt32)(_processedSize - startPos); - return Flush(); - PPMD_TRY_END -} - -#endif - -}} diff --git a/7zip/Compress/PPMD/PPMDDecoder.h b/7zip/Compress/PPMD/PPMDDecoder.h deleted file mode 100755 index bbb68ac5..00000000 --- a/7zip/Compress/PPMD/PPMDDecoder.h +++ /dev/null @@ -1,89 +0,0 @@ -// Compress/PPM/PPMDDecoder.h - -#ifndef __COMPRESS_PPMD_DECODER_H -#define __COMPRESS_PPMD_DECODER_H - -#include "../../../Common/MyCom.h" - -#include "../../ICoder.h" -#include "../../Common/OutBuffer.h" -#include "../RangeCoder/RangeCoder.h" - -#include "PPMDDecode.h" - -namespace NCompress { -namespace NPPMD { - -class CDecoder : - public ICompressCoder, - public ICompressSetDecoderProperties2, - #ifdef _ST_MODE - public ICompressSetInStream, - public ICompressSetOutStreamSize, - public ISequentialInStream, - #endif - public CMyUnknownImp -{ - NRangeCoder::CDecoder _rangeDecoder; - - COutBuffer _outStream; - - CDecodeInfo _info; - - Byte _order; - UInt32 _usedMemorySize; - - int _remainLen; - UInt64 _outSize; - bool _outSizeDefined; - UInt64 _processedSize; - - HRESULT CodeSpec(UInt32 num, Byte *memStream); -public: - - #ifdef _ST_MODE - MY_UNKNOWN_IMP4( - ICompressSetDecoderProperties2, - ICompressSetInStream, - ICompressSetOutStreamSize, - ISequentialInStream) - #else - MY_UNKNOWN_IMP1( - ICompressSetDecoderProperties2) - #endif - - void ReleaseStreams() - { - ReleaseInStream(); - _outStream.ReleaseStream(); - } - - HRESULT Flush() { return _outStream.Flush(); } - - STDMETHOD(CodeReal)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, - const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - STDMETHOD(Code)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - - STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size); - - STDMETHOD(SetInStream)(ISequentialInStream *inStream); - STDMETHOD(ReleaseInStream)(); - STDMETHOD(SetOutStreamSize)(const UInt64 *outSize); - - #ifdef _ST_MODE - STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); - #endif - - CDecoder(): _outSizeDefined(false) {} - -}; - -}} - -#endif diff --git a/7zip/Compress/PPMD/PPMDEncode.h b/7zip/Compress/PPMD/PPMDEncode.h deleted file mode 100755 index 6a720cac..00000000 --- a/7zip/Compress/PPMD/PPMDEncode.h +++ /dev/null @@ -1,142 +0,0 @@ -// PPMDEncode.h -// This code is based on Dmitry Shkarin's PPMdH code - -#ifndef __COMPRESS_PPMD_ENCODE_H -#define __COMPRESS_PPMD_ENCODE_H - -#include "PPMDContext.h" - -namespace NCompress { -namespace NPPMD { - -struct CEncodeInfo: public CInfo -{ - - void EncodeBinSymbol(int symbol, NRangeCoder::CEncoder *rangeEncoder) - { - PPM_CONTEXT::STATE& rs = MinContext->oneState(); - UInt16 &bs = GetBinSumm(rs, GetContextNoCheck(MinContext->Suffix)->NumStats); - if (rs.Symbol == symbol) - { - FoundState = &rs; - rs.Freq = (Byte)(rs.Freq + (rs.Freq < 128 ? 1: 0)); - rangeEncoder->EncodeBit(bs, TOT_BITS, 0); - bs = (UInt16)(bs + INTERVAL - GET_MEAN(bs, PERIOD_BITS, 2)); - PrevSuccess = 1; - RunLength++; - } - else - { - rangeEncoder->EncodeBit(bs, TOT_BITS, 1); - bs = (UInt16)(bs - GET_MEAN(bs, PERIOD_BITS, 2)); - InitEsc = ExpEscape[bs >> 10]; - NumMasked = 1; - CharMask[rs.Symbol] = EscCount; - PrevSuccess = 0; - FoundState = NULL; - } - } - - void EncodeSymbol1(int symbol, NRangeCoder::CEncoder *rangeEncoder) - { - PPM_CONTEXT::STATE* p = GetStateNoCheck(MinContext->Stats); - if (p->Symbol == symbol) - { - PrevSuccess = (2 * (p->Freq) > MinContext->SummFreq); - RunLength += PrevSuccess; - rangeEncoder->Encode(0, p->Freq, MinContext->SummFreq); - (FoundState = p)->Freq += 4; - MinContext->SummFreq += 4; - if (p->Freq > MAX_FREQ) - rescale(); - return; - } - PrevSuccess = 0; - int LoCnt = p->Freq, i = MinContext->NumStats - 1; - while ((++p)->Symbol != symbol) - { - LoCnt += p->Freq; - if (--i == 0) - { - HiBitsFlag = HB2Flag[FoundState->Symbol]; - CharMask[p->Symbol] = EscCount; - i=(NumMasked = MinContext->NumStats)-1; - FoundState = NULL; - do { CharMask[(--p)->Symbol] = EscCount; } while ( --i ); - rangeEncoder->Encode(LoCnt, MinContext->SummFreq - LoCnt, MinContext->SummFreq); - return; - } - } - rangeEncoder->Encode(LoCnt, p->Freq, MinContext->SummFreq); - update1(p); - } - - void EncodeSymbol2(int symbol, NRangeCoder::CEncoder *rangeEncoder) - { - int hiCnt, i = MinContext->NumStats - NumMasked; - UInt32 scale; - SEE2_CONTEXT* psee2c = makeEscFreq2(i, scale); - PPM_CONTEXT::STATE* p = GetStateNoCheck(MinContext->Stats) - 1; - hiCnt = 0; - do - { - do { p++; } while (CharMask[p->Symbol] == EscCount); - hiCnt += p->Freq; - if (p->Symbol == symbol) - goto SYMBOL_FOUND; - CharMask[p->Symbol] = EscCount; - } - while ( --i ); - - rangeEncoder->Encode(hiCnt, scale, hiCnt + scale); - scale += hiCnt; - - psee2c->Summ = (UInt16)(psee2c->Summ + scale); - NumMasked = MinContext->NumStats; - return; -SYMBOL_FOUND: - - UInt32 highCount = hiCnt; - UInt32 lowCount = highCount - p->Freq; - if ( --i ) - { - PPM_CONTEXT::STATE* p1 = p; - do - { - do { p1++; } while (CharMask[p1->Symbol] == EscCount); - hiCnt += p1->Freq; - } - while ( --i ); - } - // SubRange.scale += hiCnt; - scale += hiCnt; - rangeEncoder->Encode(lowCount, highCount - lowCount, scale); - psee2c->update(); - update2(p); - } - - void EncodeSymbol(int c, NRangeCoder::CEncoder *rangeEncoder) - { - if (MinContext->NumStats != 1) - EncodeSymbol1(c, rangeEncoder); - else - EncodeBinSymbol(c, rangeEncoder); - while ( !FoundState ) - { - do - { - OrderFall++; - MinContext = GetContext(MinContext->Suffix); - if (MinContext == 0) - return; // S_OK; - } - while (MinContext->NumStats == NumMasked); - EncodeSymbol2(c, rangeEncoder); - } - NextContext(); - } - -}; -}} - -#endif diff --git a/7zip/Compress/PPMD/PPMDEncoder.cpp b/7zip/Compress/PPMD/PPMDEncoder.cpp deleted file mode 100755 index fe99ea5a..00000000 --- a/7zip/Compress/PPMD/PPMDEncoder.cpp +++ /dev/null @@ -1,155 +0,0 @@ -// Compress/Associative/Encoder.h - -#include "StdAfx.h" - -#include "Windows/Defs.h" - -// #include -// #include - -#include "Common/Defs.h" - -#include "../../Common/StreamUtils.h" - -#include "PPMDEncoder.h" - -namespace NCompress { -namespace NPPMD { - -const UInt32 kMinMemSize = (1 << 11); -const UInt32 kMinOrder = 2; - -/* -UInt32 g_NumInner = 0; -UInt32 g_InnerCycles = 0; - -UInt32 g_Encode2 = 0; -UInt32 g_Encode2Cycles = 0; -UInt32 g_Encode2Cycles2 = 0; - -class CCounter -{ -public: - CCounter() {} - ~CCounter() - { - ofstream ofs("Res.dat"); - ofs << "innerEncode1 = " << setw(10) << g_NumInner << endl; - ofs << "g_InnerCycles = " << setw(10) << g_InnerCycles << endl; - ofs << "g_Encode2 = " << setw(10) << g_Encode2 << endl; - ofs << "g_Encode2Cycles = " << setw(10) << g_Encode2Cycles << endl; - ofs << "g_Encode2Cycles2= " << setw(10) << g_Encode2Cycles2 << endl; - - } -}; -CCounter g_Counter; -*/ - -STDMETHODIMP CEncoder::SetCoderProperties(const PROPID *propIDs, - const PROPVARIANT *properties, UInt32 numProperties) -{ - for (UInt32 i = 0; i < numProperties; i++) - { - const PROPVARIANT &prop = properties[i]; - switch(propIDs[i]) - { - case NCoderPropID::kUsedMemorySize: - if (prop.vt != VT_UI4) - return E_INVALIDARG; - if (prop.ulVal < kMinMemSize || prop.ulVal > kMaxMemBlockSize) - return E_INVALIDARG; - _usedMemorySize = (UInt32)prop.ulVal; - break; - case NCoderPropID::kOrder: - if (prop.vt != VT_UI4) - return E_INVALIDARG; - if (prop.ulVal < kMinOrder || prop.ulVal > kMaxOrderCompress) - return E_INVALIDARG; - _order = (Byte)prop.ulVal; - break; - default: - return E_INVALIDARG; - } - } - return S_OK; -} - -STDMETHODIMP CEncoder::WriteCoderProperties(ISequentialOutStream *outStream) -{ - const UInt32 kPropSize = 5; - Byte properties[kPropSize]; - properties[0] = _order; - for (int i = 0; i < 4; i++) - properties[1 + i] = Byte(_usedMemorySize >> (8 * i)); - return WriteStream(outStream, properties, kPropSize, NULL); -} - -const UInt32 kUsedMemorySizeDefault = (1 << 24); -const int kOrderDefault = 6; - -CEncoder::CEncoder(): - _usedMemorySize(kUsedMemorySizeDefault), - _order(kOrderDefault) -{ -} - - -HRESULT CEncoder::CodeReal(ISequentialInStream *inStream, - ISequentialOutStream *outStream, - const UInt64 * /* inSize */, const UInt64 * /* outSize */, - ICompressProgressInfo *progress) -{ - if (!_inStream.Create(1 << 20)) - return E_OUTOFMEMORY; - if (!_rangeEncoder.Create(1 << 20)) - return E_OUTOFMEMORY; - if (!_info.SubAllocator.StartSubAllocator(_usedMemorySize)) - return E_OUTOFMEMORY; - - _inStream.SetStream(inStream); - _inStream.Init(); - - _rangeEncoder.SetStream(outStream); - _rangeEncoder.Init(); - - CEncoderFlusher flusher(this); - - _info.MaxOrder = 0; - _info.StartModelRare(_order); - - for (;;) - { - UInt32 size = (1 << 18); - do - { - Byte symbol; - if (!_inStream.ReadByte(symbol)) - { - // here we can write End Mark for stream version. - // In current version this feature is not used. - // _info.EncodeSymbol(-1, &_rangeEncoder); - return S_OK; - } - _info.EncodeSymbol(symbol, &_rangeEncoder); - } - while (--size != 0); - if (progress != NULL) - { - UInt64 inSize = _inStream.GetProcessedSize(); - UInt64 outSize = _rangeEncoder.GetProcessedSize(); - RINOK(progress->SetRatioInfo(&inSize, &outSize)); - } - } -} - -STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - try { return CodeReal(inStream, outStream, inSize, outSize, progress); } - catch(const COutBufferException &e) { return e.ErrorCode; } - catch(const CInBufferException &e) { return e.ErrorCode; } - catch(...) { return E_FAIL; } -} - -}} diff --git a/7zip/Compress/PPMD/PPMDEncoder.h b/7zip/Compress/PPMD/PPMDEncoder.h deleted file mode 100755 index 915180b9..00000000 --- a/7zip/Compress/PPMD/PPMDEncoder.h +++ /dev/null @@ -1,81 +0,0 @@ -// Compress/PPMD/Encoder.h - -#ifndef __COMPRESS_PPMD_ENCODER_H -#define __COMPRESS_PPMD_ENCODER_H - -#include "../../../Common/MyCom.h" - -#include "../../ICoder.h" -#include "../../Common/InBuffer.h" -#include "../RangeCoder/RangeCoder.h" - -#include "PPMDEncode.h" - -namespace NCompress { -namespace NPPMD { - -class CEncoder : - public ICompressCoder, - public ICompressSetCoderProperties, - public ICompressWriteCoderProperties, - public CMyUnknownImp -{ -public: - CInBuffer _inStream; - - NRangeCoder::CEncoder _rangeEncoder; - - CEncodeInfo _info; - UInt32 _usedMemorySize; - Byte _order; - - HRESULT Flush() - { - _rangeEncoder.FlushData(); - return _rangeEncoder.FlushStream(); - } - - void ReleaseStreams() - { - _inStream.ReleaseStream(); - _rangeEncoder.ReleaseStream(); - } - - HRESULT CodeReal(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - class CEncoderFlusher - { - CEncoder *_encoder; - public: - CEncoderFlusher(CEncoder *encoder): _encoder(encoder) {} - ~CEncoderFlusher() - { - _encoder->Flush(); - _encoder->ReleaseStreams(); - } - }; - -public: - - MY_UNKNOWN_IMP2( - ICompressSetCoderProperties, - ICompressWriteCoderProperties) - - STDMETHOD(Code)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - STDMETHOD(SetCoderProperties)(const PROPID *propIDs, - const PROPVARIANT *properties, UInt32 numProperties); - - STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream); - - CEncoder(); - -}; - -}} - -#endif diff --git a/7zip/Compress/PPMD/PPMDSubAlloc.h b/7zip/Compress/PPMD/PPMDSubAlloc.h deleted file mode 100755 index 9b13f933..00000000 --- a/7zip/Compress/PPMD/PPMDSubAlloc.h +++ /dev/null @@ -1,290 +0,0 @@ -// PPMDSubAlloc.h -// This code is based on Dmitry Shkarin's PPMdH code - -#ifndef __PPMD_SUBALLOC_H -#define __PPMD_SUBALLOC_H - -#include "PPMDType.h" - -#include "../../../Common/Alloc.h" - -const UINT N1=4, N2=4, N3=4, N4=(128+3-1*N1-2*N2-3*N3)/4; -const UINT UNIT_SIZE=12, N_INDEXES=N1+N2+N3+N4; - -// Extra 1 * UNIT_SIZE for NULL support -// Extra 2 * UNIT_SIZE for s0 in GlueFreeBlocks() -const UInt32 kExtraSize = (UNIT_SIZE * 3); -const UInt32 kMaxMemBlockSize = 0xFFFFFFFF - kExtraSize; - -struct MEM_BLK -{ - UInt16 Stamp, NU; - UInt32 Next, Prev; - void InsertAt(Byte *Base, UInt32 p) - { - Prev = p; - MEM_BLK *pp = (MEM_BLK *)(Base + p); - Next = pp->Next; - pp->Next = ((MEM_BLK *)(Base + Next))->Prev = (UInt32)((Byte *)this - Base); - } - void Remove(Byte *Base) - { - ((MEM_BLK *)(Base + Prev))->Next = Next; - ((MEM_BLK *)(Base + Next))->Prev = Prev; - } -}; - - -class CSubAllocator -{ - UInt32 SubAllocatorSize; - Byte Indx2Units[N_INDEXES], Units2Indx[128], GlueCount; - UInt32 FreeList[N_INDEXES]; - - Byte *Base; - Byte *HeapStart, *LoUnit, *HiUnit; -public: - Byte *pText, *UnitsStart; - CSubAllocator(): - SubAllocatorSize(0), - GlueCount(0), - LoUnit(0), - HiUnit(0), - pText(0), - UnitsStart(0) - { - memset(Indx2Units, 0, sizeof(Indx2Units)); - memset(FreeList, 0, sizeof(FreeList)); - } - ~CSubAllocator() - { - StopSubAllocator(); - }; - - void *GetPtr(UInt32 offset) const { return (offset == 0) ? 0 : (void *)(Base + offset); } - void *GetPtrNoCheck(UInt32 offset) const { return (void *)(Base + offset); } - UInt32 GetOffset(void *ptr) const { return (ptr == 0) ? 0 : (UInt32)((Byte *)ptr - Base); } - UInt32 GetOffsetNoCheck(void *ptr) const { return (UInt32)((Byte *)ptr - Base); } - MEM_BLK *GetBlk(UInt32 offset) const { return (MEM_BLK *)(Base + offset); } - UInt32 *GetNode(UInt32 offset) const { return (UInt32 *)(Base + offset); } - - void InsertNode(void* p, int indx) - { - *(UInt32 *)p = FreeList[indx]; - FreeList[indx] = GetOffsetNoCheck(p); - } - - void* RemoveNode(int indx) - { - UInt32 offset = FreeList[indx]; - UInt32 *p = GetNode(offset); - FreeList[indx] = *p; - return (void *)p; - } - - UINT U2B(int NU) const { return (UINT)(NU) * UNIT_SIZE; } - - void SplitBlock(void* pv, int oldIndx, int newIndx) - { - int i, UDiff = Indx2Units[oldIndx] - Indx2Units[newIndx]; - Byte* p = ((Byte*)pv) + U2B(Indx2Units[newIndx]); - if (Indx2Units[i = Units2Indx[UDiff-1]] != UDiff) - { - InsertNode(p, --i); - p += U2B(i = Indx2Units[i]); - UDiff -= i; - } - InsertNode(p, Units2Indx[UDiff - 1]); - } - - UInt32 GetUsedMemory() const - { - UInt32 RetVal = SubAllocatorSize - (UInt32)(HiUnit - LoUnit) - (UInt32)(UnitsStart - pText); - for (UInt32 i = 0; i < N_INDEXES; i++) - for (UInt32 pn = FreeList[i]; pn != 0; RetVal -= (UInt32)Indx2Units[i] * UNIT_SIZE) - pn = *GetNode(pn); - return (RetVal >> 2); - } - - void StopSubAllocator() - { - if (SubAllocatorSize != 0) - { - BigFree(Base); - SubAllocatorSize = 0; - Base = 0; - } - } - - bool StartSubAllocator(UInt32 size) - { - if (SubAllocatorSize == size) - return true; - StopSubAllocator(); - if (size == 0) - Base = 0; - else - { - if ((Base = (Byte *)::BigAlloc(size + kExtraSize)) == 0) - return false; - HeapStart = Base + UNIT_SIZE; // we need such code to support NULL; - } - SubAllocatorSize = size; - return true; - } - - void InitSubAllocator() - { - int i, k; - memset(FreeList, 0, sizeof(FreeList)); - HiUnit = (pText = HeapStart) + SubAllocatorSize; - UINT Diff = UNIT_SIZE * (SubAllocatorSize / 8 / UNIT_SIZE * 7); - LoUnit = UnitsStart = HiUnit - Diff; - for (i = 0, k=1; i < N1 ; i++, k += 1) Indx2Units[i] = (Byte)k; - for (k++; i < N1 + N2 ;i++, k += 2) Indx2Units[i] = (Byte)k; - for (k++; i < N1 + N2 + N3 ;i++,k += 3) Indx2Units[i] = (Byte)k; - for (k++; i < N1 + N2 + N3 + N4; i++, k += 4) Indx2Units[i] = (Byte)k; - GlueCount = 0; - for (k = i = 0; k < 128; k++) - { - i += (Indx2Units[i] < k+1); - Units2Indx[k] = (Byte)i; - } - } - - void GlueFreeBlocks() - { - UInt32 s0 = (UInt32)(HeapStart + SubAllocatorSize - Base); - - // We need add exta MEM_BLK with Stamp=0 - GetBlk(s0)->Stamp = 0; - s0 += UNIT_SIZE; - MEM_BLK *ps0 = GetBlk(s0); - - UInt32 p; - int i; - if (LoUnit != HiUnit) - *LoUnit=0; - ps0->Next = ps0->Prev = s0; - - for (i = 0; i < N_INDEXES; i++) - while (FreeList[i] != 0) - { - MEM_BLK *pp = (MEM_BLK *)RemoveNode(i); - pp->InsertAt(Base, s0); - pp->Stamp = 0xFFFF; - pp->NU = Indx2Units[i]; - } - for (p = ps0->Next; p != s0; p = GetBlk(p)->Next) - { - for (;;) - { - MEM_BLK *pp = GetBlk(p); - MEM_BLK *pp1 = GetBlk(p + pp->NU * UNIT_SIZE); - if (pp1->Stamp != 0xFFFF || int(pp->NU) + pp1->NU >= 0x10000) - break; - pp1->Remove(Base); - pp->NU = (UInt16)(pp->NU + pp1->NU); - } - } - while ((p = ps0->Next) != s0) - { - MEM_BLK *pp = GetBlk(p); - pp->Remove(Base); - int sz; - for (sz = pp->NU; sz > 128; sz -= 128, p += 128 * UNIT_SIZE) - InsertNode(Base + p, N_INDEXES - 1); - if (Indx2Units[i = Units2Indx[sz-1]] != sz) - { - int k = sz - Indx2Units[--i]; - InsertNode(Base + p + (sz - k) * UNIT_SIZE, k - 1); - } - InsertNode(Base + p, i); - } - } - void* AllocUnitsRare(int indx) - { - if ( !GlueCount ) - { - GlueCount = 255; - GlueFreeBlocks(); - if (FreeList[indx] != 0) - return RemoveNode(indx); - } - int i = indx; - do - { - if (++i == N_INDEXES) - { - GlueCount--; - i = U2B(Indx2Units[indx]); - return (UnitsStart - pText > i) ? (UnitsStart -= i) : (NULL); - } - } while (FreeList[i] == 0); - void* RetVal = RemoveNode(i); - SplitBlock(RetVal, i, indx); - return RetVal; - } - - void* AllocUnits(int NU) - { - int indx = Units2Indx[NU - 1]; - if (FreeList[indx] != 0) - return RemoveNode(indx); - void* RetVal = LoUnit; - LoUnit += U2B(Indx2Units[indx]); - if (LoUnit <= HiUnit) - return RetVal; - LoUnit -= U2B(Indx2Units[indx]); - return AllocUnitsRare(indx); - } - - void* AllocContext() - { - if (HiUnit != LoUnit) - return (HiUnit -= UNIT_SIZE); - if (FreeList[0] != 0) - return RemoveNode(0); - return AllocUnitsRare(0); - } - - void* ExpandUnits(void* oldPtr, int oldNU) - { - int i0=Units2Indx[oldNU - 1], i1=Units2Indx[oldNU - 1 + 1]; - if (i0 == i1) - return oldPtr; - void* ptr = AllocUnits(oldNU + 1); - if (ptr) - { - memcpy(ptr, oldPtr, U2B(oldNU)); - InsertNode(oldPtr, i0); - } - return ptr; - } - - void* ShrinkUnits(void* oldPtr, int oldNU, int newNU) - { - int i0 = Units2Indx[oldNU - 1], i1 = Units2Indx[newNU - 1]; - if (i0 == i1) - return oldPtr; - if (FreeList[i1] != 0) - { - void* ptr = RemoveNode(i1); - memcpy(ptr, oldPtr, U2B(newNU)); - InsertNode(oldPtr,i0); - return ptr; - } - else - { - SplitBlock(oldPtr, i0, i1); - return oldPtr; - } - } - - void FreeUnits(void* ptr, int oldNU) - { - InsertNode(ptr, Units2Indx[oldNU - 1]); - } -}; - -#endif diff --git a/7zip/Compress/PPMD/PPMDType.h b/7zip/Compress/PPMD/PPMDType.h deleted file mode 100755 index 5200fa54..00000000 --- a/7zip/Compress/PPMD/PPMDType.h +++ /dev/null @@ -1,19 +0,0 @@ -/**************************************************************************** - * This file is part of PPMd project * - * Written and distributed to public domain by Dmitry Shkarin 1997, * - * 1999-2001 * - * Contents: compilation parameters and miscelaneous definitions * - * Comments: system & compiler dependent file - - * modified by Igor Pavlov (2004-08-29). - ****************************************************************************/ -#ifndef __PPMD_TYPE_H -#define __PPMD_TYPE_H - -const int kMaxOrderCompress = 32; -const int MAX_O = 255; /* maximum allowed model order */ - -template -inline void _PPMD_SWAP(T& t1,T& t2) { T tmp = t1; t1 = t2; t2 = tmp; } - -#endif diff --git a/7zip/Compress/PPMD/StdAfx.cpp b/7zip/Compress/PPMD/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Compress/PPMD/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Compress/PPMD/StdAfx.h b/7zip/Compress/PPMD/StdAfx.h deleted file mode 100755 index e7fb6986..00000000 --- a/7zip/Compress/PPMD/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Compress/PPMD/makefile b/7zip/Compress/PPMD/makefile deleted file mode 100755 index 2e687a70..00000000 --- a/7zip/Compress/PPMD/makefile +++ /dev/null @@ -1,41 +0,0 @@ -PROG = PPMd.dll -DEF_FILE = ../Codec.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib - -PPMD_OBJS = \ - $O\DllExports.obj \ - -PPMD_OPT_OBJS = \ - $O\PPMDDecoder.obj \ - $O\PPMDEncoder.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - -7ZIP_COMMON_OBJS = \ - $O\InBuffer.obj \ - $O\OutBuffer.obj \ - $O\StreamUtils.obj \ - - -OBJS = \ - $O\StdAfx.obj \ - $(PPMD_OBJS) \ - $(PPMD_OPT_OBJS) \ - $(COMMON_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $O\resource.res - - -!include "../../../Build.mak" - -$(PPMD_OBJS): $(*B).cpp - $(COMPL) -$(PPMD_OPT_OBJS): $(*B).cpp - $(COMPL_O2) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) - diff --git a/7zip/Compress/PPMD/resource.rc b/7zip/Compress/PPMD/resource.rc deleted file mode 100755 index fed98e19..00000000 --- a/7zip/Compress/PPMD/resource.rc +++ /dev/null @@ -1,3 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("PPMd Codec", "PPMd") diff --git a/7zip/Compress/Quantum/QuantumDecoder.cpp b/7zip/Compress/Quantum/QuantumDecoder.cpp deleted file mode 100755 index 5cf863bb..00000000 --- a/7zip/Compress/Quantum/QuantumDecoder.cpp +++ /dev/null @@ -1,173 +0,0 @@ -// QuantumDecoder.cpp - -#include "StdAfx.h" - -#include "QuantumDecoder.h" -#include "../../../Common/Defs.h" - -namespace NCompress { -namespace NQuantum { - -const UInt32 kDictionarySizeMax = (1 << 21); - -const int kLenIdNeedInit = -2; - -void CDecoder::Init() -{ - m_Selector.Init(kNumSelectors); - for (unsigned int i = 0; i < kNumLitSelectors; i++) - m_Literals[i].Init(kNumLitSymbols); - unsigned int numItems = _numDictBits << 1; - m_PosSlot[0].Init(MyMin(numItems, kNumLen3PosSymbolsMax)); - m_PosSlot[1].Init(MyMin(numItems, kNumLen4PosSymbolsMax)); - m_PosSlot[2].Init(MyMin(numItems, kNumLen5PosSymbolsMax)); - m_LenSlot.Init(kNumLenSymbols); -} - -HRESULT CDecoder::CodeSpec(UInt32 curSize) -{ - if (_remainLen == kLenIdNeedInit) - { - if (!_keepHistory) - { - if (!_outWindowStream.Create(_dictionarySize)) - return E_OUTOFMEMORY; - Init(); - } - if (!_rangeDecoder.Create(1 << 20)) - return E_OUTOFMEMORY; - _rangeDecoder.Init(); - _remainLen = 0; - } - if (curSize == 0) - return S_OK; - - while(_remainLen > 0 && curSize > 0) - { - _remainLen--; - Byte b = _outWindowStream.GetByte(_rep0); - _outWindowStream.PutByte(b); - curSize--; - } - - while(curSize > 0) - { - if (_rangeDecoder.Stream.WasFinished()) - return S_FALSE; - - unsigned int selector = m_Selector.Decode(&_rangeDecoder); - if (selector < kNumLitSelectors) - { - Byte b = (Byte)((selector << (8 - kNumLitSelectorBits)) + m_Literals[selector].Decode(&_rangeDecoder)); - _outWindowStream.PutByte(b); - curSize--; - } - else - { - selector -= kNumLitSelectors; - unsigned int len = selector + kMatchMinLen; - if (selector == 2) - { - unsigned int lenSlot = m_LenSlot.Decode(&_rangeDecoder);; - if (lenSlot >= kNumSimpleLenSlots) - { - lenSlot -= 2; - int numDirectBits = (int)(lenSlot >> 2); - len += ((4 | (lenSlot & 3)) << numDirectBits) - 2; - if (numDirectBits < 6) - len += _rangeDecoder.Stream.ReadBits(numDirectBits); - } - else - len += lenSlot; - } - UInt32 rep0 = m_PosSlot[selector].Decode(&_rangeDecoder);; - if (rep0 >= kNumSimplePosSlots) - { - int numDirectBits = (int)((rep0 >> 1) - 1); - rep0 = ((2 | (rep0 & 1)) << numDirectBits) + _rangeDecoder.Stream.ReadBits(numDirectBits); - } - unsigned int locLen = len; - if (len > curSize) - locLen = (unsigned int)curSize; - if (!_outWindowStream.CopyBlock(rep0, locLen)) - return S_FALSE; - curSize -= locLen; - len -= locLen; - if (len != 0) - { - _remainLen = (int)len; - _rep0 = rep0; - break; - } - } - } - return _rangeDecoder.Stream.WasFinished() ? S_FALSE : S_OK; -} - -HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, - ISequentialOutStream *outStream, - const UInt64 *, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - if (outSize == NULL) - return E_INVALIDARG; - UInt64 size = *outSize; - - SetInStream(inStream); - _outWindowStream.SetStream(outStream); - SetOutStreamSize(outSize); - CDecoderFlusher flusher(this); - - const UInt64 start = _outWindowStream.GetProcessedSize(); - for (;;) - { - UInt32 curSize = 1 << 18; - UInt64 rem = size - (_outWindowStream.GetProcessedSize() - start); - if (curSize > rem) - curSize = (UInt32)rem; - if (curSize == 0) - break; - RINOK(CodeSpec(curSize)); - if (progress != NULL) - { - UInt64 inSize = _rangeDecoder.GetProcessedSize(); - UInt64 nowPos64 = _outWindowStream.GetProcessedSize() - start; - RINOK(progress->SetRatioInfo(&inSize, &nowPos64)); - } - } - flusher.NeedFlush = false; - return Flush(); -} - -STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - try { return CodeReal(inStream, outStream, inSize, outSize, progress); } - catch(const CInBufferException &e) { return e.ErrorCode; } - catch(const CLZOutWindowException &e) { return e.ErrorCode; } - catch(...) { return S_FALSE; } -} - -STDMETHODIMP CDecoder::SetInStream(ISequentialInStream *inStream) -{ - _rangeDecoder.SetStream(inStream); - return S_OK; -} - -STDMETHODIMP CDecoder::ReleaseInStream() -{ - _rangeDecoder.ReleaseStream(); - return S_OK; -} - -STDMETHODIMP CDecoder::SetOutStreamSize(const UInt64 *outSize) -{ - if (outSize == NULL) - return E_FAIL; - _remainLen = kLenIdNeedInit; - _outWindowStream.Init(_keepHistory); - return S_OK; -} - -}} diff --git a/7zip/Compress/Quantum/QuantumDecoder.h b/7zip/Compress/Quantum/QuantumDecoder.h deleted file mode 100755 index 8b5aaaba..00000000 --- a/7zip/Compress/Quantum/QuantumDecoder.h +++ /dev/null @@ -1,287 +0,0 @@ -// QuantumDecoder.h - -#ifndef __QUANTUM_DECODER_H -#define __QUANTUM_DECODER_H - -#include "../../../Common/MyCom.h" - -#include "../../Common/InBuffer.h" -#include "../../ICoder.h" -#include "../LZ/LZOutWindow.h" - -namespace NCompress { -namespace NQuantum { - -class CStreamBitDecoder -{ - UInt32 m_Value; - CInBuffer m_Stream; -public: - bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); } - void SetStream(ISequentialInStream *inStream) { m_Stream.SetStream(inStream);} - void ReleaseStream() { m_Stream.ReleaseStream();} - - void Finish() { m_Value = 0x10000; } - - void Init() - { - m_Stream.Init(); - m_Value = 0x10000; - } - - UInt64 GetProcessedSize() const { return m_Stream.GetProcessedSize(); } - bool WasFinished() const { return m_Stream.WasFinished(); }; - - UInt32 ReadBit() - { - if (m_Value >= 0x10000) - m_Value = 0x100 | m_Stream.ReadByte(); - UInt32 res = (m_Value >> 7) & 1; - m_Value <<= 1; - return res; - } - - UInt32 ReadBits(int numBits) // numBits > 0 - { - UInt32 res = 0; - do - res = (res << 1) | ReadBit(); - while(--numBits != 0); - return res; - } -}; - -const int kNumLitSelectorBits = 2; -const unsigned int kNumLitSelectors = (1 << kNumLitSelectorBits); -const unsigned int kNumLitSymbols = 1 << (8 - kNumLitSelectorBits); -const unsigned int kNumMatchSelectors = 3; -const unsigned int kNumSelectors = kNumLitSelectors + kNumMatchSelectors; -const unsigned int kNumLen3PosSymbolsMax = 24; -const unsigned int kNumLen4PosSymbolsMax = 36; -const unsigned int kNumLen5PosSymbolsMax = 42; -const unsigned int kNumLenSymbols = 27; - -const unsigned int kNumSymbolsMax = kNumLitSymbols; // 64 - -const unsigned int kMatchMinLen = 3; -const unsigned int kNumSimplePosSlots = 4; -const unsigned int kNumSimpleLenSlots = 6; - -namespace NRangeCoder { - -class CDecoder -{ - UInt32 Low; - UInt32 Range; - UInt32 Code; -public: - CStreamBitDecoder Stream; - bool Create(UInt32 bufferSize) { return Stream.Create(bufferSize); } - void SetStream(ISequentialInStream *stream) { Stream.SetStream(stream); } - void ReleaseStream() { Stream.ReleaseStream(); } - - void Init() - { - Stream.Init(); - Low = 0; - Range = 0x10000; - Code = Stream.ReadBits(16); - } - - void Finish() - { - // we need these extra two Bit_reads - Stream.ReadBit(); - Stream.ReadBit(); - Stream.Finish(); - } - - UInt64 GetProcessedSize() const { return Stream.GetProcessedSize(); } - - UInt32 GetThreshold(UInt32 total) const - { - return ((Code + 1) * total - 1) / Range; // & 0xFFFF is not required; - } - - void Decode(UInt32 start, UInt32 end, UInt32 total) - { - UInt32 high = Low + end * Range / total - 1; - UInt32 offset = start * Range / total; - Code -= offset; - Low += offset; - for (;;) - { - if ((Low & 0x8000) != (high & 0x8000)) - { - if ((Low & 0x4000) == 0 || (high & 0x4000) != 0) - break; - Low &= 0x3FFF; - high |= 0x4000; - } - Low = (Low << 1) & 0xFFFF; - high = ((high << 1) | 1) & 0xFFFF; - Code = ((Code << 1) | Stream.ReadBit()); - } - Range = high - Low + 1; - } -}; - -const UInt16 kUpdateStep = 8; -const UInt16 kFreqSumMax = 3800; -const UInt16 kReorderCountStart = 4; -const UInt16 kReorderCount = 50; - -class CModelDecoder -{ - unsigned int NumItems; - unsigned int ReorderCount; - UInt16 Freqs[kNumSymbolsMax + 1]; - Byte Values[kNumSymbolsMax]; -public: - void Init(unsigned int numItems) - { - NumItems = numItems; - ReorderCount = kReorderCountStart; - for(unsigned int i = 0; i < numItems; i++) - { - Freqs[i] = (UInt16)(numItems - i); - Values[i] = (Byte)i; - } - Freqs[numItems] = 0; - } - - unsigned int Decode(CDecoder *rangeDecoder) - { - UInt32 threshold = rangeDecoder->GetThreshold(Freqs[0]); - unsigned int i; - for (i = 1; Freqs[i] > threshold; i++); - rangeDecoder->Decode(Freqs[i], Freqs[i - 1], Freqs[0]); - unsigned int res = Values[--i]; - do - Freqs[i] += kUpdateStep; - while(i-- != 0); - - if (Freqs[0] > kFreqSumMax) - { - if (--ReorderCount == 0) - { - ReorderCount = kReorderCount; - for(i = 0; i < NumItems; i++) - Freqs[i] = (UInt16)(((Freqs[i] - Freqs[i + 1]) + 1) >> 1); - for(i = 0; i < NumItems - 1; i++) - for(unsigned int j = i + 1; j < NumItems; j++) - if (Freqs[i] < Freqs[j]) - { - UInt16 tmpFreq = Freqs[i]; - Byte tmpVal = Values[i]; - Freqs[i] = Freqs[j]; - Values[i] = Values[j]; - Freqs[j] = tmpFreq; - Values[j] = tmpVal; - } - do - Freqs[i] = (UInt16)(Freqs[i] + Freqs[i + 1]); - while(i-- != 0); - } - else - { - i = NumItems - 1; - do - { - Freqs[i] >>= 1; - if (Freqs[i] <= Freqs[i + 1]) - Freqs[i] = (UInt16)(Freqs[i + 1] + 1); - } - while(i-- != 0); - } - } - return res; - }; -}; - -} - -class CDecoder: - public ICompressCoder, - public ICompressSetInStream, - public ICompressSetOutStreamSize, - public CMyUnknownImp -{ - CLZOutWindow _outWindowStream; - NRangeCoder::CDecoder _rangeDecoder; - - /////////////////// - // State - UInt64 _outSize; - // UInt64 _nowPos64; - int _remainLen; // -1 means end of stream. // -2 means need Init - UInt32 _rep0; - - int _numDictBits; - UInt32 _dictionarySize; - - NRangeCoder::CModelDecoder m_Selector; - NRangeCoder::CModelDecoder m_Literals[kNumLitSelectors]; - NRangeCoder::CModelDecoder m_PosSlot[kNumMatchSelectors]; - NRangeCoder::CModelDecoder m_LenSlot; - - bool _keepHistory; - - void Init(); - HRESULT CodeSpec(UInt32 size); -public: - MY_UNKNOWN_IMP2( - ICompressSetInStream, - ICompressSetOutStreamSize) - - void ReleaseStreams() - { - _outWindowStream.ReleaseStream(); - ReleaseInStream(); - } - - class CDecoderFlusher - { - CDecoder *_decoder; - public: - bool NeedFlush; - CDecoderFlusher(CDecoder *decoder): _decoder(decoder), NeedFlush(true) {} - ~CDecoderFlusher() - { - if (NeedFlush) - _decoder->Flush(); - _decoder->ReleaseStreams(); - } - }; - - HRESULT Flush() { return _outWindowStream.Flush(); } - - HRESULT CodeReal(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - STDMETHOD(Code)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - STDMETHOD(SetInStream)(ISequentialInStream *inStream); - STDMETHOD(ReleaseInStream)(); - STDMETHOD(SetOutStreamSize)(const UInt64 *outSize); - - void SetParams(int numDictBits) - { - _numDictBits = numDictBits; - _dictionarySize = (UInt32)1 << numDictBits; - } - void SetKeepHistory(bool keepHistory) - { - _keepHistory = keepHistory; - } - - CDecoder(): _keepHistory(false) {} - virtual ~CDecoder() {} -}; - -}} - -#endif diff --git a/7zip/Compress/RangeCoder/RangeCoder.h b/7zip/Compress/RangeCoder/RangeCoder.h deleted file mode 100755 index bbb2ba82..00000000 --- a/7zip/Compress/RangeCoder/RangeCoder.h +++ /dev/null @@ -1,205 +0,0 @@ -// Compress/RangeCoder/RangeCoder.h - -#ifndef __COMPRESS_RANGECODER_H -#define __COMPRESS_RANGECODER_H - -#include "../../Common/InBuffer.h" -#include "../../Common/OutBuffer.h" - -namespace NCompress { -namespace NRangeCoder { - -const int kNumTopBits = 24; -const UInt32 kTopValue = (1 << kNumTopBits); - -class CEncoder -{ - UInt32 _cacheSize; - Byte _cache; -public: - UInt64 Low; - UInt32 Range; - COutBuffer Stream; - bool Create(UInt32 bufferSize) { return Stream.Create(bufferSize); } - - void SetStream(ISequentialOutStream *stream) { Stream.SetStream(stream); } - void Init() - { - Stream.Init(); - Low = 0; - Range = 0xFFFFFFFF; - _cacheSize = 1; - _cache = 0; - } - - void FlushData() - { - // Low += 1; - for(int i = 0; i < 5; i++) - ShiftLow(); - } - - HRESULT FlushStream() { return Stream.Flush(); } - - void ReleaseStream() { Stream.ReleaseStream(); } - - void Encode(UInt32 start, UInt32 size, UInt32 total) - { - Low += start * (Range /= total); - Range *= size; - while (Range < kTopValue) - { - Range <<= 8; - ShiftLow(); - } - } - - void ShiftLow() - { - if ((UInt32)Low < (UInt32)0xFF000000 || (int)(Low >> 32) != 0) - { - Byte temp = _cache; - do - { - Stream.WriteByte((Byte)(temp + (Byte)(Low >> 32))); - temp = 0xFF; - } - while(--_cacheSize != 0); - _cache = (Byte)((UInt32)Low >> 24); - } - _cacheSize++; - Low = (UInt32)Low << 8; - } - - void EncodeDirectBits(UInt32 value, int numTotalBits) - { - for (int i = numTotalBits - 1; i >= 0; i--) - { - Range >>= 1; - if (((value >> i) & 1) == 1) - Low += Range; - if (Range < kTopValue) - { - Range <<= 8; - ShiftLow(); - } - } - } - - void EncodeBit(UInt32 size0, UInt32 numTotalBits, UInt32 symbol) - { - UInt32 newBound = (Range >> numTotalBits) * size0; - if (symbol == 0) - Range = newBound; - else - { - Low += newBound; - Range -= newBound; - } - while (Range < kTopValue) - { - Range <<= 8; - ShiftLow(); - } - } - - UInt64 GetProcessedSize() { return Stream.GetProcessedSize() + _cacheSize + 4; } -}; - -class CDecoder -{ -public: - CInBuffer Stream; - UInt32 Range; - UInt32 Code; - bool Create(UInt32 bufferSize) { return Stream.Create(bufferSize); } - - void Normalize() - { - while (Range < kTopValue) - { - Code = (Code << 8) | Stream.ReadByte(); - Range <<= 8; - } - } - - void SetStream(ISequentialInStream *stream) { Stream.SetStream(stream); } - void Init() - { - Stream.Init(); - Code = 0; - Range = 0xFFFFFFFF; - for(int i = 0; i < 5; i++) - Code = (Code << 8) | Stream.ReadByte(); - } - - void ReleaseStream() { Stream.ReleaseStream(); } - - UInt32 GetThreshold(UInt32 total) - { - return (Code) / ( Range /= total); - } - - void Decode(UInt32 start, UInt32 size) - { - Code -= start * Range; - Range *= size; - Normalize(); - } - - UInt32 DecodeDirectBits(int numTotalBits) - { - UInt32 range = Range; - UInt32 code = Code; - UInt32 result = 0; - for (int i = numTotalBits; i != 0; i--) - { - range >>= 1; - /* - result <<= 1; - if (code >= range) - { - code -= range; - result |= 1; - } - */ - UInt32 t = (code - range) >> 31; - code -= range & (t - 1); - result = (result << 1) | (1 - t); - - if (range < kTopValue) - { - code = (code << 8) | Stream.ReadByte(); - range <<= 8; - } - } - Range = range; - Code = code; - return result; - } - - UInt32 DecodeBit(UInt32 size0, UInt32 numTotalBits) - { - UInt32 newBound = (Range >> numTotalBits) * size0; - UInt32 symbol; - if (Code < newBound) - { - symbol = 0; - Range = newBound; - } - else - { - symbol = 1; - Code -= newBound; - Range -= newBound; - } - Normalize(); - return symbol; - } - - UInt64 GetProcessedSize() {return Stream.GetProcessedSize(); } -}; - -}} - -#endif diff --git a/7zip/Compress/RangeCoder/RangeCoderBit.cpp b/7zip/Compress/RangeCoder/RangeCoderBit.cpp deleted file mode 100755 index 8e4c4d3a..00000000 --- a/7zip/Compress/RangeCoder/RangeCoderBit.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// Compress/RangeCoder/RangeCoderBit.cpp - -#include "StdAfx.h" - -#include "RangeCoderBit.h" - -namespace NCompress { -namespace NRangeCoder { - -UInt32 CPriceTables::ProbPrices[kBitModelTotal >> kNumMoveReducingBits]; -static CPriceTables g_PriceTables; - -CPriceTables::CPriceTables() { Init(); } - -void CPriceTables::Init() -{ - const int kNumBits = (kNumBitModelTotalBits - kNumMoveReducingBits); - for(int i = kNumBits - 1; i >= 0; i--) - { - UInt32 start = 1 << (kNumBits - i - 1); - UInt32 end = 1 << (kNumBits - i); - for (UInt32 j = start; j < end; j++) - ProbPrices[j] = (i << kNumBitPriceShiftBits) + - (((end - j) << kNumBitPriceShiftBits) >> (kNumBits - i - 1)); - } - - /* - // simplest: bad solution - for(UInt32 i = 1; i < (kBitModelTotal >> kNumMoveReducingBits) - 1; i++) - ProbPrices[i] = kBitPrice; - */ - - /* - const double kDummyMultMid = (1.0 / kBitPrice) / 2; - const double kDummyMultMid = 0; - // float solution - double ln2 = log(double(2)); - double lnAll = log(double(kBitModelTotal >> kNumMoveReducingBits)); - for(UInt32 i = 1; i < (kBitModelTotal >> kNumMoveReducingBits) - 1; i++) - ProbPrices[i] = UInt32((fabs(lnAll - log(double(i))) / ln2 + kDummyMultMid) * kBitPrice); - */ - - /* - // experimental, slow, solution: - for(UInt32 i = 1; i < (kBitModelTotal >> kNumMoveReducingBits) - 1; i++) - { - const int kCyclesBits = 5; - const UInt32 kCycles = (1 << kCyclesBits); - - UInt32 range = UInt32(-1); - UInt32 bitCount = 0; - for (UInt32 j = 0; j < kCycles; j++) - { - range >>= (kNumBitModelTotalBits - kNumMoveReducingBits); - range *= i; - while(range < (1 << 31)) - { - range <<= 1; - bitCount++; - } - } - bitCount <<= kNumBitPriceShiftBits; - range -= (1 << 31); - for (int k = kNumBitPriceShiftBits - 1; k >= 0; k--) - { - range <<= 1; - if (range > (1 << 31)) - { - bitCount += (1 << k); - range -= (1 << 31); - } - } - ProbPrices[i] = (bitCount - // + (1 << (kCyclesBits - 1)) - ) >> kCyclesBits; - } - */ -} - -}} diff --git a/7zip/Compress/RangeCoder/RangeCoderBit.h b/7zip/Compress/RangeCoder/RangeCoderBit.h deleted file mode 100755 index 624f887c..00000000 --- a/7zip/Compress/RangeCoder/RangeCoderBit.h +++ /dev/null @@ -1,120 +0,0 @@ -// Compress/RangeCoder/RangeCoderBit.h - -#ifndef __COMPRESS_RANGECODER_BIT_H -#define __COMPRESS_RANGECODER_BIT_H - -#include "RangeCoder.h" - -namespace NCompress { -namespace NRangeCoder { - -const int kNumBitModelTotalBits = 11; -const UInt32 kBitModelTotal = (1 << kNumBitModelTotalBits); - -const int kNumMoveReducingBits = 2; - -const int kNumBitPriceShiftBits = 6; -const UInt32 kBitPrice = 1 << kNumBitPriceShiftBits; - -class CPriceTables -{ -public: - static UInt32 ProbPrices[kBitModelTotal >> kNumMoveReducingBits]; - static void Init(); - CPriceTables(); -}; - -template -class CBitModel -{ -public: - UInt32 Prob; - void UpdateModel(UInt32 symbol) - { - /* - Prob -= (Prob + ((symbol - 1) & ((1 << numMoveBits) - 1))) >> numMoveBits; - Prob += (1 - symbol) << (kNumBitModelTotalBits - numMoveBits); - */ - if (symbol == 0) - Prob += (kBitModelTotal - Prob) >> numMoveBits; - else - Prob -= (Prob) >> numMoveBits; - } -public: - void Init() { Prob = kBitModelTotal / 2; } -}; - -template -class CBitEncoder: public CBitModel -{ -public: - void Encode(CEncoder *encoder, UInt32 symbol) - { - /* - encoder->EncodeBit(this->Prob, kNumBitModelTotalBits, symbol); - this->UpdateModel(symbol); - */ - UInt32 newBound = (encoder->Range >> kNumBitModelTotalBits) * this->Prob; - if (symbol == 0) - { - encoder->Range = newBound; - this->Prob += (kBitModelTotal - this->Prob) >> numMoveBits; - } - else - { - encoder->Low += newBound; - encoder->Range -= newBound; - this->Prob -= (this->Prob) >> numMoveBits; - } - if (encoder->Range < kTopValue) - { - encoder->Range <<= 8; - encoder->ShiftLow(); - } - } - UInt32 GetPrice(UInt32 symbol) const - { - return CPriceTables::ProbPrices[ - (((this->Prob - symbol) ^ ((-(int)symbol))) & (kBitModelTotal - 1)) >> kNumMoveReducingBits]; - } - UInt32 GetPrice0() const { return CPriceTables::ProbPrices[this->Prob >> kNumMoveReducingBits]; } - UInt32 GetPrice1() const { return CPriceTables::ProbPrices[(kBitModelTotal - this->Prob) >> kNumMoveReducingBits]; } -}; - - -template -class CBitDecoder: public CBitModel -{ -public: - UInt32 Decode(CDecoder *decoder) - { - UInt32 newBound = (decoder->Range >> kNumBitModelTotalBits) * this->Prob; - if (decoder->Code < newBound) - { - decoder->Range = newBound; - this->Prob += (kBitModelTotal - this->Prob) >> numMoveBits; - if (decoder->Range < kTopValue) - { - decoder->Code = (decoder->Code << 8) | decoder->Stream.ReadByte(); - decoder->Range <<= 8; - } - return 0; - } - else - { - decoder->Range -= newBound; - decoder->Code -= newBound; - this->Prob -= (this->Prob) >> numMoveBits; - if (decoder->Range < kTopValue) - { - decoder->Code = (decoder->Code << 8) | decoder->Stream.ReadByte(); - decoder->Range <<= 8; - } - return 1; - } - } -}; - -}} - -#endif diff --git a/7zip/Compress/RangeCoder/RangeCoderBitTree.h b/7zip/Compress/RangeCoder/RangeCoderBitTree.h deleted file mode 100755 index 4f0c78b4..00000000 --- a/7zip/Compress/RangeCoder/RangeCoderBitTree.h +++ /dev/null @@ -1,161 +0,0 @@ -// Compress/RangeCoder/RangeCoderBitTree.h - -#ifndef __COMPRESS_RANGECODER_BIT_TREE_H -#define __COMPRESS_RANGECODER_BIT_TREE_H - -#include "RangeCoderBit.h" -#include "RangeCoderOpt.h" - -namespace NCompress { -namespace NRangeCoder { - -template -class CBitTreeEncoder -{ - CBitEncoder Models[1 << NumBitLevels]; -public: - void Init() - { - for(UInt32 i = 1; i < (1 << NumBitLevels); i++) - Models[i].Init(); - } - void Encode(CEncoder *rangeEncoder, UInt32 symbol) - { - UInt32 modelIndex = 1; - for (int bitIndex = NumBitLevels; bitIndex != 0 ;) - { - bitIndex--; - UInt32 bit = (symbol >> bitIndex) & 1; - Models[modelIndex].Encode(rangeEncoder, bit); - modelIndex = (modelIndex << 1) | bit; - } - }; - void ReverseEncode(CEncoder *rangeEncoder, UInt32 symbol) - { - UInt32 modelIndex = 1; - for (int i = 0; i < NumBitLevels; i++) - { - UInt32 bit = symbol & 1; - Models[modelIndex].Encode(rangeEncoder, bit); - modelIndex = (modelIndex << 1) | bit; - symbol >>= 1; - } - } - UInt32 GetPrice(UInt32 symbol) const - { - symbol |= (1 << NumBitLevels); - UInt32 price = 0; - while (symbol != 1) - { - price += Models[symbol >> 1].GetPrice(symbol & 1); - symbol >>= 1; - } - return price; - } - UInt32 ReverseGetPrice(UInt32 symbol) const - { - UInt32 price = 0; - UInt32 modelIndex = 1; - for (int i = NumBitLevels; i != 0; i--) - { - UInt32 bit = symbol & 1; - symbol >>= 1; - price += Models[modelIndex].GetPrice(bit); - modelIndex = (modelIndex << 1) | bit; - } - return price; - } -}; - -template -class CBitTreeDecoder -{ - CBitDecoder Models[1 << NumBitLevels]; -public: - void Init() - { - for(UInt32 i = 1; i < (1 << NumBitLevels); i++) - Models[i].Init(); - } - UInt32 Decode(CDecoder *rangeDecoder) - { - UInt32 modelIndex = 1; - RC_INIT_VAR - for(int bitIndex = NumBitLevels; bitIndex != 0; bitIndex--) - { - // modelIndex = (modelIndex << 1) + Models[modelIndex].Decode(rangeDecoder); - RC_GETBIT(numMoveBits, Models[modelIndex].Prob, modelIndex) - } - RC_FLUSH_VAR - return modelIndex - (1 << NumBitLevels); - }; - UInt32 ReverseDecode(CDecoder *rangeDecoder) - { - UInt32 modelIndex = 1; - UInt32 symbol = 0; - RC_INIT_VAR - for(int bitIndex = 0; bitIndex < NumBitLevels; bitIndex++) - { - // UInt32 bit = Models[modelIndex].Decode(rangeDecoder); - // modelIndex <<= 1; - // modelIndex += bit; - // symbol |= (bit << bitIndex); - RC_GETBIT2(numMoveBits, Models[modelIndex].Prob, modelIndex, ; , symbol |= (1 << bitIndex)) - } - RC_FLUSH_VAR - return symbol; - } -}; - -template -void ReverseBitTreeEncode(CBitEncoder *Models, - CEncoder *rangeEncoder, int NumBitLevels, UInt32 symbol) -{ - UInt32 modelIndex = 1; - for (int i = 0; i < NumBitLevels; i++) - { - UInt32 bit = symbol & 1; - Models[modelIndex].Encode(rangeEncoder, bit); - modelIndex = (modelIndex << 1) | bit; - symbol >>= 1; - } -} - -template -UInt32 ReverseBitTreeGetPrice(CBitEncoder *Models, - UInt32 NumBitLevels, UInt32 symbol) -{ - UInt32 price = 0; - UInt32 modelIndex = 1; - for (int i = NumBitLevels; i != 0; i--) - { - UInt32 bit = symbol & 1; - symbol >>= 1; - price += Models[modelIndex].GetPrice(bit); - modelIndex = (modelIndex << 1) | bit; - } - return price; -} - -template -UInt32 ReverseBitTreeDecode(CBitDecoder *Models, - CDecoder *rangeDecoder, int NumBitLevels) -{ - UInt32 modelIndex = 1; - UInt32 symbol = 0; - RC_INIT_VAR - for(int bitIndex = 0; bitIndex < NumBitLevels; bitIndex++) - { - // UInt32 bit = Models[modelIndex].Decode(rangeDecoder); - // modelIndex <<= 1; - // modelIndex += bit; - // symbol |= (bit << bitIndex); - RC_GETBIT2(numMoveBits, Models[modelIndex].Prob, modelIndex, ; , symbol |= (1 << bitIndex)) - } - RC_FLUSH_VAR - return symbol; -} - -}} - -#endif diff --git a/7zip/Compress/RangeCoder/RangeCoderOpt.h b/7zip/Compress/RangeCoder/RangeCoderOpt.h deleted file mode 100755 index 668b9a5b..00000000 --- a/7zip/Compress/RangeCoder/RangeCoderOpt.h +++ /dev/null @@ -1,31 +0,0 @@ -// Compress/RangeCoder/RangeCoderOpt.h - -#ifndef __COMPRESS_RANGECODER_OPT_H -#define __COMPRESS_RANGECODER_OPT_H - -#define RC_INIT_VAR \ - UInt32 range = rangeDecoder->Range; \ - UInt32 code = rangeDecoder->Code; - -#define RC_FLUSH_VAR \ - rangeDecoder->Range = range; \ - rangeDecoder->Code = code; - -#define RC_NORMALIZE \ - if (range < NCompress::NRangeCoder::kTopValue) \ - { code = (code << 8) | rangeDecoder->Stream.ReadByte(); range <<= 8; } - -#define RC_GETBIT2(numMoveBits, prob, mi, A0, A1) \ - { UInt32 bound = (range >> NCompress::NRangeCoder::kNumBitModelTotalBits) * prob; \ - if (code < bound) \ - { A0; range = bound; \ - prob += (NCompress::NRangeCoder::kBitModelTotal - prob) >> numMoveBits; \ - mi <<= 1; } \ - else \ - { A1; range -= bound; code -= bound; prob -= (prob) >> numMoveBits; \ - mi = (mi + mi) + 1; }} \ - RC_NORMALIZE - -#define RC_GETBIT(numMoveBits, prob, mi) RC_GETBIT2(numMoveBits, prob, mi, ; , ;) - -#endif diff --git a/7zip/Compress/RangeCoder/StdAfx.h b/7zip/Compress/RangeCoder/StdAfx.h deleted file mode 100755 index b637fd40..00000000 --- a/7zip/Compress/RangeCoder/StdAfx.h +++ /dev/null @@ -1,6 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#endif diff --git a/7zip/Compress/Rar20/DllExports.cpp b/7zip/Compress/Rar20/DllExports.cpp deleted file mode 100755 index 599d71c3..00000000 --- a/7zip/Compress/Rar20/DllExports.cpp +++ /dev/null @@ -1,66 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" - -#include "Rar20Decoder.h" - -// {23170F69-40C1-278B-0403-020000000000} -DEFINE_GUID(CLSID_CCompressRar20Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - return TRUE; -} - -STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*clsid != CLSID_CCompressRar20Decoder) - return CLASS_E_CLASSNOTAVAILABLE; - if (*iid != IID_ICompressCoder) - return E_NOINTERFACE; - CMyComPtr coder = (ICompressCoder *)new - NCompress::NRar20::CDecoder; - *outObject = coder.Detach(); - COM_TRY_END - return S_OK; -} - -STDAPI GetNumberOfMethods(UINT32 *numMethods) -{ - *numMethods = 1; - return S_OK; -} - -STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value) -{ - if (index != 0) - return E_INVALIDARG; - ::VariantClear((tagVARIANT *)value); - switch(propID) - { - case NMethodPropID::kID: - { - const char id[] = { 0x04, 0x03, 0x02 }; - if ((value->bstrVal = ::SysAllocStringByteLen(id, sizeof(id))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NMethodPropID::kName: - if ((value->bstrVal = ::SysAllocString(L"Rar20")) != 0) - value->vt = VT_BSTR; - return S_OK; - case NMethodPropID::kDecoder: - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CCompressRar20Decoder, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - return S_OK; -} diff --git a/7zip/Compress/Rar20/Rar20Const.h b/7zip/Compress/Rar20/Rar20Const.h deleted file mode 100755 index 6c5fecb6..00000000 --- a/7zip/Compress/Rar20/Rar20Const.h +++ /dev/null @@ -1,65 +0,0 @@ -// Rar20CoderConst.h -// According to unRAR license, -// this code may not be used to develop a -// RAR (WinRAR) compatible archiver - -#ifndef __RAR20_CONST_H -#define __RAR20_CONST_H - -#include "Rar20ExtConst.h" - -namespace NCompress { -namespace NRar20 { - -const UInt32 kMainTableSize = 298; -const UInt32 kLenTableSize = 28; - -const UInt32 kDistTableStart = kMainTableSize; -const UInt32 kLenTableStart = kDistTableStart + kDistTableSize; - -const UInt32 kHeapTablesSizesSum = kMainTableSize + kDistTableSize + kLenTableSize; - -const UInt32 kLevelTableSize = 19; - -const UInt32 kMMTablesSizesSum = kMMTableSize * 4; - -const UInt32 kMaxTableSize = kMMTablesSizesSum; - -const UInt32 kTableDirectLevels = 16; -const UInt32 kTableLevelRepNumber = kTableDirectLevels; -const UInt32 kTableLevel0Number = kTableLevelRepNumber + 1; -const UInt32 kTableLevel0Number2 = kTableLevel0Number + 1; - -const UInt32 kLevelMask = 0xF; - - -const UInt32 kRepBothNumber = 256; -const UInt32 kRepNumber = kRepBothNumber + 1; -const UInt32 kLen2Number = kRepNumber + 4; - -const UInt32 kLen2NumNumbers = 8; -const UInt32 kReadTableNumber = kLen2Number + kLen2NumNumbers; -const UInt32 kMatchNumber = kReadTableNumber + 1; - -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}; -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}; - -const UInt32 kDistStart[kDistTableSize] = {0,1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096,6144,8192,12288,16384,24576,32768U,49152U,65536,98304,131072,196608,262144,327680,393216,458752,524288,589824,655360,720896,786432,851968,917504,983040}; -const Byte kDistDirectBits[kDistTableSize] = {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, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16}; - -const Byte kLevelDirectBits[kLevelTableSize] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7}; - -const Byte kLen2DistStarts[kLen2NumNumbers]={0,4,8,16,32,64,128,192}; -const Byte kLen2DistDirectBits[kLen2NumNumbers]={2,2,3, 4, 5, 6, 6, 6}; - -const UInt32 kDistLimit2 = 0x101 - 1; -const UInt32 kDistLimit3 = 0x2000 - 1; -const UInt32 kDistLimit4 = 0x40000 - 1; - -const UInt32 kMatchMaxLen = 255 + 2; -const UInt32 kMatchMaxLenMax = 255 + 5; -const UInt32 kNormalMatchMinLen = 3; - -}} - -#endif diff --git a/7zip/Compress/Rar20/Rar20Decoder.cpp b/7zip/Compress/Rar20/Rar20Decoder.cpp deleted file mode 100755 index f990811f..00000000 --- a/7zip/Compress/Rar20/Rar20Decoder.cpp +++ /dev/null @@ -1,322 +0,0 @@ -// Rar20Decoder.cpp -// According to unRAR license, -// this code may not be used to develop a -// RAR (WinRAR) compatible archiver - -#include "StdAfx.h" - -#include "Rar20Decoder.h" -#include "Rar20Const.h" - -namespace NCompress { -namespace NRar20 { - -class CException -{ -public: - enum ECauseType - { - kData - } Cause; - CException(ECauseType cause): Cause(cause) {} -}; - -static const char *kNumberErrorMessage = "Number error"; - -static const UInt32 kHistorySize = 1 << 20; - -static const int kNumStats = 11; - -static const UInt32 kWindowReservSize = (1 << 22) + 256; - -CDecoder::CDecoder(): - m_IsSolid(false) -{ -} - -void CDecoder::InitStructures() -{ - m_Predictor.Init(); - for(int i = 0; i < kNumRepDists; i++) - m_RepDists[i] = 0; - m_RepDistPtr = 0; - m_LastLength = 0; - memset(m_LastLevels, 0, kMaxTableSize); -} - -#define RIF(x) { if (!(x)) return false; } - -bool CDecoder::ReadTables(void) -{ - Byte levelLevels[kLevelTableSize]; - Byte newLevels[kMaxTableSize]; - m_AudioMode = (m_InBitStream.ReadBits(1) == 1); - - if (m_InBitStream.ReadBits(1) == 0) - memset(m_LastLevels, 0, kMaxTableSize); - int numLevels; - if (m_AudioMode) - { - m_NumChannels = m_InBitStream.ReadBits(2) + 1; - if (m_Predictor.CurrentChannel >= m_NumChannels) - m_Predictor.CurrentChannel = 0; - numLevels = m_NumChannels * kMMTableSize; - } - else - numLevels = kHeapTablesSizesSum; - - int i; - for (i = 0; i < kLevelTableSize; i++) - levelLevels[i] = Byte(m_InBitStream.ReadBits(4)); - RIF(m_LevelDecoder.SetCodeLengths(levelLevels)); - i = 0; - while (i < numLevels) - { - UInt32 number = m_LevelDecoder.DecodeSymbol(&m_InBitStream); - if (number < kTableDirectLevels) - { - newLevels[i] = Byte((number + m_LastLevels[i]) & kLevelMask); - i++; - } - else - { - if (number == kTableLevelRepNumber) - { - int t = m_InBitStream.ReadBits(2) + 3; - for (int reps = t; reps > 0 && i < numLevels ; reps--, i++) - newLevels[i] = newLevels[i - 1]; - } - else - { - int num; - if (number == kTableLevel0Number) - num = m_InBitStream.ReadBits(3) + 3; - else if (number == kTableLevel0Number2) - num = m_InBitStream.ReadBits(7) + 11; - else - return false; - for (;num > 0 && i < numLevels; num--) - newLevels[i++] = 0; - } - } - } - if (m_AudioMode) - for (i = 0; i < m_NumChannels; i++) - { - RIF(m_MMDecoders[i].SetCodeLengths(&newLevels[i * kMMTableSize])); - } - else - { - RIF(m_MainDecoder.SetCodeLengths(&newLevels[0])); - RIF(m_DistDecoder.SetCodeLengths(&newLevels[kMainTableSize])); - RIF(m_LenDecoder.SetCodeLengths(&newLevels[kMainTableSize + kDistTableSize])); - } - memcpy(m_LastLevels, newLevels, kMaxTableSize); - return true; -} - -bool CDecoder::ReadLastTables() -{ - // it differs a little from pure RAR sources; - // UInt64 ttt = m_InBitStream.GetProcessedSize() + 2; - // + 2 works for: return 0xFF; in CInBuffer::ReadByte. - if (m_InBitStream.GetProcessedSize() + 7 <= m_PackSize) // test it: probably incorrect; - // if (m_InBitStream.GetProcessedSize() + 2 <= m_PackSize) // test it: probably incorrect; - if (m_AudioMode) - { - UInt32 symbol = m_MMDecoders[m_Predictor.CurrentChannel].DecodeSymbol(&m_InBitStream); - if (symbol == 256) - return ReadTables(); - if (symbol >= kMMTableSize) - return false; - } - else - { - UInt32 number = m_MainDecoder.DecodeSymbol(&m_InBitStream); - if (number == kReadTableNumber) - return ReadTables(); - if (number >= kMainTableSize) - return false; - } - return true; -} - -class CCoderReleaser -{ - CDecoder *m_Coder; -public: - CCoderReleaser(CDecoder *coder): m_Coder(coder) {} - ~CCoderReleaser() - { - m_Coder->ReleaseStreams(); - } -}; - -STDMETHODIMP CDecoder::CodeReal(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - if (inSize == NULL || outSize == NULL) - return E_INVALIDARG; - - if (!m_OutWindowStream.Create(kHistorySize)) - return E_OUTOFMEMORY; - if (!m_InBitStream.Create(1 << 20)) - return E_OUTOFMEMORY; - - m_PackSize = *inSize; - - UInt64 pos = 0, unPackSize = *outSize; - - m_OutWindowStream.SetStream(outStream); - m_OutWindowStream.Init(m_IsSolid); - m_InBitStream.SetStream(inStream); - m_InBitStream.Init(); - - CCoderReleaser coderReleaser(this); - if (!m_IsSolid) - { - InitStructures(); - if (unPackSize == 0) - { - if (m_InBitStream.GetProcessedSize() + 2 <= m_PackSize) // test it: probably incorrect; - if (!ReadTables()) - return S_FALSE; - return S_OK; - } - if (!ReadTables()) - return S_FALSE; - } - - while(pos < unPackSize) - { - if (m_AudioMode) - while(pos < unPackSize) - { - UInt32 symbol = m_MMDecoders[m_Predictor.CurrentChannel].DecodeSymbol(&m_InBitStream); - if (symbol == 256) - { - if (progress != 0) - { - UInt64 packSize = m_InBitStream.GetProcessedSize(); - RINOK(progress->SetRatioInfo(&packSize, &pos)); - } - if (!ReadTables()) - return S_FALSE; - break; - } - if (symbol >= kMMTableSize) - return S_FALSE; - Byte byPredict = m_Predictor.Predict(); - Byte byReal = (Byte)(byPredict - (Byte)symbol); - m_Predictor.Update(byReal, byPredict); - m_OutWindowStream.PutByte(byReal); - if (++m_Predictor.CurrentChannel == m_NumChannels) - m_Predictor.CurrentChannel = 0; - pos++; - } - else - while(pos < unPackSize) - { - UInt32 number = m_MainDecoder.DecodeSymbol(&m_InBitStream); - UInt32 length, distance; - if (number < 256) - { - m_OutWindowStream.PutByte(Byte(number)); - pos++; - continue; - } - else if (number >= kMatchNumber) - { - number -= kMatchNumber; - length = kNormalMatchMinLen + UInt32(kLenStart[number]) + - m_InBitStream.ReadBits(kLenDirectBits[number]); - number = m_DistDecoder.DecodeSymbol(&m_InBitStream); - if (number >= kDistTableSize) - return S_FALSE; - distance = kDistStart[number] + m_InBitStream.ReadBits(kDistDirectBits[number]); - if (distance >= kDistLimit3) - { - length += 2 - ((distance - kDistLimit4) >> 31); - // length++; - // if (distance >= kDistLimit4) - // length++; - } - } - else if (number == kRepBothNumber) - { - length = m_LastLength; - distance = m_RepDists[(m_RepDistPtr + 4 - 1) & 3]; - } - else if (number < kLen2Number) - { - distance = m_RepDists[(m_RepDistPtr - (number - kRepNumber + 1)) & 3]; - number = m_LenDecoder.DecodeSymbol(&m_InBitStream); - if (number >= kLenTableSize) - return S_FALSE; - length = 2 + kLenStart[number] + m_InBitStream.ReadBits(kLenDirectBits[number]); - if (distance >= kDistLimit2) - { - length++; - if (distance >= kDistLimit3) - { - length += 2 - ((distance - kDistLimit4) >> 31); - // length++; - // if (distance >= kDistLimit4) - // length++; - } - } - } - else if (number < kReadTableNumber) - { - number -= kLen2Number; - distance = kLen2DistStarts[number] + - m_InBitStream.ReadBits(kLen2DistDirectBits[number]); - length = 2; - } - else if (number == kReadTableNumber) - { - if (progress != 0) - { - UInt64 packSize = m_InBitStream.GetProcessedSize(); - RINOK(progress->SetRatioInfo(&packSize, &pos)); - } - if (!ReadTables()) - return S_FALSE; - break; - } - else - return S_FALSE; - m_RepDists[m_RepDistPtr++ & 3] = distance; - m_LastLength = length; - if (!m_OutWindowStream.CopyBlock(distance, length)) - return S_FALSE; - pos += length; - } - } - if (pos > unPackSize) - throw CException(CException::kData); - - if (!ReadLastTables()) - return S_FALSE; - return m_OutWindowStream.Flush(); -} - -STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - try { return CodeReal(inStream, outStream, inSize, outSize, progress); } - catch(const CLZOutWindowException &e) { return e.ErrorCode; } - catch(...) { return S_FALSE; } -} - -STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *data, UInt32 size) -{ - if (size < 1) - return E_INVALIDARG; - m_IsSolid = (data[0] != 0); - return S_OK; -} - -}} diff --git a/7zip/Compress/Rar20/Rar20Decoder.h b/7zip/Compress/Rar20/Rar20Decoder.h deleted file mode 100755 index f807594c..00000000 --- a/7zip/Compress/Rar20/Rar20Decoder.h +++ /dev/null @@ -1,85 +0,0 @@ -// Rar20Decoder.h -// According to unRAR license, -// this code may not be used to develop a -// RAR (WinRAR) compatible archiver - -#ifndef __RAR20_DECODER_H -#define __RAR20_DECODER_H - -#include "../../../Common/MyCom.h" - -#include "../../ICoder.h" -#include "../../Common/MSBFDecoder.h" -#include "../../Common/InBuffer.h" - -#include "../LZ/LZOutWindow.h" -#include "../Huffman/HuffmanDecoder.h" - -#include "Rar20Multimedia.h" -#include "Rar20Const.h" - -namespace NCompress { -namespace NRar20 { - -typedef NStream::NMSBF::CDecoder CBitDecoder; - -const int kNumHuffmanBits = 15; - -class CDecoder : - public ICompressCoder, - public ICompressSetDecoderProperties2, - public CMyUnknownImp -{ - CLZOutWindow m_OutWindowStream; - CBitDecoder m_InBitStream; - NHuffman::CDecoder m_MainDecoder; - NHuffman::CDecoder m_DistDecoder; - NHuffman::CDecoder m_LenDecoder; - NHuffman::CDecoder m_MMDecoders[NMultimedia::kNumChanelsMax]; - NHuffman::CDecoder m_LevelDecoder; - - bool m_AudioMode; - - NMultimedia::CPredictor m_Predictor; - int m_NumChannels; - - UInt32 m_RepDists[kNumRepDists]; - UInt32 m_RepDistPtr; - - UInt32 m_LastLength; - - Byte m_LastLevels[kMaxTableSize]; - - UInt64 m_PackSize; - bool m_IsSolid; - - void InitStructures(); - bool ReadTables(); - bool ReadLastTables(); - -public: - CDecoder(); - - MY_UNKNOWN_IMP1(ICompressSetDecoderProperties2) - - void ReleaseStreams() - { - m_OutWindowStream.ReleaseStream(); - m_InBitStream.ReleaseStream(); - } - - STDMETHOD(CodeReal)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - STDMETHOD(Code)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - - STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size); - -}; - -}} - -#endif diff --git a/7zip/Compress/Rar20/Rar20ExtConst.h b/7zip/Compress/Rar20/Rar20ExtConst.h deleted file mode 100755 index b74bc0cf..00000000 --- a/7zip/Compress/Rar20/Rar20ExtConst.h +++ /dev/null @@ -1,21 +0,0 @@ -// Rar20ExtConst.h -// According to unRAR license, -// this code may not be used to develop a -// RAR (WinRAR) compatible archiver - -#ifndef __RAR20_EXTCONST_H -#define __RAR20_EXTCONST_H - -#include "../../../Common/Types.h" - -namespace NCompress { -namespace NRar20 { - -const UInt32 kNumRepDists = 4; -const UInt32 kDistTableSize = 48; - -const int kMMTableSize = 256 + 1; - -}} - -#endif diff --git a/7zip/Compress/Rar20/Rar20Multimedia.cpp b/7zip/Compress/Rar20/Rar20Multimedia.cpp deleted file mode 100755 index 3c0a13af..00000000 --- a/7zip/Compress/Rar20/Rar20Multimedia.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// Rar20Multimedia.cpp -// According to unRAR license, -// this code may not be used to develop a -// RAR (WinRAR) compatible archiver - -#include "StdAfx.h" - -#include "Rar20Multimedia.h" - -namespace NCompress { -namespace NRar20 { -namespace NMultimedia { - -void CAudioVariables::Init() -{ - memset(this, 0, sizeof(CAudioVariables)); -} - -void CPredictor::Init() -{ - for(int i = 0; i < kNumChanelsMax; i++) - m_AudioVariablesArray[i].Init(); - m_ChannelDelta = 0; - CurrentChannel = 0; -} - -Byte CPredictor::Predict() -{ - CAudioVariables *v = &m_AudioVariablesArray[CurrentChannel]; - v->ByteCount++; - v->D4 = v->D3; - v->D3 = v->D2; - v->D2 = v->LastDelta-v->D1; - v->D1 = v->LastDelta; - int pCh = 8 * v->LastChar + - v->K1 * v->D1 + - v->K2 * v->D2 + - v->K3 * v->D3 + - v->K4 * v->D4 + - v->K5*m_ChannelDelta; - pCh = (pCh >> 3) & 0xFF; - return Byte(pCh); -} - -void CPredictor::Update(Byte realValue, int predictedValue) -{ - struct CAudioVariables *v = &m_AudioVariablesArray[CurrentChannel]; - - int delta = predictedValue - realValue; - int i = ((signed char)delta) << 3; - - v->Dif[0] += abs(i); - v->Dif[1] += abs(i - v->D1); - v->Dif[2] += abs(i + v->D1); - v->Dif[3] += abs(i - v->D2); - v->Dif[4] += abs(i + v->D2); - v->Dif[5] += abs(i - v->D3); - v->Dif[6] += abs(i + v->D3); - v->Dif[7] += abs(i - v->D4); - v->Dif[8] += abs(i + v->D4); - v->Dif[9] += abs(i - m_ChannelDelta); - v->Dif[10] += abs(i + m_ChannelDelta); - - m_ChannelDelta = v->LastDelta = (signed char)(realValue - v->LastChar); - v->LastChar = realValue; - - UInt32 numMinDif, minDif; - if ((v->ByteCount & 0x1F)==0) - { - minDif = v->Dif[0]; - numMinDif = 0; - v->Dif[0] = 0; - for (i = 1; i < sizeof(v->Dif) / sizeof(v->Dif[0]); i++) - { - if (v->Dif[i] < minDif) - { - minDif = v->Dif[i]; - numMinDif = i; - } - v->Dif[i] = 0; - } - switch(numMinDif) - { - case 1: - if (v->K1 >= -16) - v->K1--; - break; - case 2: - if (v->K1 < 16) - v->K1++; - break; - case 3: - if (v->K2 >= -16) - v->K2--; - break; - case 4: - if (v->K2 < 16) - v->K2++; - break; - case 5: - if (v->K3 >= -16) - v->K3--; - break; - case 6: - if (v->K3 < 16) - v->K3++; - break; - case 7: - if (v->K4 >= -16) - v->K4--; - break; - case 8: - if (v->K4 < 16) - v->K4++; - break; - case 9: - if (v->K5 >= -16) - v->K5--; - break; - case 10: - if (v->K5 < 16) - v->K5++; - break; - } - } -} - -}}} diff --git a/7zip/Compress/Rar20/Rar20Multimedia.h b/7zip/Compress/Rar20/Rar20Multimedia.h deleted file mode 100755 index 7af86d07..00000000 --- a/7zip/Compress/Rar20/Rar20Multimedia.h +++ /dev/null @@ -1,43 +0,0 @@ -// Rar20Multimedia.h -// According to unRAR license, -// this code may not be used to develop a -// RAR (WinRAR) compatible archiver - -#ifndef __RAR20_MULTIMEDIA_H -#define __RAR20_MULTIMEDIA_H - -#include "../../../Common/Types.h" - -namespace NCompress { -namespace NRar20 { -namespace NMultimedia { - -struct CAudioVariables -{ - int K1,K2,K3,K4,K5; - int D1,D2,D3,D4; - int LastDelta; - UInt32 Dif[11]; - UInt32 ByteCount; - int LastChar; - - void Init(); -}; - -const int kNumChanelsMax = 4; - -class CPredictor -{ - CAudioVariables m_AudioVariablesArray[kNumChanelsMax]; - int m_ChannelDelta; -public: - int CurrentChannel; - - void Init(); - Byte Predict(); - void Update(Byte realValue, int predictedValue); -}; - -}}} - -#endif diff --git a/7zip/Compress/Rar20/StdAfx.cpp b/7zip/Compress/Rar20/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/7zip/Compress/Rar20/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/7zip/Compress/Rar20/StdAfx.h b/7zip/Compress/Rar20/StdAfx.h deleted file mode 100755 index e7fb6986..00000000 --- a/7zip/Compress/Rar20/StdAfx.h +++ /dev/null @@ -1,8 +0,0 @@ -// StdAfx.h - -#ifndef __STDAFX_H -#define __STDAFX_H - -#include "../../../Common/MyWindows.h" - -#endif diff --git a/7zip/Compress/Rar29/DllExports.cpp b/7zip/Compress/Rar29/DllExports.cpp deleted file mode 100755 index d0053055..00000000 --- a/7zip/Compress/Rar29/DllExports.cpp +++ /dev/null @@ -1,105 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" - -#include "../Rar20/Rar20Decoder.h" -#include "Rar29Decoder.h" - -// {23170F69-40C1-278B-0403-010000000000} -DEFINE_GUID(CLSID_CCompressRar15Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0403-020000000000} -DEFINE_GUID(CLSID_CCompressRar20Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0403-030000000000} -DEFINE_GUID(CLSID_CCompressRar29Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /*lpReserved*/) -{ - return TRUE; -} - -STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - - int correctInterface = (*iid == IID_ICompressCoder); - CMyComPtr coder; - if (*clsid == CLSID_CCompressRar15Decoder) - { - if (!correctInterface) - return E_NOINTERFACE; - coder = (ICompressCoder *)new NCompress::NRar15::CDecoder; - } - else if (*clsid == CLSID_CCompressRar20Decoder) - { - if (!correctInterface) - return E_NOINTERFACE; - coder = (ICompressCoder *)new NCompress::NRar20::CDecoder; - } - else if (*clsid == CLSID_CCompressRar29Decoder) - { - if (!correctInterface) - return E_NOINTERFACE; - coder = (ICompressCoder *)new NCompress::NRar29::CDecoder; - } - else - return CLASS_E_CLASSNOTAVAILABLE; - *outObject = coder.Detach(); - COM_TRY_END - return S_OK; -} - -struct CRarMethodItem -{ - char ID[3]; - const wchar_t *UserName; - const GUID *Decoder; -}; - -static CRarMethodItem g_Methods[] = -{ - { { 0x04, 0x03, 0x01 }, L"Rar15", &CLSID_CCompressRar15Decoder }, - { { 0x04, 0x03, 0x02 }, L"Rar20", &CLSID_CCompressRar20Decoder }, - { { 0x04, 0x03, 0x03 }, L"Rar29", &CLSID_CCompressRar29Decoder } -}; - -STDAPI GetNumberOfMethods(UINT32 *numMethods) -{ - *numMethods = sizeof(g_Methods) / sizeof(g_Methods[1]); - return S_OK; -} - -STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value) -{ - if (index > sizeof(g_Methods) / sizeof(g_Methods[1])) - return E_INVALIDARG; - VariantClear((tagVARIANT *)value); - const CRarMethodItem &method = g_Methods[index]; - switch(propID) - { - case NMethodPropID::kID: - if ((value->bstrVal = ::SysAllocStringByteLen(method.ID, - sizeof(method.ID))) != 0) - value->vt = VT_BSTR; - return S_OK; - case NMethodPropID::kName: - if ((value->bstrVal = ::SysAllocString(method.UserName)) != 0) - value->vt = VT_BSTR; - return S_OK; - case NMethodPropID::kDecoder: - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)method.Decoder, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - return S_OK; -} diff --git a/7zip/Compress/Rar29/Original/archive.hpp b/7zip/Compress/Rar29/Original/archive.hpp deleted file mode 100755 index c076b5b7..00000000 --- a/7zip/Compress/Rar29/Original/archive.hpp +++ /dev/null @@ -1,128 +0,0 @@ -#ifndef _RAR_ARCHIVE_ -#define _RAR_ARCHIVE_ - -class Pack; - -enum {EN_LOCK=1,EN_VOL=2,EN_FIRSTVOL=4}; - -class Archive:public File -{ - private: - bool IsSignature(byte *D); - void UpdateLatestTime(FileHeader *CurBlock); - void Protect(int RecSectors); - void ConvertNameCase(char *Name); - void ConvertNameCase(wchar *Name); - void ConvertUnknownHeader(); - bool AddArcComment(char *NameToShow); - int ReadOldHeader(); - void PrepareExtraTime(FileHeader *hd,EXTTIME_MODE etm,EXTTIME_MODE etc,EXTTIME_MODE eta,EXTTIME_MODE etarc,Array &TimeData); - -#if !defined(SHELL_EXT) && !defined(NOCRYPT) - CryptData HeadersCrypt; - byte HeadersSalt[SALT_SIZE]; -#endif -#ifndef SHELL_EXT - ComprDataIO SubDataIO; - byte SubDataSalt[SALT_SIZE]; -#endif - RAROptions *Cmd,DummyCmd; - - MarkHeader MarkHead; - OldMainHeader OldMhd; - - int RecoverySectors; - Int64 RecoveryPos; - - RarTime LatestTime; - int LastReadBlock; - int CurHeaderType; - - bool SilentOpen; - public: - Archive(RAROptions *InitCmd=NULL); - bool IsArchive(bool EnableBroken); - int SearchBlock(int BlockType); - int SearchSubBlock(const char *Type); - int ReadBlock(int BlockType); - void WriteBlock(int BlockType,BaseBlock *wb=NULL); - int PrepareNamesToWrite(char *Name,wchar *NameW,char *DestName,byte *DestNameW); - void SetLhdSize(); - int ReadHeader(); - void CheckArc(bool EnableBroken); - void CheckOpen(char *Name,wchar *NameW=NULL); - bool WCheckOpen(char *Name,wchar *NameW=NULL); - bool TestLock(int Mode); - void MakeTemp(); - void CopyMainHeader(Archive &Src,bool CopySFX=true,char *NameToDisplay=NULL); - bool ProcessToFileHead(Archive &Src,bool LastBlockAdded, - Pack *Pack=NULL,const char *SkipName=NULL); - void TmpToArc(Archive &Src); - void CloseNew(int AdjustRecovery,bool CloseVolume); - void WriteEndBlock(bool CloseVolume); - void CopyFileRecord(Archive &Src); - void CopyArchiveData(Archive &Src); - bool GetComment(Array &CmtData); - void ViewComment(); - void ViewFileComment(); - void SetLatestTime(RarTime *NewTime); - void SeekToNext(); - bool CheckAccess(); - bool IsArcDir(); - bool IsArcLabel(); - void ConvertAttributes(); - int GetRecoverySize(bool Required); - void VolSubtractHeaderSize(int SubSize); - void AddSubData(byte *SrcData,int DataSize,File *SrcFile,char *Name,bool AllowSplit); - bool ReadSubData(Array *UnpData,File *DestFile); - int GetHeaderType() {return(CurHeaderType);}; - int ReadCommentData(Array &CmtData); - void WriteCommentData(byte *Data,int DataSize,bool FileComment); - RAROptions* GetRAROptions() {return(Cmd);} - void SetSilentOpen(bool Mode) {SilentOpen=Mode;} - - BaseBlock ShortBlock; - MainHeader NewMhd; - FileHeader NewLhd; - EndArcHeader EndArcHead; - SubBlockHeader SubBlockHead; - FileHeader SubHead; - CommentHeader CommHead; - ProtectHeader ProtectHead; - AVHeader AVHead; - SignHeader SignHead; - UnixOwnersHeader UOHead; - MacFInfoHeader MACHead; - EAHeader EAHead; - StreamHeader StreamHead; - - Int64 CurBlockPos; - Int64 NextBlockPos; - - bool OldFormat; - bool Solid; - bool Volume; - bool MainComment; - bool Locked; - bool Signed; - bool NotFirstVolume; - bool Protected; - bool Encrypted; - uint SFXSize; - bool BrokenFileHeader; - - bool Splitting; - - ushort HeaderCRC; - - Int64 VolWrite; - Int64 AddingFilesSize; - uint AddingHeadersSize; - - bool NewArchive; - - char FirstVolumeName[NM]; - wchar FirstVolumeNameW[NM]; -}; - -#endif diff --git a/7zip/Compress/Rar29/Original/array.hpp b/7zip/Compress/Rar29/Original/array.hpp deleted file mode 100755 index 3afec70c..00000000 --- a/7zip/Compress/Rar29/Original/array.hpp +++ /dev/null @@ -1,121 +0,0 @@ -#ifndef _RAR_ARRAY_ -#define _RAR_ARRAY_ - -extern ErrorHandler ErrHandler; - -template class Array -{ - private: - T *Buffer; - int BufSize; - int AllocSize; - public: - Array(); - Array(int Size); - ~Array(); - inline void CleanData(); - inline T& operator [](int Item); - inline int Size(); - void Add(int Items); - void Alloc(int Items); - void Reset(); - void operator = (Array &Src); - void Push(T Item); -}; - -template void Array::CleanData() -{ - Buffer=NULL; - BufSize=0; - AllocSize=0; -} - - -template Array::Array() -{ - CleanData(); -} - - -template Array::Array(int Size) -{ - Buffer=(T *)rarmalloc(sizeof(T)*Size); - if (Buffer==NULL && Size!=0) - ErrHandler.MemoryError(); - - AllocSize=BufSize=Size; -} - - -template Array::~Array() -{ - if (Buffer!=NULL) - rarfree(Buffer); -} - - -template inline T& Array::operator [](int Item) -{ - return(Buffer[Item]); -} - - -template inline int Array::Size() -{ - return(BufSize); -} - - -template void Array::Add(int Items) -{ - BufSize+=Items; - if (BufSize>AllocSize) - { - int Suggested=AllocSize+AllocSize/4+32; - int NewSize=Max(BufSize,Suggested); - - Buffer=(T *)rarrealloc(Buffer,NewSize*sizeof(T)); - if (Buffer==NULL) - ErrHandler.MemoryError(); - AllocSize=NewSize; - } -} - - -template void Array::Alloc(int Items) -{ - if (Items>AllocSize) - Add(Items-BufSize); - else - BufSize=Items; -} - - -template void Array::Reset() -{ - if (Buffer!=NULL) - { - rarfree(Buffer); - Buffer=NULL; - } - BufSize=0; - AllocSize=0; -} - - -template void Array::operator =(Array &Src) -{ - Reset(); - Alloc(Src.BufSize); - if (Src.BufSize!=0) - memcpy((void *)Buffer,(void *)Src.Buffer,Src.BufSize*sizeof(T)); -} - - -template void Array::Push(T Item) -{ - Add(1); - (*this)[Size()-1]=Item; -} - -#endif diff --git a/7zip/Compress/Rar29/Original/cmddata.hpp b/7zip/Compress/Rar29/Original/cmddata.hpp deleted file mode 100755 index 08b92c11..00000000 --- a/7zip/Compress/Rar29/Original/cmddata.hpp +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef _RAR_CMDDATA_ -#define _RAR_CMDDATA_ - -#define DefaultStoreList "ace;arj;bz2;cab;gz;jpeg;jpg;lha;lzh;mp3;rar;zip;taz;tgz;z" - -class CommandData:public RAROptions -{ - private: - void ProcessSwitchesString(char *Str); - void ProcessSwitch(char *Switch); - void BadSwitch(char *Switch); - bool ExclCheckArgs(StringList *Args,char *CheckName,bool CheckFullPath,int MatchMode); - uint GetExclAttr(char *Str); - - bool FileLists; - bool NoMoreSwitches; - bool TimeConverted; - bool BareOutput; - public: - CommandData(); - ~CommandData(); - void Init(); - void Close(); - void ParseArg(char *Arg,wchar *ArgW); - void ParseDone(); - void ParseEnvVar(); - void ReadConfig(int argc,char *argv[]); - bool IsConfigEnabled(int argc,char *argv[]); - void OutTitle(); - void OutHelp(); - bool IsSwitch(int Ch); - bool ExclCheck(char *CheckName,bool CheckFullPath); - bool StoreCheck(char *CheckName); - bool TimeCheck(RarTime &ft); - int IsProcessFile(FileHeader &NewLhd,bool *ExactMatch=NULL,int MatchType=MATCH_WILDSUBPATH); - void ProcessCommand(); - void AddArcName(char *Name,wchar *NameW); - bool GetArcName(char *Name,wchar *NameW,int MaxSize); - bool CheckWinSize(); - - int GetRecoverySize(char *Str,int DefSize); - - char Command[NM+16]; - wchar CommandW[NM+16]; - - char ArcName[NM]; - wchar ArcNameW[NM]; - - StringList *FileArgs; - StringList *ExclArgs; - StringList *InclArgs; - StringList *ArcNames; - StringList *StoreArgs; -}; - -#endif diff --git a/7zip/Compress/Rar29/Original/coder.cpp b/7zip/Compress/Rar29/Original/coder.cpp deleted file mode 100755 index cb6a8836..00000000 --- a/7zip/Compress/Rar29/Original/coder.cpp +++ /dev/null @@ -1,47 +0,0 @@ - - -inline unsigned int RangeCoder::GetChar() -{ - return(UnpackRead->GetChar()); -} - - -void RangeCoder::InitDecoder(Unpack *UnpackRead) -{ - RangeCoder::UnpackRead=UnpackRead; - - low=code=0; - range=uint(-1); - for (int i=0;i < 4;i++) - code=(code << 8) | GetChar(); -} - - -#define ARI_DEC_NORMALIZE(code,low,range,read) \ -{ \ - while ((low^(low+range))GetChar(); \ - range <<= 8; \ - low <<= 8; \ - } \ -} - - -inline int RangeCoder::GetCurrentCount() -{ - return (code-low)/(range /= SubRange.scale); -} - - -inline uint RangeCoder::GetCurrentShiftCount(uint SHIFT) -{ - return (code-low)/(range >>= SHIFT); -} - - -inline void RangeCoder::Decode() -{ - low += range*SubRange.LowCount; - range *= SubRange.HighCount-SubRange.LowCount; -} diff --git a/7zip/Compress/Rar29/Original/coder.hpp b/7zip/Compress/Rar29/Original/coder.hpp deleted file mode 100755 index f09f911c..00000000 --- a/7zip/Compress/Rar29/Original/coder.hpp +++ /dev/null @@ -1,24 +0,0 @@ -/**************************************************************************** - * Contents: 'Carryless rangecoder' by Dmitry Subbotin * - ****************************************************************************/ - -const uint TOP=1 << 24, BOT=1 << 15; - -class RangeCoder -{ - public: - void InitDecoder(Unpack *UnpackRead); - inline int GetCurrentCount(); - inline uint GetCurrentShiftCount(uint SHIFT); - inline void Decode(); - inline void PutChar(unsigned int c); - inline unsigned int GetChar(); - - uint low, code, range; - struct SUBRANGE - { - uint LowCount, HighCount, scale; - } SubRange; - - Unpack *UnpackRead; -}; diff --git a/7zip/Compress/Rar29/Original/compress.hpp b/7zip/Compress/Rar29/Original/compress.hpp deleted file mode 100755 index 2ba7b23e..00000000 --- a/7zip/Compress/Rar29/Original/compress.hpp +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef _RAR_COMPRESS_ -#define _RAR_COMPRESS_ - -class ComprDataIO; -class PackingFileTable; - -#define CODEBUFSIZE 0x4000 -#define MAXWINSIZE 0x400000 -#define MAXWINMASK (MAXWINSIZE-1) - -#define LOW_DIST_REP_COUNT 16 - -#define NC 299 /* alphabet = {0, 1, 2, ..., NC - 1} */ -#define DC 60 -#define LDC 17 -#define RC 28 -#define HUFF_TABLE_SIZE (NC+DC+RC+LDC) -#define BC 20 - -#define NC20 298 /* alphabet = {0, 1, 2, ..., NC - 1} */ -#define DC20 48 -#define RC20 28 -#define BC20 19 -#define MC20 257 - -enum {CODE_HUFFMAN,CODE_LZ,CODE_LZ2,CODE_REPEATLZ,CODE_CACHELZ, - CODE_STARTFILE,CODE_ENDFILE,CODE_VM,CODE_VMDATA}; - - -enum FilterType { - FILTER_NONE, FILTER_PPM /*dummy*/, FILTER_E8, FILTER_E8E9, - FILTER_UPCASETOLOW, FILTER_AUDIO, FILTER_RGB, FILTER_DELTA, - FILTER_ITANIUM, FILTER_E8E9V2 -}; - -#endif diff --git a/7zip/Compress/Rar29/Original/consio.hpp b/7zip/Compress/Rar29/Original/consio.hpp deleted file mode 100755 index 780ae7f3..00000000 --- a/7zip/Compress/Rar29/Original/consio.hpp +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef _RAR_CONSIO_ -#define _RAR_CONSIO_ - -enum {ALARM_SOUND,ERROR_SOUND,QUESTION_SOUND}; - -enum PASSWORD_TYPE {PASSWORD_GLOBAL,PASSWORD_FILE,PASSWORD_ARCHIVE}; - -void InitConsoleOptions(MESSAGE_TYPE MsgStream,bool Sound); - -#ifndef SILENT -void mprintf(const char *fmt,...); -void eprintf(const char *fmt,...); -void Alarm(); -void GetPasswordText(char *Str,int MaxLength); -unsigned int GetKey(); -bool GetPassword(PASSWORD_TYPE Type,const char *FileName,char *Password,int MaxLength); -int Ask(const char *AskStr); -#endif - -int KbdAnsi(char *Addr,int Size); -void OutComment(char *Comment,int Size); - -#ifdef SILENT -#ifdef __GNUC__ - #define mprintf(args...) - #define eprintf(args...) -#else - inline void mprintf(const char *fmt,const char *a=NULL,const char *b=NULL) {} - inline void eprintf(const char *fmt,const char *a=NULL,const char *b=NULL) {} - inline void mprintf(const char *fmt,int b) {} - inline void eprintf(const char *fmt,int b) {} - inline void mprintf(const char *fmt,const char *a,int b) {} - inline void eprintf(const char *fmt,const char *a,int b) {} -#endif -inline void Alarm() {} -inline void GetPasswordText(char *Str,int MaxLength) {} -inline unsigned int GetKey() {return(0);} -inline bool GetPassword(PASSWORD_TYPE Type,const char *FileName,char *Password,int MaxLength) {return(false);} -inline int Ask(const char *AskStr) {return(0);} -#endif - -#endif diff --git a/7zip/Compress/Rar29/Original/crc.cpp b/7zip/Compress/Rar29/Original/crc.cpp deleted file mode 100755 index c19f8595..00000000 --- a/7zip/Compress/Rar29/Original/crc.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include "rar.hpp" - -uint CRCTab[256]; - -void InitCRC() -{ - for (int I=0;I<256;I++) - { - uint C=I; - for (int J=0;J<8;J++) - C=(C & 1) ? (C>>1)^0xEDB88320L : (C>>1); - CRCTab[I]=C; - } -} - - -uint CRC(uint StartCRC,const void *Addr,uint Size) -{ - if (CRCTab[1]==0) - InitCRC(); - byte *Data=(byte *)Addr; -#if defined(LITTLE_ENDIAN) && defined(PRESENT_INT32) - while (Size>0 && ((long)Data & 7)) - { - StartCRC=CRCTab[(byte)(StartCRC^Data[0])]^(StartCRC>>8); - Size--; - Data++; - } - while (Size>=8) - { - StartCRC^=*(uint32 *)Data; - StartCRC=CRCTab[(byte)StartCRC]^(StartCRC>>8); - StartCRC=CRCTab[(byte)StartCRC]^(StartCRC>>8); - StartCRC=CRCTab[(byte)StartCRC]^(StartCRC>>8); - StartCRC=CRCTab[(byte)StartCRC]^(StartCRC>>8); - StartCRC^=*(uint32 *)(Data+4); - StartCRC=CRCTab[(byte)StartCRC]^(StartCRC>>8); - StartCRC=CRCTab[(byte)StartCRC]^(StartCRC>>8); - StartCRC=CRCTab[(byte)StartCRC]^(StartCRC>>8); - StartCRC=CRCTab[(byte)StartCRC]^(StartCRC>>8); - Data+=8; - Size-=8; - } -#endif - for (int I=0;I>8); - return(StartCRC); -} - -#ifndef SFX_MODULE -ushort OldCRC(ushort StartCRC,const void *Addr,uint Size) -{ - byte *Data=(byte *)Addr; - for (int I=0;I>15))&0xffff; - } - return(StartCRC); -} -#endif diff --git a/7zip/Compress/Rar29/Original/crc.hpp b/7zip/Compress/Rar29/Original/crc.hpp deleted file mode 100755 index 47ee7e23..00000000 --- a/7zip/Compress/Rar29/Original/crc.hpp +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _RAR_CRC_ -#define _RAR_CRC_ - -extern uint CRCTab[256]; - -void InitCRC(); -uint CRC(uint StartCRC,const void *Addr,uint Size); -ushort OldCRC(ushort StartCRC,const void *Addr,uint Size); - -#endif diff --git a/7zip/Compress/Rar29/Original/crypt.hpp b/7zip/Compress/Rar29/Original/crypt.hpp deleted file mode 100755 index 809d76a5..00000000 --- a/7zip/Compress/Rar29/Original/crypt.hpp +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef _RAR_CRYPT_ -#define _RAR_CRYPT_ - -enum { OLD_DECODE=0,OLD_ENCODE=1,NEW_CRYPT=2 }; - -struct CryptKeyCacheItem -{ -#ifndef _SFX_RTL_ - CryptKeyCacheItem() - { - *Password=0; - } - - ~CryptKeyCacheItem() - { - memset(AESKey,0,sizeof(AESKey)); - memset(AESInit,0,sizeof(AESInit)); - memset(Password,0,sizeof(Password)); - } -#endif - byte AESKey[16],AESInit[16]; - char Password[MAXPASSWORD]; - bool SaltPresent; - byte Salt[SALT_SIZE]; -}; - -class CryptData -{ - private: - void Encode13(byte *Data,uint Count); - void Decode13(byte *Data,uint Count); - void Crypt15(byte *Data,uint Count); - void UpdKeys(byte *Buf); - void Swap(byte *Ch1,byte *Ch2); - void SetOldKeys(char *Password); - - Rijndael rin; - - byte SubstTable[256]; - uint Key[4]; - ushort OldKey[4]; - byte PN1,PN2,PN3; - - byte AESKey[16],AESInit[16]; - - static CryptKeyCacheItem Cache[4]; - static int CachePos; - public: - void SetCryptKeys(char *Password,byte *Salt,bool Encrypt,bool OldOnly=false); - void SetAV15Encryption(); - void SetCmt13Encryption(); - void EncryptBlock20(byte *Buf); - void DecryptBlock20(byte *Buf); - void EncryptBlock(byte *Buf,int Size); - void DecryptBlock(byte *Buf,int Size); - void Crypt(byte *Data,uint Count,int Method); - static void SetSalt(byte *Salt,int SaltSize); -}; - -#endif diff --git a/7zip/Compress/Rar29/Original/encname.hpp b/7zip/Compress/Rar29/Original/encname.hpp deleted file mode 100755 index 586f4216..00000000 --- a/7zip/Compress/Rar29/Original/encname.hpp +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef _RAR_ENCNAME_ -#define _RAR_ENCNAME_ - -class EncodeFileName -{ - private: - void AddFlags(int Value); - - byte *EncName; - byte Flags; - int FlagBits; - int FlagsPos; - int DestSize; - public: - EncodeFileName(); - int Encode(char *Name,wchar *NameW,byte *EncName); - void Decode(char *Name,byte *EncName,int EncSize,wchar *NameW,int MaxDecSize); -}; - -#endif diff --git a/7zip/Compress/Rar29/Original/errhnd.cpp b/7zip/Compress/Rar29/Original/errhnd.cpp deleted file mode 100755 index 6e162217..00000000 --- a/7zip/Compress/Rar29/Original/errhnd.cpp +++ /dev/null @@ -1,356 +0,0 @@ -#include "rar.hpp" - - -static bool UserBreak; - -ErrorHandler::ErrorHandler() -{ - Clean(); -} - - -void ErrorHandler::Clean() -{ - ExitCode=SUCCESS; - ErrCount=0; - EnableBreak=true; - Silent=false; - DoShutdown=false; -} - - -void ErrorHandler::MemoryError() -{ - MemoryErrorMsg(); - Throw(MEMORY_ERROR); -} - - -void ErrorHandler::OpenError(const char *FileName) -{ -#ifndef SILENT - OpenErrorMsg(FileName); - Throw(OPEN_ERROR); -#endif -} - - -void ErrorHandler::CloseError(const char *FileName) -{ -#ifndef SILENT - if (!UserBreak) - { - ErrMsg(NULL,St(MErrFClose),FileName); - SysErrMsg(); - } -#endif -#if !defined(SILENT) || defined(RARDLL) - Throw(FATAL_ERROR); -#endif -} - - -void ErrorHandler::ReadError(const char *FileName) -{ -#ifndef SILENT - ReadErrorMsg(NULL,FileName); -#endif -#if !defined(SILENT) || defined(RARDLL) - Throw(FATAL_ERROR); -#endif -} - - -bool ErrorHandler::AskRepeatRead(const char *FileName) -{ -#if !defined(SILENT) && !defined(SFX_MODULE) && !defined(_WIN_CE) - if (!Silent) - { - mprintf("\n"); - Log(NULL,St(MErrRead),FileName); - return(Ask(St(MRetryAbort))==1); - } -#endif - return(false); -} - - -void ErrorHandler::WriteError(const char *ArcName,const char *FileName) -{ -#ifndef SILENT - WriteErrorMsg(ArcName,FileName); -#endif -#if !defined(SILENT) || defined(RARDLL) - Throw(WRITE_ERROR); -#endif -} - - -#ifdef _WIN_32 -void ErrorHandler::WriteErrorFAT(const char *FileName) -{ -#if !defined(SILENT) && !defined(SFX_MODULE) - SysErrMsg(); - ErrMsg(NULL,St(MNTFSRequired),FileName); -#endif -#if !defined(SILENT) && !defined(SFX_MODULE) || defined(RARDLL) - Throw(WRITE_ERROR); -#endif -} -#endif - - -bool ErrorHandler::AskRepeatWrite(const char *FileName) -{ -#if !defined(SILENT) && !defined(_WIN_CE) - if (!Silent) - { - mprintf("\n"); - Log(NULL,St(MErrWrite),FileName); - return(Ask(St(MRetryAbort))==1); - } -#endif - return(false); -} - - -void ErrorHandler::SeekError(const char *FileName) -{ -#ifndef SILENT - if (!UserBreak) - { - ErrMsg(NULL,St(MErrSeek),FileName); - SysErrMsg(); - } -#endif -#if !defined(SILENT) || defined(RARDLL) - Throw(FATAL_ERROR); -#endif -} - - -void ErrorHandler::MemoryErrorMsg() -{ -#ifndef SILENT - ErrMsg(NULL,St(MErrOutMem)); -#endif -} - - -void ErrorHandler::OpenErrorMsg(const char *FileName) -{ - OpenErrorMsg(NULL,FileName); -} - - -void ErrorHandler::OpenErrorMsg(const char *ArcName,const char *FileName) -{ -#ifndef SILENT - Log(ArcName && *ArcName ? ArcName:NULL,St(MCannotOpen),FileName); - Alarm(); - SysErrMsg(); -#endif -} - - -void ErrorHandler::CreateErrorMsg(const char *FileName) -{ - CreateErrorMsg(NULL,FileName); -} - - -void ErrorHandler::CreateErrorMsg(const char *ArcName,const char *FileName) -{ -#ifndef SILENT - Log(ArcName && *ArcName ? ArcName:NULL,St(MCannotCreate),FileName); - Alarm(); -#if defined(_WIN_32) && !defined(_WIN_CE) && !defined(SFX_MODULE) && defined(MAXPATH) - if (GetLastError()==ERROR_PATH_NOT_FOUND) - { - int NameLength=strlen(FileName); - if (!IsFullPath(FileName)) - { - char CurDir[NM]; - GetCurrentDirectory(sizeof(CurDir),CurDir); - NameLength+=strlen(CurDir)+1; - } - if (NameLength>MAXPATH) - { - Log(ArcName && *ArcName ? ArcName:NULL,St(MMaxPathLimit),MAXPATH); - } - } -#endif - SysErrMsg(); -#endif -} - - -void ErrorHandler::ReadErrorMsg(const char *ArcName,const char *FileName) -{ -#ifndef SILENT - ErrMsg(ArcName,St(MErrRead),FileName); - SysErrMsg(); -#endif -} - - -void ErrorHandler::WriteErrorMsg(const char *ArcName,const char *FileName) -{ -#ifndef SILENT - ErrMsg(ArcName,St(MErrWrite),FileName); - SysErrMsg(); -#endif -} - - -void ErrorHandler::Exit(int ExitCode) -{ -#ifndef SFX_MODULE - Alarm(); -#endif - Throw(ExitCode); -} - - -#ifndef GUI -void ErrorHandler::ErrMsg(const char *ArcName,const char *fmt,...) -{ - safebuf char Msg[NM+1024]; - va_list argptr; - va_start(argptr,fmt); - vsprintf(Msg,fmt,argptr); - va_end(argptr); -#ifdef _WIN_32 - if (UserBreak) - Sleep(5000); -#endif - Alarm(); - if (*Msg) - { - Log(ArcName,"\n%s",Msg); - mprintf("\n%s\n",St(MProgAborted)); - } -} -#endif - - -void ErrorHandler::SetErrorCode(int Code) -{ - switch(Code) - { - case WARNING: - case USER_BREAK: - if (ExitCode==SUCCESS) - ExitCode=Code; - break; - case FATAL_ERROR: - if (ExitCode==SUCCESS || ExitCode==WARNING) - ExitCode=FATAL_ERROR; - break; - default: - ExitCode=Code; - break; - } - ErrCount++; -} - - -#if !defined(GUI) && !defined(_SFX_RTL_) -#ifdef _WIN_32 -BOOL __stdcall ProcessSignal(DWORD SigType) -#else -#if defined(__sun) -extern "C" -#endif -void _stdfunction ProcessSignal(int SigType) -#endif -{ -#ifdef _WIN_32 - if (SigType==CTRL_LOGOFF_EVENT) - return(TRUE); -#endif - UserBreak=true; - mprintf(St(MBreak)); - for (int I=0; - // Igor Pavlov - // !File::RemoveCreated() && - I<3;I++) - { -#ifdef _WIN_32 - Sleep(100); -#endif - } -#if defined(USE_RC) && !defined(SFX_MODULE) && !defined(_WIN_CE) - ExtRes.UnloadDLL(); -#endif - exit(USER_BREAK); -#ifdef _WIN_32 - return(TRUE); -#endif -} -#endif - - -void ErrorHandler::SetSignalHandlers(bool Enable) -{ - EnableBreak=Enable; -#if !defined(GUI) && !defined(_SFX_RTL_) -#ifdef _WIN_32 - SetConsoleCtrlHandler(Enable ? ProcessSignal:NULL,TRUE); -// signal(SIGBREAK,Enable ? ProcessSignal:SIG_IGN); -#else - signal(SIGINT,Enable ? ProcessSignal:SIG_IGN); - signal(SIGTERM,Enable ? ProcessSignal:SIG_IGN); -#endif -#endif -} - - -void ErrorHandler::Throw(int Code) -{ - if (Code==USER_BREAK && !EnableBreak) - return; - ErrHandler.SetErrorCode(Code); -#ifdef ALLOW_EXCEPTIONS - throw Code; -#else - // Igor Pavlov - // File::RemoveCreated(); - exit(Code); -#endif -} - - -void ErrorHandler::SysErrMsg() -{ -#if defined(_WIN_32) && !defined(SFX_MODULE) && !defined(SILENT) - #define STRCHR strchr - #define ERRCHAR char - ERRCHAR *lpMsgBuf=NULL; - int ErrType=GetLastError(); - if (ErrType!=0 && FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, - NULL,ErrType,MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR)&lpMsgBuf,0,NULL)) - { - ERRCHAR *CurMsg=lpMsgBuf; - while (CurMsg!=NULL) - { - while (*CurMsg=='\r' || *CurMsg=='\n') - CurMsg++; - if (*CurMsg==0) - break; - ERRCHAR *EndMsg=STRCHR(CurMsg,'\r'); - if (EndMsg==NULL) - EndMsg=STRCHR(CurMsg,'\n'); - if (EndMsg!=NULL) - { - *EndMsg=0; - EndMsg++; - } - Log(NULL,"\n%s",CurMsg); - CurMsg=EndMsg; - } - } - LocalFree( lpMsgBuf ); -#endif -} diff --git a/7zip/Compress/Rar29/Original/errhnd.hpp b/7zip/Compress/Rar29/Original/errhnd.hpp deleted file mode 100755 index 9e276222..00000000 --- a/7zip/Compress/Rar29/Original/errhnd.hpp +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef _RAR_ERRHANDLER_ -#define _RAR_ERRHANDLER_ - -#if (defined(GUI) || !defined(_WIN_32)) && !defined(SFX_MODULE) && !defined(_WIN_CE) || defined(RARDLL) -#define ALLOW_EXCEPTIONS -#endif - - - -#define rarmalloc malloc -#define rarcalloc calloc -#define rarrealloc realloc -#define rarfree free -#define rarstrdup strdup - - - -enum { SUCCESS,WARNING,FATAL_ERROR,CRC_ERROR,LOCK_ERROR,WRITE_ERROR, - OPEN_ERROR,USER_ERROR,MEMORY_ERROR,CREATE_ERROR,USER_BREAK=255}; - -class ErrorHandler -{ - private: - void ErrMsg(const char *ArcName,const char *fmt,...); - - int ExitCode; - int ErrCount; - bool EnableBreak; - bool Silent; - bool DoShutdown; - public: - ErrorHandler(); - void Clean(); - void MemoryError(); - void OpenError(const char *FileName); - void CloseError(const char *FileName); - void ReadError(const char *FileName); - bool AskRepeatRead(const char *FileName); - void WriteError(const char *ArcName,const char *FileName); - void WriteErrorFAT(const char *FileName); - bool AskRepeatWrite(const char *FileName); - void SeekError(const char *FileName); - void MemoryErrorMsg(); - void OpenErrorMsg(const char *FileName); - void OpenErrorMsg(const char *ArcName,const char *FileName); - void CreateErrorMsg(const char *FileName); - void CreateErrorMsg(const char *ArcName,const char *FileName); - void ReadErrorMsg(const char *ArcName,const char *FileName); - void WriteErrorMsg(const char *ArcName,const char *FileName); - void Exit(int ExitCode); - void SetErrorCode(int Code); - int GetErrorCode() {return(ExitCode);} - int GetErrorCount() {return(ErrCount);} - void SetSignalHandlers(bool Enable); - void Throw(int Code); - void SetSilent(bool Mode) {Silent=Mode;}; - void SetShutdown(bool Mode) {DoShutdown=Mode;}; - void SysErrMsg(); -}; - -#endif diff --git a/7zip/Compress/Rar29/Original/extinfo.hpp b/7zip/Compress/Rar29/Original/extinfo.hpp deleted file mode 100755 index db7cea53..00000000 --- a/7zip/Compress/Rar29/Original/extinfo.hpp +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _RAR_EXTINFO_ -#define _RAR_EXTINFO_ - - -void SetExtraInfo(CommandData *Cmd,Archive &Arc,char *Name,wchar *NameW); -void SetExtraInfoNew(CommandData *Cmd,Archive &Arc,char *Name,wchar *NameW); - -#endif diff --git a/7zip/Compress/Rar29/Original/extract.hpp b/7zip/Compress/Rar29/Original/extract.hpp deleted file mode 100755 index b78c988d..00000000 --- a/7zip/Compress/Rar29/Original/extract.hpp +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef _RAR_EXTRACT_ -#define _RAR_EXTRACT_ - -enum EXTRACT_ARC_CODE {EXTRACT_ARC_NEXT,EXTRACT_ARC_REPEAT}; - -class CmdExtract -{ - private: - ComprDataIO DataIO; - Unpack *Unp; - long TotalFileCount; - - long FileCount; - long MatchedArgs; - bool FirstFile; - bool AllMatchesExact; - bool ReconstructDone; - - char ArcName[NM]; - wchar ArcNameW[NM]; - - char Password[MAXPASSWORD]; - bool PasswordAll; - bool PrevExtracted; - bool SignatureFound; - char DestFileName[NM]; - wchar DestFileNameW[NM]; - bool PasswordCancelled; - public: - CmdExtract(); - ~CmdExtract(); - void DoExtract(CommandData *Cmd); - void ExtractArchiveInit(CommandData *Cmd,Archive &Arc); - EXTRACT_ARC_CODE ExtractArchive(CommandData *Cmd); - bool ExtractCurrentFile(CommandData *Cmd,Archive &Arc,int HeaderSize, - bool &Repeat); - static void UnstoreFile(ComprDataIO &DataIO,Int64 DestUnpSize); -}; - -#endif diff --git a/7zip/Compress/Rar29/Original/filcreat.hpp b/7zip/Compress/Rar29/Original/filcreat.hpp deleted file mode 100755 index fa1fddd0..00000000 --- a/7zip/Compress/Rar29/Original/filcreat.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _RAR_FILECREATE_ -#define _RAR_FILECREATE_ - -bool FileCreate(RAROptions *Cmd,File *NewFile,char *Name,wchar *NameW, - OVERWRITE_MODE Mode,bool *UserReject,Int64 FileSize=INT64ERR, - uint FileTime=0); - -#if defined(_WIN_32) && !defined(_WIN_CE) -bool UpdateExistingShortName(char *Name,wchar *NameW); -#endif - -#endif diff --git a/7zip/Compress/Rar29/Original/file.hpp b/7zip/Compress/Rar29/Original/file.hpp deleted file mode 100755 index afa9529c..00000000 --- a/7zip/Compress/Rar29/Original/file.hpp +++ /dev/null @@ -1,100 +0,0 @@ -#ifndef _RAR_FILE_ -#define _RAR_FILE_ - -#ifdef _WIN_32 -typedef HANDLE FileHandle; -#define BAD_HANDLE INVALID_HANDLE_VALUE -#else -typedef FILE* FileHandle; -#define BAD_HANDLE NULL -#endif - -class RAROptions; - -enum FILE_HANDLETYPE {FILE_HANDLENORMAL,FILE_HANDLESTD,FILE_HANDLEERR}; - -enum FILE_ERRORTYPE {FILE_SUCCESS,FILE_NOTFOUND,FILE_READERROR}; - -struct FileStat -{ - uint FileAttr; - uint FileTime; - Int64 FileSize; - bool IsDir; -}; - - -class File -{ - private: - void AddFileToList(FileHandle hFile); - - FileHandle hFile; - bool LastWrite; - FILE_HANDLETYPE HandleType; - bool SkipClose; - bool IgnoreReadErrors; - bool NewFile; - bool AllowDelete; - bool AllowExceptions; -#ifdef _WIN_32 - bool NoSequentialRead; -#endif - protected: - bool OpenShared; - public: - char FileName[NM]; - wchar FileNameW[NM]; - - FILE_ERRORTYPE ErrorType; - - uint CloseCount; - public: - File(); - virtual ~File(); - void operator = (File &SrcFile); - bool Open(const char *Name,const wchar *NameW=NULL,bool OpenShared=false,bool Update=false); - void TOpen(const char *Name,const wchar *NameW=NULL); - bool WOpen(const char *Name,const wchar *NameW=NULL); - bool Create(const char *Name,const wchar *NameW=NULL); - void TCreate(const char *Name,const wchar *NameW=NULL); - bool WCreate(const char *Name,const wchar *NameW=NULL); - bool Close(); - void Flush(); - bool Delete(); - bool Rename(const char *NewName); - void Write(const void *Data,int Size); - int Read(void *Data,int Size); - int DirectRead(void *Data,int Size); - void Seek(Int64 Offset,int Method); - bool RawSeek(Int64 Offset,int Method); - Int64 Tell(); - void Prealloc(Int64 Size); - byte GetByte(); - void PutByte(byte Byte); - bool Truncate(); - void SetOpenFileTime(RarTime *ftm,RarTime *ftc=NULL,RarTime *fta=NULL); - void SetCloseFileTime(RarTime *ftm,RarTime *fta=NULL); - static void SetCloseFileTimeByName(const char *Name,RarTime *ftm,RarTime *fta); - void SetOpenFileStat(RarTime *ftm,RarTime *ftc,RarTime *fta); - void SetCloseFileStat(RarTime *ftm,RarTime *fta,uint FileAttr); - void GetOpenFileTime(RarTime *ft); - bool IsOpened() {return(hFile!=BAD_HANDLE);}; - Int64 FileLength(); - void SetHandleType(FILE_HANDLETYPE Type); - FILE_HANDLETYPE GetHandleType() {return(HandleType);}; - bool IsDevice(); - void fprintf(const char *fmt,...); - static bool RemoveCreated(); - FileHandle GetHandle() {return(hFile);}; - void SetIgnoreReadErrors(bool Mode) {IgnoreReadErrors=Mode;}; - char *GetName() {return(FileName);} - long Copy(File &Dest,Int64 Length=INT64ERR); - void SetAllowDelete(bool Allow) {AllowDelete=Allow;} - void SetExceptions(bool Allow) {AllowExceptions=Allow;} -#ifdef _WIN_32 - void RemoveSequentialFlag() {NoSequentialRead=true;} -#endif -}; - -#endif diff --git a/7zip/Compress/Rar29/Original/filefn.hpp b/7zip/Compress/Rar29/Original/filefn.hpp deleted file mode 100755 index 3ad31b5e..00000000 --- a/7zip/Compress/Rar29/Original/filefn.hpp +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef _RAR_FILEFN_ -#define _RAR_FILEFN_ - -enum MKDIR_CODE {MKDIR_SUCCESS,MKDIR_ERROR,MKDIR_BADPATH}; - -MKDIR_CODE MakeDir(const char *Name,const wchar *NameW,uint Attr); -void CreatePath(const char *Path,const wchar *PathW,bool SkipLastName); -void SetDirTime(const char *Name,RarTime *ftm,RarTime *ftc,RarTime *fta); -bool IsRemovable(const char *Name); -Int64 GetFreeDisk(const char *Name); -bool FileExist(const char *Name,const wchar *NameW=NULL); -bool WildFileExist(const char *Name,const wchar *NameW=NULL); -bool IsDir(uint Attr); -bool IsUnreadable(uint Attr); -bool IsLabel(uint Attr); -bool IsLink(uint Attr); -void SetSFXMode(const char *FileName); -void EraseDiskContents(const char *FileName); -bool IsDeleteAllowed(uint FileAttr); -void PrepareToDelete(const char *Name,const wchar *NameW=NULL); -uint GetFileAttr(const char *Name,const wchar *NameW=NULL); -bool SetFileAttr(const char *Name,const wchar *NameW,uint Attr); -void ConvertNameToFull(const char *Src,char *Dest); -void ConvertNameToFull(const wchar *Src,wchar *Dest); -char* MkTemp(char *Name); - - -uint CalcFileCRC(File *SrcFile,Int64 Size=INT64ERR); -bool RenameFile(const char *SrcName,const wchar *SrcNameW,const char *DestName,const wchar *DestNameW); -bool DelFile(const char *Name); -bool DelFile(const char *Name,const wchar *NameW); -bool DelDir(const char *Name); -bool DelDir(const char *Name,const wchar *NameW); - -#if defined(_WIN_32) && !defined(_WIN_CE) -bool SetFileCompression(char *Name,wchar *NameW,bool State); -#endif - -#endif diff --git a/7zip/Compress/Rar29/Original/filestr.hpp b/7zip/Compress/Rar29/Original/filestr.hpp deleted file mode 100755 index b2bcbe0e..00000000 --- a/7zip/Compress/Rar29/Original/filestr.hpp +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _RAR_FILESTR_ -#define _RAR_FILESTR_ - -bool ReadTextFile(char *Name,StringList *List,bool Config, - bool AbortOnError=false,bool ConvertToAnsi=false, - bool Unquote=false,bool SkipComments=false); - -#endif diff --git a/7zip/Compress/Rar29/Original/find.hpp b/7zip/Compress/Rar29/Original/find.hpp deleted file mode 100755 index 81548199..00000000 --- a/7zip/Compress/Rar29/Original/find.hpp +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef _RAR_FINDDATA_ -#define _RAR_FINDDATA_ - -struct FindData -{ - char Name[NM]; - wchar NameW[NM]; - Int64 Size; - uint FileAttr; - uint FileTime; - bool IsDir; - RarTime mtime; - RarTime ctime; - RarTime atime; -#ifdef _WIN_32 - char ShortName[NM]; - FILETIME ftCreationTime; - FILETIME ftLastAccessTime; - FILETIME ftLastWriteTime; -#endif - bool Error; -}; - -class FindFile -{ - private: -#ifdef _WIN_32 - static HANDLE Win32Find(HANDLE hFind,const char *Mask,const wchar *MaskW,struct FindData *fd); -#endif - - char FindMask[NM]; - wchar FindMaskW[NM]; - int FirstCall; -#ifdef _WIN_32 - HANDLE hFind; -#else - DIR *dirp; -#endif - public: - FindFile(); - ~FindFile(); - void SetMask(const char *FindMask); - void SetMaskW(const wchar *FindMaskW); - bool Next(struct FindData *fd,bool GetSymLink=false); - static bool FastFind(const char *FindMask,const wchar *FindMaskW,struct FindData *fd,bool GetSymLink=false); -}; - -#endif diff --git a/7zip/Compress/Rar29/Original/getbits.cpp b/7zip/Compress/Rar29/Original/getbits.cpp deleted file mode 100755 index 71ecfc87..00000000 --- a/7zip/Compress/Rar29/Original/getbits.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "rar.hpp" - -BitInput::BitInput() -{ - InBuf=new byte[MAX_SIZE]; -} - - -BitInput::~BitInput() -{ - delete[] InBuf; -} - - -void BitInput::faddbits(int Bits) -{ - addbits(Bits); -} - - -unsigned int BitInput::fgetbits() -{ - return(getbits()); -} diff --git a/7zip/Compress/Rar29/Original/getbits.hpp b/7zip/Compress/Rar29/Original/getbits.hpp deleted file mode 100755 index 8819f53a..00000000 --- a/7zip/Compress/Rar29/Original/getbits.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef _RAR_GETBITS_ -#define _RAR_GETBITS_ - -class BitInput -{ - public: - enum BufferSize {MAX_SIZE=0x8000}; - protected: - int InAddr,InBit; - public: - BitInput(); - ~BitInput(); - - byte *InBuf; - - void InitBitInput() - { - InAddr=InBit=0; - } - void addbits(int Bits) - { - Bits+=InBit; - InAddr+=Bits>>3; - InBit=Bits&7; - } - unsigned int getbits() - { - unsigned int BitField=(uint)InBuf[InAddr] << 16; - BitField|=(uint)InBuf[InAddr+1] << 8; - BitField|=(uint)InBuf[InAddr+2]; - BitField >>= (8-InBit); - return(BitField & 0xffff); - } - void faddbits(int Bits); - unsigned int fgetbits(); -}; -#endif diff --git a/7zip/Compress/Rar29/Original/global.hpp b/7zip/Compress/Rar29/Original/global.hpp deleted file mode 100755 index 35c6cf91..00000000 --- a/7zip/Compress/Rar29/Original/global.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _RAR_GLOBAL_ -#define _RAR_GLOBAL_ - -#ifdef INCLUDEGLOBAL - #define EXTVAR -#else - #define EXTVAR extern -#endif - -EXTVAR ErrorHandler ErrHandler; - - - -#endif diff --git a/7zip/Compress/Rar29/Original/headers.hpp b/7zip/Compress/Rar29/Original/headers.hpp deleted file mode 100755 index f719a7ec..00000000 --- a/7zip/Compress/Rar29/Original/headers.hpp +++ /dev/null @@ -1,304 +0,0 @@ -#ifndef _RAR_HEADERS_ -#define _RAR_HEADERS_ - -#define SIZEOF_MARKHEAD 7 -#define SIZEOF_OLDMHD 7 -#define SIZEOF_NEWMHD 13 -#define SIZEOF_OLDLHD 21 -#define SIZEOF_NEWLHD 32 -#define SIZEOF_SHORTBLOCKHEAD 7 -#define SIZEOF_LONGBLOCKHEAD 11 -#define SIZEOF_SUBBLOCKHEAD 14 -#define SIZEOF_COMMHEAD 13 -#define SIZEOF_PROTECTHEAD 26 -#define SIZEOF_AVHEAD 14 -#define SIZEOF_SIGNHEAD 15 -#define SIZEOF_UOHEAD 18 -#define SIZEOF_MACHEAD 22 -#define SIZEOF_EAHEAD 24 -#define SIZEOF_BEEAHEAD 24 -#define SIZEOF_STREAMHEAD 26 - -#define PACK_VER 29 -#define PACK_CRYPT_VER 29 -#define UNP_VER 29 -#define CRYPT_VER 29 -#define AV_VER 20 -#define PROTECT_VER 20 - -#define MHD_VOLUME 0x0001 -#define MHD_COMMENT 0x0002 -#define MHD_LOCK 0x0004 -#define MHD_SOLID 0x0008 -#define MHD_PACK_COMMENT 0x0010 -#define MHD_NEWNUMBERING 0x0010 -#define MHD_AV 0x0020 -#define MHD_PROTECT 0x0040 -#define MHD_PASSWORD 0x0080 -#define MHD_FIRSTVOLUME 0x0100 - -#define LHD_SPLIT_BEFORE 0x0001 -#define LHD_SPLIT_AFTER 0x0002 -#define LHD_PASSWORD 0x0004 -#define LHD_COMMENT 0x0008 -#define LHD_SOLID 0x0010 - -#define LHD_WINDOWMASK 0x00e0 -#define LHD_WINDOW64 0x0000 -#define LHD_WINDOW128 0x0020 -#define LHD_WINDOW256 0x0040 -#define LHD_WINDOW512 0x0060 -#define LHD_WINDOW1024 0x0080 -#define LHD_WINDOW2048 0x00a0 -#define LHD_WINDOW4096 0x00c0 -#define LHD_DIRECTORY 0x00e0 - -#define LHD_LARGE 0x0100 -#define LHD_UNICODE 0x0200 -#define LHD_SALT 0x0400 -#define LHD_VERSION 0x0800 -#define LHD_EXTTIME 0x1000 -#define LHD_EXTFLAGS 0x2000 - -#define SKIP_IF_UNKNOWN 0x4000 -#define LONG_BLOCK 0x8000 - -#define EARC_NEXT_VOLUME 0x0001 -#define EARC_DATACRC 0x0002 -#define EARC_REVSPACE 0x0004 -#define EARC_VOLNUMBER 0x0008 - -enum HEADER_TYPE { - MARK_HEAD=0x72,MAIN_HEAD=0x73,FILE_HEAD=0x74,COMM_HEAD=0x75,AV_HEAD=0x76, - SUB_HEAD=0x77,PROTECT_HEAD=0x78,SIGN_HEAD=0x79,NEWSUB_HEAD=0x7a, - ENDARC_HEAD=0x7b -}; - -enum { EA_HEAD=0x100,UO_HEAD=0x101,MAC_HEAD=0x102,BEEA_HEAD=0x103, - NTACL_HEAD=0x104,STREAM_HEAD=0x105 }; - -enum HOST_SYSTEM { - HOST_MSDOS=0,HOST_OS2=1,HOST_WIN32=2,HOST_UNIX=3,HOST_MACOS=4, - HOST_BEOS=5,HOST_MAX -}; - -#define SUBHEAD_TYPE_CMT "CMT" -#define SUBHEAD_TYPE_ACL "ACL" -#define SUBHEAD_TYPE_STREAM "STM" -#define SUBHEAD_TYPE_UOWNER "UOW" -#define SUBHEAD_TYPE_AV "AV" -#define SUBHEAD_TYPE_RR "RR" -#define SUBHEAD_TYPE_OS2EA "EA2" -#define SUBHEAD_TYPE_BEOSEA "EABE" - -/* new file inherits a subblock when updating a host file */ -#define SUBHEAD_FLAGS_INHERITED 0x80000000 - -#define SUBHEAD_FLAGS_CMT_UNICODE 0x00000001 - -struct OldMainHeader -{ - byte Mark[4]; - ushort HeadSize; - byte Flags; -}; - - -struct OldFileHeader -{ - uint PackSize; - uint UnpSize; - ushort FileCRC; - ushort HeadSize; - uint FileTime; - byte FileAttr; - byte Flags; - byte UnpVer; - byte NameSize; - byte Method; -}; - - -struct MarkHeader -{ - byte Mark[7]; -}; - - -struct BaseBlock -{ - ushort HeadCRC; - HEADER_TYPE HeadType;//byte - ushort Flags; - ushort HeadSize; - - bool IsSubBlock() - { - if (HeadType==SUB_HEAD) - return(true); - if (HeadType==NEWSUB_HEAD && (Flags & LHD_SOLID)!=0) - return(true); - return(false); - } -}; - -struct BlockHeader:BaseBlock -{ - union { - uint DataSize; - uint PackSize; - }; -}; - - -struct MainHeader:BlockHeader -{ - ushort HighPosAV; - uint PosAV; -}; - - -#define SALT_SIZE 8 - -struct FileHeader:BlockHeader -{ - uint UnpSize; - byte HostOS; - uint FileCRC; - uint FileTime; - byte UnpVer; - byte Method; - ushort NameSize; - union { - uint FileAttr; - uint SubFlags; - }; -/* optional */ - uint HighPackSize; - uint HighUnpSize; -/* names */ - char FileName[NM]; - wchar FileNameW[NM]; -/* optional */ - Array SubData; - byte Salt[SALT_SIZE]; - - RarTime mtime; - RarTime ctime; - RarTime atime; - RarTime arctime; -/* dummy */ - Int64 FullPackSize; - Int64 FullUnpSize; - - void Clear(int SubDataSize) - { - SubData.Alloc(SubDataSize); - Flags=LONG_BLOCK; - SubFlags=0; - } - - bool CmpName(const char *Name) - { - return(strcmp(FileName,Name)==0); - } - - FileHeader& operator = (FileHeader &hd) - { - SubData.Reset(); - memcpy(this,&hd,sizeof(*this)); - SubData.CleanData(); - SubData=hd.SubData; - return(*this); - } -}; - - -struct EndArcHeader:BaseBlock -{ - uint ArcDataCRC; - ushort VolNumber; -}; - - -struct SubBlockHeader:BlockHeader -{ - ushort SubType; - byte Level; -}; - - -struct CommentHeader:BaseBlock -{ - ushort UnpSize; - byte UnpVer; - byte Method; - ushort CommCRC; -}; - - -struct ProtectHeader:BlockHeader -{ - byte Version; - ushort RecSectors; - uint TotalBlocks; - byte Mark[8]; -}; - - -struct AVHeader:BaseBlock -{ - byte UnpVer; - byte Method; - byte AVVer; - uint AVInfoCRC; -}; - - -struct SignHeader:BaseBlock -{ - uint CreationTime; - ushort ArcNameSize; - ushort UserNameSize; -}; - - -struct UnixOwnersHeader:SubBlockHeader -{ - ushort OwnerNameSize; - ushort GroupNameSize; -/* dummy */ - char OwnerName[NM]; - char GroupName[NM]; -}; - - -struct EAHeader:SubBlockHeader -{ - uint UnpSize; - byte UnpVer; - byte Method; - uint EACRC; -}; - - -struct StreamHeader:SubBlockHeader -{ - uint UnpSize; - byte UnpVer; - byte Method; - uint StreamCRC; - ushort StreamNameSize; -/* dummy */ - byte StreamName[NM]; -}; - - -struct MacFInfoHeader:SubBlockHeader -{ - uint fileType; - uint fileCreator; -}; - - -#endif diff --git a/7zip/Compress/Rar29/Original/int64.cpp b/7zip/Compress/Rar29/Original/int64.cpp deleted file mode 100755 index 996d0ea6..00000000 --- a/7zip/Compress/Rar29/Original/int64.cpp +++ /dev/null @@ -1,274 +0,0 @@ -#include "rar.hpp" - -#ifndef NATIVE_INT64 - -Int64::Int64() -{ -} - - -Int64::Int64(uint n) -{ - HighPart=0; - LowPart=n; -} - - -Int64::Int64(uint HighPart,uint LowPart) -{ - Int64::HighPart=HighPart; - Int64::LowPart=LowPart; -} - - -/* -Int64 Int64::operator = (Int64 n) -{ - HighPart=n.HighPart; - LowPart=n.LowPart; - return(*this); -} -*/ - - -Int64 Int64::operator << (int n) -{ - Int64 res=*this; - while (n--) - { - res.HighPart<<=1; - if (res.LowPart & 0x80000000) - res.HighPart|=1; - res.LowPart<<=1; - } - return(res); -} - - -Int64 Int64::operator >> (int n) -{ - Int64 res=*this; - while (n--) - { - res.LowPart>>=1; - if (res.HighPart & 1) - res.LowPart|=0x80000000; - res.HighPart>>=1; - } - return(res); -} - - -Int64 operator / (Int64 n1,Int64 n2) -{ - if (n1.HighPart==0 && n2.HighPart==0) - return(Int64(0,n1.LowPart/n2.LowPart)); - int ShiftCount=0; - while (n1>n2) - { - n2=n2<<1; - if (++ShiftCount>64) - return(0); - } - Int64 res=0; - while (ShiftCount-- >= 0) - { - res=res<<1; - if (n1>=n2) - { - n1-=n2; - ++res; - } - n2=n2>>1; - } - return(res); -} - - -Int64 operator * (Int64 n1,Int64 n2) -{ - if (n1<0x10000 && n2<0x10000) - return(Int64(0,n1.LowPart*n2.LowPart)); - Int64 res=0; - for (int I=0;I<64;I++) - { - if (n2.LowPart & 1) - res+=n1; - n1=n1<<1; - n2=n2>>1; - } - return(res); -} - - -Int64 operator % (Int64 n1,Int64 n2) -{ - if (n1.HighPart==0 && n2.HighPart==0) - return(Int64(0,n1.LowPart%n2.LowPart)); - return(n1-n1/n2*n2); -} - - -Int64 operator + (Int64 n1,Int64 n2) -{ - n1.LowPart+=n2.LowPart; - if (n1.LowPart (Int64 n1,Int64 n2) -{ - return((int)n1.HighPart>(int)n2.HighPart || n1.HighPart==n2.HighPart && n1.LowPart>n2.LowPart); -} - - -bool operator < (Int64 n1,Int64 n2) -{ - return((int)n1.HighPart<(int)n2.HighPart || n1.HighPart==n2.HighPart && n1.LowPart= (Int64 n1,Int64 n2) -{ - return(n1>n2 || n1==n2); -} - - -bool operator <= (Int64 n1,Int64 n2) -{ - return(n1='0' && *Str<='9') - { - n=n*10+*Str-'0'; - Str++; - } - return(n); -} diff --git a/7zip/Compress/Rar29/Original/int64.hpp b/7zip/Compress/Rar29/Original/int64.hpp deleted file mode 100755 index a8057522..00000000 --- a/7zip/Compress/Rar29/Original/int64.hpp +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef _RAR_INT64_ -#define _RAR_INT64_ - -#if defined(__BORLANDC__) || defined(_MSC_VER) -#define NATIVE_INT64 -typedef __int64 Int64; -#endif - -#if defined(__GNUC__) || defined(__HP_aCC) -#define NATIVE_INT64 -typedef long long Int64; -#endif - -#ifdef NATIVE_INT64 - -#define int64to32(x) ((uint)(x)) -#define int32to64(high,low) ((((Int64)(high))<<32)+(low)) -#define is64plus(x) (x>=0) - -#else - -class Int64 -{ - public: - Int64(); - Int64(uint n); - Int64(uint HighPart,uint LowPart); - -// Int64 operator = (Int64 n); - Int64 operator << (int n); - Int64 operator >> (int n); - - friend Int64 operator / (Int64 n1,Int64 n2); - friend Int64 operator * (Int64 n1,Int64 n2); - friend Int64 operator % (Int64 n1,Int64 n2); - friend Int64 operator + (Int64 n1,Int64 n2); - friend Int64 operator - (Int64 n1,Int64 n2); - friend Int64 operator += (Int64 &n1,Int64 n2); - friend Int64 operator -= (Int64 &n1,Int64 n2); - friend Int64 operator *= (Int64 &n1,Int64 n2); - friend Int64 operator /= (Int64 &n1,Int64 n2); - friend Int64 operator | (Int64 n1,Int64 n2); - friend Int64 operator & (Int64 n1,Int64 n2); - inline friend void operator -= (Int64 &n1,unsigned int n2) - { - if (n1.LowPart (Int64 n1,Int64 n2); - friend bool operator < (Int64 n1,Int64 n2); - friend bool operator != (Int64 n1,Int64 n2); - friend bool operator >= (Int64 n1,Int64 n2); - friend bool operator <= (Int64 n1,Int64 n2); - - void Set(uint HighPart,uint LowPart); - uint GetLowPart() {return(LowPart);} - - uint LowPart; - uint HighPart; -}; - -inline uint int64to32(Int64 n) {return(n.GetLowPart());} -#define int32to64(high,low) (Int64((high),(low))) -#define is64plus(x) ((int)(x).HighPart>=0) - -#endif - -#define INT64ERR int32to64(0x80000000,0) -#define INT64MAX int32to64(0x7fffffff,0) - -void itoa(Int64 n,char *Str); -Int64 atoil(char *Str); - -#endif diff --git a/7zip/Compress/Rar29/Original/isnt.hpp b/7zip/Compress/Rar29/Original/isnt.hpp deleted file mode 100755 index 02652361..00000000 --- a/7zip/Compress/Rar29/Original/isnt.hpp +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _RAR_ISNT_ -#define _RAR_ISNT_ - -int WinNT(); - -#endif diff --git a/7zip/Compress/Rar29/Original/list.hpp b/7zip/Compress/Rar29/Original/list.hpp deleted file mode 100755 index 7721ae52..00000000 --- a/7zip/Compress/Rar29/Original/list.hpp +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _RAR_LIST_ -#define _RAR_LIST_ - -void ListArchive(CommandData *Cmd); - -#endif diff --git a/7zip/Compress/Rar29/Original/loclang.hpp b/7zip/Compress/Rar29/Original/loclang.hpp deleted file mode 100755 index 05eefdde..00000000 --- a/7zip/Compress/Rar29/Original/loclang.hpp +++ /dev/null @@ -1,340 +0,0 @@ -#define MYesNo "_Yes_No" -#define MYesNoAll "_Yes_No_All" -#define MYesNoAllRenQ "_Yes_No_All_nEver_Rename_Quit" -#define MContinueQuit "_Continue_Quit" -#define MRetryAbort "_Retry_Abort" -#define MCopyright "\nRAR %s Copyright (c) 1993-%d Alexander Roshal %d %s %d" -#define MRegTo "\nRegistered to %s\n" -#define MShare "\nShareware version Type RAR -? for help\n" -#define MUCopyright "\nUNRAR %s freeware Copyright (c) 1993-%d Alexander Roshal\n" -#define MBeta "beta" -#define MMonthJan "Jan" -#define MMonthFeb "Feb" -#define MMonthMar "Mar" -#define MMonthApr "Apr" -#define MMonthMay "May" -#define MMonthJun "Jun" -#define MMonthJul "Jul" -#define MMonthAug "Aug" -#define MMonthSep "Sep" -#define MMonthOct "Oct" -#define MMonthNov "Nov" -#define MMonthDec "Dec" -#define MRARTitle1 "\nUsage: rar - - " -#define MUNRARTitle1 "\nUsage: unrar - - " -#define MRARTitle2 "\n <@listfiles...> " -#define MCHelpCmd "\n\n" -#define MCHelpCmdA "\n a Add files to archive" -#define MCHelpCmdC "\n c Add archive comment" -#define MCHelpCmdCF "\n cf Add files comment" -#define MCHelpCmdCW "\n cw Write archive comment to file" -#define MCHelpCmdD "\n d Delete files from archive" -#define MCHelpCmdE "\n e Extract files to current directory" -#define MCHelpCmdF "\n f Freshen files in archive" -#define MCHelpCmdI "\n i[par]= Find string in archives" -#define MCHelpCmdK "\n k Lock archive" -#define MCHelpCmdL "\n l[t,b] List archive [technical, bare]" -#define MCHelpCmdM "\n m[f] Move to archive [files only]" -#define MCHelpCmdP "\n p Print file to stdout" -#define MCHelpCmdR "\n r Repair archive" -#define MCHelpCmdRC "\n rc Reconstruct missing volumes" -#define MCHelpCmdRN "\n rn Rename archived files" -#define MCHelpCmdRR "\n rr[N] Add data recovery record" -#define MCHelpCmdRV "\n rv[N] Create recovery volumes" -#define MCHelpCmdS "\n s[name|-] Convert archive to or from SFX" -#define MCHelpCmdT "\n t Test archive files" -#define MCHelpCmdU "\n u Update files in archive" -#define MCHelpCmdV "\n v[t,b] Verbosely list archive [technical,bare]" -#define MCHelpCmdX "\n x Extract files with full path" -#define MCHelpSw "\n\n" -#define MCHelpSwm "\n - Stop switches scanning" -#define MCHelpSwAC "\n ac Clear Archive attribute after compression or extraction" -#define MCHelpSwAD "\n ad Append archive name to destination path" -#define MCHelpSwAG "\n ag[format] Generate archive name using the current date" -#define MCHelpSwAO "\n ao Add files with Archive attribute set" -#define MCHelpSwAP "\n ap Set path inside archive" -#define MCHelpSwAS "\n as Synchronize archive contents" -#define MCHelpSwAV "\n av Put authenticity verification (registered versions only)" -#define MCHelpSwAVm "\n av- Disable authenticity verification check" -#define MCHelpSwCm "\n c- Disable comments show" -#define MCHelpSwCFGm "\n cfg- Disable read configuration" -#define MCHelpSwCL "\n cl Convert names to lower case" -#define MCHelpSwCU "\n cu Convert names to upper case" -#define MCHelpSwDF "\n df Delete files after archiving" -#define MCHelpSwDH "\n dh Open shared files" -#define MCHelpSwDS "\n ds Disable name sort for solid archive" -#define MCHelpSwEa "\n e[+] Set file exclude and include attributes" -#define MCHelpSwED "\n ed Do not add empty directories" -#define MCHelpSwEE "\n ee Do not save and extract extended attributes" -#define MCHelpSwEN "\n en Do not put 'end of archive' block" -#define MCHelpSwEP "\n ep Exclude paths from names" -#define MCHelpSwEP1 "\n ep1 Exclude base directory from names" -#define MCHelpSwEP2 "\n ep2 Expand paths to full" -#define MCHelpSwEP3 "\n ep3 Expand paths to full including the drive letter" -#define MCHelpSwF "\n f Freshen files" -#define MCHelpSwHP "\n hp[password] Encrypt both file data and headers" -#define MCHelpSwIDP "\n id[c,d,p,q] Disable messages" -#define MCHelpSwIEML "\n ieml[addr] Send archive by email" -#define MCHelpSwIERR "\n ierr Send all messages to stderr" -#define MCHelpSwILOG "\n ilog[name] Log errors to file (registered versions only)" -#define MCHelpSwINUL "\n inul Disable all messages" -#define MCHelpSwIOFF "\n ioff Turn PC off after completing an operation" -#define MCHelpSwISND "\n isnd Enable sound" -#define MCHelpSwK "\n k Lock archive" -#define MCHelpSwKB "\n kb Keep broken extracted files" -#define MCHelpSwMn "\n m<0..5> Set compression level (0-store...3-default...5-maximal)" -#define MCHelpSwMC "\n mc Set advanced compression parameters" -#define MCHelpSwMD "\n md Dictionary size in KB (64,128,256,512,1024,2048,4096 or A-G)" -#define MCHelpSwMS "\n ms[ext;ext] Specify file types to store" -#define MCHelpSwN "\n n Include only specified file" -#define MCHelpSwNa "\n n@ Read file names to include from stdin" -#define MCHelpSwNal "\n n@ Include files in specified list file" -#define MCHelpSwOp "\n o+ Overwrite existing files" -#define MCHelpSwOm "\n o- Do not overwrite existing files" -#define MCHelpSwOC "\n oc Set NTFS Compressed attribute" -#define MCHelpSwOL "\n ol Save symbolic links as the link instead of the file" -#define MCHelpSwOS "\n os Save NTFS streams" -#define MCHelpSwOW "\n ow Save or restore file owner and group" -#define MCHelpSwP "\n p[password] Set password" -#define MCHelpSwPm "\n p- Do not query password" -#define MCHelpSwR "\n r Recurse subdirectories" -#define MCHelpSwR0 "\n r0 Recurse subdirectories for wildcard names only" -#define MCHelpSwRI "\n ri

[:] Set priority (0-default,1-min..15-max) and sleep time in ms" -#define MCHelpSwRR "\n rr[N] Add data recovery record" -#define MCHelpSwRV "\n rv[N] Create recovery volumes" -#define MCHelpSwS "\n s[,v[-],e] Create solid archive" -#define MCHelpSwSm "\n s- Disable solid archiving" -#define MCHelpSwSFX "\n sfx[name] Create SFX archive" -#define MCHelpSwSI "\n si[name] Read data from standard input (stdin)" -#define MCHelpSwT "\n t Test files after archiving" -#define MCHelpSwTK "\n tk Keep original archive time" -#define MCHelpSwTL "\n tl Set archive time to latest file" -#define MCHelpSwTN "\n tn