react-native-update 10.34.2 → 10.34.3

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