seven_zip_ruby 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (732) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +25 -0
  3. data/.travis.yml +10 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +39 -0
  6. data/README.md +176 -0
  7. data/Rakefile +47 -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/depend +5 -0
  709. data/ext/seven_zip_ruby/extconf.rb +131 -0
  710. data/ext/seven_zip_ruby/guid_defs.h +29 -0
  711. data/ext/seven_zip_ruby/mutex.h +10 -0
  712. data/ext/seven_zip_ruby/posix/mutex.h +94 -0
  713. data/ext/seven_zip_ruby/seven_zip_archive.cpp +1614 -0
  714. data/ext/seven_zip_ruby/seven_zip_archive.h +515 -0
  715. data/ext/seven_zip_ruby/util_common.h +444 -0
  716. data/ext/seven_zip_ruby/utils.cpp +576 -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 +16 -0
  720. data/lib/seven_zip_ruby/7z.dll +0 -0
  721. data/lib/seven_zip_ruby/7z64.dll +0 -0
  722. data/lib/seven_zip_ruby/archive_info.rb +21 -0
  723. data/lib/seven_zip_ruby/entry_info.rb +45 -0
  724. data/lib/seven_zip_ruby/exception.rb +7 -0
  725. data/lib/seven_zip_ruby/seven_zip_reader.rb +180 -0
  726. data/lib/seven_zip_ruby/seven_zip_writer.rb +143 -0
  727. data/lib/seven_zip_ruby/update_info.rb +116 -0
  728. data/lib/seven_zip_ruby/version.rb +3 -0
  729. data/seven_zip_ruby.gemspec +26 -0
  730. data/spec/seven_zip_ruby_spec.rb +490 -0
  731. data/spec/seven_zip_ruby_spec_helper.rb +122 -0
  732. metadata +820 -0
