react-native-update 10.34.3 → 10.34.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (800) hide show
  1. package/harmony/pushy/src/main/cpp/HDiffPatch/CHANGELOG.md +34 -172
  2. package/harmony/pushy/src/main/cpp/HDiffPatch/LICENSE +4 -4
  3. package/harmony/pushy/src/main/cpp/HDiffPatch/Makefile +63 -379
  4. package/harmony/pushy/src/main/cpp/HDiffPatch/README.md +170 -415
  5. package/harmony/pushy/src/main/cpp/HDiffPatch/_atosize.h +10 -54
  6. package/harmony/pushy/src/main/cpp/HDiffPatch/_clock_for_demo.h +1 -13
  7. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/Android.mk +18 -171
  8. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/Application.mk +4 -5
  9. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/hpatch.c +7 -38
  10. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/hpatch.h +4 -15
  11. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/hpatch_jni.c +12 -22
  12. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/java/com/github/sisong/HPatch.java +4 -22
  13. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/codeblocks/HDiffPatch.workspace +8 -0
  14. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/codeblocks/HDiffZ.cbp +219 -0
  15. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/codeblocks/HPatchZ.cbp +156 -0
  16. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/codeblocks/unitTest.cbp +65 -0
  17. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/HDiffPatch.sln +105 -155
  18. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/HDiffZ.vcxproj +236 -363
  19. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/HDiffZ.vcxproj.user +3 -0
  20. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/HPatchZ.vcxproj +317 -347
  21. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/HPatchZ.vcxproj.user +3 -0
  22. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/unitTest.vcxproj +181 -295
  23. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/unitTest.vcxproj.user +3 -0
  24. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/HDiffPatch.xcworkspace/contents.xcworkspacedata +0 -9
  25. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/bestParams.xcodeproj/project.pbxproj +14 -53
  26. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/hdiffz.xcodeproj/project.pbxproj +32 -162
  27. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/hpatchz.xcodeproj/project.pbxproj +22 -89
  28. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/lzma.xcodeproj/project.pbxproj +13 -237
  29. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/testHashClash.xcodeproj/project.pbxproj +2 -2
  30. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/unitTest.xcodeproj/project.pbxproj +14 -194
  31. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/zstd.xcodeproj/project.pbxproj +10 -30
  32. package/harmony/pushy/src/main/cpp/HDiffPatch/checksum_plugin_demo.h +3 -458
  33. package/harmony/pushy/src/main/cpp/HDiffPatch/compress_parallel.cpp +71 -106
  34. package/harmony/pushy/src/main/cpp/HDiffPatch/compress_parallel.h +3 -3
  35. package/harmony/pushy/src/main/cpp/HDiffPatch/compress_plugin_demo.h +110 -484
  36. package/harmony/pushy/src/main/cpp/HDiffPatch/decompress_plugin_demo.h +193 -835
  37. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_diff.cpp +50 -99
  38. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_diff.h +4 -18
  39. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_diff_tools.cpp +8 -147
  40. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_diff_tools.h +6 -18
  41. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_manifest.cpp +25 -7
  42. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/file_for_dirDiff.h +113 -5
  43. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch.c +97 -163
  44. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch.h +39 -49
  45. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch_tools.c +15 -15
  46. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch_tools.h +2 -18
  47. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch_types.h +4 -8
  48. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/new_dir_output.c +57 -72
  49. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/new_dir_output.h +13 -18
  50. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/new_stream.c +1 -1
  51. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/new_stream.h +2 -2
  52. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/ref_stream.c +2 -2
  53. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/ref_stream.h +2 -2
  54. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/res_handle_limit.c +2 -2
  55. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/res_handle_limit.h +1 -1
  56. package/harmony/pushy/src/main/cpp/HDiffPatch/file_for_patch.c +100 -311
  57. package/harmony/pushy/src/main/cpp/HDiffPatch/file_for_patch.h +72 -53
  58. package/harmony/pushy/src/main/cpp/HDiffPatch/hdiffz.cpp +487 -888
  59. package/harmony/pushy/src/main/cpp/HDiffPatch/hpatch_dir_listener.h +28 -45
  60. package/harmony/pushy/src/main/cpp/HDiffPatch/hpatchz.c +247 -812
  61. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/diff.cpp +544 -1265
  62. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/diff.h +38 -123
  63. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/diff_types.h +0 -115
  64. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/bytes_rle.cpp +102 -272
  65. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/bytes_rle.h +12 -22
  66. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/compress_detect.cpp +4 -18
  67. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/compress_detect.h +5 -7
  68. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/{divsufsort.cpp → divsufsort.c} +8 -5
  69. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.c.inc.h +164 -91
  70. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.h +102 -5
  71. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort64.c +13 -0
  72. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort64.h +97 -1
  73. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort_private.h +44 -23
  74. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/sssort.c.inc.h +89 -54
  75. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/trsort.c.inc.h +55 -48
  76. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/utils.c.inc.h +381 -0
  77. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/adler_roll.c +47 -110
  78. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/adler_roll.h +4 -11
  79. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/bloom_filter.h +26 -53
  80. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/covers.h +25 -103
  81. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/digest_matcher.cpp +130 -271
  82. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/digest_matcher.h +7 -17
  83. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp +37 -628
  84. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.h +43 -203
  85. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/mem_buf.h +10 -14
  86. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/pack_uint.h +7 -22
  87. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/suffix_string.cpp +46 -132
  88. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/suffix_string.h +9 -48
  89. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/patch.c +299 -650
  90. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/patch.h +82 -120
  91. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/patch_private.h +7 -87
  92. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/patch_types.h +9 -119
  93. package/harmony/pushy/src/main/cpp/HDiffPatch/libParallel/parallel_channel.cpp +6 -2
  94. package/harmony/pushy/src/main/cpp/HDiffPatch/libParallel/parallel_channel.h +15 -192
  95. package/harmony/pushy/src/main/cpp/HDiffPatch/libParallel/parallel_import.cpp +367 -0
  96. package/harmony/pushy/src/main/cpp/HDiffPatch/libParallel/parallel_import.h +56 -31
  97. package/harmony/pushy/src/main/cpp/HDiffPatch/test/_private_searchBestParams.cpp +1 -1
  98. package/harmony/pushy/src/main/cpp/HDiffPatch/test/hpatchz_test.cpp +1 -0
  99. package/harmony/pushy/src/main/cpp/HDiffPatch/test/testHashClash.cpp +31 -225
  100. package/harmony/pushy/src/main/cpp/HDiffPatch/test/unit_test.cpp +94 -566
  101. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/7zAsm.asm +28 -222
  102. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/7zCrcOpt.asm +117 -228
  103. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/AesOpt.asm +173 -678
  104. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/LzmaDecOpt.asm +22 -103
  105. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/XzCrc64Opt.asm +167 -485
  106. package/harmony/pushy/src/main/cpp/lzma/C/7z.h +6 -8
  107. package/harmony/pushy/src/main/cpp/lzma/C/7zAlloc.c +30 -39
  108. package/harmony/pushy/src/main/cpp/lzma/C/7zAlloc.h +3 -3
  109. package/harmony/pushy/src/main/cpp/lzma/C/7zArcIn.c +217 -232
  110. package/harmony/pushy/src/main/cpp/lzma/C/7zBuf.h +3 -3
  111. package/harmony/pushy/src/main/cpp/lzma/C/7zCrc.c +68 -404
  112. package/harmony/pushy/src/main/cpp/lzma/C/7zCrc.h +6 -9
  113. package/harmony/pushy/src/main/cpp/lzma/C/7zCrcOpt.c +79 -163
  114. package/harmony/pushy/src/main/cpp/lzma/C/7zDec.c +78 -160
  115. package/harmony/pushy/src/main/cpp/lzma/C/7zFile.c +58 -215
  116. package/harmony/pushy/src/main/cpp/lzma/C/7zFile.h +6 -15
  117. package/harmony/pushy/src/main/cpp/lzma/C/7zStream.c +23 -46
  118. package/harmony/pushy/src/main/cpp/lzma/C/7zTypes.h +89 -311
  119. package/harmony/pushy/src/main/cpp/lzma/C/7zVersion.h +5 -5
  120. package/harmony/pushy/src/main/cpp/lzma/C/Aes.c +68 -191
  121. package/harmony/pushy/src/main/cpp/lzma/C/Aes.h +8 -30
  122. package/harmony/pushy/src/main/cpp/lzma/C/AesOpt.c +108 -926
  123. package/harmony/pushy/src/main/cpp/lzma/C/Alloc.c +96 -246
  124. package/harmony/pushy/src/main/cpp/lzma/C/Alloc.h +8 -33
  125. package/harmony/pushy/src/main/cpp/lzma/C/Bcj2.c +144 -177
  126. package/harmony/pushy/src/main/cpp/lzma/C/Bcj2.h +42 -228
  127. package/harmony/pushy/src/main/cpp/lzma/C/Bcj2Enc.c +182 -377
  128. package/harmony/pushy/src/main/cpp/lzma/C/Bra.c +143 -622
  129. package/harmony/pushy/src/main/cpp/lzma/C/Bra.h +40 -81
  130. package/harmony/pushy/src/main/cpp/lzma/C/Bra86.c +58 -163
  131. package/harmony/pushy/src/main/cpp/lzma/C/BraIA64.c +48 -9
  132. package/harmony/pushy/src/main/cpp/lzma/C/Compiler.h +15 -228
  133. package/harmony/pushy/src/main/cpp/lzma/C/CpuArch.c +133 -885
  134. package/harmony/pushy/src/main/cpp/lzma/C/CpuArch.h +78 -428
  135. package/harmony/pushy/src/main/cpp/lzma/C/Delta.c +31 -136
  136. package/harmony/pushy/src/main/cpp/lzma/C/Delta.h +3 -3
  137. package/harmony/pushy/src/main/cpp/lzma/C/DllSecur.c +62 -53
  138. package/harmony/pushy/src/main/cpp/lzma/C/DllSecur.h +5 -5
  139. package/harmony/pushy/src/main/cpp/lzma/C/LzFind.c +495 -1114
  140. package/harmony/pushy/src/main/cpp/lzma/C/LzFind.h +25 -64
  141. package/harmony/pushy/src/main/cpp/lzma/C/LzFindMt.c +400 -969
  142. package/harmony/pushy/src/main/cpp/lzma/C/LzFindMt.h +24 -37
  143. package/harmony/pushy/src/main/cpp/lzma/C/LzHash.h +48 -25
  144. package/harmony/pushy/src/main/cpp/lzma/C/Lzma2Dec.c +7 -12
  145. package/harmony/pushy/src/main/cpp/lzma/C/Lzma2Dec.h +7 -8
  146. package/harmony/pushy/src/main/cpp/lzma/C/Lzma2DecMt.c +83 -96
  147. package/harmony/pushy/src/main/cpp/lzma/C/Lzma2DecMt.h +9 -11
  148. package/harmony/pushy/src/main/cpp/lzma/C/Lzma2Enc.c +92 -96
  149. package/harmony/pushy/src/main/cpp/lzma/C/Lzma2Enc.h +9 -12
  150. package/harmony/pushy/src/main/cpp/lzma/C/Lzma86.h +3 -3
  151. package/harmony/pushy/src/main/cpp/lzma/C/Lzma86Dec.c +4 -3
  152. package/harmony/pushy/src/main/cpp/lzma/C/Lzma86Enc.c +6 -3
  153. package/harmony/pushy/src/main/cpp/lzma/C/LzmaDec.c +206 -384
  154. package/harmony/pushy/src/main/cpp/lzma/C/LzmaDec.h +8 -11
  155. package/harmony/pushy/src/main/cpp/lzma/C/LzmaEnc.c +315 -489
  156. package/harmony/pushy/src/main/cpp/lzma/C/LzmaEnc.h +9 -18
  157. package/harmony/pushy/src/main/cpp/lzma/C/LzmaLib.c +3 -5
  158. package/harmony/pushy/src/main/cpp/lzma/C/LzmaLib.h +14 -21
  159. package/harmony/pushy/src/main/cpp/lzma/C/MtCoder.c +87 -90
  160. package/harmony/pushy/src/main/cpp/lzma/C/MtCoder.h +25 -28
  161. package/harmony/pushy/src/main/cpp/lzma/C/MtDec.c +88 -74
  162. package/harmony/pushy/src/main/cpp/lzma/C/MtDec.h +20 -21
  163. package/harmony/pushy/src/main/cpp/lzma/C/Ppmd.h +34 -118
  164. package/harmony/pushy/src/main/cpp/lzma/C/Ppmd7.c +293 -712
  165. package/harmony/pushy/src/main/cpp/lzma/C/Ppmd7.h +70 -109
  166. package/harmony/pushy/src/main/cpp/lzma/C/Ppmd7Dec.c +116 -237
  167. package/harmony/pushy/src/main/cpp/lzma/C/Ppmd7Enc.c +95 -245
  168. package/harmony/pushy/src/main/cpp/lzma/C/Precomp.h +5 -122
  169. package/harmony/pushy/src/main/cpp/lzma/C/RotateDefs.h +4 -24
  170. package/harmony/pushy/src/main/cpp/lzma/C/Sha256.c +143 -387
  171. package/harmony/pushy/src/main/cpp/lzma/C/Sha256.h +7 -67
  172. package/harmony/pushy/src/main/cpp/lzma/C/Sort.c +114 -241
  173. package/harmony/pushy/src/main/cpp/lzma/C/Sort.h +7 -4
  174. package/harmony/pushy/src/main/cpp/lzma/C/Threads.c +14 -731
  175. package/harmony/pushy/src/main/cpp/lzma/C/Threads.h +14 -204
  176. package/harmony/pushy/src/main/cpp/lzma/C/ThreadsP.c +396 -0
  177. package/harmony/pushy/src/main/cpp/lzma/C/ThreadsP.h +31 -0
  178. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/7z.dsp +2 -10
  179. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/7zMain.c +79 -282
  180. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/Precomp.h +7 -10
  181. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/makefile +3 -7
  182. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/makefile.gcc +75 -32
  183. package/harmony/pushy/src/main/cpp/lzma/C/Util/Lzma/LzmaUtil.c +56 -111
  184. package/harmony/pushy/src/main/cpp/lzma/C/Util/Lzma/LzmaUtil.dsp +0 -24
  185. package/harmony/pushy/src/main/cpp/lzma/C/Util/Lzma/makefile +0 -2
  186. package/harmony/pushy/src/main/cpp/lzma/C/Util/Lzma/makefile.gcc +41 -18
  187. package/harmony/pushy/src/main/cpp/lzma/C/Util/LzmaLib/LzmaLib.dsp +2 -30
  188. package/harmony/pushy/src/main/cpp/lzma/C/Util/LzmaLib/LzmaLibExports.c +6 -7
  189. package/harmony/pushy/src/main/cpp/lzma/C/Util/LzmaLib/makefile +2 -27
  190. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/Precomp.h +7 -10
  191. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/SfxSetup.c +22 -39
  192. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/makefile +2 -9
  193. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/makefile_con +1 -3
  194. package/harmony/pushy/src/main/cpp/lzma/C/Xz.c +3 -5
  195. package/harmony/pushy/src/main/cpp/lzma/C/Xz.h +47 -129
  196. package/harmony/pushy/src/main/cpp/lzma/C/XzCrc64.c +43 -97
  197. package/harmony/pushy/src/main/cpp/lzma/C/XzCrc64.h +8 -8
  198. package/harmony/pushy/src/main/cpp/lzma/C/XzCrc64Opt.c +36 -228
  199. package/harmony/pushy/src/main/cpp/lzma/C/XzDec.c +295 -405
  200. package/harmony/pushy/src/main/cpp/lzma/C/XzEnc.c +139 -194
  201. package/harmony/pushy/src/main/cpp/lzma/C/XzEnc.h +11 -15
  202. package/harmony/pushy/src/main/cpp/lzma/C/XzIn.c +134 -200
  203. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/7zip.mak +6 -6
  204. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Aes.mak +1 -4
  205. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zCompressionMode.h +13 -29
  206. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zDecode.cpp +90 -120
  207. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zDecode.h +6 -9
  208. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zEncode.cpp +140 -183
  209. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zEncode.h +20 -23
  210. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zExtract.cpp +57 -78
  211. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zFolderInStream.cpp +44 -169
  212. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zFolderInStream.h +17 -57
  213. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zHandler.cpp +109 -141
  214. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zHandler.h +57 -54
  215. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zHandlerOut.cpp +116 -336
  216. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zHeader.cpp +1 -1
  217. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zHeader.h +9 -17
  218. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zIn.cpp +136 -234
  219. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zIn.h +26 -35
  220. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zItem.h +5 -10
  221. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zOut.cpp +155 -280
  222. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zOut.h +40 -51
  223. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zProperties.cpp +59 -67
  224. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zProperties.h +2 -6
  225. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zRegister.cpp +2 -8
  226. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zSpecStream.cpp +3 -12
  227. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zSpecStream.h +9 -23
  228. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zUpdate.cpp +387 -975
  229. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zUpdate.h +16 -44
  230. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/StdAfx.h +2 -5
  231. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Archive.def +0 -2
  232. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Archive2.def +0 -2
  233. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/ArchiveExports.cpp +8 -15
  234. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/CoderMixer2.cpp +87 -106
  235. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/CoderMixer2.h +57 -57
  236. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/DummyOutStream.cpp +1 -1
  237. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/DummyOutStream.h +8 -6
  238. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/HandlerOut.cpp +43 -126
  239. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/HandlerOut.h +18 -77
  240. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/InStreamWithCRC.cpp +9 -20
  241. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/InStreamWithCRC.h +23 -20
  242. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/ItemNameUtils.cpp +9 -61
  243. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/ItemNameUtils.h +3 -8
  244. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/MultiStream.cpp +27 -29
  245. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/MultiStream.h +26 -23
  246. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp +2 -2
  247. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/OutStreamWithCRC.h +8 -6
  248. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/ParseProperties.h +2 -2
  249. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/StdAfx.h +2 -5
  250. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/DllExports2.cpp +10 -63
  251. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/IArchive.h +173 -319
  252. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/LzmaHandler.cpp +113 -92
  253. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/SplitHandler.cpp +53 -47
  254. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/StdAfx.h +2 -5
  255. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/XzHandler.cpp +208 -352
  256. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/XzHandler.h +2 -2
  257. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Asm.mak +3 -6
  258. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/Alone.dsp +47 -227
  259. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/StdAfx.h +2 -5
  260. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/makefile +5 -19
  261. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zExtractR/StdAfx.h +2 -5
  262. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zExtractR/makefile +2 -4
  263. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zR/StdAfx.h +2 -5
  264. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zR/makefile +1 -6
  265. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/LzmaAlone.cpp +53 -71
  266. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/LzmaCon.dsp +22 -85
  267. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/StdAfx.h +2 -5
  268. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/makefile +4 -13
  269. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/makefile.gcc +166 -102
  270. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/SFXCon.dsp +4 -109
  271. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/SfxCon.cpp +30 -69
  272. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/StdAfx.h +2 -5
  273. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/makefile +7 -10
  274. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/resource.rc +1 -5
  275. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/ExtractCallbackSfx.cpp +16 -16
  276. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/ExtractCallbackSfx.h +12 -9
  277. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp +9 -7
  278. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/ExtractEngine.h +2 -2
  279. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp +5 -74
  280. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/SfxSetup.cpp +51 -58
  281. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/StdAfx.h +10 -3
  282. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/makefile +5 -9
  283. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/SFXWin.dsp +6 -92
  284. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/SfxWin.cpp +19 -46
  285. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/StdAfx.h +11 -3
  286. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/makefile +5 -11
  287. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/resource.rc +0 -5
  288. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/CWrappers.cpp +28 -136
  289. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/CWrappers.h +5 -67
  290. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/CreateCoder.cpp +62 -74
  291. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/CreateCoder.h +24 -32
  292. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/FilePathAutoRename.cpp +7 -7
  293. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/FilePathAutoRename.h +2 -2
  294. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/FileStreams.cpp +100 -548
  295. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/FileStreams.h +86 -125
  296. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/FilterCoder.cpp +116 -258
  297. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/FilterCoder.h +76 -72
  298. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/InBuffer.cpp +15 -34
  299. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/InBuffer.h +9 -38
  300. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/InOutTempBuffer.cpp +82 -192
  301. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/InOutTempBuffer.h +28 -25
  302. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/LimitedStreams.cpp +52 -78
  303. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/LimitedStreams.h +83 -52
  304. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/LockedStream.h +2 -2
  305. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/MethodId.h +2 -2
  306. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/MethodProps.cpp +67 -323
  307. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/MethodProps.h +38 -123
  308. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/OffsetStream.cpp +8 -6
  309. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/OffsetStream.h +13 -9
  310. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/OutBuffer.cpp +12 -12
  311. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/OutBuffer.h +7 -74
  312. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/ProgressUtils.cpp +5 -5
  313. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/ProgressUtils.h +13 -11
  314. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/PropId.cpp +1 -10
  315. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/RegisterArc.h +14 -16
  316. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/RegisterCodec.h +16 -16
  317. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StdAfx.h +2 -5
  318. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StreamBinder.cpp +50 -45
  319. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StreamBinder.h +21 -39
  320. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StreamObjects.cpp +42 -47
  321. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StreamObjects.h +53 -42
  322. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StreamUtils.cpp +4 -49
  323. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StreamUtils.h +2 -20
  324. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/UniqBlocks.cpp +4 -4
  325. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/UniqBlocks.h +5 -20
  326. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/VirtThread.cpp +9 -8
  327. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/VirtThread.h +5 -5
  328. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Bcj2Coder.cpp +355 -556
  329. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Bcj2Coder.h +59 -66
  330. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Bcj2Register.cpp +2 -2
  331. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/BcjCoder.cpp +6 -6
  332. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/BcjCoder.h +13 -19
  333. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/BcjRegister.cpp +2 -2
  334. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/BranchMisc.cpp +5 -88
  335. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/BranchMisc.h +18 -42
  336. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/BranchRegister.cpp +16 -33
  337. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/ByteSwap.cpp +53 -52
  338. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/CodecExports.cpp +30 -64
  339. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/CopyCoder.cpp +22 -55
  340. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/CopyCoder.h +26 -11
  341. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/DeltaFilter.cpp +28 -26
  342. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Lzma2Decoder.cpp +28 -30
  343. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Lzma2Decoder.h +54 -45
  344. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Lzma2Encoder.cpp +12 -24
  345. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Lzma2Encoder.h +22 -10
  346. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Lzma2Register.cpp +1 -1
  347. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/LzmaDecoder.cpp +26 -33
  348. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/LzmaDecoder.h +51 -51
  349. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/LzmaEncoder.cpp +40 -232
  350. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/LzmaEncoder.h +14 -13
  351. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/LzmaRegister.cpp +1 -1
  352. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/PpmdDecoder.cpp +35 -84
  353. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/PpmdDecoder.h +41 -42
  354. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/PpmdEncoder.cpp +25 -66
  355. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/PpmdEncoder.h +17 -8
  356. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/PpmdRegister.cpp +1 -1
  357. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/StdAfx.h +2 -5
  358. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/XzDecoder.cpp +12 -13
  359. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/XzDecoder.h +32 -26
  360. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/XzEncoder.cpp +16 -14
  361. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/XzEncoder.h +20 -9
  362. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crc.mak +1 -1
  363. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crc64.mak +1 -1
  364. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/7zAes.cpp +32 -67
  365. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/7zAes.h +18 -30
  366. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/7zAesRegister.cpp +3 -3
  367. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/MyAes.cpp +43 -208
  368. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/MyAes.h +25 -90
  369. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/MyAesReg.cpp +4 -17
  370. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/RandGen.cpp +21 -29
  371. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/RandGen.h +3 -4
  372. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/StdAfx.h +2 -5
  373. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/GuiCommon.rc +3 -38
  374. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Guid.txt +3 -26
  375. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/ICoder.h +172 -253
  376. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/IDecl.h +7 -55
  377. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/IPassword.h +12 -43
  378. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/IProgress.h +9 -10
  379. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/IStream.h +50 -133
  380. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/LzmaDec.mak +2 -4
  381. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/MyVersionInfo.rc +1 -1
  382. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/PropID.h +2 -53
  383. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/Client7z.cpp +177 -329
  384. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/Client7z.dsp +1 -97
  385. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/StdAfx.h +2 -5
  386. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/makefile +1 -2
  387. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveCommandLine.cpp +183 -687
  388. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveCommandLine.h +15 -49
  389. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp +913 -2275
  390. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveExtractCallback.h +115 -353
  391. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveName.cpp +106 -127
  392. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveName.h +3 -9
  393. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp +35 -272
  394. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveOpenCallback.h +64 -134
  395. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Bench.cpp +1200 -2608
  396. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Bench.h +20 -64
  397. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/DefaultName.cpp +1 -1
  398. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/DefaultName.h +2 -2
  399. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/DirItem.h +36 -253
  400. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/EnumDirItems.cpp +233 -774
  401. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/EnumDirItems.h +6 -2
  402. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ExitCode.h +2 -2
  403. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Extract.cpp +63 -156
  404. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Extract.h +10 -23
  405. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ExtractMode.h +2 -12
  406. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ExtractingFilePath.cpp +6 -22
  407. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ExtractingFilePath.h +4 -4
  408. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/HashCalc.cpp +65 -1991
  409. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/HashCalc.h +29 -241
  410. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/IFileExtractCallback.h +47 -45
  411. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/LoadCodecs.cpp +179 -442
  412. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/LoadCodecs.h +89 -147
  413. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/OpenArchive.cpp +380 -529
  414. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/OpenArchive.h +42 -75
  415. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/PropIDUtils.cpp +86 -163
  416. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/PropIDUtils.h +5 -5
  417. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Property.h +2 -2
  418. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/SetProperties.cpp +15 -23
  419. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/SetProperties.h +2 -2
  420. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/SortUtils.h +2 -2
  421. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/StdAfx.h +2 -5
  422. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/TempFiles.cpp +1 -2
  423. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/TempFiles.h +2 -5
  424. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Update.cpp +368 -595
  425. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Update.h +47 -68
  426. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateAction.h +2 -2
  427. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateCallback.cpp +146 -444
  428. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateCallback.h +68 -103
  429. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdatePair.cpp +42 -111
  430. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdatePair.h +2 -2
  431. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateProduce.cpp +3 -7
  432. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateProduce.h +6 -11
  433. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/WorkDir.cpp +35 -25
  434. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/WorkDir.h +4 -8
  435. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ZipRegistry.h +9 -91
  436. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/BenchCon.cpp +4 -4
  437. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/BenchCon.h +2 -2
  438. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/Console.mak +1 -4
  439. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/Console.manifest +0 -3
  440. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/ConsoleClose.cpp +19 -48
  441. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/ConsoleClose.h +12 -18
  442. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/ExtractCallbackConsole.cpp +41 -162
  443. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/ExtractCallbackConsole.h +41 -88
  444. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/HashCon.cpp +81 -140
  445. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/HashCon.h +17 -27
  446. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/List.cpp +124 -182
  447. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/List.h +7 -22
  448. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/Main.cpp +109 -590
  449. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/MainAr.cpp +2 -62
  450. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/OpenCallbackConsole.cpp +3 -3
  451. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/OpenCallbackConsole.h +10 -17
  452. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/PercentPrinter.cpp +10 -13
  453. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/PercentPrinter.h +9 -13
  454. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/StdAfx.h +2 -5
  455. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp +24 -320
  456. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/UpdateCallbackConsole.h +26 -50
  457. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/UserInputUtils.cpp +5 -13
  458. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/UserInputUtils.h +2 -2
  459. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/makefile +2 -6
  460. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Explorer/MyMessages.cpp +6 -12
  461. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Explorer/MyMessages.h +4 -4
  462. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/BrowseDialog.cpp +195 -302
  463. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/BrowseDialog.h +4 -15
  464. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ComboDialog.cpp +2 -2
  465. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ComboDialog.h +6 -6
  466. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/DialogSize.h +2 -2
  467. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ExtractCallback.cpp +181 -416
  468. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ExtractCallback.h +197 -216
  469. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/FormatUtils.h +2 -2
  470. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/LangUtils.h +5 -13
  471. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/MyWindowsNew.h +5 -48
  472. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.cpp +49 -215
  473. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.h +30 -50
  474. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.rc +1 -3
  475. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/OverwriteDialogRes.h +3 -5
  476. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PasswordDialog.cpp +5 -5
  477. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PasswordDialog.h +6 -6
  478. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PasswordDialog.rc +0 -4
  479. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog.cpp +10 -15
  480. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog.h +17 -18
  481. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.cpp +130 -276
  482. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.h +52 -56
  483. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog2Res.h +1 -2
  484. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog2a.rc +3 -8
  485. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PropertyName.h +2 -2
  486. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PropertyNameRes.h +0 -9
  487. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/SysIconUtils.cpp +89 -185
  488. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/SysIconUtils.h +20 -23
  489. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/resource.h +1 -23
  490. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/resourceGui.h +0 -10
  491. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/Extract.rc +4 -4
  492. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractDialog.cpp +33 -36
  493. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractDialog.h +15 -15
  494. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractGUI.cpp +22 -39
  495. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractGUI.h +3 -4
  496. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/HashGUI.h +2 -2
  497. package/harmony/pushy/src/main/cpp/lzma/CPP/Build.mak +13 -109
  498. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/AutoPtr.h +14 -25
  499. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/CRC.cpp +1 -1
  500. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/C_FileIO.cpp +90 -1
  501. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/C_FileIO.h +49 -2
  502. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/ComTry.h +2 -2
  503. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/CommandLineParser.cpp +7 -41
  504. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/CommandLineParser.h +3 -3
  505. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Common.h +29 -14
  506. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/CrcReg.cpp +45 -24
  507. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Defs.h +2 -3
  508. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/DynamicBuffer.h +5 -17
  509. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/IntToString.cpp +110 -132
  510. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/IntToString.h +9 -35
  511. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Lang.h +5 -12
  512. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/ListFileUtils.cpp +31 -49
  513. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/ListFileUtils.h +4 -4
  514. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyBuffer.h +21 -59
  515. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyBuffer2.h +10 -95
  516. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyCom.h +81 -497
  517. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyException.h +2 -2
  518. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyGuidDef.h +9 -18
  519. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyInitGuid.h +5 -17
  520. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyLinux.h +2 -35
  521. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyString.cpp +164 -347
  522. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyString.h +35 -246
  523. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyTypes.h +8 -11
  524. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyUnknown.h +11 -2
  525. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyVector.h +94 -184
  526. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyWindows.cpp +11 -158
  527. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyWindows.h +54 -148
  528. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/NewHandler.cpp +27 -204
  529. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/NewHandler.h +5 -38
  530. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Sha256Reg.cpp +16 -43
  531. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StdAfx.h +2 -2
  532. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StdInStream.cpp +11 -20
  533. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StdInStream.h +5 -13
  534. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StdOutStream.cpp +39 -124
  535. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StdOutStream.h +11 -27
  536. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StringConvert.cpp +15 -458
  537. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StringConvert.h +2 -24
  538. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StringToInt.cpp +89 -99
  539. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StringToInt.h +2 -19
  540. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/TextConfig.cpp +11 -10
  541. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/TextConfig.h +2 -2
  542. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/UTFConvert.cpp +102 -677
  543. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/UTFConvert.h +5 -377
  544. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Wildcard.cpp +84 -197
  545. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Wildcard.h +25 -107
  546. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/XzCrc64Reg.cpp +14 -11
  547. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/COM.h +8 -24
  548. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/CommonDialog.cpp +113 -197
  549. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/CommonDialog.h +12 -32
  550. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ComboBox.cpp +4 -4
  551. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ComboBox.h +10 -22
  552. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/CommandBar.h +6 -6
  553. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Dialog.cpp +47 -242
  554. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Dialog.h +51 -94
  555. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Edit.h +2 -2
  556. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ImageList.h +4 -4
  557. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ListView.cpp +26 -33
  558. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ListView.h +22 -32
  559. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ProgressBar.h +13 -13
  560. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/PropertyPage.cpp +34 -56
  561. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/PropertyPage.h +9 -9
  562. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ReBar.h +3 -3
  563. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Static.h +2 -2
  564. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/StatusBar.h +5 -5
  565. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/StdAfx.h +2 -5
  566. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ToolBar.h +3 -3
  567. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Trackbar.h +2 -2
  568. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Window2.cpp +6 -8
  569. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Window2.h +7 -9
  570. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/DLL.cpp +8 -77
  571. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/DLL.h +10 -55
  572. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Defs.h +4 -4
  573. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/ErrorMsg.cpp +2 -69
  574. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/ErrorMsg.h +2 -3
  575. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileDir.cpp +80 -728
  576. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileDir.h +7 -62
  577. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileFind.cpp +56 -756
  578. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileFind.h +19 -205
  579. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileIO.cpp +47 -569
  580. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileIO.h +28 -283
  581. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileLink.cpp +112 -369
  582. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileMapping.h +3 -3
  583. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileName.cpp +113 -185
  584. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileName.h +14 -41
  585. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileSystem.cpp +10 -66
  586. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileSystem.h +2 -6
  587. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Handle.h +4 -6
  588. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/MemoryLock.cpp +14 -29
  589. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/MemoryLock.h +2 -2
  590. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/NtCheck.h +2 -14
  591. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/PropVariant.cpp +56 -102
  592. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/PropVariant.h +9 -68
  593. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/PropVariantConv.cpp +14 -150
  594. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/PropVariantConv.h +3 -13
  595. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Registry.cpp +128 -212
  596. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Registry.h +20 -32
  597. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/ResourceString.cpp +4 -4
  598. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/ResourceString.h +2 -3
  599. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/SecurityUtils.cpp +18 -23
  600. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/SecurityUtils.h +56 -39
  601. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Shell.cpp +58 -539
  602. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Shell.h +14 -49
  603. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/StdAfx.h +2 -5
  604. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Synchronization.cpp +0 -77
  605. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Synchronization.h +18 -240
  606. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/System.cpp +38 -317
  607. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/System.h +5 -154
  608. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Thread.h +10 -18
  609. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/TimeUtils.cpp +37 -291
  610. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/TimeUtils.h +10 -124
  611. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Window.cpp +7 -7
  612. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Window.h +19 -98
  613. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/LzmaAlone.csproj +90 -0
  614. package/harmony/pushy/src/main/cpp/lzma/DOC/Methods.txt +2 -6
  615. package/harmony/pushy/src/main/cpp/lzma/DOC/lzma-history.txt +0 -205
  616. package/harmony/pushy/src/main/cpp/lzma/DOC/lzma-sdk.txt +13 -93
  617. package/harmony/pushy/src/main/cpp/lzma/DOC/lzma.txt +13 -30
  618. package/harmony/pushy/src/main/cpp/lzma/bin/7zS2.sfx +0 -0
  619. package/harmony/pushy/src/main/cpp/lzma/bin/7zS2con.sfx +0 -0
  620. package/harmony/pushy/src/main/cpp/lzma/bin/7zSD.sfx +0 -0
  621. package/harmony/pushy/src/main/cpp/lzma/bin/7zdec.exe +0 -0
  622. package/harmony/pushy/src/main/cpp/lzma/bin/7zr.exe +0 -0
  623. package/harmony/pushy/src/main/cpp/lzma/bin/lzma.exe +0 -0
  624. package/harmony/pushy/src/main/cpp/lzma/bin/x64/7zr.exe +0 -0
  625. package/package.json +1 -1
  626. package/harmony/pushy/src/main/cpp/HDiffPatch/README_cn.md +0 -547
  627. package/harmony/pushy/src/main/cpp/HDiffPatch/_hextobytes.h +0 -112
  628. package/harmony/pushy/src/main/cpp/HDiffPatch/bsdiff_wrapper/bsdiff_wrapper.cpp +0 -389
  629. package/harmony/pushy/src/main/cpp/HDiffPatch/bsdiff_wrapper/bsdiff_wrapper.h +0 -73
  630. package/harmony/pushy/src/main/cpp/HDiffPatch/bsdiff_wrapper/bspatch_wrapper.c +0 -266
  631. package/harmony/pushy/src/main/cpp/HDiffPatch/bsdiff_wrapper/bspatch_wrapper.h +0 -58
  632. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/build_libs_patchers.bat +0 -1
  633. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/build_libs_patchers.sh +0 -1
  634. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/bzip2.vcxproj +0 -228
  635. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/hpatchz_test.vcxproj +0 -215
  636. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/libdeflate.vcxproj +0 -256
  637. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/longPathAware.exe.manifest +0 -7
  638. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/lzma.vcxproj +0 -271
  639. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/testHashClash.vcxproj +0 -228
  640. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/zlib.vcxproj +0 -242
  641. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/zstd.vcxproj +0 -287
  642. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/HDiffPatch.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +0 -8
  643. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/libdeflate.xcodeproj/project.pbxproj +0 -286
  644. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/zlib.xcodeproj/project.pbxproj +0 -308
  645. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode_iOS_hpatchz/hpatch_objc/hpatch_objc.h +0 -33
  646. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode_iOS_hpatchz/hpatch_objc/hpatch_objc.m +0 -33
  647. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode_iOS_hpatchz/hpatchz.xcodeproj/project.pbxproj +0 -774
  648. package/harmony/pushy/src/main/cpp/HDiffPatch/hdiffz_import_patch.c +0 -31
  649. package/harmony/pushy/src/main/cpp/HDiffPatch/hdiffz_import_patch.h +0 -42
  650. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/diff_for_hpatch_lite.h +0 -74
  651. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/match_block.cpp +0 -478
  652. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/match_block.h +0 -222
  653. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort64.cpp +0 -14
  654. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/match_inplace.cpp +0 -168
  655. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/match_inplace.h +0 -44
  656. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/qsort_parallel.h +0 -125
  657. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/hpatch_mt/_hcache_old_mt.c +0 -243
  658. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/hpatch_mt/_hcache_old_mt.h +0 -51
  659. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/hpatch_mt/_hinput_mt.c +0 -153
  660. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/hpatch_mt/_hinput_mt.h +0 -54
  661. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/hpatch_mt/_houtput_mt.c +0 -158
  662. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/hpatch_mt/_houtput_mt.h +0 -49
  663. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/hpatch_mt/_hpatch_mt.c +0 -294
  664. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/hpatch_mt/_hpatch_mt.h +0 -59
  665. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/hpatch_mt/_patch_private_mt.h +0 -217
  666. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/hpatch_mt/hpatch_mt.c +0 -349
  667. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/hpatch_mt/hpatch_mt.h +0 -110
  668. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatchLite/hpatch_lite.c +0 -366
  669. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatchLite/hpatch_lite.h +0 -91
  670. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatchLite/hpatch_lite_input_cache.h +0 -31
  671. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatchLite/hpatch_lite_types.h +0 -106
  672. package/harmony/pushy/src/main/cpp/HDiffPatch/libParallel/parallel_import_c.c +0 -497
  673. package/harmony/pushy/src/main/cpp/HDiffPatch/libParallel/parallel_import_c.h +0 -106
  674. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sign_diff/_match_in_old_sign.cpp +0 -254
  675. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sign_diff/_match_in_old_sign.h +0 -39
  676. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sign_diff/_sign_diff_type.h +0 -37
  677. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sign_diff/sign_diff.cpp +0 -62
  678. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sign_diff/sign_diff.h +0 -44
  679. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/dict_decompress_plugin.h +0 -156
  680. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/dir_sync_client.cpp +0 -440
  681. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/dir_sync_client.h +0 -88
  682. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/match_in_old.cpp +0 -332
  683. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/match_in_old.h +0 -48
  684. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/match_in_types.h +0 -198
  685. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/sync_client.cpp +0 -697
  686. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/sync_client.h +0 -74
  687. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/sync_client_private.h +0 -262
  688. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/sync_client_type.h +0 -174
  689. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/sync_client_type_private.h +0 -174
  690. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/sync_diff_data.cpp +0 -252
  691. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/sync_diff_data.h +0 -67
  692. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/sync_info_client.cpp +0 -680
  693. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/sync_info_client.h +0 -137
  694. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_make/dict_compress_plugin.h +0 -83
  695. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_make/dir_sync_make.cpp +0 -125
  696. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_make/dir_sync_make.h +0 -56
  697. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_make/hsynz_plugin.h +0 -55
  698. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_make/match_in_new.cpp +0 -147
  699. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_make/match_in_new.h +0 -38
  700. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_make/sync_info_make.cpp +0 -354
  701. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_make/sync_info_make.h +0 -76
  702. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_make/sync_make.cpp +0 -521
  703. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_make/sync_make.h +0 -69
  704. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_make/sync_make_hash_clash.h +0 -122
  705. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_make/sync_make_private.h +0 -66
  706. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/zsync_client_wrapper/zsync_client_type.h +0 -36
  707. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/zsync_client_wrapper/zsync_client_type_private.h +0 -81
  708. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/zsync_client_wrapper/zsync_client_wrapper.cpp +0 -247
  709. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/zsync_client_wrapper/zsync_client_wrapper.h +0 -71
  710. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/zsync_client_wrapper/zsync_info_client.cpp +0 -351
  711. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/zsync_client_wrapper/zsync_info_client.h +0 -42
  712. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/zsync_client_wrapper/zsync_match_in_old.cpp +0 -124
  713. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/zsync_client_wrapper/zsync_match_in_old.h +0 -38
  714. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/zsync_make_wrapper/zsync_info_make.cpp +0 -203
  715. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/zsync_make_wrapper/zsync_info_make.h +0 -55
  716. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/zsync_make_wrapper/zsync_make_wrapper.cpp +0 -79
  717. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/zsync_make_wrapper/zsync_make_wrapper.h +0 -66
  718. package/harmony/pushy/src/main/cpp/HDiffPatch/vcdiff_wrapper/vcdiff_wrapper.cpp +0 -628
  719. package/harmony/pushy/src/main/cpp/HDiffPatch/vcdiff_wrapper/vcdiff_wrapper.h +0 -95
  720. package/harmony/pushy/src/main/cpp/HDiffPatch/vcdiff_wrapper/vcpatch_code_table.h +0 -78
  721. package/harmony/pushy/src/main/cpp/HDiffPatch/vcdiff_wrapper/vcpatch_wrapper.c +0 -950
  722. package/harmony/pushy/src/main/cpp/HDiffPatch/vcdiff_wrapper/vcpatch_wrapper.h +0 -72
  723. package/harmony/pushy/src/main/cpp/lzma/Asm/arm64/7zAsm.S +0 -181
  724. package/harmony/pushy/src/main/cpp/lzma/Asm/arm64/LzmaDecOpt.S +0 -1487
  725. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/LzFindOpt.asm +0 -540
  726. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/Sha256Opt.asm +0 -275
  727. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/Sort.asm +0 -860
  728. package/harmony/pushy/src/main/cpp/lzma/C/7zWindows.h +0 -101
  729. package/harmony/pushy/src/main/cpp/lzma/C/7zip_gcc_c.mak +0 -360
  730. package/harmony/pushy/src/main/cpp/lzma/C/Asm_c.mak +0 -12
  731. package/harmony/pushy/src/main/cpp/lzma/C/LzFindOpt.c +0 -578
  732. package/harmony/pushy/src/main/cpp/lzma/C/Sha256Opt.c +0 -451
  733. package/harmony/pushy/src/main/cpp/lzma/C/SwapBytes.c +0 -835
  734. package/harmony/pushy/src/main/cpp/lzma/C/SwapBytes.h +0 -17
  735. package/harmony/pushy/src/main/cpp/lzma/C/Util/Lzma/Precomp.h +0 -13
  736. package/harmony/pushy/src/main/cpp/lzma/C/Util/LzmaLib/Precomp.c +0 -4
  737. package/harmony/pushy/src/main/cpp/lzma/C/Util/LzmaLib/Precomp.h +0 -13
  738. package/harmony/pushy/src/main/cpp/lzma/C/var_clang.mak +0 -11
  739. package/harmony/pushy/src/main/cpp/lzma/C/var_clang_arm64.mak +0 -12
  740. package/harmony/pushy/src/main/cpp/lzma/C/var_clang_x64.mak +0 -11
  741. package/harmony/pushy/src/main/cpp/lzma/C/var_clang_x86.mak +0 -11
  742. package/harmony/pushy/src/main/cpp/lzma/C/var_gcc.mak +0 -12
  743. package/harmony/pushy/src/main/cpp/lzma/C/var_gcc_arm64.mak +0 -12
  744. package/harmony/pushy/src/main/cpp/lzma/C/var_gcc_x64.mak +0 -10
  745. package/harmony/pushy/src/main/cpp/lzma/C/var_gcc_x86.mak +0 -10
  746. package/harmony/pushy/src/main/cpp/lzma/C/var_mac_arm64.mak +0 -11
  747. package/harmony/pushy/src/main/cpp/lzma/C/var_mac_x64.mak +0 -11
  748. package/harmony/pushy/src/main/cpp/lzma/C/warn_clang.mak +0 -1
  749. package/harmony/pushy/src/main/cpp/lzma/C/warn_clang_mac.mak +0 -1
  750. package/harmony/pushy/src/main/cpp/lzma/C/warn_gcc.mak +0 -51
  751. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/7zip_gcc.mak +0 -1370
  752. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/makefile.gcc +0 -279
  753. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/makefile.gcc +0 -215
  754. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/MultiOutStream.cpp +0 -855
  755. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/MultiOutStream.h +0 -160
  756. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/LzFindOpt.mak +0 -7
  757. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/LzmaDec_gcc.mak +0 -14
  758. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Sha256.mak +0 -13
  759. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Sort.mak +0 -6
  760. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/makefile.gcc +0 -72
  761. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/makefile.gcc +0 -187
  762. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/MemDialog.cpp +0 -218
  763. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/MemDialog.h +0 -48
  764. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/MemDialogRes.h +0 -13
  765. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/StdAfx.h +0 -67
  766. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/7zG.exe.manifest +0 -23
  767. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/cmpl_clang.mak +0 -3
  768. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/cmpl_clang_arm64.mak +0 -3
  769. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/cmpl_clang_x64.mak +0 -3
  770. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/cmpl_clang_x86.mak +0 -3
  771. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/cmpl_gcc.mak +0 -3
  772. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/cmpl_gcc_arm64.mak +0 -3
  773. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/cmpl_gcc_x64.mak +0 -3
  774. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/cmpl_gcc_x86.mak +0 -3
  775. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/cmpl_mac_arm64.mak +0 -3
  776. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/cmpl_mac_x64.mak +0 -3
  777. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/var_clang.mak +0 -11
  778. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/var_clang_arm64.mak +0 -19
  779. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/var_clang_x64.mak +0 -11
  780. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/var_clang_x86.mak +0 -11
  781. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/var_gcc.mak +0 -12
  782. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/var_gcc_arm64.mak +0 -12
  783. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/var_gcc_x64.mak +0 -11
  784. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/var_gcc_x86.mak +0 -10
  785. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/var_mac_arm64.mak +0 -13
  786. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/var_mac_x64.mak +0 -11
  787. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/warn_clang.mak +0 -3
  788. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/warn_clang_mac.mak +0 -9
  789. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/warn_gcc.mak +0 -55
  790. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Common0.h +0 -330
  791. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/DynLimBuf.cpp +0 -93
  792. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/DynLimBuf.h +0 -41
  793. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/LzFindPrepare.cpp +0 -7
  794. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Sha256Prepare.cpp +0 -7
  795. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Clipboard.cpp +0 -130
  796. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Clipboard.h +0 -28
  797. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/MemoryGlobal.cpp +0 -36
  798. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/MemoryGlobal.h +0 -55
  799. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/SystemInfo.cpp +0 -1251
  800. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/SystemInfo.h +0 -19
