seven_zip_ruby_am 1.2.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (734) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +26 -0
  3. data/.travis.yml +35 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +39 -0
  6. data/README.md +210 -0
  7. data/Rakefile +67 -0
  8. data/ext/C/Types.h +254 -0
  9. data/ext/CPP/7zip/Archive/IArchive.h +234 -0
  10. data/ext/CPP/7zip/IDecl.h +15 -0
  11. data/ext/CPP/7zip/IPassword.h +24 -0
  12. data/ext/CPP/7zip/IProgress.h +33 -0
  13. data/ext/CPP/7zip/IStream.h +58 -0
  14. data/ext/CPP/7zip/PropID.h +76 -0
  15. data/ext/CPP/Common/MyCom.h +225 -0
  16. data/ext/CPP/Common/MyGuidDef.h +54 -0
  17. data/ext/CPP/Common/MyInitGuid.h +22 -0
  18. data/ext/CPP/Common/MyUnknown.h +13 -0
  19. data/ext/CPP/Common/MyWindows.h +204 -0
  20. data/ext/CPP/Common/Types.h +11 -0
  21. data/ext/CPP/Windows/PropVariant.h +56 -0
  22. data/ext/CPP/include_windows/basetyps.h +19 -0
  23. data/ext/CPP/include_windows/tchar.h +89 -0
  24. data/ext/CPP/include_windows/windows.h +194 -0
  25. data/ext/p7zip/Asm/x64/7zCrcT8U.asm +103 -0
  26. data/ext/p7zip/Asm/x86/7zCrcT8U.asm +101 -0
  27. data/ext/p7zip/C/7zBuf.h +39 -0
  28. data/ext/p7zip/C/7zBuf2.c +45 -0
  29. data/ext/p7zip/C/7zCrc.c +76 -0
  30. data/ext/p7zip/C/7zCrc.h +25 -0
  31. data/ext/p7zip/C/7zCrcOpt.c +34 -0
  32. data/ext/p7zip/C/7zCrcT8.c +43 -0
  33. data/ext/p7zip/C/7zStream.c +169 -0
  34. data/ext/p7zip/C/7zVersion.h +7 -0
  35. data/ext/p7zip/C/Aes.c +284 -0
  36. data/ext/p7zip/C/Aes.h +38 -0
  37. data/ext/p7zip/C/Alloc.back3 +238 -0
  38. data/ext/p7zip/C/Alloc.c +280 -0
  39. data/ext/p7zip/C/Alloc.c.back +243 -0
  40. data/ext/p7zip/C/Alloc.c.back2 +222 -0
  41. data/ext/p7zip/C/Alloc.h +27 -0
  42. data/ext/p7zip/C/Bra.c +133 -0
  43. data/ext/p7zip/C/Bra.h +68 -0
  44. data/ext/p7zip/C/Bra86.c +85 -0
  45. data/ext/p7zip/C/BraIA64.c +67 -0
  46. data/ext/p7zip/C/BwtSort.c +516 -0
  47. data/ext/p7zip/C/BwtSort.h +30 -0
  48. data/ext/p7zip/C/CpuArch.c +168 -0
  49. data/ext/p7zip/C/CpuArch.h +155 -0
  50. data/ext/p7zip/C/Delta.c +62 -0
  51. data/ext/p7zip/C/Delta.h +23 -0
  52. data/ext/p7zip/C/HuffEnc.c +146 -0
  53. data/ext/p7zip/C/HuffEnc.h +27 -0
  54. data/ext/p7zip/C/LzFind.c +761 -0
  55. data/ext/p7zip/C/LzFind.h +115 -0
  56. data/ext/p7zip/C/LzFindMt.c +793 -0
  57. data/ext/p7zip/C/LzFindMt.h +105 -0
  58. data/ext/p7zip/C/LzHash.h +54 -0
  59. data/ext/p7zip/C/Lzma2Dec.c +356 -0
  60. data/ext/p7zip/C/Lzma2Dec.h +84 -0
  61. data/ext/p7zip/C/Lzma2Enc.c +477 -0
  62. data/ext/p7zip/C/Lzma2Enc.h +66 -0
  63. data/ext/p7zip/C/LzmaDec.c +999 -0
  64. data/ext/p7zip/C/LzmaDec.h +231 -0
  65. data/ext/p7zip/C/LzmaEnc.c +2268 -0
  66. data/ext/p7zip/C/LzmaEnc.h +80 -0
  67. data/ext/p7zip/C/LzmaUtil/Lzma86Dec.c +61 -0
  68. data/ext/p7zip/C/LzmaUtil/Lzma86Dec.h +51 -0
  69. data/ext/p7zip/C/LzmaUtil/Lzma86Enc.c +113 -0
  70. data/ext/p7zip/C/LzmaUtil/Lzma86Enc.h +78 -0
  71. data/ext/p7zip/C/MtCoder.c +327 -0
  72. data/ext/p7zip/C/MtCoder.h +98 -0
  73. data/ext/p7zip/C/Ppmd.h +85 -0
  74. data/ext/p7zip/C/Ppmd7.c +708 -0
  75. data/ext/p7zip/C/Ppmd7.h +140 -0
  76. data/ext/p7zip/C/Ppmd7Dec.c +187 -0
  77. data/ext/p7zip/C/Ppmd7Enc.c +185 -0
  78. data/ext/p7zip/C/Ppmd8.c +1120 -0
  79. data/ext/p7zip/C/Ppmd8.h +133 -0
  80. data/ext/p7zip/C/Ppmd8Dec.c +155 -0
  81. data/ext/p7zip/C/Ppmd8Enc.c +161 -0
  82. data/ext/p7zip/C/RotateDefs.h +20 -0
  83. data/ext/p7zip/C/Sha256.c +204 -0
  84. data/ext/p7zip/C/Sha256.h +26 -0
  85. data/ext/p7zip/C/Sort.c +93 -0
  86. data/ext/p7zip/C/Sort.h +20 -0
  87. data/ext/p7zip/C/Threads.c +582 -0
  88. data/ext/p7zip/C/Threads.h +123 -0
  89. data/ext/p7zip/C/Types.h +254 -0
  90. data/ext/p7zip/C/Xz.c +88 -0
  91. data/ext/p7zip/C/Xz.h +252 -0
  92. data/ext/p7zip/C/XzCrc64.c +33 -0
  93. data/ext/p7zip/C/XzCrc64.h +26 -0
  94. data/ext/p7zip/C/XzDec.c +875 -0
  95. data/ext/p7zip/C/XzEnc.c +497 -0
  96. data/ext/p7zip/C/XzEnc.h +25 -0
  97. data/ext/p7zip/C/XzIn.c +306 -0
  98. data/ext/p7zip/CPP/7zip/Archive/7z/7zCompressionMode.cpp +3 -0
  99. data/ext/p7zip/CPP/7zip/Archive/7z/7zCompressionMode.h +50 -0
  100. data/ext/p7zip/CPP/7zip/Archive/7z/7zDecode.cpp +332 -0
  101. data/ext/p7zip/CPP/7zip/Archive/7z/7zDecode.h +68 -0
  102. data/ext/p7zip/CPP/7zip/Archive/7z/7zEncode.cpp +444 -0
  103. data/ext/p7zip/CPP/7zip/Archive/7z/7zEncode.h +55 -0
  104. data/ext/p7zip/CPP/7zip/Archive/7z/7zExtract.cpp +270 -0
  105. data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderInStream.cpp +123 -0
  106. data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderInStream.h +58 -0
  107. data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderOutStream.cpp +149 -0
  108. data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderOutStream.h +58 -0
  109. data/ext/p7zip/CPP/7zip/Archive/7z/7zHandler.cpp +482 -0
  110. data/ext/p7zip/CPP/7zip/Archive/7z/7zHandler.h +119 -0
  111. data/ext/p7zip/CPP/7zip/Archive/7z/7zHandlerOut.cpp +483 -0
  112. data/ext/p7zip/CPP/7zip/Archive/7z/7zHeader.cpp +14 -0
  113. data/ext/p7zip/CPP/7zip/Archive/7z/7zHeader.h +97 -0
  114. data/ext/p7zip/CPP/7zip/Archive/7z/7zIn.cpp +1276 -0
  115. data/ext/p7zip/CPP/7zip/Archive/7z/7zIn.h +245 -0
  116. data/ext/p7zip/CPP/7zip/Archive/7z/7zItem.h +268 -0
  117. data/ext/p7zip/CPP/7zip/Archive/7z/7zOut.cpp +866 -0
  118. data/ext/p7zip/CPP/7zip/Archive/7z/7zOut.h +152 -0
  119. data/ext/p7zip/CPP/7zip/Archive/7z/7zProperties.cpp +164 -0
  120. data/ext/p7zip/CPP/7zip/Archive/7z/7zProperties.h +22 -0
  121. data/ext/p7zip/CPP/7zip/Archive/7z/7zRegister.cpp +18 -0
  122. data/ext/p7zip/CPP/7zip/Archive/7z/7zSpecStream.cpp +24 -0
  123. data/ext/p7zip/CPP/7zip/Archive/7z/7zSpecStream.h +35 -0
  124. data/ext/p7zip/CPP/7zip/Archive/7z/7zUpdate.cpp +1216 -0
  125. data/ext/p7zip/CPP/7zip/Archive/7z/7zUpdate.h +88 -0
  126. data/ext/p7zip/CPP/7zip/Archive/ApmHandler.cpp +356 -0
  127. data/ext/p7zip/CPP/7zip/Archive/ArchiveExports.cpp +135 -0
  128. data/ext/p7zip/CPP/7zip/Archive/ArjHandler.cpp +798 -0
  129. data/ext/p7zip/CPP/7zip/Archive/Bz2Handler.cpp +423 -0
  130. data/ext/p7zip/CPP/7zip/Archive/Cab/CabBlockInStream.cpp +189 -0
  131. data/ext/p7zip/CPP/7zip/Archive/Cab/CabBlockInStream.h +44 -0
  132. data/ext/p7zip/CPP/7zip/Archive/Cab/CabHandler.cpp +929 -0
  133. data/ext/p7zip/CPP/7zip/Archive/Cab/CabHandler.h +28 -0
  134. data/ext/p7zip/CPP/7zip/Archive/Cab/CabHeader.cpp +15 -0
  135. data/ext/p7zip/CPP/7zip/Archive/Cab/CabHeader.h +44 -0
  136. data/ext/p7zip/CPP/7zip/Archive/Cab/CabIn.cpp +272 -0
  137. data/ext/p7zip/CPP/7zip/Archive/Cab/CabIn.h +161 -0
  138. data/ext/p7zip/CPP/7zip/Archive/Cab/CabItem.h +63 -0
  139. data/ext/p7zip/CPP/7zip/Archive/Cab/CabRegister.cpp +13 -0
  140. data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHandler.cpp +721 -0
  141. data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHandler.h +29 -0
  142. data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHeader.cpp +24 -0
  143. data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHeader.h +28 -0
  144. data/ext/p7zip/CPP/7zip/Archive/Chm/ChmIn.cpp +937 -0
  145. data/ext/p7zip/CPP/7zip/Archive/Chm/ChmIn.h +244 -0
  146. data/ext/p7zip/CPP/7zip/Archive/Chm/ChmRegister.cpp +13 -0
  147. data/ext/p7zip/CPP/7zip/Archive/Com/ComHandler.cpp +239 -0
  148. data/ext/p7zip/CPP/7zip/Archive/Com/ComHandler.h +28 -0
  149. data/ext/p7zip/CPP/7zip/Archive/Com/ComIn.cpp +389 -0
  150. data/ext/p7zip/CPP/7zip/Archive/Com/ComIn.h +119 -0
  151. data/ext/p7zip/CPP/7zip/Archive/Com/ComRegister.cpp +13 -0
  152. data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2.cpp +121 -0
  153. data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2.h +174 -0
  154. data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2MT.cpp +240 -0
  155. data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2MT.h +80 -0
  156. data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2ST.cpp +239 -0
  157. data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2ST.h +88 -0
  158. data/ext/p7zip/CPP/7zip/Archive/Common/CrossThreadProgress.cpp +15 -0
  159. data/ext/p7zip/CPP/7zip/Archive/Common/CrossThreadProgress.h +37 -0
  160. data/ext/p7zip/CPP/7zip/Archive/Common/DummyOutStream.cpp +22 -0
  161. data/ext/p7zip/CPP/7zip/Archive/Common/DummyOutStream.h +24 -0
  162. data/ext/p7zip/CPP/7zip/Archive/Common/FindSignature.cpp +62 -0
  163. data/ext/p7zip/CPP/7zip/Archive/Common/FindSignature.h +12 -0
  164. data/ext/p7zip/CPP/7zip/Archive/Common/HandlerOut.cpp +623 -0
  165. data/ext/p7zip/CPP/7zip/Archive/Common/HandlerOut.h +87 -0
  166. data/ext/p7zip/CPP/7zip/Archive/Common/InStreamWithCRC.cpp +42 -0
  167. data/ext/p7zip/CPP/7zip/Archive/Common/InStreamWithCRC.h +67 -0
  168. data/ext/p7zip/CPP/7zip/Archive/Common/ItemNameUtils.cpp +61 -0
  169. data/ext/p7zip/CPP/7zip/Archive/Common/ItemNameUtils.h +24 -0
  170. data/ext/p7zip/CPP/7zip/Archive/Common/MultiStream.cpp +190 -0
  171. data/ext/p7zip/CPP/7zip/Archive/Common/MultiStream.h +84 -0
  172. data/ext/p7zip/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp +18 -0
  173. data/ext/p7zip/CPP/7zip/Archive/Common/OutStreamWithCRC.h +36 -0
  174. data/ext/p7zip/CPP/7zip/Archive/Common/OutStreamWithSha1.cpp +18 -0
  175. data/ext/p7zip/CPP/7zip/Archive/Common/OutStreamWithSha1.h +36 -0
  176. data/ext/p7zip/CPP/7zip/Archive/Common/ParseProperties.cpp +177 -0
  177. data/ext/p7zip/CPP/7zip/Archive/Common/ParseProperties.h +18 -0
  178. data/ext/p7zip/CPP/7zip/Archive/CpioHandler.cpp +624 -0
  179. data/ext/p7zip/CPP/7zip/Archive/CramfsHandler.cpp +644 -0
  180. data/ext/p7zip/CPP/7zip/Archive/DebHandler.cpp +413 -0
  181. data/ext/p7zip/CPP/7zip/Archive/DeflateProps.cpp +118 -0
  182. data/ext/p7zip/CPP/7zip/Archive/DeflateProps.h +35 -0
  183. data/ext/p7zip/CPP/7zip/Archive/DllExports2.cpp +76 -0
  184. data/ext/p7zip/CPP/7zip/Archive/DmgHandler.cpp +918 -0
  185. data/ext/p7zip/CPP/7zip/Archive/ElfHandler.cpp +534 -0
  186. data/ext/p7zip/CPP/7zip/Archive/FatHandler.cpp +996 -0
  187. data/ext/p7zip/CPP/7zip/Archive/FlvHandler.cpp +544 -0
  188. data/ext/p7zip/CPP/7zip/Archive/GzHandler.cpp +698 -0
  189. data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsHandler.cpp +243 -0
  190. data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsHandler.h +26 -0
  191. data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsIn.cpp +480 -0
  192. data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsIn.h +154 -0
  193. data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsRegister.cpp +13 -0
  194. data/ext/p7zip/CPP/7zip/Archive/IArchive.h +234 -0
  195. data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHandler.cpp +326 -0
  196. data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHandler.h +30 -0
  197. data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHeader.cpp +21 -0
  198. data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHeader.h +61 -0
  199. data/ext/p7zip/CPP/7zip/Archive/Iso/IsoIn.cpp +453 -0
  200. data/ext/p7zip/CPP/7zip/Archive/Iso/IsoIn.h +315 -0
  201. data/ext/p7zip/CPP/7zip/Archive/Iso/IsoItem.h +141 -0
  202. data/ext/p7zip/CPP/7zip/Archive/Iso/IsoRegister.cpp +13 -0
  203. data/ext/p7zip/CPP/7zip/Archive/LzhHandler.cpp +775 -0
  204. data/ext/p7zip/CPP/7zip/Archive/LzmaHandler.cpp +430 -0
  205. data/ext/p7zip/CPP/7zip/Archive/MachoHandler.cpp +500 -0
  206. data/ext/p7zip/CPP/7zip/Archive/MbrHandler.cpp +507 -0
  207. data/ext/p7zip/CPP/7zip/Archive/MslzHandler.cpp +257 -0
  208. data/ext/p7zip/CPP/7zip/Archive/MubHandler.cpp +266 -0
  209. data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisDecode.cpp +130 -0
  210. data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisDecode.h +47 -0
  211. data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisHandler.cpp +510 -0
  212. data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisHandler.h +43 -0
  213. data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisIn.cpp +1461 -0
  214. data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisIn.h +181 -0
  215. data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisRegister.cpp +13 -0
  216. data/ext/p7zip/CPP/7zip/Archive/NtfsHandler.cpp +1764 -0
  217. data/ext/p7zip/CPP/7zip/Archive/PeHandler.cpp +1752 -0
  218. data/ext/p7zip/CPP/7zip/Archive/PpmdHandler.cpp +456 -0
  219. data/ext/p7zip/CPP/7zip/Archive/Rar/RarHandler.cpp +869 -0
  220. data/ext/p7zip/CPP/7zip/Archive/Rar/RarHandler.h +66 -0
  221. data/ext/p7zip/CPP/7zip/Archive/Rar/RarHeader.cpp +21 -0
  222. data/ext/p7zip/CPP/7zip/Archive/Rar/RarHeader.h +205 -0
  223. data/ext/p7zip/CPP/7zip/Archive/Rar/RarIn.cpp +478 -0
  224. data/ext/p7zip/CPP/7zip/Archive/Rar/RarIn.h +123 -0
  225. data/ext/p7zip/CPP/7zip/Archive/Rar/RarItem.cpp +55 -0
  226. data/ext/p7zip/CPP/7zip/Archive/Rar/RarItem.h +79 -0
  227. data/ext/p7zip/CPP/7zip/Archive/Rar/RarRegister.cpp +13 -0
  228. data/ext/p7zip/CPP/7zip/Archive/Rar/RarVolumeInStream.cpp +78 -0
  229. data/ext/p7zip/CPP/7zip/Archive/Rar/RarVolumeInStream.h +49 -0
  230. data/ext/p7zip/CPP/7zip/Archive/RpmHandler.cpp +292 -0
  231. data/ext/p7zip/CPP/7zip/Archive/SplitHandler.cpp +366 -0
  232. data/ext/p7zip/CPP/7zip/Archive/SquashfsHandler.cpp +2155 -0
  233. data/ext/p7zip/CPP/7zip/Archive/SwfHandler.cpp +706 -0
  234. data/ext/p7zip/CPP/7zip/Archive/Tar/TarHandler.cpp +386 -0
  235. data/ext/p7zip/CPP/7zip/Archive/Tar/TarHandler.h +61 -0
  236. data/ext/p7zip/CPP/7zip/Archive/Tar/TarHandlerOut.cpp +122 -0
  237. data/ext/p7zip/CPP/7zip/Archive/Tar/TarHeader.cpp +25 -0
  238. data/ext/p7zip/CPP/7zip/Archive/Tar/TarHeader.h +108 -0
  239. data/ext/p7zip/CPP/7zip/Archive/Tar/TarIn.cpp +207 -0
  240. data/ext/p7zip/CPP/7zip/Archive/Tar/TarIn.h +17 -0
  241. data/ext/p7zip/CPP/7zip/Archive/Tar/TarItem.h +72 -0
  242. data/ext/p7zip/CPP/7zip/Archive/Tar/TarOut.cpp +187 -0
  243. data/ext/p7zip/CPP/7zip/Archive/Tar/TarOut.h +28 -0
  244. data/ext/p7zip/CPP/7zip/Archive/Tar/TarRegister.cpp +18 -0
  245. data/ext/p7zip/CPP/7zip/Archive/Tar/TarUpdate.cpp +139 -0
  246. data/ext/p7zip/CPP/7zip/Archive/Tar/TarUpdate.h +34 -0
  247. data/ext/p7zip/CPP/7zip/Archive/Udf/UdfHandler.cpp +451 -0
  248. data/ext/p7zip/CPP/7zip/Archive/Udf/UdfHandler.h +37 -0
  249. data/ext/p7zip/CPP/7zip/Archive/Udf/UdfIn.cpp +876 -0
  250. data/ext/p7zip/CPP/7zip/Archive/Udf/UdfIn.h +375 -0
  251. data/ext/p7zip/CPP/7zip/Archive/Udf/UdfRegister.cpp +13 -0
  252. data/ext/p7zip/CPP/7zip/Archive/VhdHandler.cpp +734 -0
  253. data/ext/p7zip/CPP/7zip/Archive/Wim/WimHandler.cpp +660 -0
  254. data/ext/p7zip/CPP/7zip/Archive/Wim/WimHandler.h +77 -0
  255. data/ext/p7zip/CPP/7zip/Archive/Wim/WimHandlerOut.cpp +639 -0
  256. data/ext/p7zip/CPP/7zip/Archive/Wim/WimIn.cpp +855 -0
  257. data/ext/p7zip/CPP/7zip/Archive/Wim/WimIn.h +297 -0
  258. data/ext/p7zip/CPP/7zip/Archive/Wim/WimRegister.cpp +18 -0
  259. data/ext/p7zip/CPP/7zip/Archive/XarHandler.cpp +588 -0
  260. data/ext/p7zip/CPP/7zip/Archive/XzHandler.cpp +707 -0
  261. data/ext/p7zip/CPP/7zip/Archive/ZHandler.cpp +161 -0
  262. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipAddCommon.cpp +379 -0
  263. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipAddCommon.h +56 -0
  264. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipCompressionMode.h +42 -0
  265. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHandler.cpp +822 -0
  266. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHandler.h +101 -0
  267. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp +537 -0
  268. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHeader.cpp +36 -0
  269. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHeader.h +284 -0
  270. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipIn.cpp +893 -0
  271. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipIn.h +125 -0
  272. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipItem.cpp +181 -0
  273. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipItem.h +281 -0
  274. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipItemEx.h +34 -0
  275. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipOut.cpp +289 -0
  276. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipOut.h +56 -0
  277. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipRegister.cpp +18 -0
  278. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipUpdate.cpp +1076 -0
  279. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipUpdate.h +58 -0
  280. data/ext/p7zip/CPP/7zip/Bundles/Format7zFree/makefile +328 -0
  281. data/ext/p7zip/CPP/7zip/Bundles/Format7zFree/makefile.depend +4962 -0
  282. data/ext/p7zip/CPP/7zip/Bundles/Format7zFree/makefile.list +265 -0
  283. data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_7zFM.txt +163 -0
  284. data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_7zG.txt +131 -0
  285. data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_7za.txt +253 -0
  286. data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_ALL.txt +32 -0
  287. data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_Format7zFree.txt +290 -0
  288. data/ext/p7zip/CPP/7zip/CMAKE/generate.sh +37 -0
  289. data/ext/p7zip/CPP/7zip/CMAKE/generate_xcode.sh +32 -0
  290. data/ext/p7zip/CPP/7zip/Common/CWrappers.cpp +226 -0
  291. data/ext/p7zip/CPP/7zip/Common/CWrappers.h +109 -0
  292. data/ext/p7zip/CPP/7zip/Common/CreateCoder.cpp +293 -0
  293. data/ext/p7zip/CPP/7zip/Common/CreateCoder.h +98 -0
  294. data/ext/p7zip/CPP/7zip/Common/FilePathAutoRename.cpp +55 -0
  295. data/ext/p7zip/CPP/7zip/Common/FilePathAutoRename.h +10 -0
  296. data/ext/p7zip/CPP/7zip/Common/FileStreams.cpp +273 -0
  297. data/ext/p7zip/CPP/7zip/Common/FileStreams.h +134 -0
  298. data/ext/p7zip/CPP/7zip/Common/FilterCoder.cpp +247 -0
  299. data/ext/p7zip/CPP/7zip/Common/FilterCoder.h +128 -0
  300. data/ext/p7zip/CPP/7zip/Common/InBuffer.cpp +83 -0
  301. data/ext/p7zip/CPP/7zip/Common/InBuffer.h +81 -0
  302. data/ext/p7zip/CPP/7zip/Common/InOutTempBuffer.cpp +122 -0
  303. data/ext/p7zip/CPP/7zip/Common/InOutTempBuffer.h +48 -0
  304. data/ext/p7zip/CPP/7zip/Common/LimitedStreams.cpp +154 -0
  305. data/ext/p7zip/CPP/7zip/Common/LimitedStreams.h +125 -0
  306. data/ext/p7zip/CPP/7zip/Common/LockedStream.cpp +23 -0
  307. data/ext/p7zip/CPP/7zip/Common/LockedStream.h +38 -0
  308. data/ext/p7zip/CPP/7zip/Common/MemBlocks.cpp +183 -0
  309. data/ext/p7zip/CPP/7zip/Common/MemBlocks.h +71 -0
  310. data/ext/p7zip/CPP/7zip/Common/MethodId.cpp +27 -0
  311. data/ext/p7zip/CPP/7zip/Common/MethodId.h +10 -0
  312. data/ext/p7zip/CPP/7zip/Common/MethodProps.cpp +99 -0
  313. data/ext/p7zip/CPP/7zip/Common/MethodProps.h +41 -0
  314. data/ext/p7zip/CPP/7zip/Common/OffsetStream.cpp +35 -0
  315. data/ext/p7zip/CPP/7zip/Common/OffsetStream.h +25 -0
  316. data/ext/p7zip/CPP/7zip/Common/OutBuffer.cpp +116 -0
  317. data/ext/p7zip/CPP/7zip/Common/OutBuffer.h +64 -0
  318. data/ext/p7zip/CPP/7zip/Common/OutMemStream.cpp +142 -0
  319. data/ext/p7zip/CPP/7zip/Common/OutMemStream.h +96 -0
  320. data/ext/p7zip/CPP/7zip/Common/ProgressMt.cpp +53 -0
  321. data/ext/p7zip/CPP/7zip/Common/ProgressMt.h +46 -0
  322. data/ext/p7zip/CPP/7zip/Common/ProgressUtils.cpp +42 -0
  323. data/ext/p7zip/CPP/7zip/Common/ProgressUtils.h +34 -0
  324. data/ext/p7zip/CPP/7zip/Common/RegisterArc.h +32 -0
  325. data/ext/p7zip/CPP/7zip/Common/RegisterCodec.h +33 -0
  326. data/ext/p7zip/CPP/7zip/Common/StreamBinder.cpp +152 -0
  327. data/ext/p7zip/CPP/7zip/Common/StreamBinder.h +38 -0
  328. data/ext/p7zip/CPP/7zip/Common/StreamObjects.cpp +221 -0
  329. data/ext/p7zip/CPP/7zip/Common/StreamObjects.h +135 -0
  330. data/ext/p7zip/CPP/7zip/Common/StreamUtils.cpp +56 -0
  331. data/ext/p7zip/CPP/7zip/Common/StreamUtils.h +13 -0
  332. data/ext/p7zip/CPP/7zip/Common/VirtThread.cpp +46 -0
  333. data/ext/p7zip/CPP/7zip/Common/VirtThread.h +23 -0
  334. data/ext/p7zip/CPP/7zip/Compress/ArjDecoder1.cpp +309 -0
  335. data/ext/p7zip/CPP/7zip/Compress/ArjDecoder1.h +98 -0
  336. data/ext/p7zip/CPP/7zip/Compress/ArjDecoder2.cpp +90 -0
  337. data/ext/p7zip/CPP/7zip/Compress/ArjDecoder2.h +59 -0
  338. data/ext/p7zip/CPP/7zip/Compress/BZip2Const.h +54 -0
  339. data/ext/p7zip/CPP/7zip/Compress/BZip2Crc.cpp +26 -0
  340. data/ext/p7zip/CPP/7zip/Compress/BZip2Crc.h +31 -0
  341. data/ext/p7zip/CPP/7zip/Compress/BZip2Decoder.cpp +943 -0
  342. data/ext/p7zip/CPP/7zip/Compress/BZip2Decoder.h +205 -0
  343. data/ext/p7zip/CPP/7zip/Compress/BZip2Encoder.cpp +895 -0
  344. data/ext/p7zip/CPP/7zip/Compress/BZip2Encoder.h +245 -0
  345. data/ext/p7zip/CPP/7zip/Compress/BZip2Register.cpp +20 -0
  346. data/ext/p7zip/CPP/7zip/Compress/Bcj2Coder.cpp +386 -0
  347. data/ext/p7zip/CPP/7zip/Compress/Bcj2Coder.h +115 -0
  348. data/ext/p7zip/CPP/7zip/Compress/Bcj2Register.cpp +19 -0
  349. data/ext/p7zip/CPP/7zip/Compress/BcjCoder.cpp +15 -0
  350. data/ext/p7zip/CPP/7zip/Compress/BcjCoder.h +19 -0
  351. data/ext/p7zip/CPP/7zip/Compress/BcjRegister.cpp +19 -0
  352. data/ext/p7zip/CPP/7zip/Compress/BitlDecoder.cpp +24 -0
  353. data/ext/p7zip/CPP/7zip/Compress/BitlDecoder.h +141 -0
  354. data/ext/p7zip/CPP/7zip/Compress/BitlEncoder.h +57 -0
  355. data/ext/p7zip/CPP/7zip/Compress/BitmDecoder.h +66 -0
  356. data/ext/p7zip/CPP/7zip/Compress/BitmEncoder.h +50 -0
  357. data/ext/p7zip/CPP/7zip/Compress/BranchCoder.cpp +19 -0
  358. data/ext/p7zip/CPP/7zip/Compress/BranchCoder.h +44 -0
  359. data/ext/p7zip/CPP/7zip/Compress/BranchMisc.cpp +37 -0
  360. data/ext/p7zip/CPP/7zip/Compress/BranchMisc.h +14 -0
  361. data/ext/p7zip/CPP/7zip/Compress/BranchRegister.cpp +30 -0
  362. data/ext/p7zip/CPP/7zip/Compress/ByteSwap.cpp +73 -0
  363. data/ext/p7zip/CPP/7zip/Compress/CodecExports.cpp +160 -0
  364. data/ext/p7zip/CPP/7zip/Compress/CopyCoder.cpp +67 -0
  365. data/ext/p7zip/CPP/7zip/Compress/CopyCoder.h +34 -0
  366. data/ext/p7zip/CPP/7zip/Compress/CopyRegister.cpp +14 -0
  367. data/ext/p7zip/CPP/7zip/Compress/Deflate64Register.cpp +20 -0
  368. data/ext/p7zip/CPP/7zip/Compress/DeflateConst.h +134 -0
  369. data/ext/p7zip/CPP/7zip/Compress/DeflateDecoder.cpp +353 -0
  370. data/ext/p7zip/CPP/7zip/Compress/DeflateDecoder.h +157 -0
  371. data/ext/p7zip/CPP/7zip/Compress/DeflateEncoder.cpp +986 -0
  372. data/ext/p7zip/CPP/7zip/Compress/DeflateEncoder.h +211 -0
  373. data/ext/p7zip/CPP/7zip/Compress/DeflateRegister.cpp +21 -0
  374. data/ext/p7zip/CPP/7zip/Compress/DeltaFilter.cpp +112 -0
  375. data/ext/p7zip/CPP/7zip/Compress/DllExports.cpp +39 -0
  376. data/ext/p7zip/CPP/7zip/Compress/DllExports2.cpp +28 -0
  377. data/ext/p7zip/CPP/7zip/Compress/HuffmanDecoder.h +89 -0
  378. data/ext/p7zip/CPP/7zip/Compress/ImplodeDecoder.cpp +219 -0
  379. data/ext/p7zip/CPP/7zip/Compress/ImplodeDecoder.h +57 -0
  380. data/ext/p7zip/CPP/7zip/Compress/ImplodeHuffmanDecoder.cpp +89 -0
  381. data/ext/p7zip/CPP/7zip/Compress/ImplodeHuffmanDecoder.h +34 -0
  382. data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp +531 -0
  383. data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp +1018 -0
  384. data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBench.h +48 -0
  385. data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.cpp +311 -0
  386. data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.h +20 -0
  387. data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/makefile +173 -0
  388. data/ext/p7zip/CPP/7zip/Compress/LzOutWindow.cpp +14 -0
  389. data/ext/p7zip/CPP/7zip/Compress/LzOutWindow.h +66 -0
  390. data/ext/p7zip/CPP/7zip/Compress/LzhDecoder.cpp +220 -0
  391. data/ext/p7zip/CPP/7zip/Compress/LzhDecoder.h +106 -0
  392. data/ext/p7zip/CPP/7zip/Compress/Lzma2Decoder.cpp +189 -0
  393. data/ext/p7zip/CPP/7zip/Compress/Lzma2Decoder.h +73 -0
  394. data/ext/p7zip/CPP/7zip/Compress/Lzma2Encoder.cpp +94 -0
  395. data/ext/p7zip/CPP/7zip/Compress/Lzma2Encoder.h +36 -0
  396. data/ext/p7zip/CPP/7zip/Compress/Lzma2Register.cpp +20 -0
  397. data/ext/p7zip/CPP/7zip/Compress/LzmaDecoder.cpp +252 -0
  398. data/ext/p7zip/CPP/7zip/Compress/LzmaDecoder.h +84 -0
  399. data/ext/p7zip/CPP/7zip/Compress/LzmaEncoder.cpp +149 -0
  400. data/ext/p7zip/CPP/7zip/Compress/LzmaEncoder.h +36 -0
  401. data/ext/p7zip/CPP/7zip/Compress/LzmaRegister.cpp +20 -0
  402. data/ext/p7zip/CPP/7zip/Compress/Lzx.h +61 -0
  403. data/ext/p7zip/CPP/7zip/Compress/Lzx86Converter.cpp +90 -0
  404. data/ext/p7zip/CPP/7zip/Compress/Lzx86Converter.h +46 -0
  405. data/ext/p7zip/CPP/7zip/Compress/LzxDecoder.cpp +387 -0
  406. data/ext/p7zip/CPP/7zip/Compress/LzxDecoder.h +159 -0
  407. data/ext/p7zip/CPP/7zip/Compress/Mtf8.h +193 -0
  408. data/ext/p7zip/CPP/7zip/Compress/PpmdDecoder.cpp +167 -0
  409. data/ext/p7zip/CPP/7zip/Compress/PpmdDecoder.h +78 -0
  410. data/ext/p7zip/CPP/7zip/Compress/PpmdEncoder.cpp +119 -0
  411. data/ext/p7zip/CPP/7zip/Compress/PpmdEncoder.h +48 -0
  412. data/ext/p7zip/CPP/7zip/Compress/PpmdRegister.cpp +21 -0
  413. data/ext/p7zip/CPP/7zip/Compress/PpmdZip.cpp +223 -0
  414. data/ext/p7zip/CPP/7zip/Compress/PpmdZip.h +72 -0
  415. data/ext/p7zip/CPP/7zip/Compress/QuantumDecoder.cpp +175 -0
  416. data/ext/p7zip/CPP/7zip/Compress/QuantumDecoder.h +264 -0
  417. data/ext/p7zip/CPP/7zip/Compress/RangeCoder.h +205 -0
  418. data/ext/p7zip/CPP/7zip/Compress/RangeCoderBit.h +114 -0
  419. data/ext/p7zip/CPP/7zip/Compress/Rar/makefile +34 -0
  420. data/ext/p7zip/CPP/7zip/Compress/Rar/makefile.depend +158 -0
  421. data/ext/p7zip/CPP/7zip/Compress/Rar/makefile.list +64 -0
  422. data/ext/p7zip/CPP/7zip/Compress/Rar1Decoder.cpp +480 -0
  423. data/ext/p7zip/CPP/7zip/Compress/Rar1Decoder.h +88 -0
  424. data/ext/p7zip/CPP/7zip/Compress/Rar2Decoder.cpp +391 -0
  425. data/ext/p7zip/CPP/7zip/Compress/Rar2Decoder.h +174 -0
  426. data/ext/p7zip/CPP/7zip/Compress/Rar3Decoder.cpp +897 -0
  427. data/ext/p7zip/CPP/7zip/Compress/Rar3Decoder.h +267 -0
  428. data/ext/p7zip/CPP/7zip/Compress/Rar3Vm.cpp +1091 -0
  429. data/ext/p7zip/CPP/7zip/Compress/Rar3Vm.h +179 -0
  430. data/ext/p7zip/CPP/7zip/Compress/RarCodecsRegister.cpp +26 -0
  431. data/ext/p7zip/CPP/7zip/Compress/ShrinkDecoder.cpp +145 -0
  432. data/ext/p7zip/CPP/7zip/Compress/ShrinkDecoder.h +38 -0
  433. data/ext/p7zip/CPP/7zip/Compress/ZDecoder.cpp +159 -0
  434. data/ext/p7zip/CPP/7zip/Compress/ZDecoder.h +42 -0
  435. data/ext/p7zip/CPP/7zip/Compress/ZlibDecoder.cpp +89 -0
  436. data/ext/p7zip/CPP/7zip/Compress/ZlibDecoder.h +48 -0
  437. data/ext/p7zip/CPP/7zip/Compress/ZlibEncoder.cpp +61 -0
  438. data/ext/p7zip/CPP/7zip/Compress/ZlibEncoder.h +48 -0
  439. data/ext/p7zip/CPP/7zip/Crypto/7zAes.cpp +244 -0
  440. data/ext/p7zip/CPP/7zip/Crypto/7zAes.h +117 -0
  441. data/ext/p7zip/CPP/7zip/Crypto/7zAesRegister.cpp +18 -0
  442. data/ext/p7zip/CPP/7zip/Crypto/HmacSha1.cpp +109 -0
  443. data/ext/p7zip/CPP/7zip/Crypto/HmacSha1.h +39 -0
  444. data/ext/p7zip/CPP/7zip/Crypto/MyAes.cpp +48 -0
  445. data/ext/p7zip/CPP/7zip/Crypto/MyAes.h +38 -0
  446. data/ext/p7zip/CPP/7zip/Crypto/Pbkdf2HmacSha1.cpp +83 -0
  447. data/ext/p7zip/CPP/7zip/Crypto/Pbkdf2HmacSha1.h +21 -0
  448. data/ext/p7zip/CPP/7zip/Crypto/RandGen.cpp +107 -0
  449. data/ext/p7zip/CPP/7zip/Crypto/RandGen.h +21 -0
  450. data/ext/p7zip/CPP/7zip/Crypto/Rar20Crypto.cpp +133 -0
  451. data/ext/p7zip/CPP/7zip/Crypto/Rar20Crypto.h +50 -0
  452. data/ext/p7zip/CPP/7zip/Crypto/RarAes.cpp +134 -0
  453. data/ext/p7zip/CPP/7zip/Crypto/RarAes.h +47 -0
  454. data/ext/p7zip/CPP/7zip/Crypto/Sha1.cpp +229 -0
  455. data/ext/p7zip/CPP/7zip/Crypto/Sha1.h +68 -0
  456. data/ext/p7zip/CPP/7zip/Crypto/WzAes.cpp +221 -0
  457. data/ext/p7zip/CPP/7zip/Crypto/WzAes.h +125 -0
  458. data/ext/p7zip/CPP/7zip/Crypto/ZipCrypto.cpp +88 -0
  459. data/ext/p7zip/CPP/7zip/Crypto/ZipCrypto.h +56 -0
  460. data/ext/p7zip/CPP/7zip/Crypto/ZipStrong.cpp +164 -0
  461. data/ext/p7zip/CPP/7zip/Crypto/ZipStrong.h +47 -0
  462. data/ext/p7zip/CPP/7zip/Guid.txt +170 -0
  463. data/ext/p7zip/CPP/7zip/ICoder.h +186 -0
  464. data/ext/p7zip/CPP/7zip/IDecl.h +15 -0
  465. data/ext/p7zip/CPP/7zip/IPassword.h +24 -0
  466. data/ext/p7zip/CPP/7zip/IProgress.h +33 -0
  467. data/ext/p7zip/CPP/7zip/IStream.h +58 -0
  468. data/ext/p7zip/CPP/7zip/MyVersion.h +11 -0
  469. data/ext/p7zip/CPP/7zip/PREMAKE/generate.sh +18 -0
  470. data/ext/p7zip/CPP/7zip/PREMAKE/premake4.lua +263 -0
  471. data/ext/p7zip/CPP/7zip/PropID.h +76 -0
  472. data/ext/p7zip/CPP/7zip/QMAKE/7ZA/7ZA.pro +228 -0
  473. data/ext/p7zip/CPP/7zip/QMAKE/7ZA/7ZA_osx.pro +228 -0
  474. data/ext/p7zip/CPP/7zip/QMAKE/test_emul/test_emul.pro +26 -0
  475. data/ext/p7zip/CPP/7zip/TEST/TestUI/TestUI.cpp +560 -0
  476. data/ext/p7zip/CPP/7zip/TEST/TestUI/makefile +33 -0
  477. data/ext/p7zip/CPP/7zip/TEST/TestUI/makefile.depend +577 -0
  478. data/ext/p7zip/CPP/7zip/TEST/TestUI/makefile.list +16 -0
  479. data/ext/p7zip/CPP/Common/AutoPtr.h +35 -0
  480. data/ext/p7zip/CPP/Common/Buffer.h +77 -0
  481. data/ext/p7zip/CPP/Common/CRC.cpp +7 -0
  482. data/ext/p7zip/CPP/Common/C_FileIO.cpp +88 -0
  483. data/ext/p7zip/CPP/Common/C_FileIO.h +47 -0
  484. data/ext/p7zip/CPP/Common/ComTry.h +18 -0
  485. data/ext/p7zip/CPP/Common/CommandLineParser.cpp +230 -0
  486. data/ext/p7zip/CPP/Common/CommandLineParser.h +72 -0
  487. data/ext/p7zip/CPP/Common/Defs.h +20 -0
  488. data/ext/p7zip/CPP/Common/DynamicBuffer.h +50 -0
  489. data/ext/p7zip/CPP/Common/IntToString.cpp +77 -0
  490. data/ext/p7zip/CPP/Common/IntToString.h +19 -0
  491. data/ext/p7zip/CPP/Common/Lang.cpp +130 -0
  492. data/ext/p7zip/CPP/Common/Lang.h +28 -0
  493. data/ext/p7zip/CPP/Common/ListFileUtils.cpp +75 -0
  494. data/ext/p7zip/CPP/Common/ListFileUtils.h +11 -0
  495. data/ext/p7zip/CPP/Common/MyCom.h +225 -0
  496. data/ext/p7zip/CPP/Common/MyException.h +14 -0
  497. data/ext/p7zip/CPP/Common/MyGuidDef.h +54 -0
  498. data/ext/p7zip/CPP/Common/MyInitGuid.h +22 -0
  499. data/ext/p7zip/CPP/Common/MyMap.cpp +140 -0
  500. data/ext/p7zip/CPP/Common/MyMap.h +28 -0
  501. data/ext/p7zip/CPP/Common/MyString.cpp +206 -0
  502. data/ext/p7zip/CPP/Common/MyString.h +601 -0
  503. data/ext/p7zip/CPP/Common/MyUnknown.h +13 -0
  504. data/ext/p7zip/CPP/Common/MyVector.cpp +87 -0
  505. data/ext/p7zip/CPP/Common/MyVector.h +266 -0
  506. data/ext/p7zip/CPP/Common/MyWindows.cpp +111 -0
  507. data/ext/p7zip/CPP/Common/MyWindows.h +218 -0
  508. data/ext/p7zip/CPP/Common/MyXml.cpp +209 -0
  509. data/ext/p7zip/CPP/Common/MyXml.h +40 -0
  510. data/ext/p7zip/CPP/Common/NewHandler.h +16 -0
  511. data/ext/p7zip/CPP/Common/StdInStream.cpp +100 -0
  512. data/ext/p7zip/CPP/Common/StdInStream.h +32 -0
  513. data/ext/p7zip/CPP/Common/StdOutStream.cpp +93 -0
  514. data/ext/p7zip/CPP/Common/StdOutStream.h +35 -0
  515. data/ext/p7zip/CPP/Common/StringConvert.cpp +181 -0
  516. data/ext/p7zip/CPP/Common/StringConvert.h +73 -0
  517. data/ext/p7zip/CPP/Common/StringToInt.cpp +90 -0
  518. data/ext/p7zip/CPP/Common/StringToInt.h +18 -0
  519. data/ext/p7zip/CPP/Common/TextConfig.cpp +138 -0
  520. data/ext/p7zip/CPP/Common/TextConfig.h +22 -0
  521. data/ext/p7zip/CPP/Common/Types.h +11 -0
  522. data/ext/p7zip/CPP/Common/UTFConvert.cpp +145 -0
  523. data/ext/p7zip/CPP/Common/UTFConvert.h +11 -0
  524. data/ext/p7zip/CPP/Common/Wildcard.cpp +462 -0
  525. data/ext/p7zip/CPP/Common/Wildcard.h +80 -0
  526. data/ext/p7zip/CPP/Windows/COM.cpp +37 -0
  527. data/ext/p7zip/CPP/Windows/COM.h +69 -0
  528. data/ext/p7zip/CPP/Windows/Clipboard.cpp +160 -0
  529. data/ext/p7zip/CPP/Windows/Clipboard.h +28 -0
  530. data/ext/p7zip/CPP/Windows/CommonDialog.h +19 -0
  531. data/ext/p7zip/CPP/Windows/Control/ComboBox.h +82 -0
  532. data/ext/p7zip/CPP/Windows/Control/Controls.cpp +515 -0
  533. data/ext/p7zip/CPP/Windows/Control/Dialog.cpp +560 -0
  534. data/ext/p7zip/CPP/Windows/Control/Dialog.h +179 -0
  535. data/ext/p7zip/CPP/Windows/Control/DialogImpl.h +73 -0
  536. data/ext/p7zip/CPP/Windows/Control/Edit.h +24 -0
  537. data/ext/p7zip/CPP/Windows/Control/ListView.h +164 -0
  538. data/ext/p7zip/CPP/Windows/Control/ProgressBar.h +34 -0
  539. data/ext/p7zip/CPP/Windows/Control/Static.h +23 -0
  540. data/ext/p7zip/CPP/Windows/Control/StatusBar.h +56 -0
  541. data/ext/p7zip/CPP/Windows/Control/Window2.cpp +211 -0
  542. data/ext/p7zip/CPP/Windows/Control/Window2.h +111 -0
  543. data/ext/p7zip/CPP/Windows/DLL.cpp +193 -0
  544. data/ext/p7zip/CPP/Windows/DLL.h +48 -0
  545. data/ext/p7zip/CPP/Windows/Defs.h +17 -0
  546. data/ext/p7zip/CPP/Windows/Error.cpp +58 -0
  547. data/ext/p7zip/CPP/Windows/Error.h +33 -0
  548. data/ext/p7zip/CPP/Windows/FileDir.cpp +927 -0
  549. data/ext/p7zip/CPP/Windows/FileDir.h +115 -0
  550. data/ext/p7zip/CPP/Windows/FileFind.cpp +604 -0
  551. data/ext/p7zip/CPP/Windows/FileFind.h +126 -0
  552. data/ext/p7zip/CPP/Windows/FileIO.cpp +475 -0
  553. data/ext/p7zip/CPP/Windows/FileIO.h +110 -0
  554. data/ext/p7zip/CPP/Windows/FileName.cpp +50 -0
  555. data/ext/p7zip/CPP/Windows/FileName.h +27 -0
  556. data/ext/p7zip/CPP/Windows/Menu.h +4 -0
  557. data/ext/p7zip/CPP/Windows/NtCheck.h +44 -0
  558. data/ext/p7zip/CPP/Windows/PropVariant.cpp +243 -0
  559. data/ext/p7zip/CPP/Windows/PropVariant.h +56 -0
  560. data/ext/p7zip/CPP/Windows/PropVariantConversions.cpp +142 -0
  561. data/ext/p7zip/CPP/Windows/PropVariantConversions.h +14 -0
  562. data/ext/p7zip/CPP/Windows/PropVariantUtils.cpp +78 -0
  563. data/ext/p7zip/CPP/Windows/PropVariantUtils.h +28 -0
  564. data/ext/p7zip/CPP/Windows/Registry.cpp +313 -0
  565. data/ext/p7zip/CPP/Windows/Registry.h +113 -0
  566. data/ext/p7zip/CPP/Windows/ResourceString.h +22 -0
  567. data/ext/p7zip/CPP/Windows/Shell.h +21 -0
  568. data/ext/p7zip/CPP/Windows/Synchronization.cpp +157 -0
  569. data/ext/p7zip/CPP/Windows/Synchronization.h +187 -0
  570. data/ext/p7zip/CPP/Windows/Synchronization2.h +218 -0
  571. data/ext/p7zip/CPP/Windows/System.cpp +166 -0
  572. data/ext/p7zip/CPP/Windows/System.h +16 -0
  573. data/ext/p7zip/CPP/Windows/Thread.h +41 -0
  574. data/ext/p7zip/CPP/Windows/Time.cpp +88 -0
  575. data/ext/p7zip/CPP/Windows/Time.h +21 -0
  576. data/ext/p7zip/CPP/Windows/Window.cpp +101 -0
  577. data/ext/p7zip/CPP/Windows/Window.h +43 -0
  578. data/ext/p7zip/CPP/include_windows/basetyps.h +19 -0
  579. data/ext/p7zip/CPP/include_windows/tchar.h +89 -0
  580. data/ext/p7zip/CPP/include_windows/windows.h +194 -0
  581. data/ext/p7zip/CPP/myWindows/StdAfx.h +124 -0
  582. data/ext/p7zip/CPP/myWindows/config.h +67 -0
  583. data/ext/p7zip/CPP/myWindows/initguid.h +4 -0
  584. data/ext/p7zip/CPP/myWindows/makefile +21 -0
  585. data/ext/p7zip/CPP/myWindows/makefile.depend +32 -0
  586. data/ext/p7zip/CPP/myWindows/makefile.list +28 -0
  587. data/ext/p7zip/CPP/myWindows/myAddExeFlag.cpp +20 -0
  588. data/ext/p7zip/CPP/myWindows/myGetTickCount.cpp +8 -0
  589. data/ext/p7zip/CPP/myWindows/myPrivate.h +17 -0
  590. data/ext/p7zip/CPP/myWindows/mySplitCommandLine.cpp +82 -0
  591. data/ext/p7zip/CPP/myWindows/test_emul.cpp +745 -0
  592. data/ext/p7zip/CPP/myWindows/wine_GetXXXDefaultLangID.cpp +741 -0
  593. data/ext/p7zip/CPP/myWindows/wine_date_and_time.cpp +434 -0
  594. data/ext/p7zip/ChangeLog +914 -0
  595. data/ext/p7zip/DOCS/7zC.txt +194 -0
  596. data/ext/p7zip/DOCS/7zFormat.txt +469 -0
  597. data/ext/p7zip/DOCS/License.txt +52 -0
  598. data/ext/p7zip/DOCS/MANUAL/commands/add.htm +87 -0
  599. data/ext/p7zip/DOCS/MANUAL/commands/bench.htm +79 -0
  600. data/ext/p7zip/DOCS/MANUAL/commands/delete.htm +59 -0
  601. data/ext/p7zip/DOCS/MANUAL/commands/extract.htm +91 -0
  602. data/ext/p7zip/DOCS/MANUAL/commands/extract_full.htm +68 -0
  603. data/ext/p7zip/DOCS/MANUAL/commands/index.htm +33 -0
  604. data/ext/p7zip/DOCS/MANUAL/commands/list.htm +77 -0
  605. data/ext/p7zip/DOCS/MANUAL/commands/style.css +232 -0
  606. data/ext/p7zip/DOCS/MANUAL/commands/test.htm +46 -0
  607. data/ext/p7zip/DOCS/MANUAL/commands/update.htm +66 -0
  608. data/ext/p7zip/DOCS/MANUAL/exit_codes.htm +27 -0
  609. data/ext/p7zip/DOCS/MANUAL/index.htm +29 -0
  610. data/ext/p7zip/DOCS/MANUAL/style.css +232 -0
  611. data/ext/p7zip/DOCS/MANUAL/switches/ar_exclude.htm +56 -0
  612. data/ext/p7zip/DOCS/MANUAL/switches/ar_include.htm +83 -0
  613. data/ext/p7zip/DOCS/MANUAL/switches/ar_no.htm +52 -0
  614. data/ext/p7zip/DOCS/MANUAL/switches/charset.htm +49 -0
  615. data/ext/p7zip/DOCS/MANUAL/switches/exclude.htm +60 -0
  616. data/ext/p7zip/DOCS/MANUAL/switches/include.htm +87 -0
  617. data/ext/p7zip/DOCS/MANUAL/switches/index.htm +64 -0
  618. data/ext/p7zip/DOCS/MANUAL/switches/large_pages.htm +50 -0
  619. data/ext/p7zip/DOCS/MANUAL/switches/list_tech.htm +36 -0
  620. data/ext/p7zip/DOCS/MANUAL/switches/method.htm +625 -0
  621. data/ext/p7zip/DOCS/MANUAL/switches/output_dir.htm +53 -0
  622. data/ext/p7zip/DOCS/MANUAL/switches/overwrite.htm +56 -0
  623. data/ext/p7zip/DOCS/MANUAL/switches/password.htm +54 -0
  624. data/ext/p7zip/DOCS/MANUAL/switches/recurse.htm +83 -0
  625. data/ext/p7zip/DOCS/MANUAL/switches/sfx.htm +156 -0
  626. data/ext/p7zip/DOCS/MANUAL/switches/ssc.htm +50 -0
  627. data/ext/p7zip/DOCS/MANUAL/switches/stdin.htm +55 -0
  628. data/ext/p7zip/DOCS/MANUAL/switches/stdout.htm +50 -0
  629. data/ext/p7zip/DOCS/MANUAL/switches/stop_switch.htm +31 -0
  630. data/ext/p7zip/DOCS/MANUAL/switches/style.css +232 -0
  631. data/ext/p7zip/DOCS/MANUAL/switches/type.htm +83 -0
  632. data/ext/p7zip/DOCS/MANUAL/switches/update.htm +176 -0
  633. data/ext/p7zip/DOCS/MANUAL/switches/volume.htm +49 -0
  634. data/ext/p7zip/DOCS/MANUAL/switches/working_dir.htm +55 -0
  635. data/ext/p7zip/DOCS/MANUAL/switches/yes.htm +48 -0
  636. data/ext/p7zip/DOCS/MANUAL/syntax.htm +120 -0
  637. data/ext/p7zip/DOCS/Methods.txt +152 -0
  638. data/ext/p7zip/DOCS/copying.txt +504 -0
  639. data/ext/p7zip/DOCS/history.txt +456 -0
  640. data/ext/p7zip/DOCS/lzma.txt +598 -0
  641. data/ext/p7zip/DOCS/readme.txt +181 -0
  642. data/ext/p7zip/DOCS/unRarLicense.txt +41 -0
  643. data/ext/p7zip/README +358 -0
  644. data/ext/p7zip/TODO +39 -0
  645. data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/ChangeLog +41 -0
  646. data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/readme +21 -0
  647. data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/readme.u7z +30 -0
  648. data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/u7z +133 -0
  649. data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/README +21 -0
  650. data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/check/check.sh +117 -0
  651. data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/check/files.tar +0 -0
  652. data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/man1/p7zip.1 +33 -0
  653. data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/p7zip +144 -0
  654. data/ext/p7zip/contrib/qnx630sp3/qnx630sp3-shared +14 -0
  655. data/ext/p7zip/contrib/qnx630sp3/qnx630sp3-static +10 -0
  656. data/ext/p7zip/install.sh +206 -0
  657. data/ext/p7zip/install_local_context_menu.sh +18 -0
  658. data/ext/p7zip/integration_context_menu.txt +51 -0
  659. data/ext/p7zip/makefile +181 -0
  660. data/ext/p7zip/makefile.aix_gcc +22 -0
  661. data/ext/p7zip/makefile.beos +18 -0
  662. data/ext/p7zip/makefile.crc32 +8 -0
  663. data/ext/p7zip/makefile.cygwin +20 -0
  664. data/ext/p7zip/makefile.cygwin_asm +21 -0
  665. data/ext/p7zip/makefile.djgpp_old +21 -0
  666. data/ext/p7zip/makefile.djgpp_watt +47 -0
  667. data/ext/p7zip/makefile.freebsd5 +20 -0
  668. data/ext/p7zip/makefile.freebsd6 +20 -0
  669. data/ext/p7zip/makefile.glb +39 -0
  670. data/ext/p7zip/makefile.gprof +18 -0
  671. data/ext/p7zip/makefile.hpux-acc +17 -0
  672. data/ext/p7zip/makefile.hpux-acc_64 +19 -0
  673. data/ext/p7zip/makefile.hpux-gcc +21 -0
  674. data/ext/p7zip/makefile.linux_amd64 +22 -0
  675. data/ext/p7zip/makefile.linux_amd64_asm +24 -0
  676. data/ext/p7zip/makefile.linux_amd64_asm_icc +27 -0
  677. data/ext/p7zip/makefile.linux_any_cpu +22 -0
  678. data/ext/p7zip/makefile.linux_any_cpu_gcc_4.X +24 -0
  679. data/ext/p7zip/makefile.linux_clang_amd64 +22 -0
  680. data/ext/p7zip/makefile.linux_cross_arm +22 -0
  681. data/ext/p7zip/makefile.linux_gcc_2.95_no_need_for_libstdc +20 -0
  682. data/ext/p7zip/makefile.linux_other +23 -0
  683. data/ext/p7zip/makefile.linux_s390x +23 -0
  684. data/ext/p7zip/makefile.linux_x86_asm_gcc_4.X +26 -0
  685. data/ext/p7zip/makefile.linux_x86_asm_gcc_4.X_fltk +26 -0
  686. data/ext/p7zip/makefile.linux_x86_asm_gcc_mudflap_4.X +26 -0
  687. data/ext/p7zip/makefile.linux_x86_asm_icc +25 -0
  688. data/ext/p7zip/makefile.linux_x86_icc +24 -0
  689. data/ext/p7zip/makefile.machine_base +22 -0
  690. data/ext/p7zip/makefile.macosx_32bits +20 -0
  691. data/ext/p7zip/makefile.macosx_32bits_asm +23 -0
  692. data/ext/p7zip/makefile.macosx_32bits_ppc +21 -0
  693. data/ext/p7zip/makefile.macosx_64bits +20 -0
  694. data/ext/p7zip/makefile.macosx_llvm_64bits +20 -0
  695. data/ext/p7zip/makefile.netbsd +21 -0
  696. data/ext/p7zip/makefile.netware_asm_gcc_3.X +41 -0
  697. data/ext/p7zip/makefile.oldmake +174 -0
  698. data/ext/p7zip/makefile.openbsd +20 -0
  699. data/ext/p7zip/makefile.openbsd_no_port +20 -0
  700. data/ext/p7zip/makefile.qnx_shared.bin +21 -0
  701. data/ext/p7zip/makefile.qnx_static +21 -0
  702. data/ext/p7zip/makefile.rules +661 -0
  703. data/ext/p7zip/makefile.solaris_sparc_CC_32 +21 -0
  704. data/ext/p7zip/makefile.solaris_sparc_CC_64 +23 -0
  705. data/ext/p7zip/makefile.solaris_sparc_gcc +21 -0
  706. data/ext/p7zip/makefile.solaris_x86 +19 -0
  707. data/ext/p7zip/makefile.tru64 +22 -0
  708. data/ext/seven_zip_ruby/extconf.rb +194 -0
  709. data/ext/seven_zip_ruby/guid_defs.h +29 -0
  710. data/ext/seven_zip_ruby/mutex.h +10 -0
  711. data/ext/seven_zip_ruby/posix/mutex.h +94 -0
  712. data/ext/seven_zip_ruby/seven_zip_archive.cpp +1854 -0
  713. data/ext/seven_zip_ruby/seven_zip_archive.h +548 -0
  714. data/ext/seven_zip_ruby/util_common.cpp +28 -0
  715. data/ext/seven_zip_ruby/util_common.h +467 -0
  716. data/ext/seven_zip_ruby/utils.cpp +575 -0
  717. data/ext/seven_zip_ruby/utils.h +25 -0
  718. data/ext/seven_zip_ruby/win32/mutex.h +130 -0
  719. data/lib/seven_zip_ruby.rb +27 -0
  720. data/lib/seven_zip_ruby/7z.dll +0 -0
  721. data/lib/seven_zip_ruby/7z.sfx +0 -0
  722. data/lib/seven_zip_ruby/7z64.dll +0 -0
  723. data/lib/seven_zip_ruby/7zCon.sfx +0 -0
  724. data/lib/seven_zip_ruby/archive_info.rb +21 -0
  725. data/lib/seven_zip_ruby/entry_info.rb +46 -0
  726. data/lib/seven_zip_ruby/exception.rb +10 -0
  727. data/lib/seven_zip_ruby/seven_zip_reader.rb +537 -0
  728. data/lib/seven_zip_ruby/seven_zip_writer.rb +502 -0
  729. data/lib/seven_zip_ruby/update_info.rb +116 -0
  730. data/lib/seven_zip_ruby/version.rb +3 -0
  731. data/seven_zip_ruby.gemspec +34 -0
  732. data/spec/seven_zip_ruby_spec.rb +702 -0
  733. data/spec/seven_zip_ruby_spec_helper.rb +129 -0
  734. metadata +823 -0