@@ -0,0 +1,267 @@
1
+ // Rar3Decoder.h
2
+ // According to unRAR license, this code may not be used to develop
3
+ // a program that creates RAR archives
4
+
5
+ /* This code uses Carryless rangecoder (1999): Dmitry Subbotin : Public domain */
6
+
7
+ #ifndef __COMPRESS_RAR3_DECODER_H
8
+ #define __COMPRESS_RAR3_DECODER_H
9
+
10
+ #include "../../../C/Ppmd7.h"
11
+
12
+ #include "../../Common/MyCom.h"
13
+
14
+ #include "../ICoder.h"
15
+
16
+ #include "../Common/InBuffer.h"
17
+
18
+ #include "BitmDecoder.h"
19
+ #include "HuffmanDecoder.h"
20
+ #include "Rar3Vm.h"
21
+
22
+ namespace NCompress {
23
+ namespace NRar3 {
24
+
25
+ const UInt32 kWindowSize = 1 << 22;
26
+ const UInt32 kWindowMask = (kWindowSize - 1);
27
+
28
+ const UInt32 kNumReps = 4;
29
+ const UInt32 kNumLen2Symbols = 8;
30
+ const UInt32 kLenTableSize = 28;
31
+ const UInt32 kMainTableSize = 256 + 1 + 1 + 1 + kNumReps + kNumLen2Symbols + kLenTableSize;
32
+ const UInt32 kDistTableSize = 60;
33
+
34
+ const int kNumAlignBits = 4;
35
+ const UInt32 kAlignTableSize = (1 << kNumAlignBits) + 1;
36
+
37
+ const UInt32 kLevelTableSize = 20;
38
+
39
+ const UInt32 kTablesSizesSum = kMainTableSize + kDistTableSize + kAlignTableSize + kLenTableSize;
40
+
41
+ class CBitDecoder
42
+ {
43
+ UInt32 m_Value;
44
+ unsigned m_BitPos;
45
+ public:
46
+ CInBuffer m_Stream;
47
+ bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); }
48
+ void SetStream(ISequentialInStream *inStream) { m_Stream.SetStream(inStream);}
49
+ void ReleaseStream() { m_Stream.ReleaseStream();}
50
+
51
+ void Init()
52
+ {
53
+ m_Stream.Init();
54
+ m_BitPos = 0;
55
+ m_Value = 0;
56
+ }
57
+
58
+ UInt64 GetProcessedSize() const { return m_Stream.GetProcessedSize() - (m_BitPos) / 8; }
59
+ UInt32 GetBitPosition() const { return ((8 - m_BitPos) & 7); }
60
+
61
+ UInt32 GetValue(unsigned numBits)
62
+ {
63
+ if (m_BitPos < numBits)
64
+ {
65
+ m_BitPos += 8;
66
+ m_Value = (m_Value << 8) | m_Stream.ReadByte();
67
+ if (m_BitPos < numBits)
68
+ {
69
+ m_BitPos += 8;
70
+ m_Value = (m_Value << 8) | m_Stream.ReadByte();
71
+ }
72
+ }
73
+ return m_Value >> (m_BitPos - numBits);
74
+ }
75
+
76
+ void MovePos(unsigned numBits)
77
+ {
78
+ m_BitPos -= numBits;
79
+ m_Value = m_Value & ((1 << m_BitPos) - 1);
80
+ }
81
+
82
+ UInt32 ReadBits(unsigned numBits)
83
+ {
84
+ UInt32 res = GetValue(numBits);
85
+ MovePos(numBits);
86
+ return res;
87
+ }
88
+ };
89
+
90
+ const UInt32 kTopValue = (1 << 24);
91
+ const UInt32 kBot = (1 << 15);
92
+
93
+ struct CRangeDecoder
94
+ {
95
+ IPpmd7_RangeDec s;
96
+ UInt32 Range;
97
+ UInt32 Code;
98
+ UInt32 Low;
99
+ CBitDecoder bitDecoder;
100
+ SRes Res;
101
+
102
+ public:
103
+ void InitRangeCoder()
104
+ {
105
+ Code = 0;
106
+ Low = 0;
107
+ Range = 0xFFFFFFFF;
108
+ for (int i = 0; i < 4; i++)
109
+ Code = (Code << 8) | bitDecoder.ReadBits(8);
110
+ }
111
+
112
+ void Normalize()
113
+ {
114
+ while ((Low ^ (Low + Range)) < kTopValue ||
115
+ Range < kBot && ((Range = (0 - Low) & (kBot - 1)), 1))
116
+ {
117
+ Code = (Code << 8) | bitDecoder.m_Stream.ReadByte();
118
+ Range <<= 8;
119
+ Low <<= 8;
120
+ }
121
+ }
122
+
123
+ CRangeDecoder();
124
+ };
125
+
126
+ struct CFilter: public NVm::CProgram
127
+ {
128
+ CRecordVector<Byte> GlobalData;
129
+ UInt32 BlockStart;
130
+ UInt32 BlockSize;
131
+ UInt32 ExecCount;
132
+ CFilter(): BlockStart(0), BlockSize(0), ExecCount(0) {}
133
+ };
134
+
135
+ struct CTempFilter: public NVm::CProgramInitState
136
+ {
137
+ UInt32 BlockStart;
138
+ UInt32 BlockSize;
139
+ UInt32 ExecCount;
140
+ bool NextWindow;
141
+
142
+ UInt32 FilterIndex;
143
+ };
144
+
145
+ const int kNumHuffmanBits = 15;
146
+
147
+ class CDecoder:
148
+ public ICompressCoder,
149
+ public ICompressSetDecoderProperties2,
150
+ public CMyUnknownImp
151
+ {
152
+ CRangeDecoder m_InBitStream;
153
+ Byte *_window;
154
+ UInt32 _winPos;
155
+ UInt32 _wrPtr;
156
+ UInt64 _lzSize;
157
+ UInt64 _unpackSize;
158
+ UInt64 _writtenFileSize; // if it's > _unpackSize, then _unpackSize only written
159
+ CMyComPtr<ISequentialOutStream> _outStream;
160
+ NHuffman::CDecoder<kNumHuffmanBits, kMainTableSize> m_MainDecoder;
161
+ NHuffman::CDecoder<kNumHuffmanBits, kDistTableSize> m_DistDecoder;
162
+ NHuffman::CDecoder<kNumHuffmanBits, kAlignTableSize> m_AlignDecoder;
163
+ NHuffman::CDecoder<kNumHuffmanBits, kLenTableSize> m_LenDecoder;
164
+ NHuffman::CDecoder<kNumHuffmanBits, kLevelTableSize> m_LevelDecoder;
165
+
166
+ UInt32 _reps[kNumReps];
167
+ UInt32 _lastLength;
168
+
169
+ Byte m_LastLevels[kTablesSizesSum];
170
+
171
+ Byte *_vmData;
172
+ Byte *_vmCode;
173
+ NVm::CVm _vm;
174
+ CRecordVector<CFilter *> _filters;
175
+ CRecordVector<CTempFilter *> _tempFilters;
176
+ UInt32 _lastFilter;
177
+
178
+ bool m_IsSolid;
179
+
180
+ bool _lzMode;
181
+
182
+ UInt32 PrevAlignBits;
183
+ UInt32 PrevAlignCount;
184
+
185
+ bool TablesRead;
186
+
187
+ CPpmd7 _ppmd;
188
+ int PpmEscChar;
189
+ bool PpmError;
190
+
191
+ HRESULT WriteDataToStream(const Byte *data, UInt32 size);
192
+ HRESULT WriteData(const Byte *data, UInt32 size);
193
+ HRESULT WriteArea(UInt32 startPtr, UInt32 endPtr);
194
+ void ExecuteFilter(int tempFilterIndex, NVm::CBlockRef &outBlockRef);
195
+ HRESULT WriteBuf();
196
+
197
+ void InitFilters();
198
+ bool AddVmCode(UInt32 firstByte, UInt32 codeSize);
199
+ bool ReadVmCodeLZ();
200
+ bool ReadVmCodePPM();
201
+
202
+ UInt32 ReadBits(int numBits);
203
+
204
+ HRESULT InitPPM();
205
+ int DecodePpmSymbol();
206
+ HRESULT DecodePPM(Int32 num, bool &keepDecompressing);
207
+
208
+ HRESULT ReadTables(bool &keepDecompressing);
209
+ HRESULT ReadEndOfBlock(bool &keepDecompressing);
210
+ HRESULT DecodeLZ(bool &keepDecompressing);
211
+ HRESULT CodeReal(ICompressProgressInfo *progress);
212
+ public:
213
+ CDecoder();
214
+ ~CDecoder();
215
+
216
+ MY_UNKNOWN_IMP1(ICompressSetDecoderProperties2)
217
+
218
+ void ReleaseStreams()
219
+ {
220
+ _outStream.Release();
221
+ m_InBitStream.bitDecoder.ReleaseStream();
222
+ }
223
+
224
+ STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
225
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
226
+
227
+ STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
228
+
229
+ void CopyBlock(UInt32 distance, UInt32 len)
230
+ {
231
+ _lzSize += len;
232
+ UInt32 pos = (_winPos - distance - 1) & kWindowMask;
233
+ Byte *window = _window;
234
+ UInt32 winPos = _winPos;
235
+ if (kWindowSize - winPos > len && kWindowSize - pos > len)
236
+ {
237
+ const Byte *src = window + pos;
238
+ Byte *dest = window + winPos;
239
+ _winPos += len;
240
+ do
241
+ *dest++ = *src++;
242
+ while(--len != 0);
243
+ return;
244
+ }
245
+ do
246
+ {
247
+ window[winPos] = window[pos];
248
+ winPos = (winPos + 1) & kWindowMask;
249
+ pos = (pos + 1) & kWindowMask;
250
+ }
251
+ while(--len != 0);
252
+ _winPos = winPos;
253
+ }
254
+
255
+ void PutByte(Byte b)
256
+ {
257
+ _window[_winPos] = b;
258
+ _winPos = (_winPos + 1) & kWindowMask;
259
+ _lzSize++;
260
+ }
261
+
262
+
263
+ };
264
+
265
+ }}
266
+
267
+ #endif
@@ -0,0 +1,1091 @@
1
+ // Rar3Vm.cpp
2
+ // According to unRAR license, this code may not be used to develop
3
+ // a program that creates RAR archives
4
+
5
+ /*
6
+ Note:
7
+ Due to performance considerations Rar VM may set Flags C incorrectly
8
+ for some operands (SHL x, 0, ... ).
9
+ Check implementation of concrete VM command
10
+ to see if it sets flags right.
11
+ */
12
+
13
+ #include "StdAfx.h"
14
+
15
+ #include "../../../C/7zCrc.h"
16
+ #include "../../../C/Alloc.h"
17
+
18
+ #include "Rar3Vm.h"
19
+
20
+ namespace NCompress {
21
+ namespace NRar3 {
22
+
23
+ UInt32 CMemBitDecoder::ReadBits(int numBits)
24
+ {
25
+ UInt32 res = 0;
26
+ for (;;)
27
+ {
28
+ Byte b = _bitPos < _bitSize ? _data[_bitPos >> 3] : 0;
29
+ int avail = (int)(8 - (_bitPos & 7));
30
+ if (numBits <= avail)
31
+ {
32
+ _bitPos += numBits;
33
+ return res | (b >> (avail - numBits)) & ((1 << numBits) - 1);
34
+ }
35
+ numBits -= avail;
36
+ res |= (UInt32)(b & ((1 << avail) - 1)) << numBits;
37
+ _bitPos += avail;
38
+ }
39
+ }
40
+
41
+ UInt32 CMemBitDecoder::ReadBit() { return ReadBits(1); }
42
+
43
+ namespace NVm {
44
+
45
+ static const UInt32 kStackRegIndex = kNumRegs - 1;
46
+
47
+ static const UInt32 FLAG_C = 1;
48
+ static const UInt32 FLAG_Z = 2;
49
+ static const UInt32 FLAG_S = 0x80000000;
50
+
51
+ static const Byte CF_OP0 = 0;
52
+ static const Byte CF_OP1 = 1;
53
+ static const Byte CF_OP2 = 2;
54
+ static const Byte CF_OPMASK = 3;
55
+ static const Byte CF_BYTEMODE = 4;
56
+ static const Byte CF_JUMP = 8;
57
+ static const Byte CF_PROC = 16;
58
+ static const Byte CF_USEFLAGS = 32;
59
+ static const Byte CF_CHFLAGS = 64;
60
+
61
+ static Byte kCmdFlags[]=
62
+ {
63
+ /* CMD_MOV */ CF_OP2 | CF_BYTEMODE,
64
+ /* CMD_CMP */ CF_OP2 | CF_BYTEMODE | CF_CHFLAGS,
65
+ /* CMD_ADD */ CF_OP2 | CF_BYTEMODE | CF_CHFLAGS,
66
+ /* CMD_SUB */ CF_OP2 | CF_BYTEMODE | CF_CHFLAGS,
67
+ /* CMD_JZ */ CF_OP1 | CF_JUMP | CF_USEFLAGS,
68
+ /* CMD_JNZ */ CF_OP1 | CF_JUMP | CF_USEFLAGS,
69
+ /* CMD_INC */ CF_OP1 | CF_BYTEMODE | CF_CHFLAGS,
70
+ /* CMD_DEC */ CF_OP1 | CF_BYTEMODE | CF_CHFLAGS,
71
+ /* CMD_JMP */ CF_OP1 | CF_JUMP,
72
+ /* CMD_XOR */ CF_OP2 | CF_BYTEMODE | CF_CHFLAGS,
73
+ /* CMD_AND */ CF_OP2 | CF_BYTEMODE | CF_CHFLAGS,
74
+ /* CMD_OR */ CF_OP2 | CF_BYTEMODE | CF_CHFLAGS,
75
+ /* CMD_TEST */ CF_OP2 | CF_BYTEMODE | CF_CHFLAGS,
76
+ /* CMD_JS */ CF_OP1 | CF_JUMP | CF_USEFLAGS,
77
+ /* CMD_JNS */ CF_OP1 | CF_JUMP | CF_USEFLAGS,
78
+ /* CMD_JB */ CF_OP1 | CF_JUMP | CF_USEFLAGS,
79
+ /* CMD_JBE */ CF_OP1 | CF_JUMP | CF_USEFLAGS,
80
+ /* CMD_JA */ CF_OP1 | CF_JUMP | CF_USEFLAGS,
81
+ /* CMD_JAE */ CF_OP1 | CF_JUMP | CF_USEFLAGS,
82
+ /* CMD_PUSH */ CF_OP1,
83
+ /* CMD_POP */ CF_OP1,
84
+ /* CMD_CALL */ CF_OP1 | CF_PROC,
85
+ /* CMD_RET */ CF_OP0 | CF_PROC,
86
+ /* CMD_NOT */ CF_OP1 | CF_BYTEMODE,
87
+ /* CMD_SHL */ CF_OP2 | CF_BYTEMODE | CF_CHFLAGS,
88
+ /* CMD_SHR */ CF_OP2 | CF_BYTEMODE | CF_CHFLAGS,
89
+ /* CMD_SAR */ CF_OP2 | CF_BYTEMODE | CF_CHFLAGS,
90
+ /* CMD_NEG */ CF_OP1 | CF_BYTEMODE | CF_CHFLAGS,
91
+ /* CMD_PUSHA */ CF_OP0,
92
+ /* CMD_POPA */ CF_OP0,
93
+ /* CMD_PUSHF */ CF_OP0 | CF_USEFLAGS,
94
+ /* CMD_POPF */ CF_OP0 | CF_CHFLAGS,
95
+ /* CMD_MOVZX */ CF_OP2,
96
+ /* CMD_MOVSX */ CF_OP2,
97
+ /* CMD_XCHG */ CF_OP2 | CF_BYTEMODE,
98
+ /* CMD_MUL */ CF_OP2 | CF_BYTEMODE,
99
+ /* CMD_DIV */ CF_OP2 | CF_BYTEMODE,
100
+ /* CMD_ADC */ CF_OP2 | CF_BYTEMODE | CF_USEFLAGS | CF_CHFLAGS ,
101
+ /* CMD_SBB */ CF_OP2 | CF_BYTEMODE | CF_USEFLAGS | CF_CHFLAGS ,
102
+ /* CMD_PRINT */ CF_OP0
103
+ };
104
+
105
+ CVm::CVm(): Mem(NULL) {}
106
+
107
+ bool CVm::Create()
108
+ {
109
+ if (Mem == NULL)
110
+ Mem = (Byte *)::MyAlloc(kSpaceSize + 4);
111
+ return (Mem != NULL);
112
+ }
113
+
114
+ CVm::~CVm()
115
+ {
116
+ ::MyFree(Mem);
117
+ }
118
+
119
+ // CVm::Execute can change CProgram object: it clears progarm if VM returns error.
120
+
121
+ bool CVm::Execute(CProgram *prg, const CProgramInitState *initState,
122
+ CBlockRef &outBlockRef, CRecordVector<Byte> &outGlobalData)
123
+ {
124
+ memcpy(R, initState->InitR, sizeof(initState->InitR));
125
+ R[kStackRegIndex] = kSpaceSize;
126
+ R[kNumRegs] = 0;
127
+ Flags = 0;
128
+
129
+ UInt32 globalSize = MyMin((UInt32)initState->GlobalData.Size(), kGlobalSize);
130
+ if (globalSize != 0)
131
+ memcpy(Mem + kGlobalOffset, &initState->GlobalData[0], globalSize);
132
+ UInt32 staticSize = MyMin((UInt32)prg->StaticData.Size(), kGlobalSize - globalSize);
133
+ if (staticSize != 0)
134
+ memcpy(Mem + kGlobalOffset + globalSize, &prg->StaticData[0], staticSize);
135
+
136
+ bool res = true;
137
+ #ifdef RARVM_STANDARD_FILTERS
138
+ if (prg->StandardFilterIndex >= 0)
139
+ ExecuteStandardFilter(prg->StandardFilterIndex);
140
+ else
141
+ #endif
142
+ {
143
+ res = ExecuteCode(prg);
144
+ if (!res)
145
+ prg->Commands[0].OpCode = CMD_RET;
146
+ }
147
+ UInt32 newBlockPos = GetFixedGlobalValue32(NGlobalOffset::kBlockPos) & kSpaceMask;
148
+ UInt32 newBlockSize = GetFixedGlobalValue32(NGlobalOffset::kBlockSize) & kSpaceMask;
149
+ if (newBlockPos + newBlockSize >= kSpaceSize)
150
+ newBlockPos = newBlockSize = 0;
151
+ outBlockRef.Offset = newBlockPos;
152
+ outBlockRef.Size = newBlockSize;
153
+
154
+ outGlobalData.Clear();
155
+ UInt32 dataSize = GetFixedGlobalValue32(NGlobalOffset::kGlobalMemOutSize);
156
+ dataSize = MyMin(dataSize, kGlobalSize - kFixedGlobalSize);
157
+ if (dataSize != 0)
158
+ {
159
+ dataSize += kFixedGlobalSize;
160
+ outGlobalData.Reserve(dataSize);
161
+ for (UInt32 i = 0; i < dataSize; i++)
162
+ outGlobalData.Add(Mem[kGlobalOffset + i]);
163
+ }
164
+ return res;
165
+ }
166
+
167
+
168
+ #define SET_IP(IP) \
169
+ if ((IP) >= numCommands) return true; \
170
+ if (--maxOpCount <= 0) return false; \
171
+ cmd = commands + (IP);
172
+
173
+ #define GET_FLAG_S_B(res) (((res) & 0x80) ? FLAG_S : 0)
174
+ #define SET_IP_OP1 { UInt32 val = GetOperand32(&cmd->Op1); SET_IP(val); }
175
+ #define FLAGS_UPDATE_SZ Flags = res == 0 ? FLAG_Z : res & FLAG_S
176
+ #define FLAGS_UPDATE_SZ_B Flags = (res & 0xFF) == 0 ? FLAG_Z : GET_FLAG_S_B(res)
177
+
178
+ UInt32 CVm::GetOperand32(const COperand *op) const
179
+ {
180
+ switch(op->Type)
181
+ {
182
+ case OP_TYPE_REG: return R[op->Data];
183
+ case OP_TYPE_REGMEM: return GetValue32(&Mem[(op->Base + R[op->Data]) & kSpaceMask]);
184
+ default: return op->Data;
185
+ }
186
+ }
187
+
188
+ void CVm::SetOperand32(const COperand *op, UInt32 val)
189
+ {
190
+ switch(op->Type)
191
+ {
192
+ case OP_TYPE_REG: R[op->Data] = val; return;
193
+ case OP_TYPE_REGMEM: SetValue32(&Mem[(op->Base + R[op->Data]) & kSpaceMask], val); return;
194
+ }
195
+ }
196
+
197
+ Byte CVm::GetOperand8(const COperand *op) const
198
+ {
199
+ switch(op->Type)
200
+ {
201
+ case OP_TYPE_REG: return (Byte)R[op->Data];
202
+ case OP_TYPE_REGMEM: return Mem[(op->Base + R[op->Data]) & kSpaceMask];;
203
+ default: return (Byte)op->Data;
204
+ }
205
+ }
206
+
207
+ void CVm::SetOperand8(const COperand *op, Byte val)
208
+ {
209
+ switch(op->Type)
210
+ {
211
+ case OP_TYPE_REG: R[op->Data] = (R[op->Data] & 0xFFFFFF00) | val; return;
212
+ case OP_TYPE_REGMEM: Mem[(op->Base + R[op->Data]) & kSpaceMask] = val; return;
213
+ }
214
+ }
215
+
216
+ UInt32 CVm::GetOperand(bool byteMode, const COperand *op) const
217
+ {
218
+ if (byteMode)
219
+ return GetOperand8(op);
220
+ return GetOperand32(op);
221
+ }
222
+
223
+ void CVm::SetOperand(bool byteMode, const COperand *op, UInt32 val)
224
+ {
225
+ if (byteMode)
226
+ SetOperand8(op, (Byte)(val & 0xFF));
227
+ else
228
+ SetOperand32(op, val);
229
+ }
230
+
231
+ bool CVm::ExecuteCode(const CProgram *prg)
232
+ {
233
+ Int32 maxOpCount = 25000000;
234
+ const CCommand *commands = &prg->Commands[0];
235
+ const CCommand *cmd = commands;
236
+ UInt32 numCommands = prg->Commands.Size();
237
+ for (;;)
238
+ {
239
+ switch(cmd->OpCode)
240
+ {
241
+ #ifndef RARVM_NO_VM
242
+
243
+ case CMD_MOV:
244
+ SetOperand32(&cmd->Op1, GetOperand32(&cmd->Op2));
245
+ break;
246
+ case CMD_MOVB:
247
+ SetOperand8(&cmd->Op1, GetOperand8(&cmd->Op2));
248
+ break;
249
+ case CMD_CMP:
250
+ {
251
+ UInt32 v1 = GetOperand32(&cmd->Op1);
252
+ UInt32 res = v1 - GetOperand32(&cmd->Op2);
253
+ Flags = res == 0 ? FLAG_Z : (res > v1) | (res & FLAG_S);
254
+ }
255
+ break;
256
+ case CMD_CMPB:
257
+ {
258
+ Byte v1 = GetOperand8(&cmd->Op1);
259
+ Byte res = v1 - GetOperand8(&cmd->Op2);
260
+ res &= 0xFF;
261
+ Flags = res == 0 ? FLAG_Z : (res > v1) | GET_FLAG_S_B(res);
262
+ }
263
+ break;
264
+ case CMD_ADD:
265
+ {
266
+ UInt32 v1 = GetOperand32(&cmd->Op1);
267
+ UInt32 res = v1 + GetOperand32(&cmd->Op2);
268
+ SetOperand32(&cmd->Op1, res);
269
+ Flags = (res < v1) | (res == 0 ? FLAG_Z : (res & FLAG_S));
270
+ }
271
+ break;
272
+ case CMD_ADDB:
273
+ {
274
+ Byte v1 = GetOperand8(&cmd->Op1);
275
+ Byte res = v1 + GetOperand8(&cmd->Op2);
276
+ res &= 0xFF;
277
+ SetOperand8(&cmd->Op1, (Byte)res);
278
+ Flags = (res < v1) | (res == 0 ? FLAG_Z : GET_FLAG_S_B(res));
279
+ }
280
+ break;
281
+ case CMD_ADC:
282
+ {
283
+ UInt32 v1 = GetOperand(cmd->ByteMode, &cmd->Op1);
284
+ UInt32 FC = (Flags & FLAG_C);
285
+ UInt32 res = v1 + GetOperand(cmd->ByteMode, &cmd->Op2) + FC;
286
+ if (cmd->ByteMode)
287
+ res &= 0xFF;
288
+ SetOperand(cmd->ByteMode, &cmd->Op1, res);
289
+ Flags = (res < v1 || res == v1 && FC) | (res == 0 ? FLAG_Z : (res & FLAG_S));
290
+ }
291
+ break;
292
+ case CMD_SUB:
293
+ {
294
+ UInt32 v1 = GetOperand32(&cmd->Op1);
295
+ UInt32 res = v1 - GetOperand32(&cmd->Op2);
296
+ SetOperand32(&cmd->Op1, res);
297
+ Flags = res == 0 ? FLAG_Z : (res > v1) | (res & FLAG_S);
298
+ }
299
+ break;
300
+ case CMD_SUBB:
301
+ {
302
+ UInt32 v1 = GetOperand8(&cmd->Op1);
303
+ UInt32 res = v1 - GetOperand8(&cmd->Op2);
304
+ SetOperand8(&cmd->Op1, (Byte)res);
305
+ Flags = res == 0 ? FLAG_Z : (res > v1) | (res & FLAG_S);
306
+ }
307
+ break;
308
+ case CMD_SBB:
309
+ {
310
+ UInt32 v1 = GetOperand(cmd->ByteMode, &cmd->Op1);
311
+ UInt32 FC = (Flags & FLAG_C);
312
+ UInt32 res = v1 - GetOperand(cmd->ByteMode, &cmd->Op2) - FC;
313
+ // Flags = res == 0 ? FLAG_Z : (res > v1 || res == v1 && FC) | (res & FLAG_S);
314
+ if (cmd->ByteMode)
315
+ res &= 0xFF;
316
+ SetOperand(cmd->ByteMode, &cmd->Op1, res);
317
+ Flags = (res > v1 || res == v1 && FC) | (res == 0 ? FLAG_Z : (res & FLAG_S));
318
+ }
319
+ break;
320
+ case CMD_INC:
321
+ {
322
+ UInt32 res = GetOperand32(&cmd->Op1) + 1;
323
+ SetOperand32(&cmd->Op1, res);
324
+ FLAGS_UPDATE_SZ;
325
+ }
326
+ break;
327
+ case CMD_INCB:
328
+ {
329
+ Byte res = GetOperand8(&cmd->Op1) + 1;
330
+ SetOperand8(&cmd->Op1, res);;
331
+ FLAGS_UPDATE_SZ_B;
332
+ }
333
+ break;
334
+ case CMD_DEC:
335
+ {
336
+ UInt32 res = GetOperand32(&cmd->Op1) - 1;
337
+ SetOperand32(&cmd->Op1, res);
338
+ FLAGS_UPDATE_SZ;
339
+ }
340
+ break;
341
+ case CMD_DECB:
342
+ {
343
+ Byte res = GetOperand8(&cmd->Op1) - 1;
344
+ SetOperand8(&cmd->Op1, res);;
345
+ FLAGS_UPDATE_SZ_B;
346
+ }
347
+ break;
348
+ case CMD_XOR:
349
+ {
350
+ UInt32 res = GetOperand32(&cmd->Op1) ^ GetOperand32(&cmd->Op2);
351
+ SetOperand32(&cmd->Op1, res);
352
+ FLAGS_UPDATE_SZ;
353
+ }
354
+ break;
355
+ case CMD_XORB:
356
+ {
357
+ Byte res = GetOperand8(&cmd->Op1) ^ GetOperand8(&cmd->Op2);
358
+ SetOperand8(&cmd->Op1, res);
359
+ FLAGS_UPDATE_SZ_B;
360
+ }
361
+ break;
362
+ case CMD_AND:
363
+ {
364
+ UInt32 res = GetOperand32(&cmd->Op1) & GetOperand32(&cmd->Op2);
365
+ SetOperand32(&cmd->Op1, res);
366
+ FLAGS_UPDATE_SZ;
367
+ }
368
+ break;
369
+ case CMD_ANDB:
370
+ {
371
+ Byte res = GetOperand8(&cmd->Op1) & GetOperand8(&cmd->Op2);
372
+ SetOperand8(&cmd->Op1, res);
373
+ FLAGS_UPDATE_SZ_B;
374
+ }
375
+ break;
376
+ case CMD_OR:
377
+ {
378
+ UInt32 res = GetOperand32(&cmd->Op1) | GetOperand32(&cmd->Op2);
379
+ SetOperand32(&cmd->Op1, res);
380
+ FLAGS_UPDATE_SZ;
381
+ }
382
+ break;
383
+ case CMD_ORB:
384
+ {
385
+ Byte res = GetOperand8(&cmd->Op1) | GetOperand8(&cmd->Op2);
386
+ SetOperand8(&cmd->Op1, res);
387
+ FLAGS_UPDATE_SZ_B;
388
+ }
389
+ break;
390
+ case CMD_TEST:
391
+ {
392
+ UInt32 res = GetOperand32(&cmd->Op1) & GetOperand32(&cmd->Op2);
393
+ FLAGS_UPDATE_SZ;
394
+ }
395
+ break;
396
+ case CMD_TESTB:
397
+ {
398
+ Byte res = GetOperand8(&cmd->Op1) & GetOperand8(&cmd->Op2);
399
+ FLAGS_UPDATE_SZ_B;
400
+ }
401
+ break;
402
+ case CMD_NOT:
403
+ SetOperand(cmd->ByteMode, &cmd->Op1, ~GetOperand(cmd->ByteMode, &cmd->Op1));
404
+ break;
405
+ case CMD_NEG:
406
+ {
407
+ UInt32 res = 0 - GetOperand32(&cmd->Op1);
408
+ SetOperand32(&cmd->Op1, res);
409
+ Flags = res == 0 ? FLAG_Z : FLAG_C | (res & FLAG_S);
410
+ }
411
+ break;
412
+ case CMD_NEGB:
413
+ {
414
+ Byte res = (Byte)(0 - GetOperand8(&cmd->Op1));
415
+ SetOperand8(&cmd->Op1, res);
416
+ Flags = res == 0 ? FLAG_Z : FLAG_C | GET_FLAG_S_B(res);
417
+ }
418
+ break;
419
+
420
+ case CMD_SHL:
421
+ {
422
+ UInt32 v1 = GetOperand32(&cmd->Op1);
423
+ int v2 = (int)GetOperand32(&cmd->Op2);
424
+ UInt32 res = v1 << v2;
425
+ SetOperand32(&cmd->Op1, res);
426
+ Flags = (res == 0 ? FLAG_Z : (res & FLAG_S)) | ((v1 << (v2 - 1)) & 0x80000000 ? FLAG_C : 0);
427
+ }
428
+ break;
429
+ case CMD_SHLB:
430
+ {
431
+ Byte v1 = GetOperand8(&cmd->Op1);
432
+ int v2 = (int)GetOperand8(&cmd->Op2);
433
+ Byte res = (Byte)(v1 << v2);
434
+ SetOperand8(&cmd->Op1, res);
435
+ Flags = (res == 0 ? FLAG_Z : GET_FLAG_S_B(res)) | ((v1 << (v2 - 1)) & 0x80 ? FLAG_C : 0);
436
+ }
437
+ break;
438
+ case CMD_SHR:
439
+ {
440
+ UInt32 v1 = GetOperand32(&cmd->Op1);
441
+ int v2 = (int)GetOperand32(&cmd->Op2);
442
+ UInt32 res = v1 >> v2;
443
+ SetOperand32(&cmd->Op1, res);
444
+ Flags = (res == 0 ? FLAG_Z : (res & FLAG_S)) | ((v1 >> (v2 - 1)) & FLAG_C);
445
+ }
446
+ break;
447
+ case CMD_SHRB:
448
+ {
449
+ Byte v1 = GetOperand8(&cmd->Op1);
450
+ int v2 = (int)GetOperand8(&cmd->Op2);
451
+ Byte res = (Byte)(v1 >> v2);
452
+ SetOperand8(&cmd->Op1, res);
453
+ Flags = (res == 0 ? FLAG_Z : GET_FLAG_S_B(res)) | ((v1 >> (v2 - 1)) & FLAG_C);
454
+ }
455
+ break;
456
+ case CMD_SAR:
457
+ {
458
+ UInt32 v1 = GetOperand32(&cmd->Op1);
459
+ int v2 = (int)GetOperand32(&cmd->Op2);
460
+ UInt32 res = UInt32(((Int32)v1) >> v2);
461
+ SetOperand32(&cmd->Op1, res);
462
+ Flags= (res == 0 ? FLAG_Z : (res & FLAG_S)) | ((v1 >> (v2 - 1)) & FLAG_C);
463
+ }
464
+ break;
465
+ case CMD_SARB:
466
+ {
467
+ Byte v1 = GetOperand8(&cmd->Op1);
468
+ int v2 = (int)GetOperand8(&cmd->Op2);
469
+ Byte res = (Byte)(((signed char)v1) >> v2);
470
+ SetOperand8(&cmd->Op1, res);
471
+ Flags= (res == 0 ? FLAG_Z : GET_FLAG_S_B(res)) | ((v1 >> (v2 - 1)) & FLAG_C);
472
+ }
473
+ break;
474
+
475
+ case CMD_JMP:
476
+ SET_IP_OP1;
477
+ continue;
478
+ case CMD_JZ:
479
+ if ((Flags & FLAG_Z) != 0)
480
+ {
481
+ SET_IP_OP1;
482
+ continue;
483
+ }
484
+ break;
485
+ case CMD_JNZ:
486
+ if ((Flags & FLAG_Z) == 0)
487
+ {
488
+ SET_IP_OP1;
489
+ continue;
490
+ }
491
+ break;
492
+ case CMD_JS:
493
+ if ((Flags & FLAG_S) != 0)
494
+ {
495
+ SET_IP_OP1;
496
+ continue;
497
+ }
498
+ break;
499
+ case CMD_JNS:
500
+ if ((Flags & FLAG_S) == 0)
501
+ {
502
+ SET_IP_OP1;
503
+ continue;
504
+ }
505
+ break;
506
+ case CMD_JB:
507
+ if ((Flags & FLAG_C) != 0)
508
+ {
509
+ SET_IP_OP1;
510
+ continue;
511
+ }
512
+ break;
513
+ case CMD_JBE:
514
+ if ((Flags & (FLAG_C | FLAG_Z)) != 0)
515
+ {
516
+ SET_IP_OP1;
517
+ continue;
518
+ }
519
+ break;
520
+ case CMD_JA:
521
+ if ((Flags & (FLAG_C | FLAG_Z)) == 0)
522
+ {
523
+ SET_IP_OP1;
524
+ continue;
525
+ }
526
+ break;
527
+ case CMD_JAE:
528
+ if ((Flags & FLAG_C) == 0)
529
+ {
530
+ SET_IP_OP1;
531
+ continue;
532
+ }
533
+ break;
534
+
535
+ case CMD_PUSH:
536
+ R[kStackRegIndex] -= 4;
537
+ SetValue32(&Mem[R[kStackRegIndex] & kSpaceMask], GetOperand32(&cmd->Op1));
538
+ break;
539
+ case CMD_POP:
540
+ SetOperand32(&cmd->Op1, GetValue32(&Mem[R[kStackRegIndex] & kSpaceMask]));
541
+ R[kStackRegIndex] += 4;
542
+ break;
543
+ case CMD_CALL:
544
+ R[kStackRegIndex] -= 4;
545
+ SetValue32(&Mem[R[kStackRegIndex] & kSpaceMask], (UInt32)(cmd - commands + 1));
546
+ SET_IP_OP1;
547
+ continue;
548
+
549
+ case CMD_PUSHA:
550
+ {
551
+ for (UInt32 i = 0, SP = R[kStackRegIndex] - 4; i < kNumRegs; i++, SP -= 4)
552
+ SetValue32(&Mem[SP & kSpaceMask], R[i]);
553
+ R[kStackRegIndex] -= kNumRegs * 4;
554
+ }
555
+ break;
556
+ case CMD_POPA:
557
+ {
558
+ for (UInt32 i = 0, SP = R[kStackRegIndex]; i < kNumRegs; i++, SP += 4)
559
+ R[kStackRegIndex - i] = GetValue32(&Mem[SP & kSpaceMask]);
560
+ }
561
+ break;
562
+ case CMD_PUSHF:
563
+ R[kStackRegIndex] -= 4;
564
+ SetValue32(&Mem[R[kStackRegIndex]&kSpaceMask], Flags);
565
+ break;
566
+ case CMD_POPF:
567
+ Flags = GetValue32(&Mem[R[kStackRegIndex] & kSpaceMask]);
568
+ R[kStackRegIndex] += 4;
569
+ break;
570
+
571
+ case CMD_MOVZX:
572
+ SetOperand32(&cmd->Op1, GetOperand8(&cmd->Op2));
573
+ break;
574
+ case CMD_MOVSX:
575
+ SetOperand32(&cmd->Op1, (UInt32)(Int32)(signed char)GetOperand8(&cmd->Op2));
576
+ break;
577
+ case CMD_XCHG:
578
+ {
579
+ UInt32 v1 = GetOperand(cmd->ByteMode, &cmd->Op1);
580
+ SetOperand(cmd->ByteMode, &cmd->Op1, GetOperand(cmd->ByteMode, &cmd->Op2));
581
+ SetOperand(cmd->ByteMode, &cmd->Op2, v1);
582
+ }
583
+ break;
584
+ case CMD_MUL:
585
+ {
586
+ UInt32 res = GetOperand32(&cmd->Op1) * GetOperand32(&cmd->Op2);
587
+ SetOperand32(&cmd->Op1, res);
588
+ }
589
+ break;
590
+ case CMD_MULB:
591
+ {
592
+ Byte res = GetOperand8(&cmd->Op1) * GetOperand8(&cmd->Op2);
593
+ SetOperand8(&cmd->Op1, res);
594
+ }
595
+ break;
596
+ case CMD_DIV:
597
+ {
598
+ UInt32 divider = GetOperand(cmd->ByteMode, &cmd->Op2);
599
+ if (divider != 0)
600
+ {
601
+ UInt32 res = GetOperand(cmd->ByteMode, &cmd->Op1) / divider;
602
+ SetOperand(cmd->ByteMode, &cmd->Op1, res);
603
+ }
604
+ }
605
+ break;
606
+
607
+ #endif
608
+
609
+ case CMD_RET:
610
+ {
611
+ if (R[kStackRegIndex] >= kSpaceSize)
612
+ return true;
613
+ UInt32 ip = GetValue32(&Mem[R[kStackRegIndex] & kSpaceMask]);
614
+ SET_IP(ip);
615
+ R[kStackRegIndex] += 4;
616
+ continue;
617
+ }
618
+ case CMD_PRINT:
619
+ break;
620
+ }
621
+ cmd++;
622
+ --maxOpCount;
623
+ }
624
+ }
625
+
626
+
627
+ //////////////////////////////////////////////////////
628
+ // Read program
629
+
630
+ UInt32 ReadEncodedUInt32(CMemBitDecoder &inp)
631
+ {
632
+ switch(inp.ReadBits(2))
633
+ {
634
+ case 0:
635
+ return inp.ReadBits(4);
636
+ case 1:
637
+ {
638
+ UInt32 v = inp.ReadBits(4);
639
+ if (v == 0)
640
+ return 0xFFFFFF00 | inp.ReadBits(8);
641
+ else
642
+ return (v << 4) | inp.ReadBits(4);
643
+ }
644
+ case 2:
645
+ return inp.ReadBits(16);
646
+ default:
647
+ return inp.ReadBits(32);
648
+ }
649
+ }
650
+
651
+ void CVm::DecodeArg(CMemBitDecoder &inp, COperand &op, bool byteMode)
652
+ {
653
+ if (inp.ReadBit())
654
+ {
655
+ op.Type = OP_TYPE_REG;
656
+ op.Data = inp.ReadBits(kNumRegBits);
657
+ }
658
+ else if (inp.ReadBit() == 0)
659
+ {
660
+ op.Type = OP_TYPE_INT;
661
+ if (byteMode)
662
+ op.Data = inp.ReadBits(8);
663
+ else
664
+ op.Data = ReadEncodedUInt32(inp);
665
+ }
666
+ else
667
+ {
668
+ op.Type = OP_TYPE_REGMEM;
669
+ if (inp.ReadBit() == 0)
670
+ {
671
+ op.Data = inp.ReadBits(kNumRegBits);
672
+ op.Base = 0;
673
+ }
674
+ else
675
+ {
676
+ if (inp.ReadBit() == 0)
677
+ op.Data = inp.ReadBits(kNumRegBits);
678
+ else
679
+ op.Data = kNumRegs;
680
+ op.Base = ReadEncodedUInt32(inp);
681
+ }
682
+ }
683
+ }
684
+
685
+ void CVm::ReadVmProgram(const Byte *code, UInt32 codeSize, CProgram *prg)
686
+ {
687
+ CMemBitDecoder inp;
688
+ inp.Init(code, codeSize);
689
+
690
+ prg->StaticData.Clear();
691
+ if (inp.ReadBit())
692
+ {
693
+ UInt32 dataSize = ReadEncodedUInt32(inp) + 1;
694
+ for (UInt32 i = 0; inp.Avail() && i < dataSize; i++)
695
+ prg->StaticData.Add((Byte)inp.ReadBits(8));
696
+ }
697
+ while (inp.Avail())
698
+ {
699
+ prg->Commands.Add(CCommand());
700
+ CCommand *cmd = &prg->Commands.Back();
701
+ if (inp.ReadBit() == 0)
702
+ cmd->OpCode = (ECommand)inp.ReadBits(3);
703
+ else
704
+ cmd->OpCode = (ECommand)(8 + inp.ReadBits(5));
705
+ if (kCmdFlags[cmd->OpCode] & CF_BYTEMODE)
706
+ cmd->ByteMode = (inp.ReadBit()) ? true : false;
707
+ else
708
+ cmd->ByteMode = 0;
709
+ int opNum = (kCmdFlags[cmd->OpCode] & CF_OPMASK);
710
+ if (opNum > 0)
711
+ {
712
+ DecodeArg(inp, cmd->Op1, cmd->ByteMode);
713
+ if (opNum == 2)
714
+ DecodeArg(inp, cmd->Op2, cmd->ByteMode);
715
+ else
716
+ {
717
+ if (cmd->Op1.Type == OP_TYPE_INT && (kCmdFlags[cmd->OpCode] & (CF_JUMP | CF_PROC)))
718
+ {
719
+ int Distance = cmd->Op1.Data;
720
+ if (Distance >= 256)
721
+ Distance -= 256;
722
+ else
723
+ {
724
+ if (Distance >= 136)
725
+ Distance -= 264;
726
+ else if (Distance >= 16)
727
+ Distance -= 8;
728
+ else if (Distance >= 8)
729
+ Distance -= 16;
730
+ Distance += prg->Commands.Size() - 1;
731
+ }
732
+ cmd->Op1.Data = Distance;
733
+ }
734
+ }
735
+ }
736
+ if (cmd->ByteMode)
737
+ {
738
+ switch (cmd->OpCode)
739
+ {
740
+ case CMD_MOV: cmd->OpCode = CMD_MOVB; break;
741
+ case CMD_CMP: cmd->OpCode = CMD_CMPB; break;
742
+ case CMD_ADD: cmd->OpCode = CMD_ADDB; break;
743
+ case CMD_SUB: cmd->OpCode = CMD_SUBB; break;
744
+ case CMD_INC: cmd->OpCode = CMD_INCB; break;
745
+ case CMD_DEC: cmd->OpCode = CMD_DECB; break;
746
+ case CMD_XOR: cmd->OpCode = CMD_XORB; break;
747
+ case CMD_AND: cmd->OpCode = CMD_ANDB; break;
748
+ case CMD_OR: cmd->OpCode = CMD_ORB; break;
749
+ case CMD_TEST: cmd->OpCode = CMD_TESTB; break;
750
+ case CMD_NEG: cmd->OpCode = CMD_NEGB; break;
751
+ case CMD_SHL: cmd->OpCode = CMD_SHLB; break;
752
+ case CMD_SHR: cmd->OpCode = CMD_SHRB; break;
753
+ case CMD_SAR: cmd->OpCode = CMD_SARB; break;
754
+ case CMD_MUL: cmd->OpCode = CMD_MULB; break;
755
+ }
756
+ }
757
+ }
758
+ }
759
+
760
+ #ifdef RARVM_STANDARD_FILTERS
761
+
762
+ enum EStandardFilter
763
+ {
764
+ SF_E8,
765
+ SF_E8E9,
766
+ SF_ITANIUM,
767
+ SF_RGB,
768
+ SF_AUDIO,
769
+ SF_DELTA,
770
+ SF_UPCASE
771
+ };
772
+
773
+ struct StandardFilterSignature
774
+ {
775
+ UInt32 Length;
776
+ UInt32 CRC;
777
+ EStandardFilter Type;
778
+ }
779
+ kStdFilters[]=
780
+ {
781
+ { 53, 0xad576887, SF_E8 },
782
+ { 57, 0x3cd7e57e, SF_E8E9 },
783
+ { 120, 0x3769893f, SF_ITANIUM },
784
+ { 29, 0x0e06077d, SF_DELTA },
785
+ { 149, 0x1c2c5dc8, SF_RGB },
786
+ { 216, 0xbc85e701, SF_AUDIO },
787
+ { 40, 0x46b9c560, SF_UPCASE }
788
+ };
789
+
790
+ static int FindStandardFilter(const Byte *code, UInt32 codeSize)
791
+ {
792
+ UInt32 crc = CrcCalc(code, codeSize);
793
+ for (int i = 0; i < sizeof(kStdFilters) / sizeof(kStdFilters[0]); i++)
794
+ {
795
+ StandardFilterSignature &sfs = kStdFilters[i];
796
+ if (sfs.CRC == crc && sfs.Length == codeSize)
797
+ return i;
798
+ }
799
+ return -1;
800
+ }
801
+
802
+ #endif
803
+
804
+ void CVm::PrepareProgram(const Byte *code, UInt32 codeSize, CProgram *prg)
805
+ {
806
+ Byte xorSum = 0;
807
+ for (UInt32 i = 1; i < codeSize; i++)
808
+ xorSum ^= code[i];
809
+
810
+ prg->Commands.Clear();
811
+ #ifdef RARVM_STANDARD_FILTERS
812
+ prg->StandardFilterIndex = -1;
813
+ #endif
814
+
815
+ if (xorSum == code[0] && codeSize > 0)
816
+ {
817
+ #ifdef RARVM_STANDARD_FILTERS
818
+ prg->StandardFilterIndex = FindStandardFilter(code, codeSize);
819
+ if (prg->StandardFilterIndex >= 0)
820
+ return;
821
+ #endif
822
+ // 1 byte for checksum
823
+ ReadVmProgram(code + 1, codeSize - 1, prg);
824
+ }
825
+ prg->Commands.Add(CCommand());
826
+ CCommand *cmd = &prg->Commands.Back();
827
+ cmd->OpCode = CMD_RET;
828
+ }
829
+
830
+ void CVm::SetMemory(UInt32 pos, const Byte *data, UInt32 dataSize)
831
+ {
832
+ if (pos < kSpaceSize && data != Mem + pos)
833
+ memmove(Mem + pos, data, MyMin(dataSize, kSpaceSize - pos));
834
+ }
835
+
836
+ #ifdef RARVM_STANDARD_FILTERS
837
+
838
+ static void E8E9Decode(Byte *data, UInt32 dataSize, UInt32 fileOffset, bool e9)
839
+ {
840
+ if (dataSize <= 4)
841
+ return;
842
+ dataSize -= 4;
843
+ const UInt32 kFileSize = 0x1000000;
844
+ Byte cmpByte2 = (e9 ? 0xE9 : 0xE8);
845
+ for (UInt32 curPos = 0; curPos < dataSize;)
846
+ {
847
+ Byte curByte = *(data++);
848
+ curPos++;
849
+ if (curByte == 0xE8 || curByte == cmpByte2)
850
+ {
851
+ UInt32 offset = curPos + fileOffset;
852
+ UInt32 addr = (Int32)GetValue32(data);
853
+ if (addr < kFileSize)
854
+ SetValue32(data, addr - offset);
855
+ else if ((Int32)addr < 0 && (Int32)(addr + offset) >= 0)
856
+ SetValue32(data, addr + kFileSize);
857
+ data += 4;
858
+ curPos += 4;
859
+ }
860
+ }
861
+ }
862
+
863
+ static inline UInt32 ItaniumGetOpType(const Byte *data, int bitPos)
864
+ {
865
+ return (data[(unsigned int)bitPos >> 3] >> (bitPos & 7)) & 0xF;
866
+ }
867
+
868
+
869
+ static void ItaniumDecode(Byte *data, UInt32 dataSize, UInt32 fileOffset)
870
+ {
871
+ UInt32 curPos = 0;
872
+ fileOffset >>= 4;
873
+ while (curPos < dataSize - 21)
874
+ {
875
+ int b = (data[0] & 0x1F) - 0x10;
876
+ if (b >= 0)
877
+ {
878
+ static Byte kCmdMasks[16] = {4,4,6,6,0,0,7,7,4,4,0,0,4,4,0,0};
879
+ Byte cmdMask = kCmdMasks[b];
880
+ if (cmdMask != 0)
881
+ for (int i = 0; i < 3; i++)
882
+ if (cmdMask & (1 << i))
883
+ {
884
+ int startPos = i * 41 + 18;
885
+ if (ItaniumGetOpType(data, startPos + 24) == 5)
886
+ {
887
+ const UInt32 kMask = 0xFFFFF;
888
+ Byte *p = data + ((unsigned int)startPos >> 3);
889
+ UInt32 bitField = ((UInt32)p[0]) | ((UInt32)p[1] << 8) | ((UInt32)p[2] << 16);
890
+ int inBit = (startPos & 7);
891
+ UInt32 offset = (bitField >> inBit) & kMask;
892
+ UInt32 andMask = ~(kMask << inBit);
893
+ bitField = ((offset - fileOffset) & kMask) << inBit;
894
+ for (int j = 0; j < 3; j++)
895
+ {
896
+ p[j] &= andMask;
897
+ p[j] |= bitField;
898
+ andMask >>= 8;
899
+ bitField >>= 8;
900
+ }
901
+ }
902
+ }
903
+ }
904
+ data += 16;
905
+ curPos += 16;
906
+ fileOffset++;
907
+ }
908
+ }
909
+
910
+ static void DeltaDecode(Byte *data, UInt32 dataSize, UInt32 numChannels)
911
+ {
912
+ UInt32 srcPos = 0;
913
+ UInt32 border = dataSize * 2;
914
+ for (UInt32 curChannel = 0; curChannel < numChannels; curChannel++)
915
+ {
916
+ Byte prevByte = 0;
917
+ for (UInt32 destPos = dataSize + curChannel; destPos < border; destPos += numChannels)
918
+ data[destPos] = (prevByte = prevByte - data[srcPos++]);
919
+ }
920
+ }
921
+
922
+ static void RgbDecode(Byte *srcData, UInt32 dataSize, UInt32 width, UInt32 posR)
923
+ {
924
+ Byte *destData = srcData + dataSize;
925
+ const UInt32 numChannels = 3;
926
+ for (UInt32 curChannel = 0; curChannel < numChannels; curChannel++)
927
+ {
928
+ Byte prevByte = 0;
929
+
930
+ for (UInt32 i = curChannel; i < dataSize; i+= numChannels)
931
+ {
932
+ unsigned int predicted;
933
+ if (i < width)
934
+ predicted = prevByte;
935
+ else
936
+ {
937
+ unsigned int upperLeftByte = destData[i - width];
938
+ unsigned int upperByte = destData[i - width + 3];
939
+ predicted = prevByte + upperByte - upperLeftByte;
940
+ int pa = abs((int)(predicted - prevByte));
941
+ int pb = abs((int)(predicted - upperByte));
942
+ int pc = abs((int)(predicted - upperLeftByte));
943
+ if (pa <= pb && pa <= pc)
944
+ predicted = prevByte;
945
+ else
946
+ if (pb <= pc)
947
+ predicted = upperByte;
948
+ else
949
+ predicted = upperLeftByte;
950
+ }
951
+ destData[i] = prevByte = (Byte)(predicted - *(srcData++));
952
+ }
953
+ }
954
+ if (dataSize < 3)
955
+ return;
956
+ for (UInt32 i = posR, border = dataSize - 2; i < border; i += 3)
957
+ {
958
+ Byte g = destData[i + 1];
959
+ destData[i] = destData[i] + g;
960
+ destData[i + 2] = destData[i + 2] + g;
961
+ }
962
+ }
963
+
964
+ static void AudioDecode(Byte *srcData, UInt32 dataSize, UInt32 numChannels)
965
+ {
966
+ Byte *destData = srcData + dataSize;
967
+ for (UInt32 curChannel = 0; curChannel < numChannels; curChannel++)
968
+ {
969
+ UInt32 prevByte = 0, prevDelta = 0, dif[7];
970
+ Int32 D1 = 0, D2 = 0, D3;
971
+ Int32 K1 = 0, K2 = 0, K3 = 0;
972
+ memset(dif, 0, sizeof(dif));
973
+
974
+ for (UInt32 i = curChannel, byteCount = 0; i < dataSize; i += numChannels, byteCount++)
975
+ {
976
+ D3 = D2;
977
+ D2 = prevDelta - D1;
978
+ D1 = prevDelta;
979
+
980
+ UInt32 predicted = 8 * prevByte + K1 * D1 + K2 * D2 + K3 * D3;
981
+ predicted = (predicted >> 3) & 0xFF;
982
+
983
+ UInt32 curByte = *(srcData++);
984
+
985
+ predicted -= curByte;
986
+ destData[i] = (Byte)predicted;
987
+ prevDelta = (UInt32)(Int32)(signed char)(predicted - prevByte);
988
+ prevByte = predicted;
989
+
990
+ Int32 D = ((Int32)(signed char)curByte) << 3;
991
+
992
+ dif[0] += abs(D);
993
+ dif[1] += abs(D - D1);
994
+ dif[2] += abs(D + D1);
995
+ dif[3] += abs(D - D2);
996
+ dif[4] += abs(D + D2);
997
+ dif[5] += abs(D - D3);
998
+ dif[6] += abs(D + D3);
999
+
1000
+ if ((byteCount & 0x1F) == 0)
1001
+ {
1002
+ UInt32 minDif = dif[0], numMinDif = 0;
1003
+ dif[0] = 0;
1004
+ for (int j = 1; j < sizeof(dif) / sizeof(dif[0]); j++)
1005
+ {
1006
+ if (dif[j] < minDif)
1007
+ {
1008
+ minDif = dif[j];
1009
+ numMinDif = j;
1010
+ }
1011
+ dif[j] = 0;
1012
+ }
1013
+ switch (numMinDif)
1014
+ {
1015
+ case 1: if (K1 >= -16) K1--; break;
1016
+ case 2: if (K1 < 16) K1++; break;
1017
+ case 3: if (K2 >= -16) K2--; break;
1018
+ case 4: if (K2 < 16) K2++; break;
1019
+ case 5: if (K3 >= -16) K3--; break;
1020
+ case 6: if (K3 < 16) K3++; break;
1021
+ }
1022
+ }
1023
+ }
1024
+ }
1025
+ }
1026
+
1027
+ static UInt32 UpCaseDecode(Byte *data, UInt32 dataSize)
1028
+ {
1029
+ UInt32 srcPos = 0, destPos = dataSize;
1030
+ while (srcPos < dataSize)
1031
+ {
1032
+ Byte curByte = data[srcPos++];
1033
+ if (curByte == 2 && (curByte = data[srcPos++]) != 2)
1034
+ curByte -= 32;
1035
+ data[destPos++] = curByte;
1036
+ }
1037
+ return destPos - dataSize;
1038
+ }
1039
+
1040
+ void CVm::ExecuteStandardFilter(int filterIndex)
1041
+ {
1042
+ UInt32 dataSize = R[4];
1043
+ if (dataSize >= kGlobalOffset)
1044
+ return;
1045
+ EStandardFilter filterType = kStdFilters[filterIndex].Type;
1046
+
1047
+ switch (filterType)
1048
+ {
1049
+ case SF_E8:
1050
+ case SF_E8E9:
1051
+ E8E9Decode(Mem, dataSize, R[6], (filterType == SF_E8E9));
1052
+ break;
1053
+ case SF_ITANIUM:
1054
+ ItaniumDecode(Mem, dataSize, R[6]);
1055
+ break;
1056
+ case SF_DELTA:
1057
+ if (dataSize >= kGlobalOffset / 2)
1058
+ break;
1059
+ SetBlockPos(dataSize);
1060
+ DeltaDecode(Mem, dataSize, R[0]);
1061
+ break;
1062
+ case SF_RGB:
1063
+ if (dataSize >= kGlobalOffset / 2)
1064
+ break;
1065
+ {
1066
+ UInt32 width = R[0];
1067
+ if (width <= 3)
1068
+ break;
1069
+ SetBlockPos(dataSize);
1070
+ RgbDecode(Mem, dataSize, width, R[1]);
1071
+ }
1072
+ break;
1073
+ case SF_AUDIO:
1074
+ if (dataSize >= kGlobalOffset / 2)
1075
+ break;
1076
+ SetBlockPos(dataSize);
1077
+ AudioDecode(Mem, dataSize, R[0]);
1078
+ break;
1079
+ case SF_UPCASE:
1080
+ if (dataSize >= kGlobalOffset / 2)
1081
+ break;
1082
+ UInt32 destSize = UpCaseDecode(Mem, dataSize);
1083
+ SetBlockSize(destSize);
1084
+ SetBlockPos(dataSize);
1085
+ break;
1086
+ }
1087
+ }
1088
+
1089
+ #endif
1090
+
1091
+ }}}