react-native-update 10.28.10 → 10.29.0-beta.0

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 (782) hide show
  1. package/android/.project +28 -0
  2. package/android/bin/.project +34 -0
  3. package/android/bin/.settings/org.eclipse.buildship.core.prefs +13 -0
  4. package/harmony/pushy.har +0 -0
  5. package/package.json +3 -2
  6. package/src/client.ts +37 -48
  7. package/src/provider.tsx +1 -1
  8. package/src/utils.ts +19 -12
  9. package/harmony/src/main/cpp/HDiffPatch/CHANGELOG.md +0 -153
  10. package/harmony/src/main/cpp/HDiffPatch/LICENSE +0 -48
  11. package/harmony/src/main/cpp/HDiffPatch/Makefile +0 -157
  12. package/harmony/src/main/cpp/HDiffPatch/README.md +0 -307
  13. package/harmony/src/main/cpp/HDiffPatch/_atosize.h +0 -83
  14. package/harmony/src/main/cpp/HDiffPatch/_clock_for_demo.h +0 -47
  15. package/harmony/src/main/cpp/HDiffPatch/_dir_ignore.h +0 -191
  16. package/harmony/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/Android.mk +0 -37
  17. package/harmony/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/Application.mk +0 -7
  18. package/harmony/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/build_libs.bat +0 -1
  19. package/harmony/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/build_libs.sh +0 -1
  20. package/harmony/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/hpatch.c +0 -18
  21. package/harmony/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/hpatch.h +0 -20
  22. package/harmony/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/hpatch_jni.c +0 -28
  23. package/harmony/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/java/com/github/sisong/HPatch.java +0 -8
  24. package/harmony/src/main/cpp/HDiffPatch/builds/codeblocks/HDiffPatch.workspace +0 -8
  25. package/harmony/src/main/cpp/HDiffPatch/builds/codeblocks/HDiffZ.cbp +0 -219
  26. package/harmony/src/main/cpp/HDiffPatch/builds/codeblocks/HPatchZ.cbp +0 -156
  27. package/harmony/src/main/cpp/HDiffPatch/builds/codeblocks/unitTest.cbp +0 -65
  28. package/harmony/src/main/cpp/HDiffPatch/builds/vc/HDiffPatch.sln +0 -105
  29. package/harmony/src/main/cpp/HDiffPatch/builds/vc/HDiffZ.vcxproj +0 -237
  30. package/harmony/src/main/cpp/HDiffPatch/builds/vc/HDiffZ.vcxproj.user +0 -3
  31. package/harmony/src/main/cpp/HDiffPatch/builds/vc/HPatchZ.vcxproj +0 -318
  32. package/harmony/src/main/cpp/HDiffPatch/builds/vc/HPatchZ.vcxproj.user +0 -3
  33. package/harmony/src/main/cpp/HDiffPatch/builds/vc/unitTest.vcxproj +0 -182
  34. package/harmony/src/main/cpp/HDiffPatch/builds/vc/unitTest.vcxproj.user +0 -3
  35. package/harmony/src/main/cpp/HDiffPatch/builds/xcode/HDiffPatch.xcworkspace/contents.xcworkspacedata +0 -30
  36. package/harmony/src/main/cpp/HDiffPatch/builds/xcode/HDiffPatch.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  37. package/harmony/src/main/cpp/HDiffPatch/builds/xcode/bestParams.xcodeproj/project.pbxproj +0 -408
  38. package/harmony/src/main/cpp/HDiffPatch/builds/xcode/hdiffz.xcodeproj/project.pbxproj +0 -573
  39. package/harmony/src/main/cpp/HDiffPatch/builds/xcode/hpatchz.xcodeproj/project.pbxproj +0 -396
  40. package/harmony/src/main/cpp/HDiffPatch/builds/xcode/lz4.xcodeproj/project.pbxproj +0 -268
  41. package/harmony/src/main/cpp/HDiffPatch/builds/xcode/lzma.xcodeproj/project.pbxproj +0 -361
  42. package/harmony/src/main/cpp/HDiffPatch/builds/xcode/testHashClash.xcodeproj/project.pbxproj +0 -301
  43. package/harmony/src/main/cpp/HDiffPatch/builds/xcode/unitTest.xcodeproj/project.pbxproj +0 -411
  44. package/harmony/src/main/cpp/HDiffPatch/builds/xcode/zstd.xcodeproj/project.pbxproj +0 -504
  45. package/harmony/src/main/cpp/HDiffPatch/checksum_plugin_demo.h +0 -344
  46. package/harmony/src/main/cpp/HDiffPatch/compress_parallel.cpp +0 -166
  47. package/harmony/src/main/cpp/HDiffPatch/compress_parallel.h +0 -59
  48. package/harmony/src/main/cpp/HDiffPatch/compress_plugin_demo.h +0 -1152
  49. package/harmony/src/main/cpp/HDiffPatch/decompress_plugin_demo.h +0 -995
  50. package/harmony/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_diff.cpp +0 -797
  51. package/harmony/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_diff.h +0 -65
  52. package/harmony/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_diff_tools.cpp +0 -200
  53. package/harmony/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_diff_tools.h +0 -178
  54. package/harmony/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_manifest.cpp +0 -357
  55. package/harmony/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_manifest.h +0 -87
  56. package/harmony/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/file_for_dirDiff.h +0 -151
  57. package/harmony/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch.c +0 -770
  58. package/harmony/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch.h +0 -236
  59. package/harmony/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch_private.h +0 -47
  60. package/harmony/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch_tools.c +0 -112
  61. package/harmony/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch_tools.h +0 -53
  62. package/harmony/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch_types.h +0 -61
  63. package/harmony/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/new_dir_output.c +0 -331
  64. package/harmony/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/new_dir_output.h +0 -144
  65. package/harmony/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/new_stream.c +0 -176
  66. package/harmony/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/new_stream.h +0 -84
  67. package/harmony/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/ref_stream.c +0 -146
  68. package/harmony/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/ref_stream.h +0 -61
  69. package/harmony/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/res_handle_limit.c +0 -152
  70. package/harmony/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/res_handle_limit.h +0 -76
  71. package/harmony/src/main/cpp/HDiffPatch/file_for_patch.c +0 -524
  72. package/harmony/src/main/cpp/HDiffPatch/file_for_patch.h +0 -259
  73. package/harmony/src/main/cpp/HDiffPatch/hdiffz.cpp +0 -1570
  74. package/harmony/src/main/cpp/HDiffPatch/hpatch_dir_listener.h +0 -290
  75. package/harmony/src/main/cpp/HDiffPatch/hpatchz.c +0 -1221
  76. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/diff.cpp +0 -1025
  77. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/diff.h +0 -116
  78. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/diff_types.h +0 -72
  79. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/bytes_rle.cpp +0 -213
  80. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/bytes_rle.h +0 -63
  81. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/compress_detect.cpp +0 -170
  82. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/compress_detect.h +0 -86
  83. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/config.h +0 -89
  84. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.c +0 -13
  85. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.c.inc.h +0 -398
  86. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.h +0 -194
  87. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort64.c +0 -13
  88. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort64.h +0 -204
  89. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort_private.h +0 -207
  90. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/sssort.c.inc.h +0 -815
  91. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/trsort.c.inc.h +0 -586
  92. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/utils.c.inc.h +0 -381
  93. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/adler_roll.c +0 -352
  94. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/adler_roll.h +0 -137
  95. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/bloom_filter.h +0 -137
  96. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/covers.h +0 -70
  97. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/digest_matcher.cpp +0 -628
  98. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/digest_matcher.h +0 -87
  99. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp +0 -363
  100. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.h +0 -139
  101. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/mem_buf.h +0 -68
  102. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/pack_uint.h +0 -115
  103. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/suffix_string.cpp +0 -342
  104. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/suffix_string.h +0 -94
  105. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/checksum_plugin.h +0 -52
  106. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/patch.c +0 -2292
  107. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/patch.h +0 -215
  108. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/patch_private.h +0 -165
  109. package/harmony/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/patch_types.h +0 -251
  110. package/harmony/src/main/cpp/HDiffPatch/libParallel/parallel_channel.cpp +0 -174
  111. package/harmony/src/main/cpp/HDiffPatch/libParallel/parallel_channel.h +0 -73
  112. package/harmony/src/main/cpp/HDiffPatch/libParallel/parallel_import.cpp +0 -367
  113. package/harmony/src/main/cpp/HDiffPatch/libParallel/parallel_import.h +0 -92
  114. package/harmony/src/main/cpp/HDiffPatch/test/_private_searchBestParams.cpp +0 -301
  115. package/harmony/src/main/cpp/HDiffPatch/test/hpatchz_test.cpp +0 -292
  116. package/harmony/src/main/cpp/HDiffPatch/test/testHashClash.cpp +0 -436
  117. package/harmony/src/main/cpp/HDiffPatch/test/unit_test.cpp +0 -417
  118. package/harmony/src/main/cpp/lzma/Asm/arm/7zCrcOpt.asm +0 -100
  119. package/harmony/src/main/cpp/lzma/Asm/x86/7zAsm.asm +0 -147
  120. package/harmony/src/main/cpp/lzma/Asm/x86/7zCrcOpt.asm +0 -147
  121. package/harmony/src/main/cpp/lzma/Asm/x86/AesOpt.asm +0 -237
  122. package/harmony/src/main/cpp/lzma/Asm/x86/LzmaDecOpt.asm +0 -1258
  123. package/harmony/src/main/cpp/lzma/Asm/x86/XzCrc64Opt.asm +0 -205
  124. package/harmony/src/main/cpp/lzma/C/7z.h +0 -202
  125. package/harmony/src/main/cpp/lzma/C/7zAlloc.c +0 -80
  126. package/harmony/src/main/cpp/lzma/C/7zAlloc.h +0 -19
  127. package/harmony/src/main/cpp/lzma/C/7zArcIn.c +0 -1771
  128. package/harmony/src/main/cpp/lzma/C/7zBuf.c +0 -36
  129. package/harmony/src/main/cpp/lzma/C/7zBuf.h +0 -35
  130. package/harmony/src/main/cpp/lzma/C/7zBuf2.c +0 -52
  131. package/harmony/src/main/cpp/lzma/C/7zCrc.c +0 -128
  132. package/harmony/src/main/cpp/lzma/C/7zCrc.h +0 -25
  133. package/harmony/src/main/cpp/lzma/C/7zCrcOpt.c +0 -115
  134. package/harmony/src/main/cpp/lzma/C/7zDec.c +0 -591
  135. package/harmony/src/main/cpp/lzma/C/7zFile.c +0 -286
  136. package/harmony/src/main/cpp/lzma/C/7zFile.h +0 -83
  137. package/harmony/src/main/cpp/lzma/C/7zStream.c +0 -176
  138. package/harmony/src/main/cpp/lzma/C/7zTypes.h +0 -375
  139. package/harmony/src/main/cpp/lzma/C/7zVersion.h +0 -27
  140. package/harmony/src/main/cpp/lzma/C/7zVersion.rc +0 -55
  141. package/harmony/src/main/cpp/lzma/C/Aes.c +0 -306
  142. package/harmony/src/main/cpp/lzma/C/Aes.h +0 -38
  143. package/harmony/src/main/cpp/lzma/C/AesOpt.c +0 -184
  144. package/harmony/src/main/cpp/lzma/C/Alloc.c +0 -455
  145. package/harmony/src/main/cpp/lzma/C/Alloc.h +0 -51
  146. package/harmony/src/main/cpp/lzma/C/Bcj2.c +0 -257
  147. package/harmony/src/main/cpp/lzma/C/Bcj2.h +0 -146
  148. package/harmony/src/main/cpp/lzma/C/Bcj2Enc.c +0 -311
  149. package/harmony/src/main/cpp/lzma/C/Bra.c +0 -230
  150. package/harmony/src/main/cpp/lzma/C/Bra.h +0 -64
  151. package/harmony/src/main/cpp/lzma/C/Bra86.c +0 -82
  152. package/harmony/src/main/cpp/lzma/C/BraIA64.c +0 -53
  153. package/harmony/src/main/cpp/lzma/C/Compiler.h +0 -33
  154. package/harmony/src/main/cpp/lzma/C/CpuArch.c +0 -218
  155. package/harmony/src/main/cpp/lzma/C/CpuArch.h +0 -336
  156. package/harmony/src/main/cpp/lzma/C/Delta.c +0 -64
  157. package/harmony/src/main/cpp/lzma/C/Delta.h +0 -19
  158. package/harmony/src/main/cpp/lzma/C/DllSecur.c +0 -108
  159. package/harmony/src/main/cpp/lzma/C/DllSecur.h +0 -20
  160. package/harmony/src/main/cpp/lzma/C/LzFind.c +0 -1127
  161. package/harmony/src/main/cpp/lzma/C/LzFind.h +0 -121
  162. package/harmony/src/main/cpp/lzma/C/LzFindMt.c +0 -853
  163. package/harmony/src/main/cpp/lzma/C/LzFindMt.h +0 -101
  164. package/harmony/src/main/cpp/lzma/C/LzHash.h +0 -57
  165. package/harmony/src/main/cpp/lzma/C/Lzma2Dec.c +0 -488
  166. package/harmony/src/main/cpp/lzma/C/Lzma2Dec.h +0 -120
  167. package/harmony/src/main/cpp/lzma/C/Lzma2DecMt.c +0 -1082
  168. package/harmony/src/main/cpp/lzma/C/Lzma2DecMt.h +0 -79
  169. package/harmony/src/main/cpp/lzma/C/Lzma2Enc.c +0 -803
  170. package/harmony/src/main/cpp/lzma/C/Lzma2Enc.h +0 -55
  171. package/harmony/src/main/cpp/lzma/C/Lzma86.h +0 -111
  172. package/harmony/src/main/cpp/lzma/C/Lzma86Dec.c +0 -54
  173. package/harmony/src/main/cpp/lzma/C/Lzma86Enc.c +0 -106
  174. package/harmony/src/main/cpp/lzma/C/LzmaDec.c +0 -1185
  175. package/harmony/src/main/cpp/lzma/C/LzmaDec.h +0 -234
  176. package/harmony/src/main/cpp/lzma/C/LzmaEnc.c +0 -2976
  177. package/harmony/src/main/cpp/lzma/C/LzmaEnc.h +0 -76
  178. package/harmony/src/main/cpp/lzma/C/LzmaLib.c +0 -40
  179. package/harmony/src/main/cpp/lzma/C/LzmaLib.h +0 -131
  180. package/harmony/src/main/cpp/lzma/C/MtCoder.c +0 -601
  181. package/harmony/src/main/cpp/lzma/C/MtCoder.h +0 -141
  182. package/harmony/src/main/cpp/lzma/C/MtDec.c +0 -1138
  183. package/harmony/src/main/cpp/lzma/C/MtDec.h +0 -201
  184. package/harmony/src/main/cpp/lzma/C/Ppmd.h +0 -85
  185. package/harmony/src/main/cpp/lzma/C/Ppmd7.c +0 -712
  186. package/harmony/src/main/cpp/lzma/C/Ppmd7.h +0 -142
  187. package/harmony/src/main/cpp/lzma/C/Ppmd7Dec.c +0 -191
  188. package/harmony/src/main/cpp/lzma/C/Ppmd7Enc.c +0 -187
  189. package/harmony/src/main/cpp/lzma/C/Precomp.h +0 -10
  190. package/harmony/src/main/cpp/lzma/C/RotateDefs.h +0 -30
  191. package/harmony/src/main/cpp/lzma/C/Sha256.c +0 -248
  192. package/harmony/src/main/cpp/lzma/C/Sha256.h +0 -26
  193. package/harmony/src/main/cpp/lzma/C/Sort.c +0 -141
  194. package/harmony/src/main/cpp/lzma/C/Sort.h +0 -18
  195. package/harmony/src/main/cpp/lzma/C/Threads.c +0 -95
  196. package/harmony/src/main/cpp/lzma/C/Threads.h +0 -70
  197. package/harmony/src/main/cpp/lzma/C/ThreadsP.c +0 -396
  198. package/harmony/src/main/cpp/lzma/C/ThreadsP.h +0 -31
  199. package/harmony/src/main/cpp/lzma/C/Util/7z/7z.dsp +0 -241
  200. package/harmony/src/main/cpp/lzma/C/Util/7z/7z.dsw +0 -29
  201. package/harmony/src/main/cpp/lzma/C/Util/7z/7zMain.c +0 -686
  202. package/harmony/src/main/cpp/lzma/C/Util/7z/Precomp.c +0 -4
  203. package/harmony/src/main/cpp/lzma/C/Util/7z/Precomp.h +0 -10
  204. package/harmony/src/main/cpp/lzma/C/Util/7z/makefile +0 -40
  205. package/harmony/src/main/cpp/lzma/C/Util/7z/makefile.gcc +0 -75
  206. package/harmony/src/main/cpp/lzma/C/Util/Lzma/LzmaUtil.c +0 -258
  207. package/harmony/src/main/cpp/lzma/C/Util/Lzma/LzmaUtil.dsp +0 -168
  208. package/harmony/src/main/cpp/lzma/C/Util/Lzma/LzmaUtil.dsw +0 -29
  209. package/harmony/src/main/cpp/lzma/C/Util/Lzma/makefile +0 -28
  210. package/harmony/src/main/cpp/lzma/C/Util/Lzma/makefile.gcc +0 -44
  211. package/harmony/src/main/cpp/lzma/C/Util/LzmaLib/LzmaLib.def +0 -4
  212. package/harmony/src/main/cpp/lzma/C/Util/LzmaLib/LzmaLib.dsp +0 -178
  213. package/harmony/src/main/cpp/lzma/C/Util/LzmaLib/LzmaLib.dsw +0 -29
  214. package/harmony/src/main/cpp/lzma/C/Util/LzmaLib/LzmaLibExports.c +0 -14
  215. package/harmony/src/main/cpp/lzma/C/Util/LzmaLib/makefile +0 -34
  216. package/harmony/src/main/cpp/lzma/C/Util/LzmaLib/resource.rc +0 -3
  217. package/harmony/src/main/cpp/lzma/C/Util/SfxSetup/Precomp.c +0 -4
  218. package/harmony/src/main/cpp/lzma/C/Util/SfxSetup/Precomp.h +0 -10
  219. package/harmony/src/main/cpp/lzma/C/Util/SfxSetup/SfxSetup.c +0 -640
  220. package/harmony/src/main/cpp/lzma/C/Util/SfxSetup/SfxSetup.dsp +0 -231
  221. package/harmony/src/main/cpp/lzma/C/Util/SfxSetup/SfxSetup.dsw +0 -29
  222. package/harmony/src/main/cpp/lzma/C/Util/SfxSetup/makefile +0 -37
  223. package/harmony/src/main/cpp/lzma/C/Util/SfxSetup/makefile_con +0 -38
  224. package/harmony/src/main/cpp/lzma/C/Util/SfxSetup/resource.rc +0 -5
  225. package/harmony/src/main/cpp/lzma/C/Util/SfxSetup/setup.ico +0 -0
  226. package/harmony/src/main/cpp/lzma/C/Xz.c +0 -90
  227. package/harmony/src/main/cpp/lzma/C/Xz.h +0 -460
  228. package/harmony/src/main/cpp/lzma/C/XzCrc64.c +0 -86
  229. package/harmony/src/main/cpp/lzma/C/XzCrc64.h +0 -26
  230. package/harmony/src/main/cpp/lzma/C/XzCrc64Opt.c +0 -69
  231. package/harmony/src/main/cpp/lzma/C/XzDec.c +0 -2766
  232. package/harmony/src/main/cpp/lzma/C/XzEnc.c +0 -1329
  233. package/harmony/src/main/cpp/lzma/C/XzEnc.h +0 -60
  234. package/harmony/src/main/cpp/lzma/C/XzIn.c +0 -319
  235. package/harmony/src/main/cpp/lzma/CPP/7zip/7zip.mak +0 -240
  236. package/harmony/src/main/cpp/lzma/CPP/7zip/Aes.mak +0 -7
  237. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zCompressionMode.cpp +0 -3
  238. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zCompressionMode.h +0 -76
  239. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zDecode.cpp +0 -569
  240. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zDecode.h +0 -70
  241. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zEncode.cpp +0 -678
  242. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zEncode.h +0 -92
  243. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zExtract.cpp +0 -423
  244. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zFolderInStream.cpp +0 -139
  245. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zFolderInStream.h +0 -61
  246. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zHandler.cpp +0 -763
  247. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zHandler.h +0 -181
  248. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zHandlerOut.cpp +0 -942
  249. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zHeader.cpp +0 -19
  250. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zHeader.h +0 -148
  251. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zIn.cpp +0 -1666
  252. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zIn.h +0 -445
  253. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zItem.h +0 -202
  254. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zOut.cpp +0 -901
  255. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zOut.h +0 -335
  256. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zProperties.cpp +0 -174
  257. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zProperties.h +0 -22
  258. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zRegister.cpp +0 -21
  259. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zSpecStream.cpp +0 -22
  260. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zSpecStream.h +0 -35
  261. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zUpdate.cpp +0 -2500
  262. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zUpdate.h +0 -139
  263. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/StdAfx.cpp +0 -3
  264. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/7z/StdAfx.h +0 -8
  265. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/Archive.def +0 -12
  266. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/Archive2.def +0 -19
  267. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/ArchiveExports.cpp +0 -151
  268. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/Common/CoderMixer2.cpp +0 -1125
  269. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/Common/CoderMixer2.h +0 -447
  270. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/Common/DummyOutStream.cpp +0 -17
  271. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/Common/DummyOutStream.h +0 -25
  272. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/Common/HandlerOut.cpp +0 -232
  273. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/Common/HandlerOut.h +0 -110
  274. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/Common/InStreamWithCRC.cpp +0 -46
  275. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/Common/InStreamWithCRC.h +0 -67
  276. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/Common/ItemNameUtils.cpp +0 -88
  277. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/Common/ItemNameUtils.h +0 -28
  278. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/Common/MultiStream.cpp +0 -191
  279. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/Common/MultiStream.h +0 -89
  280. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp +0 -18
  281. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/Common/OutStreamWithCRC.h +0 -37
  282. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/Common/ParseProperties.cpp +0 -3
  283. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/Common/ParseProperties.h +0 -6
  284. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/Common/StdAfx.h +0 -8
  285. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/DllExports2.cpp +0 -122
  286. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/IArchive.h +0 -608
  287. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/Icons/7z.ico +0 -0
  288. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/LzmaHandler.cpp +0 -629
  289. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/SplitHandler.cpp +0 -359
  290. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/StdAfx.h +0 -8
  291. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/XzHandler.cpp +0 -1308
  292. package/harmony/src/main/cpp/lzma/CPP/7zip/Archive/XzHandler.h +0 -11
  293. package/harmony/src/main/cpp/lzma/CPP/7zip/Asm.mak +0 -9
  294. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/Alone.dsp +0 -1910
  295. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/Alone.dsw +0 -29
  296. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/StdAfx.cpp +0 -3
  297. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/StdAfx.h +0 -8
  298. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/makefile +0 -154
  299. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/resource.rc +0 -7
  300. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zExtractR/StdAfx.cpp +0 -3
  301. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zExtractR/StdAfx.h +0 -8
  302. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zExtractR/makefile +0 -96
  303. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zExtractR/resource.rc +0 -5
  304. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zR/StdAfx.cpp +0 -3
  305. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zR/StdAfx.h +0 -8
  306. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zR/makefile +0 -116
  307. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zR/resource.rc +0 -5
  308. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/LzmaAlone.cpp +0 -799
  309. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/LzmaCon.dsp +0 -477
  310. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/LzmaCon.dsw +0 -29
  311. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/StdAfx.cpp +0 -3
  312. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/StdAfx.h +0 -8
  313. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/makefile +0 -59
  314. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/makefile.gcc +0 -195
  315. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/resource.rc +0 -3
  316. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaSpec/LzmaSpec.cpp +0 -715
  317. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/7z.ico +0 -0
  318. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/SFXCon.dsp +0 -912
  319. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/SFXCon.dsw +0 -29
  320. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/SfxCon.cpp +0 -482
  321. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/StdAfx.cpp +0 -3
  322. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/StdAfx.h +0 -8
  323. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/makefile +0 -134
  324. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/resource.rc +0 -5
  325. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/ExtractCallbackSfx.cpp +0 -246
  326. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/ExtractCallbackSfx.h +0 -86
  327. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp +0 -137
  328. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/ExtractEngine.h +0 -11
  329. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp +0 -803
  330. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsw +0 -29
  331. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/SfxSetup.cpp +0 -364
  332. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/StdAfx.cpp +0 -3
  333. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/StdAfx.h +0 -13
  334. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/makefile +0 -117
  335. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/resource.h +0 -6
  336. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/resource.rc +0 -16
  337. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/setup.ico +0 -0
  338. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/7z.ico +0 -0
  339. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/SFXWin.dsp +0 -988
  340. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/SFXWin.dsw +0 -29
  341. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/SfxWin.cpp +0 -241
  342. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/StdAfx.cpp +0 -3
  343. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/StdAfx.h +0 -14
  344. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/makefile +0 -153
  345. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/resource.h +0 -1
  346. package/harmony/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/resource.rc +0 -50
  347. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/CWrappers.cpp +0 -250
  348. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/CWrappers.h +0 -120
  349. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/CreateCoder.cpp +0 -536
  350. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/CreateCoder.h +0 -192
  351. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/FilePathAutoRename.cpp +0 -46
  352. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/FilePathAutoRename.h +0 -10
  353. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/FileStreams.cpp +0 -475
  354. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/FileStreams.h +0 -166
  355. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/FilterCoder.cpp +0 -435
  356. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/FilterCoder.h +0 -205
  357. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/InBuffer.cpp +0 -163
  358. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/InBuffer.h +0 -92
  359. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/InOutTempBuffer.cpp +0 -127
  360. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/InOutTempBuffer.h +0 -48
  361. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/LimitedStreams.cpp +0 -367
  362. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/LimitedStreams.h +0 -252
  363. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/LockedStream.cpp +0 -3
  364. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/LockedStream.h +0 -6
  365. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/MethodId.cpp +0 -3
  366. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/MethodId.h +0 -10
  367. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/MethodProps.cpp +0 -509
  368. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/MethodProps.h +0 -264
  369. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/OffsetStream.cpp +0 -39
  370. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/OffsetStream.h +0 -26
  371. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/OutBuffer.cpp +0 -111
  372. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/OutBuffer.h +0 -66
  373. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/ProgressUtils.cpp +0 -51
  374. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/ProgressUtils.h +0 -35
  375. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/PropId.cpp +0 -108
  376. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/RegisterArc.h +0 -78
  377. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/RegisterCodec.h +0 -106
  378. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/StdAfx.h +0 -8
  379. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/StreamBinder.cpp +0 -156
  380. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/StreamBinder.h +0 -60
  381. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/StreamObjects.cpp +0 -285
  382. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/StreamObjects.h +0 -157
  383. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/StreamUtils.cpp +0 -56
  384. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/StreamUtils.h +0 -13
  385. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/UniqBlocks.cpp +0 -57
  386. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/UniqBlocks.h +0 -26
  387. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/VirtThread.cpp +0 -48
  388. package/harmony/src/main/cpp/lzma/CPP/7zip/Common/VirtThread.h +0 -24
  389. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/Bcj2Coder.cpp +0 -666
  390. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/Bcj2Coder.h +0 -120
  391. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/Bcj2Register.cpp +0 -24
  392. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/BcjCoder.cpp +0 -24
  393. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/BcjCoder.h +0 -31
  394. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/BcjRegister.cpp +0 -17
  395. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/BranchMisc.cpp +0 -23
  396. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/BranchMisc.h +0 -35
  397. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/BranchRegister.cpp +0 -41
  398. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/ByteSwap.cpp +0 -92
  399. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/CodecExports.cpp +0 -344
  400. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/CopyCoder.cpp +0 -120
  401. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/CopyCoder.h +0 -49
  402. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/CopyRegister.cpp +0 -15
  403. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/DeltaFilter.cpp +0 -128
  404. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/Lzma2Decoder.cpp +0 -265
  405. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/Lzma2Decoder.h +0 -96
  406. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/Lzma2Encoder.cpp +0 -122
  407. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/Lzma2Encoder.h +0 -42
  408. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/Lzma2Register.cpp +0 -22
  409. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/LzmaDecoder.cpp +0 -343
  410. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/LzmaDecoder.h +0 -113
  411. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/LzmaEncoder.cpp +0 -182
  412. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/LzmaEncoder.h +0 -46
  413. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/LzmaRegister.cpp +0 -22
  414. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/PpmdDecoder.cpp +0 -170
  415. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/PpmdDecoder.h +0 -86
  416. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/PpmdEncoder.cpp +0 -152
  417. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/PpmdEncoder.h +0 -58
  418. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/PpmdRegister.cpp +0 -22
  419. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/StdAfx.h +0 -8
  420. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/XzDecoder.cpp +0 -150
  421. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/XzDecoder.h +0 -92
  422. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/XzEncoder.cpp +0 -245
  423. package/harmony/src/main/cpp/lzma/CPP/7zip/Compress/XzEncoder.h +0 -46
  424. package/harmony/src/main/cpp/lzma/CPP/7zip/Crc.mak +0 -8
  425. package/harmony/src/main/cpp/lzma/CPP/7zip/Crc64.mak +0 -8
  426. package/harmony/src/main/cpp/lzma/CPP/7zip/Crypto/7zAes.cpp +0 -280
  427. package/harmony/src/main/cpp/lzma/CPP/7zip/Crypto/7zAes.h +0 -118
  428. package/harmony/src/main/cpp/lzma/CPP/7zip/Crypto/7zAesRegister.cpp +0 -17
  429. package/harmony/src/main/cpp/lzma/CPP/7zip/Crypto/MyAes.cpp +0 -112
  430. package/harmony/src/main/cpp/lzma/CPP/7zip/Crypto/MyAes.h +0 -57
  431. package/harmony/src/main/cpp/lzma/CPP/7zip/Crypto/MyAesReg.cpp +0 -16
  432. package/harmony/src/main/cpp/lzma/CPP/7zip/Crypto/RandGen.cpp +0 -233
  433. package/harmony/src/main/cpp/lzma/CPP/7zip/Crypto/RandGen.h +0 -40
  434. package/harmony/src/main/cpp/lzma/CPP/7zip/Crypto/StdAfx.h +0 -8
  435. package/harmony/src/main/cpp/lzma/CPP/7zip/GuiCommon.rc +0 -84
  436. package/harmony/src/main/cpp/lzma/CPP/7zip/Guid.txt +0 -220
  437. package/harmony/src/main/cpp/lzma/CPP/7zip/ICoder.h +0 -399
  438. package/harmony/src/main/cpp/lzma/CPP/7zip/IDecl.h +0 -28
  439. package/harmony/src/main/cpp/lzma/CPP/7zip/IPassword.h +0 -23
  440. package/harmony/src/main/cpp/lzma/CPP/7zip/IProgress.h +0 -19
  441. package/harmony/src/main/cpp/lzma/CPP/7zip/IStream.h +0 -127
  442. package/harmony/src/main/cpp/lzma/CPP/7zip/LzmaDec.mak +0 -5
  443. package/harmony/src/main/cpp/lzma/CPP/7zip/MyVersion.h +0 -2
  444. package/harmony/src/main/cpp/lzma/CPP/7zip/MyVersionInfo.rc +0 -2
  445. package/harmony/src/main/cpp/lzma/CPP/7zip/PropID.h +0 -127
  446. package/harmony/src/main/cpp/lzma/CPP/7zip/SubBuild.mak +0 -3
  447. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Client7z/Client7z.cpp +0 -993
  448. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Client7z/Client7z.dsp +0 -235
  449. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Client7z/Client7z.dsw +0 -29
  450. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Client7z/StdAfx.cpp +0 -3
  451. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Client7z/StdAfx.h +0 -8
  452. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Client7z/makefile +0 -28
  453. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Client7z/resource.rc +0 -3
  454. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveCommandLine.cpp +0 -1295
  455. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveCommandLine.h +0 -136
  456. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp +0 -1715
  457. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveExtractCallback.h +0 -403
  458. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveName.cpp +0 -155
  459. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveName.h +0 -10
  460. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp +0 -161
  461. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveOpenCallback.h +0 -112
  462. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/Bench.cpp +0 -3618
  463. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/Bench.h +0 -77
  464. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/DefaultName.cpp +0 -37
  465. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/DefaultName.h +0 -11
  466. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/DirItem.h +0 -190
  467. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/EnumDirItems.cpp +0 -1096
  468. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/EnumDirItems.h +0 -42
  469. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/ExitCode.h +0 -27
  470. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/Extract.cpp +0 -482
  471. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/Extract.h +0 -94
  472. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/ExtractMode.h +0 -34
  473. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/ExtractingFilePath.cpp +0 -280
  474. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/ExtractingFilePath.h +0 -31
  475. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/HashCalc.cpp +0 -347
  476. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/HashCalc.h +0 -110
  477. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/IFileExtractCallback.h +0 -114
  478. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/LoadCodecs.cpp +0 -1074
  479. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/LoadCodecs.h +0 -424
  480. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/OpenArchive.cpp +0 -3553
  481. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/OpenArchive.h +0 -436
  482. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/PropIDUtils.cpp +0 -668
  483. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/PropIDUtils.h +0 -18
  484. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/Property.h +0 -14
  485. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/SetProperties.cpp +0 -80
  486. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/SetProperties.h +0 -10
  487. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/SortUtils.cpp +0 -25
  488. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/SortUtils.h +0 -10
  489. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/StdAfx.h +0 -8
  490. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/TempFiles.cpp +0 -19
  491. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/TempFiles.h +0 -16
  492. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/Update.cpp +0 -1704
  493. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/Update.h +0 -200
  494. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateAction.cpp +0 -64
  495. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateAction.h +0 -66
  496. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateCallback.cpp +0 -771
  497. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateCallback.h +0 -162
  498. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdatePair.cpp +0 -233
  499. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdatePair.h +0 -27
  500. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateProduce.cpp +0 -70
  501. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateProduce.h +0 -55
  502. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/WorkDir.cpp +0 -94
  503. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/WorkDir.h +0 -26
  504. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Common/ZipRegistry.h +0 -130
  505. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/BenchCon.cpp +0 -41
  506. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/BenchCon.h +0 -14
  507. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/Console.mak +0 -43
  508. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/Console.manifest +0 -13
  509. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/ConsoleClose.cpp +0 -69
  510. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/ConsoleClose.h +0 -33
  511. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/ExtractCallbackConsole.cpp +0 -825
  512. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/ExtractCallbackConsole.h +0 -164
  513. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/HashCon.cpp +0 -367
  514. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/HashCon.h +0 -48
  515. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/List.cpp +0 -1359
  516. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/List.h +0 -27
  517. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/Main.cpp +0 -1154
  518. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/MainAr.cpp +0 -175
  519. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/OpenCallbackConsole.cpp +0 -115
  520. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/OpenCallbackConsole.h +0 -66
  521. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/PercentPrinter.cpp +0 -183
  522. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/PercentPrinter.h +0 -62
  523. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/StdAfx.cpp +0 -3
  524. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/StdAfx.h +0 -8
  525. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp +0 -702
  526. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/UpdateCallbackConsole.h +0 -124
  527. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/UserInputUtils.cpp +0 -110
  528. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/UserInputUtils.h +0 -27
  529. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/makefile +0 -64
  530. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Console/resource.rc +0 -7
  531. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Explorer/MyMessages.cpp +0 -37
  532. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/Explorer/MyMessages.h +0 -16
  533. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/BrowseDialog.cpp +0 -1025
  534. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/BrowseDialog.h +0 -21
  535. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/BrowseDialogRes.h +0 -9
  536. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ComboDialog.cpp +0 -64
  537. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ComboDialog.h +0 -28
  538. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ComboDialogRes.h +0 -4
  539. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/DialogSize.h +0 -16
  540. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ExtractCallback.cpp +0 -1037
  541. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ExtractCallback.h +0 -328
  542. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/FormatUtils.cpp +0 -28
  543. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/FormatUtils.h +0 -14
  544. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/LangUtils.h +0 -40
  545. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/MyWindowsNew.h +0 -76
  546. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.cpp +0 -122
  547. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.h +0 -69
  548. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.rc +0 -91
  549. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/OverwriteDialogRes.h +0 -17
  550. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PasswordDialog.cpp +0 -58
  551. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PasswordDialog.h +0 -28
  552. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PasswordDialog.rc +0 -14
  553. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PasswordDialogRes.h +0 -5
  554. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog.cpp +0 -196
  555. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog.h +0 -170
  556. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog.rc +0 -12
  557. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.cpp +0 -1337
  558. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.h +0 -351
  559. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.rc +0 -40
  560. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog2Res.h +0 -48
  561. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog2a.rc +0 -80
  562. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialogRes.h +0 -3
  563. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PropertyName.cpp +0 -23
  564. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PropertyName.h +0 -10
  565. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PropertyNameRes.h +0 -95
  566. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/SysIconUtils.cpp +0 -255
  567. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/SysIconUtils.h +0 -62
  568. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/resource.h +0 -177
  569. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/FileManager/resourceGui.h +0 -15
  570. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/GUI/Extract.rc +0 -59
  571. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractDialog.cpp +0 -418
  572. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractDialog.h +0 -113
  573. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractDialog.rc +0 -98
  574. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractDialogRes.h +0 -24
  575. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractGUI.cpp +0 -280
  576. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractGUI.h +0 -38
  577. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractRes.h +0 -51
  578. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/GUI/HashGUI.h +0 -27
  579. package/harmony/src/main/cpp/lzma/CPP/7zip/UI/GUI/resource2.h +0 -2
  580. package/harmony/src/main/cpp/lzma/CPP/Build.mak +0 -156
  581. package/harmony/src/main/cpp/lzma/CPP/Common/AutoPtr.h +0 -35
  582. package/harmony/src/main/cpp/lzma/CPP/Common/CRC.cpp +0 -7
  583. package/harmony/src/main/cpp/lzma/CPP/Common/C_FileIO.cpp +0 -92
  584. package/harmony/src/main/cpp/lzma/CPP/Common/C_FileIO.h +0 -53
  585. package/harmony/src/main/cpp/lzma/CPP/Common/ComTry.h +0 -21
  586. package/harmony/src/main/cpp/lzma/CPP/Common/CommandLineParser.cpp +0 -197
  587. package/harmony/src/main/cpp/lzma/CPP/Common/CommandLineParser.h +0 -63
  588. package/harmony/src/main/cpp/lzma/CPP/Common/Common.h +0 -43
  589. package/harmony/src/main/cpp/lzma/CPP/Common/CrcReg.cpp +0 -98
  590. package/harmony/src/main/cpp/lzma/CPP/Common/Defs.h +0 -15
  591. package/harmony/src/main/cpp/lzma/CPP/Common/DynamicBuffer.h +0 -64
  592. package/harmony/src/main/cpp/lzma/CPP/Common/IntToString.cpp +0 -193
  593. package/harmony/src/main/cpp/lzma/CPP/Common/IntToString.h +0 -28
  594. package/harmony/src/main/cpp/lzma/CPP/Common/Lang.h +0 -23
  595. package/harmony/src/main/cpp/lzma/CPP/Common/ListFileUtils.cpp +0 -132
  596. package/harmony/src/main/cpp/lzma/CPP/Common/ListFileUtils.h +0 -18
  597. package/harmony/src/main/cpp/lzma/CPP/Common/MyBuffer.h +0 -259
  598. package/harmony/src/main/cpp/lzma/CPP/Common/MyBuffer2.h +0 -100
  599. package/harmony/src/main/cpp/lzma/CPP/Common/MyCom.h +0 -277
  600. package/harmony/src/main/cpp/lzma/CPP/Common/MyException.h +0 -14
  601. package/harmony/src/main/cpp/lzma/CPP/Common/MyGuidDef.h +0 -54
  602. package/harmony/src/main/cpp/lzma/CPP/Common/MyInitGuid.h +0 -45
  603. package/harmony/src/main/cpp/lzma/CPP/Common/MyLinux.h +0 -42
  604. package/harmony/src/main/cpp/lzma/CPP/Common/MyString.cpp +0 -1659
  605. package/harmony/src/main/cpp/lzma/CPP/Common/MyString.h +0 -868
  606. package/harmony/src/main/cpp/lzma/CPP/Common/MyTypes.h +0 -35
  607. package/harmony/src/main/cpp/lzma/CPP/Common/MyUnknown.h +0 -17
  608. package/harmony/src/main/cpp/lzma/CPP/Common/MyVector.cpp +0 -3
  609. package/harmony/src/main/cpp/lzma/CPP/Common/MyVector.h +0 -634
  610. package/harmony/src/main/cpp/lzma/CPP/Common/MyWindows.cpp +0 -145
  611. package/harmony/src/main/cpp/lzma/CPP/Common/MyWindows.h +0 -231
  612. package/harmony/src/main/cpp/lzma/CPP/Common/NewHandler.cpp +0 -163
  613. package/harmony/src/main/cpp/lzma/CPP/Common/NewHandler.h +0 -88
  614. package/harmony/src/main/cpp/lzma/CPP/Common/Sha256Reg.cpp +0 -40
  615. package/harmony/src/main/cpp/lzma/CPP/Common/StdAfx.h +0 -8
  616. package/harmony/src/main/cpp/lzma/CPP/Common/StdInStream.cpp +0 -89
  617. package/harmony/src/main/cpp/lzma/CPP/Common/StdInStream.h +0 -38
  618. package/harmony/src/main/cpp/lzma/CPP/Common/StdOutStream.cpp +0 -163
  619. package/harmony/src/main/cpp/lzma/CPP/Common/StdOutStream.h +0 -71
  620. package/harmony/src/main/cpp/lzma/CPP/Common/StringConvert.cpp +0 -319
  621. package/harmony/src/main/cpp/lzma/CPP/Common/StringConvert.h +0 -88
  622. package/harmony/src/main/cpp/lzma/CPP/Common/StringToInt.cpp +0 -144
  623. package/harmony/src/main/cpp/lzma/CPP/Common/StringToInt.h +0 -21
  624. package/harmony/src/main/cpp/lzma/CPP/Common/TextConfig.cpp +0 -124
  625. package/harmony/src/main/cpp/lzma/CPP/Common/TextConfig.h +0 -19
  626. package/harmony/src/main/cpp/lzma/CPP/Common/UTFConvert.cpp +0 -288
  627. package/harmony/src/main/cpp/lzma/CPP/Common/UTFConvert.h +0 -12
  628. package/harmony/src/main/cpp/lzma/CPP/Common/Wildcard.cpp +0 -676
  629. package/harmony/src/main/cpp/lzma/CPP/Common/Wildcard.h +0 -149
  630. package/harmony/src/main/cpp/lzma/CPP/Common/XzCrc64Init.cpp +0 -7
  631. package/harmony/src/main/cpp/lzma/CPP/Common/XzCrc64Reg.cpp +0 -42
  632. package/harmony/src/main/cpp/lzma/CPP/Windows/COM.h +0 -70
  633. package/harmony/src/main/cpp/lzma/CPP/Windows/CommonDialog.cpp +0 -185
  634. package/harmony/src/main/cpp/lzma/CPP/Windows/CommonDialog.h +0 -23
  635. package/harmony/src/main/cpp/lzma/CPP/Windows/Control/ComboBox.cpp +0 -66
  636. package/harmony/src/main/cpp/lzma/CPP/Windows/Control/ComboBox.h +0 -65
  637. package/harmony/src/main/cpp/lzma/CPP/Windows/Control/CommandBar.h +0 -52
  638. package/harmony/src/main/cpp/lzma/CPP/Windows/Control/Dialog.cpp +0 -251
  639. package/harmony/src/main/cpp/lzma/CPP/Windows/Control/Dialog.h +0 -170
  640. package/harmony/src/main/cpp/lzma/CPP/Windows/Control/Edit.h +0 -19
  641. package/harmony/src/main/cpp/lzma/CPP/Windows/Control/ImageList.cpp +0 -10
  642. package/harmony/src/main/cpp/lzma/CPP/Windows/Control/ImageList.h +0 -87
  643. package/harmony/src/main/cpp/lzma/CPP/Windows/Control/ListView.cpp +0 -155
  644. package/harmony/src/main/cpp/lzma/CPP/Windows/Control/ListView.h +0 -146
  645. package/harmony/src/main/cpp/lzma/CPP/Windows/Control/ProgressBar.h +0 -35
  646. package/harmony/src/main/cpp/lzma/CPP/Windows/Control/PropertyPage.cpp +0 -143
  647. package/harmony/src/main/cpp/lzma/CPP/Windows/Control/PropertyPage.h +0 -50
  648. package/harmony/src/main/cpp/lzma/CPP/Windows/Control/ReBar.h +0 -34
  649. package/harmony/src/main/cpp/lzma/CPP/Windows/Control/Static.h +0 -28
  650. package/harmony/src/main/cpp/lzma/CPP/Windows/Control/StatusBar.h +0 -42
  651. package/harmony/src/main/cpp/lzma/CPP/Windows/Control/StdAfx.h +0 -8
  652. package/harmony/src/main/cpp/lzma/CPP/Windows/Control/ToolBar.h +0 -43
  653. package/harmony/src/main/cpp/lzma/CPP/Windows/Control/Trackbar.h +0 -27
  654. package/harmony/src/main/cpp/lzma/CPP/Windows/Control/Window2.cpp +0 -200
  655. package/harmony/src/main/cpp/lzma/CPP/Windows/Control/Window2.h +0 -51
  656. package/harmony/src/main/cpp/lzma/CPP/Windows/DLL.cpp +0 -109
  657. package/harmony/src/main/cpp/lzma/CPP/Windows/DLL.h +0 -58
  658. package/harmony/src/main/cpp/lzma/CPP/Windows/Defs.h +0 -17
  659. package/harmony/src/main/cpp/lzma/CPP/Windows/ErrorMsg.cpp +0 -66
  660. package/harmony/src/main/cpp/lzma/CPP/Windows/ErrorMsg.h +0 -15
  661. package/harmony/src/main/cpp/lzma/CPP/Windows/FileDir.cpp +0 -714
  662. package/harmony/src/main/cpp/lzma/CPP/Windows/FileDir.h +0 -117
  663. package/harmony/src/main/cpp/lzma/CPP/Windows/FileFind.cpp +0 -749
  664. package/harmony/src/main/cpp/lzma/CPP/Windows/FileFind.h +0 -161
  665. package/harmony/src/main/cpp/lzma/CPP/Windows/FileIO.cpp +0 -432
  666. package/harmony/src/main/cpp/lzma/CPP/Windows/FileIO.h +0 -212
  667. package/harmony/src/main/cpp/lzma/CPP/Windows/FileLink.cpp +0 -440
  668. package/harmony/src/main/cpp/lzma/CPP/Windows/FileMapping.cpp +0 -12
  669. package/harmony/src/main/cpp/lzma/CPP/Windows/FileMapping.h +0 -66
  670. package/harmony/src/main/cpp/lzma/CPP/Windows/FileName.cpp +0 -839
  671. package/harmony/src/main/cpp/lzma/CPP/Windows/FileName.h +0 -115
  672. package/harmony/src/main/cpp/lzma/CPP/Windows/FileSystem.cpp +0 -131
  673. package/harmony/src/main/cpp/lzma/CPP/Windows/FileSystem.h +0 -27
  674. package/harmony/src/main/cpp/lzma/CPP/Windows/Handle.h +0 -37
  675. package/harmony/src/main/cpp/lzma/CPP/Windows/MemoryLock.cpp +0 -112
  676. package/harmony/src/main/cpp/lzma/CPP/Windows/MemoryLock.h +0 -40
  677. package/harmony/src/main/cpp/lzma/CPP/Windows/NtCheck.h +0 -46
  678. package/harmony/src/main/cpp/lzma/CPP/Windows/PropVariant.cpp +0 -347
  679. package/harmony/src/main/cpp/lzma/CPP/Windows/PropVariant.h +0 -114
  680. package/harmony/src/main/cpp/lzma/CPP/Windows/PropVariantConv.cpp +0 -138
  681. package/harmony/src/main/cpp/lzma/CPP/Windows/PropVariantConv.h +0 -37
  682. package/harmony/src/main/cpp/lzma/CPP/Windows/Registry.cpp +0 -390
  683. package/harmony/src/main/cpp/lzma/CPP/Windows/Registry.h +0 -84
  684. package/harmony/src/main/cpp/lzma/CPP/Windows/ResourceString.cpp +0 -103
  685. package/harmony/src/main/cpp/lzma/CPP/Windows/ResourceString.h +0 -16
  686. package/harmony/src/main/cpp/lzma/CPP/Windows/SecurityUtils.cpp +0 -181
  687. package/harmony/src/main/cpp/lzma/CPP/Windows/SecurityUtils.h +0 -167
  688. package/harmony/src/main/cpp/lzma/CPP/Windows/Shell.cpp +0 -358
  689. package/harmony/src/main/cpp/lzma/CPP/Windows/Shell.h +0 -94
  690. package/harmony/src/main/cpp/lzma/CPP/Windows/StdAfx.h +0 -8
  691. package/harmony/src/main/cpp/lzma/CPP/Windows/Synchronization.cpp +0 -10
  692. package/harmony/src/main/cpp/lzma/CPP/Windows/Synchronization.h +0 -164
  693. package/harmony/src/main/cpp/lzma/CPP/Windows/System.cpp +0 -142
  694. package/harmony/src/main/cpp/lzma/CPP/Windows/System.h +0 -40
  695. package/harmony/src/main/cpp/lzma/CPP/Windows/Thread.h +0 -38
  696. package/harmony/src/main/cpp/lzma/CPP/Windows/TimeUtils.cpp +0 -213
  697. package/harmony/src/main/cpp/lzma/CPP/Windows/TimeUtils.h +0 -32
  698. package/harmony/src/main/cpp/lzma/CPP/Windows/Window.cpp +0 -179
  699. package/harmony/src/main/cpp/lzma/CPP/Windows/Window.h +0 -284
  700. package/harmony/src/main/cpp/lzma/CS/7zip/Common/CRC.cs +0 -55
  701. package/harmony/src/main/cpp/lzma/CS/7zip/Common/CommandLineParser.cs +0 -274
  702. package/harmony/src/main/cpp/lzma/CS/7zip/Common/InBuffer.cs +0 -72
  703. package/harmony/src/main/cpp/lzma/CS/7zip/Common/OutBuffer.cs +0 -47
  704. package/harmony/src/main/cpp/lzma/CS/7zip/Compress/LZ/IMatchFinder.cs +0 -24
  705. package/harmony/src/main/cpp/lzma/CS/7zip/Compress/LZ/LzBinTree.cs +0 -367
  706. package/harmony/src/main/cpp/lzma/CS/7zip/Compress/LZ/LzInWindow.cs +0 -132
  707. package/harmony/src/main/cpp/lzma/CS/7zip/Compress/LZ/LzOutWindow.cs +0 -110
  708. package/harmony/src/main/cpp/lzma/CS/7zip/Compress/LZMA/LzmaBase.cs +0 -76
  709. package/harmony/src/main/cpp/lzma/CS/7zip/Compress/LZMA/LzmaDecoder.cs +0 -398
  710. package/harmony/src/main/cpp/lzma/CS/7zip/Compress/LZMA/LzmaEncoder.cs +0 -1480
  711. package/harmony/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/LzmaAlone.cs +0 -364
  712. package/harmony/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/LzmaAlone.csproj +0 -90
  713. package/harmony/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/LzmaAlone.sln +0 -20
  714. package/harmony/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/LzmaBench.cs +0 -340
  715. package/harmony/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/Properties/AssemblyInfo.cs +0 -29
  716. package/harmony/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/Properties/Resources.cs +0 -70
  717. package/harmony/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/Properties/Settings.cs +0 -42
  718. package/harmony/src/main/cpp/lzma/CS/7zip/Compress/RangeCoder/RangeCoder.cs +0 -234
  719. package/harmony/src/main/cpp/lzma/CS/7zip/Compress/RangeCoder/RangeCoderBit.cs +0 -117
  720. package/harmony/src/main/cpp/lzma/CS/7zip/Compress/RangeCoder/RangeCoderBitTree.cs +0 -157
  721. package/harmony/src/main/cpp/lzma/CS/7zip/ICoder.cs +0 -157
  722. package/harmony/src/main/cpp/lzma/DOC/7zC.txt +0 -187
  723. package/harmony/src/main/cpp/lzma/DOC/7zFormat.txt +0 -469
  724. package/harmony/src/main/cpp/lzma/DOC/Methods.txt +0 -173
  725. package/harmony/src/main/cpp/lzma/DOC/installer.txt +0 -166
  726. package/harmony/src/main/cpp/lzma/DOC/lzma-history.txt +0 -446
  727. package/harmony/src/main/cpp/lzma/DOC/lzma-sdk.txt +0 -357
  728. package/harmony/src/main/cpp/lzma/DOC/lzma-specification.txt +0 -1176
  729. package/harmony/src/main/cpp/lzma/DOC/lzma.txt +0 -328
  730. package/harmony/src/main/cpp/lzma/Java/SevenZip/CRC.java +0 -52
  731. package/harmony/src/main/cpp/lzma/Java/SevenZip/Compression/LZ/BinTree.java +0 -382
  732. package/harmony/src/main/cpp/lzma/Java/SevenZip/Compression/LZ/InWindow.java +0 -131
  733. package/harmony/src/main/cpp/lzma/Java/SevenZip/Compression/LZ/OutWindow.java +0 -85
  734. package/harmony/src/main/cpp/lzma/Java/SevenZip/Compression/LZMA/Base.java +0 -88
  735. package/harmony/src/main/cpp/lzma/Java/SevenZip/Compression/LZMA/Decoder.java +0 -329
  736. package/harmony/src/main/cpp/lzma/Java/SevenZip/Compression/LZMA/Encoder.java +0 -1416
  737. package/harmony/src/main/cpp/lzma/Java/SevenZip/Compression/RangeCoder/BitTreeDecoder.java +0 -55
  738. package/harmony/src/main/cpp/lzma/Java/SevenZip/Compression/RangeCoder/BitTreeEncoder.java +0 -99
  739. package/harmony/src/main/cpp/lzma/Java/SevenZip/Compression/RangeCoder/Decoder.java +0 -88
  740. package/harmony/src/main/cpp/lzma/Java/SevenZip/Compression/RangeCoder/Encoder.java +0 -151
  741. package/harmony/src/main/cpp/lzma/Java/SevenZip/ICodeProgress.java +0 -6
  742. package/harmony/src/main/cpp/lzma/Java/SevenZip/LzmaAlone.java +0 -253
  743. package/harmony/src/main/cpp/lzma/Java/SevenZip/LzmaBench.java +0 -392
  744. package/harmony/src/main/cpp/lzma/bin/7zS2.sfx +0 -0
  745. package/harmony/src/main/cpp/lzma/bin/7zS2con.sfx +0 -0
  746. package/harmony/src/main/cpp/lzma/bin/7zSD.sfx +0 -0
  747. package/harmony/src/main/cpp/lzma/bin/7zdec.exe +0 -0
  748. package/harmony/src/main/cpp/lzma/bin/7zr.exe +0 -0
  749. package/harmony/src/main/cpp/lzma/bin/installer/config.txt +0 -5
  750. package/harmony/src/main/cpp/lzma/bin/installer/cr.bat +0 -5
  751. package/harmony/src/main/cpp/lzma/bin/lzma.exe +0 -0
  752. package/harmony/src/main/cpp/lzma/bin/x64/7zr.exe +0 -0
  753. /package/harmony/{BuildProfile.ets → pushy/BuildProfile.ets} +0 -0
  754. /package/harmony/{OAT.xml → pushy/OAT.xml} +0 -0
  755. /package/harmony/{README.md → pushy/README.md} +0 -0
  756. /package/harmony/{build-profile.json5 → pushy/build-profile.json5} +0 -0
  757. /package/harmony/{hvigorfile.ts → pushy/hvigorfile.ts} +0 -0
  758. /package/harmony/{index.ets → pushy/index.ets} +0 -0
  759. /package/harmony/{oh-package-lock.json5 → pushy/oh-package-lock.json5} +0 -0
  760. /package/harmony/{oh-package.json5 → pushy/oh-package.json5} +0 -0
  761. /package/harmony/{src → pushy/src}/main/cpp/CMakeLists.txt +0 -0
  762. /package/harmony/{src → pushy/src}/main/cpp/PushyPackage.h +0 -0
  763. /package/harmony/{src → pushy/src}/main/cpp/PushyTurboModule.cpp +0 -0
  764. /package/harmony/{src → pushy/src}/main/cpp/PushyTurboModule.h +0 -0
  765. /package/harmony/{src → pushy/src}/main/cpp/hpatch.c +0 -0
  766. /package/harmony/{src → pushy/src}/main/cpp/hpatch.h +0 -0
  767. /package/harmony/{src → pushy/src}/main/cpp/pushy.c +0 -0
  768. /package/harmony/{src → pushy/src}/main/cpp/pushy.h +0 -0
  769. /package/harmony/{src → pushy/src}/main/ets/DownloadTask.ts +0 -0
  770. /package/harmony/{src → pushy/src}/main/ets/DownloadTaskParams.ts +0 -0
  771. /package/harmony/{src → pushy/src}/main/ets/EventHub.ts +0 -0
  772. /package/harmony/{src → pushy/src}/main/ets/Logger.ts +0 -0
  773. /package/harmony/{src → pushy/src}/main/ets/PushyFileJSBundleProvider.ets +0 -0
  774. /package/harmony/{src → pushy/src}/main/ets/PushyPackage.ts +0 -0
  775. /package/harmony/{src → pushy/src}/main/ets/PushyTurboModule.ts +0 -0
  776. /package/harmony/{src → pushy/src}/main/ets/UpdateContext.ts +0 -0
  777. /package/harmony/{src → pushy/src}/main/ets/UpdateModuleImpl.ts +0 -0
  778. /package/harmony/{src → pushy/src}/main/module.json5 +0 -0
  779. /package/harmony/{src → pushy/src}/main/resources/base/element/string.json +0 -0
  780. /package/harmony/{src → pushy/src}/main/resources/en_US/element/string.json +0 -0
  781. /package/harmony/{src → pushy/src}/main/resources/zh_CN/element/string.json +0 -0
  782. /package/harmony/{ts.ts → pushy/ts.ts} +0 -0