@@ -0,0 +1,66 @@
1
+ /* Lzma2Enc.h -- LZMA2 Encoder
2
+ 2009-02-07 : Igor Pavlov : Public domain */
3
+
4
+ #ifndef __LZMA2_ENC_H
5
+ #define __LZMA2_ENC_H
6
+
7
+ #include "LzmaEnc.h"
8
+
9
+ #ifdef __cplusplus
10
+ extern "C" {
11
+ #endif
12
+
13
+ typedef struct
14
+ {
15
+ CLzmaEncProps lzmaProps;
16
+ size_t blockSize;
17
+ int numBlockThreads;
18
+ int numTotalThreads;
19
+ } CLzma2EncProps;
20
+
21
+ void Lzma2EncProps_Init(CLzma2EncProps *p);
22
+ void Lzma2EncProps_Normalize(CLzma2EncProps *p);
23
+
24
+ /* ---------- CLzmaEnc2Handle Interface ---------- */
25
+
26
+ /* Lzma2Enc_* functions can return the following exit codes:
27
+ Returns:
28
+ SZ_OK - OK
29
+ SZ_ERROR_MEM - Memory allocation error
30
+ SZ_ERROR_PARAM - Incorrect paramater in props
31
+ SZ_ERROR_WRITE - Write callback error
32
+ SZ_ERROR_PROGRESS - some break from progress callback
33
+ SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
34
+ */
35
+
36
+ typedef void * CLzma2EncHandle;
37
+
38
+ CLzma2EncHandle Lzma2Enc_Create(ISzAlloc *alloc, ISzAlloc *allocBig);
39
+ void Lzma2Enc_Destroy(CLzma2EncHandle p);
40
+ SRes Lzma2Enc_SetProps(CLzma2EncHandle p, const CLzma2EncProps *props);
41
+ Byte Lzma2Enc_WriteProperties(CLzma2EncHandle p);
42
+ SRes Lzma2Enc_Encode(CLzma2EncHandle p,
43
+ ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress);
44
+
45
+ /* ---------- One Call Interface ---------- */
46
+
47
+ /* Lzma2Encode
48
+ Return code:
49
+ SZ_OK - OK
50
+ SZ_ERROR_MEM - Memory allocation error
51
+ SZ_ERROR_PARAM - Incorrect paramater
52
+ SZ_ERROR_OUTPUT_EOF - output buffer overflow
53
+ SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
54
+ */
55
+
56
+ /*
57
+ SRes Lzma2Encode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
58
+ const CLzmaEncProps *props, Byte *propsEncoded, int writeEndMark,
59
+ ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
60
+ */
61
+
62
+ #ifdef __cplusplus
63
+ }
64
+ #endif
65
+
66
+ #endif
@@ -0,0 +1,999 @@
1
+ /* LzmaDec.c -- LZMA Decoder
2
+ 2009-09-20 : Igor Pavlov : Public domain */
3
+
4
+ #include "LzmaDec.h"
5
+
6
+ #include <string.h>
7
+
8
+ #define kNumTopBits 24
9
+ #define kTopValue ((UInt32)1 << kNumTopBits)
10
+
11
+ #define kNumBitModelTotalBits 11
12
+ #define kBitModelTotal (1 << kNumBitModelTotalBits)
13
+ #define kNumMoveBits 5
14
+
15
+ #define RC_INIT_SIZE 5
16
+
17
+ #define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); }
18
+
19
+ #define IF_BIT_0(p) ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound)
20
+ #define UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits));
21
+ #define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits));
22
+ #define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \
23
+ { UPDATE_0(p); i = (i + i); A0; } else \
24
+ { UPDATE_1(p); i = (i + i) + 1; A1; }
25
+ #define GET_BIT(p, i) GET_BIT2(p, i, ; , ;)
26
+
27
+ #define TREE_GET_BIT(probs, i) { GET_BIT((probs + i), i); }
28
+ #define TREE_DECODE(probs, limit, i) \
29
+ { i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; }
30
+
31
+ /* #define _LZMA_SIZE_OPT */
32
+
33
+ #ifdef _LZMA_SIZE_OPT
34
+ #define TREE_6_DECODE(probs, i) TREE_DECODE(probs, (1 << 6), i)
35
+ #else
36
+ #define TREE_6_DECODE(probs, i) \
37
+ { i = 1; \
38
+ TREE_GET_BIT(probs, i); \
39
+ TREE_GET_BIT(probs, i); \
40
+ TREE_GET_BIT(probs, i); \
41
+ TREE_GET_BIT(probs, i); \
42
+ TREE_GET_BIT(probs, i); \
43
+ TREE_GET_BIT(probs, i); \
44
+ i -= 0x40; }
45
+ #endif
46
+
47
+ #define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); }
48
+
49
+ #define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound)
50
+ #define UPDATE_0_CHECK range = bound;
51
+ #define UPDATE_1_CHECK range -= bound; code -= bound;
52
+ #define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \
53
+ { UPDATE_0_CHECK; i = (i + i); A0; } else \
54
+ { UPDATE_1_CHECK; i = (i + i) + 1; A1; }
55
+ #define GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;)
56
+ #define TREE_DECODE_CHECK(probs, limit, i) \
57
+ { i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; }
58
+
59
+
60
+ #define kNumPosBitsMax 4
61
+ #define kNumPosStatesMax (1 << kNumPosBitsMax)
62
+
63
+ #define kLenNumLowBits 3
64
+ #define kLenNumLowSymbols (1 << kLenNumLowBits)
65
+ #define kLenNumMidBits 3
66
+ #define kLenNumMidSymbols (1 << kLenNumMidBits)
67
+ #define kLenNumHighBits 8
68
+ #define kLenNumHighSymbols (1 << kLenNumHighBits)
69
+
70
+ #define LenChoice 0
71
+ #define LenChoice2 (LenChoice + 1)
72
+ #define LenLow (LenChoice2 + 1)
73
+ #define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
74
+ #define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
75
+ #define kNumLenProbs (LenHigh + kLenNumHighSymbols)
76
+
77
+
78
+ #define kNumStates 12
79
+ #define kNumLitStates 7
80
+
81
+ #define kStartPosModelIndex 4
82
+ #define kEndPosModelIndex 14
83
+ #define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
84
+
85
+ #define kNumPosSlotBits 6
86
+ #define kNumLenToPosStates 4
87
+
88
+ #define kNumAlignBits 4
89
+ #define kAlignTableSize (1 << kNumAlignBits)
90
+
91
+ #define kMatchMinLen 2
92
+ #define kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols)
93
+
94
+ #define IsMatch 0
95
+ #define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
96
+ #define IsRepG0 (IsRep + kNumStates)
97
+ #define IsRepG1 (IsRepG0 + kNumStates)
98
+ #define IsRepG2 (IsRepG1 + kNumStates)
99
+ #define IsRep0Long (IsRepG2 + kNumStates)
100
+ #define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
101
+ #define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
102
+ #define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
103
+ #define LenCoder (Align + kAlignTableSize)
104
+ #define RepLenCoder (LenCoder + kNumLenProbs)
105
+ #define Literal (RepLenCoder + kNumLenProbs)
106
+
107
+ #define LZMA_BASE_SIZE 1846
108
+ #define LZMA_LIT_SIZE 768
109
+
110
+ #define LzmaProps_GetNumProbs(p) ((UInt32)LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((p)->lc + (p)->lp)))
111
+
112
+ #if Literal != LZMA_BASE_SIZE
113
+ StopCompilingDueBUG
114
+ #endif
115
+
116
+ #define LZMA_DIC_MIN (1 << 12)
117
+
118
+ /* First LZMA-symbol is always decoded.
119
+ And it decodes new LZMA-symbols while (buf < bufLimit), but "buf" is without last normalization
120
+ Out:
121
+ Result:
122
+ SZ_OK - OK
123
+ SZ_ERROR_DATA - Error
124
+ p->remainLen:
125
+ < kMatchSpecLenStart : normal remain
126
+ = kMatchSpecLenStart : finished
127
+ = kMatchSpecLenStart + 1 : Flush marker
128
+ = kMatchSpecLenStart + 2 : State Init Marker
129
+ */
130
+
131
+ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
132
+ {
133
+ CLzmaProb *probs = p->probs;
134
+
135
+ unsigned state = p->state;
136
+ UInt32 rep0 = p->reps[0], rep1 = p->reps[1], rep2 = p->reps[2], rep3 = p->reps[3];
137
+ unsigned pbMask = ((unsigned)1 << (p->prop.pb)) - 1;
138
+ unsigned lpMask = ((unsigned)1 << (p->prop.lp)) - 1;
139
+ unsigned lc = p->prop.lc;
140
+
141
+ Byte *dic = p->dic;
142
+ SizeT dicBufSize = p->dicBufSize;
143
+ SizeT dicPos = p->dicPos;
144
+
145
+ UInt32 processedPos = p->processedPos;
146
+ UInt32 checkDicSize = p->checkDicSize;
147
+ unsigned len = 0;
148
+
149
+ const Byte *buf = p->buf;
150
+ UInt32 range = p->range;
151
+ UInt32 code = p->code;
152
+
153
+ do
154
+ {
155
+ CLzmaProb *prob;
156
+ UInt32 bound;
157
+ unsigned ttt;
158
+ unsigned posState = processedPos & pbMask;
159
+
160
+ prob = probs + IsMatch + (state << kNumPosBitsMax) + posState;
161
+ IF_BIT_0(prob)
162
+ {
163
+ unsigned symbol;
164
+ UPDATE_0(prob);
165
+ prob = probs + Literal;
166
+ if (checkDicSize != 0 || processedPos != 0)
167
+ prob += (LZMA_LIT_SIZE * (((processedPos & lpMask) << lc) +
168
+ (dic[(dicPos == 0 ? dicBufSize : dicPos) - 1] >> (8 - lc))));
169
+
170
+ if (state < kNumLitStates)
171
+ {
172
+ state -= (state < 4) ? state : 3;
173
+ symbol = 1;
174
+ do { GET_BIT(prob + symbol, symbol) } while (symbol < 0x100);
175
+ }
176
+ else
177
+ {
178
+ unsigned matchByte = p->dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
179
+ unsigned offs = 0x100;
180
+ state -= (state < 10) ? 3 : 6;
181
+ symbol = 1;
182
+ do
183
+ {
184
+ unsigned bit;
185
+ CLzmaProb *probLit;
186
+ matchByte <<= 1;
187
+ bit = (matchByte & offs);
188
+ probLit = prob + offs + bit + symbol;
189
+ GET_BIT2(probLit, symbol, offs &= ~bit, offs &= bit)
190
+ }
191
+ while (symbol < 0x100);
192
+ }
193
+ dic[dicPos++] = (Byte)symbol;
194
+ processedPos++;
195
+ continue;
196
+ }
197
+ else
198
+ {
199
+ UPDATE_1(prob);
200
+ prob = probs + IsRep + state;
201
+ IF_BIT_0(prob)
202
+ {
203
+ UPDATE_0(prob);
204
+ state += kNumStates;
205
+ prob = probs + LenCoder;
206
+ }
207
+ else
208
+ {
209
+ UPDATE_1(prob);
210
+ if (checkDicSize == 0 && processedPos == 0)
211
+ return SZ_ERROR_DATA;
212
+ prob = probs + IsRepG0 + state;
213
+ IF_BIT_0(prob)
214
+ {
215
+ UPDATE_0(prob);
216
+ prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState;
217
+ IF_BIT_0(prob)
218
+ {
219
+ UPDATE_0(prob);
220
+ dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
221
+ dicPos++;
222
+ processedPos++;
223
+ state = state < kNumLitStates ? 9 : 11;
224
+ continue;
225
+ }
226
+ UPDATE_1(prob);
227
+ }
228
+ else
229
+ {
230
+ UInt32 distance;
231
+ UPDATE_1(prob);
232
+ prob = probs + IsRepG1 + state;
233
+ IF_BIT_0(prob)
234
+ {
235
+ UPDATE_0(prob);
236
+ distance = rep1;
237
+ }
238
+ else
239
+ {
240
+ UPDATE_1(prob);
241
+ prob = probs + IsRepG2 + state;
242
+ IF_BIT_0(prob)
243
+ {
244
+ UPDATE_0(prob);
245
+ distance = rep2;
246
+ }
247
+ else
248
+ {
249
+ UPDATE_1(prob);
250
+ distance = rep3;
251
+ rep3 = rep2;
252
+ }
253
+ rep2 = rep1;
254
+ }
255
+ rep1 = rep0;
256
+ rep0 = distance;
257
+ }
258
+ state = state < kNumLitStates ? 8 : 11;
259
+ prob = probs + RepLenCoder;
260
+ }
261
+ {
262
+ unsigned limit, offset;
263
+ CLzmaProb *probLen = prob + LenChoice;
264
+ IF_BIT_0(probLen)
265
+ {
266
+ UPDATE_0(probLen);
267
+ probLen = prob + LenLow + (posState << kLenNumLowBits);
268
+ offset = 0;
269
+ limit = (1 << kLenNumLowBits);
270
+ }
271
+ else
272
+ {
273
+ UPDATE_1(probLen);
274
+ probLen = prob + LenChoice2;
275
+ IF_BIT_0(probLen)
276
+ {
277
+ UPDATE_0(probLen);
278
+ probLen = prob + LenMid + (posState << kLenNumMidBits);
279
+ offset = kLenNumLowSymbols;
280
+ limit = (1 << kLenNumMidBits);
281
+ }
282
+ else
283
+ {
284
+ UPDATE_1(probLen);
285
+ probLen = prob + LenHigh;
286
+ offset = kLenNumLowSymbols + kLenNumMidSymbols;
287
+ limit = (1 << kLenNumHighBits);
288
+ }
289
+ }
290
+ TREE_DECODE(probLen, limit, len);
291
+ len += offset;
292
+ }
293
+
294
+ if (state >= kNumStates)
295
+ {
296
+ UInt32 distance;
297
+ prob = probs + PosSlot +
298
+ ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits);
299
+ TREE_6_DECODE(prob, distance);
300
+ if (distance >= kStartPosModelIndex)
301
+ {
302
+ unsigned posSlot = (unsigned)distance;
303
+ int numDirectBits = (int)(((distance >> 1) - 1));
304
+ distance = (2 | (distance & 1));
305
+ if (posSlot < kEndPosModelIndex)
306
+ {
307
+ distance <<= numDirectBits;
308
+ prob = probs + SpecPos + distance - posSlot - 1;
309
+ {
310
+ UInt32 mask = 1;
311
+ unsigned i = 1;
312
+ do
313
+ {
314
+ GET_BIT2(prob + i, i, ; , distance |= mask);
315
+ mask <<= 1;
316
+ }
317
+ while (--numDirectBits != 0);
318
+ }
319
+ }
320
+ else
321
+ {
322
+ numDirectBits -= kNumAlignBits;
323
+ do
324
+ {
325
+ NORMALIZE
326
+ range >>= 1;
327
+
328
+ {
329
+ UInt32 t;
330
+ code -= range;
331
+ t = (0 - ((UInt32)code >> 31)); /* (UInt32)((Int32)code >> 31) */
332
+ distance = (distance << 1) + (t + 1);
333
+ code += range & t;
334
+ }
335
+ /*
336
+ distance <<= 1;
337
+ if (code >= range)
338
+ {
339
+ code -= range;
340
+ distance |= 1;
341
+ }
342
+ */
343
+ }
344
+ while (--numDirectBits != 0);
345
+ prob = probs + Align;
346
+ distance <<= kNumAlignBits;
347
+ {
348
+ unsigned i = 1;
349
+ GET_BIT2(prob + i, i, ; , distance |= 1);
350
+ GET_BIT2(prob + i, i, ; , distance |= 2);
351
+ GET_BIT2(prob + i, i, ; , distance |= 4);
352
+ GET_BIT2(prob + i, i, ; , distance |= 8);
353
+ }
354
+ if (distance == (UInt32)0xFFFFFFFF)
355
+ {
356
+ len += kMatchSpecLenStart;
357
+ state -= kNumStates;
358
+ break;
359
+ }
360
+ }
361
+ }
362
+ rep3 = rep2;
363
+ rep2 = rep1;
364
+ rep1 = rep0;
365
+ rep0 = distance + 1;
366
+ if (checkDicSize == 0)
367
+ {
368
+ if (distance >= processedPos)
369
+ return SZ_ERROR_DATA;
370
+ }
371
+ else if (distance >= checkDicSize)
372
+ return SZ_ERROR_DATA;
373
+ state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3;
374
+ }
375
+
376
+ len += kMatchMinLen;
377
+
378
+ if (limit == dicPos)
379
+ return SZ_ERROR_DATA;
380
+ {
381
+ SizeT rem = limit - dicPos;
382
+ unsigned curLen = ((rem < len) ? (unsigned)rem : len);
383
+ SizeT pos = (dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0);
384
+
385
+ processedPos += curLen;
386
+
387
+ len -= curLen;
388
+ if (pos + curLen <= dicBufSize)
389
+ {
390
+ Byte *dest = dic + dicPos;
391
+ ptrdiff_t src = (ptrdiff_t)pos - (ptrdiff_t)dicPos;
392
+ const Byte *lim = dest + curLen;
393
+ dicPos += curLen;
394
+ do
395
+ *(dest) = (Byte)*(dest + src);
396
+ while (++dest != lim);
397
+ }
398
+ else
399
+ {
400
+ do
401
+ {
402
+ dic[dicPos++] = dic[pos];
403
+ if (++pos == dicBufSize)
404
+ pos = 0;
405
+ }
406
+ while (--curLen != 0);
407
+ }
408
+ }
409
+ }
410
+ }
411
+ while (dicPos < limit && buf < bufLimit);
412
+ NORMALIZE;
413
+ p->buf = buf;
414
+ p->range = range;
415
+ p->code = code;
416
+ p->remainLen = len;
417
+ p->dicPos = dicPos;
418
+ p->processedPos = processedPos;
419
+ p->reps[0] = rep0;
420
+ p->reps[1] = rep1;
421
+ p->reps[2] = rep2;
422
+ p->reps[3] = rep3;
423
+ p->state = state;
424
+
425
+ return SZ_OK;
426
+ }
427
+
428
+ static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit)
429
+ {
430
+ if (p->remainLen != 0 && p->remainLen < kMatchSpecLenStart)
431
+ {
432
+ Byte *dic = p->dic;
433
+ SizeT dicPos = p->dicPos;
434
+ SizeT dicBufSize = p->dicBufSize;
435
+ unsigned len = p->remainLen;
436
+ UInt32 rep0 = p->reps[0];
437
+ if (limit - dicPos < len)
438
+ len = (unsigned)(limit - dicPos);
439
+
440
+ if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= len)
441
+ p->checkDicSize = p->prop.dicSize;
442
+
443
+ p->processedPos += len;
444
+ p->remainLen -= len;
445
+ while (len-- != 0)
446
+ {
447
+ dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
448
+ dicPos++;
449
+ }
450
+ p->dicPos = dicPos;
451
+ }
452
+ }
453
+
454
+ static int MY_FAST_CALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
455
+ {
456
+ do
457
+ {
458
+ SizeT limit2 = limit;
459
+ if (p->checkDicSize == 0)
460
+ {
461
+ UInt32 rem = p->prop.dicSize - p->processedPos;
462
+ if (limit - p->dicPos > rem)
463
+ limit2 = p->dicPos + rem;
464
+ }
465
+ RINOK(LzmaDec_DecodeReal(p, limit2, bufLimit));
466
+ if (p->processedPos >= p->prop.dicSize)
467
+ p->checkDicSize = p->prop.dicSize;
468
+ LzmaDec_WriteRem(p, limit);
469
+ }
470
+ while (p->dicPos < limit && p->buf < bufLimit && p->remainLen < kMatchSpecLenStart);
471
+
472
+ if (p->remainLen > kMatchSpecLenStart)
473
+ {
474
+ p->remainLen = kMatchSpecLenStart;
475
+ }
476
+ return 0;
477
+ }
478
+
479
+ typedef enum
480
+ {
481
+ DUMMY_ERROR, /* unexpected end of input stream */
482
+ DUMMY_LIT,
483
+ DUMMY_MATCH,
484
+ DUMMY_REP
485
+ } ELzmaDummy;
486
+
487
+ static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inSize)
488
+ {
489
+ UInt32 range = p->range;
490
+ UInt32 code = p->code;
491
+ const Byte *bufLimit = buf + inSize;
492
+ CLzmaProb *probs = p->probs;
493
+ unsigned state = p->state;
494
+ ELzmaDummy res;
495
+
496
+ {
497
+ CLzmaProb *prob;
498
+ UInt32 bound;
499
+ unsigned ttt;
500
+ unsigned posState = (p->processedPos) & ((1 << p->prop.pb) - 1);
501
+
502
+ prob = probs + IsMatch + (state << kNumPosBitsMax) + posState;
503
+ IF_BIT_0_CHECK(prob)
504
+ {
505
+ UPDATE_0_CHECK
506
+
507
+ /* if (bufLimit - buf >= 7) return DUMMY_LIT; */
508
+
509
+ prob = probs + Literal;
510
+ if (p->checkDicSize != 0 || p->processedPos != 0)
511
+ prob += (LZMA_LIT_SIZE *
512
+ ((((p->processedPos) & ((1 << (p->prop.lp)) - 1)) << p->prop.lc) +
513
+ (p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc))));
514
+
515
+ if (state < kNumLitStates)
516
+ {
517
+ unsigned symbol = 1;
518
+ do { GET_BIT_CHECK(prob + symbol, symbol) } while (symbol < 0x100);
519
+ }
520
+ else
521
+ {
522
+ unsigned matchByte = p->dic[p->dicPos - p->reps[0] +
523
+ ((p->dicPos < p->reps[0]) ? p->dicBufSize : 0)];
524
+ unsigned offs = 0x100;
525
+ unsigned symbol = 1;
526
+ do
527
+ {
528
+ unsigned bit;
529
+ CLzmaProb *probLit;
530
+ matchByte <<= 1;
531
+ bit = (matchByte & offs);
532
+ probLit = prob + offs + bit + symbol;
533
+ GET_BIT2_CHECK(probLit, symbol, offs &= ~bit, offs &= bit)
534
+ }
535
+ while (symbol < 0x100);
536
+ }
537
+ res = DUMMY_LIT;
538
+ }
539
+ else
540
+ {
541
+ unsigned len;
542
+ UPDATE_1_CHECK;
543
+
544
+ prob = probs + IsRep + state;
545
+ IF_BIT_0_CHECK(prob)
546
+ {
547
+ UPDATE_0_CHECK;
548
+ state = 0;
549
+ prob = probs + LenCoder;
550
+ res = DUMMY_MATCH;
551
+ }
552
+ else
553
+ {
554
+ UPDATE_1_CHECK;
555
+ res = DUMMY_REP;
556
+ prob = probs + IsRepG0 + state;
557
+ IF_BIT_0_CHECK(prob)
558
+ {
559
+ UPDATE_0_CHECK;
560
+ prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState;
561
+ IF_BIT_0_CHECK(prob)
562
+ {
563
+ UPDATE_0_CHECK;
564
+ NORMALIZE_CHECK;
565
+ return DUMMY_REP;
566
+ }
567
+ else
568
+ {
569
+ UPDATE_1_CHECK;
570
+ }
571
+ }
572
+ else
573
+ {
574
+ UPDATE_1_CHECK;
575
+ prob = probs + IsRepG1 + state;
576
+ IF_BIT_0_CHECK(prob)
577
+ {
578
+ UPDATE_0_CHECK;
579
+ }
580
+ else
581
+ {
582
+ UPDATE_1_CHECK;
583
+ prob = probs + IsRepG2 + state;
584
+ IF_BIT_0_CHECK(prob)
585
+ {
586
+ UPDATE_0_CHECK;
587
+ }
588
+ else
589
+ {
590
+ UPDATE_1_CHECK;
591
+ }
592
+ }
593
+ }
594
+ state = kNumStates;
595
+ prob = probs + RepLenCoder;
596
+ }
597
+ {
598
+ unsigned limit, offset;
599
+ CLzmaProb *probLen = prob + LenChoice;
600
+ IF_BIT_0_CHECK(probLen)
601
+ {
602
+ UPDATE_0_CHECK;
603
+ probLen = prob + LenLow + (posState << kLenNumLowBits);
604
+ offset = 0;
605
+ limit = 1 << kLenNumLowBits;
606
+ }
607
+ else
608
+ {
609
+ UPDATE_1_CHECK;
610
+ probLen = prob + LenChoice2;
611
+ IF_BIT_0_CHECK(probLen)
612
+ {
613
+ UPDATE_0_CHECK;
614
+ probLen = prob + LenMid + (posState << kLenNumMidBits);
615
+ offset = kLenNumLowSymbols;
616
+ limit = 1 << kLenNumMidBits;
617
+ }
618
+ else
619
+ {
620
+ UPDATE_1_CHECK;
621
+ probLen = prob + LenHigh;
622
+ offset = kLenNumLowSymbols + kLenNumMidSymbols;
623
+ limit = 1 << kLenNumHighBits;
624
+ }
625
+ }
626
+ TREE_DECODE_CHECK(probLen, limit, len);
627
+ len += offset;
628
+ }
629
+
630
+ if (state < 4)
631
+ {
632
+ unsigned posSlot;
633
+ prob = probs + PosSlot +
634
+ ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
635
+ kNumPosSlotBits);
636
+ TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot);
637
+ if (posSlot >= kStartPosModelIndex)
638
+ {
639
+ int numDirectBits = ((posSlot >> 1) - 1);
640
+
641
+ /* if (bufLimit - buf >= 8) return DUMMY_MATCH; */
642
+
643
+ if (posSlot < kEndPosModelIndex)
644
+ {
645
+ prob = probs + SpecPos + ((2 | (posSlot & 1)) << numDirectBits) - posSlot - 1;
646
+ }
647
+ else
648
+ {
649
+ numDirectBits -= kNumAlignBits;
650
+ do
651
+ {
652
+ NORMALIZE_CHECK
653
+ range >>= 1;
654
+ code -= range & (((code - range) >> 31) - 1);
655
+ /* if (code >= range) code -= range; */
656
+ }
657
+ while (--numDirectBits != 0);
658
+ prob = probs + Align;
659
+ numDirectBits = kNumAlignBits;
660
+ }
661
+ {
662
+ unsigned i = 1;
663
+ do
664
+ {
665
+ GET_BIT_CHECK(prob + i, i);
666
+ }
667
+ while (--numDirectBits != 0);
668
+ }
669
+ }
670
+ }
671
+ }
672
+ }
673
+ NORMALIZE_CHECK;
674
+ return res;
675
+ }
676
+
677
+
678
+ static void LzmaDec_InitRc(CLzmaDec *p, const Byte *data)
679
+ {
680
+ p->code = ((UInt32)data[1] << 24) | ((UInt32)data[2] << 16) | ((UInt32)data[3] << 8) | ((UInt32)data[4]);
681
+ p->range = 0xFFFFFFFF;
682
+ p->needFlush = 0;
683
+ }
684
+
685
+ void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState)
686
+ {
687
+ p->needFlush = 1;
688
+ p->remainLen = 0;
689
+ p->tempBufSize = 0;
690
+
691
+ if (initDic)
692
+ {
693
+ p->processedPos = 0;
694
+ p->checkDicSize = 0;
695
+ p->needInitState = 1;
696
+ }
697
+ if (initState)
698
+ p->needInitState = 1;
699
+ }
700
+
701
+ void LzmaDec_Init(CLzmaDec *p)
702
+ {
703
+ p->dicPos = 0;
704
+ LzmaDec_InitDicAndState(p, True, True);
705
+ }
706
+
707
+ static void LzmaDec_InitStateReal(CLzmaDec *p)
708
+ {
709
+ UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (p->prop.lc + p->prop.lp));
710
+ UInt32 i;
711
+ CLzmaProb *probs = p->probs;
712
+ for (i = 0; i < numProbs; i++)
713
+ probs[i] = kBitModelTotal >> 1;
714
+ p->reps[0] = p->reps[1] = p->reps[2] = p->reps[3] = 1;
715
+ p->state = 0;
716
+ p->needInitState = 0;
717
+ }
718
+
719
+ SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen,
720
+ ELzmaFinishMode finishMode, ELzmaStatus *status)
721
+ {
722
+ SizeT inSize = *srcLen;
723
+ (*srcLen) = 0;
724
+ LzmaDec_WriteRem(p, dicLimit);
725
+
726
+ *status = LZMA_STATUS_NOT_SPECIFIED;
727
+
728
+ while (p->remainLen != kMatchSpecLenStart)
729
+ {
730
+ int checkEndMarkNow;
731
+
732
+ if (p->needFlush != 0)
733
+ {
734
+ for (; inSize > 0 && p->tempBufSize < RC_INIT_SIZE; (*srcLen)++, inSize--)
735
+ p->tempBuf[p->tempBufSize++] = *src++;
736
+ if (p->tempBufSize < RC_INIT_SIZE)
737
+ {
738
+ *status = LZMA_STATUS_NEEDS_MORE_INPUT;
739
+ return SZ_OK;
740
+ }
741
+ if (p->tempBuf[0] != 0)
742
+ return SZ_ERROR_DATA;
743
+
744
+ LzmaDec_InitRc(p, p->tempBuf);
745
+ p->tempBufSize = 0;
746
+ }
747
+
748
+ checkEndMarkNow = 0;
749
+ if (p->dicPos >= dicLimit)
750
+ {
751
+ if (p->remainLen == 0 && p->code == 0)
752
+ {
753
+ *status = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK;
754
+ return SZ_OK;
755
+ }
756
+ if (finishMode == LZMA_FINISH_ANY)
757
+ {
758
+ *status = LZMA_STATUS_NOT_FINISHED;
759
+ return SZ_OK;
760
+ }
761
+ if (p->remainLen != 0)
762
+ {
763
+ *status = LZMA_STATUS_NOT_FINISHED;
764
+ return SZ_ERROR_DATA;
765
+ }
766
+ checkEndMarkNow = 1;
767
+ }
768
+
769
+ if (p->needInitState)
770
+ LzmaDec_InitStateReal(p);
771
+
772
+ if (p->tempBufSize == 0)
773
+ {
774
+ SizeT processed;
775
+ const Byte *bufLimit;
776
+ if (inSize < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)
777
+ {
778
+ int dummyRes = LzmaDec_TryDummy(p, src, inSize);
779
+ if (dummyRes == DUMMY_ERROR)
780
+ {
781
+ memcpy(p->tempBuf, src, inSize);
782
+ p->tempBufSize = (unsigned)inSize;
783
+ (*srcLen) += inSize;
784
+ *status = LZMA_STATUS_NEEDS_MORE_INPUT;
785
+ return SZ_OK;
786
+ }
787
+ if (checkEndMarkNow && dummyRes != DUMMY_MATCH)
788
+ {
789
+ *status = LZMA_STATUS_NOT_FINISHED;
790
+ return SZ_ERROR_DATA;
791
+ }
792
+ bufLimit = src;
793
+ }
794
+ else
795
+ bufLimit = src + inSize - LZMA_REQUIRED_INPUT_MAX;
796
+ p->buf = src;
797
+ if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0)
798
+ return SZ_ERROR_DATA;
799
+ processed = (SizeT)(p->buf - src);
800
+ (*srcLen) += processed;
801
+ src += processed;
802
+ inSize -= processed;
803
+ }
804
+ else
805
+ {
806
+ unsigned rem = p->tempBufSize, lookAhead = 0;
807
+ while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize)
808
+ p->tempBuf[rem++] = src[lookAhead++];
809
+ p->tempBufSize = rem;
810
+ if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)
811
+ {
812
+ int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, rem);
813
+ if (dummyRes == DUMMY_ERROR)
814
+ {
815
+ (*srcLen) += lookAhead;
816
+ *status = LZMA_STATUS_NEEDS_MORE_INPUT;
817
+ return SZ_OK;
818
+ }
819
+ if (checkEndMarkNow && dummyRes != DUMMY_MATCH)
820
+ {
821
+ *status = LZMA_STATUS_NOT_FINISHED;
822
+ return SZ_ERROR_DATA;
823
+ }
824
+ }
825
+ p->buf = p->tempBuf;
826
+ if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0)
827
+ return SZ_ERROR_DATA;
828
+ lookAhead -= (rem - (unsigned)(p->buf - p->tempBuf));
829
+ (*srcLen) += lookAhead;
830
+ src += lookAhead;
831
+ inSize -= lookAhead;
832
+ p->tempBufSize = 0;
833
+ }
834
+ }
835
+ if (p->code == 0)
836
+ *status = LZMA_STATUS_FINISHED_WITH_MARK;
837
+ return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA;
838
+ }
839
+
840
+ SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status)
841
+ {
842
+ SizeT outSize = *destLen;
843
+ SizeT inSize = *srcLen;
844
+ *srcLen = *destLen = 0;
845
+ for (;;)
846
+ {
847
+ SizeT inSizeCur = inSize, outSizeCur, dicPos;
848
+ ELzmaFinishMode curFinishMode;
849
+ SRes res;
850
+ if (p->dicPos == p->dicBufSize)
851
+ p->dicPos = 0;
852
+ dicPos = p->dicPos;
853
+ if (outSize > p->dicBufSize - dicPos)
854
+ {
855
+ outSizeCur = p->dicBufSize;
856
+ curFinishMode = LZMA_FINISH_ANY;
857
+ }
858
+ else
859
+ {
860
+ outSizeCur = dicPos + outSize;
861
+ curFinishMode = finishMode;
862
+ }
863
+
864
+ res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status);
865
+ src += inSizeCur;
866
+ inSize -= inSizeCur;
867
+ *srcLen += inSizeCur;
868
+ outSizeCur = p->dicPos - dicPos;
869
+ memcpy(dest, p->dic + dicPos, outSizeCur);
870
+ dest += outSizeCur;
871
+ outSize -= outSizeCur;
872
+ *destLen += outSizeCur;
873
+ if (res != 0)
874
+ return res;
875
+ if (outSizeCur == 0 || outSize == 0)
876
+ return SZ_OK;
877
+ }
878
+ }
879
+
880
+ void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc)
881
+ {
882
+ alloc->Free(alloc, p->probs);
883
+ p->probs = 0;
884
+ }
885
+
886
+ static void LzmaDec_FreeDict(CLzmaDec *p, ISzAlloc *alloc)
887
+ {
888
+ alloc->Free(alloc, p->dic);
889
+ p->dic = 0;
890
+ }
891
+
892
+ void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc)
893
+ {
894
+ LzmaDec_FreeProbs(p, alloc);
895
+ LzmaDec_FreeDict(p, alloc);
896
+ }
897
+
898
+ SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size)
899
+ {
900
+ UInt32 dicSize;
901
+ Byte d;
902
+
903
+ if (size < LZMA_PROPS_SIZE)
904
+ return SZ_ERROR_UNSUPPORTED;
905
+ else
906
+ dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24);
907
+
908
+ if (dicSize < LZMA_DIC_MIN)
909
+ dicSize = LZMA_DIC_MIN;
910
+ p->dicSize = dicSize;
911
+
912
+ d = data[0];
913
+ if (d >= (9 * 5 * 5))
914
+ return SZ_ERROR_UNSUPPORTED;
915
+
916
+ p->lc = d % 9;
917
+ d /= 9;
918
+ p->pb = d / 5;
919
+ p->lp = d % 5;
920
+
921
+ return SZ_OK;
922
+ }
923
+
924
+ static SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc)
925
+ {
926
+ UInt32 numProbs = LzmaProps_GetNumProbs(propNew);
927
+ if (p->probs == 0 || numProbs != p->numProbs)
928
+ {
929
+ LzmaDec_FreeProbs(p, alloc);
930
+ p->probs = (CLzmaProb *)alloc->Alloc(alloc, numProbs * sizeof(CLzmaProb));
931
+ p->numProbs = numProbs;
932
+ if (p->probs == 0)
933
+ return SZ_ERROR_MEM;
934
+ }
935
+ return SZ_OK;
936
+ }
937
+
938
+ SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
939
+ {
940
+ CLzmaProps propNew;
941
+ RINOK(LzmaProps_Decode(&propNew, props, propsSize));
942
+ RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc));
943
+ p->prop = propNew;
944
+ return SZ_OK;
945
+ }
946
+
947
+ SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
948
+ {
949
+ CLzmaProps propNew;
950
+ SizeT dicBufSize;
951
+ RINOK(LzmaProps_Decode(&propNew, props, propsSize));
952
+ RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc));
953
+ dicBufSize = propNew.dicSize;
954
+ if (p->dic == 0 || dicBufSize != p->dicBufSize)
955
+ {
956
+ LzmaDec_FreeDict(p, alloc);
957
+ p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize);
958
+ if (p->dic == 0)
959
+ {
960
+ LzmaDec_FreeProbs(p, alloc);
961
+ return SZ_ERROR_MEM;
962
+ }
963
+ }
964
+ p->dicBufSize = dicBufSize;
965
+ p->prop = propNew;
966
+ return SZ_OK;
967
+ }
968
+
969
+ SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
970
+ const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
971
+ ELzmaStatus *status, ISzAlloc *alloc)
972
+ {
973
+ CLzmaDec p;
974
+ SRes res;
975
+ SizeT inSize = *srcLen;
976
+ SizeT outSize = *destLen;
977
+ *srcLen = *destLen = 0;
978
+ if (inSize < RC_INIT_SIZE)
979
+ return SZ_ERROR_INPUT_EOF;
980
+
981
+ LzmaDec_Construct(&p);
982
+ res = LzmaDec_AllocateProbs(&p, propData, propSize, alloc);
983
+ if (res != 0)
984
+ return res;
985
+ p.dic = dest;
986
+ p.dicBufSize = outSize;
987
+
988
+ LzmaDec_Init(&p);
989
+
990
+ *srcLen = inSize;
991
+ res = LzmaDec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status);
992
+
993
+ if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT)
994
+ res = SZ_ERROR_INPUT_EOF;
995
+
996
+ (*destLen) = p.dicPos;
997
+ LzmaDec_FreeProbs(&p, alloc);
998
+ return res;
999
+ }