react-native-update 10.34.2 → 10.34.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (746) hide show
  1. package/.gitmodules +4 -4
  2. package/harmony/pushy/src/main/cpp/HDiffPatch/CHANGELOG.md +153 -0
  3. package/harmony/pushy/src/main/cpp/HDiffPatch/LICENSE +48 -0
  4. package/harmony/pushy/src/main/cpp/HDiffPatch/Makefile +157 -0
  5. package/harmony/pushy/src/main/cpp/HDiffPatch/README.md +307 -0
  6. package/harmony/pushy/src/main/cpp/HDiffPatch/_atosize.h +83 -0
  7. package/harmony/pushy/src/main/cpp/HDiffPatch/_clock_for_demo.h +47 -0
  8. package/harmony/pushy/src/main/cpp/HDiffPatch/_dir_ignore.h +191 -0
  9. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/Android.mk +37 -0
  10. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/Application.mk +7 -0
  11. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/build_libs.bat +1 -0
  12. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/build_libs.sh +1 -0
  13. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/hpatch.c +18 -0
  14. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/hpatch.h +20 -0
  15. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/hpatch_jni.c +28 -0
  16. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/java/com/github/sisong/HPatch.java +8 -0
  17. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/codeblocks/HDiffPatch.workspace +8 -0
  18. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/codeblocks/HDiffZ.cbp +219 -0
  19. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/codeblocks/HPatchZ.cbp +156 -0
  20. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/codeblocks/unitTest.cbp +65 -0
  21. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/HDiffPatch.sln +105 -0
  22. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/HDiffZ.vcxproj +237 -0
  23. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/HDiffZ.vcxproj.user +3 -0
  24. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/HPatchZ.vcxproj +318 -0
  25. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/HPatchZ.vcxproj.user +3 -0
  26. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/unitTest.vcxproj +182 -0
  27. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/unitTest.vcxproj.user +3 -0
  28. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/HDiffPatch.xcworkspace/contents.xcworkspacedata +30 -0
  29. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/HDiffPatch.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  30. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/bestParams.xcodeproj/project.pbxproj +408 -0
  31. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/hdiffz.xcodeproj/project.pbxproj +573 -0
  32. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/hpatchz.xcodeproj/project.pbxproj +396 -0
  33. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/lz4.xcodeproj/project.pbxproj +268 -0
  34. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/lzma.xcodeproj/project.pbxproj +361 -0
  35. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/testHashClash.xcodeproj/project.pbxproj +301 -0
  36. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/unitTest.xcodeproj/project.pbxproj +411 -0
  37. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/zstd.xcodeproj/project.pbxproj +504 -0
  38. package/harmony/pushy/src/main/cpp/HDiffPatch/checksum_plugin_demo.h +344 -0
  39. package/harmony/pushy/src/main/cpp/HDiffPatch/compress_parallel.cpp +166 -0
  40. package/harmony/pushy/src/main/cpp/HDiffPatch/compress_parallel.h +59 -0
  41. package/harmony/pushy/src/main/cpp/HDiffPatch/compress_plugin_demo.h +1152 -0
  42. package/harmony/pushy/src/main/cpp/HDiffPatch/decompress_plugin_demo.h +995 -0
  43. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_diff.cpp +797 -0
  44. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_diff.h +65 -0
  45. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_diff_tools.cpp +200 -0
  46. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_diff_tools.h +178 -0
  47. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_manifest.cpp +357 -0
  48. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_manifest.h +87 -0
  49. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/file_for_dirDiff.h +151 -0
  50. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch.c +770 -0
  51. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch.h +236 -0
  52. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch_private.h +47 -0
  53. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch_tools.c +112 -0
  54. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch_tools.h +53 -0
  55. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch_types.h +61 -0
  56. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/new_dir_output.c +331 -0
  57. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/new_dir_output.h +144 -0
  58. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/new_stream.c +176 -0
  59. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/new_stream.h +84 -0
  60. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/ref_stream.c +146 -0
  61. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/ref_stream.h +61 -0
  62. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/res_handle_limit.c +152 -0
  63. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/res_handle_limit.h +76 -0
  64. package/harmony/pushy/src/main/cpp/HDiffPatch/file_for_patch.c +524 -0
  65. package/harmony/pushy/src/main/cpp/HDiffPatch/file_for_patch.h +259 -0
  66. package/harmony/pushy/src/main/cpp/HDiffPatch/hdiffz.cpp +1570 -0
  67. package/harmony/pushy/src/main/cpp/HDiffPatch/hpatch_dir_listener.h +290 -0
  68. package/harmony/pushy/src/main/cpp/HDiffPatch/hpatchz.c +1221 -0
  69. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/diff.cpp +1025 -0
  70. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/diff.h +116 -0
  71. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/diff_types.h +72 -0
  72. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/bytes_rle.cpp +213 -0
  73. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/bytes_rle.h +63 -0
  74. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/compress_detect.cpp +170 -0
  75. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/compress_detect.h +86 -0
  76. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/config.h +89 -0
  77. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.c +13 -0
  78. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.c.inc.h +398 -0
  79. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.h +194 -0
  80. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort64.c +13 -0
  81. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort64.h +204 -0
  82. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort_private.h +207 -0
  83. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/sssort.c.inc.h +815 -0
  84. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/trsort.c.inc.h +586 -0
  85. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/utils.c.inc.h +381 -0
  86. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/adler_roll.c +352 -0
  87. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/adler_roll.h +137 -0
  88. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/bloom_filter.h +137 -0
  89. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/covers.h +70 -0
  90. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/digest_matcher.cpp +628 -0
  91. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/digest_matcher.h +87 -0
  92. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp +363 -0
  93. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.h +139 -0
  94. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/mem_buf.h +68 -0
  95. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/pack_uint.h +115 -0
  96. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/suffix_string.cpp +342 -0
  97. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/suffix_string.h +94 -0
  98. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/checksum_plugin.h +52 -0
  99. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/patch.c +2292 -0
  100. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/patch.h +215 -0
  101. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/patch_private.h +165 -0
  102. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/patch_types.h +251 -0
  103. package/harmony/pushy/src/main/cpp/HDiffPatch/libParallel/parallel_channel.cpp +174 -0
  104. package/harmony/pushy/src/main/cpp/HDiffPatch/libParallel/parallel_channel.h +73 -0
  105. package/harmony/pushy/src/main/cpp/HDiffPatch/libParallel/parallel_import.cpp +367 -0
  106. package/harmony/pushy/src/main/cpp/HDiffPatch/libParallel/parallel_import.h +92 -0
  107. package/harmony/pushy/src/main/cpp/HDiffPatch/test/_private_searchBestParams.cpp +301 -0
  108. package/harmony/pushy/src/main/cpp/HDiffPatch/test/hpatchz_test.cpp +292 -0
  109. package/harmony/pushy/src/main/cpp/HDiffPatch/test/testHashClash.cpp +436 -0
  110. package/harmony/pushy/src/main/cpp/HDiffPatch/test/unit_test.cpp +417 -0
  111. package/harmony/pushy/src/main/cpp/lzma/Asm/arm/7zCrcOpt.asm +100 -0
  112. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/7zAsm.asm +147 -0
  113. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/7zCrcOpt.asm +147 -0
  114. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/AesOpt.asm +237 -0
  115. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/LzmaDecOpt.asm +1258 -0
  116. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/XzCrc64Opt.asm +205 -0
  117. package/harmony/pushy/src/main/cpp/lzma/C/7z.h +202 -0
  118. package/harmony/pushy/src/main/cpp/lzma/C/7zAlloc.c +80 -0
  119. package/harmony/pushy/src/main/cpp/lzma/C/7zAlloc.h +19 -0
  120. package/harmony/pushy/src/main/cpp/lzma/C/7zArcIn.c +1771 -0
  121. package/harmony/pushy/src/main/cpp/lzma/C/7zBuf.c +36 -0
  122. package/harmony/pushy/src/main/cpp/lzma/C/7zBuf.h +35 -0
  123. package/harmony/pushy/src/main/cpp/lzma/C/7zBuf2.c +52 -0
  124. package/harmony/pushy/src/main/cpp/lzma/C/7zCrc.c +128 -0
  125. package/harmony/pushy/src/main/cpp/lzma/C/7zCrc.h +25 -0
  126. package/harmony/pushy/src/main/cpp/lzma/C/7zCrcOpt.c +115 -0
  127. package/harmony/pushy/src/main/cpp/lzma/C/7zDec.c +591 -0
  128. package/harmony/pushy/src/main/cpp/lzma/C/7zFile.c +286 -0
  129. package/harmony/pushy/src/main/cpp/lzma/C/7zFile.h +83 -0
  130. package/harmony/pushy/src/main/cpp/lzma/C/7zStream.c +176 -0
  131. package/harmony/pushy/src/main/cpp/lzma/C/7zTypes.h +375 -0
  132. package/harmony/pushy/src/main/cpp/lzma/C/7zVersion.h +27 -0
  133. package/harmony/pushy/src/main/cpp/lzma/C/7zVersion.rc +55 -0
  134. package/harmony/pushy/src/main/cpp/lzma/C/Aes.c +306 -0
  135. package/harmony/pushy/src/main/cpp/lzma/C/Aes.h +38 -0
  136. package/harmony/pushy/src/main/cpp/lzma/C/AesOpt.c +184 -0
  137. package/harmony/pushy/src/main/cpp/lzma/C/Alloc.c +455 -0
  138. package/harmony/pushy/src/main/cpp/lzma/C/Alloc.h +51 -0
  139. package/harmony/pushy/src/main/cpp/lzma/C/Bcj2.c +257 -0
  140. package/harmony/pushy/src/main/cpp/lzma/C/Bcj2.h +146 -0
  141. package/harmony/pushy/src/main/cpp/lzma/C/Bcj2Enc.c +311 -0
  142. package/harmony/pushy/src/main/cpp/lzma/C/Bra.c +230 -0
  143. package/harmony/pushy/src/main/cpp/lzma/C/Bra.h +64 -0
  144. package/harmony/pushy/src/main/cpp/lzma/C/Bra86.c +82 -0
  145. package/harmony/pushy/src/main/cpp/lzma/C/BraIA64.c +53 -0
  146. package/harmony/pushy/src/main/cpp/lzma/C/Compiler.h +33 -0
  147. package/harmony/pushy/src/main/cpp/lzma/C/CpuArch.c +218 -0
  148. package/harmony/pushy/src/main/cpp/lzma/C/CpuArch.h +336 -0
  149. package/harmony/pushy/src/main/cpp/lzma/C/Delta.c +64 -0
  150. package/harmony/pushy/src/main/cpp/lzma/C/Delta.h +19 -0
  151. package/harmony/pushy/src/main/cpp/lzma/C/DllSecur.c +108 -0
  152. package/harmony/pushy/src/main/cpp/lzma/C/DllSecur.h +20 -0
  153. package/harmony/pushy/src/main/cpp/lzma/C/LzFind.c +1127 -0
  154. package/harmony/pushy/src/main/cpp/lzma/C/LzFind.h +121 -0
  155. package/harmony/pushy/src/main/cpp/lzma/C/LzFindMt.c +853 -0
  156. package/harmony/pushy/src/main/cpp/lzma/C/LzFindMt.h +101 -0
  157. package/harmony/pushy/src/main/cpp/lzma/C/LzHash.h +57 -0
  158. package/harmony/pushy/src/main/cpp/lzma/C/Lzma2Dec.c +488 -0
  159. package/harmony/pushy/src/main/cpp/lzma/C/Lzma2Dec.h +120 -0
  160. package/harmony/pushy/src/main/cpp/lzma/C/Lzma2DecMt.c +1082 -0
  161. package/harmony/pushy/src/main/cpp/lzma/C/Lzma2DecMt.h +79 -0
  162. package/harmony/pushy/src/main/cpp/lzma/C/Lzma2Enc.c +803 -0
  163. package/harmony/pushy/src/main/cpp/lzma/C/Lzma2Enc.h +55 -0
  164. package/harmony/pushy/src/main/cpp/lzma/C/Lzma86.h +111 -0
  165. package/harmony/pushy/src/main/cpp/lzma/C/Lzma86Dec.c +54 -0
  166. package/harmony/pushy/src/main/cpp/lzma/C/Lzma86Enc.c +106 -0
  167. package/harmony/pushy/src/main/cpp/lzma/C/LzmaDec.c +1185 -0
  168. package/harmony/pushy/src/main/cpp/lzma/C/LzmaDec.h +234 -0
  169. package/harmony/pushy/src/main/cpp/lzma/C/LzmaEnc.c +2976 -0
  170. package/harmony/pushy/src/main/cpp/lzma/C/LzmaEnc.h +76 -0
  171. package/harmony/pushy/src/main/cpp/lzma/C/LzmaLib.c +40 -0
  172. package/harmony/pushy/src/main/cpp/lzma/C/LzmaLib.h +131 -0
  173. package/harmony/pushy/src/main/cpp/lzma/C/MtCoder.c +601 -0
  174. package/harmony/pushy/src/main/cpp/lzma/C/MtCoder.h +141 -0
  175. package/harmony/pushy/src/main/cpp/lzma/C/MtDec.c +1138 -0
  176. package/harmony/pushy/src/main/cpp/lzma/C/MtDec.h +201 -0
  177. package/harmony/pushy/src/main/cpp/lzma/C/Ppmd.h +85 -0
  178. package/harmony/pushy/src/main/cpp/lzma/C/Ppmd7.c +712 -0
  179. package/harmony/pushy/src/main/cpp/lzma/C/Ppmd7.h +142 -0
  180. package/harmony/pushy/src/main/cpp/lzma/C/Ppmd7Dec.c +191 -0
  181. package/harmony/pushy/src/main/cpp/lzma/C/Ppmd7Enc.c +187 -0
  182. package/harmony/pushy/src/main/cpp/lzma/C/Precomp.h +10 -0
  183. package/harmony/pushy/src/main/cpp/lzma/C/RotateDefs.h +30 -0
  184. package/harmony/pushy/src/main/cpp/lzma/C/Sha256.c +248 -0
  185. package/harmony/pushy/src/main/cpp/lzma/C/Sha256.h +26 -0
  186. package/harmony/pushy/src/main/cpp/lzma/C/Sort.c +141 -0
  187. package/harmony/pushy/src/main/cpp/lzma/C/Sort.h +18 -0
  188. package/harmony/pushy/src/main/cpp/lzma/C/Threads.c +95 -0
  189. package/harmony/pushy/src/main/cpp/lzma/C/Threads.h +70 -0
  190. package/harmony/pushy/src/main/cpp/lzma/C/ThreadsP.c +396 -0
  191. package/harmony/pushy/src/main/cpp/lzma/C/ThreadsP.h +31 -0
  192. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/7z.dsp +241 -0
  193. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/7z.dsw +29 -0
  194. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/7zMain.c +686 -0
  195. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/Precomp.c +4 -0
  196. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/Precomp.h +10 -0
  197. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/makefile +40 -0
  198. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/makefile.gcc +75 -0
  199. package/harmony/pushy/src/main/cpp/lzma/C/Util/Lzma/LzmaUtil.c +258 -0
  200. package/harmony/pushy/src/main/cpp/lzma/C/Util/Lzma/LzmaUtil.dsp +168 -0
  201. package/harmony/pushy/src/main/cpp/lzma/C/Util/Lzma/LzmaUtil.dsw +29 -0
  202. package/harmony/pushy/src/main/cpp/lzma/C/Util/Lzma/makefile +28 -0
  203. package/harmony/pushy/src/main/cpp/lzma/C/Util/Lzma/makefile.gcc +44 -0
  204. package/harmony/pushy/src/main/cpp/lzma/C/Util/LzmaLib/LzmaLib.def +4 -0
  205. package/harmony/pushy/src/main/cpp/lzma/C/Util/LzmaLib/LzmaLib.dsp +178 -0
  206. package/harmony/pushy/src/main/cpp/lzma/C/Util/LzmaLib/LzmaLib.dsw +29 -0
  207. package/harmony/pushy/src/main/cpp/lzma/C/Util/LzmaLib/LzmaLibExports.c +14 -0
  208. package/harmony/pushy/src/main/cpp/lzma/C/Util/LzmaLib/makefile +34 -0
  209. package/harmony/pushy/src/main/cpp/lzma/C/Util/LzmaLib/resource.rc +3 -0
  210. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/Precomp.c +4 -0
  211. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/Precomp.h +10 -0
  212. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/SfxSetup.c +640 -0
  213. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/SfxSetup.dsp +231 -0
  214. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/SfxSetup.dsw +29 -0
  215. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/makefile +37 -0
  216. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/makefile_con +38 -0
  217. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/resource.rc +5 -0
  218. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/setup.ico +0 -0
  219. package/harmony/pushy/src/main/cpp/lzma/C/Xz.c +90 -0
  220. package/harmony/pushy/src/main/cpp/lzma/C/Xz.h +460 -0
  221. package/harmony/pushy/src/main/cpp/lzma/C/XzCrc64.c +86 -0
  222. package/harmony/pushy/src/main/cpp/lzma/C/XzCrc64.h +26 -0
  223. package/harmony/pushy/src/main/cpp/lzma/C/XzCrc64Opt.c +69 -0
  224. package/harmony/pushy/src/main/cpp/lzma/C/XzDec.c +2766 -0
  225. package/harmony/pushy/src/main/cpp/lzma/C/XzEnc.c +1329 -0
  226. package/harmony/pushy/src/main/cpp/lzma/C/XzEnc.h +60 -0
  227. package/harmony/pushy/src/main/cpp/lzma/C/XzIn.c +319 -0
  228. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/7zip.mak +240 -0
  229. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Aes.mak +7 -0
  230. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zCompressionMode.cpp +3 -0
  231. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zCompressionMode.h +76 -0
  232. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zDecode.cpp +569 -0
  233. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zDecode.h +70 -0
  234. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zEncode.cpp +678 -0
  235. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zEncode.h +92 -0
  236. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zExtract.cpp +423 -0
  237. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zFolderInStream.cpp +139 -0
  238. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zFolderInStream.h +61 -0
  239. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zHandler.cpp +763 -0
  240. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zHandler.h +181 -0
  241. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zHandlerOut.cpp +942 -0
  242. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zHeader.cpp +19 -0
  243. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zHeader.h +148 -0
  244. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zIn.cpp +1666 -0
  245. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zIn.h +445 -0
  246. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zItem.h +202 -0
  247. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zOut.cpp +901 -0
  248. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zOut.h +335 -0
  249. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zProperties.cpp +174 -0
  250. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zProperties.h +22 -0
  251. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zRegister.cpp +21 -0
  252. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zSpecStream.cpp +22 -0
  253. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zSpecStream.h +35 -0
  254. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zUpdate.cpp +2500 -0
  255. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zUpdate.h +139 -0
  256. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/StdAfx.cpp +3 -0
  257. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/StdAfx.h +8 -0
  258. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Archive.def +12 -0
  259. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Archive2.def +19 -0
  260. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/ArchiveExports.cpp +151 -0
  261. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/CoderMixer2.cpp +1125 -0
  262. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/CoderMixer2.h +447 -0
  263. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/DummyOutStream.cpp +17 -0
  264. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/DummyOutStream.h +25 -0
  265. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/HandlerOut.cpp +232 -0
  266. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/HandlerOut.h +110 -0
  267. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/InStreamWithCRC.cpp +46 -0
  268. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/InStreamWithCRC.h +67 -0
  269. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/ItemNameUtils.cpp +88 -0
  270. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/ItemNameUtils.h +28 -0
  271. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/MultiStream.cpp +191 -0
  272. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/MultiStream.h +89 -0
  273. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp +18 -0
  274. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/OutStreamWithCRC.h +37 -0
  275. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/ParseProperties.cpp +3 -0
  276. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/ParseProperties.h +6 -0
  277. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/StdAfx.h +8 -0
  278. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/DllExports2.cpp +122 -0
  279. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/IArchive.h +608 -0
  280. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Icons/7z.ico +0 -0
  281. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/LzmaHandler.cpp +629 -0
  282. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/SplitHandler.cpp +359 -0
  283. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/StdAfx.h +8 -0
  284. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/XzHandler.cpp +1308 -0
  285. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/XzHandler.h +11 -0
  286. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Asm.mak +9 -0
  287. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/Alone.dsp +1910 -0
  288. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/Alone.dsw +29 -0
  289. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/StdAfx.cpp +3 -0
  290. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/StdAfx.h +8 -0
  291. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/makefile +154 -0
  292. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/resource.rc +7 -0
  293. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zExtractR/StdAfx.cpp +3 -0
  294. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zExtractR/StdAfx.h +8 -0
  295. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zExtractR/makefile +96 -0
  296. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zExtractR/resource.rc +5 -0
  297. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zR/StdAfx.cpp +3 -0
  298. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zR/StdAfx.h +8 -0
  299. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zR/makefile +116 -0
  300. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zR/resource.rc +5 -0
  301. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/LzmaAlone.cpp +799 -0
  302. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/LzmaCon.dsp +477 -0
  303. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/LzmaCon.dsw +29 -0
  304. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/StdAfx.cpp +3 -0
  305. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/StdAfx.h +8 -0
  306. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/makefile +59 -0
  307. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/makefile.gcc +195 -0
  308. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/resource.rc +3 -0
  309. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaSpec/LzmaSpec.cpp +715 -0
  310. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/7z.ico +0 -0
  311. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/SFXCon.dsp +912 -0
  312. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/SFXCon.dsw +29 -0
  313. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/SfxCon.cpp +482 -0
  314. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/StdAfx.cpp +3 -0
  315. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/StdAfx.h +8 -0
  316. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/makefile +134 -0
  317. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/resource.rc +5 -0
  318. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/ExtractCallbackSfx.cpp +246 -0
  319. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/ExtractCallbackSfx.h +86 -0
  320. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp +137 -0
  321. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/ExtractEngine.h +11 -0
  322. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp +803 -0
  323. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsw +29 -0
  324. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/SfxSetup.cpp +364 -0
  325. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/StdAfx.cpp +3 -0
  326. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/StdAfx.h +13 -0
  327. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/makefile +117 -0
  328. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/resource.h +6 -0
  329. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/resource.rc +16 -0
  330. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/setup.ico +0 -0
  331. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/7z.ico +0 -0
  332. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/SFXWin.dsp +988 -0
  333. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/SFXWin.dsw +29 -0
  334. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/SfxWin.cpp +241 -0
  335. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/StdAfx.cpp +3 -0
  336. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/StdAfx.h +14 -0
  337. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/makefile +153 -0
  338. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/resource.h +1 -0
  339. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/resource.rc +50 -0
  340. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/CWrappers.cpp +250 -0
  341. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/CWrappers.h +120 -0
  342. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/CreateCoder.cpp +536 -0
  343. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/CreateCoder.h +192 -0
  344. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/FilePathAutoRename.cpp +46 -0
  345. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/FilePathAutoRename.h +10 -0
  346. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/FileStreams.cpp +475 -0
  347. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/FileStreams.h +166 -0
  348. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/FilterCoder.cpp +435 -0
  349. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/FilterCoder.h +205 -0
  350. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/InBuffer.cpp +163 -0
  351. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/InBuffer.h +92 -0
  352. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/InOutTempBuffer.cpp +127 -0
  353. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/InOutTempBuffer.h +48 -0
  354. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/LimitedStreams.cpp +367 -0
  355. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/LimitedStreams.h +252 -0
  356. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/LockedStream.cpp +3 -0
  357. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/LockedStream.h +6 -0
  358. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/MethodId.cpp +3 -0
  359. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/MethodId.h +10 -0
  360. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/MethodProps.cpp +509 -0
  361. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/MethodProps.h +264 -0
  362. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/OffsetStream.cpp +39 -0
  363. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/OffsetStream.h +26 -0
  364. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/OutBuffer.cpp +111 -0
  365. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/OutBuffer.h +66 -0
  366. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/ProgressUtils.cpp +51 -0
  367. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/ProgressUtils.h +35 -0
  368. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/PropId.cpp +108 -0
  369. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/RegisterArc.h +78 -0
  370. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/RegisterCodec.h +106 -0
  371. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StdAfx.h +8 -0
  372. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StreamBinder.cpp +156 -0
  373. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StreamBinder.h +60 -0
  374. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StreamObjects.cpp +285 -0
  375. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StreamObjects.h +157 -0
  376. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StreamUtils.cpp +56 -0
  377. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StreamUtils.h +13 -0
  378. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/UniqBlocks.cpp +57 -0
  379. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/UniqBlocks.h +26 -0
  380. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/VirtThread.cpp +48 -0
  381. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/VirtThread.h +24 -0
  382. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Bcj2Coder.cpp +666 -0
  383. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Bcj2Coder.h +120 -0
  384. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Bcj2Register.cpp +24 -0
  385. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/BcjCoder.cpp +24 -0
  386. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/BcjCoder.h +31 -0
  387. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/BcjRegister.cpp +17 -0
  388. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/BranchMisc.cpp +23 -0
  389. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/BranchMisc.h +35 -0
  390. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/BranchRegister.cpp +41 -0
  391. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/ByteSwap.cpp +92 -0
  392. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/CodecExports.cpp +344 -0
  393. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/CopyCoder.cpp +120 -0
  394. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/CopyCoder.h +49 -0
  395. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/CopyRegister.cpp +15 -0
  396. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/DeltaFilter.cpp +128 -0
  397. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Lzma2Decoder.cpp +265 -0
  398. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Lzma2Decoder.h +96 -0
  399. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Lzma2Encoder.cpp +122 -0
  400. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Lzma2Encoder.h +42 -0
  401. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Lzma2Register.cpp +22 -0
  402. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/LzmaDecoder.cpp +343 -0
  403. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/LzmaDecoder.h +113 -0
  404. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/LzmaEncoder.cpp +182 -0
  405. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/LzmaEncoder.h +46 -0
  406. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/LzmaRegister.cpp +22 -0
  407. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/PpmdDecoder.cpp +170 -0
  408. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/PpmdDecoder.h +86 -0
  409. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/PpmdEncoder.cpp +152 -0
  410. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/PpmdEncoder.h +58 -0
  411. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/PpmdRegister.cpp +22 -0
  412. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/StdAfx.h +8 -0
  413. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/XzDecoder.cpp +150 -0
  414. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/XzDecoder.h +92 -0
  415. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/XzEncoder.cpp +245 -0
  416. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/XzEncoder.h +46 -0
  417. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crc.mak +8 -0
  418. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crc64.mak +8 -0
  419. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/7zAes.cpp +280 -0
  420. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/7zAes.h +118 -0
  421. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/7zAesRegister.cpp +17 -0
  422. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/MyAes.cpp +112 -0
  423. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/MyAes.h +57 -0
  424. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/MyAesReg.cpp +16 -0
  425. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/RandGen.cpp +233 -0
  426. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/RandGen.h +40 -0
  427. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/StdAfx.h +8 -0
  428. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/GuiCommon.rc +84 -0
  429. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Guid.txt +220 -0
  430. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/ICoder.h +399 -0
  431. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/IDecl.h +28 -0
  432. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/IPassword.h +23 -0
  433. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/IProgress.h +19 -0
  434. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/IStream.h +127 -0
  435. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/LzmaDec.mak +5 -0
  436. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/MyVersion.h +2 -0
  437. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/MyVersionInfo.rc +2 -0
  438. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/PropID.h +127 -0
  439. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/SubBuild.mak +3 -0
  440. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/Client7z.cpp +993 -0
  441. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/Client7z.dsp +235 -0
  442. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/Client7z.dsw +29 -0
  443. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/StdAfx.cpp +3 -0
  444. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/StdAfx.h +8 -0
  445. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/makefile +28 -0
  446. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/resource.rc +3 -0
  447. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveCommandLine.cpp +1295 -0
  448. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveCommandLine.h +136 -0
  449. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp +1715 -0
  450. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveExtractCallback.h +403 -0
  451. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveName.cpp +155 -0
  452. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveName.h +10 -0
  453. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp +161 -0
  454. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveOpenCallback.h +112 -0
  455. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Bench.cpp +3618 -0
  456. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Bench.h +77 -0
  457. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/DefaultName.cpp +37 -0
  458. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/DefaultName.h +11 -0
  459. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/DirItem.h +190 -0
  460. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/EnumDirItems.cpp +1096 -0
  461. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/EnumDirItems.h +42 -0
  462. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ExitCode.h +27 -0
  463. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Extract.cpp +482 -0
  464. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Extract.h +94 -0
  465. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ExtractMode.h +34 -0
  466. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ExtractingFilePath.cpp +280 -0
  467. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ExtractingFilePath.h +31 -0
  468. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/HashCalc.cpp +347 -0
  469. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/HashCalc.h +110 -0
  470. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/IFileExtractCallback.h +114 -0
  471. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/LoadCodecs.cpp +1074 -0
  472. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/LoadCodecs.h +424 -0
  473. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/OpenArchive.cpp +3553 -0
  474. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/OpenArchive.h +436 -0
  475. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/PropIDUtils.cpp +668 -0
  476. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/PropIDUtils.h +18 -0
  477. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Property.h +14 -0
  478. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/SetProperties.cpp +80 -0
  479. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/SetProperties.h +10 -0
  480. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/SortUtils.cpp +25 -0
  481. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/SortUtils.h +10 -0
  482. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/StdAfx.h +8 -0
  483. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/TempFiles.cpp +19 -0
  484. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/TempFiles.h +16 -0
  485. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Update.cpp +1704 -0
  486. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Update.h +200 -0
  487. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateAction.cpp +64 -0
  488. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateAction.h +66 -0
  489. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateCallback.cpp +771 -0
  490. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateCallback.h +162 -0
  491. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdatePair.cpp +233 -0
  492. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdatePair.h +27 -0
  493. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateProduce.cpp +70 -0
  494. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateProduce.h +55 -0
  495. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/WorkDir.cpp +94 -0
  496. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/WorkDir.h +26 -0
  497. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ZipRegistry.h +130 -0
  498. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/BenchCon.cpp +41 -0
  499. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/BenchCon.h +14 -0
  500. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/Console.mak +43 -0
  501. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/Console.manifest +13 -0
  502. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/ConsoleClose.cpp +69 -0
  503. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/ConsoleClose.h +33 -0
  504. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/ExtractCallbackConsole.cpp +825 -0
  505. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/ExtractCallbackConsole.h +164 -0
  506. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/HashCon.cpp +367 -0
  507. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/HashCon.h +48 -0
  508. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/List.cpp +1359 -0
  509. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/List.h +27 -0
  510. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/Main.cpp +1154 -0
  511. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/MainAr.cpp +175 -0
  512. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/OpenCallbackConsole.cpp +115 -0
  513. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/OpenCallbackConsole.h +66 -0
  514. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/PercentPrinter.cpp +183 -0
  515. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/PercentPrinter.h +62 -0
  516. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/StdAfx.cpp +3 -0
  517. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/StdAfx.h +8 -0
  518. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp +702 -0
  519. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/UpdateCallbackConsole.h +124 -0
  520. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/UserInputUtils.cpp +110 -0
  521. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/UserInputUtils.h +27 -0
  522. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/makefile +64 -0
  523. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/resource.rc +7 -0
  524. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Explorer/MyMessages.cpp +37 -0
  525. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Explorer/MyMessages.h +16 -0
  526. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/BrowseDialog.cpp +1025 -0
  527. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/BrowseDialog.h +21 -0
  528. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/BrowseDialogRes.h +9 -0
  529. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ComboDialog.cpp +64 -0
  530. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ComboDialog.h +28 -0
  531. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ComboDialogRes.h +4 -0
  532. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/DialogSize.h +16 -0
  533. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ExtractCallback.cpp +1037 -0
  534. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ExtractCallback.h +328 -0
  535. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/FormatUtils.cpp +28 -0
  536. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/FormatUtils.h +14 -0
  537. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/LangUtils.h +40 -0
  538. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/MyWindowsNew.h +76 -0
  539. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.cpp +122 -0
  540. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.h +69 -0
  541. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.rc +91 -0
  542. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/OverwriteDialogRes.h +17 -0
  543. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PasswordDialog.cpp +58 -0
  544. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PasswordDialog.h +28 -0
  545. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PasswordDialog.rc +14 -0
  546. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PasswordDialogRes.h +5 -0
  547. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog.cpp +196 -0
  548. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog.h +170 -0
  549. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog.rc +12 -0
  550. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.cpp +1337 -0
  551. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.h +351 -0
  552. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.rc +40 -0
  553. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog2Res.h +48 -0
  554. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog2a.rc +80 -0
  555. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialogRes.h +3 -0
  556. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PropertyName.cpp +23 -0
  557. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PropertyName.h +10 -0
  558. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PropertyNameRes.h +95 -0
  559. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/SysIconUtils.cpp +255 -0
  560. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/SysIconUtils.h +62 -0
  561. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/resource.h +177 -0
  562. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/resourceGui.h +15 -0
  563. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/Extract.rc +59 -0
  564. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractDialog.cpp +418 -0
  565. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractDialog.h +113 -0
  566. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractDialog.rc +98 -0
  567. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractDialogRes.h +24 -0
  568. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractGUI.cpp +280 -0
  569. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractGUI.h +38 -0
  570. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractRes.h +51 -0
  571. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/HashGUI.h +27 -0
  572. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/resource2.h +2 -0
  573. package/harmony/pushy/src/main/cpp/lzma/CPP/Build.mak +156 -0
  574. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/AutoPtr.h +35 -0
  575. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/CRC.cpp +7 -0
  576. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/C_FileIO.cpp +92 -0
  577. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/C_FileIO.h +53 -0
  578. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/ComTry.h +21 -0
  579. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/CommandLineParser.cpp +197 -0
  580. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/CommandLineParser.h +63 -0
  581. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Common.h +43 -0
  582. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/CrcReg.cpp +98 -0
  583. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Defs.h +15 -0
  584. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/DynamicBuffer.h +64 -0
  585. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/IntToString.cpp +193 -0
  586. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/IntToString.h +28 -0
  587. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Lang.h +23 -0
  588. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/ListFileUtils.cpp +132 -0
  589. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/ListFileUtils.h +18 -0
  590. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyBuffer.h +259 -0
  591. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyBuffer2.h +100 -0
  592. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyCom.h +277 -0
  593. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyException.h +14 -0
  594. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyGuidDef.h +54 -0
  595. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyInitGuid.h +45 -0
  596. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyLinux.h +42 -0
  597. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyString.cpp +1659 -0
  598. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyString.h +868 -0
  599. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyTypes.h +35 -0
  600. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyUnknown.h +17 -0
  601. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyVector.cpp +3 -0
  602. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyVector.h +634 -0
  603. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyWindows.cpp +145 -0
  604. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyWindows.h +231 -0
  605. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/NewHandler.cpp +163 -0
  606. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/NewHandler.h +88 -0
  607. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Sha256Reg.cpp +40 -0
  608. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StdAfx.h +8 -0
  609. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StdInStream.cpp +89 -0
  610. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StdInStream.h +38 -0
  611. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StdOutStream.cpp +163 -0
  612. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StdOutStream.h +71 -0
  613. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StringConvert.cpp +319 -0
  614. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StringConvert.h +88 -0
  615. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StringToInt.cpp +144 -0
  616. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StringToInt.h +21 -0
  617. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/TextConfig.cpp +124 -0
  618. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/TextConfig.h +19 -0
  619. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/UTFConvert.cpp +288 -0
  620. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/UTFConvert.h +12 -0
  621. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Wildcard.cpp +676 -0
  622. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Wildcard.h +149 -0
  623. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/XzCrc64Init.cpp +7 -0
  624. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/XzCrc64Reg.cpp +42 -0
  625. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/COM.h +70 -0
  626. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/CommonDialog.cpp +185 -0
  627. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/CommonDialog.h +23 -0
  628. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ComboBox.cpp +66 -0
  629. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ComboBox.h +65 -0
  630. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/CommandBar.h +52 -0
  631. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Dialog.cpp +251 -0
  632. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Dialog.h +170 -0
  633. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Edit.h +19 -0
  634. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ImageList.cpp +10 -0
  635. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ImageList.h +87 -0
  636. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ListView.cpp +155 -0
  637. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ListView.h +146 -0
  638. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ProgressBar.h +35 -0
  639. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/PropertyPage.cpp +143 -0
  640. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/PropertyPage.h +50 -0
  641. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ReBar.h +34 -0
  642. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Static.h +28 -0
  643. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/StatusBar.h +42 -0
  644. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/StdAfx.h +8 -0
  645. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ToolBar.h +43 -0
  646. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Trackbar.h +27 -0
  647. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Window2.cpp +200 -0
  648. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Window2.h +51 -0
  649. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/DLL.cpp +109 -0
  650. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/DLL.h +58 -0
  651. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Defs.h +17 -0
  652. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/ErrorMsg.cpp +66 -0
  653. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/ErrorMsg.h +15 -0
  654. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileDir.cpp +714 -0
  655. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileDir.h +117 -0
  656. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileFind.cpp +749 -0
  657. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileFind.h +161 -0
  658. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileIO.cpp +432 -0
  659. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileIO.h +212 -0
  660. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileLink.cpp +440 -0
  661. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileMapping.cpp +12 -0
  662. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileMapping.h +66 -0
  663. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileName.cpp +839 -0
  664. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileName.h +115 -0
  665. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileSystem.cpp +131 -0
  666. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileSystem.h +27 -0
  667. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Handle.h +37 -0
  668. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/MemoryLock.cpp +112 -0
  669. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/MemoryLock.h +40 -0
  670. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/NtCheck.h +46 -0
  671. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/PropVariant.cpp +347 -0
  672. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/PropVariant.h +114 -0
  673. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/PropVariantConv.cpp +138 -0
  674. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/PropVariantConv.h +37 -0
  675. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Registry.cpp +390 -0
  676. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Registry.h +84 -0
  677. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/ResourceString.cpp +103 -0
  678. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/ResourceString.h +16 -0
  679. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/SecurityUtils.cpp +181 -0
  680. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/SecurityUtils.h +167 -0
  681. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Shell.cpp +358 -0
  682. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Shell.h +94 -0
  683. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/StdAfx.h +8 -0
  684. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Synchronization.cpp +10 -0
  685. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Synchronization.h +164 -0
  686. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/System.cpp +142 -0
  687. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/System.h +40 -0
  688. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Thread.h +38 -0
  689. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/TimeUtils.cpp +213 -0
  690. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/TimeUtils.h +32 -0
  691. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Window.cpp +179 -0
  692. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Window.h +284 -0
  693. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Common/CRC.cs +55 -0
  694. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Common/CommandLineParser.cs +274 -0
  695. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Common/InBuffer.cs +72 -0
  696. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Common/OutBuffer.cs +47 -0
  697. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LZ/IMatchFinder.cs +24 -0
  698. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LZ/LzBinTree.cs +367 -0
  699. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LZ/LzInWindow.cs +132 -0
  700. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LZ/LzOutWindow.cs +110 -0
  701. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LZMA/LzmaBase.cs +76 -0
  702. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LZMA/LzmaDecoder.cs +398 -0
  703. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LZMA/LzmaEncoder.cs +1480 -0
  704. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/LzmaAlone.cs +364 -0
  705. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/LzmaAlone.csproj +90 -0
  706. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/LzmaAlone.sln +20 -0
  707. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/LzmaBench.cs +340 -0
  708. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/Properties/AssemblyInfo.cs +29 -0
  709. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/Properties/Resources.cs +70 -0
  710. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/Properties/Settings.cs +42 -0
  711. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/RangeCoder/RangeCoder.cs +234 -0
  712. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/RangeCoder/RangeCoderBit.cs +117 -0
  713. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/RangeCoder/RangeCoderBitTree.cs +157 -0
  714. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/ICoder.cs +157 -0
  715. package/harmony/pushy/src/main/cpp/lzma/DOC/7zC.txt +187 -0
  716. package/harmony/pushy/src/main/cpp/lzma/DOC/7zFormat.txt +469 -0
  717. package/harmony/pushy/src/main/cpp/lzma/DOC/Methods.txt +173 -0
  718. package/harmony/pushy/src/main/cpp/lzma/DOC/installer.txt +166 -0
  719. package/harmony/pushy/src/main/cpp/lzma/DOC/lzma-history.txt +446 -0
  720. package/harmony/pushy/src/main/cpp/lzma/DOC/lzma-sdk.txt +357 -0
  721. package/harmony/pushy/src/main/cpp/lzma/DOC/lzma-specification.txt +1176 -0
  722. package/harmony/pushy/src/main/cpp/lzma/DOC/lzma.txt +328 -0
  723. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/CRC.java +52 -0
  724. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/LZ/BinTree.java +382 -0
  725. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/LZ/InWindow.java +131 -0
  726. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/LZ/OutWindow.java +85 -0
  727. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/LZMA/Base.java +88 -0
  728. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/LZMA/Decoder.java +329 -0
  729. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/LZMA/Encoder.java +1416 -0
  730. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/RangeCoder/BitTreeDecoder.java +55 -0
  731. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/RangeCoder/BitTreeEncoder.java +99 -0
  732. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/RangeCoder/Decoder.java +88 -0
  733. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/RangeCoder/Encoder.java +151 -0
  734. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/ICodeProgress.java +6 -0
  735. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/LzmaAlone.java +253 -0
  736. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/LzmaBench.java +392 -0
  737. package/harmony/pushy/src/main/cpp/lzma/bin/7zS2.sfx +0 -0
  738. package/harmony/pushy/src/main/cpp/lzma/bin/7zS2con.sfx +0 -0
  739. package/harmony/pushy/src/main/cpp/lzma/bin/7zSD.sfx +0 -0
  740. package/harmony/pushy/src/main/cpp/lzma/bin/7zdec.exe +0 -0
  741. package/harmony/pushy/src/main/cpp/lzma/bin/7zr.exe +0 -0
  742. package/harmony/pushy/src/main/cpp/lzma/bin/installer/config.txt +5 -0
  743. package/harmony/pushy/src/main/cpp/lzma/bin/installer/cr.bat +5 -0
  744. package/harmony/pushy/src/main/cpp/lzma/bin/lzma.exe +0 -0
  745. package/harmony/pushy/src/main/cpp/lzma/bin/x64/7zr.exe +0 -0
  746. package/package.json +1 -1