@@ -29,7 +29,7 @@
29
29
  #include "diff.h"
30
30
  #include <string.h> //strlen memcmp
31
31
  #include <stdio.h> //fprintf
32
- #include <algorithm> //std::max std::sort
32
+ #include <algorithm> //std::max
33
33
  #include <vector>
34
34
  #include "private_diff/suffix_string.h"
35
35
  #include "private_diff/bytes_rle.h"
@@ -41,15 +41,13 @@
41
41
  #include "private_diff/limit_mem_diff/covers.h"
42
42
  #include "private_diff/limit_mem_diff/digest_matcher.h"
43
43
  #include "private_diff/limit_mem_diff/stream_serialize.h"
44
- #include "../../libParallel/parallel_import.h"
45
- #if (_IS_USED_MULTITHREAD)
46
- #include <thread> //if used vc++, need >= vc2012
47
- #include <atomic>
48
- #endif
49
44
  using namespace hdiff_private;
50
- #if (_IS_OUT_DIFF_INFO)
51
- int _hdiff_is_out_diff_info=1;
52
- #endif
45
+
46
+ static void getCovers_by_stream(const hpatch_TStreamInput* newData,
47
+ const hpatch_TStreamInput* oldData,
48
+ size_t kMatchBlockSize,bool kIsSkipSameRange,
49
+ TCovers& out_covers);
50
+
53
51
 
