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,2643 @@
1
+ //patch.c
2
+ //
3
+ /*
4
+ The MIT License (MIT)
5
+ Copyright (c) 2012-2018 HouSisong
6
+
7
+ Permission is hereby granted, free of charge, to any person
8
+ obtaining a copy of this software and associated documentation
9
+ files (the "Software"), to deal in the Software without
10
+ restriction, including without limitation the rights to use,
11
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the
13
+ Software is furnished to do so, subject to the following
14
+ conditions:
15
+
16
+ The above copyright notice and this permission notice shall be
17
+ included in all copies of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
21
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26
+ OTHER DEALINGS IN THE SOFTWARE.
27
+ */
28
+ #include "patch.h"
29
+ #if (_IS_NEED_CACHE_OLD_BY_COVERS)
30
+ # include <stdlib.h> //qsort
31
+ #endif
32
+ #include "patch_private.h"
33
+
34
+ #ifndef _IS_RUN_MEM_SAFE_CHECK
35
+ # define _IS_RUN_MEM_SAFE_CHECK 1
36
+ #endif
37
+
38
+ #if (_IS_RUN_MEM_SAFE_CHECK)
39
+ // __RUN_MEM_SAFE_CHECK : enables bounds checking for memory access to defend against potentially corrupted or maliciously crafted data.
40
+ # define __RUN_MEM_SAFE_CHECK
41
+ #endif
42
+
43
+ #ifdef __RUN_MEM_SAFE_CHECK
44
+ # define _SAFE_CHECK_DO(code) do{ if (!(code)) return _hpatch_FALSE; }while(0)
45
+ #else
46
+ # define _SAFE_CHECK_DO(code) do{ code; }while(0)
47
+ #endif
48
+
49
+ #define _hpatch_FALSE hpatch_FALSE
50
+ //hpatch_uint __hpatch_debug_check_false_x=0; //for debug
51
+ //#define _hpatch_FALSE (1/__hpatch_debug_check_false_x)
52
+
53
+ typedef unsigned char TByte;
54
+
55
+
56
+ //Variable-length positive integer encoding scheme (x bits for additional type flags, x<=7), outputs 1--n bytes from high:
57
+ // x0* 7-x bit
58
+ // x1* 0* 7+7-x bit
59
+ // x1* 1* 0* 7+7+7-x bit
60
+ // x1* 1* 1* 0* 7+7+7+7-x bit
61
+ // x1* 1* 1* 1* 0* 7+7+7+7+7-x bit
62
+ // ......
63
+ hpatch_BOOL hpatch_packUIntWithTag(TByte** out_code,TByte* out_code_end,
64
+ hpatch_StreamPos_t uValue,hpatch_uint highTag,
65
+ const hpatch_uint kTagBit){//write out integer and advance pointer.
66
+ TByte* pcode=*out_code;
67
+ const hpatch_StreamPos_t kMaxValueWithTag=((hpatch_StreamPos_t)1<<(7-kTagBit))-1;
68
+ TByte codeBuf[hpatch_kMaxPackedUIntBytes];
69
+ TByte* codeEnd=codeBuf;
70
+ #ifdef __RUN_MEM_SAFE_CHECK
71
+ //static const hpatch_uint kPackMaxTagBit=7;
72
+ //assert((0<=kTagBit)&&(kTagBit<=kPackMaxTagBit));
73
+ //assert((highTag>>kTagBit)==0);
74
+ #endif
75
+ while (uValue>kMaxValueWithTag) {
76
+ *codeEnd=uValue&((1<<7)-1); ++codeEnd;
77
+ uValue>>=7;
78
+ }
79
+ #ifdef __RUN_MEM_SAFE_CHECK
80
+ if ((out_code_end-pcode)<(1+(codeEnd-codeBuf))) return _hpatch_FALSE;
81
+ #endif
82
+ *pcode=(TByte)( (TByte)uValue | (highTag<<(8-kTagBit))
83
+ | (((codeBuf!=codeEnd)?1:0)<<(7-kTagBit)) );
84
+ ++pcode;
85
+ while (codeBuf!=codeEnd) {
86
+ --codeEnd;
87
+ *pcode=(*codeEnd) | (TByte)(((codeBuf!=codeEnd)?1:0)<<7);
88
+ ++pcode;
89
+ }
90
+ *out_code=pcode;
91
+ return hpatch_TRUE;
92
+ }
93
+
94
+ hpatch_uint hpatch_packUIntWithTag_size(hpatch_StreamPos_t uValue,const hpatch_uint kTagBit){
95
+ const hpatch_StreamPos_t kMaxValueWithTag=((hpatch_StreamPos_t)1<<(7-kTagBit))-1;
96
+ hpatch_uint size=0;
97
+ while (uValue>kMaxValueWithTag) {
98
+ ++size;
99
+ uValue>>=7;
100
+ }
101
+ ++size;
102
+ return size;
103
+ }
104
+
105
+ hpatch_BOOL hpatch_unpackUIntWithTag(const TByte** src_code,const TByte* src_code_end,
106
+ hpatch_StreamPos_t* result,const hpatch_uint kTagBit){//read integer and advance pointer.
107
+ #ifdef __RUN_MEM_SAFE_CHECK
108
+ //const hpatch_uint kPackMaxTagBit=7;
109
+ #endif
110
+ hpatch_StreamPos_t value;
111
+ TByte code;
112
+ const TByte* pcode=*src_code;
113
+
114
+ #ifdef __RUN_MEM_SAFE_CHECK
115
+ //assert(kTagBit<=kPackMaxTagBit);
116
+ if (src_code_end<=pcode) return _hpatch_FALSE;
117
+ #endif
118
+ code=*pcode; ++pcode;
119
+ value=code&((1<<(7-kTagBit))-1);
120
+ if ((code&(1<<(7-kTagBit)))!=0){
121
+ do {
122
+ #ifdef __RUN_MEM_SAFE_CHECK
123
+ if ((value>>(sizeof(value)*8-7))!=0) return _hpatch_FALSE;//cannot save 7bit
124
+ if (src_code_end==pcode) return _hpatch_FALSE;
125
+ #endif
126
+ code=*pcode; ++pcode;
127
+ value=(value<<7) | (code&((1<<7)-1));
128
+ } while ((code&(1<<7))!=0);
129
+ }
130
+ (*src_code)=pcode;
131
+ *result=value;
132
+ return hpatch_TRUE;
133
+ }
134
+
135
+
136
+ static hpatch_BOOL _read_mem_stream(const hpatch_TStreamInput* stream,hpatch_StreamPos_t readFromPos,
137
+ unsigned char* out_data,unsigned char* out_data_end){
138
+ const unsigned char* src=(const unsigned char*)stream->streamImport;
139
+ hpatch_size_t readLen=out_data_end-out_data;
140
+ #ifdef __RUN_MEM_SAFE_CHECK
141
+ if (readFromPos>stream->streamSize) return _hpatch_FALSE;
142
+ if (readLen>(hpatch_StreamPos_t)(stream->streamSize-readFromPos)) return _hpatch_FALSE;
143
+ #endif
144
+ memcpy(out_data,src+readFromPos,readLen);
145
+ return hpatch_TRUE;
146
+ }
147
+ const hpatch_TStreamInput* mem_as_hStreamInput(hpatch_TStreamInput* out_stream,
148
+ const unsigned char* mem,const unsigned char* mem_end){
149
+ out_stream->streamImport=(void*)mem;
150
+ out_stream->streamSize=mem_end-mem;
151
+ out_stream->read=_read_mem_stream;
152
+ return out_stream;
153
+ }
154
+
155
+ static hpatch_BOOL _write_mem_stream(const hpatch_TStreamOutput* stream,hpatch_StreamPos_t writeToPos,
156
+ const unsigned char* data,const unsigned char* data_end){
157
+ unsigned char* out_dst=(unsigned char*)stream->streamImport;
158
+ hpatch_size_t writeLen=data_end-data;
159
+ #ifdef __RUN_MEM_SAFE_CHECK
160
+ if (writeToPos>stream->streamSize) return _hpatch_FALSE;
161
+ if (writeLen>(hpatch_StreamPos_t)(stream->streamSize-writeToPos)) return _hpatch_FALSE;
162
+ #endif
163
+ memcpy(out_dst+writeToPos,data,writeLen);
164
+ return hpatch_TRUE;
165
+ }
166
+ typedef hpatch_BOOL (*_read_mem_stream_t)(const hpatch_TStreamOutput* stream,hpatch_StreamPos_t readFromPos,
167
+ unsigned char* out_data,unsigned char* out_data_end);
168
+ const hpatch_TStreamOutput* mem_as_hStreamOutput(hpatch_TStreamOutput* out_stream,
169
+ unsigned char* mem,unsigned char* mem_end){
170
+ out_stream->streamImport=mem;
171
+ out_stream->streamSize=mem_end-mem;
172
+ out_stream->read_writed=(_read_mem_stream_t)_read_mem_stream;
173
+ out_stream->write=_write_mem_stream;
174
+ return out_stream;
175
+ }
176
+
177
+ hpatch_BOOL hpatch_deccompress_mem(hpatch_TDecompress* decompressPlugin,
178
+ const unsigned char* code,const unsigned char* code_end,
179
+ unsigned char* out_data,unsigned char* out_data_end){
180
+ hpatch_decompressHandle dec=0;
181
+ hpatch_BOOL result,colose_rt;
182
+ hpatch_TStreamInput codeStream;
183
+ mem_as_hStreamInput(&codeStream,code,code_end);
184
+ dec=decompressPlugin->open(decompressPlugin,(out_data_end-out_data),
185
+ &codeStream,0,codeStream.streamSize);
186
+ if (dec==0) return _hpatch_FALSE;
187
+ result=decompressPlugin->decompress_part(dec,out_data,out_data_end);
188
+ colose_rt=decompressPlugin->close(decompressPlugin,dec);
189
+ assert(colose_rt);
190
+ return result;
191
+ }
192
+
193
+
194
+ ////////
195
+ //patch by memory
196
+
197
+ static const hpatch_uint kSignTagBit=1;
198
+
199
+ static hpatch_BOOL _bytesRle_load(TByte* out_data,TByte* out_dataEnd,
200
+ const TByte* rle_code,const TByte* rle_code_end);
201
+ static void addData(TByte* dst,const TByte* src,hpatch_size_t length);
202
+ hpatch_inline
203
+ static hpatch_BOOL _unpackUIntWithTag(const TByte** src_code,const TByte* src_code_end,
204
+ hpatch_size_t* result,const hpatch_uint kTagBit){
205
+ if (sizeof(hpatch_size_t)==sizeof(hpatch_StreamPos_t)){
206
+ return hpatch_unpackUIntWithTag(src_code,src_code_end,(hpatch_StreamPos_t*)result,kTagBit);
207
+ }else{
208
+ hpatch_StreamPos_t u64=0;
209
+ hpatch_BOOL rt=hpatch_unpackUIntWithTag(src_code,src_code_end,&u64,kTagBit);
210
+ hpatch_size_t u=(hpatch_size_t)u64;
211
+ *result=u;
212
+ #ifdef __RUN_MEM_SAFE_CHECK
213
+ return rt&(u==u64);
214
+ #else
215
+ return rt;
216
+ #endif
217
+ }
218
+ }
219
+
220
+ #define unpackUIntWithTagTo(puint,src_code,src_code_end,kTagBit) \
221
+ _SAFE_CHECK_DO(_unpackUIntWithTag(src_code,src_code_end,puint,kTagBit))
222
+ #define unpackUIntTo(puint,src_code,src_code_end) \
223
+ unpackUIntWithTagTo(puint,src_code,src_code_end,0)
224
+
225
+ hpatch_BOOL patch(TByte* out_newData,TByte* out_newData_end,
226
+ const TByte* oldData,const TByte* oldData_end,
227
+ const TByte* serializedDiff,const TByte* serializedDiff_end){
228
+ const TByte *code_lengths, *code_lengths_end,
229
+ *code_inc_newPos, *code_inc_newPos_end,
230
+ *code_inc_oldPos, *code_inc_oldPos_end,
231
+ *code_newDataDiff, *code_newDataDiff_end;
232
+ hpatch_size_t coverCount;
233
+
234
+ assert(out_newData<=out_newData_end);
235
+ assert(oldData<=oldData_end);
236
+ assert(serializedDiff<=serializedDiff_end);
237
+ unpackUIntTo(&coverCount,&serializedDiff, serializedDiff_end);
238
+ { //head
239
+ hpatch_size_t lengthSize,inc_newPosSize,inc_oldPosSize,newDataDiffSize;
240
+ unpackUIntTo(&lengthSize,&serializedDiff, serializedDiff_end);
241
+ unpackUIntTo(&inc_newPosSize,&serializedDiff, serializedDiff_end);
242
+ unpackUIntTo(&inc_oldPosSize,&serializedDiff, serializedDiff_end);
243
+ unpackUIntTo(&newDataDiffSize,&serializedDiff, serializedDiff_end);
244
+ #ifdef __RUN_MEM_SAFE_CHECK
245
+ if (lengthSize>(hpatch_size_t)(serializedDiff_end-serializedDiff)) return _hpatch_FALSE;
246
+ #endif
247
+ code_lengths=serializedDiff; serializedDiff+=lengthSize;
248
+ code_lengths_end=serializedDiff;
249
+ #ifdef __RUN_MEM_SAFE_CHECK
250
+ if (inc_newPosSize>(hpatch_size_t)(serializedDiff_end-serializedDiff)) return _hpatch_FALSE;
251
+ #endif
252
+ code_inc_newPos=serializedDiff; serializedDiff+=inc_newPosSize;
253
+ code_inc_newPos_end=serializedDiff;
254
+ #ifdef __RUN_MEM_SAFE_CHECK
255
+ if (inc_oldPosSize>(hpatch_size_t)(serializedDiff_end-serializedDiff)) return _hpatch_FALSE;
256
+ #endif
257
+ code_inc_oldPos=serializedDiff; serializedDiff+=inc_oldPosSize;
258
+ code_inc_oldPos_end=serializedDiff;
259
+ #ifdef __RUN_MEM_SAFE_CHECK
260
+ if (newDataDiffSize>(hpatch_size_t)(serializedDiff_end-serializedDiff)) return _hpatch_FALSE;
261
+ #endif
262
+ code_newDataDiff=serializedDiff; serializedDiff+=newDataDiffSize;
263
+ code_newDataDiff_end=serializedDiff;
264
+ }
265
+
266
+ //decode rle ; rle data begin==cur serializedDiff;
267
+ _SAFE_CHECK_DO(_bytesRle_load(out_newData, out_newData_end, serializedDiff, serializedDiff_end));
268
+
269
+ { //patch
270
+ const hpatch_size_t newDataSize=(hpatch_size_t)(out_newData_end-out_newData);
271
+ hpatch_size_t oldPosBack=0;
272
+ hpatch_size_t newPosBack=0;
273
+ hpatch_size_t i;
274
+ for (i=0; i<coverCount; ++i){
275
+ hpatch_size_t copyLength,addLength, oldPos,inc_oldPos,inc_oldPos_sign;
276
+ unpackUIntTo(&copyLength,&code_inc_newPos, code_inc_newPos_end);
277
+ unpackUIntTo(&addLength,&code_lengths, code_lengths_end);
278
+ #ifdef __RUN_MEM_SAFE_CHECK
279
+ if (code_inc_oldPos>=code_inc_oldPos_end) return _hpatch_FALSE;
280
+ #endif
281
+ inc_oldPos_sign=(*code_inc_oldPos)>>(8-kSignTagBit);
282
+ unpackUIntWithTagTo(&inc_oldPos,&code_inc_oldPos, code_inc_oldPos_end, kSignTagBit);
283
+ if (inc_oldPos_sign==0)
284
+ oldPos=oldPosBack+inc_oldPos;
285
+ else
286
+ oldPos=oldPosBack-inc_oldPos;
287
+ if (copyLength>0){
288
+ #ifdef __RUN_MEM_SAFE_CHECK
289
+ if (copyLength>(hpatch_size_t)(newDataSize-newPosBack)) return _hpatch_FALSE;
290
+ if (copyLength>(hpatch_size_t)(code_newDataDiff_end-code_newDataDiff)) return _hpatch_FALSE;
291
+ #endif
292
+ memcpy(out_newData+newPosBack,code_newDataDiff,copyLength);
293
+ code_newDataDiff+=copyLength;
294
+ newPosBack+=copyLength;
295
+ }
296
+ #ifdef __RUN_MEM_SAFE_CHECK
297
+ if ( (addLength>(hpatch_size_t)(newDataSize-newPosBack)) ) return _hpatch_FALSE;
298
+ if ( (oldPos>(hpatch_size_t)(oldData_end-oldData)) ||
299
+ (addLength>(hpatch_size_t)(oldData_end-oldData-oldPos)) ) return _hpatch_FALSE;
300
+ #endif
301
+ addData(out_newData+newPosBack,oldData+oldPos,addLength);
302
+ oldPosBack=oldPos;
303
+ newPosBack+=addLength;
304
+ }
305
+
306
+ if (newPosBack<newDataSize){
307
+ hpatch_size_t copyLength=newDataSize-newPosBack;
308
+ #ifdef __RUN_MEM_SAFE_CHECK
309
+ if (copyLength>(hpatch_size_t)(code_newDataDiff_end-code_newDataDiff)) return _hpatch_FALSE;
310
+ #endif
311
+ memcpy(out_newData+newPosBack,code_newDataDiff,copyLength);
312
+ code_newDataDiff+=copyLength;
313
+ //newPosBack=newDataSize;
314
+ }
315
+ }
316
+
317
+ if ( (code_lengths==code_lengths_end)
318
+ &&(code_inc_newPos==code_inc_newPos_end)
319
+ &&(code_inc_oldPos==code_inc_oldPos_end)
320
+ &&(code_newDataDiff==code_newDataDiff_end))
321
+ return hpatch_TRUE;
322
+ else
323
+ return _hpatch_FALSE;
324
+ }
325
+
326
+ hpatch_inline static void addData(TByte* dst,const TByte* src,hpatch_size_t length){
327
+ while (length--) { *dst++ += *src++; }
328
+ }
329
+
330
+ static hpatch_BOOL _bytesRle_load(TByte* out_data,TByte* out_dataEnd,
331
+ const TByte* rle_code,const TByte* rle_code_end){
332
+ const TByte* ctrlBuf,*ctrlBuf_end;
333
+ hpatch_size_t ctrlSize;
334
+ unpackUIntTo(&ctrlSize,&rle_code,rle_code_end);
335
+ #ifdef __RUN_MEM_SAFE_CHECK
336
+ if (ctrlSize>(hpatch_size_t)(rle_code_end-rle_code)) return _hpatch_FALSE;
337
+ #endif
338
+ ctrlBuf=rle_code;
339
+ rle_code+=ctrlSize;
340
+ ctrlBuf_end=rle_code;
341
+ while (ctrlBuf_end-ctrlBuf>0){
342
+ enum TByteRleType type=(enum TByteRleType)((*ctrlBuf)>>(8-kByteRleType_bit));
343
+ hpatch_size_t length;
344
+ unpackUIntWithTagTo(&length,&ctrlBuf,ctrlBuf_end,kByteRleType_bit);
345
+ #ifdef __RUN_MEM_SAFE_CHECK
346
+ if (length>=(hpatch_size_t)(out_dataEnd-out_data)) return _hpatch_FALSE;
347
+ #endif
348
+ ++length;
349
+ switch (type){
350
+ case kByteRleType_rle0:{
351
+ memset(out_data,0,length);
352
+ out_data+=length;
353
+ }break;
354
+ case kByteRleType_rle255:{
355
+ memset(out_data,255,length);
356
+ out_data+=length;
357
+ }break;
358
+ case kByteRleType_rle:{
359
+ #ifdef __RUN_MEM_SAFE_CHECK
360
+ if (1>(hpatch_size_t)(rle_code_end-rle_code)) return _hpatch_FALSE;
361
+ #endif
362
+ memset(out_data,*rle_code,length);
363
+ ++rle_code;
364
+ out_data+=length;
365
+ }break;
366
+ case kByteRleType_unrle:{
367
+ #ifdef __RUN_MEM_SAFE_CHECK
368
+ if (length>(hpatch_size_t)(rle_code_end-rle_code)) return _hpatch_FALSE;
369
+ #endif
370
+ memcpy(out_data,rle_code,length);
371
+ rle_code+=length;
372
+ out_data+=length;
373
+ }break;
374
+ }
375
+ }
376
+
377
+ if ( (ctrlBuf==ctrlBuf_end)
378
+ &&(rle_code==rle_code_end)
379
+ &&(out_data==out_dataEnd))
380
+ return hpatch_TRUE;
381
+ else
382
+ return _hpatch_FALSE;
383
+ }
384
+
385
+ //----------------------
386
+ //patch by stream
387
+
388
+ static hpatch_BOOL _TStreamInputClip_read(const hpatch_TStreamInput* stream,
389
+ hpatch_StreamPos_t readFromPos,
390
+ unsigned char* out_data,unsigned char* out_data_end){
391
+ TStreamInputClip* self=(TStreamInputClip*)stream->streamImport;
392
+ #ifdef __RUN_MEM_SAFE_CHECK
393
+ if (readFromPos+(out_data_end-out_data)>self->base.streamSize) return _hpatch_FALSE;
394
+ #endif
395
+ return self->srcStream->read(self->srcStream,readFromPos+self->clipBeginPos,out_data,out_data_end);
396
+ }
397
+ void TStreamInputClip_init(TStreamInputClip* self,const hpatch_TStreamInput* srcStream,
398
+ hpatch_StreamPos_t clipBeginPos,hpatch_StreamPos_t clipEndPos){
399
+ assert(self!=0);
400
+ assert(srcStream!=0);
401
+ assert(clipBeginPos<=clipEndPos);
402
+ assert(clipEndPos<=srcStream->streamSize);
403
+ self->srcStream=srcStream;
404
+ self->clipBeginPos=clipBeginPos;
405
+ self->base.streamImport=self;
406
+ self->base.streamSize=clipEndPos-clipBeginPos;
407
+ self->base.read=_TStreamInputClip_read;
408
+ }
409
+
410
+ static hpatch_BOOL _TStreamOutputClip_write(const hpatch_TStreamOutput* stream,
411
+ hpatch_StreamPos_t writePos,
412
+ const unsigned char* data,const unsigned char* data_end){
413
+ TStreamOutputClip* self=(TStreamOutputClip*)stream->streamImport;
414
+ #ifdef __RUN_MEM_SAFE_CHECK
415
+ if (writePos+(data_end-data)>self->base.streamSize) return _hpatch_FALSE;
416
+ #endif
417
+ return self->srcStream->write(self->srcStream,writePos+self->clipBeginPos,data,data_end);
418
+ }
419
+
420
+ void TStreamOutputClip_init(TStreamOutputClip* self,const hpatch_TStreamOutput* srcStream,
421
+ hpatch_StreamPos_t clipBeginPos,hpatch_StreamPos_t clipEndPos){
422
+ assert(self!=0);
423
+ assert(srcStream!=0);
424
+ assert(clipBeginPos<=clipEndPos);
425
+ assert(clipEndPos<=srcStream->streamSize);
426
+ self->srcStream=srcStream;
427
+ self->clipBeginPos=clipBeginPos;
428
+ self->base.streamImport=self;
429
+ self->base.streamSize=clipEndPos-clipBeginPos;
430
+ ((TStreamInputClip*)self)->base.read=_TStreamInputClip_read;
431
+ self->base.write=_TStreamOutputClip_write;
432
+ }
433
+
434
+
435
+
436
+ //assert(hpatch_kStreamCacheSize>=hpatch_kMaxPluginTypeLength+1);
437
+ struct __private_hpatch_check_kMaxCompressTypeLength {
438
+ char _[(hpatch_kStreamCacheSize>=(hpatch_kMaxPluginTypeLength+1))?1:-1];};
439
+
440
+ hpatch_BOOL _TStreamCacheClip_readStr_end(TStreamCacheClip* sclip,TByte endTag,
441
+ char* out_type,size_t typeBufLen){
442
+ const TByte* type_begin;
443
+ hpatch_size_t i;
444
+ hpatch_size_t readLen=typeBufLen;
445
+ if (readLen>_TStreamCacheClip_leaveSize(sclip))
446
+ readLen=(hpatch_size_t)_TStreamCacheClip_leaveSize(sclip);
447
+ type_begin=_TStreamCacheClip_accessData(sclip,readLen);
448
+ if (type_begin==0) return _hpatch_FALSE;//not found
449
+ for (i=0; i<readLen; ++i) {
450
+ if (type_begin[i]!=endTag)
451
+ continue;
452
+ else{
453
+ memcpy(out_type,type_begin,i); out_type[i]='\0';
454
+ _TStreamCacheClip_skipData_noCheck(sclip,i+1);
455
+ return hpatch_TRUE;
456
+ }
457
+ }
458
+ return _hpatch_FALSE;//not found
459
+ }
460
+
461
+ hpatch_BOOL _TStreamCacheClip_updateCache(TStreamCacheClip* sclip){
462
+ TByte* buf0=&sclip->cacheBuf[0];
463
+ const hpatch_StreamPos_t streamSize=sclip->streamPos_end-sclip->streamPos;
464
+ hpatch_size_t readSize=sclip->cacheBegin;
465
+ if (readSize>streamSize)
466
+ readSize=(hpatch_size_t)streamSize;
467
+ if (readSize==0) return hpatch_TRUE;
468
+ if (!_TStreamCacheClip_isCacheEmpty(sclip)){
469
+ memmove(buf0+(hpatch_size_t)(sclip->cacheBegin-readSize),
470
+ buf0+sclip->cacheBegin,_TStreamCacheClip_cachedSize(sclip));
471
+ }
472
+ if (!sclip->srcStream->read(sclip->srcStream,sclip->streamPos,
473
+ buf0+(sclip->cacheEnd-readSize),buf0+sclip->cacheEnd))
474
+ return _hpatch_FALSE;//read error
475
+ sclip->cacheBegin-=readSize;
476
+ sclip->streamPos+=readSize;
477
+ return hpatch_TRUE;
478
+ }
479
+
480
+ hpatch_BOOL _TStreamCacheClip_skipData(TStreamCacheClip* sclip,hpatch_StreamPos_t skipLongSize){
481
+ while (skipLongSize>0) {
482
+ hpatch_size_t len=sclip->cacheEnd;
483
+ if (len>skipLongSize)
484
+ len=(hpatch_size_t)skipLongSize;
485
+ if (_TStreamCacheClip_accessData(sclip,len)){
486
+ _TStreamCacheClip_skipData_noCheck(sclip,len);
487
+ skipLongSize-=len;
488
+ }else{
489
+ return _hpatch_FALSE;
490
+ }
491
+ }
492
+ return hpatch_TRUE;
493
+ }
494
+
495
+ //assert(hpatch_kStreamCacheSize>=hpatch_kMaxPackedUIntBytes);
496
+ struct __private_hpatch_check_hpatch_kMaxPackedUIntBytes {
497
+ char _[(hpatch_kStreamCacheSize>=hpatch_kMaxPackedUIntBytes)?1:-1]; };
498
+
499
+ hpatch_BOOL _TStreamCacheClip_unpackUIntWithTag(TStreamCacheClip* sclip,hpatch_StreamPos_t* result,const hpatch_uint kTagBit){
500
+ TByte* curCode,*codeBegin;
501
+ hpatch_size_t readSize=hpatch_kMaxPackedUIntBytes;
502
+ const hpatch_StreamPos_t dataSize=_TStreamCacheClip_leaveSize(sclip);
503
+ if (readSize>dataSize)
504
+ readSize=(hpatch_size_t)dataSize;
505
+ codeBegin=_TStreamCacheClip_accessData(sclip,readSize);
506
+ if (codeBegin==0) return _hpatch_FALSE;
507
+ curCode=codeBegin;
508
+ _SAFE_CHECK_DO(hpatch_unpackUIntWithTag((const TByte**)&curCode,codeBegin+readSize,result,kTagBit));
509
+ _TStreamCacheClip_skipData_noCheck(sclip,(hpatch_size_t)(curCode-codeBegin));
510
+ return hpatch_TRUE;
511
+ }
512
+
513
+ hpatch_BOOL _TStreamCacheClip_readDataTo(TStreamCacheClip* sclip,TByte* out_buf,TByte* bufEnd){
514
+ hpatch_size_t readLen=_TStreamCacheClip_cachedSize(sclip);
515
+ hpatch_size_t outLen=bufEnd-out_buf;
516
+ if (readLen>=outLen)
517
+ readLen=outLen;
518
+ memcpy(out_buf,&sclip->cacheBuf[sclip->cacheBegin],readLen);
519
+ sclip->cacheBegin+=readLen;
520
+ outLen-=readLen;
521
+ if (outLen){
522
+ out_buf += readLen;
523
+ if (outLen<(sclip->cacheEnd>>1)){
524
+ if (!_TStreamCacheClip_updateCache(sclip)) return _hpatch_FALSE;
525
+ #ifdef __RUN_MEM_SAFE_CHECK
526
+ if (outLen>_TStreamCacheClip_cachedSize(sclip)) return _hpatch_FALSE;
527
+ #endif
528
+ return _TStreamCacheClip_readDataTo(sclip, out_buf, bufEnd);
529
+ }else{
530
+ if (!sclip->srcStream->read(sclip->srcStream,sclip->streamPos,
531
+ out_buf,bufEnd)) return _hpatch_FALSE;
532
+ sclip->streamPos+=outLen;
533
+ }
534
+ }
535
+ return hpatch_TRUE;
536
+ }
537
+
538
+ hpatch_BOOL _TStreamCacheClip_addDataTo(TStreamCacheClip* self,unsigned char* dst,hpatch_size_t addLen){
539
+ const unsigned char* src=_TStreamCacheClip_readData(self,addLen);
540
+ if (src==0) return _hpatch_FALSE;
541
+ addData(dst,src,addLen);
542
+ return hpatch_TRUE;
543
+ }
544
+
545
+ static hpatch_BOOL _decompress_read(const hpatch_TStreamInput* stream,
546
+ const hpatch_StreamPos_t readFromPos,
547
+ TByte* out_data,TByte* out_data_end){
548
+ _TDecompressInputStream* self=(_TDecompressInputStream*)stream->streamImport;
549
+ return self->decompressPlugin->decompress_part(self->decompressHandle,out_data,out_data_end);
550
+ }
551
+ hpatch_BOOL getStreamClip(TStreamCacheClip* out_clip,_TDecompressInputStream* out_stream,
552
+ hpatch_StreamPos_t dataSize,hpatch_StreamPos_t compressedSize,
553
+ const hpatch_TStreamInput* stream,hpatch_StreamPos_t* pCurStreamPos,
554
+ hpatch_TDecompress* decompressPlugin,TByte* aCache,hpatch_size_t cacheSize){
555
+ hpatch_StreamPos_t curStreamPos=*pCurStreamPos;
556
+ if (compressedSize==0){
557
+ #ifdef __RUN_MEM_SAFE_CHECK
558
+ if ((curStreamPos+dataSize)<curStreamPos) return _hpatch_FALSE;
559
+ if ((curStreamPos+dataSize)>stream->streamSize) return _hpatch_FALSE;
560
+ #endif
561
+ if (out_clip)
562
+ _TStreamCacheClip_init(out_clip,stream,curStreamPos,curStreamPos+dataSize,aCache,cacheSize);
563
+ curStreamPos+=dataSize;
564
+ }else{
565
+ #ifdef __RUN_MEM_SAFE_CHECK
566
+ if ((curStreamPos+compressedSize)<curStreamPos) return _hpatch_FALSE;
567
+ if ((curStreamPos+compressedSize)>stream->streamSize) return _hpatch_FALSE;
568
+ #endif
569
+ if (out_clip){
570
+ out_stream->IInputStream.streamImport=out_stream;
571
+ out_stream->IInputStream.streamSize=dataSize;
572
+ out_stream->IInputStream.read=_decompress_read;
573
+ out_stream->decompressPlugin=decompressPlugin;
574
+ if (out_stream->decompressHandle==0){
575
+ out_stream->decompressHandle=decompressPlugin->open(decompressPlugin,dataSize,stream,
576
+ curStreamPos,curStreamPos+compressedSize);
577
+ if (!out_stream->decompressHandle) return _hpatch_FALSE;
578
+ }else{
579
+ if (decompressPlugin->reset_code==0) return _hpatch_FALSE;
580
+ if (!decompressPlugin->reset_code(out_stream->decompressHandle,dataSize,stream,curStreamPos,
581
+ curStreamPos+compressedSize)) return _hpatch_FALSE;
582
+ }
583
+ _TStreamCacheClip_init(out_clip,&out_stream->IInputStream,0,
584
+ out_stream->IInputStream.streamSize,aCache,cacheSize);
585
+ }
586
+ curStreamPos+=compressedSize;
587
+ }
588
+ *pCurStreamPos=curStreamPos;
589
+ return hpatch_TRUE;
590
+ }
591
+
592
+ ///////
593
+
594
+ static hpatch_force_inline hpatch_BOOL __TOutStreamCache_writeStream(_TOutStreamCache* self,const TByte* data,hpatch_size_t dataSize){
595
+ if (!self->dstStream->write(self->dstStream,self->writeToPos,data,data+dataSize))
596
+ return _hpatch_FALSE;
597
+ self->writeToPos+=dataSize;
598
+ return hpatch_TRUE;
599
+ }
600
+
601
+ hpatch_BOOL _TOutStreamCache_flush(_TOutStreamCache* self){
602
+ hpatch_size_t curSize=self->cacheCur;
603
+ if (curSize>0){
604
+ if (!__TOutStreamCache_writeStream(self,self->cacheBuf,curSize))
605
+ return _hpatch_FALSE;
606
+ self->cacheCur=0;
607
+ }
608
+ return hpatch_TRUE;
609
+ }
610
+
611
+ hpatch_BOOL _TOutStreamCache_write(_TOutStreamCache* self,const TByte* data,hpatch_size_t dataSize){
612
+ while (dataSize>0) {
613
+ hpatch_size_t copyLen;
614
+ hpatch_size_t curSize=self->cacheCur;
615
+ if ((dataSize>=self->cacheEnd)&&(curSize==0)){
616
+ return __TOutStreamCache_writeStream(self,data,dataSize);
617
+ }
618
+ copyLen=self->cacheEnd-curSize;
619
+ copyLen=(copyLen<=dataSize)?copyLen:dataSize;
620
+ memcpy(self->cacheBuf+curSize,data,copyLen);
621
+ self->cacheCur=curSize+copyLen;
622
+ data+=copyLen;
623
+ dataSize-=copyLen;
624
+ if (self->cacheCur==self->cacheEnd){
625
+ if (!_TOutStreamCache_flush(self))
626
+ return _hpatch_FALSE;
627
+ }
628
+ }
629
+ return hpatch_TRUE;
630
+ }
631
+
632
+ hpatch_BOOL _TOutStreamCache_fill(_TOutStreamCache* self,hpatch_byte fillValue,hpatch_StreamPos_t fillLength){
633
+ assert(self->cacheBuf);
634
+ if (self->cacheBuf==0) return _hpatch_FALSE;
635
+ while (fillLength>0){
636
+ hpatch_size_t curSize=self->cacheCur;
637
+ hpatch_size_t runStep=self->cacheEnd-curSize;
638
+ runStep=(runStep<=fillLength)?runStep:(hpatch_size_t)fillLength;
639
+ memset(self->cacheBuf+curSize,fillValue,runStep);
640
+ self->cacheCur=curSize+runStep;
641
+ fillLength-=runStep;
642
+ if (self->cacheCur==self->cacheEnd){
643
+ if (!_TOutStreamCache_flush(self))
644
+ return _hpatch_FALSE;
645
+ }
646
+ }
647
+ return hpatch_TRUE;
648
+ }
649
+
650
+ hpatch_BOOL _TOutStreamCache_copyFromStream(_TOutStreamCache* self,const hpatch_TStreamInput* src,
651
+ hpatch_StreamPos_t srcPos,hpatch_StreamPos_t copyLength){
652
+ assert(self->cacheBuf);
653
+ if (self->cacheBuf==0) return _hpatch_FALSE;
654
+ while (copyLength>0){
655
+ hpatch_size_t curSize=self->cacheCur;
656
+ hpatch_size_t runStep=self->cacheEnd-curSize;
657
+ hpatch_byte* buf=self->cacheBuf+curSize;
658
+ runStep=(runStep<=copyLength)?runStep:(hpatch_size_t)copyLength;
659
+ if (!src->read(src,srcPos,buf,buf+runStep))
660
+ return _hpatch_FALSE;
661
+ srcPos+=runStep;
662
+ self->cacheCur=curSize+runStep;
663
+ copyLength-=runStep;
664
+ if (self->cacheCur==self->cacheEnd){
665
+ if (!_TOutStreamCache_flush(self))
666
+ return _hpatch_FALSE;
667
+ }
668
+ }
669
+ return hpatch_TRUE;
670
+ }
671
+
672
+ hpatch_BOOL _TOutStreamCache_copyFromClip(_TOutStreamCache* self,TStreamCacheClip* src,hpatch_StreamPos_t copyLength){
673
+ while (copyLength>0){
674
+ const TByte* data;
675
+ hpatch_size_t runStep=(src->cacheEnd<=copyLength)?src->cacheEnd:(hpatch_size_t)copyLength;
676
+ data=_TStreamCacheClip_readData(src,runStep);
677
+ if (data==0)
678
+ return _hpatch_FALSE;
679
+ if (!_TOutStreamCache_write(self,data,runStep))
680
+ return _hpatch_FALSE;
681
+ copyLength-=runStep;
682
+ }
683
+ return hpatch_TRUE;
684
+ }
685
+
686
+ hpatch_BOOL _TOutStreamCache_copyFromSelf(_TOutStreamCache* self,hpatch_StreamPos_t aheadLength,hpatch_StreamPos_t copyLength){
687
+ // [ writed ]
688
+ // [ cached buf | empty buf ]
689
+ const hpatch_TStreamInput* src=(const hpatch_TStreamInput*)self->dstStream;
690
+ hpatch_StreamPos_t srcPos=self->writeToPos+self->cacheCur-aheadLength;
691
+ if (src->read==0) //can't read
692
+ return _hpatch_FALSE;
693
+ if ((aheadLength<1)|(aheadLength>self->writeToPos+self->cacheCur))
694
+ return _hpatch_FALSE;
695
+
696
+ if (srcPos+copyLength<=self->writeToPos){//copy from stream
697
+ // [ copyLength ]
698
+ __copy_in_stream:
699
+ return _TOutStreamCache_copyFromStream(self,src,srcPos,copyLength);
700
+ }else if (srcPos>=self->writeToPos){ //copy in mem
701
+ // [ copyLength ]
702
+ __copy_in_mem:
703
+ while (copyLength>0){
704
+ hpatch_byte* dstBuf=self->cacheBuf+self->cacheCur;
705
+ hpatch_byte* srcBuf=dstBuf-(hpatch_size_t)aheadLength;
706
+ hpatch_size_t runLen=(self->cacheCur+copyLength<=self->cacheEnd)?(hpatch_size_t)copyLength:(self->cacheEnd-self->cacheCur);
707
+ hpatch_size_t i;
708
+ for (i=0;i<runLen;i++)
709
+ dstBuf[i]=srcBuf[i];
710
+ copyLength-=runLen;
711
+ self->cacheCur+=runLen;
712
+ if (self->cacheCur==self->cacheEnd){
713
+ if (!_TOutStreamCache_flush(self))
714
+ return _hpatch_FALSE;
715
+ runLen=(hpatch_size_t)((aheadLength<=copyLength)?aheadLength:copyLength);
716
+ memmove(self->cacheBuf,self->cacheBuf+self->cacheEnd-(hpatch_size_t)aheadLength,runLen);
717
+ self->cacheCur=runLen;
718
+ copyLength-=runLen;
719
+ }else{
720
+ assert(copyLength==0);
721
+ }
722
+ }
723
+ return hpatch_TRUE;
724
+ }else if (self->writeToPos+self->cacheCur<=srcPos+self->cacheEnd){
725
+ // small data in stream,can as copy in mem
726
+ hpatch_byte* dstBuf=self->cacheBuf+self->cacheCur;
727
+ hpatch_size_t runLen=(hpatch_size_t)(self->writeToPos-srcPos);
728
+ if (!src->read(src,srcPos,dstBuf,dstBuf+runLen))
729
+ return _hpatch_FALSE;
730
+ //srcPos+=runLen; //not used
731
+ copyLength-=runLen;
732
+ self->cacheCur+=runLen;
733
+ if (self->cacheCur==self->cacheEnd){
734
+ while (hpatch_TRUE){
735
+ if (self->cacheCur==self->cacheEnd){
736
+ if (!_TOutStreamCache_flush(self))
737
+ return _hpatch_FALSE;
738
+ }
739
+ if (copyLength>0){
740
+ runLen=(self->cacheEnd<=copyLength)?self->cacheEnd:(hpatch_size_t)copyLength;
741
+ //srcPos+=runLen; //not used
742
+ copyLength-=runLen;
743
+ self->cacheCur=runLen;
744
+ }else{
745
+ return hpatch_TRUE;
746
+ }
747
+ }
748
+ }else{
749
+ goto __copy_in_mem;
750
+ }
751
+ }else{
752
+ goto __copy_in_stream;
753
+ }
754
+ }
755
+
756
+
757
+ typedef struct _TBytesRle_load_stream{
758
+ hpatch_StreamPos_t memCopyLength;
759
+ hpatch_StreamPos_t memSetLength;
760
+ TByte memSetValue;
761
+ TStreamCacheClip ctrlClip;
762
+ TStreamCacheClip rleCodeClip;
763
+ } _TBytesRle_load_stream;
764
+
765
+ hpatch_inline
766
+ static void _TBytesRle_load_stream_init(_TBytesRle_load_stream* loader){
767
+ loader->memSetLength=0;
768
+ loader->memSetValue=0;//nil;
769
+ loader->memCopyLength=0;
770
+ _TStreamCacheClip_init(&loader->ctrlClip,0,0,0,0,0);
771
+ _TStreamCacheClip_init(&loader->rleCodeClip,0,0,0,0,0);
772
+ }
773
+
774
+ hpatch_inline static void memSet_add(TByte* dst,const TByte src,hpatch_size_t length){
775
+ while (length--) { (*dst++) += src; }
776
+ }
777
+
778
+ static hpatch_BOOL _TBytesRle_load_stream_mem_add(_TBytesRle_load_stream* loader,
779
+ hpatch_size_t* _decodeSize,TByte** _out_data){
780
+ hpatch_size_t decodeSize=*_decodeSize;
781
+ TByte* out_data=*_out_data;
782
+ TStreamCacheClip* rleCodeClip=&loader->rleCodeClip;
783
+
784
+ hpatch_StreamPos_t memSetLength=loader->memSetLength;
785
+ if (memSetLength!=0){
786
+ hpatch_size_t memSetStep=((memSetLength<=decodeSize)?(hpatch_size_t)memSetLength:decodeSize);
787
+ const TByte byteSetValue=loader->memSetValue;
788
+ if (out_data!=0){
789
+ if (byteSetValue!=0)
790
+ memSet_add(out_data,byteSetValue,memSetStep);
791
+ out_data+=memSetStep;
792
+ }
793
+ decodeSize-=memSetStep;
794
+ loader->memSetLength=memSetLength-memSetStep;
795
+ }
796
+ while ((loader->memCopyLength>0)&&(decodeSize>0)) {
797
+ TByte* rleData;
798
+ hpatch_size_t decodeStep=rleCodeClip->cacheEnd;
799
+ if (decodeStep>loader->memCopyLength)
800
+ decodeStep=(hpatch_size_t)loader->memCopyLength;
801
+ if (decodeStep>decodeSize)
802
+ decodeStep=decodeSize;
803
+ rleData=_TStreamCacheClip_readData(rleCodeClip,decodeStep);
804
+ if (rleData==0) return _hpatch_FALSE;
805
+ if (out_data){
806
+ addData(out_data,rleData,decodeStep);
807
+ out_data+=decodeStep;
808
+ }
809
+ decodeSize-=decodeStep;
810
+ loader->memCopyLength-=decodeStep;
811
+ }
812
+ *_decodeSize=decodeSize;
813
+ *_out_data=out_data;
814
+ return hpatch_TRUE;
815
+ }
816
+
817
+ hpatch_inline
818
+ static hpatch_BOOL _TBytesRle_load_stream_isFinish(const _TBytesRle_load_stream* loader){
819
+ return(loader->memSetLength==0)
820
+ &&(loader->memCopyLength==0)
821
+ &&(_TStreamCacheClip_isFinish(&loader->rleCodeClip))
822
+ &&(_TStreamCacheClip_isFinish(&loader->ctrlClip));
823
+ }
824
+
825
+
826
+
827
+ #define _clip_unpackUIntWithTagTo(puint,sclip,kTagBit) \
828
+ { if (!_TStreamCacheClip_unpackUIntWithTag(sclip,puint,kTagBit)) return _hpatch_FALSE; }
829
+ #define _clip_unpackUIntTo(puint,sclip) _clip_unpackUIntWithTagTo(puint,sclip,0)
830
+
831
+ static hpatch_BOOL _TBytesRle_load_stream_decode_add(_TBytesRle_load_stream* loader,
832
+ TByte* out_data,hpatch_size_t decodeSize){
833
+ if (!_TBytesRle_load_stream_mem_add(loader,&decodeSize,&out_data))
834
+ return _hpatch_FALSE;
835
+
836
+ while ((decodeSize>0)&&(!_TStreamCacheClip_isFinish(&loader->ctrlClip))){
837
+ enum TByteRleType type;
838
+ hpatch_StreamPos_t length;
839
+ const TByte* pType=_TStreamCacheClip_accessData(&loader->ctrlClip,1);
840
+ if (pType==0) return _hpatch_FALSE;
841
+ type=(enum TByteRleType)((*pType)>>(8-kByteRleType_bit));
842
+ _clip_unpackUIntWithTagTo(&length,&loader->ctrlClip,kByteRleType_bit);
843
+ ++length;
844
+ switch (type){
845
+ case kByteRleType_rle0:{
846
+ loader->memSetLength=length;
847
+ loader->memSetValue=0;
848
+ }break;
849
+ case kByteRleType_rle255:{
850
+ loader->memSetLength=length;
851
+ loader->memSetValue=255;
852
+ }break;
853
+ case kByteRleType_rle:{
854
+ const TByte* pSetValue=_TStreamCacheClip_readData(&loader->rleCodeClip,1);
855
+ if (pSetValue==0) return _hpatch_FALSE;
856
+ loader->memSetValue=*pSetValue;
857
+ loader->memSetLength=length;
858
+ }break;
859
+ case kByteRleType_unrle:{
860
+ loader->memCopyLength=length;
861
+ }break;
862
+ }
863
+ if (!_TBytesRle_load_stream_mem_add(loader,&decodeSize,&out_data)) return _hpatch_FALSE;
864
+ }
865
+
866
+ if (decodeSize==0)
867
+ return hpatch_TRUE;
868
+ else
869
+ return _hpatch_FALSE;
870
+ }
871
+
872
+ #define _TBytesRle_load_stream_decode_skip(loader,decodeSize) \
873
+ _TBytesRle_load_stream_decode_add(loader,0,decodeSize)
874
+
875
+ static hpatch_BOOL _patch_add_old_with_rle(_TOutStreamCache* outCache,_TBytesRle_load_stream* rle_loader,
876
+ const hpatch_TStreamInput* old,hpatch_StreamPos_t oldPos,
877
+ hpatch_StreamPos_t addLength,TByte* aCache,hpatch_size_t aCacheSize){
878
+ while (addLength>0){
879
+ hpatch_size_t decodeStep=aCacheSize;
880
+ if (decodeStep>addLength)
881
+ decodeStep=(hpatch_size_t)addLength;
882
+ if (!old->read(old,oldPos,aCache,aCache+decodeStep)) return _hpatch_FALSE;
883
+ if (!_TBytesRle_load_stream_decode_add(rle_loader,aCache,decodeStep)) return _hpatch_FALSE;
884
+ if (!_TOutStreamCache_write(outCache,aCache,decodeStep)) return _hpatch_FALSE;
885
+ oldPos+=decodeStep;
886
+ addLength-=decodeStep;
887
+ }
888
+ return hpatch_TRUE;
889
+ }
890
+
891
+ typedef struct _TCovers{
892
+ hpatch_TCovers ICovers;
893
+ hpatch_StreamPos_t coverCount;
894
+ hpatch_StreamPos_t oldPosBack;
895
+ hpatch_StreamPos_t newPosBack;
896
+ TStreamCacheClip* code_inc_oldPosClip;
897
+ TStreamCacheClip* code_inc_newPosClip;
898
+ TStreamCacheClip* code_lengthsClip;
899
+ hpatch_BOOL isOldPosBackNeedAddLength;
900
+ } _TCovers;
901
+
902
+ static hpatch_StreamPos_t _covers_leaveCoverCount(const hpatch_TCovers* covers){
903
+ const _TCovers* self=(const _TCovers*)covers;
904
+ return self->coverCount;
905
+ }
906
+ static hpatch_BOOL _covers_close_nil(hpatch_TCovers* covers){
907
+ //empty
908
+ return hpatch_TRUE;
909
+ }
910
+
911
+ static hpatch_BOOL _covers_read_cover(hpatch_TCovers* covers,hpatch_TCover* out_cover){
912
+ _TCovers* self=(_TCovers*)covers;
913
+ hpatch_StreamPos_t oldPosBack=self->oldPosBack;
914
+ hpatch_StreamPos_t newPosBack=self->newPosBack;
915
+ hpatch_StreamPos_t coverCount=self->coverCount;
916
+ if (coverCount>0)
917
+ self->coverCount=coverCount-1;
918
+ else
919
+ return _hpatch_FALSE;
920
+
921
+ {
922
+ hpatch_StreamPos_t copyLength,coverLength, oldPos,inc_oldPos;
923
+ TByte inc_oldPos_sign;
924
+ const TByte* pSign=_TStreamCacheClip_accessData(self->code_inc_oldPosClip,1);
925
+ if (pSign)
926
+ inc_oldPos_sign=(*pSign)>>(8-kSignTagBit);
927
+ else
928
+ return _hpatch_FALSE;
929
+ _clip_unpackUIntWithTagTo(&inc_oldPos,self->code_inc_oldPosClip,kSignTagBit);
930
+ oldPos=(inc_oldPos_sign==0)?(oldPosBack+inc_oldPos):(oldPosBack-inc_oldPos);
931
+ _clip_unpackUIntTo(&copyLength,self->code_inc_newPosClip);
932
+ _clip_unpackUIntTo(&coverLength,self->code_lengthsClip);
933
+ newPosBack+=copyLength;
934
+ oldPosBack=oldPos;
935
+ oldPosBack+=(self->isOldPosBackNeedAddLength)?coverLength:0;
936
+
937
+ out_cover->oldPos=oldPos;
938
+ out_cover->newPos=newPosBack;
939
+ out_cover->length=coverLength;
940
+ newPosBack+=coverLength;
941
+ }
942
+ self->oldPosBack=oldPosBack;
943
+ self->newPosBack=newPosBack;
944
+ return hpatch_TRUE;
945
+ }
946
+
947
+ static hpatch_BOOL _covers_is_finish(const struct hpatch_TCovers* covers){
948
+ _TCovers* self=(_TCovers*)covers;
949
+ return _TStreamCacheClip_isFinish(self->code_lengthsClip)
950
+ && _TStreamCacheClip_isFinish(self->code_inc_newPosClip)
951
+ && _TStreamCacheClip_isFinish(self->code_inc_oldPosClip);
952
+ }
953
+
954
+
955
+ static void _covers_init(_TCovers* covers,hpatch_StreamPos_t coverCount,
956
+ TStreamCacheClip* code_inc_oldPosClip,
957
+ TStreamCacheClip* code_inc_newPosClip,
958
+ TStreamCacheClip* code_lengthsClip,
959
+ hpatch_BOOL isOldPosBackNeedAddLength){
960
+ covers->ICovers.leave_cover_count=_covers_leaveCoverCount;
961
+ covers->ICovers.read_cover=_covers_read_cover;
962
+ covers->ICovers.is_finish=_covers_is_finish;
963
+ covers->ICovers.close=_covers_close_nil;
964
+ covers->coverCount=coverCount;
965
+ covers->newPosBack=0;
966
+ covers->oldPosBack=0;
967
+ covers->code_inc_oldPosClip=code_inc_oldPosClip;
968
+ covers->code_inc_newPosClip=code_inc_newPosClip;
969
+ covers->code_lengthsClip=code_lengthsClip;
970
+ covers->isOldPosBackNeedAddLength=isOldPosBackNeedAddLength;
971
+ }
972
+
973
+ static hpatch_BOOL _rle_decode_skip(struct _TBytesRle_load_stream* rle_loader,hpatch_StreamPos_t copyLength){
974
+ while (copyLength>0) {
975
+ hpatch_size_t len=(~(hpatch_size_t)0);
976
+ if (len>copyLength)
977
+ len=(hpatch_size_t)copyLength;
978
+ if (!_TBytesRle_load_stream_decode_skip(rle_loader,len)) return _hpatch_FALSE;
979
+ copyLength-=len;
980
+ }
981
+ return hpatch_TRUE;
982
+ }
983
+
984
+ static hpatch_BOOL patchByClip(_TOutStreamCache* outCache,
985
+ const hpatch_TStreamInput* oldData,
986
+ hpatch_TCovers* covers,
987
+ TStreamCacheClip* code_newDataDiffClip,
988
+ struct _TBytesRle_load_stream* rle_loader,
989
+ TByte* temp_cache,hpatch_size_t cache_size){
990
+ const hpatch_StreamPos_t newDataSize=_TOutStreamCache_leaveSize(outCache);
991
+ const hpatch_StreamPos_t oldDataSize=oldData->streamSize;
992
+ hpatch_StreamPos_t coverCount=covers->leave_cover_count(covers);
993
+ hpatch_StreamPos_t newPosBack=0;
994
+ assert(cache_size>=hpatch_kMaxPackedUIntBytes);
995
+
996
+ while (coverCount--){
997
+ hpatch_TCover cover;
998
+ if(!covers->read_cover(covers,&cover)) return _hpatch_FALSE;
999
+ #ifdef __RUN_MEM_SAFE_CHECK
1000
+ if (cover.newPos<newPosBack) return _hpatch_FALSE;
1001
+ if (cover.length>(hpatch_StreamPos_t)(newDataSize-cover.newPos)) return _hpatch_FALSE;
1002
+ if (cover.oldPos>oldDataSize) return _hpatch_FALSE;
1003
+ if (cover.length>(hpatch_StreamPos_t)(oldDataSize-cover.oldPos)) return _hpatch_FALSE;
1004
+ #endif
1005
+ if (newPosBack<cover.newPos){
1006
+ hpatch_StreamPos_t copyLength=cover.newPos-newPosBack;
1007
+ if (!_TOutStreamCache_copyFromClip(outCache,code_newDataDiffClip,copyLength)) return _hpatch_FALSE;
1008
+ if (!_rle_decode_skip(rle_loader,copyLength)) return _hpatch_FALSE;
1009
+ }
1010
+ if (!_patch_add_old_with_rle(outCache,rle_loader,oldData,cover.oldPos,cover.length,
1011
+ temp_cache,cache_size)) return _hpatch_FALSE;
1012
+ newPosBack=cover.newPos+cover.length;
1013
+ }
1014
+
1015
+ if (newPosBack<newDataSize){
1016
+ hpatch_StreamPos_t copyLength=newDataSize-newPosBack;
1017
+ if (!_TOutStreamCache_copyFromClip(outCache,code_newDataDiffClip,copyLength)) return _hpatch_FALSE;
1018
+ if (!_rle_decode_skip(rle_loader,copyLength)) return _hpatch_FALSE;
1019
+ newPosBack=newDataSize;
1020
+ }
1021
+ if (!_TOutStreamCache_flush(outCache))
1022
+ return _hpatch_FALSE;
1023
+ if ( _TBytesRle_load_stream_isFinish(rle_loader)
1024
+ && covers->is_finish(covers)
1025
+ && _TOutStreamCache_isFinish(outCache)
1026
+ && _TStreamCacheClip_isFinish(code_newDataDiffClip)
1027
+ && (newPosBack==newDataSize) )
1028
+ return hpatch_TRUE;
1029
+ else
1030
+ return _hpatch_FALSE;
1031
+ }
1032
+
1033
+
1034
+ #define _kCachePatCount 8
1035
+
1036
+ #define _cache_alloc(dst,dst_type,memSize,temp_cache,temp_cache_end){ \
1037
+ if ((hpatch_size_t)(temp_cache_end-temp_cache) < \
1038
+ sizeof(hpatch_StreamPos_t)+(memSize)) return hpatch_FALSE; \
1039
+ (dst)=(dst_type*)_hpatch_align_upper(temp_cache,sizeof(hpatch_StreamPos_t));\
1040
+ temp_cache=(TByte*)(dst)+(hpatch_size_t)(memSize); \
1041
+ }
1042
+
1043
+ typedef struct _TPackedCovers{
1044
+ _TCovers base;
1045
+ TStreamCacheClip code_inc_oldPosClip;
1046
+ TStreamCacheClip code_inc_newPosClip;
1047
+ TStreamCacheClip code_lengthsClip;
1048
+ } _TPackedCovers;
1049
+
1050
+ typedef struct _THDiffHead{
1051
+ hpatch_StreamPos_t coverCount;
1052
+ hpatch_StreamPos_t lengthSize;
1053
+ hpatch_StreamPos_t inc_newPosSize;
1054
+ hpatch_StreamPos_t inc_oldPosSize;
1055
+ hpatch_StreamPos_t newDataDiffSize;
1056
+ hpatch_StreamPos_t headEndPos;
1057
+ hpatch_StreamPos_t coverEndPos;
1058
+ } _THDiffHead;
1059
+
1060
+ static hpatch_BOOL read_diff_head(_THDiffHead* out_diffHead,
1061
+ const hpatch_TStreamInput* serializedDiff){
1062
+ hpatch_StreamPos_t diffPos0;
1063
+ const hpatch_StreamPos_t diffPos_end=serializedDiff->streamSize;
1064
+ TByte temp_cache[hpatch_kStreamCacheSize];
1065
+ TStreamCacheClip diffHeadClip;
1066
+ _TStreamCacheClip_init(&diffHeadClip,serializedDiff,0,diffPos_end,temp_cache,hpatch_kStreamCacheSize);
1067
+ _clip_unpackUIntTo(&out_diffHead->coverCount,&diffHeadClip);
1068
+ _clip_unpackUIntTo(&out_diffHead->lengthSize,&diffHeadClip);
1069
+ _clip_unpackUIntTo(&out_diffHead->inc_newPosSize,&diffHeadClip);
1070
+ _clip_unpackUIntTo(&out_diffHead->inc_oldPosSize,&diffHeadClip);
1071
+ _clip_unpackUIntTo(&out_diffHead->newDataDiffSize,&diffHeadClip);
1072
+ diffPos0=(hpatch_StreamPos_t)(_TStreamCacheClip_readPosOfSrcStream(&diffHeadClip));
1073
+ out_diffHead->headEndPos=diffPos0;
1074
+ #ifdef __RUN_MEM_SAFE_CHECK
1075
+ if (out_diffHead->lengthSize>(hpatch_StreamPos_t)(diffPos_end-diffPos0)) return _hpatch_FALSE;
1076
+ #endif
1077
+ diffPos0+=out_diffHead->lengthSize;
1078
+ #ifdef __RUN_MEM_SAFE_CHECK
1079
+ if (out_diffHead->inc_newPosSize>(hpatch_StreamPos_t)(diffPos_end-diffPos0)) return _hpatch_FALSE;
1080
+ #endif
1081
+ diffPos0+=out_diffHead->inc_newPosSize;
1082
+ #ifdef __RUN_MEM_SAFE_CHECK
1083
+ if (out_diffHead->inc_oldPosSize>(hpatch_StreamPos_t)(diffPos_end-diffPos0)) return _hpatch_FALSE;
1084
+ #endif
1085
+ diffPos0+=out_diffHead->inc_oldPosSize;
1086
+ out_diffHead->coverEndPos=diffPos0;
1087
+ #ifdef __RUN_MEM_SAFE_CHECK
1088
+ if (out_diffHead->newDataDiffSize>(hpatch_StreamPos_t)(diffPos_end-diffPos0)) return _hpatch_FALSE;
1089
+ #endif
1090
+ return hpatch_TRUE;
1091
+ }
1092
+
1093
+ static hpatch_BOOL _packedCovers_open(_TPackedCovers** out_self,
1094
+ _THDiffHead* out_diffHead,
1095
+ const hpatch_TStreamInput* serializedDiff,
1096
+ TByte* temp_cache,TByte* temp_cache_end){
1097
+ hpatch_size_t cacheSize;
1098
+ _TPackedCovers* self=0;
1099
+ _cache_alloc(self,_TPackedCovers,sizeof(_TPackedCovers),temp_cache,temp_cache_end);
1100
+ cacheSize=(temp_cache_end-temp_cache)/3;
1101
+ {
1102
+ hpatch_StreamPos_t diffPos0;
1103
+ if (!read_diff_head(out_diffHead,serializedDiff)) return _hpatch_FALSE;
1104
+ diffPos0=out_diffHead->headEndPos;
1105
+ _TStreamCacheClip_init(&self->code_lengthsClip,serializedDiff,diffPos0,
1106
+ diffPos0+out_diffHead->lengthSize,temp_cache,cacheSize);
1107
+ temp_cache+=cacheSize;
1108
+ diffPos0+=out_diffHead->lengthSize;
1109
+ _TStreamCacheClip_init(&self->code_inc_newPosClip,serializedDiff,diffPos0,
1110
+ diffPos0+out_diffHead->inc_newPosSize,temp_cache,cacheSize);
1111
+ temp_cache+=cacheSize;
1112
+ diffPos0+=out_diffHead->inc_newPosSize;
1113
+ _TStreamCacheClip_init(&self->code_inc_oldPosClip,serializedDiff,diffPos0,
1114
+ diffPos0+out_diffHead->inc_oldPosSize,temp_cache,cacheSize);
1115
+ }
1116
+
1117
+ _covers_init(&self->base,out_diffHead->coverCount,&self->code_inc_oldPosClip,
1118
+ &self->code_inc_newPosClip,&self->code_lengthsClip,hpatch_FALSE);
1119
+ *out_self=self;
1120
+ return hpatch_TRUE;
1121
+ }
1122
+
1123
+ static hpatch_BOOL _patch_stream_with_cache(const hpatch_TStreamOutput* out_newData,
1124
+ const hpatch_TStreamInput* oldData,
1125
+ const hpatch_TStreamInput* serializedDiff,
1126
+ hpatch_TCovers* cached_covers,
1127
+ TByte* temp_cache,TByte* temp_cache_end){
1128
+ struct _THDiffHead diffHead;
1129
+ TStreamCacheClip code_newDataDiffClip;
1130
+ struct _TBytesRle_load_stream rle_loader;
1131
+ hpatch_TCovers* pcovers=0;
1132
+ hpatch_StreamPos_t diffPos0;
1133
+ const hpatch_StreamPos_t diffPos_end=serializedDiff->streamSize;
1134
+ const hpatch_size_t cacheSize=(temp_cache_end-temp_cache)/(cached_covers?(_kCachePatCount-3):_kCachePatCount);
1135
+
1136
+ assert(out_newData!=0);
1137
+ assert(out_newData->write!=0);
1138
+ assert(oldData!=0);
1139
+ assert(oldData->read!=0);
1140
+ assert(serializedDiff!=0);
1141
+ assert(serializedDiff->read!=0);
1142
+
1143
+ //covers
1144
+ if (cached_covers==0){
1145
+ struct _TPackedCovers* packedCovers;
1146
+ if (!_packedCovers_open(&packedCovers,&diffHead,serializedDiff,temp_cache+cacheSize*(_kCachePatCount-3),
1147
+ temp_cache_end)) return _hpatch_FALSE;
1148
+ pcovers=&packedCovers->base.ICovers; //not need close before return
1149
+ }else{
1150
+ pcovers=cached_covers;
1151
+ if (!read_diff_head(&diffHead,serializedDiff)) return _hpatch_FALSE;
1152
+ }
1153
+ //newDataDiff
1154
+ diffPos0=diffHead.coverEndPos;
1155
+ _TStreamCacheClip_init(&code_newDataDiffClip,serializedDiff,diffPos0,
1156
+ diffPos0+diffHead.newDataDiffSize,temp_cache,cacheSize);
1157
+ temp_cache+=cacheSize;
1158
+ diffPos0+=diffHead.newDataDiffSize;
1159
+
1160
+ {//rle
1161
+ hpatch_StreamPos_t rleCtrlSize;
1162
+ hpatch_StreamPos_t rlePos0;
1163
+ TStreamCacheClip* rleHeadClip=&rle_loader.ctrlClip;//rename, share address
1164
+ #ifdef __RUN_MEM_SAFE_CHECK
1165
+ if (cacheSize<hpatch_kMaxPackedUIntBytes) return _hpatch_FALSE;
1166
+ #endif
1167
+ _TStreamCacheClip_init(rleHeadClip,serializedDiff,diffPos0,diffPos_end,
1168
+ temp_cache,hpatch_kMaxPackedUIntBytes);
1169
+ _clip_unpackUIntTo(&rleCtrlSize,rleHeadClip);
1170
+ rlePos0=(hpatch_StreamPos_t)(_TStreamCacheClip_readPosOfSrcStream(rleHeadClip));
1171
+ #ifdef __RUN_MEM_SAFE_CHECK
1172
+ if (rleCtrlSize>(hpatch_StreamPos_t)(diffPos_end-rlePos0)) return _hpatch_FALSE;
1173
+ #endif
1174
+ _TBytesRle_load_stream_init(&rle_loader);
1175
+ _TStreamCacheClip_init(&rle_loader.ctrlClip,serializedDiff,rlePos0,rlePos0+rleCtrlSize,
1176
+ temp_cache,cacheSize);
1177
+ temp_cache+=cacheSize;
1178
+ _TStreamCacheClip_init(&rle_loader.rleCodeClip,serializedDiff,rlePos0+rleCtrlSize,diffPos_end,
1179
+ temp_cache,cacheSize);
1180
+ temp_cache+=cacheSize;
1181
+ }
1182
+ {
1183
+ _TOutStreamCache outCache;
1184
+ _TOutStreamCache_init(&outCache,out_newData,temp_cache,cacheSize);
1185
+ temp_cache+=cacheSize;
1186
+ return patchByClip(&outCache,oldData,pcovers,&code_newDataDiffClip,
1187
+ &rle_loader,temp_cache,cacheSize);
1188
+ }
1189
+ }
1190
+
1191
+
1192
+ hpatch_BOOL read_diffz_head(hpatch_compressedDiffInfo* out_diffInfo,_THDiffzHead* out_head,
1193
+ const hpatch_TStreamInput* compressedDiff){
1194
+ TStreamCacheClip _diffHeadClip;
1195
+ TStreamCacheClip* diffHeadClip=&_diffHeadClip;
1196
+ TByte temp_cache[hpatch_kStreamCacheSize];
1197
+ _TStreamCacheClip_init(&_diffHeadClip,compressedDiff,0,compressedDiff->streamSize,
1198
+ temp_cache,hpatch_kStreamCacheSize);
1199
+ {//type
1200
+ const char* kVersionType="HDIFF13";
1201
+ char* tempType=out_diffInfo->compressType;
1202
+ if (!_TStreamCacheClip_readType_end(diffHeadClip,'&',tempType)) return _hpatch_FALSE;
1203
+ if (0!=strcmp(tempType,kVersionType)) return hpatch_FALSE;
1204
+ }
1205
+ {//read compressType
1206
+ if (!_TStreamCacheClip_readType_end(diffHeadClip,'\0',
1207
+ out_diffInfo->compressType)) return _hpatch_FALSE;
1208
+ out_head->typesEndPos=_TStreamCacheClip_readPosOfSrcStream(diffHeadClip);
1209
+ }
1210
+ _clip_unpackUIntTo(&out_diffInfo->newDataSize,diffHeadClip);
1211
+ _clip_unpackUIntTo(&out_diffInfo->oldDataSize,diffHeadClip);
1212
+ _clip_unpackUIntTo(&out_head->coverCount,diffHeadClip);
1213
+ out_head->compressSizeBeginPos=_TStreamCacheClip_readPosOfSrcStream(diffHeadClip);
1214
+ _clip_unpackUIntTo(&out_head->cover_buf_size,diffHeadClip);
1215
+ _clip_unpackUIntTo(&out_head->compress_cover_buf_size,diffHeadClip);
1216
+ _clip_unpackUIntTo(&out_head->rle_ctrlBuf_size,diffHeadClip);
1217
+ _clip_unpackUIntTo(&out_head->compress_rle_ctrlBuf_size,diffHeadClip);
1218
+ _clip_unpackUIntTo(&out_head->rle_codeBuf_size,diffHeadClip);
1219
+ _clip_unpackUIntTo(&out_head->compress_rle_codeBuf_size,diffHeadClip);
1220
+ _clip_unpackUIntTo(&out_head->newDataDiff_size,diffHeadClip);
1221
+ _clip_unpackUIntTo(&out_head->compress_newDataDiff_size,diffHeadClip);
1222
+ out_head->headEndPos=_TStreamCacheClip_readPosOfSrcStream(diffHeadClip);
1223
+
1224
+ out_diffInfo->compressedCount=((out_head->compress_cover_buf_size)?1:0)
1225
+ +((out_head->compress_rle_ctrlBuf_size)?1:0)
1226
+ +((out_head->compress_rle_codeBuf_size)?1:0)
1227
+ +((out_head->compress_newDataDiff_size)?1:0);
1228
+ if (out_head->compress_cover_buf_size>0)
1229
+ out_head->coverEndPos=out_head->headEndPos+out_head->compress_cover_buf_size;
1230
+ else
1231
+ out_head->coverEndPos=out_head->headEndPos+out_head->cover_buf_size;
1232
+ return hpatch_TRUE;
1233
+ }
1234
+
1235
+ hpatch_BOOL getCompressedDiffInfo(hpatch_compressedDiffInfo* out_diffInfo,
1236
+ const hpatch_TStreamInput* compressedDiff){
1237
+ _THDiffzHead head;
1238
+ assert(out_diffInfo!=0);
1239
+ assert(compressedDiff!=0);
1240
+ assert(compressedDiff->read!=0);
1241
+ return read_diffz_head(out_diffInfo,&head,compressedDiff);
1242
+ }
1243
+
1244
+ #define _clear_return(exitValue) { result=exitValue; goto clear; }
1245
+
1246
+ #define _kCacheDecCount 6
1247
+
1248
+ static
1249
+ hpatch_BOOL _patch_decompress_cache(const hpatch_TStreamOutput* out_newData,
1250
+ const hpatch_TStreamInput* oldData,
1251
+ const hpatch_TStreamInput* compressedDiff,
1252
+ hpatch_TDecompress* decompressPlugin,
1253
+ hpatch_TCovers* cached_covers,
1254
+ TByte* temp_cache, TByte* temp_cache_end){
1255
+ TStreamCacheClip coverClip;
1256
+ TStreamCacheClip code_newDataDiffClip;
1257
+ struct _TBytesRle_load_stream rle_loader;
1258
+ _THDiffzHead head;
1259
+ hpatch_compressedDiffInfo diffInfo;
1260
+ _TDecompressInputStream decompressers[4];
1261
+ hpatch_size_t i;
1262
+ hpatch_StreamPos_t coverCount;
1263
+ hpatch_BOOL result=hpatch_TRUE;
1264
+ hpatch_StreamPos_t diffPos0=0;
1265
+ const hpatch_StreamPos_t diffPos_end=compressedDiff->streamSize;
1266
+ const hpatch_size_t cacheSize=(temp_cache_end-temp_cache)/(cached_covers?(_kCacheDecCount-1):_kCacheDecCount);
1267
+ if (cacheSize<=hpatch_kMaxPluginTypeLength) return _hpatch_FALSE;
1268
+ assert(out_newData!=0);
1269
+ assert(out_newData->write!=0);
1270
+ assert(oldData!=0);
1271
+ assert(oldData->read!=0);
1272
+ assert(compressedDiff!=0);
1273
+ assert(compressedDiff->read!=0);
1274
+ {//head
1275
+ if (!read_diffz_head(&diffInfo,&head,compressedDiff)) return _hpatch_FALSE;
1276
+ if ((diffInfo.oldDataSize!=oldData->streamSize)
1277
+ ||(diffInfo.newDataSize!=out_newData->streamSize)) return _hpatch_FALSE;
1278
+
1279
+ if ((decompressPlugin==0)&&(diffInfo.compressedCount!=0)) return _hpatch_FALSE;
1280
+ if ((decompressPlugin)&&(diffInfo.compressedCount>0))
1281
+ if (!decompressPlugin->is_can_open(diffInfo.compressType)) return _hpatch_FALSE;
1282
+ diffPos0=head.headEndPos;
1283
+ }
1284
+
1285
+ for (i=0;i<sizeof(decompressers)/sizeof(_TDecompressInputStream);++i)
1286
+ decompressers[i].decompressHandle=0;
1287
+ _TBytesRle_load_stream_init(&rle_loader);
1288
+
1289
+ if (cached_covers){
1290
+ diffPos0=head.coverEndPos;
1291
+ }else{
1292
+ if (!getStreamClip(&coverClip,&decompressers[0],
1293
+ head.cover_buf_size,head.compress_cover_buf_size,compressedDiff,&diffPos0,
1294
+ decompressPlugin,temp_cache+cacheSize*(_kCacheDecCount-1),cacheSize)) _clear_return(_hpatch_FALSE);
1295
+ }
1296
+ if (!getStreamClip(&rle_loader.ctrlClip,&decompressers[1],
1297
+ head.rle_ctrlBuf_size,head.compress_rle_ctrlBuf_size,compressedDiff,&diffPos0,
1298
+ decompressPlugin,temp_cache,cacheSize)) _clear_return(_hpatch_FALSE);
1299
+ temp_cache+=cacheSize;
1300
+ if (!getStreamClip(&rle_loader.rleCodeClip,&decompressers[2],
1301
+ head.rle_codeBuf_size,head.compress_rle_codeBuf_size,compressedDiff,&diffPos0,
1302
+ decompressPlugin,temp_cache,cacheSize)) _clear_return(_hpatch_FALSE);
1303
+ temp_cache+=cacheSize;
1304
+ if (!getStreamClip(&code_newDataDiffClip,&decompressers[3],
1305
+ head.newDataDiff_size,head.compress_newDataDiff_size,compressedDiff,&diffPos0,
1306
+ decompressPlugin,temp_cache,cacheSize)) _clear_return(_hpatch_FALSE);
1307
+ temp_cache+=cacheSize;
1308
+ #ifdef __RUN_MEM_SAFE_CHECK
1309
+ if (diffPos0!=diffPos_end) _clear_return(_hpatch_FALSE);
1310
+ #endif
1311
+
1312
+ coverCount=head.coverCount;
1313
+ {
1314
+ _TCovers covers;
1315
+ hpatch_TCovers* pcovers=0;
1316
+ _TOutStreamCache outCache;
1317
+ _TOutStreamCache_init(&outCache,out_newData,temp_cache,cacheSize);
1318
+ temp_cache+=cacheSize;
1319
+ if (cached_covers){
1320
+ pcovers=cached_covers;
1321
+ }else{
1322
+ _covers_init(&covers,coverCount,&coverClip,&coverClip,&coverClip,hpatch_TRUE);
1323
+ pcovers=&covers.ICovers; //not need close before return
1324
+ }
1325
+ result=patchByClip(&outCache,oldData,pcovers,&code_newDataDiffClip,&rle_loader,
1326
+ temp_cache,cacheSize);
1327
+ //if ((pcovers!=cached_covers)&&(!pcovers->close(pcovers))) result=_hpatch_FALSE;
1328
+ }
1329
+ clear:
1330
+ for (i=0;i<sizeof(decompressers)/sizeof(_TDecompressInputStream);++i) {
1331
+ if (decompressers[i].decompressHandle){
1332
+ if (!decompressPlugin->close(decompressPlugin,decompressers[i].decompressHandle))
1333
+ result=_hpatch_FALSE;
1334
+ decompressers[i].decompressHandle=0;
1335
+ }
1336
+ }
1337
+ return result;
1338
+ }
1339
+
1340
+
1341
+ hpatch_inline static hpatch_BOOL _cache_load_all(const hpatch_TStreamInput* data,
1342
+ TByte* cache,TByte* cache_end){
1343
+ assert((hpatch_size_t)(cache_end-cache)==data->streamSize);
1344
+ return data->read(data,0,cache,cache_end);
1345
+ }
1346
+
1347
+ typedef struct _TCompressedCovers{
1348
+ _TCovers base;
1349
+ TStreamCacheClip coverClip;
1350
+ _TDecompressInputStream decompresser;
1351
+ } _TCompressedCovers;
1352
+
1353
+ static hpatch_BOOL _compressedCovers_close(hpatch_TCovers* covers){
1354
+ hpatch_BOOL result=hpatch_TRUE;
1355
+ _TCompressedCovers* self=(_TCompressedCovers*)covers;
1356
+ if (self){
1357
+ if (self->decompresser.decompressHandle){
1358
+ result=self->decompresser.decompressPlugin->close(self->decompresser.decompressPlugin,
1359
+ self->decompresser.decompressHandle);
1360
+ self->decompresser.decompressHandle=0;
1361
+ }
1362
+ }
1363
+ return result;
1364
+ }
1365
+
1366
+ static hpatch_BOOL _compressedCovers_open(_TCompressedCovers** out_self,
1367
+ hpatch_compressedDiffInfo* out_diffInfo,
1368
+ const hpatch_TStreamInput* compressedDiff,
1369
+ hpatch_TDecompress* decompressPlugin,
1370
+ TByte* temp_cache,TByte* temp_cache_end){
1371
+ _THDiffzHead head;
1372
+ hpatch_StreamPos_t diffPos0=0;
1373
+ _TCompressedCovers* self=0;
1374
+ _cache_alloc(self,_TCompressedCovers,sizeof(_TCompressedCovers),temp_cache,temp_cache_end);
1375
+ if (!read_diffz_head(out_diffInfo,&head,compressedDiff)) return _hpatch_FALSE;
1376
+ diffPos0=head.headEndPos;
1377
+ if (head.compress_cover_buf_size>0){
1378
+ if (decompressPlugin==0) return _hpatch_FALSE;
1379
+ if (!decompressPlugin->is_can_open(out_diffInfo->compressType)) return _hpatch_FALSE;
1380
+ }
1381
+
1382
+ _covers_init(&self->base,head.coverCount,&self->coverClip,
1383
+ &self->coverClip,&self->coverClip,hpatch_TRUE);
1384
+ self->base.ICovers.close=_compressedCovers_close;
1385
+ memset(&self->decompresser,0, sizeof(self->decompresser));
1386
+ if (!getStreamClip(&self->coverClip,&self->decompresser,
1387
+ head.cover_buf_size,head.compress_cover_buf_size,
1388
+ compressedDiff,&diffPos0,decompressPlugin,
1389
+ temp_cache,temp_cache_end-temp_cache)) {
1390
+ return _hpatch_FALSE;
1391
+ };
1392
+ *out_self=self;
1393
+ return hpatch_TRUE;
1394
+ }
1395
+
1396
+ #if (_IS_NEED_CACHE_OLD_BY_COVERS)
1397
+
1398
+ typedef struct _TArrayCovers{
1399
+ hpatch_TCovers ICovers;
1400
+ void* pCCovers;
1401
+ hpatch_size_t coverCount;
1402
+ hpatch_size_t cur_index;
1403
+ hpatch_BOOL is32;
1404
+ } _TArrayCovers;
1405
+
1406
+
1407
+ typedef struct hpatch_TCCover32{
1408
+ hpatch_uint32_t oldPos;
1409
+ hpatch_uint32_t newPos;
1410
+ hpatch_uint32_t length;
1411
+ hpatch_uint32_t cachePos; //Consider moving to temporary memory and releasing after use? Logic would be more complex;
1412
+ } hpatch_TCCover32;
1413
+
1414
+ typedef struct hpatch_TCCover64{
1415
+ hpatch_StreamPos_t oldPos;
1416
+ hpatch_StreamPos_t newPos;
1417
+ hpatch_StreamPos_t length;
1418
+ hpatch_StreamPos_t cachePos;
1419
+ } hpatch_TCCover64;
1420
+
1421
+ #define _arrayCovers_get(self,i,item) (((self)->is32)? \
1422
+ ((const hpatch_uint32_t*)(self)->pCCovers)[(i)*4+(item)]:\
1423
+ ((const hpatch_StreamPos_t*)(self)->pCCovers)[(i)*4+(item)])
1424
+ #define _arrayCovers_get_oldPos(self,i) _arrayCovers_get(self,i,0)
1425
+ #define _arrayCovers_get_len(self,i) _arrayCovers_get(self,i,2)
1426
+ #define _arrayCovers_get_cachePos(self,i) _arrayCovers_get(self,i,3)
1427
+
1428
+ #define _arrayCovers_set(self,i,item,v) { if ((self)->is32){ \
1429
+ ((hpatch_uint32_t*)(self)->pCCovers)[(i)*4+(item)]=(hpatch_uint32_t)(v); }else{ \
1430
+ ((hpatch_StreamPos_t*)(self)->pCCovers)[(i)*4+(item)]=(v); } }
1431
+ #define _arrayCovers_set_cachePos(self,i,v) _arrayCovers_set(self,i,3,v)
1432
+
1433
+ hpatch_inline static hpatch_StreamPos_t arrayCovers_memSize(hpatch_StreamPos_t coverCount,hpatch_BOOL is32){
1434
+ return coverCount*(is32?sizeof(hpatch_TCCover32):sizeof(hpatch_TCCover64));
1435
+ }
1436
+
1437
+ static hpatch_BOOL _arrayCovers_is_finish(const hpatch_TCovers* covers){
1438
+ const _TArrayCovers* self=(const _TArrayCovers*)covers;
1439
+ return (self->coverCount==self->cur_index);
1440
+ }
1441
+ static hpatch_StreamPos_t _arrayCovers_leaveCoverCount(const hpatch_TCovers* covers){
1442
+ const _TArrayCovers* self=(const _TArrayCovers*)covers;
1443
+ return self->coverCount-self->cur_index;
1444
+ }
1445
+ static hpatch_BOOL _arrayCovers_read_cover(struct hpatch_TCovers* covers,hpatch_TCover* out_cover){
1446
+ _TArrayCovers* self=(_TArrayCovers*)covers;
1447
+ hpatch_size_t i=self->cur_index;
1448
+ if (i<self->coverCount){
1449
+ if (self->is32){
1450
+ const hpatch_TCCover32* pCover=((const hpatch_TCCover32*)self->pCCovers)+i;
1451
+ out_cover->oldPos=pCover->oldPos;
1452
+ out_cover->newPos=pCover->newPos;
1453
+ out_cover->length=pCover->length;
1454
+ }else{
1455
+ const hpatch_TCCover64* pCover=((const hpatch_TCCover64*)self->pCCovers)+i;
1456
+ out_cover->oldPos=pCover->oldPos;
1457
+ out_cover->newPos=pCover->newPos;
1458
+ out_cover->length=pCover->length;
1459
+ }
1460
+ self->cur_index=i+1;
1461
+ return hpatch_TRUE;
1462
+ }else{
1463
+ return _hpatch_FALSE;
1464
+ }
1465
+ }
1466
+
1467
+ static hpatch_force_inline void _arrayCovers_push_cover(_TArrayCovers* self,const hpatch_TCover* cover){
1468
+ hpatch_size_t i=self->coverCount;
1469
+ if (self->is32){
1470
+ hpatch_TCCover32* pCover=((hpatch_TCCover32*)self->pCCovers)+i;
1471
+ pCover->oldPos=(hpatch_uint32_t)cover->oldPos;
1472
+ pCover->newPos=(hpatch_uint32_t)cover->newPos;
1473
+ pCover->length=(hpatch_uint32_t)cover->length;
1474
+ }else{
1475
+ hpatch_TCCover64* pCover=((hpatch_TCCover64*)self->pCCovers)+i;
1476
+ pCover->oldPos=cover->oldPos;
1477
+ pCover->newPos=cover->newPos;
1478
+ pCover->length=cover->length;
1479
+ }
1480
+ self->coverCount=i+1;
1481
+ }
1482
+
1483
+ static hpatch_BOOL _arrayCovers_load(_TArrayCovers** out_self,hpatch_TCovers* src_covers,
1484
+ hpatch_BOOL isUsedCover32,hpatch_BOOL* out_isReadError,
1485
+ TByte** ptemp_cache,TByte* temp_cache_end){
1486
+ TByte* temp_cache=*ptemp_cache;
1487
+ hpatch_StreamPos_t _coverCount=src_covers->leave_cover_count(src_covers);
1488
+ hpatch_StreamPos_t memSize=arrayCovers_memSize(_coverCount,isUsedCover32);
1489
+ hpatch_size_t i;
1490
+ void* pCovers;
1491
+ _TArrayCovers* self=0;
1492
+ hpatch_size_t coverCount=(hpatch_size_t)_coverCount;
1493
+
1494
+ *out_isReadError=hpatch_FALSE;
1495
+ if (coverCount!=_coverCount) return hpatch_FALSE;
1496
+
1497
+ _cache_alloc(self,_TArrayCovers,sizeof(_TArrayCovers),temp_cache,temp_cache_end);
1498
+ _cache_alloc(pCovers,void,memSize,temp_cache,temp_cache_end);
1499
+ if (isUsedCover32){
1500
+ hpatch_TCCover32* pdst=(hpatch_TCCover32*)pCovers;
1501
+ for (i=0;i<coverCount;++i,++pdst) {
1502
+ hpatch_TCover cover;
1503
+ if (!src_covers->read_cover(src_covers,&cover))
1504
+ { *out_isReadError=hpatch_TRUE; return _hpatch_FALSE; }
1505
+ pdst->oldPos=(hpatch_uint32_t)cover.oldPos;
1506
+ pdst->newPos=(hpatch_uint32_t)cover.newPos;
1507
+ pdst->length=(hpatch_uint32_t)cover.length;
1508
+ }
1509
+ }else{
1510
+ hpatch_TCCover64* pdst=(hpatch_TCCover64*)pCovers;
1511
+ for (i=0;i<coverCount;++i,++pdst) {
1512
+ if (!src_covers->read_cover(src_covers,(hpatch_TCover*)pdst))
1513
+ { *out_isReadError=hpatch_TRUE; return _hpatch_FALSE; }
1514
+ }
1515
+ }
1516
+ if (!src_covers->is_finish(src_covers))
1517
+ { *out_isReadError=hpatch_TRUE; return _hpatch_FALSE; }
1518
+
1519
+ self->pCCovers=pCovers;
1520
+ self->is32=isUsedCover32;
1521
+ self->coverCount=coverCount;
1522
+ self->cur_index=0;
1523
+ self->ICovers.close=_covers_close_nil;
1524
+ self->ICovers.is_finish=_arrayCovers_is_finish;
1525
+ self->ICovers.leave_cover_count=_arrayCovers_leaveCoverCount;
1526
+ self->ICovers.read_cover=_arrayCovers_read_cover;
1527
+ *out_self=self;
1528
+ *ptemp_cache=temp_cache;
1529
+ return hpatch_TRUE;
1530
+ }
1531
+
1532
+ #define _arrayCovers_comp(_uint_t,_x,_y,item){ \
1533
+ _uint_t x=((const _uint_t*)_x)[item]; \
1534
+ _uint_t y=((const _uint_t*)_y)[item]; \
1535
+ return (x<y)?(-1):((x>y)?1:0); \
1536
+ }
1537
+ #ifdef _MSC_VER
1538
+ # define __CALL_BACK_C __cdecl
1539
+ #else
1540
+ # define __CALL_BACK_C
1541
+ #endif
1542
+ static hpatch_int __CALL_BACK_C _arrayCovers_comp_by_old_32(const void* _x, const void *_y){
1543
+ _arrayCovers_comp(hpatch_uint32_t,_x,_y,0);
1544
+ }
1545
+ static hpatch_int __CALL_BACK_C _arrayCovers_comp_by_old(const void* _x, const void *_y){
1546
+ _arrayCovers_comp(hpatch_StreamPos_t,_x,_y,0);
1547
+ }
1548
+ static hpatch_int __CALL_BACK_C _arrayCovers_comp_by_new_32(const void* _x, const void *_y){
1549
+ _arrayCovers_comp(hpatch_uint32_t,_x,_y,1);
1550
+ }
1551
+ static hpatch_int __CALL_BACK_C _arrayCovers_comp_by_new(const void* _x, const void *_y){
1552
+ _arrayCovers_comp(hpatch_StreamPos_t,_x,_y,1);
1553
+ }
1554
+ static hpatch_int __CALL_BACK_C _arrayCovers_comp_by_len_32(const void* _x, const void *_y){
1555
+ _arrayCovers_comp(hpatch_uint32_t,_x,_y,2);
1556
+ }
1557
+ static hpatch_int __CALL_BACK_C _arrayCovers_comp_by_len(const void* _x, const void *_y){
1558
+ _arrayCovers_comp(hpatch_StreamPos_t,_x,_y,2);
1559
+ }
1560
+
1561
+ hpatch_force_inline
1562
+ static void _arrayCovers_sort_by_old(_TArrayCovers* self){
1563
+ if (self->is32)
1564
+ qsort(self->pCCovers,self->coverCount,sizeof(hpatch_TCCover32),_arrayCovers_comp_by_old_32);
1565
+ else
1566
+ qsort(self->pCCovers,self->coverCount,sizeof(hpatch_TCCover64),_arrayCovers_comp_by_old);
1567
+ }
1568
+ hpatch_force_inline
1569
+ static void _arrayCovers_sort_by_new(_TArrayCovers* self){
1570
+ if (self->is32)
1571
+ qsort(self->pCCovers,self->coverCount,sizeof(hpatch_TCCover32),_arrayCovers_comp_by_new_32);
1572
+ else
1573
+ qsort(self->pCCovers,self->coverCount,sizeof(hpatch_TCCover64),_arrayCovers_comp_by_new);
1574
+ }
1575
+ hpatch_force_inline
1576
+ static void _arrayCovers_sort_by_len(_TArrayCovers* self){
1577
+ if (self->is32)
1578
+ qsort(self->pCCovers,self->coverCount,sizeof(hpatch_TCCover32),_arrayCovers_comp_by_len_32);
1579
+ else
1580
+ qsort(self->pCCovers,self->coverCount,sizeof(hpatch_TCCover64),_arrayCovers_comp_by_len);
1581
+ }
1582
+
1583
+ static hpatch_StreamPos_t _getCacheSumLen(const _TArrayCovers* src_covers,hpatch_StreamPos_t maxCachedLen){
1584
+ const hpatch_size_t coverCount=src_covers->coverCount;
1585
+ hpatch_StreamPos_t sumLen=0;
1586
+ hpatch_size_t i;
1587
+ for (i=0; i<coverCount;++i) {
1588
+ hpatch_StreamPos_t mlen=_arrayCovers_get_len(src_covers,i);
1589
+ sumLen+=(mlen<=maxCachedLen)?mlen:0;
1590
+ }
1591
+ return sumLen;
1592
+ }
1593
+
1594
+ static hpatch_size_t _getMaxCachedLen(_TArrayCovers* arrayCovers,hpatch_size_t cacheSize){
1595
+ const hpatch_size_t kMaxCachedLen =(~((hpatch_size_t)0))/2;//max allowed length for a single cached data item;
1596
+ hpatch_StreamPos_t mlen=0;
1597
+ hpatch_StreamPos_t sum=0;
1598
+ const hpatch_size_t coverCount=arrayCovers->coverCount;
1599
+ hpatch_size_t i;
1600
+ _arrayCovers_sort_by_len(arrayCovers);
1601
+
1602
+ for (i=0; i<coverCount;++i) {
1603
+ mlen=_arrayCovers_get_len(arrayCovers,i);
1604
+ sum+=mlen;
1605
+ if (sum<=cacheSize){
1606
+ continue;
1607
+ }else{
1608
+ --mlen;
1609
+ break;
1610
+ }
1611
+ }
1612
+ if (mlen>kMaxCachedLen)
1613
+ mlen=kMaxCachedLen;
1614
+ _arrayCovers_sort_by_new(arrayCovers);
1615
+ return (hpatch_size_t)mlen;
1616
+ }
1617
+
1618
+ static hpatch_size_t _set_cache_pos(_TArrayCovers* covers,hpatch_size_t maxCachedLen,
1619
+ hpatch_StreamPos_t* poldPosBegin,hpatch_StreamPos_t* poldPosEnd,
1620
+ hpatch_size_t kMinCacheCoverCount){
1621
+ const hpatch_size_t coverCount=covers->coverCount;
1622
+ hpatch_StreamPos_t oldPosBegin=hpatch_kNullStreamPos;
1623
+ hpatch_StreamPos_t oldPosEnd=0;
1624
+ hpatch_size_t cacheCoverCount=0;
1625
+ hpatch_size_t sum=0;//result
1626
+ hpatch_size_t i;
1627
+ for (i=0; i<coverCount;++i) {
1628
+ hpatch_StreamPos_t clen=_arrayCovers_get_len(covers,i);
1629
+ if (clen<=maxCachedLen){
1630
+ hpatch_StreamPos_t oldPos;
1631
+ _arrayCovers_set_cachePos(covers,i,sum);
1632
+ sum+=(hpatch_size_t)clen;
1633
+ ++cacheCoverCount;
1634
+
1635
+ oldPos=_arrayCovers_get_oldPos(covers,i);
1636
+ if (oldPos<oldPosBegin) oldPosBegin=oldPos;
1637
+ if (oldPos+clen>oldPosEnd) oldPosEnd=oldPos+clen;
1638
+ }
1639
+ }
1640
+ if (cacheCoverCount<kMinCacheCoverCount)
1641
+ return 0;//fail
1642
+ *poldPosBegin=oldPosBegin;
1643
+ *poldPosEnd=oldPosEnd;
1644
+ return sum;
1645
+ }
1646
+
1647
+ //a simple caching strategy:
1648
+ // 1. select a batch of shortest cover lines to cache based on buffer size limit;
1649
+ // 2. sequentially access the oldData file once to fill these caches;
1650
+ // 3. skip large intermediate regions that are useless for caching during sequential access;
1651
+
1652
+ static hpatch_BOOL _cache_old_load(const hpatch_TStreamInput*oldData,
1653
+ hpatch_StreamPos_t oldPos,hpatch_StreamPos_t oldPosAllEnd,
1654
+ _TArrayCovers* arrayCovers,hpatch_size_t maxCachedLen,hpatch_size_t sumCacheLen,
1655
+ TByte* old_cache,TByte* old_cache_end,TByte* cache_buf_end){
1656
+ const hpatch_size_t kMinSpaceLen =(1<<18);//skip space of length seekTime*speed (can be smaller for SSD) if time-efficient, otherwise sequential access;
1657
+ const hpatch_size_t kAccessPageSize=4096;//disk page-aligned access (affects only speed, but impact is minimal);
1658
+ hpatch_BOOL result=hpatch_TRUE;
1659
+ hpatch_size_t cur_i=0,i;
1660
+ const hpatch_size_t coverCount=arrayCovers->coverCount;
1661
+ TByte* cache_buf=old_cache_end;
1662
+ assert((hpatch_size_t)(old_cache_end-old_cache)>=sumCacheLen);
1663
+
1664
+ if ((hpatch_size_t)(cache_buf_end-cache_buf)>=kAccessPageSize*2){
1665
+ cache_buf=(TByte*)_hpatch_align_upper(cache_buf,kAccessPageSize);
1666
+ if ((hpatch_size_t)(cache_buf_end-cache_buf)>=(kMinSpaceLen>>1))
1667
+ cache_buf_end=cache_buf+(kMinSpaceLen>>1);
1668
+ else
1669
+ cache_buf_end=(TByte*)_hpatch_align_lower(cache_buf_end,kAccessPageSize);
1670
+ }
1671
+ oldPos=_hpatch_align_type_lower(hpatch_StreamPos_t,oldPos,kAccessPageSize);
1672
+ if (oldPos<kMinSpaceLen) oldPos=0;
1673
+
1674
+ _arrayCovers_sort_by_old(arrayCovers);
1675
+ while ((oldPos<oldPosAllEnd)&(cur_i<coverCount)) {
1676
+ hpatch_StreamPos_t oldPosEnd;
1677
+ hpatch_size_t readLen=(cache_buf_end-cache_buf);
1678
+ if (readLen>(oldPosAllEnd-oldPos)) readLen=(hpatch_size_t)(oldPosAllEnd-oldPos);
1679
+ if (!oldData->read(oldData,oldPos,cache_buf,
1680
+ cache_buf+readLen)) { result=_hpatch_FALSE; break; } //error
1681
+ oldPosEnd=oldPos+readLen;
1682
+ for (i=cur_i;i<coverCount;++i){
1683
+ hpatch_StreamPos_t ioldPos,ioldPosEnd;
1684
+ hpatch_StreamPos_t ilen=_arrayCovers_get_len(arrayCovers,i);
1685
+ if (ilen>maxCachedLen){//cover line too long to cache, proceed to next cover line;
1686
+ if (i==cur_i)
1687
+ ++cur_i;
1688
+ continue;
1689
+ }
1690
+ ioldPos=_arrayCovers_get_oldPos(arrayCovers,i);
1691
+ ioldPosEnd=ioldPos+ilen;
1692
+ if (ioldPosEnd>oldPos){
1693
+ // [oldPos oldPosEnd]
1694
+ // ioldPosEnd]----or----]
1695
+ if (ioldPos<oldPosEnd){//intersection exists, needs cache
1696
+ // [----or----[ioldPos ioldPosEnd]----or----]
1697
+ hpatch_StreamPos_t from;
1698
+ hpatch_size_t copyLen;
1699
+ hpatch_StreamPos_t dstPos=_arrayCovers_get_cachePos(arrayCovers,i);
1700
+ //assert(dstPos<=(hpatch_size_t)(old_cache_end-old_cache));
1701
+ if (ioldPos>=oldPos){
1702
+ // [ioldPos ioldPosEnd]----or----]
1703
+ from=ioldPos;
1704
+ }else{
1705
+ // [ioldPos ioldPosEnd]----or----]
1706
+ from=oldPos;
1707
+ dstPos+=(oldPos-ioldPos);
1708
+ }
1709
+ copyLen=(hpatch_size_t)(((ioldPosEnd<=oldPosEnd)?ioldPosEnd:oldPosEnd)-from);
1710
+ //assert(dstPos+copyLen<=(hpatch_size_t)(old_cache_end-old_cache));
1711
+ //assert(sumCacheLen>=copyLen);
1712
+ memcpy(old_cache+(hpatch_size_t)dstPos,cache_buf+(from-oldPos),copyLen);
1713
+ sumCacheLen-=copyLen;
1714
+ if ((i==cur_i)&(oldPosEnd>=ioldPosEnd))
1715
+ ++cur_i;
1716
+ }else{//no more intersections with current data for following cover lines, move to next data block;
1717
+ // [oldPos oldPosEnd]
1718
+ // [ioldPos ioldPosEnd]
1719
+ if ((i==cur_i)&&(ioldPos-oldPosEnd>=kMinSpaceLen))
1720
+ oldPosEnd=_hpatch_align_type_lower(hpatch_StreamPos_t,ioldPos,kAccessPageSize);
1721
+ break;
1722
+ }
1723
+ }else{//current cover line is behind current data, proceed to next cover line;
1724
+ // [oldPos oldPosEnd]
1725
+ // [ioldPos ioldPosEnd]
1726
+ if (i==cur_i)
1727
+ ++cur_i;
1728
+ }
1729
+ }
1730
+ oldPos=oldPosEnd;
1731
+ }
1732
+ _arrayCovers_sort_by_new(arrayCovers);
1733
+ assert(sumCacheLen==0);
1734
+ return result;
1735
+ }
1736
+
1737
+ typedef struct _cache_old_TStreamInput{
1738
+ _TArrayCovers arrayCovers;
1739
+ hpatch_BOOL isInHitCache;
1740
+ hpatch_size_t maxCachedLen;
1741
+ hpatch_StreamPos_t readFromPos;
1742
+ hpatch_StreamPos_t readFromPosEnd;
1743
+ const TByte* caches;
1744
+ const TByte* cachesEnd;
1745
+ const hpatch_TStreamInput* oldData;
1746
+ void* _cacheImport;
1747
+ hpatch_BOOL (*_doUpdateCacheCovers)(void* _cacheImport);
1748
+ } _cache_old_TStreamInput;
1749
+
1750
+ static hpatch_BOOL _cache_old_StreamInput_read(const hpatch_TStreamInput* stream,
1751
+ hpatch_StreamPos_t readFromPos,
1752
+ unsigned char* out_data,unsigned char* out_data_end){
1753
+ _cache_old_TStreamInput* self=(_cache_old_TStreamInput*)stream->streamImport;
1754
+ hpatch_size_t readLen;
1755
+ hpatch_StreamPos_t dataLen=(hpatch_size_t)(self->readFromPosEnd-self->readFromPos);
1756
+ if (dataLen==0){//next cover
1757
+ hpatch_StreamPos_t oldPos;
1758
+ hpatch_size_t i=self->arrayCovers.cur_index++;
1759
+ if (i>=self->arrayCovers.coverCount){
1760
+ if ((self->_doUpdateCacheCovers)&&(self->_doUpdateCacheCovers(self->_cacheImport))){
1761
+ i=self->arrayCovers.cur_index++;
1762
+ if (i>=self->arrayCovers.coverCount)
1763
+ return _hpatch_FALSE;//update error;
1764
+ }else
1765
+ return _hpatch_FALSE;//error;
1766
+ }
1767
+ oldPos=_arrayCovers_get_oldPos(&self->arrayCovers,i);
1768
+ dataLen=_arrayCovers_get_len(&self->arrayCovers,i);
1769
+ self->isInHitCache=(dataLen<=self->maxCachedLen);
1770
+ self->readFromPos=oldPos;
1771
+ self->readFromPosEnd=oldPos+dataLen;
1772
+ }
1773
+ readLen=out_data_end-out_data;
1774
+ if ((readLen>dataLen)|(self->readFromPos!=readFromPos)) return _hpatch_FALSE; //error
1775
+ self->readFromPos=readFromPos+readLen;
1776
+ if (self->isInHitCache){
1777
+ assert(readLen<=(hpatch_size_t)(self->cachesEnd-self->caches));
1778
+ memcpy(out_data,self->caches,readLen);
1779
+ self->caches+=readLen;
1780
+ return hpatch_TRUE;
1781
+ }else{
1782
+ return self->oldData->read(self->oldData,readFromPos,out_data,out_data_end);
1783
+ }
1784
+ }
1785
+
1786
+ static hpatch_BOOL _cache_old(hpatch_TStreamInput** out_cachedOld,const hpatch_TStreamInput* oldData,
1787
+ _TArrayCovers* arrayCovers,hpatch_BOOL* out_isReadError,
1788
+ TByte* temp_cache,TByte** ptemp_cache_end,TByte* cache_buf_end){
1789
+ _cache_old_TStreamInput* self;
1790
+ TByte* temp_cache_end=*ptemp_cache_end;
1791
+ hpatch_StreamPos_t oldPosBegin;
1792
+ hpatch_StreamPos_t oldPosEnd;
1793
+ hpatch_size_t sumCacheLen;
1794
+ hpatch_size_t maxCachedLen;
1795
+ const hpatch_size_t kMinCacheCoverCount=arrayCovers->coverCount/8+1; //control min cache count, otherwise caching becomes ineffective;
1796
+ *out_isReadError=hpatch_FALSE;
1797
+ _cache_alloc(*out_cachedOld,hpatch_TStreamInput,sizeof(hpatch_TStreamInput),
1798
+ temp_cache,temp_cache_end);
1799
+ _cache_alloc(self,_cache_old_TStreamInput,sizeof(_cache_old_TStreamInput),
1800
+ temp_cache,temp_cache_end);
1801
+
1802
+ maxCachedLen=_getMaxCachedLen(arrayCovers,temp_cache_end-temp_cache);
1803
+ if (maxCachedLen==0) return hpatch_FALSE;
1804
+ sumCacheLen=_set_cache_pos(arrayCovers,maxCachedLen,&oldPosBegin,&oldPosEnd,kMinCacheCoverCount);
1805
+ if (sumCacheLen==0) return hpatch_FALSE;
1806
+ temp_cache_end=temp_cache+sumCacheLen;
1807
+
1808
+ if (!_cache_old_load(oldData,oldPosBegin,oldPosEnd,arrayCovers,maxCachedLen,sumCacheLen,
1809
+ temp_cache,temp_cache_end,cache_buf_end))
1810
+ { *out_isReadError=hpatch_TRUE; return _hpatch_FALSE; }
1811
+
1812
+ {//out
1813
+ self->arrayCovers=*arrayCovers;
1814
+ self->arrayCovers.cur_index=0;
1815
+ self->isInHitCache=hpatch_FALSE;
1816
+ self->maxCachedLen=maxCachedLen;
1817
+ self->caches=temp_cache;
1818
+ self->cachesEnd=temp_cache_end;
1819
+ self->readFromPos=0;
1820
+ self->readFromPosEnd=0;
1821
+ self->oldData=oldData;
1822
+ (*out_cachedOld)->streamImport=self;
1823
+ (*out_cachedOld)->streamSize=oldData->streamSize;
1824
+ (*out_cachedOld)->read=_cache_old_StreamInput_read;
1825
+ *ptemp_cache_end=temp_cache_end;
1826
+ }
1827
+ return hpatch_TRUE;
1828
+ }
1829
+
1830
+ #endif //_IS_NEED_CACHE_OLD_BY_COVERS
1831
+
1832
+ #if (_IS_NEED_CACHE_OLD_ALL)
1833
+ hpatch_BOOL _patch_cache_all_old(const hpatch_TStreamInput** poldData,size_t kMinTempCacheSize,
1834
+ TByte** ptemp_cache,TByte** ptemp_cache_end,hpatch_BOOL* out_isReadError){
1835
+ const hpatch_TStreamInput* oldData=*poldData;
1836
+ TByte* temp_cache=*ptemp_cache;
1837
+ TByte* temp_cache_end=*ptemp_cache_end;
1838
+ *out_isReadError=hpatch_FALSE;
1839
+ if (_patch_is_can_cache_all_old(oldData->streamSize,kMinTempCacheSize,temp_cache_end-temp_cache)){//load all oldData
1840
+ hpatch_TStreamInput* replace_oldData=0;
1841
+ _cache_alloc(replace_oldData,hpatch_TStreamInput,sizeof(hpatch_TStreamInput),
1842
+ temp_cache,temp_cache_end);
1843
+ if (!_cache_load_all(oldData,temp_cache_end-oldData->streamSize,
1844
+ temp_cache_end)){ *out_isReadError=hpatch_TRUE; return _hpatch_FALSE; }
1845
+
1846
+ mem_as_hStreamInput(replace_oldData,temp_cache_end-oldData->streamSize,temp_cache_end);
1847
+ temp_cache_end-=oldData->streamSize;
1848
+ // [ patch cache | oldData cache ]
1849
+ // [ (cacheSize-oldData->streamSize) | (oldData->streamSize) ]
1850
+ *poldData=replace_oldData;
1851
+ *ptemp_cache=temp_cache;
1852
+ *ptemp_cache_end=temp_cache_end;
1853
+ return hpatch_TRUE;
1854
+ }
1855
+ return hpatch_FALSE;
1856
+ }
1857
+ #endif //_IS_NEED_CACHE_OLD_ALL
1858
+
1859
+ static hpatch_BOOL _patch_cache(hpatch_TCovers** out_covers,
1860
+ const hpatch_TStreamInput** poldData,hpatch_StreamPos_t newDataSize,
1861
+ const hpatch_TStreamInput* diffData,hpatch_BOOL isCompressedDiff,
1862
+ hpatch_TDecompress* decompressPlugin,size_t kCacheCount,
1863
+ TByte** ptemp_cache,TByte** ptemp_cache_end,hpatch_BOOL* out_isReadError){
1864
+ const hpatch_TStreamInput* oldData=*poldData;
1865
+ #if (_IS_NEED_CACHE_OLD_BY_COVERS)
1866
+ const hpatch_size_t kBestACacheSize=hpatch_kFileIOBufBetterSize; //optimal hpatch_kStreamCacheSize value when sufficient memory is available;
1867
+ const hpatch_size_t _minActiveSize=(1<<20)*3+kBestACacheSize*kCacheCount*2;
1868
+ const hpatch_StreamPos_t _betterActiveSize=oldData->streamSize/16+kBestACacheSize*kCacheCount*2;
1869
+ const hpatch_size_t kActiveCacheOldMemorySize = //min memory threshold for attempting to activate CacheOld functionality;
1870
+ (_minActiveSize>_betterActiveSize)?_minActiveSize:(hpatch_size_t)_betterActiveSize;
1871
+ #endif //_IS_NEED_CACHE_OLD_BY_COVERS
1872
+ TByte* temp_cache=*ptemp_cache;
1873
+ TByte* temp_cache_end=*ptemp_cache_end;
1874
+ *out_covers=0;
1875
+ if (_patch_cache_all_old(poldData,kCacheCount*hpatch_kStreamCacheSize,ptemp_cache,ptemp_cache_end,out_isReadError))
1876
+ return hpatch_TRUE;//cache all oldData
1877
+ if (*out_isReadError) return hpatch_FALSE;
1878
+ #if (_IS_NEED_CACHE_OLD_BY_COVERS)
1879
+ if ((hpatch_size_t)(temp_cache_end-temp_cache)>=kActiveCacheOldMemorySize) {// try cache part of oldData
1880
+ hpatch_BOOL isUsedCover32;
1881
+ TByte* temp_cache_end_back=temp_cache_end;
1882
+ _TArrayCovers* arrayCovers=0;
1883
+ assert((hpatch_size_t)(temp_cache_end-temp_cache)>kBestACacheSize*kCacheCount);
1884
+ assert(kBestACacheSize>sizeof(_TCompressedCovers)+sizeof(_TPackedCovers));
1885
+ if (isCompressedDiff){
1886
+ hpatch_compressedDiffInfo diffInfo;
1887
+ _TCompressedCovers* compressedCovers=0;
1888
+ if (!_compressedCovers_open(&compressedCovers,&diffInfo,diffData,decompressPlugin,
1889
+ temp_cache_end-kBestACacheSize-sizeof(_TCompressedCovers),temp_cache_end))
1890
+ { *out_isReadError=hpatch_TRUE; return _hpatch_FALSE; }
1891
+ if ((oldData->streamSize!=diffInfo.oldDataSize)||(newDataSize!=diffInfo.newDataSize))
1892
+ { *out_isReadError=hpatch_TRUE; return _hpatch_FALSE; }
1893
+ temp_cache_end-=kBestACacheSize+sizeof(_TCompressedCovers);
1894
+ // [ ... | compressedCovers cache ]
1895
+ // [ (cacheSize-kBestACacheSize) | (kBestACacheSize) ]
1896
+ *out_covers=&compressedCovers->base.ICovers;
1897
+ isUsedCover32=(diffInfo.oldDataSize|diffInfo.newDataSize)<((hpatch_uint64_t)1<<32);
1898
+ }else{
1899
+ _TPackedCovers* packedCovers=0;
1900
+ _THDiffHead diffHead;
1901
+ hpatch_StreamPos_t oldDataSize=oldData->streamSize;
1902
+ if (!_packedCovers_open(&packedCovers,&diffHead,diffData,
1903
+ temp_cache_end-kBestACacheSize*3-sizeof(_TPackedCovers),temp_cache_end))
1904
+ { *out_isReadError=hpatch_TRUE; return _hpatch_FALSE; }
1905
+ temp_cache_end-=kBestACacheSize*3+sizeof(_TPackedCovers);
1906
+ // [ ... | packedCovers cache ]
1907
+ // [ (cacheSize-kBestACacheSize*3) | (kBestACacheSize*3) ]
1908
+ *out_covers=&packedCovers->base.ICovers;
1909
+ isUsedCover32=(oldDataSize|newDataSize)<((hpatch_uint64_t)1<<32);
1910
+ }
1911
+
1912
+ if (!_arrayCovers_load(&arrayCovers,*out_covers,isUsedCover32,
1913
+ out_isReadError,&temp_cache,temp_cache_end-kBestACacheSize)){
1914
+ if (*out_isReadError) return _hpatch_FALSE;
1915
+ // [ patch cache | *edCovers cache ]
1916
+ // [ (cacheSize-kBestACacheSize*?) | (kBestACacheSize*?) ]
1917
+ *ptemp_cache=temp_cache;
1918
+ *ptemp_cache_end=temp_cache_end;
1919
+ return hpatch_FALSE;
1920
+ }else{
1921
+ // [ arrayCovers cache | ... ]
1922
+ // [((new temp_cache)-(old temp_cache))| (cacheSize-(arrayCovers cache size)) ]
1923
+ TByte* old_cache_end;
1924
+ hpatch_TStreamInput* replace_oldData=0;
1925
+ assert(!(*out_isReadError));
1926
+ if (!((*out_covers)->close(*out_covers))) return _hpatch_FALSE;
1927
+ *out_covers=&arrayCovers->ICovers;
1928
+ temp_cache_end=temp_cache_end_back; //free compressedCovers or packedCovers memory
1929
+ old_cache_end=temp_cache_end-kBestACacheSize*kCacheCount;
1930
+ // [ arrayCovers cache | ... | patch reserve cache ]
1931
+ // [ | ... | (kBestACacheSize*kCacheCount) ]
1932
+ if (((hpatch_size_t)(temp_cache_end-temp_cache)<=kBestACacheSize*kCacheCount)
1933
+ ||(!_cache_old(&replace_oldData,oldData,arrayCovers,out_isReadError,
1934
+ temp_cache,&old_cache_end,temp_cache_end))){
1935
+ if (*out_isReadError) return _hpatch_FALSE;
1936
+ // [ arrayCovers cache | patch cache ]
1937
+ *ptemp_cache=temp_cache;
1938
+ *ptemp_cache_end=temp_cache_end;
1939
+ return hpatch_FALSE;
1940
+ }else{
1941
+ // [ arrayCovers cache | oldData cache | patch cache ]
1942
+ // [ | |(temp_cache_end-(new old_cache_end))]
1943
+ assert(!(*out_isReadError));
1944
+ assert((hpatch_size_t)(temp_cache_end-old_cache_end)>=kBestACacheSize*kCacheCount);
1945
+ temp_cache=old_cache_end;
1946
+
1947
+ *poldData=replace_oldData;
1948
+ *ptemp_cache=temp_cache;
1949
+ *ptemp_cache_end=temp_cache_end;
1950
+ return hpatch_TRUE;
1951
+ }
1952
+ }
1953
+ }
1954
+ #endif//_IS_NEED_CACHE_OLD_BY_COVERS
1955
+ return hpatch_FALSE;//not cache oldData
1956
+ }
1957
+
1958
+ hpatch_BOOL patch_stream_with_cache(const struct hpatch_TStreamOutput* out_newData,
1959
+ const struct hpatch_TStreamInput* oldData,
1960
+ const struct hpatch_TStreamInput* serializedDiff,
1961
+ TByte* temp_cache,TByte* temp_cache_end){
1962
+ hpatch_BOOL result;
1963
+ hpatch_TCovers* covers=0;//not need close before return
1964
+ hpatch_BOOL isReadError=hpatch_FALSE;
1965
+ _patch_cache(&covers,&oldData,out_newData->streamSize,serializedDiff,hpatch_FALSE,0,
1966
+ _kCachePatCount,&temp_cache,&temp_cache_end,&isReadError);
1967
+ if (isReadError) return _hpatch_FALSE;
1968
+ result=_patch_stream_with_cache(out_newData,oldData,serializedDiff,covers,
1969
+ temp_cache,temp_cache_end);
1970
+ //if ((covers!=0)&&(!covers->close(covers))) result=_hpatch_FALSE;
1971
+ return result;
1972
+ }
1973
+
1974
+ hpatch_BOOL patch_stream(const hpatch_TStreamOutput* out_newData,
1975
+ const hpatch_TStreamInput* oldData,
1976
+ const hpatch_TStreamInput* serializedDiff){
1977
+ TByte temp_cache[hpatch_kStreamCacheSize*_kCachePatCount];
1978
+ return _patch_stream_with_cache(out_newData,oldData,serializedDiff,0,
1979
+ temp_cache,temp_cache+sizeof(temp_cache)/sizeof(TByte));
1980
+ }
1981
+
1982
+ hpatch_BOOL patch_decompress_with_cache(const hpatch_TStreamOutput* out_newData,
1983
+ const hpatch_TStreamInput* oldData,
1984
+ const hpatch_TStreamInput* compressedDiff,
1985
+ hpatch_TDecompress* decompressPlugin,
1986
+ TByte* temp_cache,TByte* temp_cache_end){
1987
+ hpatch_BOOL result;
1988
+ hpatch_TCovers* covers=0; //need close before return
1989
+ hpatch_BOOL isReadError=hpatch_FALSE;
1990
+ _patch_cache(&covers,&oldData,out_newData->streamSize,compressedDiff,hpatch_TRUE,
1991
+ decompressPlugin,_kCacheDecCount,&temp_cache,&temp_cache_end,&isReadError);
1992
+ if (isReadError) return _hpatch_FALSE;
1993
+ result=_patch_decompress_cache(out_newData,oldData,compressedDiff,decompressPlugin,
1994
+ covers,temp_cache,temp_cache_end);
1995
+ if ((covers!=0)&&(!covers->close(covers))) result=_hpatch_FALSE;
1996
+ return result;
1997
+ }
1998
+
1999
+ hpatch_BOOL patch_decompress(const hpatch_TStreamOutput* out_newData,
2000
+ const hpatch_TStreamInput* oldData,
2001
+ const hpatch_TStreamInput* compressedDiff,
2002
+ hpatch_TDecompress* decompressPlugin){
2003
+ TByte temp_cache[hpatch_kStreamCacheSize*_kCacheDecCount];
2004
+ return _patch_decompress_cache(out_newData,oldData,compressedDiff,decompressPlugin,
2005
+ 0,temp_cache,temp_cache+sizeof(temp_cache)/sizeof(TByte));
2006
+ }
2007
+
2008
+ hpatch_BOOL hpatch_coverList_open_serializedDiff(hpatch_TCoverList* out_coverList,
2009
+ const hpatch_TStreamInput* serializedDiff){
2010
+ TByte* temp_cache;
2011
+ TByte* temp_cache_end;
2012
+ _TPackedCovers* packedCovers=0;
2013
+ _THDiffHead diffHead;
2014
+ assert((out_coverList!=0)&&(out_coverList->ICovers==0));
2015
+ temp_cache=out_coverList->_buf;
2016
+ temp_cache_end=temp_cache+sizeof(out_coverList->_buf);
2017
+ if (!_packedCovers_open(&packedCovers,&diffHead,serializedDiff,
2018
+ temp_cache,temp_cache_end))
2019
+ return _hpatch_FALSE;
2020
+ out_coverList->ICovers=&packedCovers->base.ICovers;
2021
+ return hpatch_TRUE;
2022
+ }
2023
+
2024
+ hpatch_BOOL hpatch_coverList_open_compressedDiff(hpatch_TCoverList* out_coverList,
2025
+ const hpatch_TStreamInput* compressedDiff,
2026
+ hpatch_TDecompress* decompressPlugin){
2027
+ TByte* temp_cache;
2028
+ TByte* temp_cache_end;
2029
+ _TCompressedCovers* compressedCovers=0;
2030
+ hpatch_compressedDiffInfo diffInfo;
2031
+ assert((out_coverList!=0)&&(out_coverList->ICovers==0));
2032
+ temp_cache=out_coverList->_buf;
2033
+ temp_cache_end=temp_cache+sizeof(out_coverList->_buf);
2034
+ if (!_compressedCovers_open(&compressedCovers,&diffInfo,compressedDiff,decompressPlugin,
2035
+ temp_cache,temp_cache_end))
2036
+ return _hpatch_FALSE;
2037
+ out_coverList->ICovers=&compressedCovers->base.ICovers;
2038
+ return hpatch_TRUE;
2039
+ }
2040
+
2041
+ //
2042
+
2043
+ #if (_HPATCH_IS_USED_MULTITHREAD)
2044
+ # include "hpatch_mt/hpatch_mt.h"
2045
+ #endif
2046
+
2047
+ hpatch_BOOL _patch_single_compressed_diff_mt(const hpatch_TStreamOutput* out_newData,
2048
+ const hpatch_TStreamInput* oldData,
2049
+ const hpatch_TStreamInput* singleCompressedDiff,
2050
+ hpatch_StreamPos_t diffData_pos,
2051
+ hpatch_StreamPos_t uncompressedSize,
2052
+ hpatch_StreamPos_t compressedSize,
2053
+ hpatch_TDecompress* decompressPlugin,
2054
+ hpatch_StreamPos_t coverCount,hpatch_size_t stepMemSize,
2055
+ unsigned char* temp_cache,unsigned char* temp_cache_end,
2056
+ sspatch_coversListener_t* coversListener,
2057
+ size_t maxThreadNum,hpatchMTSets_t hpatchMTSets){
2058
+ #if (_HPATCH_IS_USED_MULTITHREAD)
2059
+ struct hpatch_mt_manager_t* hpatch_mt_manager=0;
2060
+ hpatchMTSets_t mtsets=hpatch_getMTSets(out_newData->streamSize,oldData->streamSize,singleCompressedDiff->streamSize-diffData_pos,
2061
+ decompressPlugin,_kCacheSgCount,stepMemSize,
2062
+ temp_cache_end-temp_cache,maxThreadNum,hpatchMTSets);
2063
+ #endif
2064
+ hpatch_BOOL result;
2065
+ hpatch_BOOL isNeedOutCache=hpatch_TRUE;
2066
+ hpatch_TUncompresser_t uncompressedStream;
2067
+ hpatch_StreamPos_t diffData_posEnd;
2068
+ memset(&uncompressedStream,0,sizeof(uncompressedStream));
2069
+ if (compressedSize==0){
2070
+ decompressPlugin=0;
2071
+ }else{
2072
+ if (decompressPlugin==0) return _hpatch_FALSE;
2073
+ }
2074
+ diffData_posEnd=(decompressPlugin?compressedSize:uncompressedSize)+diffData_pos;
2075
+ if (diffData_posEnd>singleCompressedDiff->streamSize) return _hpatch_FALSE;
2076
+ #if (_HPATCH_IS_USED_MULTITHREAD)
2077
+ mtsets.decompressDiff_isMT=decompressPlugin? mtsets.decompressDiff_isMT:0;
2078
+ if (_hpatchMTSets_threadNum(mtsets)>1){
2079
+ isNeedOutCache=!mtsets.writeNew_isMT;
2080
+ hpatch_mt_manager=hpatch_mt_manager_open(&out_newData,&oldData,&singleCompressedDiff,
2081
+ &diffData_pos,&diffData_posEnd,uncompressedSize,&decompressPlugin,
2082
+ stepMemSize,&temp_cache,&temp_cache_end,&coversListener,hpatch_TRUE,
2083
+ _kCacheSgCount-(isNeedOutCache?0:1),mtsets);
2084
+ if (!hpatch_mt_manager) return _hpatch_FALSE;
2085
+ }
2086
+ #endif
2087
+ if (decompressPlugin){
2088
+ if (!compressed_stream_as_uncompressed(&uncompressedStream,uncompressedSize,decompressPlugin,singleCompressedDiff,
2089
+ diffData_pos,diffData_posEnd)) return _hpatch_FALSE;
2090
+ singleCompressedDiff=&uncompressedStream.base;
2091
+ diffData_pos=0;
2092
+ diffData_posEnd=singleCompressedDiff->streamSize;
2093
+ }
2094
+
2095
+ result=patch_single_stream_diff(out_newData,oldData,singleCompressedDiff,diffData_pos,diffData_posEnd,
2096
+ coverCount,stepMemSize,temp_cache,temp_cache_end,coversListener,isNeedOutCache);
2097
+
2098
+ if (decompressPlugin)
2099
+ close_compressed_stream_as_uncompressed(&uncompressedStream);
2100
+ #if (_HPATCH_IS_USED_MULTITHREAD)
2101
+ if (hpatch_mt_manager){
2102
+ if (!hpatch_mt_manager_close(hpatch_mt_manager,!result))
2103
+ result=_hpatch_FALSE;
2104
+ hpatch_mt_manager=0;
2105
+ }
2106
+ #endif
2107
+ return result;
2108
+ }
2109
+
2110
+ static const size_t _kStepMemSizeSafeLimit =(1<<20)*16;
2111
+ hpatch_BOOL getSingleCompressedDiffInfo(hpatch_singleCompressedDiffInfo* out_diffInfo,
2112
+ const hpatch_TStreamInput* singleCompressedDiff,
2113
+ hpatch_StreamPos_t diffInfo_pos){
2114
+ TStreamCacheClip _diffHeadClip;
2115
+ TStreamCacheClip* diffHeadClip=&_diffHeadClip;
2116
+ TByte temp_cache[hpatch_kStreamCacheSize];
2117
+ _TStreamCacheClip_init(&_diffHeadClip,singleCompressedDiff,diffInfo_pos,singleCompressedDiff->streamSize,
2118
+ temp_cache,hpatch_kStreamCacheSize);
2119
+ {//type
2120
+ const char* kVersionType="HDIFFSF20";
2121
+ char* tempType=out_diffInfo->compressType;
2122
+ if (!_TStreamCacheClip_readType_end(diffHeadClip,'&',tempType)) return _hpatch_FALSE;
2123
+ if (0!=strcmp(tempType,kVersionType)) return _hpatch_FALSE;
2124
+ }
2125
+ {//read compressType
2126
+ if (!_TStreamCacheClip_readType_end(diffHeadClip,'\0',
2127
+ out_diffInfo->compressType)) return _hpatch_FALSE;
2128
+ }
2129
+ _clip_unpackUIntTo(&out_diffInfo->newDataSize,diffHeadClip);
2130
+ _clip_unpackUIntTo(&out_diffInfo->oldDataSize,diffHeadClip);
2131
+ _clip_unpackUIntTo(&out_diffInfo->coverCount,diffHeadClip);
2132
+ _clip_unpackUIntTo(&out_diffInfo->stepMemSize,diffHeadClip);
2133
+ _clip_unpackUIntTo(&out_diffInfo->uncompressedSize,diffHeadClip);
2134
+ _clip_unpackUIntTo(&out_diffInfo->compressedSize,diffHeadClip);
2135
+ out_diffInfo->diffDataPos=_TStreamCacheClip_readPosOfSrcStream(diffHeadClip)-diffInfo_pos;
2136
+ if (out_diffInfo->compressedSize>out_diffInfo->uncompressedSize)
2137
+ return _hpatch_FALSE;
2138
+ if (out_diffInfo->stepMemSize>(out_diffInfo->newDataSize>=_kStepMemSizeSafeLimit?out_diffInfo->newDataSize:_kStepMemSizeSafeLimit))
2139
+ return _hpatch_FALSE;
2140
+ if (out_diffInfo->stepMemSize>out_diffInfo->uncompressedSize)
2141
+ return _hpatch_FALSE;
2142
+ return hpatch_TRUE;
2143
+ }
2144
+
2145
+ static hpatch_BOOL _TUncompresser_read(const struct hpatch_TStreamInput* stream,hpatch_StreamPos_t readFromPos,
2146
+ unsigned char* out_data,unsigned char* out_data_end){
2147
+ hpatch_TUncompresser_t* self=(hpatch_TUncompresser_t*)stream->streamImport;
2148
+ return self->_decompressPlugin->decompress_part(self->_decompressHandle,out_data,out_data_end);
2149
+ }
2150
+
2151
+ hpatch_BOOL compressed_stream_as_uncompressed(hpatch_TUncompresser_t* uncompressedStream,hpatch_StreamPos_t uncompressedSize,
2152
+ hpatch_TDecompress* decompressPlugin,const hpatch_TStreamInput* compressedStream,
2153
+ hpatch_StreamPos_t compressed_pos,hpatch_StreamPos_t compressed_end){
2154
+ hpatch_TUncompresser_t* self=uncompressedStream;
2155
+ assert(decompressPlugin!=0);
2156
+ assert(self->_decompressHandle==0);
2157
+ self->_decompressHandle=decompressPlugin->open(decompressPlugin,uncompressedSize,compressedStream,
2158
+ compressed_pos,compressed_end);
2159
+ if (self->_decompressHandle==0) return _hpatch_FALSE;
2160
+ self->_decompressPlugin=decompressPlugin;
2161
+
2162
+ self->base.streamImport=self;
2163
+ self->base.streamSize=uncompressedSize;
2164
+ self->base.read=_TUncompresser_read;
2165
+ return hpatch_TRUE;
2166
+ }
2167
+
2168
+ void close_compressed_stream_as_uncompressed(hpatch_TUncompresser_t* uncompressedStream){
2169
+ hpatch_TUncompresser_t* self=uncompressedStream;
2170
+ if (self==0) return;
2171
+ if (self->_decompressHandle==0) return;
2172
+ self->_decompressPlugin->close(self->_decompressPlugin,self->_decompressHandle);
2173
+ self->_decompressHandle=0;
2174
+ }
2175
+
2176
+ typedef struct{
2177
+ const unsigned char* code;
2178
+ const unsigned char* code_end;
2179
+ hpatch_size_t len0;
2180
+ hpatch_size_t lenv;
2181
+ hpatch_BOOL isNeedDecode0;
2182
+ } rle0_decoder_t;
2183
+
2184
+ static void _rle0_decoder_init(rle0_decoder_t* self,const unsigned char* code,const unsigned char* code_end){
2185
+ self->code=code;
2186
+ self->code_end=code_end;
2187
+ self->len0=0;
2188
+ self->lenv=0;
2189
+ self->isNeedDecode0=hpatch_TRUE;
2190
+ }
2191
+
2192
+ static hpatch_BOOL _rle0_decoder_add(rle0_decoder_t* self,TByte* out_data,hpatch_size_t decodeSize){
2193
+ if (self->len0){
2194
+ _0_process:
2195
+ if (self->len0>=decodeSize){
2196
+ self->len0-=decodeSize;
2197
+ return hpatch_TRUE;
2198
+ }else{
2199
+ decodeSize-=self->len0;
2200
+ out_data+=self->len0;
2201
+ self->len0=0;
2202
+ goto _decode_v_process;
2203
+ }
2204
+ }
2205
+
2206
+ if (self->lenv){
2207
+ _v_process:
2208
+ if (self->lenv>=decodeSize){
2209
+ addData(out_data,self->code,decodeSize);
2210
+ self->code+=decodeSize;
2211
+ self->lenv-=decodeSize;
2212
+ return hpatch_TRUE;
2213
+ }else{
2214
+ addData(out_data,self->code,self->lenv);
2215
+ out_data+=self->lenv;
2216
+ decodeSize-=self->lenv;
2217
+ self->code+=self->lenv;
2218
+ self->lenv=0;
2219
+ goto _decode_0_process;
2220
+ }
2221
+ }
2222
+
2223
+ assert(decodeSize>0);
2224
+ if (self->isNeedDecode0){
2225
+ hpatch_StreamPos_t len0;
2226
+ _decode_0_process:
2227
+ self->isNeedDecode0=hpatch_FALSE;
2228
+ if (!hpatch_unpackUInt(&self->code,self->code_end,&len0)) return _hpatch_FALSE;
2229
+ if (len0!=(hpatch_size_t)len0) return _hpatch_FALSE;
2230
+ self->len0=(hpatch_size_t)len0;
2231
+ goto _0_process;
2232
+ }else{
2233
+ hpatch_StreamPos_t lenv;
2234
+ _decode_v_process:
2235
+ self->isNeedDecode0=hpatch_TRUE;
2236
+ if (!hpatch_unpackUInt(&self->code,self->code_end,&lenv)) return _hpatch_FALSE;
2237
+ if (lenv>(size_t)(self->code_end-self->code)) return _hpatch_FALSE;
2238
+ self->lenv=(hpatch_size_t)lenv;
2239
+ goto _v_process;
2240
+ }
2241
+ }
2242
+
2243
+
2244
+ static hpatch_BOOL _patch_add_old_with_rle0(_TOutStreamCache* outCache,rle0_decoder_t* rle0_decoder,
2245
+ const hpatch_TStreamInput* old,hpatch_StreamPos_t oldPos,
2246
+ hpatch_StreamPos_t addLength,TByte* aCache,hpatch_size_t aCacheSize){
2247
+ while (addLength>0){
2248
+ hpatch_size_t decodeStep=aCacheSize;
2249
+ if (decodeStep>addLength)
2250
+ decodeStep=(hpatch_size_t)addLength;
2251
+ if (!old->read(old,oldPos,aCache,aCache+decodeStep)) return _hpatch_FALSE;
2252
+ if (!_rle0_decoder_add(rle0_decoder,aCache,decodeStep)) return _hpatch_FALSE;
2253
+ if (!_TOutStreamCache_write(outCache,aCache,decodeStep)) return _hpatch_FALSE;
2254
+ oldPos+=decodeStep;
2255
+ addLength-=decodeStep;
2256
+ }
2257
+ return hpatch_TRUE;
2258
+ }
2259
+
2260
+ hpatch_BOOL sspatch_covers_nextCover(sspatch_covers_t* self){
2261
+ hpatch_BOOL inc_oldPos_sign=(*(self->covers_cache))>>(8-1);
2262
+ self->lastOldEnd=self->cover.oldPos+self->cover.length;
2263
+ self->lastNewEnd=self->cover.newPos+self->cover.length;
2264
+ if (!hpatch_unpackUIntWithTag(&self->covers_cache,self->covers_cacheEnd,&self->cover.oldPos,1)) return _hpatch_FALSE;
2265
+ if (inc_oldPos_sign==0)
2266
+ self->cover.oldPos+=self->lastOldEnd;
2267
+ else
2268
+ self->cover.oldPos=self->lastOldEnd-self->cover.oldPos;
2269
+ if (!hpatch_unpackUInt(&self->covers_cache,self->covers_cacheEnd,&self->cover.newPos)) return _hpatch_FALSE;
2270
+ self->cover.newPos+=self->lastNewEnd;
2271
+ if (!hpatch_unpackUInt(&self->covers_cache,self->covers_cacheEnd,&self->cover.length)) return _hpatch_FALSE;
2272
+ return hpatch_TRUE;
2273
+ }
2274
+
2275
+
2276
+ #if (_IS_NEED_CACHE_OLD_BY_COVERS)
2277
+
2278
+ #define _kMaxCachedLen_min (32*1024) // 1M is big value, 256k is middle value, 32k is small value
2279
+ #define _kMaxCachedLen_max (32*_kMaxCachedLen_min)
2280
+ #define _kMemForReadOldSize (hpatch_kFileIOBufBetterSize*2)
2281
+
2282
+ typedef struct{
2283
+ _cache_old_TStreamInput cache_old;
2284
+ hpatch_TStreamInput base;
2285
+ sspatch_covers_t covers;
2286
+ hpatch_BOOL isHaveACover;
2287
+ hpatch_size_t sumCacheLen;
2288
+ hpatch_byte* cache_buf_end;
2289
+ const hpatch_byte* covers_cache;
2290
+ const hpatch_byte* covers_cacheEnd;
2291
+ } _step_cache_old_t;
2292
+
2293
+ static hpatch_force_inline hpatch_size_t _step_cache_old_sumBufSize(const _step_cache_old_t* self){
2294
+ return self->cache_old.cachesEnd-(const hpatch_byte*)self->cache_old.arrayCovers.pCCovers; }
2295
+ static hpatch_force_inline hpatch_size_t _step_cache_old_coverBufSize(const _step_cache_old_t* self){
2296
+ return (hpatch_size_t)arrayCovers_memSize(self->cache_old.arrayCovers.coverCount,self->cache_old.arrayCovers.is32); }
2297
+ static hpatch_force_inline hpatch_StreamPos_t _step_cache_old_incCoverBufSize(const _step_cache_old_t* self){
2298
+ return arrayCovers_memSize(self->cache_old.arrayCovers.coverCount+1,self->cache_old.arrayCovers.is32); }
2299
+
2300
+
2301
+ static hpatch_BOOL _step_cache_old_addCover(_step_cache_old_t* self,const hpatch_TCover* cover){
2302
+ const hpatch_StreamPos_t _incCoverBufSize=_step_cache_old_incCoverBufSize(self);
2303
+ while (hpatch_TRUE){
2304
+ const hpatch_size_t _addCachedLen=(cover->length<=self->cache_old.maxCachedLen)?(hpatch_size_t)cover->length:0;
2305
+ if (_incCoverBufSize+self->sumCacheLen+_addCachedLen<=_step_cache_old_sumBufSize(self)){
2306
+ self->sumCacheLen+=_addCachedLen;
2307
+ _arrayCovers_push_cover(&self->cache_old.arrayCovers,cover);
2308
+ return hpatch_TRUE;
2309
+ }else{
2310
+ assert(self->cache_old.maxCachedLen>=_kMaxCachedLen_min);
2311
+ if (self->cache_old.maxCachedLen==_kMaxCachedLen_min) return hpatch_FALSE;
2312
+ self->cache_old.maxCachedLen/=2;
2313
+ self->sumCacheLen=(hpatch_size_t)_getCacheSumLen(&self->cache_old.arrayCovers,self->cache_old.maxCachedLen);
2314
+ }
2315
+ }
2316
+ }
2317
+
2318
+ static hpatch_BOOL _patch_step_cache_old_update(void* _self){
2319
+ _step_cache_old_t* self=(_step_cache_old_t*)_self;
2320
+ hpatch_StreamPos_t oldPosBegin;
2321
+ hpatch_StreamPos_t oldPosEnd;
2322
+ const hpatch_size_t kMinCacheCoverCount=0; //no limit
2323
+ assert(self->cache_old.arrayCovers.coverCount<=self->cache_old.arrayCovers.cur_index);
2324
+ assert(self->cache_old.caches==self->cache_old.cachesEnd);
2325
+ self->sumCacheLen=0;
2326
+ self->cache_old.arrayCovers.coverCount=0;
2327
+ self->cache_old.arrayCovers.cur_index=0;
2328
+ self->cache_old.cachesEnd=self->cache_buf_end-_kMemForReadOldSize; //limit covers + cached data 's size
2329
+ self->cache_old.maxCachedLen=_kMaxCachedLen_max;
2330
+ while ((self->cache_old.maxCachedLen>=_step_cache_old_sumBufSize(self))&(self->cache_old.maxCachedLen>_kMaxCachedLen_min))
2331
+ self->cache_old.maxCachedLen/=2;
2332
+
2333
+ //read some cover from self->covers to self->cache_old.arrayCovers
2334
+ if (self->isHaveACover){
2335
+ self->isHaveACover=hpatch_FALSE;
2336
+ assert(self->covers.cover.length>0);
2337
+ if (!_step_cache_old_addCover(self,&self->covers.cover)) assert(hpatch_FALSE);
2338
+ }
2339
+ while (sspatch_covers_isHaveNextCover(&self->covers)){
2340
+ if (!sspatch_covers_nextCover(&self->covers))
2341
+ return hpatch_FALSE;
2342
+ if (self->covers.cover.length>0){
2343
+ if (_step_cache_old_addCover(self,&self->covers.cover)){
2344
+ //ok
2345
+ }else{
2346
+ self->isHaveACover=hpatch_TRUE;
2347
+ break; //arrayCovers full
2348
+ }
2349
+ }
2350
+ }
2351
+
2352
+ self->cache_old.maxCachedLen=_getMaxCachedLen(&self->cache_old.arrayCovers,_step_cache_old_sumBufSize(self)-_step_cache_old_coverBufSize(self));
2353
+ assert(self->cache_old.maxCachedLen>0);
2354
+ self->sumCacheLen=_set_cache_pos(&self->cache_old.arrayCovers,self->cache_old.maxCachedLen,&oldPosBegin,&oldPosEnd,kMinCacheCoverCount);
2355
+ self->cache_old.caches=((hpatch_byte*)self->cache_old.arrayCovers.pCCovers)+_step_cache_old_coverBufSize(self);
2356
+ self->cache_old.cachesEnd=self->cache_old.caches+self->sumCacheLen;
2357
+ if (self->sumCacheLen>0){
2358
+ if (!_cache_old_load(self->cache_old.oldData,oldPosBegin,oldPosEnd,&self->cache_old.arrayCovers,
2359
+ self->cache_old.maxCachedLen,self->sumCacheLen, (hpatch_byte*)self->cache_old.caches,
2360
+ (hpatch_byte*)self->cache_old.cachesEnd,self->cache_buf_end))
2361
+ return _hpatch_FALSE;
2362
+ }
2363
+ return hpatch_TRUE;
2364
+ }
2365
+
2366
+ static hpatch_inline
2367
+ void _patch_step_cache_old_init(_step_cache_old_t* self,hpatch_size_t canUsedMemSize,
2368
+ const hpatch_TStreamInput* oldData,hpatch_BOOL isUsedCover32){
2369
+ memset(self,0,sizeof(*self));
2370
+ assert(canUsedMemSize>=_kMemForReadOldSize*2);
2371
+ self->base.streamImport=&self->cache_old;
2372
+ self->base.streamSize=oldData->streamSize;
2373
+ self->base.read=_cache_old_StreamInput_read;
2374
+ //todo: _cache_old_StreamInput_read call back
2375
+ self->cache_old.oldData=oldData;
2376
+ self->cache_old._cacheImport=self;
2377
+ self->cache_old._doUpdateCacheCovers=_patch_step_cache_old_update;
2378
+ self->cache_buf_end=((hpatch_byte*)self) + canUsedMemSize;
2379
+
2380
+ self->cache_old.arrayCovers.is32=isUsedCover32;
2381
+ self->cache_old.arrayCovers.pCCovers=(void*)_hpatch_align_upper((self+1),sizeof(hpatch_StreamPos_t));
2382
+ self->cache_old.arrayCovers.ICovers.leave_cover_count=_arrayCovers_leaveCoverCount;
2383
+ self->cache_old.arrayCovers.ICovers.read_cover=_arrayCovers_read_cover;
2384
+ }
2385
+
2386
+
2387
+ hpatch_BOOL _patch_step_cache_old_onStepCovers(const hpatch_TStreamInput* _self,const unsigned char* covers_cache,const unsigned char* covers_cacheEnd){
2388
+ _step_cache_old_t* self=(_step_cache_old_t*)_self->streamImport;
2389
+ assert(!sspatch_covers_isHaveNextCover(&self->covers));
2390
+ assert(!self->isHaveACover);
2391
+ self->covers_cache=covers_cache;
2392
+ self->covers_cacheEnd=covers_cacheEnd;
2393
+ sspatch_covers_setCoversCache(&self->covers,covers_cache,covers_cacheEnd);
2394
+ return covers_cache?_patch_step_cache_old_update(self):hpatch_TRUE;
2395
+ }
2396
+
2397
+
2398
+ hpatch_size_t _patch_step_cache_old_canUsedSize(hpatch_size_t stepCoversMemSize,hpatch_size_t kMinTempCacheSize,hpatch_size_t tempCacheSize){
2399
+ const hpatch_size_t kActiveCacheOldMemorySize=(1<<20)*3+_kMemForReadOldSize*2;
2400
+ hpatch_size_t cacheStepSize,multiple;
2401
+ if (tempCacheSize<kActiveCacheOldMemorySize+stepCoversMemSize+kMinTempCacheSize)
2402
+ return 0;
2403
+ cacheStepSize=tempCacheSize-(stepCoversMemSize+kMinTempCacheSize+sizeof(hpatch_StreamPos_t));
2404
+ multiple=cacheStepSize/((kActiveCacheOldMemorySize+kMinTempCacheSize+_kMemForReadOldSize)/4);
2405
+ cacheStepSize-=(hpatch_size_t)((hpatch_StreamPos_t)(kMinTempCacheSize+_kMemForReadOldSize)*((multiple>4)?(hpatch_size_t)(multiple-4):0)/8);
2406
+ return cacheStepSize;
2407
+ }
2408
+
2409
+ hpatch_BOOL _patch_step_cache_old(const hpatch_TStreamInput** poldData,hpatch_StreamPos_t newDataSize,size_t stepCoversMemSize,
2410
+ size_t kMinTempCacheSize,hpatch_byte** ptemp_cache,hpatch_byte** ptemp_cache_end){
2411
+ const hpatch_TStreamInput* oldData=*poldData;
2412
+ _step_cache_old_t* self;
2413
+ const hpatch_BOOL isUsedCover32=(oldData->streamSize|newDataSize)<((hpatch_uint64_t)1<<32);
2414
+ hpatch_byte* temp_cache=*ptemp_cache;
2415
+ hpatch_byte* const temp_cache_end=*ptemp_cache_end;
2416
+
2417
+ hpatch_size_t canUsedMemSize=_patch_step_cache_old_canUsedSize(stepCoversMemSize,kMinTempCacheSize,temp_cache_end-temp_cache);
2418
+ if (canUsedMemSize==0)
2419
+ return hpatch_FALSE; //not enough memory for cache part of oldData
2420
+ _cache_alloc(self,_step_cache_old_t,canUsedMemSize,temp_cache,temp_cache_end);
2421
+ _patch_step_cache_old_init(self,canUsedMemSize,oldData,isUsedCover32);
2422
+
2423
+ *poldData=&self->base;
2424
+ *ptemp_cache=temp_cache;
2425
+ return hpatch_TRUE;
2426
+ }
2427
+
2428
+ #endif // _IS_NEED_CACHE_OLD_BY_COVERS
2429
+
2430
+
2431
+ hpatch_BOOL patch_single_stream_diff(const hpatch_TStreamOutput* out_newData,
2432
+ const hpatch_TStreamInput* oldData,
2433
+ const hpatch_TStreamInput* uncompressedDiffData,
2434
+ hpatch_StreamPos_t diffData_pos,
2435
+ hpatch_StreamPos_t diffData_posEnd,
2436
+ hpatch_StreamPos_t coverCount,hpatch_size_t stepMemSize,
2437
+ unsigned char* temp_cache,unsigned char* temp_cache_end,
2438
+ sspatch_coversListener_t* coversListener,hpatch_BOOL isNeedOutCache){
2439
+ unsigned char* step_cache;
2440
+ hpatch_size_t cache_size;
2441
+ TStreamCacheClip inClip;
2442
+ _TOutStreamCache outCache;
2443
+ const size_t kCacheCount=_kCacheSgCount-(isNeedOutCache?0:1);
2444
+ sspatch_covers_t covers;
2445
+ #if (_IS_NEED_CACHE_OLD_BY_COVERS)
2446
+ hpatch_BOOL isCachedOldByStep=hpatch_FALSE;
2447
+ #endif
2448
+
2449
+ step_cache=temp_cache;
2450
+ assert(diffData_posEnd<=uncompressedDiffData->streamSize);
2451
+ sspatch_covers_init(&covers);
2452
+ if (coversListener) assert(coversListener->onStepCovers);
2453
+ {//cache
2454
+ hpatch_BOOL isCachedAllOld;
2455
+ hpatch_BOOL isReadError=hpatch_FALSE;
2456
+ if ((size_t)(temp_cache_end-temp_cache)<stepMemSize+hpatch_kStreamCacheSize*kCacheCount) return _hpatch_FALSE;
2457
+ temp_cache+=stepMemSize;
2458
+ isCachedAllOld=_patch_cache_all_old(&oldData,kCacheCount*hpatch_kStreamCacheSize,&temp_cache,&temp_cache_end,&isReadError);
2459
+ if (isReadError) return _hpatch_FALSE;
2460
+ #if (_IS_NEED_CACHE_OLD_BY_COVERS)
2461
+ if (!isCachedAllOld)
2462
+ isCachedOldByStep=_patch_step_cache_old(&oldData,out_newData->streamSize,stepMemSize,
2463
+ kCacheCount*hpatch_kFileIOBufBetterSize,&temp_cache,&temp_cache_end);
2464
+ #endif
2465
+ cache_size=(temp_cache_end-temp_cache)/kCacheCount;
2466
+ _TStreamCacheClip_init(&inClip,uncompressedDiffData,diffData_pos,diffData_posEnd,
2467
+ temp_cache,cache_size);
2468
+ temp_cache+=cache_size;
2469
+ _TOutStreamCache_init(&outCache,out_newData,isNeedOutCache?(temp_cache+cache_size):0,isNeedOutCache?cache_size:0);
2470
+ }
2471
+ while (coverCount) {//step loop
2472
+ rle0_decoder_t rle0_decoder;
2473
+ {//read step info
2474
+ unsigned char* covers_cacheEnd;
2475
+ unsigned char* bufRle_cache_end;
2476
+ {
2477
+ hpatch_StreamPos_t bufCover_size;
2478
+ hpatch_StreamPos_t bufRle_size;
2479
+ _clip_unpackUIntTo(&bufCover_size,&inClip);
2480
+ _clip_unpackUIntTo(&bufRle_size,&inClip);
2481
+ #ifdef __RUN_MEM_SAFE_CHECK
2482
+ if ((bufCover_size>stepMemSize)|(bufRle_size>stepMemSize)|
2483
+ (bufCover_size+bufRle_size>stepMemSize)) return _hpatch_FALSE;
2484
+ #endif
2485
+ covers_cacheEnd=step_cache+(size_t)bufCover_size;
2486
+ bufRle_cache_end=covers_cacheEnd+(size_t)bufRle_size;
2487
+ }
2488
+ if (coversListener&&coversListener->onStepCoversReset)
2489
+ coversListener->onStepCoversReset(coversListener,coverCount);
2490
+ if (!_TStreamCacheClip_readDataTo(&inClip,step_cache,bufRle_cache_end))
2491
+ return _hpatch_FALSE;
2492
+ if (coversListener)
2493
+ coversListener->onStepCovers(coversListener,step_cache,covers_cacheEnd);
2494
+ #if (_IS_NEED_CACHE_OLD_BY_COVERS)
2495
+ if (isCachedOldByStep)
2496
+ _patch_step_cache_old_onStepCovers(oldData,step_cache,covers_cacheEnd);
2497
+ #endif
2498
+ sspatch_covers_setCoversCache(&covers,step_cache,covers_cacheEnd);
2499
+ _rle0_decoder_init(&rle0_decoder,covers_cacheEnd,bufRle_cache_end);
2500
+ }
2501
+ while (sspatch_covers_isHaveNextCover(&covers)) {//cover loop
2502
+ if (!sspatch_covers_nextCover(&covers))
2503
+ return _hpatch_FALSE;
2504
+ if (covers.cover.newPos>covers.lastNewEnd){
2505
+ if (!_TOutStreamCache_copyFromClip(&outCache,&inClip,covers.cover.newPos-covers.lastNewEnd))
2506
+ return _hpatch_FALSE;
2507
+ }
2508
+
2509
+ --coverCount;
2510
+ if (covers.cover.length){
2511
+ #ifdef __RUN_MEM_SAFE_CHECK
2512
+ if ((covers.cover.oldPos>oldData->streamSize)|
2513
+ (covers.cover.length>(hpatch_StreamPos_t)(oldData->streamSize-covers.cover.oldPos))) return _hpatch_FALSE;
2514
+ #endif
2515
+ if (!_patch_add_old_with_rle0(&outCache,&rle0_decoder,oldData,covers.cover.oldPos,covers.cover.length,
2516
+ temp_cache,cache_size)) return _hpatch_FALSE;
2517
+ }else{
2518
+ #ifdef __RUN_MEM_SAFE_CHECK
2519
+ if (coverCount!=0) return _hpatch_FALSE;
2520
+ #endif
2521
+ }
2522
+ }
2523
+ }
2524
+ if (coversListener){
2525
+ if (coversListener->onStepCoversReset)
2526
+ coversListener->onStepCoversReset(coversListener,0);
2527
+ coversListener->onStepCovers(coversListener,0,0);
2528
+ }
2529
+
2530
+ if (!_TOutStreamCache_flush(&outCache))
2531
+ return _hpatch_FALSE;
2532
+ if (_TStreamCacheClip_isFinish(&inClip)&_TOutStreamCache_isFinish(&outCache)&(coverCount==0))
2533
+ return hpatch_TRUE;
2534
+ else
2535
+ return _hpatch_FALSE;
2536
+ }
2537
+
2538
+
2539
+ static hpatch_BOOL _TDiffToSingleStream_read(const struct hpatch_TStreamInput* stream,hpatch_StreamPos_t readFromPos,
2540
+ unsigned char* out_data,unsigned char* out_data_end){
2541
+ //[ |readedSize ]
2542
+ // [ |cachedBufBegin _TDiffToSingleStream_kBufSize]
2543
+ // readFromPos[out_data out_data_end]
2544
+ TDiffToSingleStream* self=(TDiffToSingleStream*)stream->streamImport;
2545
+ hpatch_StreamPos_t readedSize=self->readedSize;
2546
+ while (1){
2547
+ size_t rLen=out_data_end-out_data;
2548
+ if (readFromPos==readedSize){
2549
+ hpatch_BOOL result=self->diffStream->read(self->diffStream,readedSize,out_data,out_data_end);
2550
+ self->readedSize=readedSize+rLen;
2551
+ if ((self->isInSingleStream)||(rLen>_TDiffToSingleStream_kBufSize)){
2552
+ self->cachedBufBegin=_TDiffToSingleStream_kBufSize;
2553
+ }else{
2554
+ //cache
2555
+ if (rLen>=_TDiffToSingleStream_kBufSize){
2556
+ memcpy(self->buf,out_data_end-_TDiffToSingleStream_kBufSize,_TDiffToSingleStream_kBufSize);
2557
+ self->cachedBufBegin = 0;
2558
+ }else{
2559
+ size_t new_cachedBufBegin;
2560
+ if (self->cachedBufBegin>=rLen){
2561
+ new_cachedBufBegin=self->cachedBufBegin-rLen;
2562
+ memmove(self->buf+new_cachedBufBegin,self->buf+self->cachedBufBegin,_TDiffToSingleStream_kBufSize-self->cachedBufBegin);
2563
+ }else{
2564
+ new_cachedBufBegin=0;
2565
+ memmove(self->buf,self->buf+rLen,_TDiffToSingleStream_kBufSize-rLen);
2566
+ }
2567
+ memcpy(self->buf+(_TDiffToSingleStream_kBufSize-rLen),out_data,rLen);
2568
+ self->cachedBufBegin=new_cachedBufBegin;
2569
+ }
2570
+ }
2571
+ return result;
2572
+ }else{
2573
+ size_t cachedSize=_TDiffToSingleStream_kBufSize-self->cachedBufBegin;
2574
+ size_t bufSize=(size_t)(readedSize-readFromPos);
2575
+ if ((readFromPos<readedSize)&(bufSize<=cachedSize)){
2576
+ if (rLen>bufSize)
2577
+ rLen=bufSize;
2578
+ memcpy(out_data,self->buf+(_TDiffToSingleStream_kBufSize-bufSize),rLen);
2579
+ out_data+=rLen;
2580
+ readFromPos+=rLen;
2581
+ if (out_data==out_data_end)
2582
+ return hpatch_TRUE;
2583
+ else
2584
+ continue;
2585
+ }else{
2586
+ return _hpatch_FALSE;
2587
+ }
2588
+ }
2589
+ }
2590
+ }
2591
+ void TDiffToSingleStream_init(TDiffToSingleStream* self,const hpatch_TStreamInput* diffStream){
2592
+ self->base.streamImport=self;
2593
+ self->base.streamSize=diffStream->streamSize;
2594
+ self->base.read=_TDiffToSingleStream_read;
2595
+ self->base._private_reserved=0;
2596
+ self->diffStream=diffStream;
2597
+ self->readedSize=0;
2598
+ self->cachedBufBegin=_TDiffToSingleStream_kBufSize;
2599
+ self->isInSingleStream=hpatch_FALSE;
2600
+ }
2601
+
2602
+ hpatch_BOOL _patch_single_stream_mt(sspatch_listener_t* listener,
2603
+ const hpatch_TStreamOutput* __out_newData,
2604
+ const hpatch_TStreamInput* oldData,
2605
+ const hpatch_TStreamInput* singleCompressedDiff,
2606
+ hpatch_StreamPos_t diffInfo_pos,
2607
+ sspatch_coversListener_t* coversListener,
2608
+ size_t maxThreadNum,hpatchMTSets_t hpatchMTSets){
2609
+ hpatch_BOOL result=hpatch_TRUE;
2610
+ hpatch_TDecompress* decompressPlugin=0;
2611
+ unsigned char* temp_cache=0;
2612
+ unsigned char* temp_cacheEnd=0;
2613
+ hpatch_singleCompressedDiffInfo diffInfo;
2614
+ hpatch_TStreamOutput _out_newData=*__out_newData;
2615
+ hpatch_TStreamOutput* out_newData=&_out_newData;
2616
+ TDiffToSingleStream _toSStream;
2617
+ assert((listener)&&(listener->onDiffInfo));
2618
+ TDiffToSingleStream_init(&_toSStream,singleCompressedDiff);
2619
+ singleCompressedDiff=&_toSStream.base;
2620
+
2621
+ if (!getSingleCompressedDiffInfo(&diffInfo,singleCompressedDiff,diffInfo_pos))
2622
+ return _hpatch_FALSE;
2623
+ if (diffInfo.newDataSize>out_newData->streamSize)
2624
+ return _hpatch_FALSE;
2625
+ out_newData->streamSize=diffInfo.newDataSize;
2626
+ if (diffInfo.oldDataSize!=oldData->streamSize)
2627
+ return _hpatch_FALSE;
2628
+ if (!listener->onDiffInfo(listener,&diffInfo,&decompressPlugin,&temp_cache,&temp_cacheEnd))
2629
+ return _hpatch_FALSE;
2630
+
2631
+ if ((temp_cache==0)||(temp_cache>=temp_cacheEnd))
2632
+ result=_hpatch_FALSE;
2633
+ if (result){
2634
+ result=_patch_single_compressed_diff_mt(out_newData,oldData,singleCompressedDiff,diffInfo.diffDataPos,
2635
+ diffInfo.uncompressedSize,diffInfo.compressedSize,decompressPlugin,
2636
+ diffInfo.coverCount,(size_t)diffInfo.stepMemSize,
2637
+ temp_cache,temp_cacheEnd,coversListener,maxThreadNum,hpatchMTSets);
2638
+ }
2639
+ if (listener->onPatchFinish)
2640
+ listener->onPatchFinish(listener,temp_cache,temp_cacheEnd);
2641
+ return result;
2642
+ }
2643
+