@@ -0,0 +1,2976 @@
1
+ /* LzmaEnc.c -- LZMA Encoder
2
+ 2019-01-10: Igor Pavlov : Public domain */
3
+
4
+ #include "Precomp.h"
5
+
6
+ #include <string.h>
7
+
8
+ /* #define SHOW_STAT */
9
+ /* #define SHOW_STAT2 */
10
+
11
+ #if defined(SHOW_STAT) || defined(SHOW_STAT2)
12
+ #include <stdio.h>
13
+ #endif
14
+
15
+ #include "LzmaEnc.h"
16
+
17
+ #include "LzFind.h"
18
+ #ifndef _7ZIP_ST
19
+ #include "LzFindMt.h"
20
+ #endif
21
+
22
+ #ifdef SHOW_STAT
23
+ static unsigned g_STAT_OFFSET = 0;
24
+ #endif
25
+
26
+ #define kLzmaMaxHistorySize ((UInt32)3 << 29)
27
+ /* #define kLzmaMaxHistorySize ((UInt32)7 << 29) */
28
+
29
+ #define kNumTopBits 24
30
+ #define kTopValue ((UInt32)1 << kNumTopBits)
31
+
32
+ #define kNumBitModelTotalBits 11
33
+ #define kBitModelTotal (1 << kNumBitModelTotalBits)
34
+ #define kNumMoveBits 5
35
+ #define kProbInitValue (kBitModelTotal >> 1)
36
+
37
+ #define kNumMoveReducingBits 4
38
+ #define kNumBitPriceShiftBits 4
39
+ #define kBitPrice (1 << kNumBitPriceShiftBits)
40
+
41
+ #define REP_LEN_COUNT 64
42
+
43
+ void LzmaEncProps_Init(CLzmaEncProps *p)
44
+ {
45
+ p->level = 5;
46
+ p->dictSize = p->mc = 0;
47
+ p->reduceSize = (UInt64)(Int64)-1;
48
+ p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1;
49
+ p->writeEndMark = 0;
50
+ }
51
+
52
+ void LzmaEncProps_Normalize(CLzmaEncProps *p)
53
+ {
54
+ int level = p->level;
55
+ if (level < 0) level = 5;
56
+ p->level = level;
57
+
58
+ if (p->dictSize == 0) p->dictSize = (level <= 5 ? (1 << (level * 2 + 14)) : (level <= 7 ? (1 << 25) : (1 << 26)));
59
+ if (p->dictSize > p->reduceSize)
60
+ {
61
+ unsigned i;
62
+ UInt32 reduceSize = (UInt32)p->reduceSize;
63
+ for (i = 11; i <= 30; i++)
64
+ {
65
+ if (reduceSize <= ((UInt32)2 << i)) { p->dictSize = ((UInt32)2 << i); break; }
66
+ if (reduceSize <= ((UInt32)3 << i)) { p->dictSize = ((UInt32)3 << i); break; }
67
+ }
68
+ }
69
+
70
+ if (p->lc < 0) p->lc = 3;
71
+ if (p->lp < 0) p->lp = 0;
72
+ if (p->pb < 0) p->pb = 2;
73
+
74
+ if (p->algo < 0) p->algo = (level < 5 ? 0 : 1);
75
+ if (p->fb < 0) p->fb = (level < 7 ? 32 : 64);
76
+ if (p->btMode < 0) p->btMode = (p->algo == 0 ? 0 : 1);
77
+ if (p->numHashBytes < 0) p->numHashBytes = 4;
78
+ if (p->mc == 0) p->mc = (16 + (p->fb >> 1)) >> (p->btMode ? 0 : 1);
79
+
80
+ if (p->numThreads < 0)
81
+ p->numThreads =
82
+ #ifndef _7ZIP_ST
83
+ ((p->btMode && p->algo) ? 2 : 1);
84
+ #else
85
+ 1;
86
+ #endif
87
+ }
88
+
89
+ UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2)
90
+ {
91
+ CLzmaEncProps props = *props2;
92
+ LzmaEncProps_Normalize(&props);
93
+ return props.dictSize;
94
+ }
95
+
96
+ #if (_MSC_VER >= 1400)
97
+ /* BSR code is fast for some new CPUs */
98
+ /* #define LZMA_LOG_BSR */
99
+ #endif
100
+
101
+ #ifdef LZMA_LOG_BSR
102
+
103
+ #define kDicLogSizeMaxCompress 32
104
+
105
+ #define BSR2_RET(pos, res) { unsigned long zz; _BitScanReverse(&zz, (pos)); res = (zz + zz) + ((pos >> (zz - 1)) & 1); }
106
+
107
+ static unsigned GetPosSlot1(UInt32 pos)
108
+ {
109
+ unsigned res;
110
+ BSR2_RET(pos, res);
111
+ return res;
112
+ }
113
+ #define GetPosSlot2(pos, res) { BSR2_RET(pos, res); }
114
+ #define GetPosSlot(pos, res) { if (pos < 2) res = pos; else BSR2_RET(pos, res); }
115
+
116
+ #else
117
+
118
+ #define kNumLogBits (9 + sizeof(size_t) / 2)
119
+ /* #define kNumLogBits (11 + sizeof(size_t) / 8 * 3) */
120
+
121
+ #define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7)
122
+
123
+ static void LzmaEnc_FastPosInit(Byte *g_FastPos)
124
+ {
125
+ unsigned slot;
126
+ g_FastPos[0] = 0;
127
+ g_FastPos[1] = 1;
128
+ g_FastPos += 2;
129
+
130
+ for (slot = 2; slot < kNumLogBits * 2; slot++)
131
+ {
132
+ size_t k = ((size_t)1 << ((slot >> 1) - 1));
133
+ size_t j;
134
+ for (j = 0; j < k; j++)
135
+ g_FastPos[j] = (Byte)slot;
136
+ g_FastPos += k;
137
+ }
138
+ }
139
+
140
+ /* we can use ((limit - pos) >> 31) only if (pos < ((UInt32)1 << 31)) */
141
+ /*
142
+ #define BSR2_RET(pos, res) { unsigned zz = 6 + ((kNumLogBits - 1) & \
143
+ (0 - (((((UInt32)1 << (kNumLogBits + 6)) - 1) - pos) >> 31))); \
144
+ res = p->g_FastPos[pos >> zz] + (zz * 2); }
145
+ */
146
+
147
+ /*
148
+ #define BSR2_RET(pos, res) { unsigned zz = 6 + ((kNumLogBits - 1) & \
149
+ (0 - (((((UInt32)1 << (kNumLogBits)) - 1) - (pos >> 6)) >> 31))); \
150
+ res = p->g_FastPos[pos >> zz] + (zz * 2); }
151
+ */
152
+
153
+ #define BSR2_RET(pos, res) { unsigned zz = (pos < (1 << (kNumLogBits + 6))) ? 6 : 6 + kNumLogBits - 1; \
154
+ res = p->g_FastPos[pos >> zz] + (zz * 2); }
155
+
156
+ /*
157
+ #define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \
158
+ p->g_FastPos[pos >> 6] + 12 : \
159
+ p->g_FastPos[pos >> (6 + kNumLogBits - 1)] + (6 + (kNumLogBits - 1)) * 2; }
160
+ */
161
+
162
+ #define GetPosSlot1(pos) p->g_FastPos[pos]
163
+ #define GetPosSlot2(pos, res) { BSR2_RET(pos, res); }
164
+ #define GetPosSlot(pos, res) { if (pos < kNumFullDistances) res = p->g_FastPos[pos & (kNumFullDistances - 1)]; else BSR2_RET(pos, res); }
165
+
166
+ #endif
167
+
168
+
169
+ #define LZMA_NUM_REPS 4
170
+
171
+ typedef UInt16 CState;
172
+ typedef UInt16 CExtra;
173
+
174
+ typedef struct
175
+ {
176
+ UInt32 price;
177
+ CState state;
178
+ CExtra extra;
179
+ // 0 : normal
180
+ // 1 : LIT : MATCH
181
+ // > 1 : MATCH (extra-1) : LIT : REP0 (len)
182
+ UInt32 len;
183
+ UInt32 dist;
184
+ UInt32 reps[LZMA_NUM_REPS];
185
+ } COptimal;
186
+
187
+
188
+ // 18.06
189
+ #define kNumOpts (1 << 11)
190
+ #define kPackReserve (kNumOpts * 8)
191
+ // #define kNumOpts (1 << 12)
192
+ // #define kPackReserve (1 + kNumOpts * 2)
193
+
194
+ #define kNumLenToPosStates 4
195
+ #define kNumPosSlotBits 6
196
+ #define kDicLogSizeMin 0
197
+ #define kDicLogSizeMax 32
198
+ #define kDistTableSizeMax (kDicLogSizeMax * 2)
199
+
200
+ #define kNumAlignBits 4
201
+ #define kAlignTableSize (1 << kNumAlignBits)
202
+ #define kAlignMask (kAlignTableSize - 1)
203
+
204
+ #define kStartPosModelIndex 4
205
+ #define kEndPosModelIndex 14
206
+ #define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
207
+
208
+ typedef
209
+ #ifdef _LZMA_PROB32
210
+ UInt32
211
+ #else
212
+ UInt16
213
+ #endif
214
+ CLzmaProb;
215
+
216
+ #define LZMA_PB_MAX 4
217
+ #define LZMA_LC_MAX 8
218
+ #define LZMA_LP_MAX 4
219
+
220
+ #define LZMA_NUM_PB_STATES_MAX (1 << LZMA_PB_MAX)
221
+
222
+ #define kLenNumLowBits 3
223
+ #define kLenNumLowSymbols (1 << kLenNumLowBits)
224
+ #define kLenNumHighBits 8
225
+ #define kLenNumHighSymbols (1 << kLenNumHighBits)
226
+ #define kLenNumSymbolsTotal (kLenNumLowSymbols * 2 + kLenNumHighSymbols)
227
+
228
+ #define LZMA_MATCH_LEN_MIN 2
229
+ #define LZMA_MATCH_LEN_MAX (LZMA_MATCH_LEN_MIN + kLenNumSymbolsTotal - 1)
230
+
231
+ #define kNumStates 12
232
+
233
+
234
+ typedef struct
235
+ {
236
+ CLzmaProb low[LZMA_NUM_PB_STATES_MAX << (kLenNumLowBits + 1)];
237
+ CLzmaProb high[kLenNumHighSymbols];
238
+ } CLenEnc;
239
+
240
+
241
+ typedef struct
242
+ {
243
+ unsigned tableSize;
244
+ UInt32 prices[LZMA_NUM_PB_STATES_MAX][kLenNumSymbolsTotal];
245
+ // UInt32 prices1[LZMA_NUM_PB_STATES_MAX][kLenNumLowSymbols * 2];
246
+ // UInt32 prices2[kLenNumSymbolsTotal];
247
+ } CLenPriceEnc;
248
+
249
+ #define GET_PRICE_LEN(p, posState, len) \
250
+ ((p)->prices[posState][(size_t)(len) - LZMA_MATCH_LEN_MIN])
251
+
252
+ /*
253
+ #define GET_PRICE_LEN(p, posState, len) \
254
+ ((p)->prices2[(size_t)(len) - 2] + ((p)->prices1[posState][((len) - 2) & (kLenNumLowSymbols * 2 - 1)] & (((len) - 2 - kLenNumLowSymbols * 2) >> 9)))
255
+ */
256
+
257
+ typedef struct
258
+ {
259
+ UInt32 range;
260
+ unsigned cache;
261
+ UInt64 low;
262
+ UInt64 cacheSize;
263
+ Byte *buf;
264
+ Byte *bufLim;
265
+ Byte *bufBase;
266
+ ISeqOutStream *outStream;
267
+ UInt64 processed;
268
+ SRes res;
269
+ } CRangeEnc;
270
+
271
+
272
+ typedef struct
273
+ {
274
+ CLzmaProb *litProbs;
275
+
276
+ unsigned state;
277
+ UInt32 reps[LZMA_NUM_REPS];
278
+
279
+ CLzmaProb posAlignEncoder[1 << kNumAlignBits];
280
+ CLzmaProb isRep[kNumStates];
281
+ CLzmaProb isRepG0[kNumStates];
282
+ CLzmaProb isRepG1[kNumStates];
283
+ CLzmaProb isRepG2[kNumStates];
284
+ CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX];
285
+ CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX];
286
+
287
+ CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits];
288
+ CLzmaProb posEncoders[kNumFullDistances];
289
+
290
+ CLenEnc lenProbs;
291
+ CLenEnc repLenProbs;
292
+
293
+ } CSaveState;
294
+
295
+
296
+ typedef UInt32 CProbPrice;
297
+
298
+
299
+ typedef struct
300
+ {
301
+ void *matchFinderObj;
302
+ IMatchFinder matchFinder;
303
+
304
+ unsigned optCur;
305
+ unsigned optEnd;
306
+
307
+ unsigned longestMatchLen;
308
+ unsigned numPairs;
309
+ UInt32 numAvail;
310
+
311
+ unsigned state;
312
+ unsigned numFastBytes;
313
+ unsigned additionalOffset;
314
+ UInt32 reps[LZMA_NUM_REPS];
315
+ unsigned lpMask, pbMask;
316
+ CLzmaProb *litProbs;
317
+ CRangeEnc rc;
318
+
319
+ UInt32 backRes;
320
+
321
+ unsigned lc, lp, pb;
322
+ unsigned lclp;
323
+
324
+ BoolInt fastMode;
325
+ BoolInt writeEndMark;
326
+ BoolInt finished;
327
+ BoolInt multiThread;
328
+ BoolInt needInit;
329
+ // BoolInt _maxMode;
330
+
331
+ UInt64 nowPos64;
332
+
333
+ unsigned matchPriceCount;
334
+ // unsigned alignPriceCount;
335
+ int repLenEncCounter;
336
+
337
+ unsigned distTableSize;
338
+
339
+ UInt32 dictSize;
340
+ SRes result;
341
+
342
+ #ifndef _7ZIP_ST
343
+ BoolInt mtMode;
344
+ // begin of CMatchFinderMt is used in LZ thread
345
+ CMatchFinderMt matchFinderMt;
346
+ // end of CMatchFinderMt is used in BT and HASH threads
347
+ #endif
348
+
349
+ CMatchFinder matchFinderBase;
350
+
351
+ #ifndef _7ZIP_ST
352
+ Byte pad[128];
353
+ #endif
354
+
355
+ // LZ thread
356
+ CProbPrice ProbPrices[kBitModelTotal >> kNumMoveReducingBits];
357
+
358
+ UInt32 matches[LZMA_MATCH_LEN_MAX * 2 + 2 + 1];
359
+
360
+ UInt32 alignPrices[kAlignTableSize];
361
+ UInt32 posSlotPrices[kNumLenToPosStates][kDistTableSizeMax];
362
+ UInt32 distancesPrices[kNumLenToPosStates][kNumFullDistances];
363
+
364
+ CLzmaProb posAlignEncoder[1 << kNumAlignBits];
365
+ CLzmaProb isRep[kNumStates];
366
+ CLzmaProb isRepG0[kNumStates];
367
+ CLzmaProb isRepG1[kNumStates];
368
+ CLzmaProb isRepG2[kNumStates];
369
+ CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX];
370
+ CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX];
371
+ CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits];
372
+ CLzmaProb posEncoders[kNumFullDistances];
373
+
374
+ CLenEnc lenProbs;
375
+ CLenEnc repLenProbs;
376
+
377
+ #ifndef LZMA_LOG_BSR
378
+ Byte g_FastPos[1 << kNumLogBits];
379
+ #endif
380
+
381
+ CLenPriceEnc lenEnc;
382
+ CLenPriceEnc repLenEnc;
383
+
384
+ COptimal opt[kNumOpts];
385
+
386
+ CSaveState saveState;
387
+
388
+ #ifndef _7ZIP_ST
389
+ Byte pad2[128];
390
+ #endif
391
+ } CLzmaEnc;
392
+
393
+
394
+
395
+ #define COPY_ARR(dest, src, arr) memcpy(dest->arr, src->arr, sizeof(src->arr));
396
+
397
+ void LzmaEnc_SaveState(CLzmaEncHandle pp)
398
+ {
399
+ CLzmaEnc *p = (CLzmaEnc *)pp;
400
+ CSaveState *dest = &p->saveState;
401
+
402
+ dest->state = p->state;
403
+
404
+ dest->lenProbs = p->lenProbs;
405
+ dest->repLenProbs = p->repLenProbs;
406
+
407
+ COPY_ARR(dest, p, reps);
408
+
409
+ COPY_ARR(dest, p, posAlignEncoder);
410
+ COPY_ARR(dest, p, isRep);
411
+ COPY_ARR(dest, p, isRepG0);
412
+ COPY_ARR(dest, p, isRepG1);
413
+ COPY_ARR(dest, p, isRepG2);
414
+ COPY_ARR(dest, p, isMatch);
415
+ COPY_ARR(dest, p, isRep0Long);
416
+ COPY_ARR(dest, p, posSlotEncoder);
417
+ COPY_ARR(dest, p, posEncoders);
418
+
419
+ memcpy(dest->litProbs, p->litProbs, ((UInt32)0x300 << p->lclp) * sizeof(CLzmaProb));
420
+ }
421
+
422
+
423
+ void LzmaEnc_RestoreState(CLzmaEncHandle pp)
424
+ {
425
+ CLzmaEnc *dest = (CLzmaEnc *)pp;
426
+ const CSaveState *p = &dest->saveState;
427
+
428
+ dest->state = p->state;
429
+
430
+ dest->lenProbs = p->lenProbs;
431
+ dest->repLenProbs = p->repLenProbs;
432
+
433
+ COPY_ARR(dest, p, reps);
434
+
435
+ COPY_ARR(dest, p, posAlignEncoder);
436
+ COPY_ARR(dest, p, isRep);
437
+ COPY_ARR(dest, p, isRepG0);
438
+ COPY_ARR(dest, p, isRepG1);
439
+ COPY_ARR(dest, p, isRepG2);
440
+ COPY_ARR(dest, p, isMatch);
441
+ COPY_ARR(dest, p, isRep0Long);
442
+ COPY_ARR(dest, p, posSlotEncoder);
443
+ COPY_ARR(dest, p, posEncoders);
444
+
445
+ memcpy(dest->litProbs, p->litProbs, ((UInt32)0x300 << dest->lclp) * sizeof(CLzmaProb));
446
+ }
447
+
448
+
449
+
450
+ SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2)
451
+ {
452
+ CLzmaEnc *p = (CLzmaEnc *)pp;
453
+ CLzmaEncProps props = *props2;
454
+ LzmaEncProps_Normalize(&props);
455
+
456
+ if (props.lc > LZMA_LC_MAX
457
+ || props.lp > LZMA_LP_MAX
458
+ || props.pb > LZMA_PB_MAX
459
+ || props.dictSize > ((UInt64)1 << kDicLogSizeMaxCompress)
460
+ || props.dictSize > kLzmaMaxHistorySize)
461
+ return SZ_ERROR_PARAM;
462
+
463
+ p->dictSize = props.dictSize;
464
+ {
465
+ unsigned fb = props.fb;
466
+ if (fb < 5)
467
+ fb = 5;
468
+ if (fb > LZMA_MATCH_LEN_MAX)
469
+ fb = LZMA_MATCH_LEN_MAX;
470
+ p->numFastBytes = fb;
471
+ }
472
+ p->lc = props.lc;
473
+ p->lp = props.lp;
474
+ p->pb = props.pb;
475
+ p->fastMode = (props.algo == 0);
476
+ // p->_maxMode = True;
477
+ p->matchFinderBase.btMode = (Byte)(props.btMode ? 1 : 0);
478
+ {
479
+ unsigned numHashBytes = 4;
480
+ if (props.btMode)
481
+ {
482
+ if (props.numHashBytes < 2)
483
+ numHashBytes = 2;
484
+ else if (props.numHashBytes < 4)
485
+ numHashBytes = props.numHashBytes;
486
+ }
487
+ p->matchFinderBase.numHashBytes = numHashBytes;
488
+ }
489
+
490
+ p->matchFinderBase.cutValue = props.mc;
491
+
492
+ p->writeEndMark = props.writeEndMark;
493
+
494
+ #ifndef _7ZIP_ST
495
+ /*
496
+ if (newMultiThread != _multiThread)
497
+ {
498
+ ReleaseMatchFinder();
499
+ _multiThread = newMultiThread;
500
+ }
501
+ */
502
+ p->multiThread = (props.numThreads > 1);
503
+ #endif
504
+
505
+ return SZ_OK;
506
+ }
507
+
508
+
509
+ void LzmaEnc_SetDataSize(CLzmaEncHandle pp, UInt64 expectedDataSiize)
510
+ {
511
+ CLzmaEnc *p = (CLzmaEnc *)pp;
512
+ p->matchFinderBase.expectedDataSize = expectedDataSiize;
513
+ }
514
+
515
+
516
+ #define kState_Start 0
517
+ #define kState_LitAfterMatch 4
518
+ #define kState_LitAfterRep 5
519
+ #define kState_MatchAfterLit 7
520
+ #define kState_RepAfterLit 8
521
+
522
+ static const Byte kLiteralNextStates[kNumStates] = {0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5};
523
+ static const Byte kMatchNextStates[kNumStates] = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10};
524
+ static const Byte kRepNextStates[kNumStates] = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11};
525
+ static const Byte kShortRepNextStates[kNumStates]= {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11};
526
+
527
+ #define IsLitState(s) ((s) < 7)
528
+ #define GetLenToPosState2(len) (((len) < kNumLenToPosStates - 1) ? (len) : kNumLenToPosStates - 1)
529
+ #define GetLenToPosState(len) (((len) < kNumLenToPosStates + 1) ? (len) - 2 : kNumLenToPosStates - 1)
530
+
531
+ #define kInfinityPrice (1 << 30)
532
+
533
+ static void RangeEnc_Construct(CRangeEnc *p)
534
+ {
535
+ p->outStream = NULL;
536
+ p->bufBase = NULL;
537
+ }
538
+
539
+ #define RangeEnc_GetProcessed(p) ((p)->processed + ((p)->buf - (p)->bufBase) + (p)->cacheSize)
540
+ #define RangeEnc_GetProcessed_sizet(p) ((size_t)(p)->processed + ((p)->buf - (p)->bufBase) + (size_t)(p)->cacheSize)
541
+
542
+ #define RC_BUF_SIZE (1 << 16)
543
+
544
+ static int RangeEnc_Alloc(CRangeEnc *p, ISzAllocPtr alloc)
545
+ {
546
+ if (!p->bufBase)
547
+ {
548
+ p->bufBase = (Byte *)ISzAlloc_Alloc(alloc, RC_BUF_SIZE);
549
+ if (!p->bufBase)
550
+ return 0;
551
+ p->bufLim = p->bufBase + RC_BUF_SIZE;
552
+ }
553
+ return 1;
554
+ }
555
+
556
+ static void RangeEnc_Free(CRangeEnc *p, ISzAllocPtr alloc)
557
+ {
558
+ ISzAlloc_Free(alloc, p->bufBase);
559
+ p->bufBase = 0;
560
+ }
561
+
562
+ static void RangeEnc_Init(CRangeEnc *p)
563
+ {
564
+ /* Stream.Init(); */
565
+ p->range = 0xFFFFFFFF;
566
+ p->cache = 0;
567
+ p->low = 0;
568
+ p->cacheSize = 0;
569
+
570
+ p->buf = p->bufBase;
571
+
572
+ p->processed = 0;
573
+ p->res = SZ_OK;
574
+ }
575
+
576
+ MY_NO_INLINE static void RangeEnc_FlushStream(CRangeEnc *p)
577
+ {
578
+ size_t num;
579
+ if (p->res != SZ_OK)
580
+ return;
581
+ num = p->buf - p->bufBase;
582
+ if (num != ISeqOutStream_Write(p->outStream, p->bufBase, num))
583
+ p->res = SZ_ERROR_WRITE;
584
+ p->processed += num;
585
+ p->buf = p->bufBase;
586
+ }
587
+
588
+ MY_NO_INLINE static void MY_FAST_CALL RangeEnc_ShiftLow(CRangeEnc *p)
589
+ {
590
+ UInt32 low = (UInt32)p->low;
591
+ unsigned high = (unsigned)(p->low >> 32);
592
+ p->low = (UInt32)(low << 8);
593
+ if (low < (UInt32)0xFF000000 || high != 0)
594
+ {
595
+ {
596
+ Byte *buf = p->buf;
597
+ *buf++ = (Byte)(p->cache + high);
598
+ p->cache = (unsigned)(low >> 24);
599
+ p->buf = buf;
600
+ if (buf == p->bufLim)
601
+ RangeEnc_FlushStream(p);
602
+ if (p->cacheSize == 0)
603
+ return;
604
+ }
605
+ high += 0xFF;
606
+ for (;;)
607
+ {
608
+ Byte *buf = p->buf;
609
+ *buf++ = (Byte)(high);
610
+ p->buf = buf;
611
+ if (buf == p->bufLim)
612
+ RangeEnc_FlushStream(p);
613
+ if (--p->cacheSize == 0)
614
+ return;
615
+ }
616
+ }
617
+ p->cacheSize++;
618
+ }
619
+
620
+ static void RangeEnc_FlushData(CRangeEnc *p)
621
+ {
622
+ int i;
623
+ for (i = 0; i < 5; i++)
624
+ RangeEnc_ShiftLow(p);
625
+ }
626
+
627
+ #define RC_NORM(p) if (range < kTopValue) { range <<= 8; RangeEnc_ShiftLow(p); }
628
+
629
+ #define RC_BIT_PRE(p, prob) \
630
+ ttt = *(prob); \
631
+ newBound = (range >> kNumBitModelTotalBits) * ttt;
632
+
633
+ // #define _LZMA_ENC_USE_BRANCH
634
+
635
+ #ifdef _LZMA_ENC_USE_BRANCH
636
+
637
+ #define RC_BIT(p, prob, bit) { \
638
+ RC_BIT_PRE(p, prob) \
639
+ if (bit == 0) { range = newBound; ttt += (kBitModelTotal - ttt) >> kNumMoveBits; } \
640
+ else { (p)->low += newBound; range -= newBound; ttt -= ttt >> kNumMoveBits; } \
641
+ *(prob) = (CLzmaProb)ttt; \
642
+ RC_NORM(p) \
643
+ }
644
+
645
+ #else
646
+
647
+ #define RC_BIT(p, prob, bit) { \
648
+ UInt32 mask; \
649
+ RC_BIT_PRE(p, prob) \
650
+ mask = 0 - (UInt32)bit; \
651
+ range &= mask; \
652
+ mask &= newBound; \
653
+ range -= mask; \
654
+ (p)->low += mask; \
655
+ mask = (UInt32)bit - 1; \
656
+ range += newBound & mask; \
657
+ mask &= (kBitModelTotal - ((1 << kNumMoveBits) - 1)); \
658
+ mask += ((1 << kNumMoveBits) - 1); \
659
+ ttt += (Int32)(mask - ttt) >> kNumMoveBits; \
660
+ *(prob) = (CLzmaProb)ttt; \
661
+ RC_NORM(p) \
662
+ }
663
+
664
+ #endif
665
+
666
+
667
+
668
+
669
+ #define RC_BIT_0_BASE(p, prob) \
670
+ range = newBound; *(prob) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits));
671
+
672
+ #define RC_BIT_1_BASE(p, prob) \
673
+ range -= newBound; (p)->low += newBound; *(prob) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits)); \
674
+
675
+ #define RC_BIT_0(p, prob) \
676
+ RC_BIT_0_BASE(p, prob) \
677
+ RC_NORM(p)
678
+
679
+ #define RC_BIT_1(p, prob) \
680
+ RC_BIT_1_BASE(p, prob) \
681
+ RC_NORM(p)
682
+
683
+ static void RangeEnc_EncodeBit_0(CRangeEnc *p, CLzmaProb *prob)
684
+ {
685
+ UInt32 range, ttt, newBound;
686
+ range = p->range;
687
+ RC_BIT_PRE(p, prob)
688
+ RC_BIT_0(p, prob)
689
+ p->range = range;
690
+ }
691
+
692
+ static void LitEnc_Encode(CRangeEnc *p, CLzmaProb *probs, UInt32 sym)
693
+ {
694
+ UInt32 range = p->range;
695
+ sym |= 0x100;
696
+ do
697
+ {
698
+ UInt32 ttt, newBound;
699
+ // RangeEnc_EncodeBit(p, probs + (sym >> 8), (sym >> 7) & 1);
700
+ CLzmaProb *prob = probs + (sym >> 8);
701
+ UInt32 bit = (sym >> 7) & 1;
702
+ sym <<= 1;
703
+ RC_BIT(p, prob, bit);
704
+ }
705
+ while (sym < 0x10000);
706
+ p->range = range;
707
+ }
708
+
709
+ static void LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, UInt32 sym, UInt32 matchByte)
710
+ {
711
+ UInt32 range = p->range;
712
+ UInt32 offs = 0x100;
713
+ sym |= 0x100;
714
+ do
715
+ {
716
+ UInt32 ttt, newBound;
717
+ CLzmaProb *prob;
718
+ UInt32 bit;
719
+ matchByte <<= 1;
720
+ // RangeEnc_EncodeBit(p, probs + (offs + (matchByte & offs) + (sym >> 8)), (sym >> 7) & 1);
721
+ prob = probs + (offs + (matchByte & offs) + (sym >> 8));
722
+ bit = (sym >> 7) & 1;
723
+ sym <<= 1;
724
+ offs &= ~(matchByte ^ sym);
725
+ RC_BIT(p, prob, bit);
726
+ }
727
+ while (sym < 0x10000);
728
+ p->range = range;
729
+ }
730
+
731
+
732
+
733
+ static void LzmaEnc_InitPriceTables(CProbPrice *ProbPrices)
734
+ {
735
+ UInt32 i;
736
+ for (i = 0; i < (kBitModelTotal >> kNumMoveReducingBits); i++)
737
+ {
738
+ const unsigned kCyclesBits = kNumBitPriceShiftBits;
739
+ UInt32 w = (i << kNumMoveReducingBits) + (1 << (kNumMoveReducingBits - 1));
740
+ unsigned bitCount = 0;
741
+ unsigned j;
742
+ for (j = 0; j < kCyclesBits; j++)
743
+ {
744
+ w = w * w;
745
+ bitCount <<= 1;
746
+ while (w >= ((UInt32)1 << 16))
747
+ {
748
+ w >>= 1;
749
+ bitCount++;
750
+ }
751
+ }
752
+ ProbPrices[i] = (CProbPrice)((kNumBitModelTotalBits << kCyclesBits) - 15 - bitCount);
753
+ // printf("\n%3d: %5d", i, ProbPrices[i]);
754
+ }
755
+ }
756
+
757
+
758
+ #define GET_PRICE(prob, bit) \
759
+ p->ProbPrices[((prob) ^ (unsigned)(((-(int)(bit))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits];
760
+
761
+ #define GET_PRICEa(prob, bit) \
762
+ ProbPrices[((prob) ^ (unsigned)((-((int)(bit))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits];
763
+
764
+ #define GET_PRICE_0(prob) p->ProbPrices[(prob) >> kNumMoveReducingBits]
765
+ #define GET_PRICE_1(prob) p->ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits]
766
+
767
+ #define GET_PRICEa_0(prob) ProbPrices[(prob) >> kNumMoveReducingBits]
768
+ #define GET_PRICEa_1(prob) ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits]
769
+
770
+
771
+ static UInt32 LitEnc_GetPrice(const CLzmaProb *probs, UInt32 sym, const CProbPrice *ProbPrices)
772
+ {
773
+ UInt32 price = 0;
774
+ sym |= 0x100;
775
+ do
776
+ {
777
+ unsigned bit = sym & 1;
778
+ sym >>= 1;
779
+ price += GET_PRICEa(probs[sym], bit);
780
+ }
781
+ while (sym >= 2);
782
+ return price;
783
+ }
784
+
785
+
786
+ static UInt32 LitEnc_Matched_GetPrice(const CLzmaProb *probs, UInt32 sym, UInt32 matchByte, const CProbPrice *ProbPrices)
787
+ {
788
+ UInt32 price = 0;
789
+ UInt32 offs = 0x100;
790
+ sym |= 0x100;
791
+ do
792
+ {
793
+ matchByte <<= 1;
794
+ price += GET_PRICEa(probs[offs + (matchByte & offs) + (sym >> 8)], (sym >> 7) & 1);
795
+ sym <<= 1;
796
+ offs &= ~(matchByte ^ sym);
797
+ }
798
+ while (sym < 0x10000);
799
+ return price;
800
+ }
801
+
802
+
803
+ static void RcTree_ReverseEncode(CRangeEnc *rc, CLzmaProb *probs, unsigned numBits, unsigned sym)
804
+ {
805
+ UInt32 range = rc->range;
806
+ unsigned m = 1;
807
+ do
808
+ {
809
+ UInt32 ttt, newBound;
810
+ unsigned bit = sym & 1;
811
+ // RangeEnc_EncodeBit(rc, probs + m, bit);
812
+ sym >>= 1;
813
+ RC_BIT(rc, probs + m, bit);
814
+ m = (m << 1) | bit;
815
+ }
816
+ while (--numBits);
817
+ rc->range = range;
818
+ }
819
+
820
+
821
+
822
+ static void LenEnc_Init(CLenEnc *p)
823
+ {
824
+ unsigned i;
825
+ for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << (kLenNumLowBits + 1)); i++)
826
+ p->low[i] = kProbInitValue;
827
+ for (i = 0; i < kLenNumHighSymbols; i++)
828
+ p->high[i] = kProbInitValue;
829
+ }
830
+
831
+ static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, unsigned sym, unsigned posState)
832
+ {
833
+ UInt32 range, ttt, newBound;
834
+ CLzmaProb *probs = p->low;
835
+ range = rc->range;
836
+ RC_BIT_PRE(rc, probs);
837
+ if (sym >= kLenNumLowSymbols)
838
+ {
839
+ RC_BIT_1(rc, probs);
840
+ probs += kLenNumLowSymbols;
841
+ RC_BIT_PRE(rc, probs);
842
+ if (sym >= kLenNumLowSymbols * 2)
843
+ {
844
+ RC_BIT_1(rc, probs);
845
+ rc->range = range;
846
+ // RcTree_Encode(rc, p->high, kLenNumHighBits, sym - kLenNumLowSymbols * 2);
847
+ LitEnc_Encode(rc, p->high, sym - kLenNumLowSymbols * 2);
848
+ return;
849
+ }
850
+ sym -= kLenNumLowSymbols;
851
+ }
852
+
853
+ // RcTree_Encode(rc, probs + (posState << kLenNumLowBits), kLenNumLowBits, sym);
854
+ {
855
+ unsigned m;
856
+ unsigned bit;
857
+ RC_BIT_0(rc, probs);
858
+ probs += (posState << (1 + kLenNumLowBits));
859
+ bit = (sym >> 2) ; RC_BIT(rc, probs + 1, bit); m = (1 << 1) + bit;
860
+ bit = (sym >> 1) & 1; RC_BIT(rc, probs + m, bit); m = (m << 1) + bit;
861
+ bit = sym & 1; RC_BIT(rc, probs + m, bit);
862
+ rc->range = range;
863
+ }
864
+ }
865
+
866
+ static void SetPrices_3(const CLzmaProb *probs, UInt32 startPrice, UInt32 *prices, const CProbPrice *ProbPrices)
867
+ {
868
+ unsigned i;
869
+ for (i = 0; i < 8; i += 2)
870
+ {
871
+ UInt32 price = startPrice;
872
+ UInt32 prob;
873
+ price += GET_PRICEa(probs[1 ], (i >> 2));
874
+ price += GET_PRICEa(probs[2 + (i >> 2)], (i >> 1) & 1);
875
+ prob = probs[4 + (i >> 1)];
876
+ prices[i ] = price + GET_PRICEa_0(prob);
877
+ prices[i + 1] = price + GET_PRICEa_1(prob);
878
+ }
879
+ }
880
+
881
+
882
+ MY_NO_INLINE static void MY_FAST_CALL LenPriceEnc_UpdateTables(
883
+ CLenPriceEnc *p,
884
+ unsigned numPosStates,
885
+ const CLenEnc *enc,
886
+ const CProbPrice *ProbPrices)
887
+ {
888
+ UInt32 b;
889
+
890
+ {
891
+ unsigned prob = enc->low[0];
892
+ UInt32 a, c;
893
+ unsigned posState;
894
+ b = GET_PRICEa_1(prob);
895
+ a = GET_PRICEa_0(prob);
896
+ c = b + GET_PRICEa_0(enc->low[kLenNumLowSymbols]);
897
+ for (posState = 0; posState < numPosStates; posState++)
898
+ {
899
+ UInt32 *prices = p->prices[posState];
900
+ const CLzmaProb *probs = enc->low + (posState << (1 + kLenNumLowBits));
901
+ SetPrices_3(probs, a, prices, ProbPrices);
902
+ SetPrices_3(probs + kLenNumLowSymbols, c, prices + kLenNumLowSymbols, ProbPrices);
903
+ }
904
+ }
905
+
906
+ /*
907
+ {
908
+ unsigned i;
909
+ UInt32 b;
910
+ a = GET_PRICEa_0(enc->low[0]);
911
+ for (i = 0; i < kLenNumLowSymbols; i++)
912
+ p->prices2[i] = a;
913
+ a = GET_PRICEa_1(enc->low[0]);
914
+ b = a + GET_PRICEa_0(enc->low[kLenNumLowSymbols]);
915
+ for (i = kLenNumLowSymbols; i < kLenNumLowSymbols * 2; i++)
916
+ p->prices2[i] = b;
917
+ a += GET_PRICEa_1(enc->low[kLenNumLowSymbols]);
918
+ }
919
+ */
920
+
921
+ // p->counter = numSymbols;
922
+ // p->counter = 64;
923
+
924
+ {
925
+ unsigned i = p->tableSize;
926
+
927
+ if (i > kLenNumLowSymbols * 2)
928
+ {
929
+ const CLzmaProb *probs = enc->high;
930
+ UInt32 *prices = p->prices[0] + kLenNumLowSymbols * 2;
931
+ i -= kLenNumLowSymbols * 2 - 1;
932
+ i >>= 1;
933
+ b += GET_PRICEa_1(enc->low[kLenNumLowSymbols]);
934
+ do
935
+ {
936
+ /*
937
+ p->prices2[i] = a +
938
+ // RcTree_GetPrice(enc->high, kLenNumHighBits, i - kLenNumLowSymbols * 2, ProbPrices);
939
+ LitEnc_GetPrice(probs, i - kLenNumLowSymbols * 2, ProbPrices);
940
+ */
941
+ // UInt32 price = a + RcTree_GetPrice(probs, kLenNumHighBits - 1, sym, ProbPrices);
942
+ unsigned sym = --i + (1 << (kLenNumHighBits - 1));
943
+ UInt32 price = b;
944
+ do
945
+ {
946
+ unsigned bit = sym & 1;
947
+ sym >>= 1;
948
+ price += GET_PRICEa(probs[sym], bit);
949
+ }
950
+ while (sym >= 2);
951
+
952
+ {
953
+ unsigned prob = probs[(size_t)i + (1 << (kLenNumHighBits - 1))];
954
+ prices[(size_t)i * 2 ] = price + GET_PRICEa_0(prob);
955
+ prices[(size_t)i * 2 + 1] = price + GET_PRICEa_1(prob);
956
+ }
957
+ }
958
+ while (i);
959
+
960
+ {
961
+ unsigned posState;
962
+ size_t num = (p->tableSize - kLenNumLowSymbols * 2) * sizeof(p->prices[0][0]);
963
+ for (posState = 1; posState < numPosStates; posState++)
964
+ memcpy(p->prices[posState] + kLenNumLowSymbols * 2, p->prices[0] + kLenNumLowSymbols * 2, num);
965
+ }
966
+ }
967
+ }
968
+ }
969
+
970
+ /*
971
+ #ifdef SHOW_STAT
972
+ g_STAT_OFFSET += num;
973
+ printf("\n MovePos %u", num);
974
+ #endif
975
+ */
976
+
977
+ #define MOVE_POS(p, num) { \
978
+ p->additionalOffset += (num); \
979
+ p->matchFinder.Skip(p->matchFinderObj, (UInt32)(num)); }
980
+
981
+
982
+ static unsigned ReadMatchDistances(CLzmaEnc *p, unsigned *numPairsRes)
983
+ {
984
+ unsigned numPairs;
985
+
986
+ p->additionalOffset++;
987
+ p->numAvail = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
988
+ numPairs = p->matchFinder.GetMatches(p->matchFinderObj, p->matches);
989
+ *numPairsRes = numPairs;
990
+
991
+ #ifdef SHOW_STAT
992
+ printf("\n i = %u numPairs = %u ", g_STAT_OFFSET, numPairs / 2);
993
+ g_STAT_OFFSET++;
994
+ {
995
+ unsigned i;
996
+ for (i = 0; i < numPairs; i += 2)
997
+ printf("%2u %6u | ", p->matches[i], p->matches[i + 1]);
998
+ }
999
+ #endif
1000
+
1001
+ if (numPairs == 0)
1002
+ return 0;
1003
+ {
1004
+ unsigned len = p->matches[(size_t)numPairs - 2];
1005
+ if (len != p->numFastBytes)
1006
+ return len;
1007
+ {
1008
+ UInt32 numAvail = p->numAvail;
1009
+ if (numAvail > LZMA_MATCH_LEN_MAX)
1010
+ numAvail = LZMA_MATCH_LEN_MAX;
1011
+ {
1012
+ const Byte *p1 = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
1013
+ const Byte *p2 = p1 + len;
1014
+ ptrdiff_t dif = (ptrdiff_t)-1 - p->matches[(size_t)numPairs - 1];
1015
+ const Byte *lim = p1 + numAvail;
1016
+ for (; p2 != lim && *p2 == p2[dif]; p2++)
1017
+ {}
1018
+ return (unsigned)(p2 - p1);
1019
+ }
1020
+ }
1021
+ }
1022
+ }
1023
+
1024
+ #define MARK_LIT ((UInt32)(Int32)-1)
1025
+
1026
+ #define MakeAs_Lit(p) { (p)->dist = MARK_LIT; (p)->extra = 0; }
1027
+ #define MakeAs_ShortRep(p) { (p)->dist = 0; (p)->extra = 0; }
1028
+ #define IsShortRep(p) ((p)->dist == 0)
1029
+
1030
+
1031
+ #define GetPrice_ShortRep(p, state, posState) \
1032
+ ( GET_PRICE_0(p->isRepG0[state]) + GET_PRICE_0(p->isRep0Long[state][posState]))
1033
+
1034
+ #define GetPrice_Rep_0(p, state, posState) ( \
1035
+ GET_PRICE_1(p->isMatch[state][posState]) \
1036
+ + GET_PRICE_1(p->isRep0Long[state][posState])) \
1037
+ + GET_PRICE_1(p->isRep[state]) \
1038
+ + GET_PRICE_0(p->isRepG0[state])
1039
+
1040
+ MY_FORCE_INLINE
1041
+ static UInt32 GetPrice_PureRep(const CLzmaEnc *p, unsigned repIndex, size_t state, size_t posState)
1042
+ {
1043
+ UInt32 price;
1044
+ UInt32 prob = p->isRepG0[state];
1045
+ if (repIndex == 0)
1046
+ {
1047
+ price = GET_PRICE_0(prob);
1048
+ price += GET_PRICE_1(p->isRep0Long[state][posState]);
1049
+ }
1050
+ else
1051
+ {
1052
+ price = GET_PRICE_1(prob);
1053
+ prob = p->isRepG1[state];
1054
+ if (repIndex == 1)
1055
+ price += GET_PRICE_0(prob);
1056
+ else
1057
+ {
1058
+ price += GET_PRICE_1(prob);
1059
+ price += GET_PRICE(p->isRepG2[state], repIndex - 2);
1060
+ }
1061
+ }
1062
+ return price;
1063
+ }
1064
+
1065
+
1066
+ static unsigned Backward(CLzmaEnc *p, unsigned cur)
1067
+ {
1068
+ unsigned wr = cur + 1;
1069
+ p->optEnd = wr;
1070
+
1071
+ for (;;)
1072
+ {
1073
+ UInt32 dist = p->opt[cur].dist;
1074
+ unsigned len = (unsigned)p->opt[cur].len;
1075
+ unsigned extra = (unsigned)p->opt[cur].extra;
1076
+ cur -= len;
1077
+
1078
+ if (extra)
1079
+ {
1080
+ wr--;
1081
+ p->opt[wr].len = (UInt32)len;
1082
+ cur -= extra;
1083
+ len = extra;
1084
+ if (extra == 1)
1085
+ {
1086
+ p->opt[wr].dist = dist;
1087
+ dist = MARK_LIT;
1088
+ }
1089
+ else
1090
+ {
1091
+ p->opt[wr].dist = 0;
1092
+ len--;
1093
+ wr--;
1094
+ p->opt[wr].dist = MARK_LIT;
1095
+ p->opt[wr].len = 1;
1096
+ }
1097
+ }
1098
+
1099
+ if (cur == 0)
1100
+ {
1101
+ p->backRes = dist;
1102
+ p->optCur = wr;
1103
+ return len;
1104
+ }
1105
+
1106
+ wr--;
1107
+ p->opt[wr].dist = dist;
1108
+ p->opt[wr].len = (UInt32)len;
1109
+ }
1110
+ }
1111
+
1112
+
1113
+
1114
+ #define LIT_PROBS(pos, prevByte) \
1115
+ (p->litProbs + (UInt32)3 * (((((pos) << 8) + (prevByte)) & p->lpMask) << p->lc))
1116
+
1117
+
1118
+ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position)
1119
+ {
1120
+ unsigned last, cur;
1121
+ UInt32 reps[LZMA_NUM_REPS];
1122
+ unsigned repLens[LZMA_NUM_REPS];
1123
+ UInt32 *matches;
1124
+
1125
+ {
1126
+ UInt32 numAvail;
1127
+ unsigned numPairs, mainLen, repMaxIndex, i, posState;
1128
+ UInt32 matchPrice, repMatchPrice;
1129
+ const Byte *data;
1130
+ Byte curByte, matchByte;
1131
+
1132
+ p->optCur = p->optEnd = 0;
1133
+
1134
+ if (p->additionalOffset == 0)
1135
+ mainLen = ReadMatchDistances(p, &numPairs);
1136
+ else
1137
+ {
1138
+ mainLen = p->longestMatchLen;
1139
+ numPairs = p->numPairs;
1140
+ }
1141
+
1142
+ numAvail = p->numAvail;
1143
+ if (numAvail < 2)
1144
+ {
1145
+ p->backRes = MARK_LIT;
1146
+ return 1;
1147
+ }
1148
+ if (numAvail > LZMA_MATCH_LEN_MAX)
1149
+ numAvail = LZMA_MATCH_LEN_MAX;
1150
+
1151
+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
1152
+ repMaxIndex = 0;
1153
+
1154
+ for (i = 0; i < LZMA_NUM_REPS; i++)
1155
+ {
1156
+ unsigned len;
1157
+ const Byte *data2;
1158
+ reps[i] = p->reps[i];
1159
+ data2 = data - reps[i];
1160
+ if (data[0] != data2[0] || data[1] != data2[1])
1161
+ {
1162
+ repLens[i] = 0;
1163
+ continue;
1164
+ }
1165
+ for (len = 2; len < numAvail && data[len] == data2[len]; len++)
1166
+ {}
1167
+ repLens[i] = len;
1168
+ if (len > repLens[repMaxIndex])
1169
+ repMaxIndex = i;
1170
+ }
1171
+
1172
+ if (repLens[repMaxIndex] >= p->numFastBytes)
1173
+ {
1174
+ unsigned len;
1175
+ p->backRes = (UInt32)repMaxIndex;
1176
+ len = repLens[repMaxIndex];
1177
+ MOVE_POS(p, len - 1)
1178
+ return len;
1179
+ }
1180
+
1181
+ matches = p->matches;
1182
+
1183
+ if (mainLen >= p->numFastBytes)
1184
+ {
1185
+ p->backRes = matches[(size_t)numPairs - 1] + LZMA_NUM_REPS;
1186
+ MOVE_POS(p, mainLen - 1)
1187
+ return mainLen;
1188
+ }
1189
+
1190
+ curByte = *data;
1191
+ matchByte = *(data - reps[0]);
1192
+
1193
+ last = repLens[repMaxIndex];
1194
+ if (last <= mainLen)
1195
+ last = mainLen;
1196
+
1197
+ if (last < 2 && curByte != matchByte)
1198
+ {
1199
+ p->backRes = MARK_LIT;
1200
+ return 1;
1201
+ }
1202
+
1203
+ p->opt[0].state = (CState)p->state;
1204
+
1205
+ posState = (position & p->pbMask);
1206
+
1207
+ {
1208
+ const CLzmaProb *probs = LIT_PROBS(position, *(data - 1));
1209
+ p->opt[1].price = GET_PRICE_0(p->isMatch[p->state][posState]) +
1210
+ (!IsLitState(p->state) ?
1211
+ LitEnc_Matched_GetPrice(probs, curByte, matchByte, p->ProbPrices) :
1212
+ LitEnc_GetPrice(probs, curByte, p->ProbPrices));
1213
+ }
1214
+
1215
+ MakeAs_Lit(&p->opt[1]);
1216
+
1217
+ matchPrice = GET_PRICE_1(p->isMatch[p->state][posState]);
1218
+ repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[p->state]);
1219
+
1220
+ // 18.06
1221
+ if (matchByte == curByte && repLens[0] == 0)
1222
+ {
1223
+ UInt32 shortRepPrice = repMatchPrice + GetPrice_ShortRep(p, p->state, posState);
1224
+ if (shortRepPrice < p->opt[1].price)
1225
+ {
1226
+ p->opt[1].price = shortRepPrice;
1227
+ MakeAs_ShortRep(&p->opt[1]);
1228
+ }
1229
+ if (last < 2)
1230
+ {
1231
+ p->backRes = p->opt[1].dist;
1232
+ return 1;
1233
+ }
1234
+ }
1235
+
1236
+ p->opt[1].len = 1;
1237
+
1238
+ p->opt[0].reps[0] = reps[0];
1239
+ p->opt[0].reps[1] = reps[1];
1240
+ p->opt[0].reps[2] = reps[2];
1241
+ p->opt[0].reps[3] = reps[3];
1242
+
1243
+ // ---------- REP ----------
1244
+
1245
+ for (i = 0; i < LZMA_NUM_REPS; i++)
1246
+ {
1247
+ unsigned repLen = repLens[i];
1248
+ UInt32 price;
1249
+ if (repLen < 2)
1250
+ continue;
1251
+ price = repMatchPrice + GetPrice_PureRep(p, i, p->state, posState);
1252
+ do
1253
+ {
1254
+ UInt32 price2 = price + GET_PRICE_LEN(&p->repLenEnc, posState, repLen);
1255
+ COptimal *opt = &p->opt[repLen];
1256
+ if (price2 < opt->price)
1257
+ {
1258
+ opt->price = price2;
1259
+ opt->len = (UInt32)repLen;
1260
+ opt->dist = (UInt32)i;
1261
+ opt->extra = 0;
1262
+ }
1263
+ }
1264
+ while (--repLen >= 2);
1265
+ }
1266
+
1267
+
1268
+ // ---------- MATCH ----------
1269
+ {
1270
+ unsigned len = repLens[0] + 1;
1271
+ if (len <= mainLen)
1272
+ {
1273
+ unsigned offs = 0;
1274
+ UInt32 normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[p->state]);
1275
+
1276
+ if (len < 2)
1277
+ len = 2;
1278
+ else
1279
+ while (len > matches[offs])
1280
+ offs += 2;
1281
+
1282
+ for (; ; len++)
1283
+ {
1284
+ COptimal *opt;
1285
+ UInt32 dist = matches[(size_t)offs + 1];
1286
+ UInt32 price = normalMatchPrice + GET_PRICE_LEN(&p->lenEnc, posState, len);
1287
+ unsigned lenToPosState = GetLenToPosState(len);
1288
+
1289
+ if (dist < kNumFullDistances)
1290
+ price += p->distancesPrices[lenToPosState][dist & (kNumFullDistances - 1)];
1291
+ else
1292
+ {
1293
+ unsigned slot;
1294
+ GetPosSlot2(dist, slot);
1295
+ price += p->alignPrices[dist & kAlignMask];
1296
+ price += p->posSlotPrices[lenToPosState][slot];
1297
+ }
1298
+
1299
+ opt = &p->opt[len];
1300
+
1301
+ if (price < opt->price)
1302
+ {
1303
+ opt->price = price;
1304
+ opt->len = (UInt32)len;
1305
+ opt->dist = dist + LZMA_NUM_REPS;
1306
+ opt->extra = 0;
1307
+ }
1308
+
1309
+ if (len == matches[offs])
1310
+ {
1311
+ offs += 2;
1312
+ if (offs == numPairs)
1313
+ break;
1314
+ }
1315
+ }
1316
+ }
1317
+ }
1318
+
1319
+
1320
+ cur = 0;
1321
+
1322
+ #ifdef SHOW_STAT2
1323
+ /* if (position >= 0) */
1324
+ {
1325
+ unsigned i;
1326
+ printf("\n pos = %4X", position);
1327
+ for (i = cur; i <= last; i++)
1328
+ printf("\nprice[%4X] = %u", position - cur + i, p->opt[i].price);
1329
+ }
1330
+ #endif
1331
+ }
1332
+
1333
+
1334
+
1335
+ // ---------- Optimal Parsing ----------
1336
+
1337
+ for (;;)
1338
+ {
1339
+ unsigned numAvail;
1340
+ UInt32 numAvailFull;
1341
+ unsigned newLen, numPairs, prev, state, posState, startLen;
1342
+ UInt32 litPrice, matchPrice, repMatchPrice;
1343
+ BoolInt nextIsLit;
1344
+ Byte curByte, matchByte;
1345
+ const Byte *data;
1346
+ COptimal *curOpt, *nextOpt;
1347
+
1348
+ if (++cur == last)
1349
+ break;
1350
+
1351
+ // 18.06
1352
+ if (cur >= kNumOpts - 64)
1353
+ {
1354
+ unsigned j, best;
1355
+ UInt32 price = p->opt[cur].price;
1356
+ best = cur;
1357
+ for (j = cur + 1; j <= last; j++)
1358
+ {
1359
+ UInt32 price2 = p->opt[j].price;
1360
+ if (price >= price2)
1361
+ {
1362
+ price = price2;
1363
+ best = j;
1364
+ }
1365
+ }
1366
+ {
1367
+ unsigned delta = best - cur;
1368
+ if (delta != 0)
1369
+ {
1370
+ MOVE_POS(p, delta);
1371
+ }
1372
+ }
1373
+ cur = best;
1374
+ break;
1375
+ }
1376
+
1377
+ newLen = ReadMatchDistances(p, &numPairs);
1378
+
1379
+ if (newLen >= p->numFastBytes)
1380
+ {
1381
+ p->numPairs = numPairs;
1382
+ p->longestMatchLen = newLen;
1383
+ break;
1384
+ }
1385
+
1386
+ curOpt = &p->opt[cur];
1387
+
1388
+ position++;
1389
+
1390
+ // we need that check here, if skip_items in p->opt are possible
1391
+ /*
1392
+ if (curOpt->price >= kInfinityPrice)
1393
+ continue;
1394
+ */
1395
+
1396
+ prev = cur - curOpt->len;
1397
+
1398
+ if (curOpt->len == 1)
1399
+ {
1400
+ state = (unsigned)p->opt[prev].state;
1401
+ if (IsShortRep(curOpt))
1402
+ state = kShortRepNextStates[state];
1403
+ else
1404
+ state = kLiteralNextStates[state];
1405
+ }
1406
+ else
1407
+ {
1408
+ const COptimal *prevOpt;
1409
+ UInt32 b0;
1410
+ UInt32 dist = curOpt->dist;
1411
+
1412
+ if (curOpt->extra)
1413
+ {
1414
+ prev -= (unsigned)curOpt->extra;
1415
+ state = kState_RepAfterLit;
1416
+ if (curOpt->extra == 1)
1417
+ state = (dist < LZMA_NUM_REPS ? kState_RepAfterLit : kState_MatchAfterLit);
1418
+ }
1419
+ else
1420
+ {
1421
+ state = (unsigned)p->opt[prev].state;
1422
+ if (dist < LZMA_NUM_REPS)
1423
+ state = kRepNextStates[state];
1424
+ else
1425
+ state = kMatchNextStates[state];
1426
+ }
1427
+
1428
+ prevOpt = &p->opt[prev];
1429
+ b0 = prevOpt->reps[0];
1430
+
1431
+ if (dist < LZMA_NUM_REPS)
1432
+ {
1433
+ if (dist == 0)
1434
+ {
1435
+ reps[0] = b0;
1436
+ reps[1] = prevOpt->reps[1];
1437
+ reps[2] = prevOpt->reps[2];
1438
+ reps[3] = prevOpt->reps[3];
1439
+ }
1440
+ else
1441
+ {
1442
+ reps[1] = b0;
1443
+ b0 = prevOpt->reps[1];
1444
+ if (dist == 1)
1445
+ {
1446
+ reps[0] = b0;
1447
+ reps[2] = prevOpt->reps[2];
1448
+ reps[3] = prevOpt->reps[3];
1449
+ }
1450
+ else
1451
+ {
1452
+ reps[2] = b0;
1453
+ reps[0] = prevOpt->reps[dist];
1454
+ reps[3] = prevOpt->reps[dist ^ 1];
1455
+ }
1456
+ }
1457
+ }
1458
+ else
1459
+ {
1460
+ reps[0] = (dist - LZMA_NUM_REPS + 1);
1461
+ reps[1] = b0;
1462
+ reps[2] = prevOpt->reps[1];
1463
+ reps[3] = prevOpt->reps[2];
1464
+ }
1465
+ }
1466
+
1467
+ curOpt->state = (CState)state;
1468
+ curOpt->reps[0] = reps[0];
1469
+ curOpt->reps[1] = reps[1];
1470
+ curOpt->reps[2] = reps[2];
1471
+ curOpt->reps[3] = reps[3];
1472
+
1473
+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
1474
+ curByte = *data;
1475
+ matchByte = *(data - reps[0]);
1476
+
1477
+ posState = (position & p->pbMask);
1478
+
1479
+ /*
1480
+ The order of Price checks:
1481
+ < LIT
1482
+ <= SHORT_REP
1483
+ < LIT : REP_0
1484
+ < REP [ : LIT : REP_0 ]
1485
+ < MATCH [ : LIT : REP_0 ]
1486
+ */
1487
+
1488
+ {
1489
+ UInt32 curPrice = curOpt->price;
1490
+ unsigned prob = p->isMatch[state][posState];
1491
+ matchPrice = curPrice + GET_PRICE_1(prob);
1492
+ litPrice = curPrice + GET_PRICE_0(prob);
1493
+ }
1494
+
1495
+ nextOpt = &p->opt[(size_t)cur + 1];
1496
+ nextIsLit = False;
1497
+
1498
+ // here we can allow skip_items in p->opt, if we don't check (nextOpt->price < kInfinityPrice)
1499
+ // 18.new.06
1500
+ if ((nextOpt->price < kInfinityPrice
1501
+ // && !IsLitState(state)
1502
+ && matchByte == curByte)
1503
+ || litPrice > nextOpt->price
1504
+ )
1505
+ litPrice = 0;
1506
+ else
1507
+ {
1508
+ const CLzmaProb *probs = LIT_PROBS(position, *(data - 1));
1509
+ litPrice += (!IsLitState(state) ?
1510
+ LitEnc_Matched_GetPrice(probs, curByte, matchByte, p->ProbPrices) :
1511
+ LitEnc_GetPrice(probs, curByte, p->ProbPrices));
1512
+
1513
+ if (litPrice < nextOpt->price)
1514
+ {
1515
+ nextOpt->price = litPrice;
1516
+ nextOpt->len = 1;
1517
+ MakeAs_Lit(nextOpt);
1518
+ nextIsLit = True;
1519
+ }
1520
+ }
1521
+
1522
+ repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[state]);
1523
+
1524
+ numAvailFull = p->numAvail;
1525
+ {
1526
+ unsigned temp = kNumOpts - 1 - cur;
1527
+ if (numAvailFull > temp)
1528
+ numAvailFull = (UInt32)temp;
1529
+ }
1530
+
1531
+ // 18.06
1532
+ // ---------- SHORT_REP ----------
1533
+ if (IsLitState(state)) // 18.new
1534
+ if (matchByte == curByte)
1535
+ if (repMatchPrice < nextOpt->price) // 18.new
1536
+ // if (numAvailFull < 2 || data[1] != *(data - reps[0] + 1))
1537
+ if (
1538
+ // nextOpt->price >= kInfinityPrice ||
1539
+ nextOpt->len < 2 // we can check nextOpt->len, if skip items are not allowed in p->opt
1540
+ || (nextOpt->dist != 0
1541
+ // && nextOpt->extra <= 1 // 17.old
1542
+ )
1543
+ )
1544
+ {
1545
+ UInt32 shortRepPrice = repMatchPrice + GetPrice_ShortRep(p, state, posState);
1546
+ // if (shortRepPrice <= nextOpt->price) // 17.old
1547
+ if (shortRepPrice < nextOpt->price) // 18.new
1548
+ {
1549
+ nextOpt->price = shortRepPrice;
1550
+ nextOpt->len = 1;
1551
+ MakeAs_ShortRep(nextOpt);
1552
+ nextIsLit = False;
1553
+ }
1554
+ }
1555
+
1556
+ if (numAvailFull < 2)
1557
+ continue;
1558
+ numAvail = (numAvailFull <= p->numFastBytes ? numAvailFull : p->numFastBytes);
1559
+
1560
+ // numAvail <= p->numFastBytes
1561
+
1562
+ // ---------- LIT : REP_0 ----------
1563
+
1564
+ if (!nextIsLit
1565
+ && litPrice != 0 // 18.new
1566
+ && matchByte != curByte
1567
+ && numAvailFull > 2)
1568
+ {
1569
+ const Byte *data2 = data - reps[0];
1570
+ if (data[1] == data2[1] && data[2] == data2[2])
1571
+ {
1572
+ unsigned len;
1573
+ unsigned limit = p->numFastBytes + 1;
1574
+ if (limit > numAvailFull)
1575
+ limit = numAvailFull;
1576
+ for (len = 3; len < limit && data[len] == data2[len]; len++)
1577
+ {}
1578
+
1579
+ {
1580
+ unsigned state2 = kLiteralNextStates[state];
1581
+ unsigned posState2 = (position + 1) & p->pbMask;
1582
+ UInt32 price = litPrice + GetPrice_Rep_0(p, state2, posState2);
1583
+ {
1584
+ unsigned offset = cur + len;
1585
+
1586
+ if (last < offset)
1587
+ last = offset;
1588
+
1589
+ // do
1590
+ {
1591
+ UInt32 price2;
1592
+ COptimal *opt;
1593
+ len--;
1594
+ // price2 = price + GetPrice_Len_Rep_0(p, len, state2, posState2);
1595
+ price2 = price + GET_PRICE_LEN(&p->repLenEnc, posState2, len);
1596
+
1597
+ opt = &p->opt[offset];
1598
+ // offset--;
1599
+ if (price2 < opt->price)
1600
+ {
1601
+ opt->price = price2;
1602
+ opt->len = (UInt32)len;
1603
+ opt->dist = 0;
1604
+ opt->extra = 1;
1605
+ }
1606
+ }
1607
+ // while (len >= 3);
1608
+ }
1609
+ }
1610
+ }
1611
+ }
1612
+
1613
+ startLen = 2; /* speed optimization */
1614
+
1615
+ {
1616
+ // ---------- REP ----------
1617
+ unsigned repIndex = 0; // 17.old
1618
+ // unsigned repIndex = IsLitState(state) ? 0 : 1; // 18.notused
1619
+ for (; repIndex < LZMA_NUM_REPS; repIndex++)
1620
+ {
1621
+ unsigned len;
1622
+ UInt32 price;
1623
+ const Byte *data2 = data - reps[repIndex];
1624
+ if (data[0] != data2[0] || data[1] != data2[1])
1625
+ continue;
1626
+
1627
+ for (len = 2; len < numAvail && data[len] == data2[len]; len++)
1628
+ {}
1629
+
1630
+ // if (len < startLen) continue; // 18.new: speed optimization
1631
+
1632
+ {
1633
+ unsigned offset = cur + len;
1634
+ if (last < offset)
1635
+ last = offset;
1636
+ }
1637
+ {
1638
+ unsigned len2 = len;
1639
+ price = repMatchPrice + GetPrice_PureRep(p, repIndex, state, posState);
1640
+ do
1641
+ {
1642
+ UInt32 price2 = price + GET_PRICE_LEN(&p->repLenEnc, posState, len2);
1643
+ COptimal *opt = &p->opt[cur + len2];
1644
+ if (price2 < opt->price)
1645
+ {
1646
+ opt->price = price2;
1647
+ opt->len = (UInt32)len2;
1648
+ opt->dist = (UInt32)repIndex;
1649
+ opt->extra = 0;
1650
+ }
1651
+ }
1652
+ while (--len2 >= 2);
1653
+ }
1654
+
1655
+ if (repIndex == 0) startLen = len + 1; // 17.old
1656
+ // startLen = len + 1; // 18.new
1657
+
1658
+ /* if (_maxMode) */
1659
+ {
1660
+ // ---------- REP : LIT : REP_0 ----------
1661
+ // numFastBytes + 1 + numFastBytes
1662
+
1663
+ unsigned len2 = len + 1;
1664
+ unsigned limit = len2 + p->numFastBytes;
1665
+ if (limit > numAvailFull)
1666
+ limit = numAvailFull;
1667
+
1668
+ len2 += 2;
1669
+ if (len2 <= limit)
1670
+ if (data[len2 - 2] == data2[len2 - 2])
1671
+ if (data[len2 - 1] == data2[len2 - 1])
1672
+ {
1673
+ unsigned state2 = kRepNextStates[state];
1674
+ unsigned posState2 = (position + len) & p->pbMask;
1675
+ price += GET_PRICE_LEN(&p->repLenEnc, posState, len)
1676
+ + GET_PRICE_0(p->isMatch[state2][posState2])
1677
+ + LitEnc_Matched_GetPrice(LIT_PROBS(position + len, data[(size_t)len - 1]),
1678
+ data[len], data2[len], p->ProbPrices);
1679
+
1680
+ // state2 = kLiteralNextStates[state2];
1681
+ state2 = kState_LitAfterRep;
1682
+ posState2 = (posState2 + 1) & p->pbMask;
1683
+
1684
+
1685
+ price += GetPrice_Rep_0(p, state2, posState2);
1686
+
1687
+ for (; len2 < limit && data[len2] == data2[len2]; len2++)
1688
+ {}
1689
+
1690
+ len2 -= len;
1691
+ // if (len2 >= 3)
1692
+ {
1693
+ {
1694
+ unsigned offset = cur + len + len2;
1695
+
1696
+ if (last < offset)
1697
+ last = offset;
1698
+ // do
1699
+ {
1700
+ UInt32 price2;
1701
+ COptimal *opt;
1702
+ len2--;
1703
+ // price2 = price + GetPrice_Len_Rep_0(p, len2, state2, posState2);
1704
+ price2 = price + GET_PRICE_LEN(&p->repLenEnc, posState2, len2);
1705
+
1706
+ opt = &p->opt[offset];
1707
+ // offset--;
1708
+ if (price2 < opt->price)
1709
+ {
1710
+ opt->price = price2;
1711
+ opt->len = (UInt32)len2;
1712
+ opt->extra = (CExtra)(len + 1);
1713
+ opt->dist = (UInt32)repIndex;
1714
+ }
1715
+ }
1716
+ // while (len2 >= 3);
1717
+ }
1718
+ }
1719
+ }
1720
+ }
1721
+ }
1722
+ }
1723
+
1724
+
1725
+ // ---------- MATCH ----------
1726
+ /* for (unsigned len = 2; len <= newLen; len++) */
1727
+ if (newLen > numAvail)
1728
+ {
1729
+ newLen = numAvail;
1730
+ for (numPairs = 0; newLen > matches[numPairs]; numPairs += 2);
1731
+ matches[numPairs] = (UInt32)newLen;
1732
+ numPairs += 2;
1733
+ }
1734
+
1735
+ // startLen = 2; /* speed optimization */
1736
+
1737
+ if (newLen >= startLen)
1738
+ {
1739
+ UInt32 normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[state]);
1740
+ UInt32 dist;
1741
+ unsigned offs, posSlot, len;
1742
+
1743
+ {
1744
+ unsigned offset = cur + newLen;
1745
+ if (last < offset)
1746
+ last = offset;
1747
+ }
1748
+
1749
+ offs = 0;
1750
+ while (startLen > matches[offs])
1751
+ offs += 2;
1752
+ dist = matches[(size_t)offs + 1];
1753
+
1754
+ // if (dist >= kNumFullDistances)
1755
+ GetPosSlot2(dist, posSlot);
1756
+
1757
+ for (len = /*2*/ startLen; ; len++)
1758
+ {
1759
+ UInt32 price = normalMatchPrice + GET_PRICE_LEN(&p->lenEnc, posState, len);
1760
+ {
1761
+ COptimal *opt;
1762
+ unsigned lenNorm = len - 2;
1763
+ lenNorm = GetLenToPosState2(lenNorm);
1764
+ if (dist < kNumFullDistances)
1765
+ price += p->distancesPrices[lenNorm][dist & (kNumFullDistances - 1)];
1766
+ else
1767
+ price += p->posSlotPrices[lenNorm][posSlot] + p->alignPrices[dist & kAlignMask];
1768
+
1769
+ opt = &p->opt[cur + len];
1770
+ if (price < opt->price)
1771
+ {
1772
+ opt->price = price;
1773
+ opt->len = (UInt32)len;
1774
+ opt->dist = dist + LZMA_NUM_REPS;
1775
+ opt->extra = 0;
1776
+ }
1777
+ }
1778
+
1779
+ if (len == matches[offs])
1780
+ {
1781
+ // if (p->_maxMode) {
1782
+ // MATCH : LIT : REP_0
1783
+
1784
+ const Byte *data2 = data - dist - 1;
1785
+ unsigned len2 = len + 1;
1786
+ unsigned limit = len2 + p->numFastBytes;
1787
+ if (limit > numAvailFull)
1788
+ limit = numAvailFull;
1789
+
1790
+ len2 += 2;
1791
+ if (len2 <= limit)
1792
+ if (data[len2 - 2] == data2[len2 - 2])
1793
+ if (data[len2 - 1] == data2[len2 - 1])
1794
+ {
1795
+ for (; len2 < limit && data[len2] == data2[len2]; len2++)
1796
+ {}
1797
+
1798
+ len2 -= len;
1799
+
1800
+ // if (len2 >= 3)
1801
+ {
1802
+ unsigned state2 = kMatchNextStates[state];
1803
+ unsigned posState2 = (position + len) & p->pbMask;
1804
+ unsigned offset;
1805
+ price += GET_PRICE_0(p->isMatch[state2][posState2]);
1806
+ price += LitEnc_Matched_GetPrice(LIT_PROBS(position + len, data[(size_t)len - 1]),
1807
+ data[len], data2[len], p->ProbPrices);
1808
+
1809
+ // state2 = kLiteralNextStates[state2];
1810
+ state2 = kState_LitAfterMatch;
1811
+
1812
+ posState2 = (posState2 + 1) & p->pbMask;
1813
+ price += GetPrice_Rep_0(p, state2, posState2);
1814
+
1815
+ offset = cur + len + len2;
1816
+
1817
+ if (last < offset)
1818
+ last = offset;
1819
+ // do
1820
+ {
1821
+ UInt32 price2;
1822
+ COptimal *opt;
1823
+ len2--;
1824
+ // price2 = price + GetPrice_Len_Rep_0(p, len2, state2, posState2);
1825
+ price2 = price + GET_PRICE_LEN(&p->repLenEnc, posState2, len2);
1826
+ opt = &p->opt[offset];
1827
+ // offset--;
1828
+ if (price2 < opt->price)
1829
+ {
1830
+ opt->price = price2;
1831
+ opt->len = (UInt32)len2;
1832
+ opt->extra = (CExtra)(len + 1);
1833
+ opt->dist = dist + LZMA_NUM_REPS;
1834
+ }
1835
+ }
1836
+ // while (len2 >= 3);
1837
+ }
1838
+
1839
+ }
1840
+
1841
+ offs += 2;
1842
+ if (offs == numPairs)
1843
+ break;
1844
+ dist = matches[(size_t)offs + 1];
1845
+ // if (dist >= kNumFullDistances)
1846
+ GetPosSlot2(dist, posSlot);
1847
+ }
1848
+ }
1849
+ }
1850
+ }
1851
+
1852
+ do
1853
+ p->opt[last].price = kInfinityPrice;
1854
+ while (--last);
1855
+
1856
+ return Backward(p, cur);
1857
+ }
1858
+
1859
+
1860
+
1861
+ #define ChangePair(smallDist, bigDist) (((bigDist) >> 7) > (smallDist))
1862
+
1863
+
1864
+
1865
+ static unsigned GetOptimumFast(CLzmaEnc *p)
1866
+ {
1867
+ UInt32 numAvail, mainDist;
1868
+ unsigned mainLen, numPairs, repIndex, repLen, i;
1869
+ const Byte *data;
1870
+
1871
+ if (p->additionalOffset == 0)
1872
+ mainLen = ReadMatchDistances(p, &numPairs);
1873
+ else
1874
+ {
1875
+ mainLen = p->longestMatchLen;
1876
+ numPairs = p->numPairs;
1877
+ }
1878
+
1879
+ numAvail = p->numAvail;
1880
+ p->backRes = MARK_LIT;
1881
+ if (numAvail < 2)
1882
+ return 1;
1883
+ // if (mainLen < 2 && p->state == 0) return 1; // 18.06.notused
1884
+ if (numAvail > LZMA_MATCH_LEN_MAX)
1885
+ numAvail = LZMA_MATCH_LEN_MAX;
1886
+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
1887
+ repLen = repIndex = 0;
1888
+
1889
+ for (i = 0; i < LZMA_NUM_REPS; i++)
1890
+ {
1891
+ unsigned len;
1892
+ const Byte *data2 = data - p->reps[i];
1893
+ if (data[0] != data2[0] || data[1] != data2[1])
1894
+ continue;
1895
+ for (len = 2; len < numAvail && data[len] == data2[len]; len++)
1896
+ {}
1897
+ if (len >= p->numFastBytes)
1898
+ {
1899
+ p->backRes = (UInt32)i;
1900
+ MOVE_POS(p, len - 1)
1901
+ return len;
1902
+ }
1903
+ if (len > repLen)
1904
+ {
1905
+ repIndex = i;
1906
+ repLen = len;
1907
+ }
1908
+ }
1909
+
1910
+ if (mainLen >= p->numFastBytes)
1911
+ {
1912
+ p->backRes = p->matches[(size_t)numPairs - 1] + LZMA_NUM_REPS;
1913
+ MOVE_POS(p, mainLen - 1)
1914
+ return mainLen;
1915
+ }
1916
+
1917
+ mainDist = 0; /* for GCC */
1918
+
1919
+ if (mainLen >= 2)
1920
+ {
1921
+ mainDist = p->matches[(size_t)numPairs - 1];
1922
+ while (numPairs > 2)
1923
+ {
1924
+ UInt32 dist2;
1925
+ if (mainLen != p->matches[(size_t)numPairs - 4] + 1)
1926
+ break;
1927
+ dist2 = p->matches[(size_t)numPairs - 3];
1928
+ if (!ChangePair(dist2, mainDist))
1929
+ break;
1930
+ numPairs -= 2;
1931
+ mainLen--;
1932
+ mainDist = dist2;
1933
+ }
1934
+ if (mainLen == 2 && mainDist >= 0x80)
1935
+ mainLen = 1;
1936
+ }
1937
+
1938
+ if (repLen >= 2)
1939
+ if ( repLen + 1 >= mainLen
1940
+ || (repLen + 2 >= mainLen && mainDist >= (1 << 9))
1941
+ || (repLen + 3 >= mainLen && mainDist >= (1 << 15)))
1942
+ {
1943
+ p->backRes = (UInt32)repIndex;
1944
+ MOVE_POS(p, repLen - 1)
1945
+ return repLen;
1946
+ }
1947
+
1948
+ if (mainLen < 2 || numAvail <= 2)
1949
+ return 1;
1950
+
1951
+ {
1952
+ unsigned len1 = ReadMatchDistances(p, &p->numPairs);
1953
+ p->longestMatchLen = len1;
1954
+
1955
+ if (len1 >= 2)
1956
+ {
1957
+ UInt32 newDist = p->matches[(size_t)p->numPairs - 1];
1958
+ if ( (len1 >= mainLen && newDist < mainDist)
1959
+ || (len1 == mainLen + 1 && !ChangePair(mainDist, newDist))
1960
+ || (len1 > mainLen + 1)
1961
+ || (len1 + 1 >= mainLen && mainLen >= 3 && ChangePair(newDist, mainDist)))
1962
+ return 1;
1963
+ }
1964
+ }
1965
+
1966
+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
1967
+
1968
+ for (i = 0; i < LZMA_NUM_REPS; i++)
1969
+ {
1970
+ unsigned len, limit;
1971
+ const Byte *data2 = data - p->reps[i];
1972
+ if (data[0] != data2[0] || data[1] != data2[1])
1973
+ continue;
1974
+ limit = mainLen - 1;
1975
+ for (len = 2;; len++)
1976
+ {
1977
+ if (len >= limit)
1978
+ return 1;
1979
+ if (data[len] != data2[len])
1980
+ break;
1981
+ }
1982
+ }
1983
+
1984
+ p->backRes = mainDist + LZMA_NUM_REPS;
1985
+ if (mainLen != 2)
1986
+ {
1987
+ MOVE_POS(p, mainLen - 2)
1988
+ }
1989
+ return mainLen;
1990
+ }
1991
+
1992
+
1993
+
1994
+
1995
+ static void WriteEndMarker(CLzmaEnc *p, unsigned posState)
1996
+ {
1997
+ UInt32 range;
1998
+ range = p->rc.range;
1999
+ {
2000
+ UInt32 ttt, newBound;
2001
+ CLzmaProb *prob = &p->isMatch[p->state][posState];
2002
+ RC_BIT_PRE(&p->rc, prob)
2003
+ RC_BIT_1(&p->rc, prob)
2004
+ prob = &p->isRep[p->state];
2005
+ RC_BIT_PRE(&p->rc, prob)
2006
+ RC_BIT_0(&p->rc, prob)
2007
+ }
2008
+ p->state = kMatchNextStates[p->state];
2009
+
2010
+ p->rc.range = range;
2011
+ LenEnc_Encode(&p->lenProbs, &p->rc, 0, posState);
2012
+ range = p->rc.range;
2013
+
2014
+ {
2015
+ // RcTree_Encode_PosSlot(&p->rc, p->posSlotEncoder[0], (1 << kNumPosSlotBits) - 1);
2016
+ CLzmaProb *probs = p->posSlotEncoder[0];
2017
+ unsigned m = 1;
2018
+ do
2019
+ {
2020
+ UInt32 ttt, newBound;
2021
+ RC_BIT_PRE(p, probs + m)
2022
+ RC_BIT_1(&p->rc, probs + m);
2023
+ m = (m << 1) + 1;
2024
+ }
2025
+ while (m < (1 << kNumPosSlotBits));
2026
+ }
2027
+ {
2028
+ // RangeEnc_EncodeDirectBits(&p->rc, ((UInt32)1 << (30 - kNumAlignBits)) - 1, 30 - kNumAlignBits); UInt32 range = p->range;
2029
+ unsigned numBits = 30 - kNumAlignBits;
2030
+ do
2031
+ {
2032
+ range >>= 1;
2033
+ p->rc.low += range;
2034
+ RC_NORM(&p->rc)
2035
+ }
2036
+ while (--numBits);
2037
+ }
2038
+
2039
+ {
2040
+ // RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, kAlignMask);
2041
+ CLzmaProb *probs = p->posAlignEncoder;
2042
+ unsigned m = 1;
2043
+ do
2044
+ {
2045
+ UInt32 ttt, newBound;
2046
+ RC_BIT_PRE(p, probs + m)
2047
+ RC_BIT_1(&p->rc, probs + m);
2048
+ m = (m << 1) + 1;
2049
+ }
2050
+ while (m < kAlignTableSize);
2051
+ }
2052
+ p->rc.range = range;
2053
+ }
2054
+
2055
+
2056
+ static SRes CheckErrors(CLzmaEnc *p)
2057
+ {
2058
+ if (p->result != SZ_OK)
2059
+ return p->result;
2060
+ if (p->rc.res != SZ_OK)
2061
+ p->result = SZ_ERROR_WRITE;
2062
+ if (p->matchFinderBase.result != SZ_OK)
2063
+ p->result = SZ_ERROR_READ;
2064
+ if (p->result != SZ_OK)
2065
+ p->finished = True;
2066
+ return p->result;
2067
+ }
2068
+
2069
+
2070
+ MY_NO_INLINE static SRes Flush(CLzmaEnc *p, UInt32 nowPos)
2071
+ {
2072
+ /* ReleaseMFStream(); */
2073
+ p->finished = True;
2074
+ if (p->writeEndMark)
2075
+ WriteEndMarker(p, nowPos & p->pbMask);
2076
+ RangeEnc_FlushData(&p->rc);
2077
+ RangeEnc_FlushStream(&p->rc);
2078
+ return CheckErrors(p);
2079
+ }
2080
+
2081
+
2082
+ MY_NO_INLINE static void FillAlignPrices(CLzmaEnc *p)
2083
+ {
2084
+ unsigned i;
2085
+ const CProbPrice *ProbPrices = p->ProbPrices;
2086
+ const CLzmaProb *probs = p->posAlignEncoder;
2087
+ // p->alignPriceCount = 0;
2088
+ for (i = 0; i < kAlignTableSize / 2; i++)
2089
+ {
2090
+ UInt32 price = 0;
2091
+ unsigned sym = i;
2092
+ unsigned m = 1;
2093
+ unsigned bit;
2094
+ UInt32 prob;
2095
+ bit = sym & 1; sym >>= 1; price += GET_PRICEa(probs[m], bit); m = (m << 1) + bit;
2096
+ bit = sym & 1; sym >>= 1; price += GET_PRICEa(probs[m], bit); m = (m << 1) + bit;
2097
+ bit = sym & 1; sym >>= 1; price += GET_PRICEa(probs[m], bit); m = (m << 1) + bit;
2098
+ prob = probs[m];
2099
+ p->alignPrices[i ] = price + GET_PRICEa_0(prob);
2100
+ p->alignPrices[i + 8] = price + GET_PRICEa_1(prob);
2101
+ // p->alignPrices[i] = RcTree_ReverseGetPrice(p->posAlignEncoder, kNumAlignBits, i, p->ProbPrices);
2102
+ }
2103
+ }
2104
+
2105
+
2106
+ MY_NO_INLINE static void FillDistancesPrices(CLzmaEnc *p)
2107
+ {
2108
+ // int y; for (y = 0; y < 100; y++) {
2109
+
2110
+ UInt32 tempPrices[kNumFullDistances];
2111
+ unsigned i, lps;
2112
+
2113
+ const CProbPrice *ProbPrices = p->ProbPrices;
2114
+ p->matchPriceCount = 0;
2115
+
2116
+ for (i = kStartPosModelIndex / 2; i < kNumFullDistances / 2; i++)
2117
+ {
2118
+ unsigned posSlot = GetPosSlot1(i);
2119
+ unsigned footerBits = (posSlot >> 1) - 1;
2120
+ unsigned base = ((2 | (posSlot & 1)) << footerBits);
2121
+ const CLzmaProb *probs = p->posEncoders + (size_t)base * 2;
2122
+ // tempPrices[i] = RcTree_ReverseGetPrice(p->posEncoders + base, footerBits, i - base, p->ProbPrices);
2123
+ UInt32 price = 0;
2124
+ unsigned m = 1;
2125
+ unsigned sym = i;
2126
+ unsigned offset = (unsigned)1 << footerBits;
2127
+ base += i;
2128
+
2129
+ if (footerBits)
2130
+ do
2131
+ {
2132
+ unsigned bit = sym & 1;
2133
+ sym >>= 1;
2134
+ price += GET_PRICEa(probs[m], bit);
2135
+ m = (m << 1) + bit;
2136
+ }
2137
+ while (--footerBits);
2138
+
2139
+ {
2140
+ unsigned prob = probs[m];
2141
+ tempPrices[base ] = price + GET_PRICEa_0(prob);
2142
+ tempPrices[base + offset] = price + GET_PRICEa_1(prob);
2143
+ }
2144
+ }
2145
+
2146
+ for (lps = 0; lps < kNumLenToPosStates; lps++)
2147
+ {
2148
+ unsigned slot;
2149
+ unsigned distTableSize2 = (p->distTableSize + 1) >> 1;
2150
+ UInt32 *posSlotPrices = p->posSlotPrices[lps];
2151
+ const CLzmaProb *probs = p->posSlotEncoder[lps];
2152
+
2153
+ for (slot = 0; slot < distTableSize2; slot++)
2154
+ {
2155
+ // posSlotPrices[slot] = RcTree_GetPrice(encoder, kNumPosSlotBits, slot, p->ProbPrices);
2156
+ UInt32 price;
2157
+ unsigned bit;
2158
+ unsigned sym = slot + (1 << (kNumPosSlotBits - 1));
2159
+ unsigned prob;
2160
+ bit = sym & 1; sym >>= 1; price = GET_PRICEa(probs[sym], bit);
2161
+ bit = sym & 1; sym >>= 1; price += GET_PRICEa(probs[sym], bit);
2162
+ bit = sym & 1; sym >>= 1; price += GET_PRICEa(probs[sym], bit);
2163
+ bit = sym & 1; sym >>= 1; price += GET_PRICEa(probs[sym], bit);
2164
+ bit = sym & 1; sym >>= 1; price += GET_PRICEa(probs[sym], bit);
2165
+ prob = probs[(size_t)slot + (1 << (kNumPosSlotBits - 1))];
2166
+ posSlotPrices[(size_t)slot * 2 ] = price + GET_PRICEa_0(prob);
2167
+ posSlotPrices[(size_t)slot * 2 + 1] = price + GET_PRICEa_1(prob);
2168
+ }
2169
+
2170
+ {
2171
+ UInt32 delta = ((UInt32)((kEndPosModelIndex / 2 - 1) - kNumAlignBits) << kNumBitPriceShiftBits);
2172
+ for (slot = kEndPosModelIndex / 2; slot < distTableSize2; slot++)
2173
+ {
2174
+ posSlotPrices[(size_t)slot * 2 ] += delta;
2175
+ posSlotPrices[(size_t)slot * 2 + 1] += delta;
2176
+ delta += ((UInt32)1 << kNumBitPriceShiftBits);
2177
+ }
2178
+ }
2179
+
2180
+ {
2181
+ UInt32 *dp = p->distancesPrices[lps];
2182
+
2183
+ dp[0] = posSlotPrices[0];
2184
+ dp[1] = posSlotPrices[1];
2185
+ dp[2] = posSlotPrices[2];
2186
+ dp[3] = posSlotPrices[3];
2187
+
2188
+ for (i = 4; i < kNumFullDistances; i += 2)
2189
+ {
2190
+ UInt32 slotPrice = posSlotPrices[GetPosSlot1(i)];
2191
+ dp[i ] = slotPrice + tempPrices[i];
2192
+ dp[i + 1] = slotPrice + tempPrices[i + 1];
2193
+ }
2194
+ }
2195
+ }
2196
+ // }
2197
+ }
2198
+
2199
+
2200
+
2201
+ void LzmaEnc_Construct(CLzmaEnc *p)
2202
+ {
2203
+ RangeEnc_Construct(&p->rc);
2204
+ MatchFinder_Construct(&p->matchFinderBase);
2205
+
2206
+ #ifndef _7ZIP_ST
2207
+ MatchFinderMt_Construct(&p->matchFinderMt);
2208
+ p->matchFinderMt.MatchFinder = &p->matchFinderBase;
2209
+ #endif
2210
+
2211
+ {
2212
+ CLzmaEncProps props;
2213
+ LzmaEncProps_Init(&props);
2214
+ LzmaEnc_SetProps(p, &props);
2215
+ }
2216
+
2217
+ #ifndef LZMA_LOG_BSR
2218
+ LzmaEnc_FastPosInit(p->g_FastPos);
2219
+ #endif
2220
+
2221
+ LzmaEnc_InitPriceTables(p->ProbPrices);
2222
+ p->litProbs = NULL;
2223
+ p->saveState.litProbs = NULL;
2224
+
2225
+ }
2226
+
2227
+ CLzmaEncHandle LzmaEnc_Create(ISzAllocPtr alloc)
2228
+ {
2229
+ void *p;
2230
+ p = ISzAlloc_Alloc(alloc, sizeof(CLzmaEnc));
2231
+ if (p)
2232
+ LzmaEnc_Construct((CLzmaEnc *)p);
2233
+ return p;
2234
+ }
2235
+
2236
+ void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAllocPtr alloc)
2237
+ {
2238
+ ISzAlloc_Free(alloc, p->litProbs);
2239
+ ISzAlloc_Free(alloc, p->saveState.litProbs);
2240
+ p->litProbs = NULL;
2241
+ p->saveState.litProbs = NULL;
2242
+ }
2243
+
2244
+ void LzmaEnc_Destruct(CLzmaEnc *p, ISzAllocPtr alloc, ISzAllocPtr allocBig)
2245
+ {
2246
+ #ifndef _7ZIP_ST
2247
+ MatchFinderMt_Destruct(&p->matchFinderMt, allocBig);
2248
+ #endif
2249
+
2250
+ MatchFinder_Free(&p->matchFinderBase, allocBig);
2251
+ LzmaEnc_FreeLits(p, alloc);
2252
+ RangeEnc_Free(&p->rc, alloc);
2253
+ }
2254
+
2255
+ void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAllocPtr alloc, ISzAllocPtr allocBig)
2256
+ {
2257
+ LzmaEnc_Destruct((CLzmaEnc *)p, alloc, allocBig);
2258
+ ISzAlloc_Free(alloc, p);
2259
+ }
2260
+
2261
+
2262
+ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, UInt32 maxPackSize, UInt32 maxUnpackSize)
2263
+ {
2264
+ UInt32 nowPos32, startPos32;
2265
+ if (p->needInit)
2266
+ {
2267
+ p->matchFinder.Init(p->matchFinderObj);
2268
+ p->needInit = 0;
2269
+ }
2270
+
2271
+ if (p->finished)
2272
+ return p->result;
2273
+ RINOK(CheckErrors(p));
2274
+
2275
+ nowPos32 = (UInt32)p->nowPos64;
2276
+ startPos32 = nowPos32;
2277
+
2278
+ if (p->nowPos64 == 0)
2279
+ {
2280
+ unsigned numPairs;
2281
+ Byte curByte;
2282
+ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0)
2283
+ return Flush(p, nowPos32);
2284
+ ReadMatchDistances(p, &numPairs);
2285
+ RangeEnc_EncodeBit_0(&p->rc, &p->isMatch[kState_Start][0]);
2286
+ // p->state = kLiteralNextStates[p->state];
2287
+ curByte = *(p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset);
2288
+ LitEnc_Encode(&p->rc, p->litProbs, curByte);
2289
+ p->additionalOffset--;
2290
+ nowPos32++;
2291
+ }
2292
+
2293
+ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) != 0)
2294
+
2295
+ for (;;)
2296
+ {
2297
+ UInt32 dist;
2298
+ unsigned len, posState;
2299
+ UInt32 range, ttt, newBound;
2300
+ CLzmaProb *probs;
2301
+
2302
+ if (p->fastMode)
2303
+ len = GetOptimumFast(p);
2304
+ else
2305
+ {
2306
+ unsigned oci = p->optCur;
2307
+ if (p->optEnd == oci)
2308
+ len = GetOptimum(p, nowPos32);
2309
+ else
2310
+ {
2311
+ const COptimal *opt = &p->opt[oci];
2312
+ len = opt->len;
2313
+ p->backRes = opt->dist;
2314
+ p->optCur = oci + 1;
2315
+ }
2316
+ }
2317
+
2318
+ posState = (unsigned)nowPos32 & p->pbMask;
2319
+ range = p->rc.range;
2320
+ probs = &p->isMatch[p->state][posState];
2321
+
2322
+ RC_BIT_PRE(&p->rc, probs)
2323
+
2324
+ dist = p->backRes;
2325
+
2326
+ #ifdef SHOW_STAT2
2327
+ printf("\n pos = %6X, len = %3u pos = %6u", nowPos32, len, dist);
2328
+ #endif
2329
+
2330
+ if (dist == MARK_LIT)
2331
+ {
2332
+ Byte curByte;
2333
+ const Byte *data;
2334
+ unsigned state;
2335
+
2336
+ RC_BIT_0(&p->rc, probs);
2337
+ p->rc.range = range;
2338
+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset;
2339
+ probs = LIT_PROBS(nowPos32, *(data - 1));
2340
+ curByte = *data;
2341
+ state = p->state;
2342
+ p->state = kLiteralNextStates[state];
2343
+ if (IsLitState(state))
2344
+ LitEnc_Encode(&p->rc, probs, curByte);
2345
+ else
2346
+ LitEnc_EncodeMatched(&p->rc, probs, curByte, *(data - p->reps[0]));
2347
+ }
2348
+ else
2349
+ {
2350
+ RC_BIT_1(&p->rc, probs);
2351
+ probs = &p->isRep[p->state];
2352
+ RC_BIT_PRE(&p->rc, probs)
2353
+
2354
+ if (dist < LZMA_NUM_REPS)
2355
+ {
2356
+ RC_BIT_1(&p->rc, probs);
2357
+ probs = &p->isRepG0[p->state];
2358
+ RC_BIT_PRE(&p->rc, probs)
2359
+ if (dist == 0)
2360
+ {
2361
+ RC_BIT_0(&p->rc, probs);
2362
+ probs = &p->isRep0Long[p->state][posState];
2363
+ RC_BIT_PRE(&p->rc, probs)
2364
+ if (len != 1)
2365
+ {
2366
+ RC_BIT_1_BASE(&p->rc, probs);
2367
+ }
2368
+ else
2369
+ {
2370
+ RC_BIT_0_BASE(&p->rc, probs);
2371
+ p->state = kShortRepNextStates[p->state];
2372
+ }
2373
+ }
2374
+ else
2375
+ {
2376
+ RC_BIT_1(&p->rc, probs);
2377
+ probs = &p->isRepG1[p->state];
2378
+ RC_BIT_PRE(&p->rc, probs)
2379
+ if (dist == 1)
2380
+ {
2381
+ RC_BIT_0_BASE(&p->rc, probs);
2382
+ dist = p->reps[1];
2383
+ }
2384
+ else
2385
+ {
2386
+ RC_BIT_1(&p->rc, probs);
2387
+ probs = &p->isRepG2[p->state];
2388
+ RC_BIT_PRE(&p->rc, probs)
2389
+ if (dist == 2)
2390
+ {
2391
+ RC_BIT_0_BASE(&p->rc, probs);
2392
+ dist = p->reps[2];
2393
+ }
2394
+ else
2395
+ {
2396
+ RC_BIT_1_BASE(&p->rc, probs);
2397
+ dist = p->reps[3];
2398
+ p->reps[3] = p->reps[2];
2399
+ }
2400
+ p->reps[2] = p->reps[1];
2401
+ }
2402
+ p->reps[1] = p->reps[0];
2403
+ p->reps[0] = dist;
2404
+ }
2405
+
2406
+ RC_NORM(&p->rc)
2407
+
2408
+ p->rc.range = range;
2409
+
2410
+ if (len != 1)
2411
+ {
2412
+ LenEnc_Encode(&p->repLenProbs, &p->rc, len - LZMA_MATCH_LEN_MIN, posState);
2413
+ --p->repLenEncCounter;
2414
+ p->state = kRepNextStates[p->state];
2415
+ }
2416
+ }
2417
+ else
2418
+ {
2419
+ unsigned posSlot;
2420
+ RC_BIT_0(&p->rc, probs);
2421
+ p->rc.range = range;
2422
+ p->state = kMatchNextStates[p->state];
2423
+
2424
+ LenEnc_Encode(&p->lenProbs, &p->rc, len - LZMA_MATCH_LEN_MIN, posState);
2425
+ // --p->lenEnc.counter;
2426
+
2427
+ dist -= LZMA_NUM_REPS;
2428
+ p->reps[3] = p->reps[2];
2429
+ p->reps[2] = p->reps[1];
2430
+ p->reps[1] = p->reps[0];
2431
+ p->reps[0] = dist + 1;
2432
+
2433
+ p->matchPriceCount++;
2434
+ GetPosSlot(dist, posSlot);
2435
+ // RcTree_Encode_PosSlot(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], posSlot);
2436
+ {
2437
+ UInt32 sym = (UInt32)posSlot + (1 << kNumPosSlotBits);
2438
+ range = p->rc.range;
2439
+ probs = p->posSlotEncoder[GetLenToPosState(len)];
2440
+ do
2441
+ {
2442
+ CLzmaProb *prob = probs + (sym >> kNumPosSlotBits);
2443
+ UInt32 bit = (sym >> (kNumPosSlotBits - 1)) & 1;
2444
+ sym <<= 1;
2445
+ RC_BIT(&p->rc, prob, bit);
2446
+ }
2447
+ while (sym < (1 << kNumPosSlotBits * 2));
2448
+ p->rc.range = range;
2449
+ }
2450
+
2451
+ if (dist >= kStartPosModelIndex)
2452
+ {
2453
+ unsigned footerBits = ((posSlot >> 1) - 1);
2454
+
2455
+ if (dist < kNumFullDistances)
2456
+ {
2457
+ unsigned base = ((2 | (posSlot & 1)) << footerBits);
2458
+ RcTree_ReverseEncode(&p->rc, p->posEncoders + base, footerBits, (unsigned)(dist /* - base */));
2459
+ }
2460
+ else
2461
+ {
2462
+ UInt32 pos2 = (dist | 0xF) << (32 - footerBits);
2463
+ range = p->rc.range;
2464
+ // RangeEnc_EncodeDirectBits(&p->rc, posReduced >> kNumAlignBits, footerBits - kNumAlignBits);
2465
+ /*
2466
+ do
2467
+ {
2468
+ range >>= 1;
2469
+ p->rc.low += range & (0 - ((dist >> --footerBits) & 1));
2470
+ RC_NORM(&p->rc)
2471
+ }
2472
+ while (footerBits > kNumAlignBits);
2473
+ */
2474
+ do
2475
+ {
2476
+ range >>= 1;
2477
+ p->rc.low += range & (0 - (pos2 >> 31));
2478
+ pos2 += pos2;
2479
+ RC_NORM(&p->rc)
2480
+ }
2481
+ while (pos2 != 0xF0000000);
2482
+
2483
+
2484
+ // RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, posReduced & kAlignMask);
2485
+
2486
+ {
2487
+ unsigned m = 1;
2488
+ unsigned bit;
2489
+ bit = dist & 1; dist >>= 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit); m = (m << 1) + bit;
2490
+ bit = dist & 1; dist >>= 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit); m = (m << 1) + bit;
2491
+ bit = dist & 1; dist >>= 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit); m = (m << 1) + bit;
2492
+ bit = dist & 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit);
2493
+ p->rc.range = range;
2494
+ // p->alignPriceCount++;
2495
+ }
2496
+ }
2497
+ }
2498
+ }
2499
+ }
2500
+
2501
+ nowPos32 += (UInt32)len;
2502
+ p->additionalOffset -= len;
2503
+
2504
+ if (p->additionalOffset == 0)
2505
+ {
2506
+ UInt32 processed;
2507
+
2508
+ if (!p->fastMode)
2509
+ {
2510
+ /*
2511
+ if (p->alignPriceCount >= 16) // kAlignTableSize
2512
+ FillAlignPrices(p);
2513
+ if (p->matchPriceCount >= 128)
2514
+ FillDistancesPrices(p);
2515
+ if (p->lenEnc.counter <= 0)
2516
+ LenPriceEnc_UpdateTables(&p->lenEnc, 1 << p->pb, &p->lenProbs, p->ProbPrices);
2517
+ */
2518
+ if (p->matchPriceCount >= 64)
2519
+ {
2520
+ FillAlignPrices(p);
2521
+ // { int y; for (y = 0; y < 100; y++) {
2522
+ FillDistancesPrices(p);
2523
+ // }}
2524
+ LenPriceEnc_UpdateTables(&p->lenEnc, 1 << p->pb, &p->lenProbs, p->ProbPrices);
2525
+ }
2526
+ if (p->repLenEncCounter <= 0)
2527
+ {
2528
+ p->repLenEncCounter = REP_LEN_COUNT;
2529
+ LenPriceEnc_UpdateTables(&p->repLenEnc, 1 << p->pb, &p->repLenProbs, p->ProbPrices);
2530
+ }
2531
+ }
2532
+
2533
+ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0)
2534
+ break;
2535
+ processed = nowPos32 - startPos32;
2536
+
2537
+ if (maxPackSize)
2538
+ {
2539
+ if (processed + kNumOpts + 300 >= maxUnpackSize
2540
+ || RangeEnc_GetProcessed_sizet(&p->rc) + kPackReserve >= maxPackSize)
2541
+ break;
2542
+ }
2543
+ else if (processed >= (1 << 17))
2544
+ {
2545
+ p->nowPos64 += nowPos32 - startPos32;
2546
+ return CheckErrors(p);
2547
+ }
2548
+ }
2549
+ }
2550
+
2551
+ p->nowPos64 += nowPos32 - startPos32;
2552
+ return Flush(p, nowPos32);
2553
+ }
2554
+
2555
+
2556
+
2557
+ #define kBigHashDicLimit ((UInt32)1 << 24)
2558
+
2559
+ static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAllocPtr alloc, ISzAllocPtr allocBig)
2560
+ {
2561
+ UInt32 beforeSize = kNumOpts;
2562
+ if (!RangeEnc_Alloc(&p->rc, alloc))
2563
+ return SZ_ERROR_MEM;
2564
+
2565
+ #ifndef _7ZIP_ST
2566
+ p->mtMode = (p->multiThread && !p->fastMode && (p->matchFinderBase.btMode != 0));
2567
+ #endif
2568
+
2569
+ {
2570
+ unsigned lclp = p->lc + p->lp;
2571
+ if (!p->litProbs || !p->saveState.litProbs || p->lclp != lclp)
2572
+ {
2573
+ LzmaEnc_FreeLits(p, alloc);
2574
+ p->litProbs = (CLzmaProb *)ISzAlloc_Alloc(alloc, ((UInt32)0x300 << lclp) * sizeof(CLzmaProb));
2575
+ p->saveState.litProbs = (CLzmaProb *)ISzAlloc_Alloc(alloc, ((UInt32)0x300 << lclp) * sizeof(CLzmaProb));
2576
+ if (!p->litProbs || !p->saveState.litProbs)
2577
+ {
2578
+ LzmaEnc_FreeLits(p, alloc);
2579
+ return SZ_ERROR_MEM;
2580
+ }
2581
+ p->lclp = lclp;
2582
+ }
2583
+ }
2584
+
2585
+ p->matchFinderBase.bigHash = (Byte)(p->dictSize > kBigHashDicLimit ? 1 : 0);
2586
+
2587
+ if (beforeSize + p->dictSize < keepWindowSize)
2588
+ beforeSize = keepWindowSize - p->dictSize;
2589
+
2590
+ #ifndef _7ZIP_ST
2591
+ if (p->mtMode)
2592
+ {
2593
+ RINOK(MatchFinderMt_Create(&p->matchFinderMt, p->dictSize, beforeSize, p->numFastBytes,
2594
+ LZMA_MATCH_LEN_MAX
2595
+ + 1 /* 18.04 */
2596
+ , allocBig));
2597
+ p->matchFinderObj = &p->matchFinderMt;
2598
+ p->matchFinderBase.bigHash = (Byte)(
2599
+ (p->dictSize > kBigHashDicLimit && p->matchFinderBase.hashMask >= 0xFFFFFF) ? 1 : 0);
2600
+ MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder);
2601
+ }
2602
+ else
2603
+ #endif
2604
+ {
2605
+ if (!MatchFinder_Create(&p->matchFinderBase, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig))
2606
+ return SZ_ERROR_MEM;
2607
+ p->matchFinderObj = &p->matchFinderBase;
2608
+ MatchFinder_CreateVTable(&p->matchFinderBase, &p->matchFinder);
2609
+ }
2610
+
2611
+ return SZ_OK;
2612
+ }
2613
+
2614
+ void LzmaEnc_Init(CLzmaEnc *p)
2615
+ {
2616
+ unsigned i;
2617
+ p->state = 0;
2618
+ p->reps[0] =
2619
+ p->reps[1] =
2620
+ p->reps[2] =
2621
+ p->reps[3] = 1;
2622
+
2623
+ RangeEnc_Init(&p->rc);
2624
+
2625
+ for (i = 0; i < (1 << kNumAlignBits); i++)
2626
+ p->posAlignEncoder[i] = kProbInitValue;
2627
+
2628
+ for (i = 0; i < kNumStates; i++)
2629
+ {
2630
+ unsigned j;
2631
+ for (j = 0; j < LZMA_NUM_PB_STATES_MAX; j++)
2632
+ {
2633
+ p->isMatch[i][j] = kProbInitValue;
2634
+ p->isRep0Long[i][j] = kProbInitValue;
2635
+ }
2636
+ p->isRep[i] = kProbInitValue;
2637
+ p->isRepG0[i] = kProbInitValue;
2638
+ p->isRepG1[i] = kProbInitValue;
2639
+ p->isRepG2[i] = kProbInitValue;
2640
+ }
2641
+
2642
+ {
2643
+ for (i = 0; i < kNumLenToPosStates; i++)
2644
+ {
2645
+ CLzmaProb *probs = p->posSlotEncoder[i];
2646
+ unsigned j;
2647
+ for (j = 0; j < (1 << kNumPosSlotBits); j++)
2648
+ probs[j] = kProbInitValue;
2649
+ }
2650
+ }
2651
+ {
2652
+ for (i = 0; i < kNumFullDistances; i++)
2653
+ p->posEncoders[i] = kProbInitValue;
2654
+ }
2655
+
2656
+ {
2657
+ UInt32 num = (UInt32)0x300 << (p->lp + p->lc);
2658
+ UInt32 k;
2659
+ CLzmaProb *probs = p->litProbs;
2660
+ for (k = 0; k < num; k++)
2661
+ probs[k] = kProbInitValue;
2662
+ }
2663
+
2664
+
2665
+ LenEnc_Init(&p->lenProbs);
2666
+ LenEnc_Init(&p->repLenProbs);
2667
+
2668
+ p->optEnd = 0;
2669
+ p->optCur = 0;
2670
+
2671
+ {
2672
+ for (i = 0; i < kNumOpts; i++)
2673
+ p->opt[i].price = kInfinityPrice;
2674
+ }
2675
+
2676
+ p->additionalOffset = 0;
2677
+
2678
+ p->pbMask = (1 << p->pb) - 1;
2679
+ p->lpMask = ((UInt32)0x100 << p->lp) - ((unsigned)0x100 >> p->lc);
2680
+ }
2681
+
2682
+
2683
+ void LzmaEnc_InitPrices(CLzmaEnc *p)
2684
+ {
2685
+ if (!p->fastMode)
2686
+ {
2687
+ FillDistancesPrices(p);
2688
+ FillAlignPrices(p);
2689
+ }
2690
+
2691
+ p->lenEnc.tableSize =
2692
+ p->repLenEnc.tableSize =
2693
+ p->numFastBytes + 1 - LZMA_MATCH_LEN_MIN;
2694
+
2695
+ p->repLenEncCounter = REP_LEN_COUNT;
2696
+
2697
+ LenPriceEnc_UpdateTables(&p->lenEnc, 1 << p->pb, &p->lenProbs, p->ProbPrices);
2698
+ LenPriceEnc_UpdateTables(&p->repLenEnc, 1 << p->pb, &p->repLenProbs, p->ProbPrices);
2699
+ }
2700
+
2701
+ static SRes LzmaEnc_AllocAndInit(CLzmaEnc *p, UInt32 keepWindowSize, ISzAllocPtr alloc, ISzAllocPtr allocBig)
2702
+ {
2703
+ unsigned i;
2704
+ for (i = kEndPosModelIndex / 2; i < kDicLogSizeMax; i++)
2705
+ if (p->dictSize <= ((UInt32)1 << i))
2706
+ break;
2707
+ p->distTableSize = i * 2;
2708
+
2709
+ p->finished = False;
2710
+ p->result = SZ_OK;
2711
+ RINOK(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig));
2712
+ LzmaEnc_Init(p);
2713
+ LzmaEnc_InitPrices(p);
2714
+ p->nowPos64 = 0;
2715
+ return SZ_OK;
2716
+ }
2717
+
2718
+ static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream,
2719
+ ISzAllocPtr alloc, ISzAllocPtr allocBig)
2720
+ {
2721
+ CLzmaEnc *p = (CLzmaEnc *)pp;
2722
+ p->matchFinderBase.stream = inStream;
2723
+ p->needInit = 1;
2724
+ p->rc.outStream = outStream;
2725
+ return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig);
2726
+ }
2727
+
2728
+ SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp,
2729
+ ISeqInStream *inStream, UInt32 keepWindowSize,
2730
+ ISzAllocPtr alloc, ISzAllocPtr allocBig)
2731
+ {
2732
+ CLzmaEnc *p = (CLzmaEnc *)pp;
2733
+ p->matchFinderBase.stream = inStream;
2734
+ p->needInit = 1;
2735
+ return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
2736
+ }
2737
+
2738
+ static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen)
2739
+ {
2740
+ p->matchFinderBase.directInput = 1;
2741
+ p->matchFinderBase.bufferBase = (Byte *)src;
2742
+ p->matchFinderBase.directInputRem = srcLen;
2743
+ }
2744
+
2745
+ SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen,
2746
+ UInt32 keepWindowSize, ISzAllocPtr alloc, ISzAllocPtr allocBig)
2747
+ {
2748
+ CLzmaEnc *p = (CLzmaEnc *)pp;
2749
+ LzmaEnc_SetInputBuf(p, src, srcLen);
2750
+ p->needInit = 1;
2751
+
2752
+ LzmaEnc_SetDataSize(pp, srcLen);
2753
+ return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
2754
+ }
2755
+
2756
+ void LzmaEnc_Finish(CLzmaEncHandle pp)
2757
+ {
2758
+ #ifndef _7ZIP_ST
2759
+ CLzmaEnc *p = (CLzmaEnc *)pp;
2760
+ if (p->mtMode)
2761
+ MatchFinderMt_ReleaseStream(&p->matchFinderMt);
2762
+ #else
2763
+ UNUSED_VAR(pp);
2764
+ #endif
2765
+ }
2766
+
2767
+
2768
+ typedef struct
2769
+ {
2770
+ ISeqOutStream vt;
2771
+ Byte *data;
2772
+ SizeT rem;
2773
+ BoolInt overflow;
2774
+ } CLzmaEnc_SeqOutStreamBuf;
2775
+
2776
+ static size_t SeqOutStreamBuf_Write(const ISeqOutStream *pp, const void *data, size_t size)
2777
+ {
2778
+ CLzmaEnc_SeqOutStreamBuf *p = CONTAINER_FROM_VTBL(pp, CLzmaEnc_SeqOutStreamBuf, vt);
2779
+ if (p->rem < size)
2780
+ {
2781
+ size = p->rem;
2782
+ p->overflow = True;
2783
+ }
2784
+ memcpy(p->data, data, size);
2785
+ p->rem -= size;
2786
+ p->data += size;
2787
+ return size;
2788
+ }
2789
+
2790
+
2791
+ UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp)
2792
+ {
2793
+ const CLzmaEnc *p = (CLzmaEnc *)pp;
2794
+ return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
2795
+ }
2796
+
2797
+
2798
+ const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp)
2799
+ {
2800
+ const CLzmaEnc *p = (CLzmaEnc *)pp;
2801
+ return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset;
2802
+ }
2803
+
2804
+
2805
+ SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit,
2806
+ Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize)
2807
+ {
2808
+ CLzmaEnc *p = (CLzmaEnc *)pp;
2809
+ UInt64 nowPos64;
2810
+ SRes res;
2811
+ CLzmaEnc_SeqOutStreamBuf outStream;
2812
+
2813
+ outStream.vt.Write = SeqOutStreamBuf_Write;
2814
+ outStream.data = dest;
2815
+ outStream.rem = *destLen;
2816
+ outStream.overflow = False;
2817
+
2818
+ p->writeEndMark = False;
2819
+ p->finished = False;
2820
+ p->result = SZ_OK;
2821
+
2822
+ if (reInit)
2823
+ LzmaEnc_Init(p);
2824
+ LzmaEnc_InitPrices(p);
2825
+
2826
+ nowPos64 = p->nowPos64;
2827
+ RangeEnc_Init(&p->rc);
2828
+ p->rc.outStream = &outStream.vt;
2829
+
2830
+ if (desiredPackSize == 0)
2831
+ return SZ_ERROR_OUTPUT_EOF;
2832
+
2833
+ res = LzmaEnc_CodeOneBlock(p, desiredPackSize, *unpackSize);
2834
+
2835
+ *unpackSize = (UInt32)(p->nowPos64 - nowPos64);
2836
+ *destLen -= outStream.rem;
2837
+ if (outStream.overflow)
2838
+ return SZ_ERROR_OUTPUT_EOF;
2839
+
2840
+ return res;
2841
+ }
2842
+
2843
+
2844
+ static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress)
2845
+ {
2846
+ SRes res = SZ_OK;
2847
+
2848
+ #ifndef _7ZIP_ST
2849
+ Byte allocaDummy[0x300];
2850
+ allocaDummy[0] = 0;
2851
+ allocaDummy[1] = allocaDummy[0];
2852
+ #endif
2853
+
2854
+ for (;;)
2855
+ {
2856
+ res = LzmaEnc_CodeOneBlock(p, 0, 0);
2857
+ if (res != SZ_OK || p->finished)
2858
+ break;
2859
+ if (progress)
2860
+ {
2861
+ res = ICompressProgress_Progress(progress, p->nowPos64, RangeEnc_GetProcessed(&p->rc));
2862
+ if (res != SZ_OK)
2863
+ {
2864
+ res = SZ_ERROR_PROGRESS;
2865
+ break;
2866
+ }
2867
+ }
2868
+ }
2869
+
2870
+ LzmaEnc_Finish(p);
2871
+
2872
+ /*
2873
+ if (res == SZ_OK && !Inline_MatchFinder_IsFinishedOK(&p->matchFinderBase))
2874
+ res = SZ_ERROR_FAIL;
2875
+ }
2876
+ */
2877
+
2878
+ return res;
2879
+ }
2880
+
2881
+
2882
+ SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress,
2883
+ ISzAllocPtr alloc, ISzAllocPtr allocBig)
2884
+ {
2885
+ RINOK(LzmaEnc_Prepare(pp, outStream, inStream, alloc, allocBig));
2886
+ return LzmaEnc_Encode2((CLzmaEnc *)pp, progress);
2887
+ }
2888
+
2889
+
2890
+ SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size)
2891
+ {
2892
+ CLzmaEnc *p = (CLzmaEnc *)pp;
2893
+ unsigned i;
2894
+ UInt32 dictSize = p->dictSize;
2895
+ if (*size < LZMA_PROPS_SIZE)
2896
+ return SZ_ERROR_PARAM;
2897
+ *size = LZMA_PROPS_SIZE;
2898
+ props[0] = (Byte)((p->pb * 5 + p->lp) * 9 + p->lc);
2899
+
2900
+ if (dictSize >= ((UInt32)1 << 22))
2901
+ {
2902
+ UInt32 kDictMask = ((UInt32)1 << 20) - 1;
2903
+ if (dictSize < (UInt32)0xFFFFFFFF - kDictMask)
2904
+ dictSize = (dictSize + kDictMask) & ~kDictMask;
2905
+ }
2906
+ else for (i = 11; i <= 30; i++)
2907
+ {
2908
+ if (dictSize <= ((UInt32)2 << i)) { dictSize = (2 << i); break; }
2909
+ if (dictSize <= ((UInt32)3 << i)) { dictSize = (3 << i); break; }
2910
+ }
2911
+
2912
+ for (i = 0; i < 4; i++)
2913
+ props[1 + i] = (Byte)(dictSize >> (8 * i));
2914
+ return SZ_OK;
2915
+ }
2916
+
2917
+
2918
+ unsigned LzmaEnc_IsWriteEndMark(CLzmaEncHandle pp)
2919
+ {
2920
+ return ((CLzmaEnc *)pp)->writeEndMark;
2921
+ }
2922
+
2923
+
2924
+ SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
2925
+ int writeEndMark, ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig)
2926
+ {
2927
+ SRes res;
2928
+ CLzmaEnc *p = (CLzmaEnc *)pp;
2929
+
2930
+ CLzmaEnc_SeqOutStreamBuf outStream;
2931
+
2932
+ outStream.vt.Write = SeqOutStreamBuf_Write;
2933
+ outStream.data = dest;
2934
+ outStream.rem = *destLen;
2935
+ outStream.overflow = False;
2936
+
2937
+ p->writeEndMark = writeEndMark;
2938
+ p->rc.outStream = &outStream.vt;
2939
+
2940
+ res = LzmaEnc_MemPrepare(pp, src, srcLen, 0, alloc, allocBig);
2941
+
2942
+ if (res == SZ_OK)
2943
+ {
2944
+ res = LzmaEnc_Encode2(p, progress);
2945
+ if (res == SZ_OK && p->nowPos64 != srcLen)
2946
+ res = SZ_ERROR_FAIL;
2947
+ }
2948
+
2949
+ *destLen -= outStream.rem;
2950
+ if (outStream.overflow)
2951
+ return SZ_ERROR_OUTPUT_EOF;
2952
+ return res;
2953
+ }
2954
+
2955
+
2956
+ SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
2957
+ const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
2958
+ ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig)
2959
+ {
2960
+ CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc);
2961
+ SRes res;
2962
+ if (!p)
2963
+ return SZ_ERROR_MEM;
2964
+
2965
+ res = LzmaEnc_SetProps(p, props);
2966
+ if (res == SZ_OK)
2967
+ {
2968
+ res = LzmaEnc_WriteProperties(p, propsEncoded, propsSize);
2969
+ if (res == SZ_OK)
2970
+ res = LzmaEnc_MemEncode(p, dest, destLen, src, srcLen,
2971
+ writeEndMark, progress, alloc, allocBig);
2972
+ }
2973
+
2974
+ LzmaEnc_Destroy(p, alloc, allocBig);
2975
+ return res;
2976
+ }