54
52
  static const char* kHDiffVersionType ="HDIFF13";
55
53
  static const char* kHDiffSFVersionType="HDIFFSF20";
@@ -57,22 +55,14 @@ static const char* kHDiffSFVersionType="HDIFFSF20";
57
55
  #define checki(value,info) { if (!(value)) { throw std::runtime_error(info); } }
58
56
  #define check(value) checki(value,"check "#value" error!")
59
57
 
60
- #if (_SSTRING_FAST_MATCH>0)
61
- static const int kMinMatchLen = (_SSTRING_FAST_MATCH>kCoverMinMatchLen)?_SSTRING_FAST_MATCH:kCoverMinMatchLen;
62
- #else
63
- static const int kMinMatchLen = kCoverMinMatchLen; //min length for match search.
64
- #endif
65
- static const int kMinMatchScore = 2; //min match benefit threshold for cover search.
66
- static const hpatch_uint64_t kDefaultLimitCoverLen=((hpatch_uint64_t)1<<30); //<=2GB-1
67
-
68
58
  namespace{
69
59
 
70
60
  typedef unsigned char TByte;
71
61
  typedef size_t TUInt;
72
62
  typedef ptrdiff_t TInt;
73
- static const int kMaxLinkSpaceLength=(1<<9)-1; //max allowed distance for merging across cover lines.
63
+ static const int kMaxLinkSpaceLength=(1<<9)-1; //跨覆盖线合并时,允许合并的最远距离.
74
64
 
75
- //cover line.
65
+ //覆盖线.
76
66
  struct TOldCover {
77
67
  TInt oldPos;
78
68
  TInt newPos;
@@ -83,16 +73,16 @@ namespace{
83
73
  inline TOldCover(const TOldCover& cover)
84
74
  :oldPos(cover.oldPos),newPos(cover.newPos),length(cover.length) { }
85
75
 
86
- inline bool isCanLink(const TOldCover& next)const{//whether the cover lines can be linked.
76
+ inline bool isCanLink(const TOldCover& next)const{//覆盖线是否可以连接.
87
77
  return isCollinear(next)&&(linkSpaceLength(next)<=kMaxLinkSpaceLength);
88
78
  }
89
- inline bool isCollinear(const TOldCover& next)const{//whether the cover lines are collinear.
90
- return cover_is_collinear(*this,next);
79
+ inline bool isCollinear(const TOldCover& next)const{//覆盖线是否在同一条直线上.
80
+ return (oldPos-next.oldPos==newPos-next.newPos);
91
81
  }
92
- inline TInt linkSpaceLength(const TOldCover& next)const{//the space between cover lines.
82
+ inline TInt linkSpaceLength(const TOldCover& next)const{//覆盖线间的间距.
93
83
  return next.oldPos-(oldPos+length);
94
84
  }
95
- inline void Link(const TOldCover& next){// link&merge two collinear cover lines.
85
+ inline void Link(const TOldCover& next){//共线的2覆盖线合并链接.
96
86
  assert(isCollinear(next));
97
87
  assert(oldPos<=next.oldPos);
98
88
  length = (next.oldPos-oldPos)+next.length;
@@ -105,106 +95,41 @@ struct TDiffData{
105
95
  const TByte* newData_end;
106
96
  const TByte* oldData;
107
97
  const TByte* oldData_end;
108
- inline TDiffData():newData(0),newData_end(0),oldData(0),oldData_end(0){}
109
- inline TDiffData(const TByte* _newData,const TByte* _newData_end,
110
- const TByte* _oldData,const TByte* _oldData_end)
111
- :newData(_newData),newData_end(_newData_end),oldData(_oldData),oldData_end(_oldData_end){}
112
- inline TDiffData(const TDiffData& src)
113
- :newData(src.newData),newData_end(src.newData_end),
114
- oldData(src.oldData),oldData_end(src.oldData_end){}
98
+ std::vector<TOldCover> covers; //选出的覆盖线.
99
+ std::vector<TByte> newDataDiff; //集中储存newData中没有被覆盖线覆盖住的字节数据.
100
+ std::vector<TByte> newDataSubDiff; //newData中的每个数值减去对应的cover线条的oldData数值和newDataDiff的数值.
115
101
  };
116
102
 
117
103
 
118
- //Find the length of the matching substring.
119
- template<TInt kMaxEqLenLimit>
120
- static TInt getEqualLengthLimit(const TByte* x,const TByte* x_end,
121
- const TByte* y,const TByte* y_end){
104
+ //查找相等的字符串长度.
105
+ static TInt getEqualLength(const TByte* x,const TByte* x_end,
106
+ const TByte* y,const TByte* y_end){
122
107
  const TInt xLen=(TInt)(x_end-x);
123
108
  const TInt yLen=(TInt)(y_end-y);
124
- TInt maxEqLen=(xLen<yLen)?xLen:yLen;
125
- if (kMaxEqLenLimit)
126
- maxEqLen=(maxEqLen<=kMaxEqLenLimit)?maxEqLen:kMaxEqLenLimit;
109
+ const TInt maxEqLen=(xLen<yLen)?xLen:yLen;
127
110
  for (TInt i=0; i<maxEqLen; ++i) {
128
111
  if (x[i]!=y[i])
129
112
  return i;
130
113
  }
131
114
  return maxEqLen;
132
115
  }
133
- #define getEqualLength(x,x_end,y,y_end) getEqualLengthLimit<0>(x,x_end,y,y_end)
134
116
 
135
- struct TDiffLimit{
136
- IDiffSearchCoverListener* listener;
137
- size_t newPos;
138
- size_t newEnd;
139
- size_t recoverOldPos;
140
- size_t recoverOldEnd;
141
- TCompressDetect& nocover_detect;
142
- TCompressDetect& cover_detect;
143
- TOldCover lastCover_back;
144
- int kMaxMatchDeep;
145
- };
146
-
147
-
148
- //Get the longest match length and its position.
117
+ //得到最长的一个匹配长度和其位置.
149
118
  static TInt getBestMatch(TInt* out_pos,const TSuffixString& sstring,
150
- const TByte* newData,const TByte* newData_end,
151
- TInt curNewPos,TDiffLimit* diffLimit=0,size_t* out_limitSkip=0){
119
+ const TByte* newData,const TByte* newData_end){
152
120
  TInt sai=sstring.lower_bound(newData,newData_end);
153
- if (sai<0) return 0;
154
- const TInt matchDeep = diffLimit?diffLimit->kMaxMatchDeep:2;
155
- const TInt kLimitOldPos=(TInt)(diffLimit?diffLimit->recoverOldPos:0);
156
- const TInt kLimitOldEnd=(TInt)(diffLimit?diffLimit->recoverOldEnd:sstring.SASize());
157
121
 
158
122
  const TByte* src_begin=sstring.src_begin();
159
123
  const TByte* src_end=sstring.src_end();
160
- TInt bestLength= kMinMatchLen -1;
124
+ TInt bestLength=-1;
161
125
  TInt bestOldPos=-1;
162
- bool leftOk = false;
163
- bool rightOk = false;
164
- for (TInt mdi= 0; mdi< matchDeep; ++mdi) {
165
- if (mdi&1){
166
- if (rightOk) continue;
167
- } else {
168
- if (leftOk) continue;
169
- }
170
- TInt i = sai + (1-(mdi&1)*2) * ((mdi+1)/2);
171
- if ((i<0)|(i>=(src_end-src_begin))) continue;
126
+ for (TInt i=sai-1; i<=sai; ++i) {
127
+ if ((i<0)||(i>=(src_end-src_begin))) continue;
172
128
  TInt curOldPos=sstring.SA(i);
173
-
174
- TInt curLength;
175
- #define kTryEqLenLimit (1024*1+17)
176
- if (0==diffLimit){
177
- curLength=getEqualLength(newData,newData_end,src_begin+curOldPos,src_end);
178
- }else{
179
- curLength=getEqualLengthLimit<kTryEqLenLimit>(newData,newData_end,src_begin+curOldPos,src_end);
180
- if ((kLimitOldPos<=curOldPos)&&(curOldPos<kLimitOldEnd)){
181
- if (curLength==kTryEqLenLimit)
182
- *out_limitSkip=kTryEqLenLimit/2;
183
- continue;
184
- }
185
- }
186
-
129
+ TInt curLength=getEqualLength(newData,newData_end,src_begin+curOldPos,src_end);
187
130
  if (curLength>bestLength){
188
- if (diffLimit){
189
- hpatch_TCover cover={(size_t)curOldPos,(size_t)curNewPos,(size_t)curLength};
190
- hpatch_StreamPos_t hitPos;
191
- diffLimit->listener->limitCover(diffLimit->listener,&cover,&hitPos);
192
- if (hitPos<=(size_t)bestLength)
193
- continue;
194
- if (hitPos==kTryEqLenLimit){
195
- curLength=getEqualLength(newData,newData_end,src_begin+curOldPos,src_end);
196
- hpatch_TCover cover={(size_t)curOldPos,(size_t)curNewPos,(size_t)curLength};
197
- diffLimit->listener->limitCover(diffLimit->listener,&cover,&hitPos);
198
- }
199
- curLength=(TInt)hitPos;
200
- }
201
- bestLength = curLength;
202
- bestOldPos= curOldPos;
203
- }
204
- if (mdi&1){
205
- rightOk=true; if (leftOk) break;
206
- } else {
207
- leftOk=true; if (rightOk) break;
131
+ bestLength=curLength;
132
+ bestOldPos=curOldPos;
208
133
  }
209
134
  }
210
135
  *out_pos=bestOldPos;
@@ -212,7 +137,7 @@ static TInt getBestMatch(TInt* out_pos,const TSuffixString& sstring,
212
137
  }
213
138
 
214
139
 
215
- //Roughly estimate the control data cost of the cover line;
140
+ //粗略估算覆盖线的控制数据成本;
216
141
  inline static TInt getCoverCtrlCost(const TOldCover& cover,const TOldCover& lastCover){
217
142
  static const int kUnLinkOtherScore=0;//0--2
218
143
  return _getIntCost<TInt,TUInt>((TInt)(cover.oldPos-lastCover.oldPos))
@@ -220,53 +145,37 @@ static TInt getBestMatch(TInt* out_pos,const TSuffixString& sstring,
220
145
  + _getUIntCost((TUInt)(cover.newPos-lastCover.newPos)) + kUnLinkOtherScore;
221
146
  }
222
147
 
223
- //Roughly estimate the possible storage cost if the region is treated as a cover.
148
+ //粗略估算 区域内当作覆盖时的可能存储成本.
149
+ inline static bool checkGetCoverCost(TInt* out_cost,TInt newPos,TInt oldPos,
150
+ TInt length,const TDiffData& diff){
151
+ if ((oldPos<0)||(oldPos+length>(diff.oldData_end-diff.oldData)))
152
+ return false;
153
+ *out_cost=(TInt)getRegionRleCost(diff.newData+newPos,length,diff.oldData+oldPos);
154
+ return true;
155
+ }
224
156
  inline static TInt getCoverCost(const TOldCover& cover,const TDiffData& diff){
225
157
  return (TInt)getRegionRleCost(diff.newData+cover.newPos,cover.length,diff.oldData+cover.oldPos);
226
158
  }
227
159
 
228
- // Attempt to extend lastCover to completely replace matchCover;
229
- static bool tryLinkExtend(TOldCover& lastCover,const TOldCover& matchCover,const TDiffData& diff,TDiffLimit* diffLimit){
160
+ //尝试延长lastCover来完全代替matchCover;
161
+ static bool tryLinkExtend(TOldCover& lastCover,const TOldCover& matchCover,const TDiffData& diff){
230
162
  if (lastCover.length<=0) return false;
231
163
  const TInt linkSpaceLength=(matchCover.newPos-(lastCover.newPos+lastCover.length));
232
- assert(linkSpaceLength>=0);
233
- if (linkSpaceLength>kMaxLinkSpaceLength)
234
- return false;
235
- TInt linkOldPos=lastCover.oldPos+lastCover.length+linkSpaceLength;
236
- if (linkOldPos+matchCover.length>(diff.oldData_end-diff.oldData))
164
+ if ((linkSpaceLength>kMaxLinkSpaceLength)||(matchCover.newPos==0))
237
165
  return false;
238
- const bool isCollinear=lastCover.isCollinear(matchCover);
239
- if (diffLimit){
240
- size_t cnewPos=lastCover.newPos+lastCover.length;
241
- hpatch_TCover cover={(size_t)(lastCover.oldPos+lastCover.length),cnewPos,
242
- (size_t)(linkSpaceLength+(isCollinear?0:matchCover.length))};
243
- if (!diffLimit->listener->limitCover(diffLimit->listener,&cover,0))
244
- return false;
245
- }
246
- if (isCollinear){// Already collinear;
166
+ if (lastCover.isCollinear(matchCover)){//已经共线;
247
167
  lastCover.Link(matchCover);
248
168
  return true;
249
169
  }
250
-
170
+ TInt linkOldPos=lastCover.oldPos+lastCover.length+linkSpaceLength;
251
171
  TInt matchCost=getCoverCtrlCost(matchCover,lastCover);
252
- TInt lastLinkCost=(TInt)getRegionRleCost(diff.newData+matchCover.newPos,matchCover.length,diff.oldData+linkOldPos);
172
+ TInt lastLinkCost;
173
+ if (!checkGetCoverCost(&lastLinkCost,matchCover.newPos,linkOldPos,matchCover.length,diff)) return false;
253
174
  if (lastLinkCost>matchCost)
254
175
  return false;
255
- TInt len=lastCover.length+linkSpaceLength+(matchCover.length*2/3);// Extend most of it, leaving the remaining possible extension to extend_cover.
176
+ TInt len=lastCover.length+linkSpaceLength+(matchCover.length*2/3);//扩展大部分,剩下的可能扩展留给extend_cover.
256
177
  len+=getEqualLength(diff.newData+lastCover.newPos+len,diff.newData_end,
257
178
  diff.oldData+lastCover.oldPos+len,diff.oldData_end);
258
- if (diffLimit){
259
- TInt limitLen=diffLimit->newEnd-lastCover.newPos;
260
- len=len<limitLen?len:limitLen;
261
- TInt safeLen=lastCover.length+linkSpaceLength+matchCover.length;
262
- if (len>safeLen){
263
- hpatch_TCover cover={(size_t)(lastCover.oldPos+safeLen),(size_t)(lastCover.newPos+safeLen),
264
- (size_t)(len-safeLen)};
265
- hpatch_StreamPos_t hitPos;
266
- diffLimit->listener->limitCover(diffLimit->listener,&cover,&hitPos);
267
- len=(TInt)(safeLen+hitPos);
268
- }
269
- }
270
179
  while ((len>0) && (diff.newData[lastCover.newPos+len-1]
271
180
  !=diff.oldData[lastCover.oldPos+len-1])) {
272
181
  --len;
@@ -275,122 +184,73 @@ static bool tryLinkExtend(TOldCover& lastCover,const TOldCover& matchCover,const
275
184
  return true;
276
185
  }
277
186
 
278
- // Attempt to set lastCover as an extension of the line where matchCover is located, achieving collinearity (increasing merge possibilities, etc.);
279
- static void tryCollinear(TOldCover& lastCover,const TOldCover& matchCover,const TDiffData& diff,TDiffLimit* diffLimit){
187
+ //尝试设置lastCovermatchCover所在直线的延长线,实现共线(增加合并可能等);
188
+ static void tryCollinear(TOldCover& lastCover,const TOldCover& matchCover,const TDiffData& diff){
280
189
  if (lastCover.length<=0) return;
281
- if (lastCover.isCollinear(matchCover)) return; // Already collinear;
282
-
190
+ if (lastCover.isCollinear(matchCover)) return; //已经共线;
283
191
  TInt linkOldPos=matchCover.oldPos-(matchCover.newPos-lastCover.newPos);
284
- if ((linkOldPos<0)||(linkOldPos+lastCover.length>(diff.oldData_end-diff.oldData)))
285
- return;
286
- if (diffLimit){
287
- hpatch_TCover cover={ (size_t)linkOldPos,(size_t)lastCover.newPos,(size_t)lastCover.length};
288
- if (!diffLimit->listener->limitCover(diffLimit->listener,&cover,0))
289
- return;
290
- }
291
192
  TInt lastCost=getCoverCost(lastCover,diff);
292
- TInt matchLinkCost=(TInt)getRegionRleCost(diff.newData+lastCover.newPos,lastCover.length,diff.oldData+linkOldPos);
193
+ TInt matchLinkCost;
194
+ if (!checkGetCoverCost(&matchLinkCost,lastCover.newPos,linkOldPos,lastCover.length,diff)) return;
293
195
  if (lastCost>=matchLinkCost)
294
196
  lastCover.oldPos=linkOldPos;
295
197
  }
296
198
 
297
-
298
- // Find suitable cover lines.
299
- static void _search_cover(std::vector<TOldCover>& covers,const TDiffData& diff,
300
- const TSuffixString& sstring,TDiffLimit* diffLimit,bool isCanExtendCover){
199
+ //寻找合适的覆盖线.
200
+ static void search_cover(TDiffData& diff,const TSuffixString& sstring){
301
201
  if (sstring.SASize()<=0) return;
302
- TInt newPos=diffLimit?diffLimit->newPos:0;
303
- const TInt newEnd=diffLimit?diffLimit->newEnd:(diff.newData_end-diff.newData);
304
- if (newEnd-newPos<=kMinMatchLen) return;
305
- const TInt maxSearchNewPos=newEnd-kMinMatchLen;
306
- const size_t cover_begin=covers.size();
307
-
202
+ static const int kMinMatchScore = 2; //最小搜寻覆盖收益.
203
+ const TInt maxSearchNewPos=(diff.newData_end-diff.newData)-kMinMatchScore;
204
+ TInt newPos=0;
308
205
  TOldCover lastCover(0,0,0);
309
206
  while (newPos<=maxSearchNewPos) {
310
207
  TInt matchOldPos=0;
311
- size_t limitSkip=1;
312
- TInt matchEqLength=getBestMatch(&matchOldPos,sstring,diff.newData+newPos,diff.newData+newEnd,newPos,
313
- diffLimit,&limitSkip);
314
- if (matchEqLength<kMinMatchLen){
315
- newPos+=limitSkip;
316
- continue;
317
- }
208
+ TInt matchEqLength=getBestMatch(&matchOldPos,sstring,diff.newData+newPos,diff.newData_end);
318
209
  TOldCover matchCover(matchOldPos,newPos,matchEqLength);
319
210
  if (matchEqLength-getCoverCtrlCost(matchCover,lastCover)<kMinMatchScore){
320
- ++newPos;// The next string to match (matching byte by byte is relatively slow).
211
+ ++newPos;//下一个需要匹配的字符串(逐位置匹配速度会比较慢).
321
212
  continue;
322
213
  }//else matched
323
214
 
324
- if (isCanExtendCover){
325
- if (tryLinkExtend(lastCover,matchCover,diff,diffLimit)){//use link
326
- if (covers.size()==cover_begin)
327
- covers.push_back(lastCover);
328
- else
329
- covers.back()=lastCover;
330
- }else{ //use match
331
- if (covers.size()>cover_begin)// Attempt collinearity;
332
- tryCollinear(covers.back(),matchCover,diff,diffLimit);
333
- covers.push_back(matchCover);
334
- }
335
- }else{
336
- covers.push_back(matchCover);
215
+ if (tryLinkExtend(lastCover,matchCover,diff)){//use link
216
+ if (diff.covers.empty())
217
+ diff.covers.push_back(lastCover);
218
+ else
219
+ diff.covers.back()=lastCover;
220
+ }else{ //use match
221
+ if (!diff.covers.empty())//尝试共线;
222
+ tryCollinear(diff.covers.back(),matchCover,diff);
223
+ diff.covers.push_back(matchCover);
337
224
  }
338
- lastCover=covers.back();
339
- newPos=std::max(newPos+1,lastCover.newPos+lastCover.length);// The selected cover does not allow overlap, which may not be the optimal strategy;
225
+ lastCover=diff.covers.back();
226
+ newPos=std::max(newPos+1,lastCover.newPos+lastCover.length);//选出的cover不允许重叠,这可能不是最优策略;
340
227
  }
341
228
  }
342
229
 
230
+ //选择合适的覆盖线,去掉不合适的.
231
+ static void select_cover(TDiffData& diff,int kMinSingleMatchScore){
232
+ std::vector<TOldCover>& covers=diff.covers;
233
+ TCompressDetect nocover_detect;
234
+ TCompressDetect cover_detect;
343
235
 
344
- //Select the appropriate cover lines and remove the unsuitable ones.
345
- static void _select_cover(std::vector<TOldCover>& covers,size_t cover_begin,const TDiffData& diff,int kMinSingleMatchScore,
346
- TCompressDetect& nocover_detect,TCompressDetect& cover_detect,
347
- TDiffLimit* diffLimit,bool isCanExtendCover){
348
236
  TOldCover lastCover(0,0,0);
349
- if (diffLimit)
350
- lastCover=diffLimit->lastCover_back;
351
- const size_t coverSize_old=covers.size();
352
- size_t insertIndex=cover_begin;
353
- for (size_t i=cover_begin;i<coverSize_old;++i){
354
- if (covers[i].length<=0) continue;// Skip the already deleted ones.
237
+ const TInt coverSize_old=(TInt)covers.size();
238
+ TInt insertIndex=0;
239
+ for (TInt i=0;i<coverSize_old;++i){
240
+ if (covers[i].oldPos<0) continue;//处理已经del的.
355
241
  bool isNeedSave=false;
356
- bool isCanLink=false;
357
- if (isCanExtendCover&&(!isNeedSave)){// Possibility for forward merging.
358
- if ((insertIndex>cover_begin)&&(covers[insertIndex-1].isCanLink(covers[i]))){
359
- if (diffLimit){
360
- const TOldCover& fc=covers[insertIndex-1];
361
- hpatch_TCover cover={(size_t)(fc.oldPos+fc.length),(size_t)(fc.newPos+fc.length),
362
- (size_t)fc.linkSpaceLength(covers[i])};
363
- if (diffLimit->listener->limitCover(diffLimit->listener,&cover,0)){
364
- isCanLink=true;
365
- isNeedSave=true;
366
- }
367
- }else{
368
- isCanLink=true;
369
- isNeedSave=true;
370
- }
371
- }
242
+ if (!isNeedSave){//向前合并可能.
243
+ if ((insertIndex>0)&&(covers[insertIndex-1].isCanLink(covers[i])))
244
+ isNeedSave=true;
372
245
  }
373
- if (isCanExtendCover&&(i+1<coverSize_old)){// Check possibility for backward link merging
374
- for (size_t j=i+1;j<coverSize_old; ++j) {
246
+ if (i+1<coverSize_old){//查询向后合并可能link
247
+ for (TInt j=i+1;j<coverSize_old; ++j) {
375
248
  if (!covers[i].isCanLink(covers[j])) break;
376
- if (diffLimit){
377
- const TOldCover& fc=covers[i];
378
- hpatch_TCover cover={(size_t)(fc.oldPos+fc.length),(size_t)(fc.newPos+fc.length),
379
- (size_t)fc.linkSpaceLength(covers[j])};
380
- if (diffLimit->listener->limitCover(diffLimit->listener,&cover,0)){
381
- covers[i].Link(covers[j]);
382
- covers[j].length=0;//del
383
- }else{
384
- break;
385
- }
386
- }else{
387
- covers[i].Link(covers[j]);
388
- covers[j].length=0;//del
389
- }
390
-
249
+ covers[i].Link(covers[j]);
250
+ covers[j].oldPos=-1;//del
391
251
  }
392
252
  }
393
- if (!isNeedSave){// Whether to keep the single cover.
253
+ if (!isNeedSave){//单覆盖是否保留.
394
254
  TInt noCoverCost=nocover_detect.cost(diff.newData+covers[i].newPos,covers[i].length);
395
255
  TInt coverCost=cover_detect.cost(diff.newData+covers[i].newPos,covers[i].length,
396
256
  diff.oldData+covers[i].oldPos);
@@ -399,7 +259,7 @@ static void _select_cover(std::vector<TOldCover>& covers,size_t cover_begin,cons
399
259
  }
400
260
 
401
261
  if (isNeedSave){
402
- if (isCanLink){// Link merging.
262
+ if ((insertIndex>0)&&(covers[insertIndex-1].isCanLink(covers[i]))){//link合并.
403
263
  covers[insertIndex-1].Link(covers[i]);
404
264
  cover_detect.add_chars(diff.newData+lastCover.newPos+lastCover.length,
405
265
  covers[insertIndex-1].length-lastCover.length,
@@ -416,24 +276,11 @@ static void _select_cover(std::vector<TOldCover>& covers,size_t cover_begin,cons
416
276
  }
417
277
  covers.resize(insertIndex);
418
278
  }
419
-
420
- static void select_cover(std::vector<TOldCover>& covers,size_t cover_begin,const TDiffData& diff,
421
- int kMinSingleMatchScore,TDiffLimit* diffLimit,bool isCanExtendCover){
422
- if (diffLimit==0){
423
- TCompressDetect nocover_detect;
424
- TCompressDetect cover_detect;
425
- _select_cover(covers,cover_begin,diff,kMinSingleMatchScore,nocover_detect,cover_detect,0,isCanExtendCover);
426
- }else{
427
- _select_cover(covers,cover_begin,diff,kMinSingleMatchScore,diffLimit->nocover_detect,
428
- diffLimit->cover_detect,diffLimit,isCanExtendCover);
429
- }
430
- }
431
-
432
279
 
433
- typedef size_t TFixedFloatSmooth; // Fixed-point number.
434
- static const TFixedFloatSmooth kFixedFloatSmooth_base=1024;// Position of fixed-point decimal point.
280
+ typedef size_t TFixedFloatSmooth; //定点数.
281
+ static const TFixedFloatSmooth kFixedFloatSmooth_base=1024;//定点数小数点位置.
435
282
 
436
- // Get the length of positions that can be extended.
283
+ //得到可以扩展位置的长度.
437
284
  static TInt getCanExtendLength(TInt oldPos,TInt newPos,int inc,TInt newPos_min,TInt lastNewEnd,
438
285
  const TDiffData& diff,const TFixedFloatSmooth kExtendMinSameRatio){
439
286
  static const unsigned int kSmoothLength=4;
@@ -463,39 +310,17 @@ static void select_cover(std::vector<TOldCover>& covers,size_t cover_begin,const
463
310
  return curBestLength;
464
311
  }
465
312
 
466
- // Attempt to extend the cover area.
467
- static void extend_cover(std::vector<TOldCover>& covers,size_t cover_begin,const TDiffData& diff,
468
- const TFixedFloatSmooth kExtendMinSameRatio,TDiffLimit* diffLimit=0){
469
- TInt lastNewEnd=diffLimit?diffLimit->newPos:0;
470
- for (size_t i=cover_begin; i<covers.size(); ++i) {
471
- TInt newPos_next;
472
- if (i+1<covers.size())
313
+ //尝试延长覆盖区域.
314
+ static void extend_cover(TDiffData& diff,const TFixedFloatSmooth kExtendMinSameRatio){
315
+ std::vector<TOldCover>& covers=diff.covers;
316
+
317
+ TInt lastNewEnd=0;
318
+ for (TInt i=0; i<(TInt)covers.size(); ++i) {
319
+ TInt newPos_next=(TInt)(diff.newData_end-diff.newData);
320
+ if (i+1<(TInt)covers.size())
473
321
  newPos_next=covers[i+1].newPos;
474
- else
475
- newPos_next=diffLimit?diffLimit->newEnd:(TInt)(diff.newData_end-diff.newData);
476
322
  TOldCover& curCover=covers[i];
477
- if (diffLimit){
478
- TInt limit_front=std::min(curCover.newPos-lastNewEnd,curCover.oldPos);
479
- if (limit_front>0){
480
- hpatch_TCover cover={(size_t)(curCover.oldPos-limit_front),
481
- (size_t)(curCover.newPos-limit_front),(size_t)limit_front};
482
- hpatch_StreamPos_t lenLimit;
483
- diffLimit->listener->limitCover_front(diffLimit->listener,&cover,&lenLimit);
484
- lastNewEnd=curCover.newPos-(TInt)lenLimit;
485
- }
486
-
487
- TInt limit_back=newPos_next-(curCover.newPos+curCover.length);
488
- if ((curCover.oldPos+curCover.length)+limit_back>(diff.oldData_end-diff.oldData))
489
- limit_back=(diff.oldData_end-diff.oldData)-(curCover.oldPos+curCover.length);
490
- if (limit_back>0){
491
- hpatch_TCover cover={(size_t)(curCover.oldPos+curCover.length),
492
- (size_t)(curCover.newPos+curCover.length),(size_t)limit_back};
493
- hpatch_StreamPos_t lenLimit;
494
- diffLimit->listener->limitCover(diffLimit->listener,&cover,&lenLimit);
495
- newPos_next=(curCover.newPos+curCover.length)+ (TInt)lenLimit;
496
- }
497
- }
498
- // Extend forward.
323
+ //向前延伸.
499
324
  TInt extendLength_front=getCanExtendLength(curCover.oldPos-1,curCover.newPos-1,
500
325
  -1,lastNewEnd,newPos_next,diff,kExtendMinSameRatio);
501
326
  if (extendLength_front>0){
@@ -503,7 +328,7 @@ static void extend_cover(std::vector<TOldCover>& covers,size_t cover_begin,const
503
328
  curCover.newPos-=extendLength_front;
504
329
  curCover.length+=extendLength_front;
505
330
  }
506
- // Extend backward.
331
+ //向后延伸.
507
332
  TInt extendLength_back=getCanExtendLength(curCover.oldPos+curCover.length,
508
333
  curCover.newPos+curCover.length,
509
334
  1,lastNewEnd,newPos_next,diff,kExtendMinSameRatio);
@@ -528,66 +353,38 @@ static void extend_cover(std::vector<TOldCover>& covers,size_t cover_begin,const
528
353
  check(cover.oldPos+cover.length<=oldSize);
529
354
  }
530
355
 
531
- static void assert_covers_safe(const TCovers& covers,hpatch_StreamPos_t newSize,hpatch_StreamPos_t oldSize){
532
- hpatch_StreamPos_t lastNewEnd=0;
533
- for (size_t i=0;i<covers.coverCount();++i){
534
- TCover cover;
535
- covers.covers(i,&cover);
536
- assert_cover_safe(cover,lastNewEnd,newSize,oldSize);
537
- lastNewEnd=cover.newPos+cover.length;
538
- }
539
- }
540
- static void assert_covers_safe(const std::vector<TOldCover>& covers,hpatch_StreamPos_t newSize,hpatch_StreamPos_t oldSize){
541
- const TCovers _covers((void*)covers.data(),covers.size(),
542
- sizeof(*covers.data())==sizeof(hpatch_TCover32));
543
- assert_covers_safe(_covers,newSize,oldSize);
544
- }
545
-
546
- static inline hpatch_StreamPos_t _clipLenByLimit(hpatch_StreamPos_t& clen,hpatch_StreamPos_t kMaxLen){
547
- hpatch_StreamPos_t alen=clen;
548
- assert(alen>kMaxLen);
549
- do{
550
- alen=(alen+1)>>1;
551
- } while (alen>kMaxLen);
552
- clen-=alen;
553
- return alen;
554
- }
555
- static void _limitCoverLenth(std::vector<TOldCover>& covers,hpatch_StreamPos_t kMaxLen){
556
- assert((0<kMaxLen)&&(0<(TInt)kMaxLen)&&(kMaxLen==(TInt)kMaxLen));
557
- size_t csize=covers.size();
558
- size_t isize=0;
559
- for (size_t i=0;i<csize;++i){
560
- hpatch_StreamPos_t clen=covers[i].length;
561
- while (clen>kMaxLen){
562
- ++isize;
563
- _clipLenByLimit(clen,kMaxLen);
564
- }
565
- }
566
- if (isize==0) return;
356
+ //用覆盖线得到差异数据.
357
+ static void sub_cover(TDiffData& diff){
358
+ std::vector<TOldCover>& covers=diff.covers;
359
+ const TByte* newData=diff.newData;
360
+ const TByte* oldData=diff.oldData;
567
361
 
568
- covers.resize(csize+isize);
569
- memmove(covers.data()+isize,covers.data(),sizeof(TOldCover)*csize);
570
- size_t insertIndex=0;
571
- for (size_t i=isize;i<covers.size();++i){
572
- hpatch_StreamPos_t clen=covers[i].length;
573
- while (clen>kMaxLen){
574
- --isize;
575
- TInt clipLen=(TInt)_clipLenByLimit(clen,kMaxLen);
576
- assert(insertIndex<i);
577
- covers[insertIndex++]=TOldCover(covers[i].oldPos,covers[i].newPos,clipLen);
578
- covers[i].oldPos+=clipLen;
579
- covers[i].newPos+=clipLen;
580
- covers[i].length-=clipLen;
581
- assert(covers[i].length==clen);
582
- }
583
- covers[insertIndex++]=covers[i];
584
- }
585
- assert(isize==0);
586
- }
362
+ diff.newDataSubDiff.resize(0);
363
+ diff.newDataSubDiff.resize(diff.newData_end-diff.newData,0);
364
+ TByte* newDataSubDiff=diff.newDataSubDiff.data();
365
+ diff.newDataDiff.resize(0);
366
+ diff.newDataDiff.reserve((diff.newData_end-diff.newData)>>2);
367
+
368
+ TInt lastNewEnd=0;
369
+ for (TInt i=0;i<(TInt)covers.size();++i){
370
+ assert_cover_safe(covers[i],lastNewEnd,
371
+ diff.newData_end-diff.newData,diff.oldData_end-diff.oldData);
372
+ const TInt newPos=covers[i].newPos;
373
+ if (newPos>lastNewEnd)
374
+ pushBack(diff.newDataDiff,newData+lastNewEnd,newData+newPos);
375
+ const TInt oldPos=covers[i].oldPos;
376
+ const TInt length=covers[i].length;
377
+ for (TInt si=0; si<length;++si)
378
+ newDataSubDiff[si+newPos]=(newData[si+newPos]-oldData[si+oldPos]);
379
+ lastNewEnd=newPos+length;
380
+ }
381
+ if (lastNewEnd<diff.newData_end-newData)
382
+ pushBack(diff.newDataDiff,newData+lastNewEnd,diff.newData_end);
383
+ }
587
384
 
588
- // Serialized output of diff result.
589
- static void serialize_diff(const TDiffData& diff,const std::vector<TOldCover>& covers,std::vector<TByte>& out_diff){
590
- const TUInt coverCount=(TUInt)covers.size();
385
+ //diff结果序列化输出.
386
+ static void serialize_diff(const TDiffData& diff,std::vector<TByte>& out_diff){
387
+ const TUInt coverCount=(TUInt)diff.covers.size();
591
388
  std::vector<TByte> length_buf;
592
389
  std::vector<TByte> inc_newPos_buf;
593
390
  std::vector<TByte> inc_oldPos_buf;
@@ -595,40 +392,61 @@ static void serialize_diff(const TDiffData& diff,const std::vector<TOldCover>& c
595
392
  TInt oldPosBack=0;
596
393
  TInt lastNewEnd=0;
597
394
  for (TUInt i=0; i<coverCount; ++i) {
598
- packUInt(length_buf, (TUInt)covers[i].length);
599
- assert(covers[i].newPos>=lastNewEnd);
600
- packUInt(inc_newPos_buf,(TUInt)(covers[i].newPos-lastNewEnd)); //save inc_newPos
601
- if (covers[i].oldPos>=oldPosBack){ //save inc_oldPos
602
- packUIntWithTag(inc_oldPos_buf,(TUInt)(covers[i].oldPos-oldPosBack), 0, 1);
395
+ packUInt(length_buf, (TUInt)diff.covers[i].length);
396
+ assert(diff.covers[i].newPos>=lastNewEnd);
397
+ packUInt(inc_newPos_buf,(TUInt)(diff.covers[i].newPos-lastNewEnd)); //save inc_newPos
398
+ if (diff.covers[i].oldPos>=oldPosBack){ //save inc_oldPos
399
+ packUIntWithTag(inc_oldPos_buf,(TUInt)(diff.covers[i].oldPos-oldPosBack), 0, 1);
603
400
  }else{
604
- packUIntWithTag(inc_oldPos_buf,(TUInt)(oldPosBack-covers[i].oldPos), 1, 1);//sub safe
401
+ packUIntWithTag(inc_oldPos_buf,(TUInt)(oldPosBack-diff.covers[i].oldPos), 1, 1);//sub safe
605
402
  }
606
- oldPosBack=covers[i].oldPos;
607
- lastNewEnd=covers[i].newPos+covers[i].length;
403
+ oldPosBack=diff.covers[i].oldPos;
404
+ lastNewEnd=diff.covers[i].newPos+diff.covers[i].length;
608
405
  }
609
406
  }
610
-
611
- const TCovers _covers((void*)covers.data(),covers.size(),
612
- sizeof(*covers.data())==sizeof(hpatch_TCover32));
613
- hpatch_TStreamInput _newDataStream;
614
- mem_as_hStreamInput(&_newDataStream,diff.newData,diff.newData_end);
615
- TNewDataDiffStream newDataDiffStream(_covers,&_newDataStream);
616
407
 
617
408
  packUInt(out_diff, (TUInt)coverCount);
618
409
  packUInt(out_diff, (TUInt)length_buf.size());
619
410
  packUInt(out_diff, (TUInt)inc_newPos_buf.size());
620
411
  packUInt(out_diff, (TUInt)inc_oldPos_buf.size());
621
- packUInt(out_diff, newDataDiffStream.streamSize);
412
+ packUInt(out_diff, (TUInt)diff.newDataDiff.size());
622
413
  pushBack(out_diff,length_buf);
623
414
  pushBack(out_diff,inc_newPos_buf);
624
415
  pushBack(out_diff,inc_oldPos_buf);
625
- pushBack(out_diff,&newDataDiffStream);
416
+ pushBack(out_diff,diff.newDataDiff);
626
417
 
627
- TNewDataSubDiffStream_mem newDataSubDiff(diff.newData,diff.newData_end,
628
- diff.oldData,diff.oldData_end,_covers);
629
- bytesRLE_save(out_diff,&newDataSubDiff,kRle_bestSize);
418
+ const TByte* newDataSubDiff=diff.newDataSubDiff.data();
419
+ bytesRLE_save(out_diff,newDataSubDiff,
420
+ newDataSubDiff+diff.newDataSubDiff.size(),kRle_bestSize);
630
421
  }
631
422
 
423
+
424
+ static void do_compress(std::vector<TByte>& out_code,const std::vector<TByte>& data,
425
+ const hdiff_TCompress* compressPlugin,bool isMustCompress=false){
426
+ out_code.clear();
427
+ if (!compressPlugin) return;
428
+ if (data.empty()) return;
429
+ hpatch_StreamPos_t maxCodeSize=compressPlugin->maxCompressedSize(data.size());
430
+ if ((maxCodeSize<=data.size())||(maxCodeSize!=(size_t)maxCodeSize)) return; //error
431
+ out_code.resize((size_t)maxCodeSize);
432
+ const TByte* data0=&data[0];
433
+ TByte* out_code0=&out_code[0];
434
+ size_t codeSize=hdiff_compress_mem(compressPlugin,out_code0,out_code0+out_code.size(),
435
+ data0,data0+data.size());
436
+ if ((codeSize>0)&&(isMustCompress||(codeSize<data.size())))
437
+ out_code.resize(codeSize); //ok
438
+ else
439
+ out_code.clear();//error or cancel
440
+ }
441
+ inline static void pushCompressCode(std::vector<TByte>& out_diff,
442
+ const std::vector<TByte>& compress_code,
443
+ const std::vector<TByte>& data){
444
+ if (compress_code.empty())
445
+ pushBack(out_diff,data);
446
+ else
447
+ pushBack(out_diff,compress_code);
448
+ }
449
+
632
450
  template<class T>
633
451
  static void _outType(std::vector<TByte>& out_data,T* compressPlugin,const char* versionType=kHDiffVersionType){
634
452
  //type version
@@ -647,300 +465,117 @@ static void serialize_diff(const TDiffData& diff,const std::vector<TOldCover>& c
647
465
  pushBack(out_data,&_cstrEndTag,(&_cstrEndTag)+1);
648
466
  }
649
467
 
650
-
651
- static void _dispose_cover(std::vector<TOldCover>& covers,size_t cover_begin,const TDiffData& diff,
652
- int kMinSingleMatchScore,TDiffLimit* diffLimit,bool isCanExtendCover){
653
- if (isCanExtendCover){
654
- TFixedFloatSmooth kExtendMinSameRatio=kMinSingleMatchScore*36+254;
655
- if (kExtendMinSameRatio<200) kExtendMinSameRatio=200;
656
- if (kExtendMinSameRatio>800) kExtendMinSameRatio=800;
657
-
658
- extend_cover(covers,cover_begin,diff,kExtendMinSameRatio,diffLimit);// First try to extend.
659
- select_cover(covers,cover_begin,diff,kMinSingleMatchScore,diffLimit,isCanExtendCover);
660
- extend_cover(covers,cover_begin,diff,kExtendMinSameRatio,diffLimit);// select_cover will delete some cover lines, so re-extend.
661
- }else{
662
- select_cover(covers,cover_begin,diff,kMinSingleMatchScore,diffLimit,isCanExtendCover);
663
- }
664
- }
665
-
666
-
667
- static void search_and_dispose_cover(std::vector<TOldCover>& covers,const TDiffData& diff,
668
- const TSuffixString& sstring,int kMinSingleMatchScore,
669
- TDiffLimit* diffLimit,bool isCanExtendCover){
670
- const size_t cover_begin=covers.size();
671
- _search_cover(covers,diff,sstring,diffLimit,isCanExtendCover);
672
- if (covers.size()>cover_begin)
673
- _dispose_cover(covers,cover_begin,diff,kMinSingleMatchScore,diffLimit,isCanExtendCover);
674
- }
675
-
676
- #define first_search_and_dispose_cover(covers,diff,sstring,kMinSingleMatchScore,isCanExtendCover) search_and_dispose_cover(covers,diff,sstring,kMinSingleMatchScore,0,isCanExtendCover);
677
-
678
- #if (_IS_USED_MULTITHREAD)
679
- const size_t kPartPepeatSize=1024*2;
680
- struct mt_data_t{
681
- const TDiffData* diff;
682
- const TSuffixString* sstring;
683
- ICoverLinesListener* listener;
684
- int kMinSingleMatchScore;
685
- size_t workBlockSize;
686
- bool isCanExtendCover;
687
- std::atomic<size_t> workIndex;
688
- bool nextBlock(hdiff_TRange* out_newRange){
689
- const size_t kNewSize=(diff->newData_end-diff->newData);
690
- if (listener)
691
- return listener->next_search_block_MT(listener,out_newRange);
692
- size_t i=workIndex++;
693
- hpatch_StreamPos_t pos=i*(hpatch_StreamPos_t)workBlockSize;
694
- if (pos<kNewSize){
695
- out_newRange->beginPos=pos;
696
- pos+=workBlockSize+kPartPepeatSize;
697
- pos=(pos<=kNewSize)?pos:kNewSize;
698
- out_newRange->endPos=pos;
699
- return true;
468
+ static void serialize_compressed_diff(const TDiffData& diff,std::vector<TByte>& out_diff,
469
+ const hdiff_TCompress* compressPlugin){
470
+ const TUInt coverCount=(TUInt)diff.covers.size();
471
+ std::vector<TByte> cover_buf;
472
+ {
473
+ TInt lastOldEnd=0;
474
+ TInt lastNewEnd=0;
475
+ for (TUInt i=0; i<coverCount; ++i) {
476
+ if (diff.covers[i].oldPos>=lastOldEnd){ //save inc_oldPos
477
+ packUIntWithTag(cover_buf,(TUInt)(diff.covers[i].oldPos-lastOldEnd), 0, 1);
700
478
  }else{
701
- return false;
479
+ packUIntWithTag(cover_buf,(TUInt)(lastOldEnd-diff.covers[i].oldPos), 1, 1);//sub safe
702
480
  }
703
- }
704
- };
705
-
706
- static void _fsearch_and_dispose_cover_thread(std::vector<TOldCover>* _covers,mt_data_t* mt){
707
- std::vector<TOldCover>& covers=*_covers;
708
- const TDiffData& diff=*mt->diff;
709
- hdiff_TRange newRange;
710
- while (mt->nextBlock(&newRange)){
711
- TDiffData diff_part(diff);
712
- diff_part.newData=diff.newData+(size_t)newRange.beginPos;
713
- diff_part.newData_end=diff.newData+(size_t)newRange.endPos;
714
- size_t coverCountBack=covers.size();
715
- first_search_and_dispose_cover(covers,diff_part,*mt->sstring,mt->kMinSingleMatchScore,mt->isCanExtendCover);
716
- for (size_t i=coverCountBack;i<covers.size();++i)
717
- covers[i].newPos+=(TInt)newRange.beginPos;
481
+ assert(diff.covers[i].newPos>=lastNewEnd);
482
+ packUInt(cover_buf,(TUInt)(diff.covers[i].newPos-lastNewEnd)); //save inc_newPos
483
+ packUInt(cover_buf,(TUInt)diff.covers[i].length);
484
+ lastOldEnd=diff.covers[i].oldPos+diff.covers[i].length;//! +length
485
+ lastNewEnd=diff.covers[i].newPos+diff.covers[i].length;
718
486
  }
719
487
  }
720
- #endif
721
-
722
- static void first_search_and_dispose_cover_MT(std::vector<TOldCover>& covers,const TDiffData& diff,
723
- const TSuffixString& sstring,int kMinSingleMatchScore,
724
- ICoverLinesListener* listener,size_t threadNum,bool isCanExtendCover){
725
- #if (_IS_USED_MULTITHREAD)
726
- const size_t kMinParallelSize=1024*1024*2;
727
- const size_t kBestParallelSize=1024*1024*8;
728
- size_t newSize=diff.newData_end-diff.newData;
729
- if ((threadNum>1)&&(diff.oldData!=diff.oldData_end)&&(newSize>=kMinParallelSize)){
730
- const size_t maxThreanNum=newSize/(kMinParallelSize/2);
731
- threadNum=(threadNum<=maxThreanNum)?threadNum:maxThreanNum;
732
- size_t workCount=(newSize+kBestParallelSize-1)/kBestParallelSize;
733
- workCount=(threadNum>workCount)?threadNum:workCount;
734
-
735
- const size_t threadCount=threadNum-1;
736
- std::vector<std::thread> threads(threadCount);
737
- std::vector<std::vector<TOldCover> > threadCovers(threadCount);
738
- mt_data_t mt_data;
739
- mt_data.diff=&diff;
740
- mt_data.sstring=&sstring;
741
- mt_data.listener=(listener&&listener->next_search_block_MT)?listener:0;
742
- mt_data.kMinSingleMatchScore=kMinSingleMatchScore;
743
- mt_data.workBlockSize=(newSize+workCount-1)/workCount;
744
- mt_data.workIndex=0;
745
- mt_data.isCanExtendCover=isCanExtendCover;
746
- if (mt_data.listener&&listener->begin_search_block)
747
- listener->begin_search_block(listener,newSize,mt_data.workBlockSize,kPartPepeatSize);
748
- for (size_t i=0;i<threadCount;i++)
749
- threads[i]=std::thread(_fsearch_and_dispose_cover_thread,&threadCovers[i],&mt_data);
750
- _fsearch_and_dispose_cover_thread(&covers,&mt_data);
751
- for (size_t i=0;i<threadCount;i++){
752
- threads[i].join();
753
- covers.insert(covers.end(),threadCovers[i].begin(),threadCovers[i].end());
754
- { std::vector<TOldCover> tmp; tmp.swap(threadCovers[i]); }
755
- }
756
- tm_collate_covers(covers);
757
- }else
758
- #endif
759
- {
760
- first_search_and_dispose_cover(covers,diff,sstring,kMinSingleMatchScore,isCanExtendCover);
761
- }
488
+
489
+ std::vector<TByte> rle_ctrlBuf;
490
+ std::vector<TByte> rle_codeBuf;
491
+ const TByte* newDataSubDiff=diff.newDataSubDiff.data();
492
+ bytesRLE_save(rle_ctrlBuf,rle_codeBuf,newDataSubDiff,
493
+ newDataSubDiff+diff.newDataSubDiff.size(),kRle_bestSize);
494
+
495
+ std::vector<TByte> compress_cover_buf;
496
+ std::vector<TByte> compress_rle_ctrlBuf;
497
+ std::vector<TByte> compress_rle_codeBuf;
498
+ std::vector<TByte> compress_newDataDiff;
499
+ do_compress(compress_cover_buf,cover_buf,compressPlugin);
500
+ do_compress(compress_rle_ctrlBuf,rle_ctrlBuf,compressPlugin);
501
+ do_compress(compress_rle_codeBuf,rle_codeBuf,compressPlugin);
502
+ do_compress(compress_newDataDiff,diff.newDataDiff,compressPlugin);
503
+
504
+ _outType(out_diff,compressPlugin);
505
+ const TUInt newDataSize=(TUInt)(diff.newData_end-diff.newData);
506
+ const TUInt oldDataSize=(TUInt)(diff.oldData_end-diff.oldData);
507
+ packUInt(out_diff, newDataSize);
508
+ packUInt(out_diff, oldDataSize);
509
+ packUInt(out_diff, coverCount);
510
+ packUInt(out_diff, (TUInt)cover_buf.size());
511
+ packUInt(out_diff, (TUInt)compress_cover_buf.size());
512
+ packUInt(out_diff, (TUInt)rle_ctrlBuf.size());
513
+ packUInt(out_diff, (TUInt)compress_rle_ctrlBuf.size());
514
+ packUInt(out_diff, (TUInt)rle_codeBuf.size());
515
+ packUInt(out_diff, (TUInt)compress_rle_codeBuf.size());
516
+ packUInt(out_diff, (TUInt)diff.newDataDiff.size());
517
+ packUInt(out_diff, (TUInt)compress_newDataDiff.size());
518
+
519
+ pushCompressCode(out_diff,compress_cover_buf,cover_buf);
520
+ pushCompressCode(out_diff,compress_rle_ctrlBuf,rle_ctrlBuf);
521
+ pushCompressCode(out_diff,compress_rle_codeBuf,rle_codeBuf);
522
+ pushCompressCode(out_diff,compress_newDataDiff,diff.newDataDiff);
762
523
  }
763
-
764
- static const hpatch_StreamPos_t _kNullCoverHitEndPos =hpatch_kNullStreamPos;
765
- struct TDiffResearchCover:public IDiffResearchCover{
766
- TDiffResearchCover(TDiffData& diff_,std::vector<TOldCover>& covers_,const TSuffixString& sstring_,
767
- int kMinSingleMatchScore_,int kMaxMatchDeep_,bool _isCanExtendCover)
768
- :diff(diff_), covers(covers_),sstring(sstring_),
769
- kMinSingleMatchScore(kMinSingleMatchScore_),kMaxMatchDeep(kMaxMatchDeep_),
770
- limitCoverIndex_back(~(size_t)0),limitCoverHitEndPos_back(_kNullCoverHitEndPos),
771
- isCanExtendCover(_isCanExtendCover){ researchCover=_researchCover; }
772
-
773
- void _researchRange(TDiffLimit* diffLimit){
774
- search_and_dispose_cover(curCovers,diff,sstring,kMinSingleMatchScore,diffLimit,isCanExtendCover);
775
- if (curCovers.empty()) return;
776
- reCovers.insert(reCovers.end(),curCovers.begin(),curCovers.end());
777
- curCovers.clear();
778
- }
779
-
780
- inline void endResearchCover(){
781
- if (limitCoverHitEndPos_back!=_kNullCoverHitEndPos){
782
- TOldCover& cover=covers[limitCoverIndex_back];
783
- cover.oldPos+=(TInt)limitCoverHitEndPos_back;
784
- cover.newPos+=(TInt)limitCoverHitEndPos_back;
785
- cover.length-=(TInt)limitCoverHitEndPos_back;
786
- limitCoverHitEndPos_back=_kNullCoverHitEndPos;
787
- }
788
- }
789
- inline void doResearchCover(IDiffSearchCoverListener* listener,size_t limitCoverIndex,
790
- hpatch_StreamPos_t endPosBack,hpatch_StreamPos_t hitPos,hpatch_StreamPos_t hitLen){
791
- if (limitCoverIndex_back!=limitCoverIndex)
792
- endResearchCover();
793
- limitCoverIndex_back=limitCoverIndex;
794
- limitCoverHitEndPos_back=hitPos+hitLen;
795
-
796
- const TOldCover& cover=covers[limitCoverIndex];
797
- TOldCover lastCover_back(0,0,0);
798
- if (endPosBack<hitPos){
799
- lastCover_back.oldPos=cover.oldPos+(TInt)endPosBack;
800
- lastCover_back.newPos=cover.newPos+(TInt)endPosBack;
801
- lastCover_back.length=(TInt)(hitPos-endPosBack);
802
- reCovers.push_back(lastCover_back);
803
- }else {
804
- assert(endPosBack==hitPos);
805
- if (limitCoverIndex>0)
806
- lastCover_back=covers[limitCoverIndex-1];
807
- if ((!reCovers.empty())&&(reCovers.back().newPos>lastCover_back.newPos))
808
- lastCover_back=reCovers.back();
809
- }
810
-
811
- TDiffLimit diffLimit={listener,cover.newPos+(size_t)hitPos,cover.newPos+(size_t)(hitPos+hitLen),
812
- cover.oldPos+(size_t)hitPos,cover.oldPos+(size_t)(hitPos+hitLen),
813
- nocover_detect,cover_detect,lastCover_back,kMaxMatchDeep};
814
- _researchRange(&diffLimit);
815
- }
816
-
817
- static void _researchCover(struct IDiffResearchCover* diffi,struct IDiffSearchCoverListener* listener,size_t limitCoverIndex,
818
- hpatch_StreamPos_t endPosBack,hpatch_StreamPos_t hitPos,hpatch_StreamPos_t hitLen){
819
- TDiffResearchCover* self=(TDiffResearchCover*)diffi;
820
- self->doResearchCover(listener,limitCoverIndex,endPosBack,hitPos,hitLen);
821
- }
822
524
 
823
- void researchFinish(){
824
- endResearchCover();
825
- size_t insert=0;
826
- for (size_t i=0;i<covers.size();++i){
827
- if (covers[i].length>0)
828
- covers[insert++]=covers[i];
829
- }
830
- covers.resize(insert);
831
- covers.insert(covers.end(),reCovers.begin(),reCovers.end());
832
- std::inplace_merge(covers.begin(),covers.begin()+insert,
833
- covers.end(),cover_cmp_by_new_t<TOldCover>());
834
- }
835
-
836
- TDiffData& diff;
837
- std::vector<TOldCover>& covers;
838
- const TSuffixString& sstring;
839
- int kMinSingleMatchScore;
840
- int kMaxMatchDeep;
841
- std::vector<TOldCover> reCovers;
842
- std::vector<TOldCover> curCovers;
843
- size_t limitCoverIndex_back;
844
- hpatch_StreamPos_t limitCoverHitEndPos_back;
845
- const bool isCanExtendCover;
846
- TCompressDetect nocover_detect;
847
- TCompressDetect cover_detect;
848
- };
849
-
850
- struct TDiffInsertCover:public IDiffInsertCover{
851
- inline TDiffInsertCover(std::vector<TOldCover>& _covers)
852
- :covers(_covers){
853
- insertCover=_insertCover;
854
- }
855
- static void* _insertCover(IDiffInsertCover* diffi,const void* pInsertCovers,size_t insertCoverCount,bool insertIsCover32){
856
- TDiffInsertCover* self=(TDiffInsertCover*)diffi;
857
- return self->_insertCover(pInsertCovers,insertCoverCount,insertIsCover32);
858
- }
859
- void* _insertCover(const void* pInsertCovers,size_t insertCoverCount,bool insertIsCover32){
860
- const bool isCover32=sizeof(*covers.data())==sizeof(hpatch_TCover32);
861
- if (insertIsCover32==isCover32){
862
- covers.insert(covers.end(),(const TOldCover*)pInsertCovers,
863
- ((const TOldCover*)pInsertCovers)+insertCoverCount);
864
- }else{
865
- size_t oldSize=covers.size();
866
- covers.resize(oldSize +insertCoverCount);
867
- for (size_t i=0;i<insertCoverCount;i++){
868
- if (insertIsCover32){
869
- const hpatch_TCover32& s=((const hpatch_TCover32*)pInsertCovers)[i];
870
- covers[oldSize+i]=TOldCover((TInt)s.oldPos,(TInt)s.newPos,(TInt)s.length);
871
- }else{
872
- const hpatch_TCover& s=((const hpatch_TCover*)pInsertCovers)[i];
873
- covers[oldSize+i]=TOldCover((TInt)s.oldPos,(TInt)s.newPos,(TInt)s.length);
874
- }
875
- }
525
+ static void search_cover_by_stream(TDiffData& diff,size_t kMatchBlockSize,bool isSkipSameRange){
526
+ hdiff_TStreamInput oldData;
527
+ mem_as_hStreamInput(&oldData,diff.oldData,diff.oldData_end);
528
+ hdiff_TStreamInput newData;
529
+ mem_as_hStreamInput(&newData,diff.newData,diff.newData_end);
530
+ TCovers covers(oldData.streamSize,newData.streamSize);
531
+ getCovers_by_stream(&newData,&oldData,kMatchBlockSize,isSkipSameRange,covers);
532
+
533
+ size_t coverCount=covers.coverCount();
534
+ diff.covers.resize(coverCount);
535
+ TOldCover* outCover=diff.covers.data();
536
+ for (size_t i=0;i<coverCount;++i,++outCover){
537
+ TCover cover;
538
+ covers.covers(i,&cover);
539
+ outCover->oldPos=(TInt)cover.oldPos;
540
+ outCover->newPos=(TInt)cover.newPos;
541
+ outCover->length=(TInt)cover.length;
876
542
  }
877
- return covers.data();
878
543
  }
879
- std::vector<TOldCover>& covers;
880
- };
881
-
882
-
883
- static void get_diff(TDiffData& diff,std::vector<TOldCover>& covers,
884
- int kMinSingleMatchScore,
885
- bool isUseBigCacheMatch,ICoverLinesListener* listener,
886
- const TSuffixString* sstring,size_t threadNum,
887
- bool isCanExtendCover=true){
888
- _out_diff_info(" match covers by suffix string ...\n");
889
- const bool isCover32=sizeof(*covers.data())==sizeof(hpatch_TCover32);
890
- if (!isCover32)
891
- assert(sizeof(*covers.data())==sizeof(hpatch_TCover));
892
- const hpatch_StreamPos_t maxCoverLen=(listener&&listener->get_limit_cover_length)?
893
- listener->get_limit_cover_length(listener):kDefaultLimitCoverLen;
894
- {
895
- TSuffixString _sstring_default(isUseBigCacheMatch);
544
+
545
+ static void get_diff(const TByte* newData,const TByte* newData_end,
546
+ const TByte* oldData,const TByte* oldData_end,
547
+ TDiffData& out_diff,int kMinSingleMatchScore,
548
+ const TSuffixString* sstring=0, bool isDoSubCover=true,
549
+ bool _is_search_cover_by_stream=false){
550
+ assert(newData<=newData_end);
551
+ assert(oldData<=oldData_end);
552
+ TDiffData& diff=out_diff;
553
+ diff.newData=newData;
554
+ diff.newData_end=newData_end;
555
+ diff.oldData=oldData;
556
+ diff.oldData_end=oldData_end;
557
+
558
+ if (_is_search_cover_by_stream){
559
+ search_cover_by_stream(diff,8,true);
560
+ }else{
561
+ TSuffixString _sstring_default(0,0);
896
562
  if (sstring==0){
897
- _out_diff_info(" create suffix string ...\n");
898
- _sstring_default.resetSuffixString(diff.oldData,diff.oldData_end,threadNum);
563
+ _sstring_default.resetSuffixString(oldData,oldData_end);
899
564
  sstring=&_sstring_default;
900
565
  }
901
-
902
- _out_diff_info(" search covers by suffix string ...\n");
903
- first_search_and_dispose_cover_MT(covers,diff,*sstring,kMinSingleMatchScore,listener,threadNum,isCanExtendCover);
904
- _limitCoverLenth(covers,maxCoverLen);
905
- assert_covers_safe(covers,diff.newData_end-diff.newData,diff.oldData_end-diff.oldData);
906
- if (listener&&listener->search_cover_limit&&
907
- listener->search_cover_limit(listener,covers.data(),covers.size(),isCover32)){
908
- _out_diff_info(" research covers by limit ...\n");
909
- TDiffResearchCover diffResearchCover(diff,covers,*sstring,kMinSingleMatchScore,
910
- listener->get_max_match_deep?listener->get_max_match_deep(listener):kDefaultMaxMatchDeepForLimit,
911
- isCanExtendCover);
912
- listener->research_cover(listener,&diffResearchCover,covers.data(),covers.size(),isCover32);
913
- diffResearchCover.researchFinish();
914
- _limitCoverLenth(covers,maxCoverLen);
915
- assert_covers_safe(covers,diff.newData_end-diff.newData,diff.oldData_end-diff.oldData);
916
- }
566
+ search_cover(diff,*sstring);
917
567
  sstring=0;
918
568
  _sstring_default.clear();
919
569
  }
920
- if (listener&&listener->insert_cover){
921
- TDiffInsertCover diffInsertCover(covers);
922
- hpatch_StreamPos_t newDataSize=(size_t)(diff.newData_end-diff.newData);
923
- hpatch_StreamPos_t oldDataSize=(size_t)(diff.oldData_end-diff.oldData);
924
- listener->insert_cover(listener,&diffInsertCover,covers.data(),covers.size(),isCover32,
925
- &newDataSize,&oldDataSize);
926
- diff.newData_end=diff.newData+(size_t)newDataSize;
927
- diff.oldData_end=diff.oldData+(size_t)oldDataSize;
928
- _limitCoverLenth(covers,maxCoverLen);
929
- assert_covers_safe(covers,diff.newData_end-diff.newData,diff.oldData_end-diff.oldData);
930
- }
931
- if (listener&&listener->search_cover_finish){
932
- hpatch_StreamPos_t newDataSize=(size_t)(diff.newData_end-diff.newData);
933
- hpatch_StreamPos_t oldDataSize=(size_t)(diff.oldData_end-diff.oldData);
934
- size_t newCoverCount=covers.size();
935
- listener->search_cover_finish(listener,covers.data(),&newCoverCount,isCover32,
936
- &newDataSize,&oldDataSize);
937
- check(newCoverCount<=covers.size());
938
- covers.resize(newCoverCount);
939
- diff.newData_end=diff.newData+(size_t)newDataSize;
940
- diff.oldData_end=diff.oldData+(size_t)oldDataSize;
941
- _limitCoverLenth(covers,maxCoverLen);
942
- assert_covers_safe(covers,diff.newData_end-diff.newData,diff.oldData_end-diff.oldData);
943
- }
570
+
571
+ TFixedFloatSmooth kExtendMinSameRatio=kMinSingleMatchScore*36+254;
572
+ if (kExtendMinSameRatio<200) kExtendMinSameRatio=200;
573
+ if (kExtendMinSameRatio>800) kExtendMinSameRatio=800;
574
+
575
+ extend_cover(diff,kExtendMinSameRatio);//先尝试扩展.
576
+ select_cover(diff,kMinSingleMatchScore);
577
+ extend_cover(diff,kExtendMinSameRatio);//select_cover会删除一些覆盖线,所以重新扩展.
578
+ if (isDoSubCover) sub_cover(diff);
944
579
  }
945
580
 
946
581
  }//end namespace
@@ -949,227 +584,269 @@ static void get_diff(TDiffData& diff,std::vector<TOldCover>& covers,
949
584
  void create_diff(const TByte* newData,const TByte* newData_end,
950
585
  const TByte* oldData,const TByte* oldData_end,
951
586
  std::vector<TByte>& out_diff,
952
- int kMinSingleMatchScore,bool isUseBigCacheMatch,size_t threadNum){
953
- TDiffData diff(newData,newData_end,oldData,oldData_end);
954
- std::vector<TOldCover> covers;
955
- get_diff(diff,covers,kMinSingleMatchScore,isUseBigCacheMatch,0,0,threadNum);
956
- serialize_diff(diff,covers,out_diff);
587
+ int kMinSingleMatchScore){
588
+ TDiffData diff;
589
+ get_diff(newData,newData_end,oldData,oldData_end,diff,kMinSingleMatchScore);
590
+ serialize_diff(diff,out_diff);
957
591
  }
958
592
 
959
- void create_compressed_diff(const TByte* newData,const TByte* newData_end,
960
- const TByte* oldData,const TByte* oldData_end,
961
- std::vector<TByte>& out_diff,const hdiff_TCompress* compressPlugin,
962
- int kMinSingleMatchScore,bool isUseBigCacheMatch,
963
- ICoverLinesListener* listener,size_t threadNum){
964
- TVectorAsStreamOutput outDiffStream(out_diff);
965
- create_compressed_diff(newData,newData_end,oldData,oldData_end,&outDiffStream,
966
- compressPlugin,kMinSingleMatchScore,isUseBigCacheMatch,listener,threadNum);
593
+ bool check_diff(const TByte* newData,const TByte* newData_end,
594
+ const TByte* oldData,const TByte* oldData_end,
595
+ const TByte* diff,const TByte* diff_end){
596
+ TAutoMem updateNewData(newData_end-newData);
597
+ TByte* updateNew0=updateNewData.data();
598
+ if (!patch(updateNew0,updateNew0+updateNewData.size(),
599
+ oldData,oldData_end, diff,diff_end)) return false;
600
+ return (0==memcmp(updateNew0,newData,updateNewData.size()));
967
601
  }
968
602
 
969
- static void serialize_compressed_diff(const hpatch_TStreamInput* newData,
970
- const hpatch_TStreamInput* oldData,
971
- bool isZeroSubDiff,const TCovers& covers,
972
- const hpatch_TStreamOutput* out_diff,
973
- const hdiff_TCompress* compressPlugin);
974
603
  void create_compressed_diff(const TByte* newData,const TByte* newData_end,
975
604
  const TByte* oldData,const TByte* oldData_end,
976
- const hpatch_TStreamOutput* out_diff,const hdiff_TCompress* compressPlugin,
977
- int kMinSingleMatchScore,bool isUseBigCacheMatch,
978
- ICoverLinesListener* listener,size_t threadNum){
979
- TDiffData diff(newData,newData_end,oldData,oldData_end);
980
- std::vector<TOldCover> covers;
981
- get_diff(diff,covers,kMinSingleMatchScore,isUseBigCacheMatch,listener,0,threadNum);
982
-
983
- hpatch_TStreamInput _newStream; hpatch_TStreamInput* newStream=&_newStream;
984
- hpatch_TStreamInput _oldStream; hpatch_TStreamInput* oldStream=&_oldStream;
985
- mem_as_hStreamInput(newStream,diff.newData,diff.newData_end);
986
- mem_as_hStreamInput(oldStream,diff.oldData,diff.oldData_end);
987
- if (listener&&listener->map_streams_befor_serialize)
988
- listener->map_streams_befor_serialize(listener,(const hpatch_TStreamInput **)&newStream,(const hpatch_TStreamInput **)&oldStream);
989
- const TCovers _covers((void*)covers.data(),covers.size(),
990
- sizeof(*covers.data())==sizeof(hpatch_TCover32));
991
- serialize_compressed_diff(newStream,oldStream,false,_covers,out_diff,compressPlugin);
605
+ std::vector<TByte>& out_diff,
606
+ const hdiff_TCompress* compressPlugin,int kMinSingleMatchScore){
607
+ TDiffData diff;
608
+ get_diff(newData,newData_end,oldData,oldData_end,diff,kMinSingleMatchScore);
609
+ serialize_compressed_diff(diff,out_diff,compressPlugin);
992
610
  }
993
611
 
994
- void serialize_single_compressed_diff(const hpatch_TStreamInput* newStream,const hpatch_TStreamInput* oldStream,
995
- bool isZeroSubDiff,const TCovers& covers,const hpatch_TStreamOutput* out_diff,
996
- const hdiff_TCompress* compressPlugin,size_t patchStepMemSize){
997
- _out_diff_info(" serialize single compressed diffData ...\n");
998
- check(patchStepMemSize>=hpatch_kStreamCacheSize);
999
- if (patchStepMemSize>newStream->streamSize){
1000
- patchStepMemSize=(size_t)newStream->streamSize;
1001
- if (patchStepMemSize<hpatch_kStreamCacheSize)
1002
- patchStepMemSize=hpatch_kStreamCacheSize;
1003
- }
1004
- TStepStream stepStream(newStream,oldStream,isZeroSubDiff,covers,patchStepMemSize);
1005
-
1006
- TDiffStream outDiff(out_diff);
1007
- {//type
1008
- std::vector<TByte> out_type;
1009
- _outType(out_type,compressPlugin,kHDiffSFVersionType);
1010
- outDiff.pushBack(out_type.data(),out_type.size());
1011
- }
1012
- outDiff.packUInt(newStream->streamSize);
1013
- outDiff.packUInt(oldStream->streamSize);
1014
- outDiff.packUInt(stepStream.getCoverCount());
1015
- outDiff.packUInt(stepStream.getMaxStepMemSize());
1016
- outDiff.packUInt(stepStream.streamSize);
1017
- TPlaceholder compressed_sizePos=outDiff.packUInt_pos(compressPlugin?stepStream.streamSize:0);
1018
- outDiff.pushStream(&stepStream,compressPlugin,compressed_sizePos);
1019
- }
1020
-
1021
- void create_single_compressed_diff(const TByte* newData,const TByte* newData_end,
1022
- const TByte* oldData,const TByte* oldData_end,
1023
- std::vector<unsigned char>& out_diff,
1024
- const hdiff_TCompress* compressPlugin,int kMinSingleMatchScore,
1025
- size_t patchStepMemSize,bool isUseBigCacheMatch,
1026
- ICoverLinesListener* listener,size_t threadNum){
1027
- TVectorAsStreamOutput outDiffStream(out_diff);
1028
- create_single_compressed_diff(newData,newData_end,oldData,oldData_end,&outDiffStream,
1029
- compressPlugin,kMinSingleMatchScore,patchStepMemSize,
1030
- isUseBigCacheMatch,listener,threadNum);
612
+ bool check_compressed_diff(const TByte* newData,const TByte* newData_end,
613
+ const TByte* oldData,const TByte* oldData_end,
614
+ const TByte* diff,const TByte* diff_end,
615
+ hpatch_TDecompress* decompressPlugin){
616
+ TAutoMem updateNewData(newData_end-newData);
617
+ TByte* updateNew0=updateNewData.data();
618
+ if (!patch_decompress_mem(updateNew0,updateNew0+updateNewData.size(),
619
+ oldData,oldData_end, diff,diff_end, decompressPlugin)) return false;
620
+ return (0==memcmp(updateNew0,newData,updateNewData.size()));
1031
621
  }
1032
622
 
1033
- void create_single_compressed_diff(const TByte* newData,const TByte* newData_end,
1034
- const TByte* oldData,const TByte* oldData_end,
1035
- const hpatch_TStreamOutput* out_diff,
1036
- const hdiff_TCompress* compressPlugin,int kMinSingleMatchScore,
1037
- size_t patchStepMemSize,bool isUseBigCacheMatch,
1038
- ICoverLinesListener* listener,size_t threadNum){
1039
- TDiffData diff(newData,newData_end,oldData,oldData_end);
1040
- std::vector<TOldCover> covers;
1041
- get_diff(diff,covers,kMinSingleMatchScore,isUseBigCacheMatch,listener,0,threadNum);
1042
-
1043
- hpatch_TStreamInput _newStream; hpatch_TStreamInput* newStream=&_newStream;
1044
- hpatch_TStreamInput _oldStream; hpatch_TStreamInput* oldStream=&_oldStream;
1045
- mem_as_hStreamInput(newStream,diff.newData,diff.newData_end);
1046
- mem_as_hStreamInput(oldStream,diff.oldData,diff.oldData_end);
1047
- if (listener&&listener->map_streams_befor_serialize)
1048
- listener->map_streams_befor_serialize(listener,(const hpatch_TStreamInput **)&newStream,(const hpatch_TStreamInput **)&oldStream);
1049
- const TCovers _covers((void*)covers.data(),covers.size(),
1050
- sizeof(*covers.data())==sizeof(hpatch_TCover32));
1051
- serialize_single_compressed_diff(newStream,oldStream,false,_covers,
1052
- out_diff,compressPlugin,patchStepMemSize);
1053
- }
1054
623
 
1055
- void create_single_compressed_diff_stream(const hpatch_TStreamInput* newData,
1056
- const hpatch_TStreamInput* oldData,
1057
- const hpatch_TStreamOutput* out_diff,
1058
- const hdiff_TCompress* compressPlugin,
1059
- size_t kMatchBlockSize,size_t patchStepMemSize,
1060
- const hdiff_TMTSets_s* mtsets){
1061
- TCoversBuf covers(newData->streamSize,oldData->streamSize);
1062
- get_match_covers_by_block(newData,oldData,&covers,kMatchBlockSize,mtsets);
1063
- serialize_single_compressed_diff(newData,oldData,true,covers,
1064
- out_diff,compressPlugin,patchStepMemSize);
624
+ static void _flush_step_code(std::vector<TByte> &buf, std::vector<TByte> &step_bufCover, std::vector<TByte> &step_bufData,
625
+ hdiff_private::TSangileStreamRLE0 &step_bufRle,size_t& curMaxStepMemSize) {
626
+ step_bufRle.finishAppend();
627
+ packUInt(buf,step_bufCover.size()); //general saved data
628
+ packUInt(buf,step_bufRle.curCodeSize());
629
+ size_t bufSize_back=buf.size();
630
+ pushBack(buf,step_bufCover); step_bufCover.clear();
631
+ pushBack(buf,step_bufRle.fixed_code); step_bufRle.clear();
632
+ size_t curStepMemSize=buf.size()-bufSize_back;
633
+ pushBack(buf,step_bufData); step_bufData.clear();
634
+ if (curMaxStepMemSize<curStepMemSize)
635
+ curMaxStepMemSize=curStepMemSize;
1065
636
  }
1066
637
 
638
+ static void serialize_single_compressed_diff(TDiffData& diff,std::vector<TByte>& out_diff,
639
+ const hdiff_TCompress* compressPlugin,size_t patchStepMemSize){
640
+ check(patchStepMemSize>=hpatch_kStreamCacheSize);
641
+ std::vector<TOldCover>& covers=diff.covers;
642
+ const TUInt newDataSize=(TUInt)(diff.newData_end-diff.newData);
643
+ const TUInt oldDataSize=(TUInt)(diff.oldData_end-diff.oldData);
644
+ if (covers.empty()){
645
+ covers.push_back(TOldCover(0,newDataSize,0));
646
+ }else{
647
+ const TOldCover& back=covers[covers.size()-1];
648
+ if ((TUInt)back.newPos+(TUInt)back.length<newDataSize){
649
+ covers.push_back(TOldCover(back.oldPos+back.length,newDataSize,0));
650
+ }
651
+ }
652
+ size_t curMaxStepMemSize=0;
653
+ std::vector<TByte> buf;
654
+ {
655
+ TInt lastOldEnd=0;
656
+ TInt lastNewEnd=0;
657
+ TUInt curNewDiff=0;
658
+ std::vector<TByte> step_bufCover;
659
+ TSangileStreamRLE0 step_bufRle;
660
+ std::vector<TByte> step_bufData;
661
+ TUInt i=0;
662
+ while ( i<covers.size()) {
663
+ const size_t step_bufCover_backSize=step_bufCover.size();
664
+
665
+ const TOldCover& cover=covers[i];
666
+ const TByte* subDiff=diff.newDataSubDiff.data()+cover.newPos;
667
+ if (cover.oldPos>=lastOldEnd){ //save inc_oldPos
668
+ packUIntWithTag(step_bufCover,(TUInt)(cover.oldPos-lastOldEnd), 0, 1);
669
+ }else{
670
+ packUIntWithTag(step_bufCover,(TUInt)(lastOldEnd-cover.oldPos), 1, 1);//sub safe
671
+ }
672
+ TInt backNewLen=cover.newPos-lastNewEnd;
673
+ assert(backNewLen>=0);
674
+ packUInt(step_bufCover,(TUInt)backNewLen); //save inc_newPos
675
+ packUInt(step_bufCover,cover.length);
676
+
677
+ const TUInt curMaxNeedSize = step_bufCover.size() + step_bufRle.maxCodeSize(subDiff,subDiff+cover.length);
678
+ if (curMaxNeedSize<=patchStepMemSize){ //append
679
+ step_bufRle.append(subDiff,subDiff+cover.length);
680
+ if (backNewLen>0){
681
+ const TByte* newDataDiff=diff.newDataDiff.data()+curNewDiff;
682
+ pushBack(step_bufData,newDataDiff,newDataDiff+backNewLen);
683
+ curNewDiff+=backNewLen;
684
+ }
1067
685
 
1068
- bool check_diff(const TByte* newData,const TByte* newData_end,
1069
- const TByte* oldData,const TByte* oldData_end,
1070
- const TByte* diff,const TByte* diff_end){
1071
- hpatch_TStreamInput newStream;
1072
- hpatch_TStreamInput oldStream;
1073
- hpatch_TStreamInput diffStream;
1074
- mem_as_hStreamInput(&newStream,newData,newData_end);
1075
- mem_as_hStreamInput(&oldStream,oldData,oldData_end);
1076
- mem_as_hStreamInput(&diffStream,diff,diff_end);
1077
- return check_diff(&newStream,&oldStream,&diffStream);
686
+ //next i
687
+ lastOldEnd=cover.oldPos+cover.length;//! +length
688
+ lastNewEnd=cover.newPos+cover.length;
689
+ ++i;
690
+ }else{
691
+ if (step_bufCover_backSize+step_bufRle.curCodeSize()>=(patchStepMemSize/2)){//flush step
692
+ step_bufCover.resize(step_bufCover_backSize);
693
+ _flush_step_code(buf,step_bufCover,step_bufData,step_bufRle,curMaxStepMemSize);
694
+ continue; // old i!
695
+ }else{ //clip one cover to two cover
696
+ TOldCover& cover_l=covers[i];
697
+ TUInt clen=cover_l.length;
698
+ while (1) {
699
+ clen=clen*3/4;
700
+ check(clen>0); // stepMemSize error
701
+ const TUInt _curMaxNeedSize = step_bufCover.size() + step_bufRle.maxCodeSize(subDiff,subDiff+clen);
702
+ if (_curMaxNeedSize<=patchStepMemSize)
703
+ break;
704
+ }
705
+ TOldCover cover_r=cover_l;
706
+ cover_l.length=clen;
707
+ cover_r.length-=clen;
708
+ cover_r.oldPos+=clen;
709
+ cover_r.newPos+=clen;
710
+ covers.insert(covers.begin()+(i+1),cover_r);
711
+
712
+ step_bufCover.resize(step_bufCover_backSize);
713
+ continue; // old i!
714
+ }
715
+ }
716
+ }
717
+ check(diff.newDataDiff.size()==curNewDiff);
718
+ if (!step_bufCover.empty())
719
+ _flush_step_code(buf,step_bufCover,step_bufData,step_bufRle,curMaxStepMemSize);
720
+ }
721
+ assert(curMaxStepMemSize<=patchStepMemSize);
722
+
723
+ std::vector<TByte> compress_buf;
724
+ do_compress(compress_buf,buf,compressPlugin);
725
+
726
+ _outType(out_diff,compress_buf.empty()?0:compressPlugin,kHDiffSFVersionType);
727
+ packUInt(out_diff, newDataSize);
728
+ packUInt(out_diff, oldDataSize);
729
+ packUInt(out_diff, covers.size());
730
+ packUInt(out_diff, curMaxStepMemSize);
731
+ packUInt(out_diff, (TUInt)buf.size());
732
+ packUInt(out_diff, (TUInt)compress_buf.size());
733
+
734
+ pushCompressCode(out_diff,compress_buf,buf);
1078
735
  }
1079
736
 
1080
- bool check_diff(const hpatch_TStreamInput* newData,
1081
- const hpatch_TStreamInput* oldData,
1082
- const hpatch_TStreamInput* diff){
1083
- const size_t kACacheBufSize=hdiff_kFileIOBufBestSize;
1084
- TAutoMem _cache(kACacheBufSize*(1+16));
1085
- _TCheckOutNewDataStream out_newData(newData,_cache.data(),kACacheBufSize);
1086
- _test_rt(patch_stream_with_cache(&out_newData,oldData,diff,
1087
- _cache.data()+kACacheBufSize,_cache.data_end()));
1088
- _test_rt(out_newData.isWriteFinish());
1089
- return true;
737
+ void create_single_compressed_diff(const TByte* newData,const TByte* newData_end,
738
+ const TByte* oldData,const TByte* oldData_end,
739
+ std::vector<unsigned char>& out_diff,ICoverLinesListener* listener,const hdiff_TCompress* compressPlugin,
740
+ int kMinSingleMatchScore,size_t patchStepMemSize,bool _is_search_cover_by_stream){
741
+ TDiffData diff;
742
+ get_diff(newData,newData_end,oldData,oldData_end,diff,kMinSingleMatchScore,0,false,_is_search_cover_by_stream);
743
+ if (listener){
744
+ std::vector<hpatch_TCover> _covers(diff.covers.size());
745
+ for (size_t i=0; i<diff.covers.size(); ++i) {
746
+ _covers[i].oldPos=diff.covers[i].oldPos;
747
+ _covers[i].newPos=diff.covers[i].newPos;
748
+ _covers[i].length=diff.covers[i].length;
749
+ }
750
+ hpatch_StreamPos_t newDataSize=(size_t)(diff.newData_end-diff.newData);
751
+ hpatch_StreamPos_t oldDataSize=(size_t)(diff.oldData_end-diff.oldData);
752
+ size_t coverCount=_covers.size();
753
+ listener->coverLines(listener,_covers.data(),&coverCount,&newDataSize,&oldDataSize);
754
+ assert(coverCount<=_covers.size());
755
+ diff.covers.resize(coverCount);
756
+ diff.newData_end=diff.newData+newDataSize;
757
+ diff.oldData_end=diff.oldData+oldDataSize;
758
+ for (size_t i=0; i<diff.covers.size(); ++i){
759
+ diff.covers[i].oldPos=(TInt)_covers[i].oldPos;
760
+ diff.covers[i].newPos=(TInt)_covers[i].newPos;
761
+ diff.covers[i].length=(TInt)_covers[i].length;
762
+ }
763
+ }
764
+ sub_cover(diff);
765
+ serialize_single_compressed_diff(diff,out_diff,compressPlugin,patchStepMemSize);
1090
766
  }
1091
767
 
1092
- bool check_compressed_diff(const TByte* newData,const TByte* newData_end,
1093
- const TByte* oldData,const TByte* oldData_end,
1094
- const TByte* diff,const TByte* diff_end,
1095
- hpatch_TDecompress* decompressPlugin){
1096
- hpatch_TStreamInput newStream;
1097
- hpatch_TStreamInput oldStream;
1098
- hpatch_TStreamInput diffStream;
1099
- mem_as_hStreamInput(&newStream,newData,newData_end);
1100
- mem_as_hStreamInput(&oldStream,oldData,oldData_end);
1101
- mem_as_hStreamInput(&diffStream,diff,diff_end);
1102
- return check_compressed_diff(&newStream,&oldStream,&diffStream,decompressPlugin);
768
+ static hpatch_BOOL _check_single_onDiffInfo(struct sspatch_listener_t* listener,
769
+ const hpatch_singleCompressedDiffInfo* info,
770
+ hpatch_TDecompress** out_decompressPlugin,
771
+ unsigned char** out_temp_cache,
772
+ unsigned char** out_temp_cacheEnd){
773
+ size_t memSize=(size_t)(info->stepMemSize+hpatch_kStreamCacheSize*3);
774
+ *out_temp_cache=(unsigned char*)malloc(memSize);
775
+ *out_temp_cacheEnd=(*out_temp_cache)+memSize;
776
+ *out_decompressPlugin=(hpatch_TDecompress*)listener->import;
777
+ return hpatch_TRUE;
1103
778
  }
1104
-
1105
- bool check_compressed_diff(const hpatch_TStreamInput* newData,
1106
- const hpatch_TStreamInput* oldData,
1107
- const hpatch_TStreamInput* compressed_diff,
1108
- hpatch_TDecompress* decompressPlugin){
1109
- const size_t kACacheBufSize=hdiff_kFileIOBufBestSize;
1110
- TAutoMem _cache(kACacheBufSize*(1+16));
1111
- _TCheckOutNewDataStream out_newData(newData,_cache.data(),kACacheBufSize);
1112
- _test_rt(patch_decompress_with_cache(&out_newData,oldData,compressed_diff,decompressPlugin,
1113
- _cache.data()+kACacheBufSize,_cache.data_end()));
1114
- _test_rt(out_newData.isWriteFinish());
1115
- return true;
779
+ static void _check_single_onPatchFinish(struct sspatch_listener_t* listener,
780
+ unsigned char* temp_cache, unsigned char* temp_cacheEnd){
781
+ if (temp_cache) free(temp_cache);
1116
782
  }
1117
783
 
1118
784
  bool check_single_compressed_diff(const TByte* newData,const TByte* newData_end,
1119
785
  const TByte* oldData,const TByte* oldData_end,
1120
786
  const TByte* diff,const TByte* diff_end,
1121
- hpatch_TDecompress* decompressPlugin,size_t threadNum){
1122
- hpatch_TStreamInput newStream;
1123
- hpatch_TStreamInput oldStream;
1124
- hpatch_TStreamInput diffStream;
1125
- mem_as_hStreamInput(&newStream,newData,newData_end);
1126
- mem_as_hStreamInput(&oldStream,oldData,oldData_end);
1127
- mem_as_hStreamInput(&diffStream,diff,diff_end);
1128
- return check_single_compressed_diff(&newStream,&oldStream,&diffStream,decompressPlugin,threadNum);
1129
- }
1130
-
1131
- bool check_single_compressed_diff(const hpatch_TStreamInput* newData,
1132
- const TByte* oldData,const TByte* oldData_end,
1133
- const hpatch_TStreamInput* diff,
1134
- hpatch_TDecompress* decompressPlugin,size_t threadNum){
1135
- hpatch_TStreamInput oldStream;
1136
- mem_as_hStreamInput(&oldStream,oldData,oldData_end);
1137
- return check_single_compressed_diff(newData,&oldStream,diff,decompressPlugin,threadNum);
1138
- }
1139
-
1140
- static hpatch_BOOL _check_single_onDiffInfo(struct sspatch_listener_t* listener,
1141
- const hpatch_singleCompressedDiffInfo* info,
1142
- hpatch_TDecompress** out_decompressPlugin,
1143
- unsigned char** out_temp_cache,
1144
- unsigned char** out_temp_cacheEnd){
1145
- size_t memSize=(size_t)(info->stepMemSize+hdiff_kFileIOBufBestSize*(1+16));
1146
- *out_temp_cache=(unsigned char*)malloc(memSize);
1147
- *out_temp_cacheEnd=(*out_temp_cache)+memSize;
1148
- *out_decompressPlugin=(info->compressType[0]=='\0')?0:(hpatch_TDecompress*)listener->import;
1149
- return hpatch_TRUE;
1150
- }
1151
- static void _check_single_onPatchFinish(struct sspatch_listener_t* listener,
1152
- unsigned char* temp_cache, unsigned char* temp_cacheEnd){
1153
- if (temp_cache) free(temp_cache);
1154
- }
1155
- bool check_single_compressed_diff(const hpatch_TStreamInput* newData,
1156
- const hpatch_TStreamInput* oldData,
1157
- const hpatch_TStreamInput* diff,
1158
- hpatch_TDecompress* decompressPlugin,size_t threadNum){
787
+ hpatch_TDecompress* decompressPlugin){
1159
788
  sspatch_listener_t listener={0};
1160
789
  listener.import=decompressPlugin;
1161
790
  listener.onDiffInfo=_check_single_onDiffInfo;
1162
791
  listener.onPatchFinish=_check_single_onPatchFinish;
1163
-
1164
- const size_t kACacheBufSize=hdiff_kFileIOBufBestSize;
1165
- TAutoMem _cache(kACacheBufSize*(1+16));
1166
- _TCheckOutNewDataStream out_newData(newData,_cache.data(),kACacheBufSize);
792
+ TAutoMem updateNewData(newData_end-newData);
793
+ TByte* updateNew0=updateNewData.data();
794
+ if (!patch_single_stream_by_mem(&listener,updateNew0,updateNew0+updateNewData.size(),
795
+ oldData,oldData_end,diff,diff_end)) return false;
796
+ return (0==memcmp(updateNew0,newData,updateNewData.size()));
797
+ }
798
+
799
+
800
+ #define _test(value) { if (!(value)) { fprintf(stderr,"patch check "#value" error!\n"); return hpatch_FALSE; } }
801
+
802
+ bool check_compressed_diff_stream(const hpatch_TStreamInput* newData,
803
+ const hpatch_TStreamInput* oldData,
804
+ const hpatch_TStreamInput* compressed_diff,
805
+ hpatch_TDecompress* decompressPlugin){
1167
806
 
1168
- _test_rt(patch_single_stream(&listener,&out_newData,oldData,diff,0,0,threadNum));
1169
- _test_rt(out_newData.isWriteFinish());
807
+ struct _TCheckOutNewDataStream:public hpatch_TStreamOutput{
808
+ explicit _TCheckOutNewDataStream(const hpatch_TStreamInput* _newData,
809
+ TByte* _buf,size_t _bufSize)
810
+ :newData(_newData),writedLen(0),buf(_buf),bufSize(_bufSize){
811
+ streamImport=this;
812
+ streamSize=newData->streamSize;
813
+ read_writed=0;
814
+ write=_write_check;
815
+ }
816
+ static hpatch_BOOL _write_check(const hpatch_TStreamOutput* stream,hpatch_StreamPos_t writeToPos,
817
+ const TByte* data,const TByte* data_end){
818
+ _TCheckOutNewDataStream* self=(_TCheckOutNewDataStream*)stream->streamImport;
819
+ _test(self->writedLen==writeToPos);
820
+ self->writedLen+=(size_t)(data_end-data);
821
+ _test(self->writedLen<=self->streamSize);
822
+
823
+ hpatch_StreamPos_t readPos=writeToPos;
824
+ while (data<data_end) {
825
+ size_t readLen=(size_t)(data_end-data);
826
+ if (readLen>self->bufSize) readLen=self->bufSize;
827
+ _test(self->newData->read(self->newData,readPos,self->buf,self->buf+readLen));
828
+ _test(0==memcmp(data,self->buf,readLen));
829
+ data+=readLen;
830
+ readPos+=readLen;
831
+ }
832
+ return hpatch_TRUE;
833
+ }
834
+ bool isWriteFinish()const{ return writedLen==newData->streamSize; }
835
+ const hpatch_TStreamInput* newData;
836
+ hpatch_StreamPos_t writedLen;
837
+ TByte* buf;
838
+ size_t bufSize;
839
+ };
840
+
841
+ const size_t kACacheBufSize=hpatch_kFileIOBufBetterSize;
842
+ TAutoMem _cache(kACacheBufSize*8);
843
+ _TCheckOutNewDataStream out_newData(newData,_cache.data(),kACacheBufSize);
844
+ _test(patch_decompress_with_cache(&out_newData,oldData,compressed_diff,decompressPlugin,
845
+ _cache.data()+kACacheBufSize,_cache.data_end()));
846
+ _test(out_newData.isWriteFinish());
1170
847
  return true;
1171
848
  }
1172
-
849
+ #undef _test
1173
850
 
1174
851
  //for test
1175
852
  void __hdiff_private__create_compressed_diff(const TByte* newData,const TByte* newData_end,
@@ -1177,87 +854,49 @@ void __hdiff_private__create_compressed_diff(const TByte* newData,const TByte* n
1177
854
  std::vector<TByte>& out_diff,
1178
855
  const hdiff_TCompress* compressPlugin,int kMinSingleMatchScore,
1179
856
  const TSuffixString* sstring){
1180
- TDiffData diff(newData,newData_end,oldData,oldData_end);
1181
- std::vector<TOldCover> covers;
1182
- get_diff(diff,covers,kMinSingleMatchScore,false,0,sstring,1);
1183
- TVectorAsStreamOutput outDiffStream(out_diff);
1184
-
1185
- hpatch_TStreamInput _newStream; hpatch_TStreamInput* newStream=&_newStream;
1186
- hpatch_TStreamInput _oldStream; hpatch_TStreamInput* oldStream=&_oldStream;
1187
- mem_as_hStreamInput(newStream,diff.newData,diff.newData_end);
1188
- mem_as_hStreamInput(oldStream,diff.oldData,diff.oldData_end);
1189
- const TCovers _covers((void*)covers.data(),covers.size(),
1190
- sizeof(*covers.data())==sizeof(hpatch_TCover32));
1191
- serialize_compressed_diff(newStream,oldStream,false,_covers,&outDiffStream,compressPlugin);
857
+ TDiffData diff;
858
+ get_diff(newData,newData_end,oldData,oldData_end,diff,kMinSingleMatchScore,sstring);
859
+ serialize_compressed_diff(diff,out_diff,compressPlugin);
1192
860
  }
1193
861
 
1194
862
 
1195
863
  //======================
864
+ #include "private_diff/limit_mem_diff/digest_matcher.h"
865
+ #include "private_diff/limit_mem_diff/stream_serialize.h"
1196
866
 
1197
- void get_match_covers_by_block(const hpatch_TStreamInput* newData,const hpatch_TStreamInput* oldData,
1198
- hpatch_TOutputCovers* out_covers,size_t kMatchBlockSize,const hdiff_TMTSets_s* mtsets){
1199
- assert(out_covers->push_cover!=0);
1200
- TDigestMatcher matcher(oldData,newData,kMatchBlockSize,mtsets?*mtsets:hdiff_TMTSets_s_kEmpty);
1201
- matcher.search_cover(out_covers);
1202
- }
1203
- void get_match_covers_by_block(const unsigned char* newData,const unsigned char* newData_end,
1204
- const unsigned char* oldData,const unsigned char* oldData_end,
1205
- hpatch_TOutputCovers* out_covers,size_t kMatchBlockSize,size_t threadNum){
1206
- hdiff_TStreamInput oldData_stream;
1207
- mem_as_hStreamInput(&oldData_stream,oldData,oldData_end);
1208
- hdiff_TStreamInput newData_stream;
1209
- mem_as_hStreamInput(&newData_stream,newData,newData_end);
1210
- hdiff_TMTSets_s mtsets={threadNum,threadNum,true,true};
1211
- get_match_covers_by_block(&newData_stream,&oldData_stream,out_covers,kMatchBlockSize,&mtsets);
1212
- }
1213
-
1214
- void get_match_covers_by_sstring(const unsigned char* newData,const unsigned char* newData_end,
1215
- const unsigned char* oldData,const unsigned char* oldData_end,
1216
- std::vector<hpatch_TCover_sz>& out_covers,int kMinSingleMatchScore,
1217
- bool isUseBigCacheMatch,ICoverLinesListener* listener,
1218
- size_t threadNum,bool isCanExtendCover){
1219
- TDiffData diff(newData,newData_end,oldData,oldData_end);
1220
- std::vector<TOldCover> covers;
1221
- assert(sizeof(TOldCover)==sizeof(hpatch_TCover_sz));
1222
- { std::vector<hpatch_TCover_sz> tmp; tmp.swap(out_covers); }
1223
- get_diff(diff,covers,kMinSingleMatchScore,isUseBigCacheMatch,listener,0,threadNum,isCanExtendCover);
1224
- void* pcovers=&covers;
1225
- out_covers.swap(*(std::vector<hpatch_TCover_sz>*)pcovers);
1226
- }
1227
- void get_match_covers_by_sstring(const unsigned char* newData,const unsigned char* newData_end,
1228
- const unsigned char* oldData,const unsigned char* oldData_end,
1229
- hpatch_TOutputCovers* out_covers,int kMinSingleMatchScore,
1230
- bool isUseBigCacheMatch,ICoverLinesListener* listener,
1231
- size_t threadNum,bool isCanExtendCover){
1232
- std::vector<hpatch_TCover_sz> covers;
1233
- get_match_covers_by_sstring(newData,newData_end,oldData,oldData_end,covers,
1234
- kMinSingleMatchScore,isUseBigCacheMatch,listener,threadNum,isCanExtendCover);
1235
- const hpatch_TCover_sz* pcovers=covers.data();
1236
- for (size_t i=0;i<covers.size();++i,++pcovers){
1237
- if (sizeof(*pcovers)==sizeof(hpatch_TCover)){
1238
- out_covers->push_cover(out_covers,(const hpatch_TCover*)pcovers);
1239
- }else{
1240
- hpatch_TCover cover;
1241
- cover.oldPos=pcovers->oldPos;
1242
- cover.newPos=pcovers->newPos;
1243
- cover.length=pcovers->length;
1244
- out_covers->push_cover(out_covers,&cover);
867
+ static void getCovers_by_stream(const hpatch_TStreamInput* newData,
868
+ const hpatch_TStreamInput* oldData,
869
+ size_t kMatchBlockSize,bool kIsSkipSameRange,
870
+ TCovers& out_covers){
871
+ {
872
+ TDigestMatcher matcher(oldData,kMatchBlockSize,kIsSkipSameRange);
873
+ matcher.search_cover(newData,&out_covers);
874
+ }
875
+ {//check cover
876
+ TCover cover;
877
+ hpatch_StreamPos_t lastNewEnd=0;
878
+ size_t coverCount=out_covers.coverCount();
879
+ for (size_t i=0;i<coverCount;++i){
880
+ out_covers.covers(i,&cover);
881
+ assert_cover_safe(cover,lastNewEnd,newData->streamSize,oldData->streamSize);
882
+ lastNewEnd=cover.newPos+cover.length;
1245
883
  }
1246
884
  }
885
+ //todo: + extend_cover_stream ?
1247
886
  }
1248
887
 
1249
-
1250
- static void serialize_compressed_diff(const hpatch_TStreamInput* newData,
1251
- const hpatch_TStreamInput* oldData,
1252
- bool isZeroSubDiff,const TCovers& covers,
1253
- const hpatch_TStreamOutput* out_diff,
1254
- const hdiff_TCompress* compressPlugin){
1255
- _out_diff_info(" serialize compressed diffData ...\n");
888
+ static void stream_serialize(const hpatch_TStreamInput* newData,
889
+ hpatch_StreamPos_t oldDataSize,
890
+ const hpatch_TStreamOutput* out_diff,
891
+ const hdiff_TCompress* compressPlugin,
892
+ const TCovers& covers){
893
+
1256
894
  std::vector<TByte> rle_ctrlBuf;
1257
895
  std::vector<TByte> rle_codeBuf;
1258
- {//now rle datas used buf, not used stream
1259
- TNewDataSubDiffStream subStream(newData,oldData,covers,false,isZeroSubDiff);
1260
- bytesRLE_save(rle_ctrlBuf,rle_codeBuf,&subStream,kRle_bestSize);
896
+ {//empty rle //todo: suport rle data
897
+ if (newData->streamSize>0)
898
+ packUIntWithTag(rle_ctrlBuf,newData->streamSize-1,kByteRleType_rle0,kByteRleType_bit);
899
+ assert(rle_codeBuf.empty());
1261
900
  }
1262
901
 
1263
902
  TDiffStream outDiff(out_diff);
@@ -1267,18 +906,16 @@ static void serialize_compressed_diff(const hpatch_TStreamInput* newData,
1267
906
  outDiff.pushBack(out_type.data(),out_type.size());
1268
907
  }
1269
908
  outDiff.packUInt(newData->streamSize);
1270
- outDiff.packUInt(oldData->streamSize);
909
+ outDiff.packUInt(oldDataSize);
1271
910
  outDiff.packUInt(covers.coverCount());
1272
911
  const hpatch_StreamPos_t cover_buf_size=TCoversStream::getDataSize(covers);
1273
912
  outDiff.packUInt(cover_buf_size);
1274
913
  TPlaceholder compress_cover_buf_sizePos=
1275
914
  outDiff.packUInt_pos(compressPlugin?cover_buf_size:0); //compress_cover_buf size
1276
915
  outDiff.packUInt(rle_ctrlBuf.size());//rle_ctrlBuf size
1277
- TPlaceholder compress_rle_ctrlBuf_sizePos=
1278
- outDiff.packUInt_pos(compressPlugin?rle_ctrlBuf.size():0); //compress_rle_ctrlBuf size
916
+ outDiff.packUInt(0);//compress_rle_ctrlBuf size
1279
917
  outDiff.packUInt(rle_codeBuf.size());//rle_codeBuf size
1280
- TPlaceholder compress_rle_codeBuf_sizePos=
1281
- outDiff.packUInt_pos(compressPlugin?rle_codeBuf.size():0); //compress_rle_codeBuf size
918
+ outDiff.packUInt(0);//compress_rle_codeBuf size
1282
919
  const hpatch_StreamPos_t newDataDiff_size=
1283
920
  TNewDataDiffStream::getDataSize(covers,newData->streamSize);
1284
921
  outDiff.packUInt(newDataDiff_size);
@@ -1289,11 +926,9 @@ static void serialize_compressed_diff(const hpatch_TStreamInput* newData,
1289
926
  TCoversStream cover_buf(covers,cover_buf_size);
1290
927
  outDiff.pushStream(&cover_buf,compressPlugin,compress_cover_buf_sizePos);
1291
928
  }
1292
- {//save rle
1293
- TVectorAsStreamInput rle_ctrlStream(rle_ctrlBuf);
1294
- TVectorAsStreamInput rle_codeStream(rle_codeBuf);
1295
- outDiff.pushStream(&rle_ctrlStream,compressPlugin,compress_rle_ctrlBuf_sizePos);
1296
- outDiff.pushStream(&rle_codeStream,compressPlugin,compress_rle_codeBuf_sizePos);
929
+ {//rle
930
+ outDiff.pushBack(rle_ctrlBuf.data(),rle_ctrlBuf.size());
931
+ outDiff.pushBack(rle_codeBuf.data(),rle_codeBuf.size());
1297
932
  }
1298
933
  {//save newDataDiff
1299
934
  TNewDataDiffStream newDataDiff(covers,newData,newDataDiff_size);
@@ -1304,19 +939,18 @@ static void serialize_compressed_diff(const hpatch_TStreamInput* newData,
1304
939
  void create_compressed_diff_stream(const hpatch_TStreamInput* newData,
1305
940
  const hpatch_TStreamInput* oldData,
1306
941
  const hpatch_TStreamOutput* out_diff,
1307
- const hdiff_TCompress* compressPlugin,
1308
- size_t kMatchBlockSize,const hdiff_TMTSets_s* mtsets){
1309
- TCoversBuf covers(newData->streamSize,oldData->streamSize);
1310
- get_match_covers_by_block(newData,oldData,&covers,kMatchBlockSize,mtsets);
1311
- serialize_compressed_diff(newData,oldData,true,covers,out_diff,compressPlugin);
942
+ const hdiff_TCompress* compressPlugin,size_t kMatchBlockSize){
943
+ const bool isSkipSameRange=(compressPlugin!=0);
944
+ TCovers covers(oldData->streamSize,newData->streamSize);
945
+ getCovers_by_stream(newData,oldData,kMatchBlockSize,isSkipSameRange,covers);
946
+ stream_serialize(newData,oldData->streamSize,out_diff,compressPlugin,covers);
1312
947
  }
1313
948
 
1314
949
 
1315
950
  void resave_compressed_diff(const hpatch_TStreamInput* in_diff,
1316
951
  hpatch_TDecompress* decompressPlugin,
1317
952
  const hpatch_TStreamOutput* out_diff,
1318
- const hdiff_TCompress* compressPlugin,
1319
- hpatch_StreamPos_t out_diff_curPos){
953
+ const hdiff_TCompress* compressPlugin){
1320
954
  _THDiffzHead head;
1321
955
  hpatch_compressedDiffInfo diffInfo;
1322
956
  assert(in_diff!=0);
@@ -1335,7 +969,7 @@ void resave_compressed_diff(const hpatch_TStreamInput* in_diff,
1335
969
  }
1336
970
  }
1337
971
 
1338
- TDiffStream outDiff(out_diff,out_diff_curPos);
972
+ TDiffStream outDiff(out_diff);
1339
973
  {//type
1340
974
  std::vector<TByte> out_type;
1341
975
  _outType(out_type,compressPlugin);
@@ -1389,358 +1023,3 @@ void resave_compressed_diff(const hpatch_TStreamInput* in_diff,
1389
1023
  diffPos0+=bufSize;
1390
1024
  }
1391
1025
  }
1392
-
1393
-
1394
- hpatch_StreamPos_t
1395
- resave_single_compressed_diff(const hpatch_TStreamInput* in_diff,
1396
- hpatch_TDecompress* decompressPlugin,
1397
- const hpatch_TStreamOutput* out_diff,
1398
- const hdiff_TCompress* compressPlugin,
1399
- const hpatch_singleCompressedDiffInfo* diffInfo,
1400
- hpatch_StreamPos_t in_diff_curPos,
1401
- hpatch_StreamPos_t out_diff_curPos){
1402
- hpatch_singleCompressedDiffInfo _diffInfo;
1403
- if (diffInfo==0){
1404
- checki(getSingleCompressedDiffInfo(&_diffInfo,in_diff,in_diff_curPos),
1405
- "getSingleCompressedDiffInfo() return fail!");
1406
- diffInfo=&_diffInfo;
1407
- }
1408
- const bool isCompressed=(diffInfo->compressedSize>0);
1409
- if (isCompressed){ //check
1410
- checki(diffInfo->compressedSize+(in_diff_curPos+diffInfo->diffDataPos)==in_diff->streamSize,
1411
- "resave_single_compressed_diff() diffInfo error!");
1412
- checki((decompressPlugin!=0)&&(decompressPlugin->is_can_open(diffInfo->compressType)),
1413
- "resave_single_compressed_diff() decompressPlugin error!");
1414
- }
1415
-
1416
- TDiffStream outDiff(out_diff,out_diff_curPos);
1417
- {//type & head
1418
- std::vector<TByte> outBuf;
1419
- _outType(outBuf, compressPlugin,kHDiffSFVersionType);
1420
- packUInt(outBuf, diffInfo->newDataSize);
1421
- packUInt(outBuf, diffInfo->oldDataSize);
1422
- packUInt(outBuf, diffInfo->coverCount);
1423
- packUInt(outBuf, diffInfo->stepMemSize);
1424
- packUInt(outBuf, diffInfo->uncompressedSize);
1425
- outDiff.pushBack(outBuf.data(),outBuf.size());
1426
- //no compressedSize
1427
- }
1428
- {//save single stream data
1429
- TStreamClip clip(in_diff,diffInfo->diffDataPos+in_diff_curPos,in_diff->streamSize,
1430
- isCompressed?decompressPlugin:0,diffInfo->uncompressedSize);
1431
- TPlaceholder compressedSize_pos=outDiff.packUInt_pos(compressPlugin?diffInfo->uncompressedSize:0);
1432
- outDiff.pushStream(&clip,compressPlugin,compressedSize_pos);
1433
- }
1434
- return outDiff.getWritedPos();
1435
- }
1436
-
1437
-
1438
- //----------------------------------------------------------------------------------------------------
1439
-
1440
- #include "diff_for_hpatch_lite.h"
1441
- #include "../HPatchLite/hpatch_lite.h"
1442
-
1443
- namespace{
1444
- static const char* kHPatchLite_versionType="hI";
1445
- static const hpi_byte kHPatchLite_versionCode=1;
1446
- static const hpi_byte kHPatchLite_inplaceCode=2; //for inplace-patch, just adding extraSafeSize
1447
-
1448
- static inline void hpi_packUInt(std::vector<TByte>& buf,TUInt v){
1449
- check(v==(hpi_pos_t)v);
1450
- packUInt(buf,v);
1451
- }
1452
- static inline void hpi_packUIntWithTag(std::vector<TByte>& buf,TUInt v,TByte tag,TByte bit){
1453
- check(v==(hpi_pos_t)v);
1454
- packUIntWithTag(buf,v,tag,bit);
1455
- }
1456
-
1457
- static inline TByte hpi_getSavedSizeBytes(TUInt size){
1458
- check(size==(hpi_pos_t)size);
1459
- TByte bytes=0;
1460
- while (size>0){
1461
- ++bytes;
1462
- size>>=8;
1463
- }
1464
- return bytes;
1465
- }
1466
- static inline void hpi_saveSize(std::vector<TByte>& buf,TUInt size){
1467
- check(size==(hpi_pos_t)size);
1468
- while (size>0){
1469
- buf.push_back((TByte)size);
1470
- size>>=8;
1471
- }
1472
- }
1473
-
1474
- static bool _getIs0(const TByte* data,size_t length){
1475
- for (size_t i=0; i<length; ++i) {
1476
- if (data[i]==0)
1477
- continue;
1478
- else
1479
- return false;
1480
- }
1481
- return true;
1482
- }
1483
-
1484
- static void _getSubDiff(std::vector<TByte>& subDiff,const TDiffData& diff,const TOldCover& cover){
1485
- subDiff.resize(cover.length);
1486
- const TByte* pnew=diff.newData+cover.newPos;
1487
- const TByte* pold=diff.oldData+cover.oldPos;
1488
- for (size_t i=0;i<subDiff.size();++i)
1489
- subDiff[i]=pnew[i]-pold[i];
1490
- }
1491
-
1492
- struct TInlpacePatchSets{
1493
- bool isInplacePatchByExtra;
1494
- hpi_size_t extraSafeSize;
1495
- };
1496
-
1497
- static void serialize_lite_diff(const TDiffData& diff,const std::vector<TOldCover>& covers,
1498
- std::vector<TByte>& out_diff,const hdiffi_TCompress* compressPlugin,
1499
- const TInlpacePatchSets& inlpacePatchSets){
1500
- const TUInt coverCount=(TUInt)covers.size();
1501
- const bool isInplacePatch= inlpacePatchSets.isInplacePatchByExtra;
1502
- std::vector<TByte> subDiff;
1503
- std::vector<TByte> buf;
1504
- hpi_packUInt(buf,coverCount);
1505
- const TUInt newSize=(TUInt)(diff.newData_end-diff.newData);
1506
- {
1507
- TUInt lastOldEnd=0;
1508
- TUInt lastNewEnd=0;
1509
- for (TUInt i=0; i<coverCount; ++i) {
1510
- const TOldCover& cover=covers[i];
1511
- hpi_packUInt(buf, cover.length);
1512
- _getSubDiff(subDiff,diff,cover);
1513
- const TByte isNullSubDiff=_getIs0(subDiff.data(),cover.length)?1:0;
1514
- if ((TUInt)cover.oldPos>=lastOldEnd){ //save inc_oldPos
1515
- hpi_packUIntWithTag(buf,(TUInt)(cover.oldPos-lastOldEnd), 0+isNullSubDiff*2,2);
1516
- }else{
1517
- hpi_packUIntWithTag(buf,(TUInt)(lastOldEnd-cover.oldPos), 1+isNullSubDiff*2,2);
1518
- }
1519
- TUInt backNewLen=cover.newPos-lastNewEnd;
1520
- assert(backNewLen>=0);
1521
- hpi_packUInt(buf,(TUInt)backNewLen); //save inc_newPos
1522
-
1523
- if (backNewLen>0){
1524
- const TByte* newDataDiff=diff.newData+lastNewEnd;
1525
- pushBack(buf,newDataDiff,newDataDiff+backNewLen);
1526
- }
1527
- if (!isNullSubDiff){
1528
- pushBack(buf,subDiff.data(),subDiff.data()+cover.length);
1529
- }
1530
-
1531
- lastOldEnd=cover.oldPos+cover.length;
1532
- lastNewEnd=cover.newPos+cover.length;
1533
- }
1534
-
1535
- TUInt backNewLen=(newSize-lastNewEnd);
1536
- check(backNewLen==0);
1537
- }
1538
-
1539
- std::vector<TByte> compress_buf;
1540
- do_compress(compress_buf,buf,compressPlugin->compress);
1541
- out_diff.push_back(kHPatchLite_versionType[0]);
1542
- out_diff.push_back(kHPatchLite_versionType[1]);
1543
- out_diff.push_back(compress_buf.empty()?hpi_compressType_no:compressPlugin->compress_type);
1544
- TUInt savedUncompressSize=compress_buf.empty()?0:buf.size();
1545
- const TByte savedVersionCode=isInplacePatch?kHPatchLite_inplaceCode:kHPatchLite_versionCode;
1546
- out_diff.push_back((savedVersionCode<<6)|
1547
- (hpi_getSavedSizeBytes(newSize))|
1548
- (hpi_getSavedSizeBytes(savedUncompressSize)<<3));
1549
- if (isInplacePatch)
1550
- out_diff.push_back(hpi_getSavedSizeBytes(inlpacePatchSets.extraSafeSize));
1551
- hpi_saveSize(out_diff,newSize);
1552
- hpi_saveSize(out_diff,savedUncompressSize);
1553
- if (isInplacePatch)
1554
- hpi_saveSize(out_diff,inlpacePatchSets.extraSafeSize);
1555
- pushBack(out_diff,compress_buf.empty()?buf:compress_buf);
1556
- }
1557
-
1558
- } //end namespace
1559
-
1560
- void create_lite_diff(const unsigned char* newData,const unsigned char* newData_end,
1561
- const unsigned char* oldData,const unsigned char* oldData_end,
1562
- std::vector<hpi_byte>& out_lite_diff,const hdiffi_TCompress* compressPlugin,
1563
- int kMinSingleMatchScore,bool isUseBigCacheMatch,
1564
- ILiteDiffListener* listener,size_t threadNum){
1565
- static const int _kMatchScore_optim4bin=6;
1566
- TDiffData diff(newData,newData_end,oldData,oldData_end);
1567
- std::vector<TOldCover> covers;
1568
- get_diff(diff,covers,kMinSingleMatchScore-_kMatchScore_optim4bin,isUseBigCacheMatch,listener,0,threadNum);
1569
- size_t oldPosEnd=0;
1570
- size_t newPosEnd=0;
1571
- if (!covers.empty()){
1572
- const TOldCover& c=covers.back();
1573
- oldPosEnd=c.oldPos+c.length;
1574
- newPosEnd=c.newPos+c.length;
1575
- }
1576
- const size_t newSize=newData_end-newData;
1577
- if (newPosEnd<newSize)
1578
- covers.push_back(TOldCover(oldPosEnd,newSize,0));
1579
-
1580
- TInlpacePatchSets inlpacePatchSets={};
1581
- if (listener&&listener->getInplacePatchExtraSafeSize){
1582
- if (listener->getInplacePatchExtraSafeSize(listener,&inlpacePatchSets.extraSafeSize))
1583
- inlpacePatchSets.isInplacePatchByExtra=true;
1584
- }
1585
- serialize_lite_diff(diff,covers,out_lite_diff,compressPlugin,inlpacePatchSets);
1586
- }
1587
-
1588
- namespace{
1589
- struct TPatchiListener:public hpatchi_listener_t{
1590
- hpatch_decompressHandle decompresser;
1591
- hpatch_TDecompress* decompressPlugin;
1592
- inline TPatchiListener():decompresser(0),newData_cur_pos(0){}
1593
- inline ~TPatchiListener(){ if (decompresser) decompressPlugin->close(decompressPlugin,decompresser); }
1594
- const hpi_byte* diffData_cur;
1595
- const hpi_byte* diffData_end;
1596
- hpatch_TStreamInput diffStream;
1597
- hpi_pos_t uncompressSize;
1598
- const hpi_byte* newData_cur;
1599
- const hpi_byte* newData_end;
1600
- const hpi_byte* oldData;
1601
- const hpi_byte* oldData_end;
1602
- bool isInplacePatch;
1603
- hpi_size_t extraSafeSize;//for inplace-patch
1604
- hpatch_size_t newData_cur_pos;//for inplace-patch
1605
-
1606
- static hpi_BOOL _read_diff(hpi_TInputStreamHandle inputStream,hpi_byte* out_data,hpi_size_t* data_size){
1607
- TPatchiListener& self=*(TPatchiListener*)inputStream;
1608
- const hpi_byte* cur=self.diffData_cur;
1609
- size_t d_size=self.diffData_end-cur;
1610
- size_t r_size=*data_size;
1611
- if (r_size>d_size){
1612
- r_size=d_size;
1613
- *data_size=(hpi_size_t)r_size;
1614
- }
1615
- memcpy(out_data,cur,r_size);
1616
- self.diffData_cur=cur+r_size;
1617
- return hpi_TRUE;
1618
- }
1619
- static hpi_BOOL _read_diff_dec(hpi_TInputStreamHandle inputStream,hpi_byte* out_data,hpi_size_t* data_size){
1620
- TPatchiListener& self=*(TPatchiListener*)inputStream;
1621
- hpi_size_t r_size=*data_size;
1622
- if (r_size>self.uncompressSize){
1623
- r_size=(hpi_size_t)self.uncompressSize;
1624
- *data_size=(hpi_size_t)self.uncompressSize;
1625
- }
1626
- if (!self.decompressPlugin->decompress_part(self.decompresser,out_data,out_data+r_size))
1627
- return hpi_FALSE;
1628
- self.uncompressSize-=r_size;
1629
- return hpi_TRUE;
1630
- }
1631
- static hpi_BOOL _write_new(struct hpatchi_listener_t* listener,const hpi_byte* data,hpi_size_t data_size){
1632
- TPatchiListener& self=*(TPatchiListener*)listener;
1633
- if (data_size>(size_t)(self.newData_end-self.newData_cur))
1634
- return hpi_FALSE;
1635
- if (0!=memcmp(self.newData_cur,data,data_size))
1636
- return hpi_FALSE;
1637
- self.newData_cur+=data_size;
1638
- self.newData_cur_pos+=data_size;
1639
- return hpi_TRUE;
1640
- }
1641
- static hpi_BOOL _read_old(struct hpatchi_listener_t* listener,hpi_pos_t read_from_pos,hpi_byte* out_data,hpi_size_t data_size){
1642
- TPatchiListener& self=*(TPatchiListener*)listener;
1643
- size_t dsize=self.oldData_end-self.oldData;
1644
- if ((read_from_pos>dsize)|(data_size>(size_t)(dsize-read_from_pos))) return hpi_FALSE;
1645
- memcpy(out_data,self.oldData+(size_t)read_from_pos,data_size);
1646
- if (self.isInplacePatch){
1647
- if (read_from_pos<self.newData_cur_pos)
1648
- return hpi_FALSE;
1649
- }
1650
- return hpi_TRUE;
1651
- }
1652
- };
1653
- }// end namespace
1654
-
1655
- static
1656
- bool _try_open_hpatchi_and_inplace(TPatchiListener& listener,hpi_compressType* out_compress_type,
1657
- hpi_pos_t* out_newSize,hpi_pos_t* out_uncompressSize){
1658
- listener.isInplacePatch=false;
1659
- listener.extraSafeSize=0;
1660
- const hpi_byte* diffData_cur_bck=listener.diffData_cur;
1661
- if (hpatch_lite_open(&listener,listener._read_diff,out_compress_type,out_newSize,out_uncompressSize))
1662
- return true;
1663
- listener.diffData_cur=diffData_cur_bck;//reread diffData from 0 pos
1664
- if (hpatchi_inplace_open(&listener,listener._read_diff,out_compress_type,out_newSize,out_uncompressSize,&listener.extraSafeSize)){
1665
- listener.isInplacePatch=true;
1666
- return true;
1667
- }
1668
- return false;
1669
- }
1670
-
1671
- bool check_lite_diff_open(const hpi_byte* lite_diff,const hpi_byte* lite_diff_end,
1672
- hpi_compressType* out_compress_type){
1673
- TPatchiListener listener;
1674
- listener.diffData_cur=lite_diff;
1675
- listener.diffData_end=lite_diff_end;
1676
- hpi_pos_t saved_newSize;
1677
- hpi_pos_t saved_uncompressSize;
1678
- if (!_try_open_hpatchi_and_inplace(listener,out_compress_type,
1679
- &saved_newSize,&saved_uncompressSize)) return false;
1680
- return true;
1681
- }
1682
-
1683
- bool check_lite_diff(const hpi_byte* newData,const hpi_byte* newData_end,
1684
- const hpi_byte* oldData,const hpi_byte* oldData_end,
1685
- const hpi_byte* lite_diff,const hpi_byte* lite_diff_end,
1686
- hpatch_TDecompress* decompressPlugin){
1687
- TPatchiListener listener;
1688
- listener.diffData_cur=lite_diff;
1689
- listener.diffData_end=lite_diff_end;
1690
- hpi_compressType _compress_type;
1691
- hpi_pos_t saved_newSize;
1692
- hpi_pos_t saved_uncompressSize;
1693
- if (!_try_open_hpatchi_and_inplace(listener,&_compress_type,
1694
- &saved_newSize,&saved_uncompressSize)) return false;
1695
- if (saved_newSize!=(size_t)(newData_end-newData)) return false;
1696
- listener.diff_data=&listener;
1697
- listener.decompressPlugin=(_compress_type!=hpi_compressType_no)?decompressPlugin:0;
1698
- if (listener.decompressPlugin){
1699
- listener.uncompressSize=saved_uncompressSize;
1700
- mem_as_hStreamInput(&listener.diffStream,listener.diffData_cur,lite_diff_end);
1701
- listener.decompresser=decompressPlugin->open(decompressPlugin,saved_uncompressSize,&listener.diffStream,
1702
- 0,(size_t)(lite_diff_end-listener.diffData_cur));
1703
- if (listener.decompresser==0) return false;
1704
- listener.read_diff=listener._read_diff_dec;
1705
- }else{
1706
- listener.read_diff=listener._read_diff;
1707
- }
1708
- listener.newData_cur=newData;
1709
- listener.newData_end=newData_end;
1710
- listener.write_new=listener._write_new;
1711
- listener.oldData=oldData;
1712
- listener.oldData_end=oldData_end;
1713
- listener.read_old=listener._read_old;
1714
-
1715
- const size_t kACacheBufSize=hpatch_kFileIOBufBetterSize;
1716
- hdiff_private::TAutoMem _cache(kACacheBufSize+listener.extraSafeSize);
1717
-
1718
- if (listener.isInplacePatch){
1719
- if (!hpatchi_inplaceB(&listener,saved_newSize,_cache.data(),listener.extraSafeSize,(hpi_size_t)_cache.size()))
1720
- return false;
1721
- }else if (!hpatch_lite_patch(&listener,saved_newSize,_cache.data(),(hpi_size_t)_cache.size())){
1722
- return false;
1723
- }
1724
- return listener.newData_cur==listener.newData_end;
1725
- }
1726
-
1727
-
1728
- hpatch_BOOL hdiff_streamDataIsEqual(const hpatch_TStreamInput* x,const hpatch_TStreamInput* y){
1729
- const hpatch_StreamPos_t ssize=x->streamSize;
1730
- if (ssize!=y->streamSize) return hpatch_FALSE;
1731
- const size_t kACacheBufSize=hdiff_kFileIOBufBestSize;
1732
- hdiff_private::TAutoMem _cache(kACacheBufSize*2);
1733
- hpatch_byte* bufx=_cache.data();
1734
- hpatch_byte* bufy=bufx+kACacheBufSize;
1735
- for (hpatch_StreamPos_t i=0; i<ssize; ){
1736
- const hpatch_StreamPos_t maxdSize=ssize-i;
1737
- size_t dataSize=(size_t)(kACacheBufSize<=maxdSize?kACacheBufSize:maxdSize);
1738
- check(x->read(x,i,bufx,bufx+dataSize));
1739
- check(y->read(y,i,bufy,bufy+dataSize));
1740
- if (0!=memcmp(bufx,bufy,dataSize))
1741
- return hpatch_FALSE;
1742
- i+=dataSize;
1743
- }
1744
- return hpatch_TRUE;
1745
- }
1746
-