@@ -1,2292 +0,0 @@
1
- //patch.c
2
- //
3
- /*
4
- The MIT License (MIT)
5
- Copyright (c) 2012-2018 HouSisong
6
-
7
- Permission is hereby granted, free of charge, to any person
8
- obtaining a copy of this software and associated documentation
9
- files (the "Software"), to deal in the Software without
10
- restriction, including without limitation the rights to use,
11
- copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- copies of the Software, and to permit persons to whom the
13
- Software is furnished to do so, subject to the following
14
- conditions:
15
-
16
- The above copyright notice and this permission notice shall be
17
- included in all copies of the Software.
18
-
19
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
21
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26
- OTHER DEALINGS IN THE SOFTWARE.
27
- */
28
- #include "patch.h"
29
- #if (_IS_NEED_CACHE_OLD_BY_COVERS)
30
- # include <stdlib.h> //qsort
31
- #endif
32
- #include "patch_private.h"
33
-
34
- #ifndef _IS_NEED_MIN_CODE_SIZE
35
- # define _IS_NEED_MIN_CODE_SIZE 0 //default used fast code
36
- #endif
37
-
38
- #ifndef _IS_RUN_MEM_SAFE_CHECK
39
- # define _IS_RUN_MEM_SAFE_CHECK 1
40
- #endif
41
-
42
- #if (_IS_RUN_MEM_SAFE_CHECK)
43
- //__RUN_MEM_SAFE_CHECK用来启动内存访问越界检查,用以防御可能被意外或故意损坏的数据.
44
- # define __RUN_MEM_SAFE_CHECK
45
- #endif
46
-
47
- #ifdef __RUN_MEM_SAFE_CHECK
48
- # define _SAFE_CHECK_DO(code) do{ if (!(code)) return _hpatch_FALSE; }while(0)
49
- #else
50
- # define _SAFE_CHECK_DO(code) do{ code; }while(0)
51
- #endif
52
-
53
- #define _hpatch_FALSE hpatch_FALSE
54
- //hpatch_uint __debug_check_false_x=0; //for debug
55
- //#define _hpatch_FALSE (1/__debug_check_false_x)
56
-
57
- typedef unsigned char TByte;
58
-
59
-
60
- //变长正整数编码方案(x bit额外类型标志位,x<=7),从高位开始输出1--n byte:
61
- // x0* 7-x bit
62
- // x1* 0* 7+7-x bit
63
- // x1* 1* 0* 7+7+7-x bit
64
- // x1* 1* 1* 0* 7+7+7+7-x bit
65
- // x1* 1* 1* 1* 0* 7+7+7+7+7-x bit
66
- // ......
67
- hpatch_BOOL hpatch_packUIntWithTag(TByte** out_code,TByte* out_code_end,
68
- hpatch_StreamPos_t uValue,hpatch_uint highTag,
69
- const hpatch_uint kTagBit){//写入整数并前进指针.
70
- TByte* pcode=*out_code;
71
- const hpatch_StreamPos_t kMaxValueWithTag=((hpatch_StreamPos_t)1<<(7-kTagBit))-1;
72
- TByte codeBuf[hpatch_kMaxPackedUIntBytes];
73
- TByte* codeEnd=codeBuf;
74
- #ifdef __RUN_MEM_SAFE_CHECK
75
- //static const hpatch_uint kPackMaxTagBit=7;
76
- //assert((0<=kTagBit)&&(kTagBit<=kPackMaxTagBit));
77
- //assert((highTag>>kTagBit)==0);
78
- #endif
79
- while (uValue>kMaxValueWithTag) {
80
- *codeEnd=uValue&((1<<7)-1); ++codeEnd;
81
- uValue>>=7;
82
- }
83
- #ifdef __RUN_MEM_SAFE_CHECK
84
- if ((out_code_end-pcode)<(1+(codeEnd-codeBuf))) return _hpatch_FALSE;
85
- #endif
86
- *pcode=(TByte)( (TByte)uValue | (highTag<<(8-kTagBit))
87
- | (((codeBuf!=codeEnd)?1:0)<<(7-kTagBit)) );
88
- ++pcode;
89
- while (codeBuf!=codeEnd) {
90
- --codeEnd;
91
- *pcode=(*codeEnd) | (((codeBuf!=codeEnd)?1:0)<<7);
92
- ++pcode;
93
- }
94
- *out_code=pcode;
95
- return hpatch_TRUE;
96
- }
97
-
98
- hpatch_uint hpatch_packUIntWithTag_size(hpatch_StreamPos_t uValue,const hpatch_uint kTagBit){
99
- const hpatch_StreamPos_t kMaxValueWithTag=((hpatch_StreamPos_t)1<<(7-kTagBit))-1;
100
- hpatch_uint size=0;
101
- while (uValue>kMaxValueWithTag) {
102
- ++size;
103
- uValue>>=7;
104
- }
105
- ++size;
106
- return size;
107
- }
108
-
109
- hpatch_BOOL hpatch_unpackUIntWithTag(const TByte** src_code,const TByte* src_code_end,
110
- hpatch_StreamPos_t* result,const hpatch_uint kTagBit){//读出整数并前进指针.
111
- #ifdef __RUN_MEM_SAFE_CHECK
112
- //const hpatch_uint kPackMaxTagBit=7;
113
- #endif
114
- hpatch_StreamPos_t value;
115
- TByte code;
116
- const TByte* pcode=*src_code;
117
-
118
- #ifdef __RUN_MEM_SAFE_CHECK
119
- //assert(kTagBit<=kPackMaxTagBit);
120
- if (src_code_end<=pcode) return _hpatch_FALSE;
121
- #endif
122
- code=*pcode; ++pcode;
123
- value=code&((1<<(7-kTagBit))-1);
124
- if ((code&(1<<(7-kTagBit)))!=0){
125
- do {
126
- #ifdef __RUN_MEM_SAFE_CHECK
127
- if ((value>>(sizeof(value)*8-7))!=0) return _hpatch_FALSE;//cannot save 7bit
128
- if (src_code_end==pcode) return _hpatch_FALSE;
129
- #endif
130
- code=*pcode; ++pcode;
131
- value=(value<<7) | (code&((1<<7)-1));
132
- } while ((code&(1<<7))!=0);
133
- }
134
- (*src_code)=pcode;
135
- *result=value;
136
- return hpatch_TRUE;
137
- }
138
-
139
-
140
- static hpatch_BOOL _read_mem_stream(const hpatch_TStreamInput* stream,hpatch_StreamPos_t readFromPos,
141
- unsigned char* out_data,unsigned char* out_data_end){
142
- const unsigned char* src=(const unsigned char*)stream->streamImport;
143
- hpatch_size_t readLen=out_data_end-out_data;
144
- #ifdef __RUN_MEM_SAFE_CHECK
145
- if (readFromPos>stream->streamSize) return _hpatch_FALSE;
146
- if (readLen>(hpatch_StreamPos_t)(stream->streamSize-readFromPos)) return _hpatch_FALSE;
147
- #endif
148
- memcpy(out_data,src+readFromPos,readLen);
149
- return hpatch_TRUE;
150
- }
151
- void mem_as_hStreamInput(hpatch_TStreamInput* out_stream,
152
- const unsigned char* mem,const unsigned char* mem_end){
153
- out_stream->streamImport=(void*)mem;
154
- out_stream->streamSize=mem_end-mem;
155
- out_stream->read=_read_mem_stream;
156
- }
157
-
158
- static hpatch_BOOL _write_mem_stream(const hpatch_TStreamOutput* stream,hpatch_StreamPos_t writeToPos,
159
- const unsigned char* data,const unsigned char* data_end){
160
- unsigned char* out_dst=(unsigned char*)stream->streamImport;
161
- hpatch_size_t writeLen=data_end-data;
162
- #ifdef __RUN_MEM_SAFE_CHECK
163
- if (writeToPos>stream->streamSize) return _hpatch_FALSE;
164
- if (writeLen>(hpatch_StreamPos_t)(stream->streamSize-writeToPos)) return _hpatch_FALSE;
165
- #endif
166
- memcpy(out_dst+writeToPos,data,writeLen);
167
- return hpatch_TRUE;
168
- }
169
- typedef hpatch_BOOL (*_read_mem_stream_t)(const hpatch_TStreamOutput* stream,hpatch_StreamPos_t readFromPos,
170
- unsigned char* out_data,unsigned char* out_data_end);
171
- void mem_as_hStreamOutput(hpatch_TStreamOutput* out_stream,
172
- unsigned char* mem,unsigned char* mem_end){
173
- out_stream->streamImport=mem;
174
- out_stream->streamSize=mem_end-mem;
175
- out_stream->read_writed=(_read_mem_stream_t)_read_mem_stream;
176
- out_stream->write=_write_mem_stream;
177
- }
178
-
179
- hpatch_BOOL hpatch_deccompress_mem(hpatch_TDecompress* decompressPlugin,
180
- const unsigned char* code,const unsigned char* code_end,
181
- unsigned char* out_data,unsigned char* out_data_end){
182
- hpatch_decompressHandle dec=0;
183
- hpatch_BOOL result,colose_rt;
184
- hpatch_TStreamInput codeStream;
185
- mem_as_hStreamInput(&codeStream,code,code_end);
186
- dec=decompressPlugin->open(decompressPlugin,(out_data_end-out_data),
187
- &codeStream,0,codeStream.streamSize);
188
- if (dec==0) return _hpatch_FALSE;
189
- result=decompressPlugin->decompress_part(dec,out_data,out_data_end);
190
- colose_rt=decompressPlugin->close(decompressPlugin,dec);
191
- assert(colose_rt);
192
- return result;
193
- }
194
-
195
-
196
- ////////
197
- //patch by memory
198
-
199
- static const hpatch_uint kSignTagBit=1;
200
-
201
- static hpatch_BOOL _bytesRle_load(TByte* out_data,TByte* out_dataEnd,
202
- const TByte* rle_code,const TByte* rle_code_end);
203
- static void addData(TByte* dst,const TByte* src,hpatch_size_t length);
204
- hpatch_inline
205
- static hpatch_BOOL _unpackUIntWithTag(const TByte** src_code,const TByte* src_code_end,
206
- hpatch_size_t* result,const hpatch_uint kTagBit){
207
- if (sizeof(hpatch_size_t)==sizeof(hpatch_StreamPos_t)){
208
- return hpatch_unpackUIntWithTag(src_code,src_code_end,(hpatch_StreamPos_t*)result,kTagBit);
209
- }else{
210
- hpatch_StreamPos_t u64=0;
211
- hpatch_BOOL rt=hpatch_unpackUIntWithTag(src_code,src_code_end,&u64,kTagBit);
212
- hpatch_size_t u=(hpatch_size_t)u64;
213
- *result=u;
214
- #ifdef __RUN_MEM_SAFE_CHECK
215
- return rt&(u==u64);
216
- #else
217
- return rt;
218
- #endif
219
- }
220
- }
221
-
222
- #define unpackUIntWithTagTo(puint,src_code,src_code_end,kTagBit) \
223
- _SAFE_CHECK_DO(_unpackUIntWithTag(src_code,src_code_end,puint,kTagBit))
224
- #define unpackUIntTo(puint,src_code,src_code_end) \
225
- unpackUIntWithTagTo(puint,src_code,src_code_end,0)
226
-
227
- hpatch_BOOL patch(TByte* out_newData,TByte* out_newData_end,
228
- const TByte* oldData,const TByte* oldData_end,
229
- const TByte* serializedDiff,const TByte* serializedDiff_end){
230
- const TByte *code_lengths, *code_lengths_end,
231
- *code_inc_newPos, *code_inc_newPos_end,
232
- *code_inc_oldPos, *code_inc_oldPos_end,
233
- *code_newDataDiff, *code_newDataDiff_end;
234
- hpatch_size_t coverCount;
235
-
236
- assert(out_newData<=out_newData_end);
237
- assert(oldData<=oldData_end);
238
- assert(serializedDiff<=serializedDiff_end);
239
- unpackUIntTo(&coverCount,&serializedDiff, serializedDiff_end);
240
- { //head
241
- hpatch_size_t lengthSize,inc_newPosSize,inc_oldPosSize,newDataDiffSize;
242
- unpackUIntTo(&lengthSize,&serializedDiff, serializedDiff_end);
243
- unpackUIntTo(&inc_newPosSize,&serializedDiff, serializedDiff_end);
244
- unpackUIntTo(&inc_oldPosSize,&serializedDiff, serializedDiff_end);
245
- unpackUIntTo(&newDataDiffSize,&serializedDiff, serializedDiff_end);
246
- #ifdef __RUN_MEM_SAFE_CHECK
247
- if (lengthSize>(hpatch_size_t)(serializedDiff_end-serializedDiff)) return _hpatch_FALSE;
248
- #endif
249
- code_lengths=serializedDiff; serializedDiff+=lengthSize;
250
- code_lengths_end=serializedDiff;
251
- #ifdef __RUN_MEM_SAFE_CHECK
252
- if (inc_newPosSize>(hpatch_size_t)(serializedDiff_end-serializedDiff)) return _hpatch_FALSE;
253
- #endif
254
- code_inc_newPos=serializedDiff; serializedDiff+=inc_newPosSize;
255
- code_inc_newPos_end=serializedDiff;
256
- #ifdef __RUN_MEM_SAFE_CHECK
257
- if (inc_oldPosSize>(hpatch_size_t)(serializedDiff_end-serializedDiff)) return _hpatch_FALSE;
258
- #endif
259
- code_inc_oldPos=serializedDiff; serializedDiff+=inc_oldPosSize;
260
- code_inc_oldPos_end=serializedDiff;
261
- #ifdef __RUN_MEM_SAFE_CHECK
262
- if (newDataDiffSize>(hpatch_size_t)(serializedDiff_end-serializedDiff)) return _hpatch_FALSE;
263
- #endif
264
- code_newDataDiff=serializedDiff; serializedDiff+=newDataDiffSize;
265
- code_newDataDiff_end=serializedDiff;
266
- }
267
-
268
- //decode rle ; rle data begin==cur serializedDiff;
269
- _SAFE_CHECK_DO(_bytesRle_load(out_newData, out_newData_end, serializedDiff, serializedDiff_end));
270
-
271
- { //patch
272
- const hpatch_size_t newDataSize=(hpatch_size_t)(out_newData_end-out_newData);
273
- hpatch_size_t oldPosBack=0;
274
- hpatch_size_t newPosBack=0;
275
- hpatch_size_t i;
276
- for (i=0; i<coverCount; ++i){
277
- hpatch_size_t copyLength,addLength, oldPos,inc_oldPos,inc_oldPos_sign;
278
- unpackUIntTo(&copyLength,&code_inc_newPos, code_inc_newPos_end);
279
- unpackUIntTo(&addLength,&code_lengths, code_lengths_end);
280
- #ifdef __RUN_MEM_SAFE_CHECK
281
- if (code_inc_oldPos>=code_inc_oldPos_end) return _hpatch_FALSE;
282
- #endif
283
- inc_oldPos_sign=(*code_inc_oldPos)>>(8-kSignTagBit);
284
- unpackUIntWithTagTo(&inc_oldPos,&code_inc_oldPos, code_inc_oldPos_end, kSignTagBit);
285
- if (inc_oldPos_sign==0)
286
- oldPos=oldPosBack+inc_oldPos;
287
- else
288
- oldPos=oldPosBack-inc_oldPos;
289
- if (copyLength>0){
290
- #ifdef __RUN_MEM_SAFE_CHECK
291
- if (copyLength>(hpatch_size_t)(newDataSize-newPosBack)) return _hpatch_FALSE;
292
- if (copyLength>(hpatch_size_t)(code_newDataDiff_end-code_newDataDiff)) return _hpatch_FALSE;
293
- #endif
294
- memcpy(out_newData+newPosBack,code_newDataDiff,copyLength);
295
- code_newDataDiff+=copyLength;
296
- newPosBack+=copyLength;
297
- }
298
- #ifdef __RUN_MEM_SAFE_CHECK
299
- if ( (addLength>(hpatch_size_t)(newDataSize-newPosBack)) ) return _hpatch_FALSE;
300
- if ( (oldPos>(hpatch_size_t)(oldData_end-oldData)) ||
301
- (addLength>(hpatch_size_t)(oldData_end-oldData-oldPos)) ) return _hpatch_FALSE;
302
- #endif
303
- addData(out_newData+newPosBack,oldData+oldPos,addLength);
304
- oldPosBack=oldPos;
305
- newPosBack+=addLength;
306
- }
307
-
308
- if (newPosBack<newDataSize){
309
- hpatch_size_t copyLength=newDataSize-newPosBack;
310
- #ifdef __RUN_MEM_SAFE_CHECK
311
- if (copyLength>(hpatch_size_t)(code_newDataDiff_end-code_newDataDiff)) return _hpatch_FALSE;
312
- #endif
313
- memcpy(out_newData+newPosBack,code_newDataDiff,copyLength);
314
- code_newDataDiff+=copyLength;
315
- //newPosBack=newDataSize;
316
- }
317
- }
318
-
319
- if ( (code_lengths==code_lengths_end)
320
- &&(code_inc_newPos==code_inc_newPos_end)
321
- &&(code_inc_oldPos==code_inc_oldPos_end)
322
- &&(code_newDataDiff==code_newDataDiff_end))
323
- return hpatch_TRUE;
324
- else
325
- return _hpatch_FALSE;
326
- }
327
-
328
- #if (_IS_NEED_MIN_CODE_SIZE)
329
- hpatch_inline static void addData(TByte* dst,const TByte* src,hpatch_size_t length){
330
- while (length--) { *dst++ += *src++; }
331
- }
332
- #else
333
- static void addData(TByte* dst,const TByte* src,hpatch_size_t length){
334
- hpatch_size_t length_fast,i;
335
-
336
- length_fast=length&(~(hpatch_size_t)7);
337
- for (i=0;i<length_fast;i+=8){
338
- dst[i ]+=src[i ];
339
- dst[i+1]+=src[i+1];
340
- dst[i+2]+=src[i+2];
341
- dst[i+3]+=src[i+3];
342
- dst[i+4]+=src[i+4];
343
- dst[i+5]+=src[i+5];
344
- dst[i+6]+=src[i+6];
345
- dst[i+7]+=src[i+7];
346
- }
347
- for (;i<length;++i)
348
- dst[i]+=src[i];
349
- }
350
- #endif
351
-
352
-
353
- static hpatch_BOOL _bytesRle_load(TByte* out_data,TByte* out_dataEnd,
354
- const TByte* rle_code,const TByte* rle_code_end){
355
- const TByte* ctrlBuf,*ctrlBuf_end;
356
- hpatch_size_t ctrlSize;
357
- unpackUIntTo(&ctrlSize,&rle_code,rle_code_end);
358
- #ifdef __RUN_MEM_SAFE_CHECK
359
- if (ctrlSize>(hpatch_size_t)(rle_code_end-rle_code)) return _hpatch_FALSE;
360
- #endif
361
- ctrlBuf=rle_code;
362
- rle_code+=ctrlSize;
363
- ctrlBuf_end=rle_code;
364
- while (ctrlBuf_end-ctrlBuf>0){
365
- enum TByteRleType type=(enum TByteRleType)((*ctrlBuf)>>(8-kByteRleType_bit));
366
- hpatch_size_t length;
367
- unpackUIntWithTagTo(&length,&ctrlBuf,ctrlBuf_end,kByteRleType_bit);
368
- #ifdef __RUN_MEM_SAFE_CHECK
369
- if (length>=(hpatch_size_t)(out_dataEnd-out_data)) return _hpatch_FALSE;
370
- #endif
371
- ++length;
372
- switch (type){
373
- case kByteRleType_rle0:{
374
- memset(out_data,0,length);
375
- out_data+=length;
376
- }break;
377
- case kByteRleType_rle255:{
378
- memset(out_data,255,length);
379
- out_data+=length;
380
- }break;
381
- case kByteRleType_rle:{
382
- #ifdef __RUN_MEM_SAFE_CHECK
383
- if (1>(hpatch_size_t)(rle_code_end-rle_code)) return _hpatch_FALSE;
384
- #endif
385
- memset(out_data,*rle_code,length);
386
- ++rle_code;
387
- out_data+=length;
388
- }break;
389
- case kByteRleType_unrle:{
390
- #ifdef __RUN_MEM_SAFE_CHECK
391
- if (length>(hpatch_size_t)(rle_code_end-rle_code)) return _hpatch_FALSE;
392
- #endif
393
- memcpy(out_data,rle_code,length);
394
- rle_code+=length;
395
- out_data+=length;
396
- }break;
397
- }
398
- }
399
-
400
- if ( (ctrlBuf==ctrlBuf_end)
401
- &&(rle_code==rle_code_end)
402
- &&(out_data==out_dataEnd))
403
- return hpatch_TRUE;
404
- else
405
- return _hpatch_FALSE;
406
- }
407
-
408
- //----------------------
409
- //patch by stream
410
-
411
- static hpatch_BOOL _TStreamInputClip_read(const hpatch_TStreamInput* stream,
412
- hpatch_StreamPos_t readFromPos,
413
- unsigned char* out_data,unsigned char* out_data_end){
414
- TStreamInputClip* self=(TStreamInputClip*)stream->streamImport;
415
- #ifdef __RUN_MEM_SAFE_CHECK
416
- if (readFromPos+(out_data_end-out_data)>self->base.streamSize) return _hpatch_FALSE;
417
- #endif
418
- return self->srcStream->read(self->srcStream,readFromPos+self->clipBeginPos,out_data,out_data_end);
419
- }
420
- void TStreamInputClip_init(TStreamInputClip* self,const hpatch_TStreamInput* srcStream,
421
- hpatch_StreamPos_t clipBeginPos,hpatch_StreamPos_t clipEndPos){
422
- assert(self!=0);
423
- assert(srcStream!=0);
424
- assert(clipBeginPos<=clipEndPos);
425
- assert(clipEndPos<=srcStream->streamSize);
426
- self->srcStream=srcStream;
427
- self->clipBeginPos=clipBeginPos;
428
- self->base.streamImport=self;
429
- self->base.streamSize=clipEndPos-clipBeginPos;
430
- self->base.read=_TStreamInputClip_read;
431
- }
432
-
433
- static hpatch_BOOL _TStreamOutputClip_write(const hpatch_TStreamOutput* stream,
434
- hpatch_StreamPos_t writePos,
435
- const unsigned char* data,const unsigned char* data_end){
436
- TStreamOutputClip* self=(TStreamOutputClip*)stream->streamImport;
437
- #ifdef __RUN_MEM_SAFE_CHECK
438
- if (writePos+(data_end-data)>self->base.streamSize) return _hpatch_FALSE;
439
- #endif
440
- return self->srcStream->write(self->srcStream,writePos+self->clipBeginPos,data,data_end);
441
- }
442
-
443
- void TStreamOutputClip_init(TStreamOutputClip* self,const hpatch_TStreamOutput* srcStream,
444
- hpatch_StreamPos_t clipBeginPos,hpatch_StreamPos_t clipEndPos){
445
- assert(self!=0);
446
- assert(srcStream!=0);
447
- assert(clipBeginPos<=clipEndPos);
448
- assert(clipEndPos<=srcStream->streamSize);
449
- self->srcStream=srcStream;
450
- self->clipBeginPos=clipBeginPos;
451
- self->base.streamImport=self;
452
- self->base.streamSize=clipEndPos-clipBeginPos;
453
- ((TStreamInputClip*)self)->base.read=_TStreamInputClip_read;
454
- self->base.write=_TStreamOutputClip_write;
455
- }
456
-
457
-
458
-
459
- //assert(hpatch_kStreamCacheSize>=hpatch_kMaxPluginTypeLength+1);
460
- struct __private_hpatch_check_kMaxCompressTypeLength {
461
- char _[(hpatch_kStreamCacheSize>=(hpatch_kMaxPluginTypeLength+1))?1:-1];};
462
-
463
- hpatch_BOOL _TStreamCacheClip_readType_end(TStreamCacheClip* sclip,TByte endTag,
464
- char out_type[hpatch_kMaxPluginTypeLength+1]){
465
- const TByte* type_begin;
466
- hpatch_size_t i;
467
- hpatch_size_t readLen=hpatch_kMaxPluginTypeLength+1;
468
- if (readLen>_TStreamCacheClip_streamSize(sclip))
469
- readLen=(hpatch_size_t)_TStreamCacheClip_streamSize(sclip);
470
- type_begin=_TStreamCacheClip_accessData(sclip,readLen);
471
- if (type_begin==0) return _hpatch_FALSE;//not found
472
- for (i=0; i<readLen; ++i) {
473
- if (type_begin[i]!=endTag)
474
- continue;
475
- else{
476
- memcpy(out_type,type_begin,i); out_type[i]='\0';
477
- _TStreamCacheClip_skipData_noCheck(sclip,i+1);
478
- return hpatch_TRUE;
479
- }
480
- }
481
- return _hpatch_FALSE;//not found
482
- }
483
-
484
- hpatch_BOOL _TStreamCacheClip_updateCache(TStreamCacheClip* sclip){
485
- TByte* buf0=&sclip->cacheBuf[0];
486
- const hpatch_StreamPos_t streamSize=sclip->streamPos_end-sclip->streamPos;
487
- hpatch_size_t readSize=sclip->cacheBegin;
488
- if (readSize>streamSize)
489
- readSize=(hpatch_size_t)streamSize;
490
- if (readSize==0) return hpatch_TRUE;
491
- if (!_TStreamCacheClip_isCacheEmpty(sclip)){
492
- memmove(buf0+(hpatch_size_t)(sclip->cacheBegin-readSize),
493
- buf0+sclip->cacheBegin,_TStreamCacheClip_cachedSize(sclip));
494
- }
495
- if (!sclip->srcStream->read(sclip->srcStream,sclip->streamPos,
496
- buf0+(sclip->cacheEnd-readSize),buf0+sclip->cacheEnd))
497
- return _hpatch_FALSE;//read error
498
- sclip->cacheBegin-=readSize;
499
- sclip->streamPos+=readSize;
500
- return hpatch_TRUE;
501
- }
502
-
503
- hpatch_BOOL _TStreamCacheClip_skipData(TStreamCacheClip* sclip,hpatch_StreamPos_t skipLongSize){
504
- while (skipLongSize>0) {
505
- hpatch_size_t len=sclip->cacheEnd;
506
- if (len>skipLongSize)
507
- len=(hpatch_size_t)skipLongSize;
508
- if (_TStreamCacheClip_accessData(sclip,len)){
509
- _TStreamCacheClip_skipData_noCheck(sclip,len);
510
- skipLongSize-=len;
511
- }else{
512
- return _hpatch_FALSE;
513
- }
514
- }
515
- return hpatch_TRUE;
516
- }
517
-
518
- //assert(hpatch_kStreamCacheSize>=hpatch_kMaxPackedUIntBytes);
519
- struct __private_hpatch_check_hpatch_kMaxPackedUIntBytes {
520
- char _[(hpatch_kStreamCacheSize>=hpatch_kMaxPackedUIntBytes)?1:-1]; };
521
-
522
- hpatch_BOOL _TStreamCacheClip_unpackUIntWithTag(TStreamCacheClip* sclip,hpatch_StreamPos_t* result,const hpatch_uint kTagBit){
523
- TByte* curCode,*codeBegin;
524
- hpatch_size_t readSize=hpatch_kMaxPackedUIntBytes;
525
- const hpatch_StreamPos_t dataSize=_TStreamCacheClip_streamSize(sclip);
526
- if (readSize>dataSize)
527
- readSize=(hpatch_size_t)dataSize;
528
- codeBegin=_TStreamCacheClip_accessData(sclip,readSize);
529
- if (codeBegin==0) return _hpatch_FALSE;
530
- curCode=codeBegin;
531
- _SAFE_CHECK_DO(hpatch_unpackUIntWithTag((const TByte**)&curCode,codeBegin+readSize,result,kTagBit));
532
- _TStreamCacheClip_skipData_noCheck(sclip,(hpatch_size_t)(curCode-codeBegin));
533
- return hpatch_TRUE;
534
- }
535
-
536
- hpatch_BOOL _TStreamCacheClip_readUInt(TStreamCacheClip* sclip,hpatch_StreamPos_t* result,hpatch_size_t uintSize){
537
- // assert(uintSize<=sizeof(hpatch_StreamPos_t));
538
- const TByte* buf=_TStreamCacheClip_readData(sclip,uintSize);
539
- hpatch_StreamPos_t v=0;
540
- if (buf!=0){
541
- switch (uintSize) {
542
- case 8: v|=((hpatch_StreamPos_t)buf[7])<<(7*8);
543
- case 7: v|=((hpatch_StreamPos_t)buf[6])<<(6*8);
544
- case 6: v|=((hpatch_StreamPos_t)buf[5])<<(5*8);
545
- case 5: v|=((hpatch_StreamPos_t)buf[4])<<(4*8);
546
- case 4: v|=((hpatch_StreamPos_t)buf[3])<<(3*8);
547
- case 3: v|=((hpatch_StreamPos_t)buf[2])<<(2*8);
548
- case 2: v|=((hpatch_StreamPos_t)buf[1])<<(1*8);
549
- case 1: v|=((hpatch_StreamPos_t)buf[0]);
550
- case 0: { *result=v; return hpatch_TRUE; }
551
- default: return _hpatch_FALSE;
552
- }
553
- }else{
554
- return _hpatch_FALSE;
555
- }
556
- }
557
-
558
- hpatch_BOOL _TStreamCacheClip_readDataTo(TStreamCacheClip* sclip,TByte* out_buf,TByte* bufEnd){
559
- hpatch_size_t readLen=_TStreamCacheClip_cachedSize(sclip);
560
- hpatch_size_t outLen=bufEnd-out_buf;
561
- if (readLen>=outLen)
562
- readLen=outLen;
563
- memcpy(out_buf,&sclip->cacheBuf[sclip->cacheBegin],readLen);
564
- sclip->cacheBegin+=readLen;
565
- out_buf+=readLen;
566
- outLen-=readLen;
567
- if (outLen){
568
- if (!sclip->srcStream->read(sclip->srcStream,sclip->streamPos,
569
- out_buf,bufEnd)) return _hpatch_FALSE;
570
- sclip->streamPos+=outLen;
571
- }
572
- return hpatch_TRUE;
573
- }
574
-
575
- static hpatch_BOOL _decompress_read(const hpatch_TStreamInput* stream,
576
- const hpatch_StreamPos_t readFromPos,
577
- TByte* out_data,TByte* out_data_end){
578
- _TDecompressInputStream* self=(_TDecompressInputStream*)stream->streamImport;
579
- return self->decompressPlugin->decompress_part(self->decompressHandle,out_data,out_data_end);
580
- }
581
- hpatch_BOOL getStreamClip(TStreamCacheClip* out_clip,_TDecompressInputStream* out_stream,
582
- hpatch_StreamPos_t dataSize,hpatch_StreamPos_t compressedSize,
583
- const hpatch_TStreamInput* stream,hpatch_StreamPos_t* pCurStreamPos,
584
- hpatch_TDecompress* decompressPlugin,TByte* aCache,hpatch_size_t cacheSize){
585
- hpatch_StreamPos_t curStreamPos=*pCurStreamPos;
586
- if (compressedSize==0){
587
- #ifdef __RUN_MEM_SAFE_CHECK
588
- if ((curStreamPos+dataSize)<curStreamPos) return _hpatch_FALSE;
589
- if ((curStreamPos+dataSize)>stream->streamSize) return _hpatch_FALSE;
590
- #endif
591
- if (out_clip)
592
- _TStreamCacheClip_init(out_clip,stream,curStreamPos,curStreamPos+dataSize,aCache,cacheSize);
593
- curStreamPos+=dataSize;
594
- }else{
595
- #ifdef __RUN_MEM_SAFE_CHECK
596
- if ((curStreamPos+compressedSize)<curStreamPos) return _hpatch_FALSE;
597
- if ((curStreamPos+compressedSize)>stream->streamSize) return _hpatch_FALSE;
598
- #endif
599
- if (out_clip){
600
- out_stream->IInputStream.streamImport=out_stream;
601
- out_stream->IInputStream.streamSize=dataSize;
602
- out_stream->IInputStream.read=_decompress_read;
603
- out_stream->decompressPlugin=decompressPlugin;
604
- out_stream->decompressHandle=decompressPlugin->open(decompressPlugin,dataSize,stream,
605
- curStreamPos,curStreamPos+compressedSize);
606
- if (!out_stream->decompressHandle) return _hpatch_FALSE;
607
- _TStreamCacheClip_init(out_clip,&out_stream->IInputStream,0,
608
- out_stream->IInputStream.streamSize,aCache,cacheSize);
609
- }
610
- curStreamPos+=compressedSize;
611
- }
612
- *pCurStreamPos=curStreamPos;
613
- return hpatch_TRUE;
614
- }
615
-
616
- ///////
617
-
618
- // Stream Clip cache
619
- typedef struct {
620
- hpatch_StreamPos_t writeToPos;
621
- const hpatch_TStreamOutput* dstStream;
622
- unsigned char* cacheBuf;
623
- hpatch_size_t cacheCur;
624
- hpatch_size_t cacheEnd;
625
- } TOutStreamCache;
626
-
627
- static hpatch_inline void TOutStreamCache_init(TOutStreamCache* self,const hpatch_TStreamOutput* dstStream,
628
- TByte* aCache,hpatch_size_t aCacheSize){
629
- self->writeToPos=0;
630
- self->dstStream=dstStream;
631
- self->cacheBuf=aCache;
632
- self->cacheCur=0;
633
- self->cacheEnd=aCacheSize;
634
- }
635
- static hpatch_inline hpatch_BOOL TOutStreamCache_isFinish(const TOutStreamCache* self){
636
- return self->writeToPos==self->dstStream->streamSize;
637
- }
638
-
639
- static hpatch_inline hpatch_BOOL _TOutStreamCache_write(TOutStreamCache* self,const TByte* data,hpatch_size_t dataSize){
640
- if (!self->dstStream->write(self->dstStream,self->writeToPos,data,data+dataSize))
641
- return _hpatch_FALSE;
642
- self->writeToPos+=dataSize;
643
- return hpatch_TRUE;
644
- }
645
-
646
- static hpatch_BOOL TOutStreamCache_flush(TOutStreamCache* self){
647
- hpatch_size_t curSize=self->cacheCur;
648
- if (curSize>0){
649
- if (!_TOutStreamCache_write(self,self->cacheBuf,curSize))
650
- return _hpatch_FALSE;
651
- self->cacheCur=0;
652
- }
653
- return hpatch_TRUE;
654
- }
655
-
656
- static hpatch_BOOL TOutStreamCache_write(TOutStreamCache* self,const TByte* data,hpatch_size_t dataSize){
657
- while (dataSize>0) {
658
- hpatch_size_t copyLen;
659
- hpatch_size_t curSize=self->cacheCur;
660
- if ((dataSize>=self->cacheEnd)&&(curSize==0)){
661
- return _TOutStreamCache_write(self,data,dataSize);
662
- }
663
- copyLen=self->cacheEnd-curSize;
664
- copyLen=(copyLen<=dataSize)?copyLen:dataSize;
665
- memcpy(self->cacheBuf+curSize,data,copyLen);
666
- self->cacheCur=curSize+copyLen;
667
- data+=copyLen;
668
- dataSize-=copyLen;
669
- if (self->cacheCur==self->cacheEnd){
670
- if (!TOutStreamCache_flush(self)) return _hpatch_FALSE;
671
- }
672
- }
673
- return hpatch_TRUE;
674
- }
675
-
676
-
677
- static hpatch_BOOL _patch_copy_diff_by_outCache(TOutStreamCache* outCache,TStreamCacheClip* diff,hpatch_StreamPos_t copyLength){
678
- while (copyLength>0){
679
- const TByte* data;
680
- hpatch_size_t decodeStep=diff->cacheEnd;
681
- if (decodeStep>copyLength)
682
- decodeStep=(hpatch_size_t)copyLength;
683
- data=_TStreamCacheClip_readData(diff,decodeStep);
684
- if (data==0) return _hpatch_FALSE;
685
- if (!TOutStreamCache_write(outCache,data,decodeStep))
686
- return _hpatch_FALSE;
687
- copyLength-=decodeStep;
688
- }
689
- return hpatch_TRUE;
690
- }
691
-
692
-
693
- typedef struct _TBytesRle_load_stream{
694
- hpatch_StreamPos_t memCopyLength;
695
- hpatch_StreamPos_t memSetLength;
696
- TByte memSetValue;
697
- TStreamCacheClip ctrlClip;
698
- TStreamCacheClip rleCodeClip;
699
- } _TBytesRle_load_stream;
700
-
701
- hpatch_inline
702
- static void _TBytesRle_load_stream_init(_TBytesRle_load_stream* loader){
703
- loader->memSetLength=0;
704
- loader->memSetValue=0;//nil;
705
- loader->memCopyLength=0;
706
- _TStreamCacheClip_init(&loader->ctrlClip,0,0,0,0,0);
707
- _TStreamCacheClip_init(&loader->rleCodeClip,0,0,0,0,0);
708
- }
709
-
710
- #if (_IS_NEED_MIN_CODE_SIZE)
711
- hpatch_inline static void memSet_add(TByte* dst,const TByte src,hpatch_size_t length){
712
- while (length--) { *dst++ += src; }
713
- }
714
- #else
715
- static void memSet_add(TByte* dst,const TByte src,hpatch_size_t length){
716
- hpatch_size_t length_fast,i;
717
-
718
- length_fast=length&(~(hpatch_size_t)7);
719
- for (i=0;i<length_fast;i+=8){
720
- dst[i ]+=src;
721
- dst[i+1]+=src;
722
- dst[i+2]+=src;
723
- dst[i+3]+=src;
724
- dst[i+4]+=src;
725
- dst[i+5]+=src;
726
- dst[i+6]+=src;
727
- dst[i+7]+=src;
728
- }
729
- for (;i<length;++i)
730
- dst[i]+=src;
731
- }
732
- #endif
733
-
734
- static hpatch_BOOL _TBytesRle_load_stream_mem_add(_TBytesRle_load_stream* loader,
735
- hpatch_size_t* _decodeSize,TByte** _out_data){
736
- hpatch_size_t decodeSize=*_decodeSize;
737
- TByte* out_data=*_out_data;
738
- TStreamCacheClip* rleCodeClip=&loader->rleCodeClip;
739
-
740
- hpatch_StreamPos_t memSetLength=loader->memSetLength;
741
- if (memSetLength!=0){
742
- hpatch_size_t memSetStep=((memSetLength<=decodeSize)?(hpatch_size_t)memSetLength:decodeSize);
743
- const TByte byteSetValue=loader->memSetValue;
744
- if (out_data!=0){
745
- if (byteSetValue!=0)
746
- memSet_add(out_data,byteSetValue,memSetStep);
747
- out_data+=memSetStep;
748
- }
749
- decodeSize-=memSetStep;
750
- loader->memSetLength=memSetLength-memSetStep;
751
- }
752
- while ((loader->memCopyLength>0)&&(decodeSize>0)) {
753
- TByte* rleData;
754
- hpatch_size_t decodeStep=rleCodeClip->cacheEnd;
755
- if (decodeStep>loader->memCopyLength)
756
- decodeStep=(hpatch_size_t)loader->memCopyLength;
757
- if (decodeStep>decodeSize)
758
- decodeStep=decodeSize;
759
- rleData=_TStreamCacheClip_readData(rleCodeClip,decodeStep);
760
- if (rleData==0) return _hpatch_FALSE;
761
- if (out_data){
762
- addData(out_data,rleData,decodeStep);
763
- out_data+=decodeStep;
764
- }
765
- decodeSize-=decodeStep;
766
- loader->memCopyLength-=decodeStep;
767
- }
768
- *_decodeSize=decodeSize;
769
- *_out_data=out_data;
770
- return hpatch_TRUE;
771
- }
772
-
773
- hpatch_inline
774
- static hpatch_BOOL _TBytesRle_load_stream_isFinish(const _TBytesRle_load_stream* loader){
775
- return(loader->memSetLength==0)
776
- &&(loader->memCopyLength==0)
777
- &&(_TStreamCacheClip_isFinish(&loader->rleCodeClip))
778
- &&(_TStreamCacheClip_isFinish(&loader->ctrlClip));
779
- }
780
-
781
-
782
-
783
- #define _clip_unpackUIntWithTagTo(puint,sclip,kTagBit) \
784
- { if (!_TStreamCacheClip_unpackUIntWithTag(sclip,puint,kTagBit)) return _hpatch_FALSE; }
785
- #define _clip_unpackUIntTo(puint,sclip) _clip_unpackUIntWithTagTo(puint,sclip,0)
786
-
787
- static hpatch_BOOL _TBytesRle_load_stream_decode_add(_TBytesRle_load_stream* loader,
788
- TByte* out_data,hpatch_size_t decodeSize){
789
- if (!_TBytesRle_load_stream_mem_add(loader,&decodeSize,&out_data))
790
- return _hpatch_FALSE;
791
-
792
- while ((decodeSize>0)&&(!_TStreamCacheClip_isFinish(&loader->ctrlClip))){
793
- enum TByteRleType type;
794
- hpatch_StreamPos_t length;
795
- const TByte* pType=_TStreamCacheClip_accessData(&loader->ctrlClip,1);
796
- if (pType==0) return _hpatch_FALSE;
797
- type=(enum TByteRleType)((*pType)>>(8-kByteRleType_bit));
798
- _clip_unpackUIntWithTagTo(&length,&loader->ctrlClip,kByteRleType_bit);
799
- ++length;
800
- switch (type){
801
- case kByteRleType_rle0:{
802
- loader->memSetLength=length;
803
- loader->memSetValue=0;
804
- }break;
805
- case kByteRleType_rle255:{
806
- loader->memSetLength=length;
807
- loader->memSetValue=255;
808
- }break;
809
- case kByteRleType_rle:{
810
- const TByte* pSetValue=_TStreamCacheClip_readData(&loader->rleCodeClip,1);
811
- if (pSetValue==0) return _hpatch_FALSE;
812
- loader->memSetValue=*pSetValue;
813
- loader->memSetLength=length;
814
- }break;
815
- case kByteRleType_unrle:{
816
- loader->memCopyLength=length;
817
- }break;
818
- }
819
- if (!_TBytesRle_load_stream_mem_add(loader,&decodeSize,&out_data)) return _hpatch_FALSE;
820
- }
821
-
822
- if (decodeSize==0)
823
- return hpatch_TRUE;
824
- else
825
- return _hpatch_FALSE;
826
- }
827
-
828
- #define _TBytesRle_load_stream_decode_skip(loader,decodeSize) \
829
- _TBytesRle_load_stream_decode_add(loader,0,decodeSize)
830
-
831
- static hpatch_BOOL _patch_add_old_with_rle(TOutStreamCache* outCache,_TBytesRle_load_stream* rle_loader,
832
- const hpatch_TStreamInput* old,hpatch_StreamPos_t oldPos,
833
- hpatch_StreamPos_t addLength,TByte* aCache,hpatch_size_t aCacheSize){
834
- while (addLength>0){
835
- hpatch_size_t decodeStep=aCacheSize;
836
- if (decodeStep>addLength)
837
- decodeStep=(hpatch_size_t)addLength;
838
- if (!old->read(old,oldPos,aCache,aCache+decodeStep)) return _hpatch_FALSE;
839
- if (!_TBytesRle_load_stream_decode_add(rle_loader,aCache,decodeStep)) return _hpatch_FALSE;
840
- if (!TOutStreamCache_write(outCache,aCache,decodeStep)) return _hpatch_FALSE;
841
- oldPos+=decodeStep;
842
- addLength-=decodeStep;
843
- }
844
- return hpatch_TRUE;
845
- }
846
-
847
- typedef struct _TCovers{
848
- hpatch_TCovers ICovers;
849
- hpatch_StreamPos_t coverCount;
850
- hpatch_StreamPos_t oldPosBack;
851
- hpatch_StreamPos_t newPosBack;
852
- TStreamCacheClip* code_inc_oldPosClip;
853
- TStreamCacheClip* code_inc_newPosClip;
854
- TStreamCacheClip* code_lengthsClip;
855
- hpatch_BOOL isOldPosBackNeedAddLength;
856
- } _TCovers;
857
-
858
- static hpatch_StreamPos_t _covers_leaveCoverCount(const hpatch_TCovers* covers){
859
- const _TCovers* self=(const _TCovers*)covers;
860
- return self->coverCount;
861
- }
862
- static hpatch_BOOL _covers_close_nil(hpatch_TCovers* covers){
863
- //empty
864
- return hpatch_TRUE;
865
- }
866
-
867
- static hpatch_BOOL _covers_read_cover(hpatch_TCovers* covers,hpatch_TCover* out_cover){
868
- _TCovers* self=(_TCovers*)covers;
869
- hpatch_StreamPos_t oldPosBack=self->oldPosBack;
870
- hpatch_StreamPos_t newPosBack=self->newPosBack;
871
- hpatch_StreamPos_t coverCount=self->coverCount;
872
- if (coverCount>0)
873
- self->coverCount=coverCount-1;
874
- else
875
- return _hpatch_FALSE;
876
-
877
- {
878
- hpatch_StreamPos_t copyLength,coverLength, oldPos,inc_oldPos;
879
- TByte inc_oldPos_sign;
880
- const TByte* pSign=_TStreamCacheClip_accessData(self->code_inc_oldPosClip,1);
881
- if (pSign)
882
- inc_oldPos_sign=(*pSign)>>(8-kSignTagBit);
883
- else
884
- return _hpatch_FALSE;
885
- _clip_unpackUIntWithTagTo(&inc_oldPos,self->code_inc_oldPosClip,kSignTagBit);
886
- oldPos=(inc_oldPos_sign==0)?(oldPosBack+inc_oldPos):(oldPosBack-inc_oldPos);
887
- _clip_unpackUIntTo(&copyLength,self->code_inc_newPosClip);
888
- _clip_unpackUIntTo(&coverLength,self->code_lengthsClip);
889
- newPosBack+=copyLength;
890
- oldPosBack=oldPos;
891
- oldPosBack+=(self->isOldPosBackNeedAddLength)?coverLength:0;
892
-
893
- out_cover->oldPos=oldPos;
894
- out_cover->newPos=newPosBack;
895
- out_cover->length=coverLength;
896
- newPosBack+=coverLength;
897
- }
898
- self->oldPosBack=oldPosBack;
899
- self->newPosBack=newPosBack;
900
- return hpatch_TRUE;
901
- }
902
-
903
- static hpatch_BOOL _covers_is_finish(const struct hpatch_TCovers* covers){
904
- _TCovers* self=(_TCovers*)covers;
905
- return _TStreamCacheClip_isFinish(self->code_lengthsClip)
906
- && _TStreamCacheClip_isFinish(self->code_inc_newPosClip)
907
- && _TStreamCacheClip_isFinish(self->code_inc_oldPosClip);
908
- }
909
-
910
-
911
- static void _covers_init(_TCovers* covers,hpatch_StreamPos_t coverCount,
912
- TStreamCacheClip* code_inc_oldPosClip,
913
- TStreamCacheClip* code_inc_newPosClip,
914
- TStreamCacheClip* code_lengthsClip,
915
- hpatch_BOOL isOldPosBackNeedAddLength){
916
- covers->ICovers.leave_cover_count=_covers_leaveCoverCount;
917
- covers->ICovers.read_cover=_covers_read_cover;
918
- covers->ICovers.is_finish=_covers_is_finish;
919
- covers->ICovers.close=_covers_close_nil;
920
- covers->coverCount=coverCount;
921
- covers->newPosBack=0;
922
- covers->oldPosBack=0;
923
- covers->code_inc_oldPosClip=code_inc_oldPosClip;
924
- covers->code_inc_newPosClip=code_inc_newPosClip;
925
- covers->code_lengthsClip=code_lengthsClip;
926
- covers->isOldPosBackNeedAddLength=isOldPosBackNeedAddLength;
927
- }
928
-
929
- static hpatch_BOOL _rle_decode_skip(struct _TBytesRle_load_stream* rle_loader,hpatch_StreamPos_t copyLength){
930
- while (copyLength>0) {
931
- hpatch_size_t len=(~(hpatch_size_t)0);
932
- if (len>copyLength)
933
- len=(hpatch_size_t)copyLength;
934
- if (!_TBytesRle_load_stream_decode_skip(rle_loader,len)) return _hpatch_FALSE;
935
- copyLength-=len;
936
- }
937
- return hpatch_TRUE;
938
- }
939
-
940
- static hpatch_BOOL patchByClip(const hpatch_TStreamOutput* out_newData,
941
- const hpatch_TStreamInput* oldData,
942
- hpatch_TCovers* covers,
943
- TStreamCacheClip* code_newDataDiffClip,
944
- struct _TBytesRle_load_stream* rle_loader,
945
- TByte* temp_cache,hpatch_size_t cache_size){
946
- const hpatch_StreamPos_t newDataSize=out_newData->streamSize;
947
- const hpatch_StreamPos_t oldDataSize=oldData->streamSize;
948
- hpatch_StreamPos_t coverCount=covers->leave_cover_count(covers);
949
- TOutStreamCache outCache;
950
- hpatch_StreamPos_t newPosBack=0;
951
- assert(cache_size>=hpatch_kMaxPackedUIntBytes);
952
- TOutStreamCache_init(&outCache,out_newData,temp_cache+cache_size,cache_size);
953
-
954
- while (coverCount--){
955
- hpatch_TCover cover;
956
- if(!covers->read_cover(covers,&cover)) return _hpatch_FALSE;
957
- #ifdef __RUN_MEM_SAFE_CHECK
958
- if (cover.newPos>newDataSize) return _hpatch_FALSE;
959
- if (cover.length>(hpatch_StreamPos_t)(newDataSize-cover.newPos)) return _hpatch_FALSE;
960
- if (cover.oldPos>oldDataSize) return _hpatch_FALSE;
961
- if (cover.length>(hpatch_StreamPos_t)(oldDataSize-cover.oldPos)) return _hpatch_FALSE;
962
- if (cover.newPos<newPosBack) return _hpatch_FALSE;
963
- #endif
964
- if (newPosBack<cover.newPos){
965
- hpatch_StreamPos_t copyLength=cover.newPos-newPosBack;
966
- if (!_patch_copy_diff_by_outCache(&outCache,code_newDataDiffClip,copyLength)) return _hpatch_FALSE;
967
- if (!_rle_decode_skip(rle_loader,copyLength)) return _hpatch_FALSE;
968
- }
969
- if (!_patch_add_old_with_rle(&outCache,rle_loader,oldData,cover.oldPos,cover.length,
970
- temp_cache,cache_size)) return _hpatch_FALSE;
971
- newPosBack=cover.newPos+cover.length;
972
- }
973
-
974
- if (newPosBack<newDataSize){
975
- hpatch_StreamPos_t copyLength=newDataSize-newPosBack;
976
- if (!_patch_copy_diff_by_outCache(&outCache,code_newDataDiffClip,copyLength)) return _hpatch_FALSE;
977
- if (!_rle_decode_skip(rle_loader,copyLength)) return _hpatch_FALSE;
978
- newPosBack=newDataSize;
979
- }
980
- if (!TOutStreamCache_flush(&outCache))
981
- return _hpatch_FALSE;
982
- if ( _TBytesRle_load_stream_isFinish(rle_loader)
983
- && covers->is_finish(covers)
984
- && TOutStreamCache_isFinish(&outCache)
985
- && _TStreamCacheClip_isFinish(code_newDataDiffClip)
986
- && (newPosBack==newDataSize) )
987
- return hpatch_TRUE;
988
- else
989
- return _hpatch_FALSE;
990
- }
991
-
992
-
993
- #define _kCachePatCount 8
994
-
995
- #define _cache_alloc(dst,dst_type,memSize,temp_cache,temp_cache_end){ \
996
- if ((hpatch_size_t)(temp_cache_end-temp_cache) < \
997
- sizeof(hpatch_StreamPos_t)+(memSize)) return hpatch_FALSE; \
998
- (dst)=(dst_type*)_hpatch_align_upper(temp_cache,sizeof(hpatch_StreamPos_t));\
999
- temp_cache=(TByte*)(dst)+(hpatch_size_t)(memSize); \
1000
- }
1001
-
1002
- typedef struct _TPackedCovers{
1003
- _TCovers base;
1004
- TStreamCacheClip code_inc_oldPosClip;
1005
- TStreamCacheClip code_inc_newPosClip;
1006
- TStreamCacheClip code_lengthsClip;
1007
- } _TPackedCovers;
1008
-
1009
- typedef struct _THDiffHead{
1010
- hpatch_StreamPos_t coverCount;
1011
- hpatch_StreamPos_t lengthSize;
1012
- hpatch_StreamPos_t inc_newPosSize;
1013
- hpatch_StreamPos_t inc_oldPosSize;
1014
- hpatch_StreamPos_t newDataDiffSize;
1015
- hpatch_StreamPos_t headEndPos;
1016
- hpatch_StreamPos_t coverEndPos;
1017
- } _THDiffHead;
1018
-
1019
- static hpatch_BOOL read_diff_head(_THDiffHead* out_diffHead,
1020
- const hpatch_TStreamInput* serializedDiff){
1021
- hpatch_StreamPos_t diffPos0;
1022
- const hpatch_StreamPos_t diffPos_end=serializedDiff->streamSize;
1023
- TByte temp_cache[hpatch_kStreamCacheSize];
1024
- TStreamCacheClip diffHeadClip;
1025
- _TStreamCacheClip_init(&diffHeadClip,serializedDiff,0,diffPos_end,temp_cache,hpatch_kStreamCacheSize);
1026
- _clip_unpackUIntTo(&out_diffHead->coverCount,&diffHeadClip);
1027
- _clip_unpackUIntTo(&out_diffHead->lengthSize,&diffHeadClip);
1028
- _clip_unpackUIntTo(&out_diffHead->inc_newPosSize,&diffHeadClip);
1029
- _clip_unpackUIntTo(&out_diffHead->inc_oldPosSize,&diffHeadClip);
1030
- _clip_unpackUIntTo(&out_diffHead->newDataDiffSize,&diffHeadClip);
1031
- diffPos0=(hpatch_StreamPos_t)(_TStreamCacheClip_readPosOfSrcStream(&diffHeadClip));
1032
- out_diffHead->headEndPos=diffPos0;
1033
- #ifdef __RUN_MEM_SAFE_CHECK
1034
- if (out_diffHead->lengthSize>(hpatch_StreamPos_t)(diffPos_end-diffPos0)) return _hpatch_FALSE;
1035
- #endif
1036
- diffPos0+=out_diffHead->lengthSize;
1037
- #ifdef __RUN_MEM_SAFE_CHECK
1038
- if (out_diffHead->inc_newPosSize>(hpatch_StreamPos_t)(diffPos_end-diffPos0)) return _hpatch_FALSE;
1039
- #endif
1040
- diffPos0+=out_diffHead->inc_newPosSize;
1041
- #ifdef __RUN_MEM_SAFE_CHECK
1042
- if (out_diffHead->inc_oldPosSize>(hpatch_StreamPos_t)(diffPos_end-diffPos0)) return _hpatch_FALSE;
1043
- #endif
1044
- diffPos0+=out_diffHead->inc_oldPosSize;
1045
- out_diffHead->coverEndPos=diffPos0;
1046
- #ifdef __RUN_MEM_SAFE_CHECK
1047
- if (out_diffHead->newDataDiffSize>(hpatch_StreamPos_t)(diffPos_end-diffPos0)) return _hpatch_FALSE;
1048
- #endif
1049
- return hpatch_TRUE;
1050
- }
1051
-
1052
- static hpatch_BOOL _packedCovers_open(_TPackedCovers** out_self,
1053
- _THDiffHead* out_diffHead,
1054
- const hpatch_TStreamInput* serializedDiff,
1055
- TByte* temp_cache,TByte* temp_cache_end){
1056
- hpatch_size_t cacheSize;
1057
- _TPackedCovers* self=0;
1058
- _cache_alloc(self,_TPackedCovers,sizeof(_TPackedCovers),temp_cache,temp_cache_end);
1059
- cacheSize=(temp_cache_end-temp_cache)/3;
1060
- {
1061
- hpatch_StreamPos_t diffPos0;
1062
- if (!read_diff_head(out_diffHead,serializedDiff)) return _hpatch_FALSE;
1063
- diffPos0=out_diffHead->headEndPos;
1064
- _TStreamCacheClip_init(&self->code_lengthsClip,serializedDiff,diffPos0,
1065
- diffPos0+out_diffHead->lengthSize,temp_cache,cacheSize);
1066
- diffPos0+=out_diffHead->lengthSize;
1067
- _TStreamCacheClip_init(&self->code_inc_newPosClip,serializedDiff,diffPos0,
1068
- diffPos0+out_diffHead->inc_newPosSize,temp_cache+cacheSize*1,cacheSize);
1069
- diffPos0+=out_diffHead->inc_newPosSize;
1070
- _TStreamCacheClip_init(&self->code_inc_oldPosClip,serializedDiff,diffPos0,
1071
- diffPos0+out_diffHead->inc_oldPosSize,temp_cache+cacheSize*2,cacheSize);
1072
- }
1073
-
1074
- _covers_init(&self->base,out_diffHead->coverCount,&self->code_inc_oldPosClip,
1075
- &self->code_inc_newPosClip,&self->code_lengthsClip,hpatch_FALSE);
1076
- *out_self=self;
1077
- return hpatch_TRUE;
1078
- }
1079
-
1080
- static hpatch_BOOL _patch_stream_with_cache(const hpatch_TStreamOutput* out_newData,
1081
- const hpatch_TStreamInput* oldData,
1082
- const hpatch_TStreamInput* serializedDiff,
1083
- hpatch_TCovers* cached_covers,
1084
- TByte* temp_cache,TByte* temp_cache_end){
1085
- struct _THDiffHead diffHead;
1086
- TStreamCacheClip code_newDataDiffClip;
1087
- struct _TBytesRle_load_stream rle_loader;
1088
- hpatch_TCovers* pcovers=0;
1089
- hpatch_StreamPos_t diffPos0;
1090
- const hpatch_StreamPos_t diffPos_end=serializedDiff->streamSize;
1091
- const hpatch_size_t cacheSize=(temp_cache_end-temp_cache)/(cached_covers?(_kCachePatCount-3):_kCachePatCount);
1092
-
1093
- assert(out_newData!=0);
1094
- assert(out_newData->write!=0);
1095
- assert(oldData!=0);
1096
- assert(oldData->read!=0);
1097
- assert(serializedDiff!=0);
1098
- assert(serializedDiff->read!=0);
1099
-
1100
- //covers
1101
- if (cached_covers==0){
1102
- struct _TPackedCovers* packedCovers;
1103
- if (!_packedCovers_open(&packedCovers,&diffHead,serializedDiff,temp_cache+cacheSize*(_kCachePatCount-3),
1104
- temp_cache_end)) return _hpatch_FALSE;
1105
- pcovers=&packedCovers->base.ICovers; //not need close before return
1106
- }else{
1107
- pcovers=cached_covers;
1108
- if (!read_diff_head(&diffHead,serializedDiff)) return _hpatch_FALSE;
1109
- }
1110
- //newDataDiff
1111
- diffPos0=diffHead.coverEndPos;
1112
- _TStreamCacheClip_init(&code_newDataDiffClip,serializedDiff,diffPos0,
1113
- diffPos0+diffHead.newDataDiffSize,temp_cache+cacheSize*0,cacheSize);
1114
- diffPos0+=diffHead.newDataDiffSize;
1115
-
1116
- {//rle
1117
- hpatch_StreamPos_t rleCtrlSize;
1118
- hpatch_StreamPos_t rlePos0;
1119
- TStreamCacheClip* rleHeadClip=&rle_loader.ctrlClip;//rename, share address
1120
- #ifdef __RUN_MEM_SAFE_CHECK
1121
- if (cacheSize<hpatch_kMaxPackedUIntBytes) return _hpatch_FALSE;
1122
- #endif
1123
- _TStreamCacheClip_init(rleHeadClip,serializedDiff,diffPos0,diffPos_end,
1124
- temp_cache+cacheSize*1,hpatch_kMaxPackedUIntBytes);
1125
- _clip_unpackUIntTo(&rleCtrlSize,rleHeadClip);
1126
- rlePos0=(hpatch_StreamPos_t)(_TStreamCacheClip_readPosOfSrcStream(rleHeadClip));
1127
- #ifdef __RUN_MEM_SAFE_CHECK
1128
- if (rleCtrlSize>(hpatch_StreamPos_t)(diffPos_end-rlePos0)) return _hpatch_FALSE;
1129
- #endif
1130
- _TBytesRle_load_stream_init(&rle_loader);
1131
- _TStreamCacheClip_init(&rle_loader.ctrlClip,serializedDiff,rlePos0,rlePos0+rleCtrlSize,
1132
- temp_cache+cacheSize*1,cacheSize);
1133
- _TStreamCacheClip_init(&rle_loader.rleCodeClip,serializedDiff,rlePos0+rleCtrlSize,diffPos_end,
1134
- temp_cache+cacheSize*2,cacheSize);
1135
- }
1136
-
1137
- return patchByClip(out_newData,oldData,pcovers,&code_newDataDiffClip,
1138
- &rle_loader,temp_cache+cacheSize*3,cacheSize);
1139
- }
1140
-
1141
-
1142
- hpatch_BOOL read_diffz_head(hpatch_compressedDiffInfo* out_diffInfo,_THDiffzHead* out_head,
1143
- const hpatch_TStreamInput* compressedDiff){
1144
- TStreamCacheClip _diffHeadClip;
1145
- TStreamCacheClip* diffHeadClip=&_diffHeadClip;
1146
- TByte temp_cache[hpatch_kStreamCacheSize];
1147
- _TStreamCacheClip_init(&_diffHeadClip,compressedDiff,0,compressedDiff->streamSize,
1148
- temp_cache,hpatch_kStreamCacheSize);
1149
- {//type
1150
- const char* kVersionType="HDIFF13";
1151
- char* tempType=out_diffInfo->compressType;
1152
- if (!_TStreamCacheClip_readType_end(diffHeadClip,'&',tempType)) return _hpatch_FALSE;
1153
- if (0!=strcmp(tempType,kVersionType)) return _hpatch_FALSE;
1154
- }
1155
- {//read compressType
1156
- if (!_TStreamCacheClip_readType_end(diffHeadClip,'\0',
1157
- out_diffInfo->compressType)) return _hpatch_FALSE;
1158
- out_head->typesEndPos=_TStreamCacheClip_readPosOfSrcStream(diffHeadClip);
1159
- }
1160
- _clip_unpackUIntTo(&out_diffInfo->newDataSize,diffHeadClip);
1161
- _clip_unpackUIntTo(&out_diffInfo->oldDataSize,diffHeadClip);
1162
- _clip_unpackUIntTo(&out_head->coverCount,diffHeadClip);
1163
- out_head->compressSizeBeginPos=_TStreamCacheClip_readPosOfSrcStream(diffHeadClip);
1164
- _clip_unpackUIntTo(&out_head->cover_buf_size,diffHeadClip);
1165
- _clip_unpackUIntTo(&out_head->compress_cover_buf_size,diffHeadClip);
1166
- _clip_unpackUIntTo(&out_head->rle_ctrlBuf_size,diffHeadClip);
1167
- _clip_unpackUIntTo(&out_head->compress_rle_ctrlBuf_size,diffHeadClip);
1168
- _clip_unpackUIntTo(&out_head->rle_codeBuf_size,diffHeadClip);
1169
- _clip_unpackUIntTo(&out_head->compress_rle_codeBuf_size,diffHeadClip);
1170
- _clip_unpackUIntTo(&out_head->newDataDiff_size,diffHeadClip);
1171
- _clip_unpackUIntTo(&out_head->compress_newDataDiff_size,diffHeadClip);
1172
- out_head->headEndPos=_TStreamCacheClip_readPosOfSrcStream(diffHeadClip);
1173
-
1174
- out_diffInfo->compressedCount=((out_head->compress_cover_buf_size)?1:0)
1175
- +((out_head->compress_rle_ctrlBuf_size)?1:0)
1176
- +((out_head->compress_rle_codeBuf_size)?1:0)
1177
- +((out_head->compress_newDataDiff_size)?1:0);
1178
- if (out_head->compress_cover_buf_size>0)
1179
- out_head->coverEndPos=out_head->headEndPos+out_head->compress_cover_buf_size;
1180
- else
1181
- out_head->coverEndPos=out_head->headEndPos+out_head->cover_buf_size;
1182
- return hpatch_TRUE;
1183
- }
1184
-
1185
- hpatch_BOOL getCompressedDiffInfo(hpatch_compressedDiffInfo* out_diffInfo,
1186
- const hpatch_TStreamInput* compressedDiff){
1187
- _THDiffzHead head;
1188
- assert(out_diffInfo!=0);
1189
- assert(compressedDiff!=0);
1190
- assert(compressedDiff->read!=0);
1191
- return read_diffz_head(out_diffInfo,&head,compressedDiff);
1192
- }
1193
-
1194
- #define _clear_return(exitValue) { result=exitValue; goto clear; }
1195
-
1196
- #define _kCacheDecCount 6
1197
-
1198
- static
1199
- hpatch_BOOL _patch_decompress_cache(const hpatch_TStreamOutput* out_newData,
1200
- hpatch_TStreamInput* once_in_newData,
1201
- const hpatch_TStreamInput* oldData,
1202
- const hpatch_TStreamInput* compressedDiff,
1203
- hpatch_TDecompress* decompressPlugin,
1204
- hpatch_TCovers* cached_covers,
1205
- TByte* temp_cache, TByte* temp_cache_end){
1206
- TStreamCacheClip coverClip;
1207
- TStreamCacheClip code_newDataDiffClip;
1208
- struct _TBytesRle_load_stream rle_loader;
1209
- _THDiffzHead head;
1210
- hpatch_compressedDiffInfo diffInfo;
1211
- _TDecompressInputStream decompressers[4];
1212
- hpatch_uint i;
1213
- hpatch_StreamPos_t coverCount;
1214
- hpatch_BOOL result=hpatch_TRUE;
1215
- hpatch_StreamPos_t diffPos0=0;
1216
- const hpatch_StreamPos_t diffPos_end=compressedDiff->streamSize;
1217
- const hpatch_size_t cacheSize=(temp_cache_end-temp_cache)/(cached_covers?(_kCacheDecCount-1):_kCacheDecCount);
1218
- if (cacheSize<=hpatch_kMaxPluginTypeLength) return _hpatch_FALSE;
1219
- assert(out_newData!=0);
1220
- assert(out_newData->write!=0);
1221
- assert(oldData!=0);
1222
- assert(oldData->read!=0);
1223
- assert(compressedDiff!=0);
1224
- assert(compressedDiff->read!=0);
1225
- {//head
1226
- if (!read_diffz_head(&diffInfo,&head,compressedDiff)) return _hpatch_FALSE;
1227
- if ((diffInfo.oldDataSize!=oldData->streamSize)
1228
- ||(diffInfo.newDataSize!=out_newData->streamSize)) return _hpatch_FALSE;
1229
-
1230
- if ((decompressPlugin==0)&&(diffInfo.compressedCount!=0)) return _hpatch_FALSE;
1231
- if ((decompressPlugin)&&(diffInfo.compressedCount>0))
1232
- if (!decompressPlugin->is_can_open(diffInfo.compressType)) return _hpatch_FALSE;
1233
- diffPos0=head.headEndPos;
1234
- }
1235
-
1236
- for (i=0;i<sizeof(decompressers)/sizeof(_TDecompressInputStream);++i)
1237
- decompressers[i].decompressHandle=0;
1238
- _TBytesRle_load_stream_init(&rle_loader);
1239
-
1240
- if (cached_covers){
1241
- diffPos0=head.coverEndPos;
1242
- }else{
1243
- if (!getStreamClip(&coverClip,&decompressers[0],
1244
- head.cover_buf_size,head.compress_cover_buf_size,compressedDiff,&diffPos0,
1245
- decompressPlugin,temp_cache+cacheSize*(_kCacheDecCount-1),cacheSize)) _clear_return(_hpatch_FALSE);
1246
- }
1247
- if (!getStreamClip(&rle_loader.ctrlClip,&decompressers[1],
1248
- head.rle_ctrlBuf_size,head.compress_rle_ctrlBuf_size,compressedDiff,&diffPos0,
1249
- decompressPlugin,temp_cache+cacheSize*0,cacheSize)) _clear_return(_hpatch_FALSE);
1250
- if (!getStreamClip(&rle_loader.rleCodeClip,&decompressers[2],
1251
- head.rle_codeBuf_size,head.compress_rle_codeBuf_size,compressedDiff,&diffPos0,
1252
- decompressPlugin,temp_cache+cacheSize*1,cacheSize)) _clear_return(_hpatch_FALSE);
1253
- if (!getStreamClip(&code_newDataDiffClip,&decompressers[3],
1254
- head.newDataDiff_size,head.compress_newDataDiff_size,compressedDiff,&diffPos0,
1255
- decompressPlugin,temp_cache+cacheSize*2,cacheSize)) _clear_return(_hpatch_FALSE);
1256
- #ifdef __RUN_MEM_SAFE_CHECK
1257
- if (diffPos0!=diffPos_end) _clear_return(_hpatch_FALSE);
1258
- #endif
1259
-
1260
- coverCount=head.coverCount;
1261
- {
1262
- _TCovers covers;
1263
- hpatch_TCovers* pcovers=0;
1264
- if (cached_covers){
1265
- pcovers=cached_covers;
1266
- }else{
1267
- _covers_init(&covers,coverCount,&coverClip,&coverClip,&coverClip,hpatch_TRUE);
1268
- pcovers=&covers.ICovers; //not need close before return
1269
- }
1270
- result=patchByClip(out_newData,oldData,pcovers,&code_newDataDiffClip,&rle_loader,
1271
- temp_cache+cacheSize*3,cacheSize);
1272
- //if ((pcovers!=cached_covers)&&(!pcovers->close(pcovers))) result=_hpatch_FALSE;
1273
- }
1274
- clear:
1275
- for (i=0;i<sizeof(decompressers)/sizeof(_TDecompressInputStream);++i) {
1276
- if (decompressers[i].decompressHandle){
1277
- if (!decompressPlugin->close(decompressPlugin,decompressers[i].decompressHandle))
1278
- result=_hpatch_FALSE;
1279
- decompressers[i].decompressHandle=0;
1280
- }
1281
- }
1282
- return result;
1283
- }
1284
-
1285
-
1286
- hpatch_inline static hpatch_BOOL _cache_load_all(const hpatch_TStreamInput* data,
1287
- TByte* cache,TByte* cache_end){
1288
- assert((hpatch_size_t)(cache_end-cache)==data->streamSize);
1289
- return data->read(data,0,cache,cache_end);
1290
- }
1291
-
1292
- typedef struct _TCompressedCovers{
1293
- _TCovers base;
1294
- TStreamCacheClip coverClip;
1295
- _TDecompressInputStream decompresser;
1296
- } _TCompressedCovers;
1297
-
1298
- static hpatch_BOOL _compressedCovers_close(hpatch_TCovers* covers){
1299
- hpatch_BOOL result=hpatch_TRUE;
1300
- _TCompressedCovers* self=(_TCompressedCovers*)covers;
1301
- if (self){
1302
- if (self->decompresser.decompressHandle){
1303
- result=self->decompresser.decompressPlugin->close(self->decompresser.decompressPlugin,
1304
- self->decompresser.decompressHandle);
1305
- self->decompresser.decompressHandle=0;
1306
- }
1307
- }
1308
- return result;
1309
- }
1310
-
1311
- static hpatch_BOOL _compressedCovers_open(_TCompressedCovers** out_self,
1312
- hpatch_compressedDiffInfo* out_diffInfo,
1313
- const hpatch_TStreamInput* compressedDiff,
1314
- hpatch_TDecompress* decompressPlugin,
1315
- TByte* temp_cache,TByte* temp_cache_end){
1316
- _THDiffzHead head;
1317
- hpatch_StreamPos_t diffPos0=0;
1318
- _TCompressedCovers* self=0;
1319
- _cache_alloc(self,_TCompressedCovers,sizeof(_TCompressedCovers),temp_cache,temp_cache_end);
1320
- if (!read_diffz_head(out_diffInfo,&head,compressedDiff)) return _hpatch_FALSE;
1321
- diffPos0=head.headEndPos;
1322
- if (head.compress_cover_buf_size>0){
1323
- if (decompressPlugin==0) return _hpatch_FALSE;
1324
- if (!decompressPlugin->is_can_open(out_diffInfo->compressType)) return _hpatch_FALSE;
1325
- }
1326
-
1327
- _covers_init(&self->base,head.coverCount,&self->coverClip,
1328
- &self->coverClip,&self->coverClip,hpatch_TRUE);
1329
- self->base.ICovers.close=_compressedCovers_close;
1330
- memset(&self->decompresser,0, sizeof(self->decompresser));
1331
- if (!getStreamClip(&self->coverClip,&self->decompresser,
1332
- head.cover_buf_size,head.compress_cover_buf_size,
1333
- compressedDiff,&diffPos0,decompressPlugin,
1334
- temp_cache,temp_cache_end-temp_cache)) {
1335
- return _hpatch_FALSE;
1336
- };
1337
- *out_self=self;
1338
- return hpatch_TRUE;
1339
- }
1340
-
1341
- #if (_IS_NEED_CACHE_OLD_BY_COVERS)
1342
-
1343
- typedef struct _TArrayCovers{
1344
- hpatch_TCovers ICovers;
1345
- void* pCCovers;
1346
- hpatch_size_t coverCount;
1347
- hpatch_size_t cur_index;
1348
- hpatch_BOOL is32;
1349
- } _TArrayCovers;
1350
-
1351
-
1352
- typedef struct hpatch_TCCover32{
1353
- hpatch_uint32_t oldPos;
1354
- hpatch_uint32_t newPos;
1355
- hpatch_uint32_t length;
1356
- hpatch_uint32_t cachePos; //todo:放到临时内存中,用完释放?逻辑会比较复杂;
1357
- } hpatch_TCCover32;
1358
-
1359
- typedef struct hpatch_TCCover64{
1360
- hpatch_StreamPos_t oldPos;
1361
- hpatch_StreamPos_t newPos;
1362
- hpatch_StreamPos_t length;
1363
- hpatch_StreamPos_t cachePos;
1364
- } hpatch_TCCover64;
1365
-
1366
- #define _arrayCovers_get(self,i,item) (((self)->is32)? \
1367
- ((const hpatch_uint32_t*)(self)->pCCovers)[(i)*4+(item)]:\
1368
- ((const hpatch_StreamPos_t*)(self)->pCCovers)[(i)*4+(item)])
1369
- #define _arrayCovers_get_oldPos(self,i) _arrayCovers_get(self,i,0)
1370
- #define _arrayCovers_get_len(self,i) _arrayCovers_get(self,i,2)
1371
- #define _arrayCovers_get_cachePos(self,i) _arrayCovers_get(self,i,3)
1372
-
1373
- #define _arrayCovers_set(self,i,item,v) { if ((self)->is32){ \
1374
- ((hpatch_uint32_t*)(self)->pCCovers)[(i)*4+(item)]=(hpatch_uint32_t)(v); }else{ \
1375
- ((hpatch_StreamPos_t*)(self)->pCCovers)[(i)*4+(item)]=(v); } }
1376
- #define _arrayCovers_set_cachePos(self,i,v) _arrayCovers_set(self,i,3,v)
1377
-
1378
- hpatch_inline static hpatch_StreamPos_t arrayCovers_memSize(hpatch_StreamPos_t coverCount,hpatch_BOOL is32){
1379
- return coverCount*(is32?sizeof(hpatch_TCCover32):sizeof(hpatch_TCCover64));
1380
- }
1381
-
1382
- static hpatch_BOOL _arrayCovers_is_finish(const hpatch_TCovers* covers){
1383
- const _TArrayCovers* self=(const _TArrayCovers*)covers;
1384
- return (self->coverCount==self->cur_index);
1385
- }
1386
- static hpatch_StreamPos_t _arrayCovers_leaveCoverCount(const hpatch_TCovers* covers){
1387
- const _TArrayCovers* self=(const _TArrayCovers*)covers;
1388
- return self->coverCount-self->cur_index;
1389
- }
1390
- static hpatch_BOOL _arrayCovers_read_cover(struct hpatch_TCovers* covers,hpatch_TCover* out_cover){
1391
- _TArrayCovers* self=(_TArrayCovers*)covers;
1392
- hpatch_size_t i=self->cur_index;
1393
- if (i<self->coverCount){
1394
- if (self->is32){
1395
- const hpatch_TCCover32* pCover=((const hpatch_TCCover32*)self->pCCovers)+i;
1396
- out_cover->oldPos=pCover->oldPos;
1397
- out_cover->newPos=pCover->newPos;
1398
- out_cover->length=pCover->length;
1399
- }else{
1400
- const hpatch_TCCover64* pCover=((const hpatch_TCCover64*)self->pCCovers)+i;
1401
- out_cover->oldPos=pCover->oldPos;
1402
- out_cover->newPos=pCover->newPos;
1403
- out_cover->length=pCover->length;
1404
- }
1405
- self->cur_index=i+1;
1406
- return hpatch_TRUE;
1407
- }else{
1408
- return _hpatch_FALSE;
1409
- }
1410
- }
1411
-
1412
- static hpatch_BOOL _arrayCovers_load(_TArrayCovers** out_self,hpatch_TCovers* src_covers,
1413
- hpatch_BOOL isUsedCover32,hpatch_BOOL* out_isReadError,
1414
- TByte** ptemp_cache,TByte* temp_cache_end){
1415
- TByte* temp_cache=*ptemp_cache;
1416
- hpatch_StreamPos_t _coverCount=src_covers->leave_cover_count(src_covers);
1417
- hpatch_StreamPos_t memSize=arrayCovers_memSize(_coverCount,isUsedCover32);
1418
- hpatch_size_t i;
1419
- void* pCovers;
1420
- _TArrayCovers* self=0;
1421
- hpatch_size_t coverCount=(hpatch_size_t)_coverCount;
1422
-
1423
- *out_isReadError=hpatch_FALSE;
1424
- if (coverCount!=_coverCount) return hpatch_FALSE;
1425
-
1426
- _cache_alloc(self,_TArrayCovers,sizeof(_TArrayCovers),temp_cache,temp_cache_end);
1427
- _cache_alloc(pCovers,void,memSize,temp_cache,temp_cache_end);
1428
- if (isUsedCover32){
1429
- hpatch_TCCover32* pdst=(hpatch_TCCover32*)pCovers;
1430
- for (i=0;i<coverCount;++i,++pdst) {
1431
- hpatch_TCover cover;
1432
- if (!src_covers->read_cover(src_covers,&cover))
1433
- { *out_isReadError=hpatch_TRUE; return _hpatch_FALSE; }
1434
- pdst->oldPos=(hpatch_uint32_t)cover.oldPos;
1435
- pdst->newPos=(hpatch_uint32_t)cover.newPos;
1436
- pdst->length=(hpatch_uint32_t)cover.length;
1437
- }
1438
- }else{
1439
- hpatch_TCCover64* pdst=(hpatch_TCCover64*)pCovers;
1440
- for (i=0;i<coverCount;++i,++pdst) {
1441
- if (!src_covers->read_cover(src_covers,(hpatch_TCover*)pdst))
1442
- { *out_isReadError=hpatch_TRUE; return _hpatch_FALSE; }
1443
- }
1444
- }
1445
- if (!src_covers->is_finish(src_covers))
1446
- { *out_isReadError=hpatch_TRUE; return _hpatch_FALSE; }
1447
-
1448
- self->pCCovers=pCovers;
1449
- self->is32=isUsedCover32;
1450
- self->coverCount=coverCount;
1451
- self->cur_index=0;
1452
- self->ICovers.close=_covers_close_nil;
1453
- self->ICovers.is_finish=_arrayCovers_is_finish;
1454
- self->ICovers.leave_cover_count=_arrayCovers_leaveCoverCount;
1455
- self->ICovers.read_cover=_arrayCovers_read_cover;
1456
- *out_self=self;
1457
- *ptemp_cache=temp_cache;
1458
- return hpatch_TRUE;
1459
- }
1460
-
1461
- #define _arrayCovers_comp(_uint_t,_x,_y,item){ \
1462
- _uint_t x=((const _uint_t*)_x)[item]; \
1463
- _uint_t y=((const _uint_t*)_y)[item]; \
1464
- return (x<y)?(-1):((x>y)?1:0); \
1465
- }
1466
- static hpatch_int _arrayCovers_comp_by_old_32(const void* _x, const void *_y){
1467
- _arrayCovers_comp(hpatch_uint32_t,_x,_y,0);
1468
- }
1469
- static hpatch_int _arrayCovers_comp_by_old(const void* _x, const void *_y){
1470
- _arrayCovers_comp(hpatch_StreamPos_t,_x,_y,0);
1471
- }
1472
- static hpatch_int _arrayCovers_comp_by_new_32(const void* _x, const void *_y){
1473
- _arrayCovers_comp(hpatch_uint32_t,_x,_y,1);
1474
- }
1475
- static hpatch_int _arrayCovers_comp_by_new(const void* _x, const void *_y){
1476
- _arrayCovers_comp(hpatch_StreamPos_t,_x,_y,1);
1477
- }
1478
- static hpatch_int _arrayCovers_comp_by_len_32(const void* _x, const void *_y){
1479
- _arrayCovers_comp(hpatch_uint32_t,_x,_y,2);
1480
- }
1481
- static hpatch_int _arrayCovers_comp_by_len(const void* _x, const void *_y){
1482
- _arrayCovers_comp(hpatch_StreamPos_t,_x,_y,2);
1483
- }
1484
-
1485
- static void _arrayCovers_sort_by_old(_TArrayCovers* self){
1486
- if (self->is32)
1487
- qsort(self->pCCovers,self->coverCount,sizeof(hpatch_TCCover32),_arrayCovers_comp_by_old_32);
1488
- else
1489
- qsort(self->pCCovers,self->coverCount,sizeof(hpatch_TCCover64),_arrayCovers_comp_by_old);
1490
- }
1491
- static void _arrayCovers_sort_by_new(_TArrayCovers* self){
1492
- if (self->is32)
1493
- qsort(self->pCCovers,self->coverCount,sizeof(hpatch_TCCover32),_arrayCovers_comp_by_new_32);
1494
- else
1495
- qsort(self->pCCovers,self->coverCount,sizeof(hpatch_TCCover64),_arrayCovers_comp_by_new);
1496
- }
1497
- static void _arrayCovers_sort_by_len(_TArrayCovers* self){
1498
- if (self->is32)
1499
- qsort(self->pCCovers,self->coverCount,sizeof(hpatch_TCCover32),_arrayCovers_comp_by_len_32);
1500
- else
1501
- qsort(self->pCCovers,self->coverCount,sizeof(hpatch_TCCover64),_arrayCovers_comp_by_len);
1502
- }
1503
-
1504
- static hpatch_size_t _getMaxCachedLen(const _TArrayCovers* src_covers,
1505
- TByte* temp_cache,TByte* temp_cache_end,TByte* cache_buf_end){
1506
- const hpatch_size_t kMaxCachedLen =~((hpatch_size_t)0);//允许缓存的最长单个数据长度;
1507
- hpatch_StreamPos_t mlen=0;
1508
- hpatch_StreamPos_t sum=0;
1509
- const hpatch_size_t coverCount=src_covers->coverCount;
1510
- hpatch_size_t i;
1511
- _TArrayCovers cur_covers=*src_covers;
1512
- hpatch_size_t cacheSize=temp_cache_end-temp_cache;
1513
- hpatch_StreamPos_t memSize=arrayCovers_memSize(src_covers->coverCount,src_covers->is32);
1514
- _cache_alloc(cur_covers.pCCovers,void,memSize,temp_cache,temp_cache_end); //fail return 0
1515
- memcpy(cur_covers.pCCovers,src_covers->pCCovers,(hpatch_size_t)memSize);
1516
- _arrayCovers_sort_by_len(&cur_covers);
1517
-
1518
- for (i=0; i<coverCount;++i) {
1519
- mlen=_arrayCovers_get_len(&cur_covers,i);
1520
- sum+=mlen;
1521
- if (sum<=cacheSize){
1522
- continue;
1523
- }else{
1524
- --mlen;
1525
- break;
1526
- }
1527
- }
1528
- if (mlen>kMaxCachedLen)
1529
- mlen=kMaxCachedLen;
1530
- return (hpatch_size_t)mlen;
1531
- }
1532
-
1533
- static hpatch_size_t _set_cache_pos(_TArrayCovers* covers,hpatch_size_t maxCachedLen,
1534
- hpatch_StreamPos_t* poldPosBegin,hpatch_StreamPos_t* poldPosEnd){
1535
- const hpatch_size_t coverCount=covers->coverCount;
1536
- const hpatch_size_t kMinCacheCoverCount=coverCount/8+1; //控制最小缓存数量,否则缓存的意义太小;
1537
- hpatch_StreamPos_t oldPosBegin=~(hpatch_StreamPos_t)0;
1538
- hpatch_StreamPos_t oldPosEnd=0;
1539
- hpatch_size_t cacheCoverCount=0;
1540
- hpatch_size_t sum=0;//result
1541
- hpatch_size_t i;
1542
- for (i=0; i<coverCount;++i) {
1543
- hpatch_StreamPos_t clen=_arrayCovers_get_len(covers,i);
1544
- if (clen<=maxCachedLen){
1545
- hpatch_StreamPos_t oldPos;
1546
- _arrayCovers_set_cachePos(covers,i,sum);
1547
- sum+=(hpatch_size_t)clen;
1548
- ++cacheCoverCount;
1549
-
1550
- oldPos=_arrayCovers_get_oldPos(covers,i);
1551
- if (oldPos<oldPosBegin) oldPosBegin=oldPos;
1552
- if (oldPos+clen>oldPosEnd) oldPosEnd=oldPos+clen;
1553
- }
1554
- }
1555
- if (cacheCoverCount<kMinCacheCoverCount)
1556
- return 0;//fail
1557
- *poldPosBegin=oldPosBegin;
1558
- *poldPosEnd=oldPosEnd;
1559
- return sum;
1560
- }
1561
-
1562
- //一个比较简单的缓存策略:
1563
- // 1. 根据缓冲区大小限制,选择出最短的一批覆盖线来缓存;
1564
- // 2. 顺序访问一次oldData文件,填充这些缓存;
1565
- // 3. 顺序访问时跳过中间过大的对缓存无用的区域;
1566
-
1567
- static hpatch_BOOL _cache_old_load(const hpatch_TStreamInput*oldData,
1568
- hpatch_StreamPos_t oldPos,hpatch_StreamPos_t oldPosAllEnd,
1569
- _TArrayCovers* arrayCovers,hpatch_size_t maxCachedLen,hpatch_size_t sumCacheLen,
1570
- TByte* old_cache,TByte* old_cache_end,TByte* cache_buf_end){
1571
- const hpatch_size_t kMinSpaceLen =(1<<(20+2));//跳过seekTime*speed长度的空间(SSD可以更小)时间上划得来,否则就顺序访问;
1572
- const hpatch_size_t kAccessPageSize=(1<<(10+2));//页面对齐访问;
1573
- hpatch_BOOL result=hpatch_TRUE;
1574
- hpatch_size_t cur_i=0,i;
1575
- const hpatch_size_t coverCount=arrayCovers->coverCount;
1576
- TByte* cache_buf=old_cache_end;
1577
- assert((hpatch_size_t)(old_cache_end-old_cache)>=sumCacheLen);
1578
-
1579
- if ((hpatch_size_t)(cache_buf_end-cache_buf)>=kAccessPageSize*2){
1580
- cache_buf=(TByte*)_hpatch_align_upper(cache_buf,kAccessPageSize);
1581
- if ((hpatch_size_t)(cache_buf_end-cache_buf)>=(kMinSpaceLen>>1))
1582
- cache_buf_end=cache_buf+(kMinSpaceLen>>1);
1583
- else
1584
- cache_buf_end=(TByte*)_hpatch_align_lower(cache_buf_end,kAccessPageSize);
1585
- }
1586
- oldPos=_hpatch_align_type_lower(hpatch_StreamPos_t,oldPos,kAccessPageSize);
1587
- if (oldPos<kMinSpaceLen) oldPos=0;
1588
-
1589
- _arrayCovers_sort_by_old(arrayCovers);
1590
- while ((oldPos<oldPosAllEnd)&(cur_i<coverCount)) {
1591
- hpatch_StreamPos_t oldPosEnd;
1592
- hpatch_size_t readLen=(cache_buf_end-cache_buf);
1593
- if (readLen>(oldPosAllEnd-oldPos)) readLen=(hpatch_size_t)(oldPosAllEnd-oldPos);
1594
- if (!oldData->read(oldData,oldPos,cache_buf,
1595
- cache_buf+readLen)) { result=_hpatch_FALSE; break; } //error
1596
- oldPosEnd=oldPos+readLen;
1597
- for (i=cur_i;i<coverCount;++i){
1598
- hpatch_StreamPos_t ioldPos,ioldPosEnd;
1599
- hpatch_StreamPos_t ilen=_arrayCovers_get_len(arrayCovers,i);
1600
- if (ilen>maxCachedLen){//覆盖线比较长不需要缓存,下一个覆盖线;
1601
- if (i==cur_i)
1602
- ++cur_i;
1603
- continue;
1604
- }
1605
- ioldPos=_arrayCovers_get_oldPos(arrayCovers,i);
1606
- ioldPosEnd=ioldPos+ilen;
1607
- if (ioldPosEnd>oldPos){
1608
- // [oldPos oldPosEnd]
1609
- // ioldPosEnd]----or----]
1610
- if (ioldPos<oldPosEnd){//有交集,需要cache
1611
- // [----or----[ioldPos ioldPosEnd]----or----]
1612
- hpatch_StreamPos_t from;
1613
- hpatch_size_t copyLen;
1614
- hpatch_StreamPos_t dstPos=_arrayCovers_get_cachePos(arrayCovers,i);
1615
- //assert(dstPos<=(hpatch_size_t)(old_cache_end-old_cache));
1616
- if (ioldPos>=oldPos){
1617
- // [ioldPos ioldPosEnd]----or----]
1618
- from=ioldPos;
1619
- }else{
1620
- // [ioldPos ioldPosEnd]----or----]
1621
- from=oldPos;
1622
- dstPos+=(oldPos-ioldPos);
1623
- }
1624
- copyLen=(hpatch_size_t)(((ioldPosEnd<=oldPosEnd)?ioldPosEnd:oldPosEnd)-from);
1625
- //assert(dstPos+copyLen<=(hpatch_size_t)(old_cache_end-old_cache));
1626
- //assert(sumCacheLen>=copyLen);
1627
- memcpy(old_cache+(hpatch_size_t)dstPos,cache_buf+(from-oldPos),copyLen);
1628
- sumCacheLen-=copyLen;
1629
- if ((i==cur_i)&(oldPosEnd>=ioldPosEnd))
1630
- ++cur_i;
1631
- }else{//后面覆盖线暂时都不会与当前数据有交集了,下一块数据;
1632
- // [oldPos oldPosEnd]
1633
- // [ioldPos ioldPosEnd]
1634
- if ((i==cur_i)&&(ioldPos-oldPosEnd>=kMinSpaceLen))
1635
- oldPosEnd=_hpatch_align_type_lower(hpatch_StreamPos_t,ioldPos,kAccessPageSize);
1636
- break;
1637
- }
1638
- }else{//当前覆盖线已经落后于当前数据,下一个覆盖线;
1639
- // [oldPos oldPosEnd]
1640
- // [ioldPos ioldPosEnd]
1641
- if (i==cur_i)
1642
- ++cur_i;
1643
- }
1644
- }
1645
- oldPos=oldPosEnd;
1646
- }
1647
- _arrayCovers_sort_by_new(arrayCovers);
1648
- assert(sumCacheLen==0);
1649
- return result;
1650
- }
1651
-
1652
- typedef struct _cache_old_TStreamInput{
1653
- _TArrayCovers arrayCovers;
1654
- hpatch_BOOL isInHitCache;
1655
- hpatch_size_t maxCachedLen;
1656
- hpatch_StreamPos_t readFromPos;
1657
- hpatch_StreamPos_t readFromPosEnd;
1658
- const TByte* caches;
1659
- const TByte* cachesEnd;
1660
- const hpatch_TStreamInput* oldData;
1661
- } _cache_old_TStreamInput;
1662
-
1663
- static hpatch_BOOL _cache_old_StreamInput_read(const hpatch_TStreamInput* stream,
1664
- hpatch_StreamPos_t readFromPos,
1665
- unsigned char* out_data,unsigned char* out_data_end){
1666
- _cache_old_TStreamInput* self=(_cache_old_TStreamInput*)stream->streamImport;
1667
- hpatch_StreamPos_t dataLen=(hpatch_size_t)(self->readFromPosEnd-self->readFromPos);
1668
- hpatch_size_t readLen;
1669
- if (dataLen==0){//next cover
1670
- hpatch_StreamPos_t oldPos;
1671
- hpatch_size_t i=self->arrayCovers.cur_index++;
1672
- if (i>=self->arrayCovers.coverCount) return _hpatch_FALSE;//error;
1673
- oldPos=_arrayCovers_get_oldPos(&self->arrayCovers,i);
1674
- dataLen=_arrayCovers_get_len(&self->arrayCovers,i);
1675
- self->isInHitCache=(dataLen<=self->maxCachedLen);
1676
- self->readFromPos=oldPos;
1677
- self->readFromPosEnd=oldPos+dataLen;
1678
- }
1679
- readLen=out_data_end-out_data;
1680
- if ((readLen>dataLen)||(self->readFromPos!=readFromPos)) return _hpatch_FALSE; //error
1681
- self->readFromPos=readFromPos+readLen;
1682
- if (self->isInHitCache){
1683
- assert(readLen<=(hpatch_size_t)(self->cachesEnd-self->caches));
1684
- memcpy(out_data,self->caches,readLen);
1685
- self->caches+=readLen;
1686
- return hpatch_TRUE;
1687
- }else{
1688
- return self->oldData->read(self->oldData,readFromPos,out_data,out_data_end);
1689
- }
1690
- }
1691
-
1692
- static hpatch_BOOL _cache_old(hpatch_TStreamInput** out_cachedOld,const hpatch_TStreamInput* oldData,
1693
- _TArrayCovers* arrayCovers,hpatch_BOOL* out_isReadError,
1694
- TByte* temp_cache,TByte** ptemp_cache_end,TByte* cache_buf_end){
1695
- _cache_old_TStreamInput* self;
1696
- TByte* temp_cache_end=*ptemp_cache_end;
1697
- hpatch_StreamPos_t oldPosBegin;
1698
- hpatch_StreamPos_t oldPosEnd;
1699
- hpatch_size_t sumCacheLen;
1700
- hpatch_size_t maxCachedLen;
1701
- *out_isReadError=hpatch_FALSE;
1702
- _cache_alloc(*out_cachedOld,hpatch_TStreamInput,sizeof(hpatch_TStreamInput),
1703
- temp_cache,temp_cache_end);
1704
- _cache_alloc(self,_cache_old_TStreamInput,sizeof(_cache_old_TStreamInput),
1705
- temp_cache,temp_cache_end);
1706
-
1707
- maxCachedLen=_getMaxCachedLen(arrayCovers,temp_cache,temp_cache_end,cache_buf_end);
1708
- if (maxCachedLen==0) return hpatch_FALSE;
1709
- sumCacheLen=_set_cache_pos(arrayCovers,maxCachedLen,&oldPosBegin,&oldPosEnd);
1710
- if (sumCacheLen==0) return hpatch_FALSE;
1711
- temp_cache_end=temp_cache+sumCacheLen;
1712
-
1713
- if (!_cache_old_load(oldData,oldPosBegin,oldPosEnd,arrayCovers,maxCachedLen,sumCacheLen,
1714
- temp_cache,temp_cache_end,cache_buf_end))
1715
- { *out_isReadError=hpatch_TRUE; return _hpatch_FALSE; }
1716
-
1717
- {//out
1718
- self->arrayCovers=*arrayCovers;
1719
- self->arrayCovers.cur_index=0;
1720
- self->isInHitCache=hpatch_FALSE;
1721
- self->maxCachedLen=maxCachedLen;
1722
- self->caches=temp_cache;
1723
- self->cachesEnd=temp_cache_end;
1724
- self->readFromPos=0;
1725
- self->readFromPosEnd=0;
1726
- self->oldData=oldData;
1727
- (*out_cachedOld)->streamImport=self;
1728
- (*out_cachedOld)->streamSize=oldData->streamSize;
1729
- (*out_cachedOld)->read=_cache_old_StreamInput_read;
1730
- *ptemp_cache_end=temp_cache_end;
1731
- }
1732
- return hpatch_TRUE;
1733
- }
1734
-
1735
- #endif //_IS_NEED_CACHE_OLD_BY_COVERS
1736
-
1737
-
1738
- static hpatch_BOOL _patch_cache(hpatch_TCovers** out_covers,
1739
- const hpatch_TStreamInput** poldData,hpatch_StreamPos_t newDataSize,
1740
- const hpatch_TStreamInput* diffData,hpatch_BOOL isCompressedDiff,
1741
- hpatch_TDecompress* decompressPlugin,size_t kCacheCount,
1742
- TByte** ptemp_cache,TByte** ptemp_cache_end,hpatch_BOOL* out_isReadError){
1743
- const hpatch_TStreamInput* oldData=*poldData;
1744
- const hpatch_size_t kMinCacheSize=hpatch_kStreamCacheSize*kCacheCount;
1745
- #if (_IS_NEED_CACHE_OLD_BY_COVERS)
1746
- const hpatch_size_t kBestACacheSize=hpatch_kFileIOBufBetterSize; //内存足够时比较好的hpatch_kStreamCacheSize值;
1747
- const hpatch_size_t _minActiveSize=(1<<20)*8;
1748
- const hpatch_StreamPos_t _betterActiveSize=kBestACacheSize*kCacheCount*2+oldData->streamSize/8;
1749
- const hpatch_size_t kActiveCacheOldMemorySize = //尝试激活CacheOld功能的内存下限;
1750
- (_betterActiveSize>_minActiveSize)?_minActiveSize:(hpatch_size_t)_betterActiveSize;
1751
- #endif //_IS_NEED_CACHE_OLD_BY_COVERS
1752
- TByte* temp_cache=*ptemp_cache;
1753
- TByte* temp_cache_end=*ptemp_cache_end;
1754
- *out_isReadError=hpatch_FALSE;
1755
- if ((hpatch_size_t)(temp_cache_end-temp_cache)>=oldData->streamSize+kMinCacheSize
1756
- +sizeof(hpatch_TStreamInput)+sizeof(hpatch_StreamPos_t)){//load all oldData
1757
- hpatch_TStreamInput* replace_oldData=0;
1758
- _cache_alloc(replace_oldData,hpatch_TStreamInput,sizeof(hpatch_TStreamInput),
1759
- temp_cache,temp_cache_end);
1760
- if (!_cache_load_all(oldData,temp_cache_end-oldData->streamSize,
1761
- temp_cache_end)){ *out_isReadError=hpatch_TRUE; return _hpatch_FALSE; }
1762
-
1763
- mem_as_hStreamInput(replace_oldData,temp_cache_end-oldData->streamSize,temp_cache_end);
1764
- temp_cache_end-=oldData->streamSize;
1765
- // [ patch cache | oldData cache ]
1766
- // [ (cacheSize-oldData->streamSize) | (oldData->streamSize) ]
1767
- *out_covers=0;
1768
- *poldData=replace_oldData;
1769
- *ptemp_cache=temp_cache;
1770
- *ptemp_cache_end=temp_cache_end;
1771
- return hpatch_TRUE;
1772
- }
1773
- #if (_IS_NEED_CACHE_OLD_BY_COVERS)
1774
- else if ((hpatch_size_t)(temp_cache_end-temp_cache)>=kActiveCacheOldMemorySize) {
1775
- hpatch_BOOL isUsedCover32;
1776
- TByte* temp_cache_end_back=temp_cache_end;
1777
- _TArrayCovers* arrayCovers=0;
1778
- assert((hpatch_size_t)(temp_cache_end-temp_cache)>kBestACacheSize*kCacheCount);
1779
- assert(kBestACacheSize>sizeof(_TCompressedCovers)+sizeof(_TPackedCovers));
1780
- if (isCompressedDiff){
1781
- hpatch_compressedDiffInfo diffInfo;
1782
- _TCompressedCovers* compressedCovers=0;
1783
- if (!_compressedCovers_open(&compressedCovers,&diffInfo,diffData,decompressPlugin,
1784
- temp_cache_end-kBestACacheSize-sizeof(_TCompressedCovers),temp_cache_end))
1785
- { *out_isReadError=hpatch_TRUE; return _hpatch_FALSE; }
1786
- if ((oldData->streamSize!=diffInfo.oldDataSize)||(newDataSize!=diffInfo.newDataSize))
1787
- { *out_isReadError=hpatch_TRUE; return _hpatch_FALSE; }
1788
- temp_cache_end-=kBestACacheSize+sizeof(_TCompressedCovers);
1789
- // [ ... | compressedCovers cache ]
1790
- // [ (cacheSize-kBestACacheSize) | (kBestACacheSize) ]
1791
- *out_covers=&compressedCovers->base.ICovers;
1792
- isUsedCover32=(diffInfo.oldDataSize|diffInfo.newDataSize)<((hpatch_StreamPos_t)1<<32);
1793
- }else{
1794
- _TPackedCovers* packedCovers=0;
1795
- _THDiffHead diffHead;
1796
- hpatch_StreamPos_t oldDataSize=oldData->streamSize;
1797
- if (!_packedCovers_open(&packedCovers,&diffHead,diffData,
1798
- temp_cache_end-kBestACacheSize*3-sizeof(_TPackedCovers),temp_cache_end))
1799
- { *out_isReadError=hpatch_TRUE; return _hpatch_FALSE; }
1800
- temp_cache_end-=kBestACacheSize*3+sizeof(_TPackedCovers);
1801
- // [ ... | packedCovers cache ]
1802
- // [ (cacheSize-kBestACacheSize*3) | (kBestACacheSize*3) ]
1803
- *out_covers=&packedCovers->base.ICovers;
1804
- isUsedCover32=(oldDataSize|newDataSize)<((hpatch_StreamPos_t)1<<32);
1805
- }
1806
-
1807
- if (!_arrayCovers_load(&arrayCovers,*out_covers,isUsedCover32,
1808
- out_isReadError,&temp_cache,temp_cache_end-kBestACacheSize)){
1809
- if (*out_isReadError) return _hpatch_FALSE;
1810
- // [ patch cache | *edCovers cache ]
1811
- // [ (cacheSize-kBestACacheSize*?) | (kBestACacheSize*?) ]
1812
- *ptemp_cache=temp_cache;
1813
- *ptemp_cache_end=temp_cache_end;
1814
- return hpatch_FALSE;
1815
- }else{
1816
- // [ arrayCovers cache | ... ]
1817
- // [((new temp_cache)-(old temp_cache))| (cacheSize-(arrayCovers cache size)) ]
1818
- TByte* old_cache_end;
1819
- hpatch_TStreamInput* replace_oldData=0;
1820
- assert(!(*out_isReadError));
1821
- if (!((*out_covers)->close(*out_covers))) return _hpatch_FALSE;
1822
- *out_covers=&arrayCovers->ICovers;
1823
- temp_cache_end=temp_cache_end_back; //free compressedCovers or packedCovers memory
1824
- old_cache_end=temp_cache_end-kBestACacheSize*kCacheCount;
1825
- // [ arrayCovers cache | ... | patch reserve cache ]
1826
- // [ | ... | (kBestACacheSize*kCacheCount) ]
1827
- if (((hpatch_size_t)(temp_cache_end-temp_cache)<=kBestACacheSize*kCacheCount)
1828
- ||(!_cache_old(&replace_oldData,oldData,arrayCovers,out_isReadError,
1829
- temp_cache,&old_cache_end,temp_cache_end))){
1830
- if (*out_isReadError) return _hpatch_FALSE;
1831
- // [ arrayCovers cache | patch cache ]
1832
- *ptemp_cache=temp_cache;
1833
- *ptemp_cache_end=temp_cache_end;
1834
- return hpatch_FALSE;
1835
- }else{
1836
- // [ arrayCovers cache | oldData cache | patch cache ]
1837
- // [ | |(temp_cache_end-(new old_cache_end))]
1838
- assert(!(*out_isReadError));
1839
- assert((hpatch_size_t)(temp_cache_end-old_cache_end)>=kBestACacheSize*kCacheCount);
1840
- temp_cache=old_cache_end;
1841
-
1842
- *poldData=replace_oldData;
1843
- *ptemp_cache=temp_cache;
1844
- *ptemp_cache_end=temp_cache_end;
1845
- return hpatch_TRUE;
1846
- }
1847
- }
1848
- }
1849
- #endif//_IS_NEED_CACHE_OLD_BY_COVERS
1850
- return hpatch_FALSE;//not cache oldData
1851
- }
1852
-
1853
- hpatch_BOOL patch_stream_with_cache(const struct hpatch_TStreamOutput* out_newData,
1854
- const struct hpatch_TStreamInput* oldData,
1855
- const struct hpatch_TStreamInput* serializedDiff,
1856
- TByte* temp_cache,TByte* temp_cache_end){
1857
- hpatch_BOOL result;
1858
- hpatch_TCovers* covers=0;//not need close before return
1859
- hpatch_BOOL isReadError=hpatch_FALSE;
1860
- _patch_cache(&covers,&oldData,out_newData->streamSize,serializedDiff,hpatch_FALSE,0,
1861
- _kCachePatCount,&temp_cache,&temp_cache_end,&isReadError);
1862
- if (isReadError) return _hpatch_FALSE;
1863
- result=_patch_stream_with_cache(out_newData,oldData,serializedDiff,covers,
1864
- temp_cache,temp_cache_end);
1865
- //if ((covers!=0)&&(!covers->close(covers))) result=_hpatch_FALSE;
1866
- return result;
1867
- }
1868
-
1869
- hpatch_BOOL patch_stream(const hpatch_TStreamOutput* out_newData,
1870
- const hpatch_TStreamInput* oldData,
1871
- const hpatch_TStreamInput* serializedDiff){
1872
- TByte temp_cache[hpatch_kStreamCacheSize*_kCachePatCount];
1873
- return _patch_stream_with_cache(out_newData,oldData,serializedDiff,0,
1874
- temp_cache,temp_cache+sizeof(temp_cache)/sizeof(TByte));
1875
- }
1876
-
1877
- hpatch_BOOL patch_decompress_with_cache(const hpatch_TStreamOutput* out_newData,
1878
- const hpatch_TStreamInput* oldData,
1879
- const hpatch_TStreamInput* compressedDiff,
1880
- hpatch_TDecompress* decompressPlugin,
1881
- TByte* temp_cache,TByte* temp_cache_end){
1882
- hpatch_BOOL result;
1883
- hpatch_TCovers* covers=0; //need close before return
1884
- hpatch_BOOL isReadError=hpatch_FALSE;
1885
- _patch_cache(&covers,&oldData,out_newData->streamSize,compressedDiff,hpatch_TRUE,
1886
- decompressPlugin,_kCacheDecCount,&temp_cache,&temp_cache_end,&isReadError);
1887
- if (isReadError) return _hpatch_FALSE;
1888
- result=_patch_decompress_cache(out_newData,0,oldData,compressedDiff,decompressPlugin,
1889
- covers,temp_cache,temp_cache_end);
1890
- if ((covers!=0)&&(!covers->close(covers))) result=_hpatch_FALSE;
1891
- return result;
1892
- }
1893
-
1894
- hpatch_BOOL patch_decompress(const hpatch_TStreamOutput* out_newData,
1895
- const hpatch_TStreamInput* oldData,
1896
- const hpatch_TStreamInput* compressedDiff,
1897
- hpatch_TDecompress* decompressPlugin){
1898
- TByte temp_cache[hpatch_kStreamCacheSize*_kCacheDecCount];
1899
- return _patch_decompress_cache(out_newData,0,oldData,compressedDiff,decompressPlugin,
1900
- 0,temp_cache,temp_cache+sizeof(temp_cache)/sizeof(TByte));
1901
- }
1902
-
1903
- hpatch_BOOL hpatch_coverList_open_serializedDiff(hpatch_TCoverList* out_coverList,
1904
- const hpatch_TStreamInput* serializedDiff){
1905
- TByte* temp_cache;
1906
- TByte* temp_cache_end;
1907
- _TPackedCovers* packedCovers=0;
1908
- _THDiffHead diffHead;
1909
- assert((out_coverList!=0)&&(out_coverList->ICovers==0));
1910
- temp_cache=out_coverList->_buf;
1911
- temp_cache_end=temp_cache+sizeof(out_coverList->_buf);
1912
- if (!_packedCovers_open(&packedCovers,&diffHead,serializedDiff,
1913
- temp_cache,temp_cache_end))
1914
- return _hpatch_FALSE;
1915
- out_coverList->ICovers=&packedCovers->base.ICovers;
1916
- return hpatch_TRUE;
1917
- }
1918
-
1919
- hpatch_BOOL hpatch_coverList_open_compressedDiff(hpatch_TCoverList* out_coverList,
1920
- const hpatch_TStreamInput* compressedDiff,
1921
- hpatch_TDecompress* decompressPlugin){
1922
- TByte* temp_cache;
1923
- TByte* temp_cache_end;
1924
- _TCompressedCovers* compressedCovers=0;
1925
- hpatch_compressedDiffInfo diffInfo;
1926
- assert((out_coverList!=0)&&(out_coverList->ICovers==0));
1927
- temp_cache=out_coverList->_buf;
1928
- temp_cache_end=temp_cache+sizeof(out_coverList->_buf);
1929
- if (!_compressedCovers_open(&compressedCovers,&diffInfo,compressedDiff,decompressPlugin,
1930
- temp_cache,temp_cache_end))
1931
- return _hpatch_FALSE;
1932
- out_coverList->ICovers=&compressedCovers->base.ICovers;
1933
- return hpatch_TRUE;
1934
- }
1935
-
1936
- //
1937
-
1938
- #define _kCacheSgCount 3
1939
-
1940
- hpatch_BOOL patch_single_compressed_diff(const hpatch_TStreamOutput* out_newData,
1941
- const hpatch_TStreamInput* oldData,
1942
- const hpatch_TStreamInput* singleCompressedDiff,
1943
- hpatch_StreamPos_t diffData_pos,
1944
- hpatch_StreamPos_t uncompressedSize,
1945
- hpatch_TDecompress* decompressPlugin,
1946
- hpatch_StreamPos_t coverCount,hpatch_size_t stepMemSize,
1947
- unsigned char* temp_cache,unsigned char* temp_cache_end){
1948
- hpatch_BOOL result;
1949
- hpatch_TUncompresser_t uncompressedStream;
1950
- memset(&uncompressedStream,0,sizeof(uncompressedStream));
1951
- if (decompressPlugin){
1952
- if (!compressed_stream_as_uncompressed(&uncompressedStream,uncompressedSize,decompressPlugin,singleCompressedDiff,
1953
- diffData_pos,singleCompressedDiff->streamSize)) return _hpatch_FALSE;
1954
- singleCompressedDiff=&uncompressedStream.base;
1955
- diffData_pos=0;
1956
- }
1957
- result=patch_single_stream_diff(out_newData,oldData,singleCompressedDiff,diffData_pos,
1958
- coverCount,stepMemSize,temp_cache,temp_cache_end);
1959
- if (decompressPlugin)
1960
- close_compressed_stream_as_uncompressed(&uncompressedStream);
1961
- return result;
1962
- }
1963
-
1964
- hpatch_BOOL getSingleCompressedDiffInfo(hpatch_singleCompressedDiffInfo* out_diffInfo,
1965
- const hpatch_TStreamInput* singleCompressedDiff,
1966
- hpatch_StreamPos_t diffInfo_pos){
1967
- TStreamCacheClip _diffHeadClip;
1968
- TStreamCacheClip* diffHeadClip=&_diffHeadClip;
1969
- TByte temp_cache[hpatch_kStreamCacheSize];
1970
- _TStreamCacheClip_init(&_diffHeadClip,singleCompressedDiff,diffInfo_pos,singleCompressedDiff->streamSize,
1971
- temp_cache,hpatch_kStreamCacheSize);
1972
- {//type
1973
- const char* kVersionType="HDIFFSF20";
1974
- char* tempType=out_diffInfo->compressType;
1975
- if (!_TStreamCacheClip_readType_end(diffHeadClip,'&',tempType)) return _hpatch_FALSE;
1976
- if (0!=strcmp(tempType,kVersionType)) return _hpatch_FALSE;
1977
- }
1978
- {//read compressType
1979
- if (!_TStreamCacheClip_readType_end(diffHeadClip,'\0',
1980
- out_diffInfo->compressType)) return _hpatch_FALSE;
1981
- }
1982
- _clip_unpackUIntTo(&out_diffInfo->newDataSize,diffHeadClip);
1983
- _clip_unpackUIntTo(&out_diffInfo->oldDataSize,diffHeadClip);
1984
- _clip_unpackUIntTo(&out_diffInfo->coverCount,diffHeadClip);
1985
- _clip_unpackUIntTo(&out_diffInfo->stepMemSize,diffHeadClip);
1986
- _clip_unpackUIntTo(&out_diffInfo->uncompressedSize,diffHeadClip);
1987
- _clip_unpackUIntTo(&out_diffInfo->compressedSize,diffHeadClip);
1988
- out_diffInfo->diffDataPos=_TStreamCacheClip_readPosOfSrcStream(diffHeadClip)-diffInfo_pos;
1989
- if (out_diffInfo->stepMemSize>(size_t)((~(size_t)0)-hpatch_kStreamCacheSize*_kCacheSgCount))
1990
- return _hpatch_FALSE;
1991
- return hpatch_TRUE;
1992
- }
1993
-
1994
- static hpatch_BOOL _TUncompresser_read(const struct hpatch_TStreamInput* stream,hpatch_StreamPos_t readFromPos,
1995
- unsigned char* out_data,unsigned char* out_data_end){
1996
- hpatch_TUncompresser_t* self=(hpatch_TUncompresser_t*)stream->streamImport;
1997
- return self->_decompressPlugin->decompress_part(self->_decompressHandle,out_data,out_data_end);
1998
- }
1999
-
2000
- hpatch_BOOL compressed_stream_as_uncompressed(hpatch_TUncompresser_t* uncompressedStream,hpatch_StreamPos_t uncompressedSize,
2001
- hpatch_TDecompress* decompressPlugin,const hpatch_TStreamInput* compressedStream,
2002
- hpatch_StreamPos_t compressed_pos,hpatch_StreamPos_t compressed_end){
2003
- hpatch_TUncompresser_t* self=uncompressedStream;
2004
- assert(decompressPlugin!=0);
2005
- assert(self->_decompressHandle==0);
2006
- self->_decompressHandle=decompressPlugin->open(decompressPlugin,uncompressedSize,compressedStream,
2007
- compressed_pos,compressed_end);
2008
- if (self->_decompressHandle==0) return _hpatch_FALSE;
2009
- self->_decompressPlugin=decompressPlugin;
2010
-
2011
- self->base.streamImport=self;
2012
- self->base.streamSize=uncompressedSize;
2013
- self->base.read=_TUncompresser_read;
2014
- return hpatch_TRUE;
2015
- }
2016
-
2017
- void close_compressed_stream_as_uncompressed(hpatch_TUncompresser_t* uncompressedStream){
2018
- hpatch_TUncompresser_t* self=uncompressedStream;
2019
- if (self==0) return;
2020
- if (self->_decompressHandle==0) return;
2021
- self->_decompressPlugin->close(self->_decompressPlugin,self->_decompressHandle);
2022
- self->_decompressHandle=0;
2023
- }
2024
-
2025
- typedef struct{
2026
- const unsigned char* code;
2027
- const unsigned char* code_end;
2028
- hpatch_size_t len0;
2029
- hpatch_size_t lenv;
2030
- hpatch_BOOL isNeedDecode0;
2031
- } rle0_decoder_t;
2032
-
2033
- static void _rle0_decoder_init(rle0_decoder_t* self,const unsigned char* code,const unsigned char* code_end){
2034
- self->code=code;
2035
- self->code_end=code_end;
2036
- self->len0=0;
2037
- self->lenv=0;
2038
- self->isNeedDecode0=hpatch_TRUE;
2039
- }
2040
-
2041
- static hpatch_BOOL _rle0_decoder_add(rle0_decoder_t* self,TByte* out_data,hpatch_size_t decodeSize){
2042
- if (self->len0){
2043
- _0_process:
2044
- if (self->len0>=decodeSize){
2045
- self->len0-=decodeSize;
2046
- return hpatch_TRUE;
2047
- }else{
2048
- decodeSize-=self->len0;
2049
- out_data+=self->len0;
2050
- self->len0=0;
2051
- goto _decode_v_process;
2052
- }
2053
- }
2054
-
2055
- if (self->lenv){
2056
- _v_process:
2057
- if (self->lenv>=decodeSize){
2058
- addData(out_data,self->code,decodeSize);
2059
- self->code+=decodeSize;
2060
- self->lenv-=decodeSize;
2061
- return hpatch_TRUE;
2062
- }else{
2063
- addData(out_data,self->code,self->lenv);
2064
- out_data+=self->lenv;
2065
- decodeSize-=self->lenv;
2066
- self->code+=self->lenv;
2067
- self->lenv=0;
2068
- goto _decode_0_process;
2069
- }
2070
- }
2071
-
2072
- assert(decodeSize>0);
2073
- if (self->isNeedDecode0){
2074
- hpatch_StreamPos_t len0;
2075
- _decode_0_process:
2076
- self->isNeedDecode0=hpatch_FALSE;
2077
- if (!hpatch_unpackUInt(&self->code,self->code_end,&len0)) return _hpatch_FALSE;
2078
- if (len0!=(hpatch_size_t)len0) return _hpatch_FALSE;
2079
- self->len0=(hpatch_size_t)len0;
2080
- goto _0_process;
2081
- }else{
2082
- hpatch_StreamPos_t lenv;
2083
- _decode_v_process:
2084
- self->isNeedDecode0=hpatch_TRUE;
2085
- if (!hpatch_unpackUInt(&self->code,self->code_end,&lenv)) return _hpatch_FALSE;
2086
- if (lenv>(size_t)(self->code_end-self->code)) return _hpatch_FALSE;
2087
- self->lenv=(hpatch_size_t)lenv;
2088
- goto _v_process;
2089
- }
2090
- }
2091
-
2092
-
2093
- static hpatch_BOOL _patch_add_old_with_rle0(TOutStreamCache* outCache,rle0_decoder_t* rle0_decoder,
2094
- const hpatch_TStreamInput* old,hpatch_StreamPos_t oldPos,
2095
- hpatch_StreamPos_t addLength,TByte* aCache,hpatch_size_t aCacheSize){
2096
- while (addLength>0){
2097
- hpatch_size_t decodeStep=aCacheSize;
2098
- if (decodeStep>addLength)
2099
- decodeStep=(hpatch_size_t)addLength;
2100
- if (!old->read(old,oldPos,aCache,aCache+decodeStep)) return _hpatch_FALSE;
2101
- if (!_rle0_decoder_add(rle0_decoder,aCache,decodeStep)) return _hpatch_FALSE;
2102
- if (!TOutStreamCache_write(outCache,aCache,decodeStep)) return _hpatch_FALSE;
2103
- oldPos+=decodeStep;
2104
- addLength-=decodeStep;
2105
- }
2106
- return hpatch_TRUE;
2107
- }
2108
-
2109
- hpatch_BOOL patch_single_stream_diff(const hpatch_TStreamOutput* out_newData,
2110
- const hpatch_TStreamInput* oldData,
2111
- const hpatch_TStreamInput* uncompressedDiffData,
2112
- hpatch_StreamPos_t diffData_pos,
2113
- hpatch_StreamPos_t coverCount,hpatch_size_t stepMemSize,
2114
- unsigned char* temp_cache,unsigned char* temp_cache_end){
2115
- unsigned char* step_cache=temp_cache;
2116
- hpatch_StreamPos_t lastOldEnd=0;
2117
- hpatch_StreamPos_t lastNewEnd=0;
2118
- hpatch_size_t cache_size;
2119
- TStreamCacheClip inClip;
2120
- TOutStreamCache outCache;
2121
- if ((size_t)(temp_cache_end-temp_cache)<stepMemSize+hpatch_kStreamCacheSize*_kCacheSgCount) return _hpatch_FALSE;
2122
- temp_cache+=stepMemSize;
2123
- cache_size=(temp_cache_end-temp_cache)/_kCacheSgCount;
2124
- _TStreamCacheClip_init(&inClip,uncompressedDiffData,diffData_pos,uncompressedDiffData->streamSize,
2125
- temp_cache,cache_size);
2126
- temp_cache+=cache_size;
2127
- TOutStreamCache_init(&outCache,out_newData,temp_cache+cache_size,cache_size);
2128
- while (coverCount) {//step loop
2129
- const unsigned char* covers_cache = step_cache;
2130
- const unsigned char* covers_cache_end;
2131
- rle0_decoder_t rle0_decoder;
2132
- {//read step info
2133
- hpatch_StreamPos_t bufCover_size;
2134
- hpatch_StreamPos_t bufRle_size;
2135
- _clip_unpackUIntTo(&bufCover_size,&inClip);
2136
- _clip_unpackUIntTo(&bufRle_size,&inClip);
2137
- if (bufCover_size+bufRle_size>stepMemSize) return _hpatch_FALSE;
2138
- if (!_TStreamCacheClip_readDataTo(&inClip,step_cache,step_cache+bufCover_size+bufRle_size)) return _hpatch_FALSE;
2139
- covers_cache_end=covers_cache+bufCover_size;
2140
- _rle0_decoder_init(&rle0_decoder,covers_cache_end,covers_cache_end+bufRle_size);
2141
- }
2142
- while (covers_cache!=covers_cache_end) {// cover loop
2143
- hpatch_StreamPos_t oldPos;
2144
- hpatch_StreamPos_t newPos;
2145
- hpatch_StreamPos_t coverLen;
2146
- {//read cover
2147
- hpatch_BOOL inc_oldPos_sign;
2148
- if (covers_cache==covers_cache_end) return _hpatch_FALSE;
2149
- inc_oldPos_sign=(*covers_cache)>>7;
2150
- if (!hpatch_unpackUIntWithTag(&covers_cache,covers_cache_end,&oldPos,1)) return _hpatch_FALSE;
2151
- if (inc_oldPos_sign==0)
2152
- oldPos+=lastOldEnd;
2153
- else
2154
- oldPos=lastOldEnd-oldPos;
2155
- if (!hpatch_unpackUInt(&covers_cache,covers_cache_end,&newPos)) return _hpatch_FALSE;
2156
- newPos+=lastNewEnd;
2157
- if (!hpatch_unpackUInt(&covers_cache,covers_cache_end,&coverLen)) return _hpatch_FALSE;
2158
- }
2159
-
2160
- if (newPos>lastNewEnd){
2161
- if (!_patch_copy_diff_by_outCache(&outCache,&inClip,newPos-lastNewEnd)) return _hpatch_FALSE;
2162
- }
2163
-
2164
- --coverCount;
2165
- if (coverLen){
2166
- #ifdef __RUN_MEM_SAFE_CHECK
2167
- if (oldPos>oldData->streamSize) return _hpatch_FALSE;
2168
- if (coverLen>(hpatch_StreamPos_t)(oldData->streamSize-oldPos)) return _hpatch_FALSE;
2169
- #endif
2170
- if (!_patch_add_old_with_rle0(&outCache,&rle0_decoder,oldData,oldPos,coverLen,
2171
- temp_cache,cache_size)) return _hpatch_FALSE;
2172
- lastOldEnd=oldPos+coverLen;
2173
- lastNewEnd=newPos+coverLen;
2174
- }else{
2175
- if (coverCount!=0) return _hpatch_FALSE;
2176
- }
2177
- }
2178
- }
2179
-
2180
- if (!TOutStreamCache_flush(&outCache))
2181
- return _hpatch_FALSE;
2182
- if (_TStreamCacheClip_isFinish(&inClip)&TOutStreamCache_isFinish(&outCache)&(coverCount==0))
2183
- return hpatch_TRUE;
2184
- else
2185
- return _hpatch_FALSE;
2186
- }
2187
-
2188
-
2189
- static hpatch_BOOL _TDiffToSingleStream_read(const struct hpatch_TStreamInput* stream,hpatch_StreamPos_t readFromPos,
2190
- unsigned char* out_data,unsigned char* out_data_end){
2191
- //[ |readedSize ]
2192
- // [ |cachedBufBegin _TDiffToSingleStream_kBufSize]
2193
- // readFromPos[out_data out_data_end]
2194
- TDiffToSingleStream* self=(TDiffToSingleStream*)stream->streamImport;
2195
- hpatch_StreamPos_t readedSize=self->readedSize;
2196
- while (1){
2197
- size_t rLen=out_data_end-out_data;
2198
- if (readFromPos==readedSize){
2199
- hpatch_BOOL result=self->diffStream->read(self->diffStream,readedSize,out_data,out_data_end);
2200
- self->readedSize=readedSize+rLen;
2201
- if ((self->isInSingleStream)||(rLen>_TDiffToSingleStream_kBufSize)){
2202
- self->cachedBufBegin=_TDiffToSingleStream_kBufSize;
2203
- }else{
2204
- //cache
2205
- if (rLen>=_TDiffToSingleStream_kBufSize){
2206
- memcpy(self->buf,out_data_end-_TDiffToSingleStream_kBufSize,_TDiffToSingleStream_kBufSize);
2207
- self->cachedBufBegin = 0;
2208
- }else{
2209
- size_t new_cachedBufBegin;
2210
- if (self->cachedBufBegin>=rLen){
2211
- new_cachedBufBegin=self->cachedBufBegin-rLen;
2212
- memmove(self->buf+new_cachedBufBegin,self->buf+self->cachedBufBegin,_TDiffToSingleStream_kBufSize-self->cachedBufBegin);
2213
- }else{
2214
- new_cachedBufBegin=0;
2215
- memmove(self->buf,self->buf+rLen,_TDiffToSingleStream_kBufSize-rLen);
2216
- }
2217
- memcpy(self->buf+(_TDiffToSingleStream_kBufSize-rLen),out_data,rLen);
2218
- self->cachedBufBegin=new_cachedBufBegin;
2219
- }
2220
- }
2221
- return result;
2222
- }else{
2223
- size_t cachedSize=_TDiffToSingleStream_kBufSize-self->cachedBufBegin;
2224
- size_t bufSize=(size_t)(readedSize-readFromPos);
2225
- if ((readFromPos<readedSize)&(bufSize<=cachedSize)){
2226
- if (rLen>bufSize)
2227
- rLen=bufSize;
2228
- memcpy(out_data,self->buf+(_TDiffToSingleStream_kBufSize-bufSize),rLen);
2229
- out_data+=rLen;
2230
- readFromPos+=rLen;
2231
- if (out_data==out_data_end)
2232
- return hpatch_TRUE;
2233
- else
2234
- continue;
2235
- }else{
2236
- return _hpatch_FALSE;
2237
- }
2238
- }
2239
- }
2240
- }
2241
- void TDiffToSingleStream_init(TDiffToSingleStream* self,const hpatch_TStreamInput* diffStream){
2242
- self->base.streamImport=self;
2243
- self->base.streamSize=diffStream->streamSize;
2244
- self->base.read=_TDiffToSingleStream_read;
2245
- self->base._private_reserved=0;
2246
- self->diffStream=diffStream;
2247
- self->readedSize=0;
2248
- self->cachedBufBegin=_TDiffToSingleStream_kBufSize;
2249
- self->isInSingleStream=hpatch_FALSE;
2250
- }
2251
-
2252
- hpatch_BOOL patch_single_stream_by(sspatch_listener_t* listener,
2253
- const hpatch_TStreamOutput* __out_newData,
2254
- const hpatch_TStreamInput* oldData,
2255
- const hpatch_TStreamInput* singleCompressedDiff,
2256
- hpatch_StreamPos_t diffInfo_pos){
2257
- hpatch_BOOL result;
2258
- hpatch_TDecompress* decompressPlugin=0;
2259
- unsigned char* temp_cache=0;
2260
- unsigned char* temp_cacheEnd=0;
2261
- hpatch_singleCompressedDiffInfo diffInfo;
2262
- hpatch_TStreamOutput _out_newData=*__out_newData;
2263
- hpatch_TStreamOutput* out_newData=&_out_newData;
2264
- TDiffToSingleStream _toSStream;
2265
- assert((listener)&&(listener->onDiffInfo));
2266
- TDiffToSingleStream_init(&_toSStream,singleCompressedDiff);
2267
- singleCompressedDiff=&_toSStream.base;
2268
-
2269
- if (!getSingleCompressedDiffInfo(&diffInfo,singleCompressedDiff,diffInfo_pos))
2270
- return _hpatch_FALSE;
2271
- if (diffInfo.newDataSize>out_newData->streamSize)
2272
- return _hpatch_FALSE;
2273
- out_newData->streamSize=diffInfo.newDataSize;
2274
- if (diffInfo.oldDataSize!=oldData->streamSize)
2275
- return _hpatch_FALSE;
2276
- if ((diffInfo.compressedSize?diffInfo.compressedSize:diffInfo.uncompressedSize)
2277
- !=(singleCompressedDiff->streamSize-diffInfo.diffDataPos))
2278
- return _hpatch_FALSE;
2279
-
2280
- if (!listener->onDiffInfo(listener,&diffInfo,&decompressPlugin,&temp_cache,&temp_cacheEnd))
2281
- return _hpatch_FALSE;
2282
- if ((temp_cache==0)||(temp_cache>=temp_cacheEnd))
2283
- return _hpatch_FALSE;
2284
- result=(diffInfo.compressType[0]=='\0')?(decompressPlugin==0):(decompressPlugin!=0);
2285
- result=result&&patch_single_compressed_diff(out_newData,oldData,singleCompressedDiff,
2286
- diffInfo.diffDataPos,diffInfo.uncompressedSize,
2287
- decompressPlugin,diffInfo.coverCount,
2288
- (size_t)diffInfo.stepMemSize,temp_cache,temp_cacheEnd);
2289
- if (listener->onPatchFinish)
2290
- listener->onPatchFinish(listener,temp_cache,temp_cacheEnd);
2291
- return result;
2292
- }