electrobun 0.0.1 → 0.0.2

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 (667) hide show
  1. package/.gitmodules +3 -0
  2. package/dist/webview +0 -0
  3. package/package.json +1 -1
  4. package/src/cli/build/electrobun +0 -0
  5. package/example/assets/electrobun-logo-32-template.png +0 -0
  6. package/example/buildScript.ts +0 -1
  7. package/example/bun.lockb +0 -0
  8. package/example/electrobun.config +0 -48
  9. package/example/icon.iconset/icon_128x128.png +0 -0
  10. package/example/icon.iconset/icon_128x128@2x.png +0 -0
  11. package/example/icon.iconset/icon_16x16.png +0 -0
  12. package/example/icon.iconset/icon_16x16@2x.png +0 -0
  13. package/example/icon.iconset/icon_256x256.png +0 -0
  14. package/example/icon.iconset/icon_256x256@2x.png +0 -0
  15. package/example/icon.iconset/icon_32x32.png +0 -0
  16. package/example/icon.iconset/icon_32x32@2x.png +0 -0
  17. package/example/icon.iconset/icon_512x512.png +0 -0
  18. package/example/icon.iconset/icon_512x512@2x.png +0 -0
  19. package/example/package-lock.json +0 -32
  20. package/example/package.json +0 -11
  21. package/example/readme.md +0 -0
  22. package/example/src/bun/index.ts +0 -403
  23. package/example/src/mainview/index.css +0 -4
  24. package/example/src/mainview/index.html +0 -13
  25. package/example/src/mainview/index.ts +0 -45
  26. package/example/src/mainview/rpc.ts +0 -36
  27. package/example/src/myextension/preload.ts +0 -15
  28. package/example/src/myextension/rpc.ts +0 -15
  29. package/example/src/webviewtag/electrobun.png +0 -0
  30. package/example/src/webviewtag/index.html +0 -94
  31. package/example/src/webviewtag/index.ts +0 -26
  32. package/src/bsdiff/bsdiff.zig +0 -842
  33. package/src/bsdiff/bspatch.zig +0 -253
  34. package/src/bsdiff/build.zig +0 -73
  35. package/src/bsdiff/zig-out/bin/bsdiff +0 -0
  36. package/src/bsdiff/zig-out/bin/bspatch +0 -0
  37. package/src/bsdiff/zig-out/lib/libzstd.a +0 -0
  38. package/src/bsdiff/zstd/.buckconfig +0 -9
  39. package/src/bsdiff/zstd/.buckversion +0 -1
  40. package/src/bsdiff/zstd/.circleci/config.yml +0 -123
  41. package/src/bsdiff/zstd/.circleci/images/primary/Dockerfile +0 -9
  42. package/src/bsdiff/zstd/.cirrus.yml +0 -10
  43. package/src/bsdiff/zstd/.gitattributes +0 -21
  44. package/src/bsdiff/zstd/.github/ISSUE_TEMPLATE/bug_report.md +0 -35
  45. package/src/bsdiff/zstd/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  46. package/src/bsdiff/zstd/.github/dependabot.yml +0 -6
  47. package/src/bsdiff/zstd/.github/workflows/commit.yml +0 -89
  48. package/src/bsdiff/zstd/.github/workflows/dev-long-tests.yml +0 -297
  49. package/src/bsdiff/zstd/.github/workflows/dev-short-tests.yml +0 -633
  50. package/src/bsdiff/zstd/.github/workflows/nightly.yml +0 -65
  51. package/src/bsdiff/zstd/.github/workflows/publish-release-artifacts.yml +0 -73
  52. package/src/bsdiff/zstd/.github/workflows/scorecards.yml +0 -64
  53. package/src/bsdiff/zstd/.github/workflows/windows-artifacts.yml +0 -58
  54. package/src/bsdiff/zstd/CHANGELOG +0 -837
  55. package/src/bsdiff/zstd/CODE_OF_CONDUCT.md +0 -5
  56. package/src/bsdiff/zstd/CONTRIBUTING.md +0 -489
  57. package/src/bsdiff/zstd/COPYING +0 -339
  58. package/src/bsdiff/zstd/LICENSE +0 -30
  59. package/src/bsdiff/zstd/Makefile +0 -457
  60. package/src/bsdiff/zstd/Package.swift +0 -36
  61. package/src/bsdiff/zstd/README.md +0 -227
  62. package/src/bsdiff/zstd/SECURITY.md +0 -15
  63. package/src/bsdiff/zstd/TESTING.md +0 -43
  64. package/src/bsdiff/zstd/build/LICENSE +0 -0
  65. package/src/bsdiff/zstd/build/README.md +0 -56
  66. package/src/bsdiff/zstd/build/VS2008/fullbench/fullbench.vcproj +0 -549
  67. package/src/bsdiff/zstd/build/VS2008/fuzzer/fuzzer.vcproj +0 -585
  68. package/src/bsdiff/zstd/build/VS2008/zstd/zstd.vcproj +0 -677
  69. package/src/bsdiff/zstd/build/VS2008/zstd.sln +0 -56
  70. package/src/bsdiff/zstd/build/VS2008/zstdlib/zstdlib.vcproj +0 -635
  71. package/src/bsdiff/zstd/build/VS2010/CompileAsCpp.props +0 -8
  72. package/src/bsdiff/zstd/build/VS2010/datagen/datagen.vcxproj +0 -170
  73. package/src/bsdiff/zstd/build/VS2010/fullbench/fullbench.vcxproj +0 -218
  74. package/src/bsdiff/zstd/build/VS2010/fullbench-dll/fullbench-dll.vcxproj +0 -189
  75. package/src/bsdiff/zstd/build/VS2010/fuzzer/fuzzer.vcxproj +0 -223
  76. package/src/bsdiff/zstd/build/VS2010/libzstd/libzstd.vcxproj +0 -242
  77. package/src/bsdiff/zstd/build/VS2010/libzstd-dll/libzstd-dll.rc +0 -51
  78. package/src/bsdiff/zstd/build/VS2010/libzstd-dll/libzstd-dll.vcxproj +0 -249
  79. package/src/bsdiff/zstd/build/VS2010/zstd/zstd.rc +0 -51
  80. package/src/bsdiff/zstd/build/VS2010/zstd/zstd.vcxproj +0 -265
  81. package/src/bsdiff/zstd/build/VS2010/zstd.sln +0 -89
  82. package/src/bsdiff/zstd/build/VS_scripts/README.md +0 -64
  83. package/src/bsdiff/zstd/build/VS_scripts/build.VS2010.cmd +0 -7
  84. package/src/bsdiff/zstd/build/VS_scripts/build.VS2012.cmd +0 -6
  85. package/src/bsdiff/zstd/build/VS_scripts/build.VS2013.cmd +0 -7
  86. package/src/bsdiff/zstd/build/VS_scripts/build.VS2015.cmd +0 -7
  87. package/src/bsdiff/zstd/build/VS_scripts/build.VS2017.cmd +0 -7
  88. package/src/bsdiff/zstd/build/VS_scripts/build.VS2017Community.cmd +0 -7
  89. package/src/bsdiff/zstd/build/VS_scripts/build.VS2017Enterprise.cmd +0 -7
  90. package/src/bsdiff/zstd/build/VS_scripts/build.VS2017Professional.cmd +0 -7
  91. package/src/bsdiff/zstd/build/VS_scripts/build.generic.cmd +0 -72
  92. package/src/bsdiff/zstd/build/cmake/CMakeLists.txt +0 -216
  93. package/src/bsdiff/zstd/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake +0 -121
  94. package/src/bsdiff/zstd/build/cmake/CMakeModules/FindLibLZ4.cmake +0 -49
  95. package/src/bsdiff/zstd/build/cmake/CMakeModules/GetZstdLibraryVersion.cmake +0 -10
  96. package/src/bsdiff/zstd/build/cmake/CMakeModules/JoinPaths.cmake +0 -23
  97. package/src/bsdiff/zstd/build/cmake/README.md +0 -136
  98. package/src/bsdiff/zstd/build/cmake/contrib/CMakeLists.txt +0 -13
  99. package/src/bsdiff/zstd/build/cmake/contrib/gen_html/CMakeLists.txt +0 -30
  100. package/src/bsdiff/zstd/build/cmake/contrib/pzstd/CMakeLists.txt +0 -39
  101. package/src/bsdiff/zstd/build/cmake/lib/CMakeLists.txt +0 -253
  102. package/src/bsdiff/zstd/build/cmake/lib/cmake_uninstall.cmake.in +0 -22
  103. package/src/bsdiff/zstd/build/cmake/programs/CMakeLists.txt +0 -144
  104. package/src/bsdiff/zstd/build/cmake/tests/CMakeLists.txt +0 -118
  105. package/src/bsdiff/zstd/build/cmake/zstdConfig.cmake.in +0 -10
  106. package/src/bsdiff/zstd/build/meson/GetZstdLibraryVersion.py +0 -39
  107. package/src/bsdiff/zstd/build/meson/InstallSymlink.py +0 -55
  108. package/src/bsdiff/zstd/build/meson/README.md +0 -38
  109. package/src/bsdiff/zstd/build/meson/contrib/gen_html/meson.build +0 -30
  110. package/src/bsdiff/zstd/build/meson/contrib/meson.build +0 -12
  111. package/src/bsdiff/zstd/build/meson/contrib/pzstd/meson.build +0 -25
  112. package/src/bsdiff/zstd/build/meson/lib/meson.build +0 -167
  113. package/src/bsdiff/zstd/build/meson/meson.build +0 -145
  114. package/src/bsdiff/zstd/build/meson/meson_options.txt +0 -36
  115. package/src/bsdiff/zstd/build/meson/programs/meson.build +0 -124
  116. package/src/bsdiff/zstd/build/meson/tests/meson.build +0 -217
  117. package/src/bsdiff/zstd/build/meson/tests/valgrindTest.py +0 -90
  118. package/src/bsdiff/zstd/build/single_file_libs/README.md +0 -33
  119. package/src/bsdiff/zstd/build/single_file_libs/build_decoder_test.sh +0 -91
  120. package/src/bsdiff/zstd/build/single_file_libs/build_library_test.sh +0 -97
  121. package/src/bsdiff/zstd/build/single_file_libs/combine.py +0 -234
  122. package/src/bsdiff/zstd/build/single_file_libs/combine.sh +0 -249
  123. package/src/bsdiff/zstd/build/single_file_libs/create_single_file_decoder.sh +0 -19
  124. package/src/bsdiff/zstd/build/single_file_libs/create_single_file_library.sh +0 -19
  125. package/src/bsdiff/zstd/build/single_file_libs/examples/README.md +0 -11
  126. package/src/bsdiff/zstd/build/single_file_libs/examples/emscripten.c +0 -340
  127. package/src/bsdiff/zstd/build/single_file_libs/examples/roundtrip.c +0 -83
  128. package/src/bsdiff/zstd/build/single_file_libs/examples/shell.html +0 -31
  129. package/src/bsdiff/zstd/build/single_file_libs/examples/simple.c +0 -75
  130. package/src/bsdiff/zstd/build/single_file_libs/examples/testcard-dxt1.inl +0 -2731
  131. package/src/bsdiff/zstd/build/single_file_libs/examples/testcard-zstd.inl +0 -261
  132. package/src/bsdiff/zstd/build/single_file_libs/examples/testcard.png +0 -0
  133. package/src/bsdiff/zstd/build/single_file_libs/zstd-in.c +0 -90
  134. package/src/bsdiff/zstd/build/single_file_libs/zstddeclib-in.c +0 -62
  135. package/src/bsdiff/zstd/contrib/VS2005/README.md +0 -3
  136. package/src/bsdiff/zstd/contrib/VS2005/fullbench/fullbench.vcproj +0 -440
  137. package/src/bsdiff/zstd/contrib/VS2005/fuzzer/fuzzer.vcproj +0 -488
  138. package/src/bsdiff/zstd/contrib/VS2005/zstd/zstd.vcproj +0 -552
  139. package/src/bsdiff/zstd/contrib/VS2005/zstd.sln +0 -55
  140. package/src/bsdiff/zstd/contrib/VS2005/zstdlib/zstdlib.vcproj +0 -546
  141. package/src/bsdiff/zstd/contrib/cleanTabs +0 -2
  142. package/src/bsdiff/zstd/contrib/diagnose_corruption/Makefile +0 -35
  143. package/src/bsdiff/zstd/contrib/diagnose_corruption/check_flipped_bits.c +0 -400
  144. package/src/bsdiff/zstd/contrib/docker/Dockerfile +0 -20
  145. package/src/bsdiff/zstd/contrib/docker/README.md +0 -20
  146. package/src/bsdiff/zstd/contrib/externalSequenceProducer/Makefile +0 -40
  147. package/src/bsdiff/zstd/contrib/externalSequenceProducer/README.md +0 -14
  148. package/src/bsdiff/zstd/contrib/externalSequenceProducer/main.c +0 -107
  149. package/src/bsdiff/zstd/contrib/externalSequenceProducer/sequence_producer.c +0 -80
  150. package/src/bsdiff/zstd/contrib/externalSequenceProducer/sequence_producer.h +0 -26
  151. package/src/bsdiff/zstd/contrib/freestanding_lib/freestanding.py +0 -774
  152. package/src/bsdiff/zstd/contrib/gen_html/Makefile +0 -51
  153. package/src/bsdiff/zstd/contrib/gen_html/README.md +0 -31
  154. package/src/bsdiff/zstd/contrib/gen_html/gen-zstd-manual.sh +0 -9
  155. package/src/bsdiff/zstd/contrib/gen_html/gen_html.cpp +0 -224
  156. package/src/bsdiff/zstd/contrib/largeNbDicts/Makefile +0 -58
  157. package/src/bsdiff/zstd/contrib/largeNbDicts/README.md +0 -33
  158. package/src/bsdiff/zstd/contrib/largeNbDicts/largeNbDicts.c +0 -1085
  159. package/src/bsdiff/zstd/contrib/linux-kernel/Makefile +0 -108
  160. package/src/bsdiff/zstd/contrib/linux-kernel/README.md +0 -14
  161. package/src/bsdiff/zstd/contrib/linux-kernel/btrfs-benchmark.sh +0 -104
  162. package/src/bsdiff/zstd/contrib/linux-kernel/btrfs-extract-benchmark.sh +0 -99
  163. package/src/bsdiff/zstd/contrib/linux-kernel/decompress_sources.h +0 -34
  164. package/src/bsdiff/zstd/contrib/linux-kernel/linux.mk +0 -43
  165. package/src/bsdiff/zstd/contrib/linux-kernel/linux_zstd.h +0 -447
  166. package/src/bsdiff/zstd/contrib/linux-kernel/mem.h +0 -262
  167. package/src/bsdiff/zstd/contrib/linux-kernel/squashfs-benchmark.sh +0 -39
  168. package/src/bsdiff/zstd/contrib/linux-kernel/test/Makefile +0 -49
  169. package/src/bsdiff/zstd/contrib/linux-kernel/test/include/asm/unaligned.h +0 -187
  170. package/src/bsdiff/zstd/contrib/linux-kernel/test/include/linux/compiler.h +0 -23
  171. package/src/bsdiff/zstd/contrib/linux-kernel/test/include/linux/errno.h +0 -15
  172. package/src/bsdiff/zstd/contrib/linux-kernel/test/include/linux/kernel.h +0 -19
  173. package/src/bsdiff/zstd/contrib/linux-kernel/test/include/linux/limits.h +0 -15
  174. package/src/bsdiff/zstd/contrib/linux-kernel/test/include/linux/math64.h +0 -15
  175. package/src/bsdiff/zstd/contrib/linux-kernel/test/include/linux/module.h +0 -20
  176. package/src/bsdiff/zstd/contrib/linux-kernel/test/include/linux/printk.h +0 -15
  177. package/src/bsdiff/zstd/contrib/linux-kernel/test/include/linux/stddef.h +0 -15
  178. package/src/bsdiff/zstd/contrib/linux-kernel/test/include/linux/swab.h +0 -16
  179. package/src/bsdiff/zstd/contrib/linux-kernel/test/include/linux/types.h +0 -16
  180. package/src/bsdiff/zstd/contrib/linux-kernel/test/include/linux/xxhash.h +0 -745
  181. package/src/bsdiff/zstd/contrib/linux-kernel/test/macro-test.sh +0 -44
  182. package/src/bsdiff/zstd/contrib/linux-kernel/test/static_test.c +0 -52
  183. package/src/bsdiff/zstd/contrib/linux-kernel/test/test.c +0 -229
  184. package/src/bsdiff/zstd/contrib/linux-kernel/zstd_common_module.c +0 -29
  185. package/src/bsdiff/zstd/contrib/linux-kernel/zstd_compress_module.c +0 -164
  186. package/src/bsdiff/zstd/contrib/linux-kernel/zstd_decompress_module.c +0 -105
  187. package/src/bsdiff/zstd/contrib/linux-kernel/zstd_deps.h +0 -121
  188. package/src/bsdiff/zstd/contrib/match_finders/README.md +0 -42
  189. package/src/bsdiff/zstd/contrib/match_finders/zstd_edist.c +0 -558
  190. package/src/bsdiff/zstd/contrib/match_finders/zstd_edist.h +0 -70
  191. package/src/bsdiff/zstd/contrib/premake/premake4.lua +0 -6
  192. package/src/bsdiff/zstd/contrib/premake/zstd.lua +0 -80
  193. package/src/bsdiff/zstd/contrib/pzstd/BUCK +0 -72
  194. package/src/bsdiff/zstd/contrib/pzstd/ErrorHolder.h +0 -54
  195. package/src/bsdiff/zstd/contrib/pzstd/Logging.h +0 -72
  196. package/src/bsdiff/zstd/contrib/pzstd/Makefile +0 -265
  197. package/src/bsdiff/zstd/contrib/pzstd/Options.cpp +0 -424
  198. package/src/bsdiff/zstd/contrib/pzstd/Options.h +0 -71
  199. package/src/bsdiff/zstd/contrib/pzstd/Pzstd.cpp +0 -618
  200. package/src/bsdiff/zstd/contrib/pzstd/Pzstd.h +0 -153
  201. package/src/bsdiff/zstd/contrib/pzstd/README.md +0 -56
  202. package/src/bsdiff/zstd/contrib/pzstd/SkippableFrame.cpp +0 -30
  203. package/src/bsdiff/zstd/contrib/pzstd/SkippableFrame.h +0 -64
  204. package/src/bsdiff/zstd/contrib/pzstd/images/Cspeed.png +0 -0
  205. package/src/bsdiff/zstd/contrib/pzstd/images/Dspeed.png +0 -0
  206. package/src/bsdiff/zstd/contrib/pzstd/main.cpp +0 -27
  207. package/src/bsdiff/zstd/contrib/pzstd/test/BUCK +0 -37
  208. package/src/bsdiff/zstd/contrib/pzstd/test/OptionsTest.cpp +0 -536
  209. package/src/bsdiff/zstd/contrib/pzstd/test/PzstdTest.cpp +0 -149
  210. package/src/bsdiff/zstd/contrib/pzstd/test/RoundTrip.h +0 -86
  211. package/src/bsdiff/zstd/contrib/pzstd/test/RoundTripTest.cpp +0 -86
  212. package/src/bsdiff/zstd/contrib/pzstd/utils/BUCK +0 -75
  213. package/src/bsdiff/zstd/contrib/pzstd/utils/Buffer.h +0 -99
  214. package/src/bsdiff/zstd/contrib/pzstd/utils/FileSystem.h +0 -96
  215. package/src/bsdiff/zstd/contrib/pzstd/utils/Likely.h +0 -28
  216. package/src/bsdiff/zstd/contrib/pzstd/utils/Portability.h +0 -16
  217. package/src/bsdiff/zstd/contrib/pzstd/utils/Range.h +0 -133
  218. package/src/bsdiff/zstd/contrib/pzstd/utils/ResourcePool.h +0 -96
  219. package/src/bsdiff/zstd/contrib/pzstd/utils/ScopeGuard.h +0 -50
  220. package/src/bsdiff/zstd/contrib/pzstd/utils/ThreadPool.h +0 -58
  221. package/src/bsdiff/zstd/contrib/pzstd/utils/WorkQueue.h +0 -181
  222. package/src/bsdiff/zstd/contrib/pzstd/utils/test/BUCK +0 -35
  223. package/src/bsdiff/zstd/contrib/pzstd/utils/test/BufferTest.cpp +0 -89
  224. package/src/bsdiff/zstd/contrib/pzstd/utils/test/RangeTest.cpp +0 -82
  225. package/src/bsdiff/zstd/contrib/pzstd/utils/test/ResourcePoolTest.cpp +0 -72
  226. package/src/bsdiff/zstd/contrib/pzstd/utils/test/ScopeGuardTest.cpp +0 -28
  227. package/src/bsdiff/zstd/contrib/pzstd/utils/test/ThreadPoolTest.cpp +0 -71
  228. package/src/bsdiff/zstd/contrib/pzstd/utils/test/WorkQueueTest.cpp +0 -282
  229. package/src/bsdiff/zstd/contrib/recovery/Makefile +0 -35
  230. package/src/bsdiff/zstd/contrib/recovery/recover_directory.c +0 -152
  231. package/src/bsdiff/zstd/contrib/seekable_format/README.md +0 -42
  232. package/src/bsdiff/zstd/contrib/seekable_format/examples/Makefile +0 -53
  233. package/src/bsdiff/zstd/contrib/seekable_format/examples/parallel_compression.c +0 -214
  234. package/src/bsdiff/zstd/contrib/seekable_format/examples/parallel_processing.c +0 -194
  235. package/src/bsdiff/zstd/contrib/seekable_format/examples/seekable_compression.c +0 -136
  236. package/src/bsdiff/zstd/contrib/seekable_format/examples/seekable_decompression.c +0 -141
  237. package/src/bsdiff/zstd/contrib/seekable_format/examples/seekable_decompression_mem.c +0 -147
  238. package/src/bsdiff/zstd/contrib/seekable_format/tests/Makefile +0 -38
  239. package/src/bsdiff/zstd/contrib/seekable_format/tests/seekable_tests.c +0 -363
  240. package/src/bsdiff/zstd/contrib/seekable_format/zstd_seekable.h +0 -226
  241. package/src/bsdiff/zstd/contrib/seekable_format/zstd_seekable_compression_format.md +0 -116
  242. package/src/bsdiff/zstd/contrib/seekable_format/zstdseek_compress.c +0 -365
  243. package/src/bsdiff/zstd/contrib/seekable_format/zstdseek_decompress.c +0 -595
  244. package/src/bsdiff/zstd/contrib/seqBench/Makefile +0 -58
  245. package/src/bsdiff/zstd/contrib/seqBench/seqBench.c +0 -53
  246. package/src/bsdiff/zstd/contrib/snap/snapcraft.yaml +0 -28
  247. package/src/bsdiff/zstd/doc/README.md +0 -26
  248. package/src/bsdiff/zstd/doc/decompressor_errata.md +0 -148
  249. package/src/bsdiff/zstd/doc/decompressor_permissive.md +0 -60
  250. package/src/bsdiff/zstd/doc/educational_decoder/Makefile +0 -62
  251. package/src/bsdiff/zstd/doc/educational_decoder/README.md +0 -36
  252. package/src/bsdiff/zstd/doc/educational_decoder/harness.c +0 -119
  253. package/src/bsdiff/zstd/doc/educational_decoder/zstd_decompress.c +0 -2323
  254. package/src/bsdiff/zstd/doc/educational_decoder/zstd_decompress.h +0 -61
  255. package/src/bsdiff/zstd/doc/images/CSpeed2.png +0 -0
  256. package/src/bsdiff/zstd/doc/images/DCspeed5.png +0 -0
  257. package/src/bsdiff/zstd/doc/images/DSpeed3.png +0 -0
  258. package/src/bsdiff/zstd/doc/images/cdict_v136.png +0 -0
  259. package/src/bsdiff/zstd/doc/images/dict-cr.png +0 -0
  260. package/src/bsdiff/zstd/doc/images/dict-cs.png +0 -0
  261. package/src/bsdiff/zstd/doc/images/dict-ds.png +0 -0
  262. package/src/bsdiff/zstd/doc/images/zstd_cdict_v1_3_5.png +0 -0
  263. package/src/bsdiff/zstd/doc/images/zstd_logo86.png +0 -0
  264. package/src/bsdiff/zstd/doc/zstd_compression_format.md +0 -1737
  265. package/src/bsdiff/zstd/doc/zstd_manual.html +0 -2170
  266. package/src/bsdiff/zstd/examples/Makefile +0 -93
  267. package/src/bsdiff/zstd/examples/README.md +0 -46
  268. package/src/bsdiff/zstd/examples/common.h +0 -246
  269. package/src/bsdiff/zstd/examples/dictionary_compression.c +0 -107
  270. package/src/bsdiff/zstd/examples/dictionary_decompression.c +0 -99
  271. package/src/bsdiff/zstd/examples/multiple_simple_compression.c +0 -116
  272. package/src/bsdiff/zstd/examples/multiple_streaming_compression.c +0 -133
  273. package/src/bsdiff/zstd/examples/simple_compression.c +0 -68
  274. package/src/bsdiff/zstd/examples/simple_decompression.c +0 -65
  275. package/src/bsdiff/zstd/examples/streaming_compression.c +0 -146
  276. package/src/bsdiff/zstd/examples/streaming_compression_thread_pool.c +0 -180
  277. package/src/bsdiff/zstd/examples/streaming_decompression.c +0 -100
  278. package/src/bsdiff/zstd/examples/streaming_memory_usage.c +0 -137
  279. package/src/bsdiff/zstd/lib/BUCK +0 -232
  280. package/src/bsdiff/zstd/lib/Makefile +0 -369
  281. package/src/bsdiff/zstd/lib/README.md +0 -237
  282. package/src/bsdiff/zstd/lib/common/allocations.h +0 -55
  283. package/src/bsdiff/zstd/lib/common/bits.h +0 -200
  284. package/src/bsdiff/zstd/lib/common/bitstream.h +0 -457
  285. package/src/bsdiff/zstd/lib/common/compiler.h +0 -450
  286. package/src/bsdiff/zstd/lib/common/cpu.h +0 -249
  287. package/src/bsdiff/zstd/lib/common/debug.c +0 -30
  288. package/src/bsdiff/zstd/lib/common/debug.h +0 -116
  289. package/src/bsdiff/zstd/lib/common/entropy_common.c +0 -340
  290. package/src/bsdiff/zstd/lib/common/error_private.c +0 -63
  291. package/src/bsdiff/zstd/lib/common/error_private.h +0 -168
  292. package/src/bsdiff/zstd/lib/common/fse.h +0 -640
  293. package/src/bsdiff/zstd/lib/common/fse_decompress.c +0 -313
  294. package/src/bsdiff/zstd/lib/common/huf.h +0 -286
  295. package/src/bsdiff/zstd/lib/common/mem.h +0 -426
  296. package/src/bsdiff/zstd/lib/common/pool.c +0 -371
  297. package/src/bsdiff/zstd/lib/common/pool.h +0 -90
  298. package/src/bsdiff/zstd/lib/common/portability_macros.h +0 -158
  299. package/src/bsdiff/zstd/lib/common/threading.c +0 -182
  300. package/src/bsdiff/zstd/lib/common/threading.h +0 -150
  301. package/src/bsdiff/zstd/lib/common/xxhash.c +0 -18
  302. package/src/bsdiff/zstd/lib/common/xxhash.h +0 -7020
  303. package/src/bsdiff/zstd/lib/common/zstd_common.c +0 -48
  304. package/src/bsdiff/zstd/lib/common/zstd_deps.h +0 -111
  305. package/src/bsdiff/zstd/lib/common/zstd_internal.h +0 -392
  306. package/src/bsdiff/zstd/lib/common/zstd_trace.h +0 -163
  307. package/src/bsdiff/zstd/lib/compress/clevels.h +0 -134
  308. package/src/bsdiff/zstd/lib/compress/fse_compress.c +0 -625
  309. package/src/bsdiff/zstd/lib/compress/hist.c +0 -181
  310. package/src/bsdiff/zstd/lib/compress/hist.h +0 -75
  311. package/src/bsdiff/zstd/lib/compress/huf_compress.c +0 -1464
  312. package/src/bsdiff/zstd/lib/compress/zstd_compress.c +0 -7153
  313. package/src/bsdiff/zstd/lib/compress/zstd_compress_internal.h +0 -1534
  314. package/src/bsdiff/zstd/lib/compress/zstd_compress_literals.c +0 -235
  315. package/src/bsdiff/zstd/lib/compress/zstd_compress_literals.h +0 -39
  316. package/src/bsdiff/zstd/lib/compress/zstd_compress_sequences.c +0 -442
  317. package/src/bsdiff/zstd/lib/compress/zstd_compress_sequences.h +0 -54
  318. package/src/bsdiff/zstd/lib/compress/zstd_compress_superblock.c +0 -688
  319. package/src/bsdiff/zstd/lib/compress/zstd_compress_superblock.h +0 -32
  320. package/src/bsdiff/zstd/lib/compress/zstd_cwksp.h +0 -748
  321. package/src/bsdiff/zstd/lib/compress/zstd_double_fast.c +0 -770
  322. package/src/bsdiff/zstd/lib/compress/zstd_double_fast.h +0 -50
  323. package/src/bsdiff/zstd/lib/compress/zstd_fast.c +0 -968
  324. package/src/bsdiff/zstd/lib/compress/zstd_fast.h +0 -38
  325. package/src/bsdiff/zstd/lib/compress/zstd_lazy.c +0 -2199
  326. package/src/bsdiff/zstd/lib/compress/zstd_lazy.h +0 -202
  327. package/src/bsdiff/zstd/lib/compress/zstd_ldm.c +0 -730
  328. package/src/bsdiff/zstd/lib/compress/zstd_ldm.h +0 -117
  329. package/src/bsdiff/zstd/lib/compress/zstd_ldm_geartab.h +0 -106
  330. package/src/bsdiff/zstd/lib/compress/zstd_opt.c +0 -1576
  331. package/src/bsdiff/zstd/lib/compress/zstd_opt.h +0 -80
  332. package/src/bsdiff/zstd/lib/compress/zstdmt_compress.c +0 -1882
  333. package/src/bsdiff/zstd/lib/compress/zstdmt_compress.h +0 -113
  334. package/src/bsdiff/zstd/lib/decompress/huf_decompress.c +0 -1944
  335. package/src/bsdiff/zstd/lib/decompress/huf_decompress_amd64.S +0 -595
  336. package/src/bsdiff/zstd/lib/decompress/zstd_ddict.c +0 -244
  337. package/src/bsdiff/zstd/lib/decompress/zstd_ddict.h +0 -44
  338. package/src/bsdiff/zstd/lib/decompress/zstd_decompress.c +0 -2407
  339. package/src/bsdiff/zstd/lib/decompress/zstd_decompress_block.c +0 -2215
  340. package/src/bsdiff/zstd/lib/decompress/zstd_decompress_block.h +0 -73
  341. package/src/bsdiff/zstd/lib/decompress/zstd_decompress_internal.h +0 -240
  342. package/src/bsdiff/zstd/lib/deprecated/zbuff.h +0 -214
  343. package/src/bsdiff/zstd/lib/deprecated/zbuff_common.c +0 -26
  344. package/src/bsdiff/zstd/lib/deprecated/zbuff_compress.c +0 -167
  345. package/src/bsdiff/zstd/lib/deprecated/zbuff_decompress.c +0 -77
  346. package/src/bsdiff/zstd/lib/dictBuilder/cover.c +0 -1261
  347. package/src/bsdiff/zstd/lib/dictBuilder/cover.h +0 -152
  348. package/src/bsdiff/zstd/lib/dictBuilder/divsufsort.c +0 -1913
  349. package/src/bsdiff/zstd/lib/dictBuilder/divsufsort.h +0 -67
  350. package/src/bsdiff/zstd/lib/dictBuilder/fastcover.c +0 -766
  351. package/src/bsdiff/zstd/lib/dictBuilder/zdict.c +0 -1133
  352. package/src/bsdiff/zstd/lib/dll/example/Makefile +0 -48
  353. package/src/bsdiff/zstd/lib/dll/example/README.md +0 -63
  354. package/src/bsdiff/zstd/lib/dll/example/build_package.bat +0 -20
  355. package/src/bsdiff/zstd/lib/dll/example/fullbench-dll.sln +0 -25
  356. package/src/bsdiff/zstd/lib/dll/example/fullbench-dll.vcxproj +0 -181
  357. package/src/bsdiff/zstd/lib/legacy/zstd_legacy.h +0 -452
  358. package/src/bsdiff/zstd/lib/legacy/zstd_v01.c +0 -2127
  359. package/src/bsdiff/zstd/lib/legacy/zstd_v01.h +0 -94
  360. package/src/bsdiff/zstd/lib/legacy/zstd_v02.c +0 -3465
  361. package/src/bsdiff/zstd/lib/legacy/zstd_v02.h +0 -93
  362. package/src/bsdiff/zstd/lib/legacy/zstd_v03.c +0 -3105
  363. package/src/bsdiff/zstd/lib/legacy/zstd_v03.h +0 -93
  364. package/src/bsdiff/zstd/lib/legacy/zstd_v04.c +0 -3598
  365. package/src/bsdiff/zstd/lib/legacy/zstd_v04.h +0 -142
  366. package/src/bsdiff/zstd/lib/legacy/zstd_v05.c +0 -4005
  367. package/src/bsdiff/zstd/lib/legacy/zstd_v05.h +0 -162
  368. package/src/bsdiff/zstd/lib/legacy/zstd_v06.c +0 -4106
  369. package/src/bsdiff/zstd/lib/legacy/zstd_v06.h +0 -172
  370. package/src/bsdiff/zstd/lib/legacy/zstd_v07.c +0 -4490
  371. package/src/bsdiff/zstd/lib/legacy/zstd_v07.h +0 -187
  372. package/src/bsdiff/zstd/lib/libzstd.mk +0 -237
  373. package/src/bsdiff/zstd/lib/libzstd.pc.in +0 -16
  374. package/src/bsdiff/zstd/lib/module.modulemap +0 -35
  375. package/src/bsdiff/zstd/lib/zdict.h +0 -474
  376. package/src/bsdiff/zstd/lib/zstd.h +0 -3089
  377. package/src/bsdiff/zstd/lib/zstd_errors.h +0 -114
  378. package/src/bsdiff/zstd/programs/BUCK +0 -44
  379. package/src/bsdiff/zstd/programs/Makefile +0 -445
  380. package/src/bsdiff/zstd/programs/README.md +0 -302
  381. package/src/bsdiff/zstd/programs/benchfn.c +0 -256
  382. package/src/bsdiff/zstd/programs/benchfn.h +0 -183
  383. package/src/bsdiff/zstd/programs/benchzstd.c +0 -1264
  384. package/src/bsdiff/zstd/programs/benchzstd.h +0 -198
  385. package/src/bsdiff/zstd/programs/datagen.c +0 -186
  386. package/src/bsdiff/zstd/programs/datagen.h +0 -30
  387. package/src/bsdiff/zstd/programs/dibio.c +0 -440
  388. package/src/bsdiff/zstd/programs/dibio.h +0 -39
  389. package/src/bsdiff/zstd/programs/fileio.c +0 -3470
  390. package/src/bsdiff/zstd/programs/fileio.h +0 -181
  391. package/src/bsdiff/zstd/programs/fileio_asyncio.c +0 -663
  392. package/src/bsdiff/zstd/programs/fileio_asyncio.h +0 -203
  393. package/src/bsdiff/zstd/programs/fileio_common.h +0 -125
  394. package/src/bsdiff/zstd/programs/fileio_types.h +0 -86
  395. package/src/bsdiff/zstd/programs/lorem.c +0 -285
  396. package/src/bsdiff/zstd/programs/lorem.h +0 -32
  397. package/src/bsdiff/zstd/programs/platform.h +0 -218
  398. package/src/bsdiff/zstd/programs/timefn.c +0 -168
  399. package/src/bsdiff/zstd/programs/timefn.h +0 -70
  400. package/src/bsdiff/zstd/programs/util.c +0 -1652
  401. package/src/bsdiff/zstd/programs/util.h +0 -359
  402. package/src/bsdiff/zstd/programs/windres/verrsrc.h +0 -17
  403. package/src/bsdiff/zstd/programs/windres/zstd.rc +0 -51
  404. package/src/bsdiff/zstd/programs/windres/zstd32.res +0 -0
  405. package/src/bsdiff/zstd/programs/windres/zstd64.res +0 -0
  406. package/src/bsdiff/zstd/programs/zstd.1 +0 -566
  407. package/src/bsdiff/zstd/programs/zstd.1.md +0 -695
  408. package/src/bsdiff/zstd/programs/zstdcli.c +0 -1625
  409. package/src/bsdiff/zstd/programs/zstdcli_trace.c +0 -172
  410. package/src/bsdiff/zstd/programs/zstdcli_trace.h +0 -24
  411. package/src/bsdiff/zstd/programs/zstdgrep +0 -134
  412. package/src/bsdiff/zstd/programs/zstdgrep.1 +0 -26
  413. package/src/bsdiff/zstd/programs/zstdgrep.1.md +0 -30
  414. package/src/bsdiff/zstd/programs/zstdless +0 -8
  415. package/src/bsdiff/zstd/programs/zstdless.1 +0 -14
  416. package/src/bsdiff/zstd/programs/zstdless.1.md +0 -16
  417. package/src/bsdiff/zstd/tests/DEPRECATED-test-zstd-speed.py +0 -378
  418. package/src/bsdiff/zstd/tests/Makefile +0 -477
  419. package/src/bsdiff/zstd/tests/README.md +0 -184
  420. package/src/bsdiff/zstd/tests/automated_benchmarking.py +0 -326
  421. package/src/bsdiff/zstd/tests/bigdict.c +0 -128
  422. package/src/bsdiff/zstd/tests/checkTag.c +0 -65
  423. package/src/bsdiff/zstd/tests/check_size.py +0 -31
  424. package/src/bsdiff/zstd/tests/cli-tests/README.md +0 -258
  425. package/src/bsdiff/zstd/tests/cli-tests/basic/args.sh +0 -10
  426. package/src/bsdiff/zstd/tests/cli-tests/basic/args.sh.exit +0 -1
  427. package/src/bsdiff/zstd/tests/cli-tests/basic/args.sh.stderr.glob +0 -28
  428. package/src/bsdiff/zstd/tests/cli-tests/basic/help.sh +0 -10
  429. package/src/bsdiff/zstd/tests/cli-tests/basic/help.sh.stdout.glob +0 -34
  430. package/src/bsdiff/zstd/tests/cli-tests/basic/memlimit.sh +0 -40
  431. package/src/bsdiff/zstd/tests/cli-tests/basic/memlimit.sh.stderr.exact +0 -13
  432. package/src/bsdiff/zstd/tests/cli-tests/basic/memlimit.sh.stdout.exact +0 -13
  433. package/src/bsdiff/zstd/tests/cli-tests/basic/output_dir.sh +0 -7
  434. package/src/bsdiff/zstd/tests/cli-tests/basic/output_dir.sh.stderr.exact +0 -2
  435. package/src/bsdiff/zstd/tests/cli-tests/basic/output_dir.sh.stdout.exact +0 -2
  436. package/src/bsdiff/zstd/tests/cli-tests/basic/version.sh +0 -6
  437. package/src/bsdiff/zstd/tests/cli-tests/basic/version.sh.stdout.glob +0 -2
  438. package/src/bsdiff/zstd/tests/cli-tests/bin/cmp_size +0 -44
  439. package/src/bsdiff/zstd/tests/cli-tests/bin/datagen +0 -3
  440. package/src/bsdiff/zstd/tests/cli-tests/bin/die +0 -4
  441. package/src/bsdiff/zstd/tests/cli-tests/bin/println +0 -2
  442. package/src/bsdiff/zstd/tests/cli-tests/bin/zstd +0 -9
  443. package/src/bsdiff/zstd/tests/cli-tests/bin/zstdgrep +0 -2
  444. package/src/bsdiff/zstd/tests/cli-tests/bin/zstdless +0 -2
  445. package/src/bsdiff/zstd/tests/cli-tests/cltools/setup +0 -6
  446. package/src/bsdiff/zstd/tests/cli-tests/cltools/zstdgrep.sh +0 -8
  447. package/src/bsdiff/zstd/tests/cli-tests/cltools/zstdgrep.sh.exit +0 -1
  448. package/src/bsdiff/zstd/tests/cli-tests/cltools/zstdgrep.sh.stderr.exact +0 -1
  449. package/src/bsdiff/zstd/tests/cli-tests/cltools/zstdgrep.sh.stdout.glob +0 -4
  450. package/src/bsdiff/zstd/tests/cli-tests/cltools/zstdless.sh +0 -10
  451. package/src/bsdiff/zstd/tests/cli-tests/cltools/zstdless.sh.stderr.exact +0 -2
  452. package/src/bsdiff/zstd/tests/cli-tests/cltools/zstdless.sh.stdout.glob +0 -5
  453. package/src/bsdiff/zstd/tests/cli-tests/common/format.sh +0 -19
  454. package/src/bsdiff/zstd/tests/cli-tests/common/mtime.sh +0 -13
  455. package/src/bsdiff/zstd/tests/cli-tests/common/permissions.sh +0 -18
  456. package/src/bsdiff/zstd/tests/cli-tests/common/platform.sh +0 -37
  457. package/src/bsdiff/zstd/tests/cli-tests/compression/adapt.sh +0 -14
  458. package/src/bsdiff/zstd/tests/cli-tests/compression/basic.sh +0 -36
  459. package/src/bsdiff/zstd/tests/cli-tests/compression/compress-literals.sh +0 -10
  460. package/src/bsdiff/zstd/tests/cli-tests/compression/format.sh +0 -16
  461. package/src/bsdiff/zstd/tests/cli-tests/compression/golden.sh +0 -16
  462. package/src/bsdiff/zstd/tests/cli-tests/compression/gzip-compat.sh +0 -17
  463. package/src/bsdiff/zstd/tests/cli-tests/compression/levels.sh +0 -62
  464. package/src/bsdiff/zstd/tests/cli-tests/compression/levels.sh.stderr.exact +0 -69
  465. package/src/bsdiff/zstd/tests/cli-tests/compression/long-distance-matcher.sh +0 -7
  466. package/src/bsdiff/zstd/tests/cli-tests/compression/multi-threaded.sh +0 -15
  467. package/src/bsdiff/zstd/tests/cli-tests/compression/multi-threaded.sh.stderr.exact +0 -11
  468. package/src/bsdiff/zstd/tests/cli-tests/compression/multiple-files.sh +0 -21
  469. package/src/bsdiff/zstd/tests/cli-tests/compression/multiple-files.sh.stdout.exact +0 -12
  470. package/src/bsdiff/zstd/tests/cli-tests/compression/row-match-finder.sh +0 -7
  471. package/src/bsdiff/zstd/tests/cli-tests/compression/setup +0 -7
  472. package/src/bsdiff/zstd/tests/cli-tests/compression/stream-size.sh +0 -7
  473. package/src/bsdiff/zstd/tests/cli-tests/compression/verbose-wlog.sh +0 -11
  474. package/src/bsdiff/zstd/tests/cli-tests/compression/verbose-wlog.sh.stderr.glob +0 -5
  475. package/src/bsdiff/zstd/tests/cli-tests/compression/verbose-wlog.sh.stdout.glob +0 -5
  476. package/src/bsdiff/zstd/tests/cli-tests/compression/window-resize.sh +0 -9
  477. package/src/bsdiff/zstd/tests/cli-tests/compression/window-resize.sh.stderr.ignore +0 -0
  478. package/src/bsdiff/zstd/tests/cli-tests/compression/window-resize.sh.stdout.glob +0 -3
  479. package/src/bsdiff/zstd/tests/cli-tests/decompression/detectErrors.sh +0 -11
  480. package/src/bsdiff/zstd/tests/cli-tests/decompression/golden.sh +0 -7
  481. package/src/bsdiff/zstd/tests/cli-tests/decompression/pass-through.sh +0 -57
  482. package/src/bsdiff/zstd/tests/cli-tests/decompression/pass-through.sh.stderr.exact +0 -11
  483. package/src/bsdiff/zstd/tests/cli-tests/decompression/pass-through.sh.stdout.exact +0 -25
  484. package/src/bsdiff/zstd/tests/cli-tests/dict-builder/empty-input.sh +0 -9
  485. package/src/bsdiff/zstd/tests/cli-tests/dict-builder/empty-input.sh.stderr.exact +0 -1
  486. package/src/bsdiff/zstd/tests/cli-tests/dict-builder/no-inputs.sh +0 -3
  487. package/src/bsdiff/zstd/tests/cli-tests/dict-builder/no-inputs.sh.exit +0 -1
  488. package/src/bsdiff/zstd/tests/cli-tests/dict-builder/no-inputs.sh.stderr.exact +0 -5
  489. package/src/bsdiff/zstd/tests/cli-tests/dictionaries/dictionary-mismatch.sh +0 -29
  490. package/src/bsdiff/zstd/tests/cli-tests/dictionaries/dictionary-mismatch.sh.stderr.exact +0 -7
  491. package/src/bsdiff/zstd/tests/cli-tests/dictionaries/golden.sh +0 -9
  492. package/src/bsdiff/zstd/tests/cli-tests/dictionaries/setup +0 -6
  493. package/src/bsdiff/zstd/tests/cli-tests/dictionaries/setup_once +0 -24
  494. package/src/bsdiff/zstd/tests/cli-tests/file-handling/directory-mirror.sh +0 -49
  495. package/src/bsdiff/zstd/tests/cli-tests/file-handling/directory-mirror.sh.stderr.exact +0 -0
  496. package/src/bsdiff/zstd/tests/cli-tests/file-handling/directory-mirror.sh.stdout.exact +0 -0
  497. package/src/bsdiff/zstd/tests/cli-tests/file-stat/compress-file-to-dir-without-write-perm.sh +0 -12
  498. package/src/bsdiff/zstd/tests/cli-tests/file-stat/compress-file-to-dir-without-write-perm.sh.stderr.exact +0 -26
  499. package/src/bsdiff/zstd/tests/cli-tests/file-stat/compress-file-to-file.sh +0 -9
  500. package/src/bsdiff/zstd/tests/cli-tests/file-stat/compress-file-to-file.sh.stderr.exact +0 -42
  501. package/src/bsdiff/zstd/tests/cli-tests/file-stat/compress-file-to-stdout.sh +0 -8
  502. package/src/bsdiff/zstd/tests/cli-tests/file-stat/compress-file-to-stdout.sh.stderr.exact +0 -24
  503. package/src/bsdiff/zstd/tests/cli-tests/file-stat/compress-stdin-to-file.sh +0 -8
  504. package/src/bsdiff/zstd/tests/cli-tests/file-stat/compress-stdin-to-file.sh.stderr.exact +0 -24
  505. package/src/bsdiff/zstd/tests/cli-tests/file-stat/compress-stdin-to-stdout.sh +0 -8
  506. package/src/bsdiff/zstd/tests/cli-tests/file-stat/compress-stdin-to-stdout.sh.stderr.exact +0 -18
  507. package/src/bsdiff/zstd/tests/cli-tests/file-stat/decompress-file-to-file.sh +0 -8
  508. package/src/bsdiff/zstd/tests/cli-tests/file-stat/decompress-file-to-file.sh.stderr.exact +0 -38
  509. package/src/bsdiff/zstd/tests/cli-tests/file-stat/decompress-file-to-stdout.sh +0 -7
  510. package/src/bsdiff/zstd/tests/cli-tests/file-stat/decompress-file-to-stdout.sh.stderr.exact +0 -18
  511. package/src/bsdiff/zstd/tests/cli-tests/file-stat/decompress-stdin-to-file.sh +0 -7
  512. package/src/bsdiff/zstd/tests/cli-tests/file-stat/decompress-stdin-to-file.sh.stderr.exact +0 -20
  513. package/src/bsdiff/zstd/tests/cli-tests/file-stat/decompress-stdin-to-stdout.sh +0 -7
  514. package/src/bsdiff/zstd/tests/cli-tests/file-stat/decompress-stdin-to-stdout.sh.stderr.exact +0 -14
  515. package/src/bsdiff/zstd/tests/cli-tests/progress/no-progress.sh +0 -46
  516. package/src/bsdiff/zstd/tests/cli-tests/progress/no-progress.sh.stderr.glob +0 -96
  517. package/src/bsdiff/zstd/tests/cli-tests/progress/progress.sh +0 -41
  518. package/src/bsdiff/zstd/tests/cli-tests/progress/progress.sh.stderr.glob +0 -62
  519. package/src/bsdiff/zstd/tests/cli-tests/run.py +0 -731
  520. package/src/bsdiff/zstd/tests/cli-tests/zstd-symlinks/setup +0 -6
  521. package/src/bsdiff/zstd/tests/cli-tests/zstd-symlinks/zstdcat.sh +0 -12
  522. package/src/bsdiff/zstd/tests/cli-tests/zstd-symlinks/zstdcat.sh.stdout.exact +0 -8
  523. package/src/bsdiff/zstd/tests/datagencli.c +0 -149
  524. package/src/bsdiff/zstd/tests/decodecorpus.c +0 -1936
  525. package/src/bsdiff/zstd/tests/dict-files/zero-weight-dict +0 -0
  526. package/src/bsdiff/zstd/tests/external_matchfinder.c +0 -140
  527. package/src/bsdiff/zstd/tests/external_matchfinder.h +0 -39
  528. package/src/bsdiff/zstd/tests/fullbench.c +0 -980
  529. package/src/bsdiff/zstd/tests/fuzz/Makefile +0 -277
  530. package/src/bsdiff/zstd/tests/fuzz/README.md +0 -161
  531. package/src/bsdiff/zstd/tests/fuzz/block_decompress.c +0 -53
  532. package/src/bsdiff/zstd/tests/fuzz/block_round_trip.c +0 -103
  533. package/src/bsdiff/zstd/tests/fuzz/decompress_cross_format.c +0 -130
  534. package/src/bsdiff/zstd/tests/fuzz/decompress_dstSize_tooSmall.c +0 -74
  535. package/src/bsdiff/zstd/tests/fuzz/dictionary_decompress.c +0 -77
  536. package/src/bsdiff/zstd/tests/fuzz/dictionary_loader.c +0 -106
  537. package/src/bsdiff/zstd/tests/fuzz/dictionary_round_trip.c +0 -155
  538. package/src/bsdiff/zstd/tests/fuzz/dictionary_stream_round_trip.c +0 -209
  539. package/src/bsdiff/zstd/tests/fuzz/fse_read_ncount.c +0 -100
  540. package/src/bsdiff/zstd/tests/fuzz/fuzz.h +0 -57
  541. package/src/bsdiff/zstd/tests/fuzz/fuzz.py +0 -911
  542. package/src/bsdiff/zstd/tests/fuzz/fuzz_data_producer.c +0 -95
  543. package/src/bsdiff/zstd/tests/fuzz/fuzz_data_producer.h +0 -66
  544. package/src/bsdiff/zstd/tests/fuzz/fuzz_helpers.c +0 -48
  545. package/src/bsdiff/zstd/tests/fuzz/fuzz_helpers.h +0 -81
  546. package/src/bsdiff/zstd/tests/fuzz/fuzz_third_party_seq_prod.h +0 -116
  547. package/src/bsdiff/zstd/tests/fuzz/generate_sequences.c +0 -88
  548. package/src/bsdiff/zstd/tests/fuzz/huf_decompress.c +0 -68
  549. package/src/bsdiff/zstd/tests/fuzz/huf_round_trip.c +0 -137
  550. package/src/bsdiff/zstd/tests/fuzz/raw_dictionary_round_trip.c +0 -119
  551. package/src/bsdiff/zstd/tests/fuzz/regression_driver.c +0 -90
  552. package/src/bsdiff/zstd/tests/fuzz/seekable_roundtrip.c +0 -88
  553. package/src/bsdiff/zstd/tests/fuzz/seq_prod_fuzz_example/Makefile +0 -16
  554. package/src/bsdiff/zstd/tests/fuzz/seq_prod_fuzz_example/README.md +0 -12
  555. package/src/bsdiff/zstd/tests/fuzz/seq_prod_fuzz_example/example_seq_prod.c +0 -52
  556. package/src/bsdiff/zstd/tests/fuzz/sequence_compression_api.c +0 -381
  557. package/src/bsdiff/zstd/tests/fuzz/simple_compress.c +0 -60
  558. package/src/bsdiff/zstd/tests/fuzz/simple_decompress.c +0 -59
  559. package/src/bsdiff/zstd/tests/fuzz/simple_round_trip.c +0 -182
  560. package/src/bsdiff/zstd/tests/fuzz/stream_decompress.c +0 -119
  561. package/src/bsdiff/zstd/tests/fuzz/stream_round_trip.c +0 -218
  562. package/src/bsdiff/zstd/tests/fuzz/zstd_frame_info.c +0 -43
  563. package/src/bsdiff/zstd/tests/fuzz/zstd_helpers.c +0 -207
  564. package/src/bsdiff/zstd/tests/fuzz/zstd_helpers.h +0 -56
  565. package/src/bsdiff/zstd/tests/fuzzer.c +0 -4933
  566. package/src/bsdiff/zstd/tests/golden-compression/PR-3517-block-splitter-corruption-test +0 -1
  567. package/src/bsdiff/zstd/tests/golden-compression/http +0 -1
  568. package/src/bsdiff/zstd/tests/golden-compression/huffman-compressed-larger +0 -0
  569. package/src/bsdiff/zstd/tests/golden-compression/large-literal-and-match-lengths +0 -0
  570. package/src/bsdiff/zstd/tests/golden-decompression/block-128k.zst +0 -0
  571. package/src/bsdiff/zstd/tests/golden-decompression/empty-block.zst +0 -0
  572. package/src/bsdiff/zstd/tests/golden-decompression/rle-first-block.zst +0 -0
  573. package/src/bsdiff/zstd/tests/golden-decompression/zeroSeq_2B.zst +0 -0
  574. package/src/bsdiff/zstd/tests/golden-decompression-errors/off0.bin.zst +0 -0
  575. package/src/bsdiff/zstd/tests/golden-decompression-errors/zeroSeq_extraneous.zst +0 -0
  576. package/src/bsdiff/zstd/tests/golden-dictionaries/http-dict-missing-symbols +0 -0
  577. package/src/bsdiff/zstd/tests/gzip/Makefile +0 -45
  578. package/src/bsdiff/zstd/tests/gzip/gzip-env.sh +0 -46
  579. package/src/bsdiff/zstd/tests/gzip/helin-segv.sh +0 -31
  580. package/src/bsdiff/zstd/tests/gzip/help-version.sh +0 -270
  581. package/src/bsdiff/zstd/tests/gzip/hufts-segv.gz +0 -0
  582. package/src/bsdiff/zstd/tests/gzip/hufts.sh +0 -34
  583. package/src/bsdiff/zstd/tests/gzip/init.cfg +0 -5
  584. package/src/bsdiff/zstd/tests/gzip/init.sh +0 -616
  585. package/src/bsdiff/zstd/tests/gzip/keep.sh +0 -51
  586. package/src/bsdiff/zstd/tests/gzip/list.sh +0 -31
  587. package/src/bsdiff/zstd/tests/gzip/memcpy-abuse.sh +0 -34
  588. package/src/bsdiff/zstd/tests/gzip/mixed.sh +0 -68
  589. package/src/bsdiff/zstd/tests/gzip/null-suffix-clobber.sh +0 -35
  590. package/src/bsdiff/zstd/tests/gzip/stdin.sh +0 -31
  591. package/src/bsdiff/zstd/tests/gzip/test-driver.sh +0 -150
  592. package/src/bsdiff/zstd/tests/gzip/trailing-nul.sh +0 -37
  593. package/src/bsdiff/zstd/tests/gzip/unpack-invalid.sh +0 -36
  594. package/src/bsdiff/zstd/tests/gzip/z-suffix.sh +0 -30
  595. package/src/bsdiff/zstd/tests/gzip/zdiff.sh +0 -48
  596. package/src/bsdiff/zstd/tests/gzip/zgrep-context.sh +0 -47
  597. package/src/bsdiff/zstd/tests/gzip/zgrep-f.sh +0 -43
  598. package/src/bsdiff/zstd/tests/gzip/zgrep-signal.sh +0 -64
  599. package/src/bsdiff/zstd/tests/gzip/znew-k.sh +0 -40
  600. package/src/bsdiff/zstd/tests/invalidDictionaries.c +0 -61
  601. package/src/bsdiff/zstd/tests/legacy.c +0 -260
  602. package/src/bsdiff/zstd/tests/libzstd_builds.sh +0 -104
  603. package/src/bsdiff/zstd/tests/longmatch.c +0 -102
  604. package/src/bsdiff/zstd/tests/loremOut.c +0 -50
  605. package/src/bsdiff/zstd/tests/loremOut.h +0 -15
  606. package/src/bsdiff/zstd/tests/paramgrill.c +0 -2966
  607. package/src/bsdiff/zstd/tests/playTests.sh +0 -1928
  608. package/src/bsdiff/zstd/tests/poolTests.c +0 -271
  609. package/src/bsdiff/zstd/tests/rateLimiter.py +0 -41
  610. package/src/bsdiff/zstd/tests/regression/Makefile +0 -60
  611. package/src/bsdiff/zstd/tests/regression/README.md +0 -28
  612. package/src/bsdiff/zstd/tests/regression/config.c +0 -404
  613. package/src/bsdiff/zstd/tests/regression/config.h +0 -91
  614. package/src/bsdiff/zstd/tests/regression/data.c +0 -631
  615. package/src/bsdiff/zstd/tests/regression/data.h +0 -121
  616. package/src/bsdiff/zstd/tests/regression/levels.h +0 -59
  617. package/src/bsdiff/zstd/tests/regression/method.c +0 -701
  618. package/src/bsdiff/zstd/tests/regression/method.h +0 -65
  619. package/src/bsdiff/zstd/tests/regression/result.c +0 -28
  620. package/src/bsdiff/zstd/tests/regression/result.h +0 -103
  621. package/src/bsdiff/zstd/tests/regression/results.csv +0 -1480
  622. package/src/bsdiff/zstd/tests/regression/test.c +0 -362
  623. package/src/bsdiff/zstd/tests/roundTripCrash.c +0 -241
  624. package/src/bsdiff/zstd/tests/seqgen.c +0 -260
  625. package/src/bsdiff/zstd/tests/seqgen.h +0 -58
  626. package/src/bsdiff/zstd/tests/test-license.py +0 -156
  627. package/src/bsdiff/zstd/tests/test-variants.sh +0 -115
  628. package/src/bsdiff/zstd/tests/test-zstd-versions.py +0 -308
  629. package/src/bsdiff/zstd/tests/zstreamtest.c +0 -3407
  630. package/src/bsdiff/zstd/zlibWrapper/BUCK +0 -22
  631. package/src/bsdiff/zstd/zlibWrapper/Makefile +0 -120
  632. package/src/bsdiff/zstd/zlibWrapper/README.md +0 -163
  633. package/src/bsdiff/zstd/zlibWrapper/examples/example.c +0 -598
  634. package/src/bsdiff/zstd/zlibWrapper/examples/example_original.c +0 -599
  635. package/src/bsdiff/zstd/zlibWrapper/examples/fitblk.c +0 -254
  636. package/src/bsdiff/zstd/zlibWrapper/examples/fitblk_original.c +0 -233
  637. package/src/bsdiff/zstd/zlibWrapper/examples/minigzip.c +0 -605
  638. package/src/bsdiff/zstd/zlibWrapper/examples/zwrapbench.c +0 -1018
  639. package/src/bsdiff/zstd/zlibWrapper/gzclose.c +0 -26
  640. package/src/bsdiff/zstd/zlibWrapper/gzcompatibility.h +0 -68
  641. package/src/bsdiff/zstd/zlibWrapper/gzguts.h +0 -229
  642. package/src/bsdiff/zstd/zlibWrapper/gzlib.c +0 -587
  643. package/src/bsdiff/zstd/zlibWrapper/gzread.c +0 -637
  644. package/src/bsdiff/zstd/zlibWrapper/gzwrite.c +0 -631
  645. package/src/bsdiff/zstd/zlibWrapper/zstd_zlibwrapper.c +0 -1200
  646. package/src/bsdiff/zstd/zlibWrapper/zstd_zlibwrapper.h +0 -91
  647. package/src/objc/build/objcWrapper.o +0 -0
  648. package/src/objc/objcWrapper.m +0 -1380
  649. package/src/zig/build/index.js +0 -782
  650. package/src/zig/build/libObjcWrapper.a +0 -0
  651. package/src/zig/build.zig +0 -29
  652. package/src/zig/macos/application.zig +0 -6
  653. package/src/zig/macos/objc.zig +0 -123
  654. package/src/zig/macos/tray.zig +0 -102
  655. package/src/zig/macos/webview.zig +0 -693
  656. package/src/zig/macos/window.zig +0 -189
  657. package/src/zig/main.zig +0 -16
  658. package/src/zig/rpc/pipesin.zig +0 -202
  659. package/src/zig/rpc/rpc.zig +0 -19
  660. package/src/zig/rpc/schema/handlers.zig +0 -402
  661. package/src/zig/rpc/schema/request.zig +0 -59
  662. package/src/zig/rpc/schema/schema.zig +0 -412
  663. package/src/zig/rpc/stdin.zig +0 -112
  664. package/src/zig/rpc/stdout.zig +0 -106
  665. package/src/zig/rpc/types.zig +0 -41
  666. package/src/zig/utils.zig +0 -49
  667. package/src/zig/zig-out/bin/webview +0 -0
@@ -1,1625 +0,0 @@
1
- /*
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- * All rights reserved.
4
- *
5
- * This source code is licensed under both the BSD-style license (found in the
6
- * LICENSE file in the root directory of this source tree) and the GPLv2 (found
7
- * in the COPYING file in the root directory of this source tree).
8
- * You may select, at your option, one of the above-listed licenses.
9
- */
10
-
11
-
12
- /*-************************************
13
- * Tuning parameters
14
- **************************************/
15
- #ifndef ZSTDCLI_CLEVEL_DEFAULT
16
- # define ZSTDCLI_CLEVEL_DEFAULT 3
17
- #endif
18
-
19
- #ifndef ZSTDCLI_CLEVEL_MAX
20
- # define ZSTDCLI_CLEVEL_MAX 19 /* without using --ultra */
21
- #endif
22
-
23
- #ifndef ZSTDCLI_NBTHREADS_DEFAULT
24
- # define ZSTDCLI_NBTHREADS_DEFAULT 1
25
- #endif
26
-
27
- /*-************************************
28
- * Dependencies
29
- **************************************/
30
- #include "platform.h" /* PLATFORM_POSIX_VERSION */
31
- #include "util.h" /* UTIL_HAS_CREATEFILELIST, UTIL_createFileList, UTIL_isConsole */
32
- #include <stdlib.h> /* getenv */
33
- #include <string.h> /* strcmp, strlen */
34
- #include <stdio.h> /* fprintf(), stdin, stdout, stderr */
35
- #include <errno.h> /* errno */
36
- #include <assert.h> /* assert */
37
-
38
- #include "fileio.h" /* stdinmark, stdoutmark, ZSTD_EXTENSION */
39
- #ifndef ZSTD_NOBENCH
40
- # include "benchzstd.h" /* BMK_benchFilesAdvanced */
41
- #endif
42
- #ifndef ZSTD_NODICT
43
- # include "dibio.h" /* ZDICT_cover_params_t, DiB_trainFromFiles() */
44
- #endif
45
- #ifndef ZSTD_NOTRACE
46
- # include "zstdcli_trace.h"
47
- #endif
48
- #include "../lib/zstd.h" /* ZSTD_VERSION_STRING, ZSTD_minCLevel, ZSTD_maxCLevel */
49
- #include "fileio_asyncio.h"
50
-
51
-
52
- /*-************************************
53
- * Constants
54
- **************************************/
55
- #define COMPRESSOR_NAME "Zstandard CLI"
56
- #ifndef ZSTD_VERSION
57
- # define ZSTD_VERSION "v" ZSTD_VERSION_STRING
58
- #endif
59
- #define AUTHOR "Yann Collet"
60
- #define WELCOME_MESSAGE "*** %s (%i-bit) %s, by %s ***\n", COMPRESSOR_NAME, (int)(sizeof(size_t)*8), ZSTD_VERSION, AUTHOR
61
-
62
- #define ZSTD_ZSTDMT "zstdmt"
63
- #define ZSTD_UNZSTD "unzstd"
64
- #define ZSTD_CAT "zstdcat"
65
- #define ZSTD_ZCAT "zcat"
66
- #define ZSTD_GZ "gzip"
67
- #define ZSTD_GUNZIP "gunzip"
68
- #define ZSTD_GZCAT "gzcat"
69
- #define ZSTD_LZMA "lzma"
70
- #define ZSTD_UNLZMA "unlzma"
71
- #define ZSTD_XZ "xz"
72
- #define ZSTD_UNXZ "unxz"
73
- #define ZSTD_LZ4 "lz4"
74
- #define ZSTD_UNLZ4 "unlz4"
75
-
76
- #define KB *(1 <<10)
77
- #define MB *(1 <<20)
78
- #define GB *(1U<<30)
79
-
80
- #define DISPLAY_LEVEL_DEFAULT 2
81
-
82
- static const char* g_defaultDictName = "dictionary";
83
- static const unsigned g_defaultMaxDictSize = 110 KB;
84
- static const int g_defaultDictCLevel = 3;
85
- static const unsigned g_defaultSelectivityLevel = 9;
86
- static const unsigned g_defaultMaxWindowLog = 27;
87
- #define OVERLAP_LOG_DEFAULT 9999
88
- #define LDM_PARAM_DEFAULT 9999 /* Default for parameters where 0 is valid */
89
- static U32 g_overlapLog = OVERLAP_LOG_DEFAULT;
90
- static U32 g_ldmHashLog = 0;
91
- static U32 g_ldmMinMatch = 0;
92
- static U32 g_ldmHashRateLog = LDM_PARAM_DEFAULT;
93
- static U32 g_ldmBucketSizeLog = LDM_PARAM_DEFAULT;
94
-
95
-
96
- #define DEFAULT_ACCEL 1
97
-
98
- typedef enum { cover, fastCover, legacy } dictType;
99
-
100
- /*-************************************
101
- * Display Macros
102
- **************************************/
103
- #define DISPLAY_F(f, ...) fprintf((f), __VA_ARGS__)
104
- #define DISPLAYOUT(...) DISPLAY_F(stdout, __VA_ARGS__)
105
- #define DISPLAY(...) DISPLAY_F(stderr, __VA_ARGS__)
106
- #define DISPLAYLEVEL(l, ...) { if (g_displayLevel>=l) { DISPLAY(__VA_ARGS__); } }
107
- static int g_displayLevel = DISPLAY_LEVEL_DEFAULT; /* 0 : no display, 1: errors, 2 : + result + interaction + warnings, 3 : + progression, 4 : + information */
108
-
109
-
110
- /*-************************************
111
- * Check Version (when CLI linked to dynamic library)
112
- **************************************/
113
-
114
- /* Due to usage of experimental symbols and capabilities by the CLI,
115
- * the CLI must be linked against a dynamic library of same version */
116
- static void checkLibVersion(void)
117
- {
118
- if (strcmp(ZSTD_VERSION_STRING, ZSTD_versionString())) {
119
- DISPLAYLEVEL(1, "Error : incorrect library version (expecting : %s ; actual : %s ) \n",
120
- ZSTD_VERSION_STRING, ZSTD_versionString());
121
- DISPLAYLEVEL(1, "Please update library to version %s, or use stand-alone zstd binary \n",
122
- ZSTD_VERSION_STRING);
123
- exit(1);
124
- }
125
- }
126
-
127
-
128
- /*! exeNameMatch() :
129
- @return : a non-zero value if exeName matches test, excluding the extension
130
- */
131
- static int exeNameMatch(const char* exeName, const char* test)
132
- {
133
- return !strncmp(exeName, test, strlen(test)) &&
134
- (exeName[strlen(test)] == '\0' || exeName[strlen(test)] == '.');
135
- }
136
-
137
- /*-************************************
138
- * Command Line
139
- **************************************/
140
- /* print help either in `stderr` or `stdout` depending on originating request
141
- * error (badUsage) => stderr
142
- * help (usageAdvanced) => stdout
143
- */
144
- static void usage(FILE* f, const char* programName)
145
- {
146
- DISPLAY_F(f, "Compress or decompress the INPUT file(s); reads from STDIN if INPUT is `-` or not provided.\n\n");
147
- DISPLAY_F(f, "Usage: %s [OPTIONS...] [INPUT... | -] [-o OUTPUT]\n\n", programName);
148
- DISPLAY_F(f, "Options:\n");
149
- DISPLAY_F(f, " -o OUTPUT Write output to a single file, OUTPUT.\n");
150
- DISPLAY_F(f, " -k, --keep Preserve INPUT file(s). [Default] \n");
151
- DISPLAY_F(f, " --rm Remove INPUT file(s) after successful (de)compression.\n");
152
- #ifdef ZSTD_GZCOMPRESS
153
- if (exeNameMatch(programName, ZSTD_GZ)) { /* behave like gzip */
154
- DISPLAY_F(f, " -n, --no-name Do not store original filename when compressing.\n\n");
155
- }
156
- #endif
157
- DISPLAY_F(f, "\n");
158
- #ifndef ZSTD_NOCOMPRESS
159
- DISPLAY_F(f, " -# Desired compression level, where `#` is a number between 1 and %d;\n", ZSTDCLI_CLEVEL_MAX);
160
- DISPLAY_F(f, " lower numbers provide faster compression, higher numbers yield\n");
161
- DISPLAY_F(f, " better compression ratios. [Default: %d]\n\n", ZSTDCLI_CLEVEL_DEFAULT);
162
- #endif
163
- #ifndef ZSTD_NODECOMPRESS
164
- DISPLAY_F(f, " -d, --decompress Perform decompression.\n");
165
- #endif
166
- DISPLAY_F(f, " -D DICT Use DICT as the dictionary for compression or decompression.\n\n");
167
- DISPLAY_F(f, " -f, --force Disable input and output checks. Allows overwriting existing files,\n");
168
- DISPLAY_F(f, " receiving input from the console, printing output to STDOUT, and\n");
169
- DISPLAY_F(f, " operating on links, block devices, etc. Unrecognized formats will be\n");
170
- DISPLAY_F(f, " passed-through through as-is.\n\n");
171
-
172
- DISPLAY_F(f, " -h Display short usage and exit.\n");
173
- DISPLAY_F(f, " -H, --help Display full help and exit.\n");
174
- DISPLAY_F(f, " -V, --version Display the program version and exit.\n");
175
- DISPLAY_F(f, "\n");
176
- }
177
-
178
- static void usageAdvanced(const char* programName)
179
- {
180
- DISPLAYOUT(WELCOME_MESSAGE);
181
- DISPLAYOUT("\n");
182
- usage(stdout, programName);
183
- DISPLAYOUT("Advanced options:\n");
184
- DISPLAYOUT(" -c, --stdout Write to STDOUT (even if it is a console) and keep the INPUT file(s).\n\n");
185
-
186
- DISPLAYOUT(" -v, --verbose Enable verbose output; pass multiple times to increase verbosity.\n");
187
- DISPLAYOUT(" -q, --quiet Suppress warnings; pass twice to suppress errors.\n");
188
- #ifndef ZSTD_NOTRACE
189
- DISPLAYOUT(" --trace LOG Log tracing information to LOG.\n");
190
- #endif
191
- DISPLAYOUT("\n");
192
- DISPLAYOUT(" --[no-]progress Forcibly show/hide the progress counter. NOTE: Any (de)compressed\n");
193
- DISPLAYOUT(" output to terminal will mix with progress counter text.\n\n");
194
-
195
- #ifdef UTIL_HAS_CREATEFILELIST
196
- DISPLAYOUT(" -r Operate recursively on directories.\n");
197
- DISPLAYOUT(" --filelist LIST Read a list of files to operate on from LIST.\n");
198
- DISPLAYOUT(" --output-dir-flat DIR Store processed files in DIR.\n");
199
- #endif
200
-
201
- #ifdef UTIL_HAS_MIRRORFILELIST
202
- DISPLAYOUT(" --output-dir-mirror DIR Store processed files in DIR, respecting original directory structure.\n");
203
- #endif
204
- if (AIO_supported())
205
- DISPLAYOUT(" --[no-]asyncio Use asynchronous IO. [Default: Enabled]\n");
206
-
207
- DISPLAYOUT("\n");
208
- #ifndef ZSTD_NOCOMPRESS
209
- DISPLAYOUT(" --[no-]check Add XXH64 integrity checksums during compression. [Default: Add, Validate]\n");
210
- #ifndef ZSTD_NODECOMPRESS
211
- DISPLAYOUT(" If `-d` is present, ignore/validate checksums during decompression.\n");
212
- #endif
213
- #else
214
- #ifdef ZSTD_NOCOMPRESS
215
- DISPLAYOUT(" --[no-]check Ignore/validate checksums during decompression. [Default: Validate]");
216
- #endif
217
- #endif /* ZSTD_NOCOMPRESS */
218
-
219
- DISPLAYOUT("\n");
220
- DISPLAYOUT(" -- Treat remaining arguments after `--` as files.\n");
221
-
222
- #ifndef ZSTD_NOCOMPRESS
223
- DISPLAYOUT("\n");
224
- DISPLAYOUT("Advanced compression options:\n");
225
- DISPLAYOUT(" --ultra Enable levels beyond %i, up to %i; requires more memory.\n", ZSTDCLI_CLEVEL_MAX, ZSTD_maxCLevel());
226
- DISPLAYOUT(" --fast[=#] Use to very fast compression levels. [Default: %u]\n", 1);
227
- #ifdef ZSTD_GZCOMPRESS
228
- if (exeNameMatch(programName, ZSTD_GZ)) { /* behave like gzip */
229
- DISPLAYOUT(" --best Compatibility alias for `-9`.\n");
230
- }
231
- #endif
232
- DISPLAYOUT(" --adapt Dynamically adapt compression level to I/O conditions.\n");
233
- DISPLAYOUT(" --long[=#] Enable long distance matching with window log #. [Default: %u]\n", g_defaultMaxWindowLog);
234
- DISPLAYOUT(" --patch-from=REF Use REF as the reference point for Zstandard's diff engine. \n\n");
235
- # ifdef ZSTD_MULTITHREAD
236
- DISPLAYOUT(" -T# Spawn # compression threads. [Default: 1; pass 0 for core count.]\n");
237
- DISPLAYOUT(" --single-thread Share a single thread for I/O and compression (slightly different than `-T1`).\n");
238
- DISPLAYOUT(" --auto-threads={physical|logical}\n");
239
- DISPLAYOUT(" Use physical/logical cores when using `-T0`. [Default: Physical]\n\n");
240
- DISPLAYOUT(" -B# Set job size to #. [Default: 0 (automatic)]\n");
241
- DISPLAYOUT(" --rsyncable Compress using a rsync-friendly method (`-B` sets block size). \n");
242
- DISPLAYOUT("\n");
243
- # endif
244
- DISPLAYOUT(" --exclude-compressed Only compress files that are not already compressed.\n\n");
245
-
246
- DISPLAYOUT(" --stream-size=# Specify size of streaming input from STDIN.\n");
247
- DISPLAYOUT(" --size-hint=# Optimize compression parameters for streaming input of approximately size #.\n");
248
- DISPLAYOUT(" --target-compressed-block-size=#\n");
249
- DISPLAYOUT(" Generate compressed blocks of approximately # size.\n\n");
250
- DISPLAYOUT(" --no-dictID Don't write `dictID` into the header (dictionary compression only).\n");
251
- DISPLAYOUT(" --[no-]compress-literals Force (un)compressed literals.\n");
252
- DISPLAYOUT(" --[no-]row-match-finder Explicitly enable/disable the fast, row-based matchfinder for\n");
253
- DISPLAYOUT(" the 'greedy', 'lazy', and 'lazy2' strategies.\n");
254
-
255
- DISPLAYOUT("\n");
256
- DISPLAYOUT(" --format=zstd Compress files to the `.zst` format. [Default]\n");
257
- DISPLAYOUT(" --[no-]mmap-dict Memory-map dictionary file rather than mallocing and loading all at once\n");
258
- #ifdef ZSTD_GZCOMPRESS
259
- DISPLAYOUT(" --format=gzip Compress files to the `.gz` format.\n");
260
- #endif
261
- #ifdef ZSTD_LZMACOMPRESS
262
- DISPLAYOUT(" --format=xz Compress files to the `.xz` format.\n");
263
- DISPLAYOUT(" --format=lzma Compress files to the `.lzma` format.\n");
264
- #endif
265
- #ifdef ZSTD_LZ4COMPRESS
266
- DISPLAYOUT( " --format=lz4 Compress files to the `.lz4` format.\n");
267
- #endif
268
- #endif /* !ZSTD_NOCOMPRESS */
269
-
270
- #ifndef ZSTD_NODECOMPRESS
271
- DISPLAYOUT("\n");
272
- DISPLAYOUT("Advanced decompression options:\n");
273
- DISPLAYOUT(" -l Print information about Zstandard-compressed files.\n");
274
- DISPLAYOUT(" --test Test compressed file integrity.\n");
275
- DISPLAYOUT(" -M# Set the memory usage limit to # megabytes.\n");
276
- # if ZSTD_SPARSE_DEFAULT
277
- DISPLAYOUT(" --[no-]sparse Enable sparse mode. [Default: Enabled for files, disabled for STDOUT.]\n");
278
- # else
279
- DISPLAYOUT(" --[no-]sparse Enable sparse mode. [Default: Disabled]\n");
280
- # endif
281
- {
282
- char const* passThroughDefault = "Disabled";
283
- if (exeNameMatch(programName, ZSTD_CAT) ||
284
- exeNameMatch(programName, ZSTD_ZCAT) ||
285
- exeNameMatch(programName, ZSTD_GZCAT)) {
286
- passThroughDefault = "Enabled";
287
- }
288
- DISPLAYOUT(" --[no-]pass-through Pass through uncompressed files as-is. [Default: %s]\n", passThroughDefault);
289
- }
290
- #endif /* ZSTD_NODECOMPRESS */
291
-
292
- #ifndef ZSTD_NODICT
293
- DISPLAYOUT("\n");
294
- DISPLAYOUT("Dictionary builder:\n");
295
- DISPLAYOUT(" --train Create a dictionary from a training set of files.\n\n");
296
- DISPLAYOUT(" --train-cover[=k=#,d=#,steps=#,split=#,shrink[=#]]\n");
297
- DISPLAYOUT(" Use the cover algorithm (with optional arguments).\n");
298
- DISPLAYOUT(" --train-fastcover[=k=#,d=#,f=#,steps=#,split=#,accel=#,shrink[=#]]\n");
299
- DISPLAYOUT(" Use the fast cover algorithm (with optional arguments).\n\n");
300
- DISPLAYOUT(" --train-legacy[=s=#] Use the legacy algorithm with selectivity #. [Default: %u]\n", g_defaultSelectivityLevel);
301
- DISPLAYOUT(" -o NAME Use NAME as dictionary name. [Default: %s]\n", g_defaultDictName);
302
- DISPLAYOUT(" --maxdict=# Limit dictionary to specified size #. [Default: %u]\n", g_defaultMaxDictSize);
303
- DISPLAYOUT(" --dictID=# Force dictionary ID to #. [Default: Random]\n");
304
- #endif
305
-
306
- #ifndef ZSTD_NOBENCH
307
- DISPLAYOUT("\n");
308
- DISPLAYOUT("Benchmark options:\n");
309
- DISPLAYOUT(" -b# Perform benchmarking with compression level #. [Default: %d]\n", ZSTDCLI_CLEVEL_DEFAULT);
310
- DISPLAYOUT(" -e# Test all compression levels up to #; starting level is `-b#`. [Default: 1]\n");
311
- DISPLAYOUT(" -i# Set the minimum evaluation to time # seconds. [Default: 3]\n");
312
- DISPLAYOUT(" -B# Cut file into independent chunks of size #. [Default: No chunking]\n");
313
- DISPLAYOUT(" -S Output one benchmark result per input file. [Default: Consolidated result]\n");
314
- DISPLAYOUT(" --priority=rt Set process priority to real-time.\n");
315
- #endif
316
-
317
- }
318
-
319
- static void badUsage(const char* programName, const char* parameter)
320
- {
321
- DISPLAYLEVEL(1, "Incorrect parameter: %s \n", parameter);
322
- if (g_displayLevel >= 2) usage(stderr, programName);
323
- }
324
-
325
- static void waitEnter(void)
326
- {
327
- int unused;
328
- DISPLAY("Press enter to continue... \n");
329
- unused = getchar();
330
- (void)unused;
331
- }
332
-
333
- static const char* lastNameFromPath(const char* path)
334
- {
335
- const char* name = path;
336
- if (strrchr(name, '/')) name = strrchr(name, '/') + 1;
337
- if (strrchr(name, '\\')) name = strrchr(name, '\\') + 1; /* windows */
338
- return name;
339
- }
340
-
341
- static void errorOut(const char* msg)
342
- {
343
- DISPLAYLEVEL(1, "%s \n", msg); exit(1);
344
- }
345
-
346
- /*! readU32FromCharChecked() :
347
- * @return 0 if success, and store the result in *value.
348
- * allows and interprets K, KB, KiB, M, MB and MiB suffix.
349
- * Will also modify `*stringPtr`, advancing it to position where it stopped reading.
350
- * @return 1 if an overflow error occurs */
351
- static int readU32FromCharChecked(const char** stringPtr, unsigned* value)
352
- {
353
- unsigned result = 0;
354
- while ((**stringPtr >='0') && (**stringPtr <='9')) {
355
- unsigned const max = ((unsigned)(-1)) / 10;
356
- unsigned last = result;
357
- if (result > max) return 1; /* overflow error */
358
- result *= 10;
359
- result += (unsigned)(**stringPtr - '0');
360
- if (result < last) return 1; /* overflow error */
361
- (*stringPtr)++ ;
362
- }
363
- if ((**stringPtr=='K') || (**stringPtr=='M')) {
364
- unsigned const maxK = ((unsigned)(-1)) >> 10;
365
- if (result > maxK) return 1; /* overflow error */
366
- result <<= 10;
367
- if (**stringPtr=='M') {
368
- if (result > maxK) return 1; /* overflow error */
369
- result <<= 10;
370
- }
371
- (*stringPtr)++; /* skip `K` or `M` */
372
- if (**stringPtr=='i') (*stringPtr)++;
373
- if (**stringPtr=='B') (*stringPtr)++;
374
- }
375
- *value = result;
376
- return 0;
377
- }
378
-
379
- /*! readU32FromChar() :
380
- * @return : unsigned integer value read from input in `char` format.
381
- * allows and interprets K, KB, KiB, M, MB and MiB suffix.
382
- * Will also modify `*stringPtr`, advancing it to position where it stopped reading.
383
- * Note : function will exit() program if digit sequence overflows */
384
- static unsigned readU32FromChar(const char** stringPtr) {
385
- static const char errorMsg[] = "error: numeric value overflows 32-bit unsigned int";
386
- unsigned result;
387
- if (readU32FromCharChecked(stringPtr, &result)) { errorOut(errorMsg); }
388
- return result;
389
- }
390
-
391
- /*! readIntFromChar() :
392
- * @return : signed integer value read from input in `char` format.
393
- * allows and interprets K, KB, KiB, M, MB and MiB suffix.
394
- * Will also modify `*stringPtr`, advancing it to position where it stopped reading.
395
- * Note : function will exit() program if digit sequence overflows */
396
- static int readIntFromChar(const char** stringPtr) {
397
- static const char errorMsg[] = "error: numeric value overflows 32-bit int";
398
- int sign = 1;
399
- unsigned result;
400
- if (**stringPtr=='-') {
401
- (*stringPtr)++;
402
- sign = -1;
403
- }
404
- if (readU32FromCharChecked(stringPtr, &result)) { errorOut(errorMsg); }
405
- return (int) result * sign;
406
- }
407
-
408
- /*! readSizeTFromCharChecked() :
409
- * @return 0 if success, and store the result in *value.
410
- * allows and interprets K, KB, KiB, M, MB and MiB suffix.
411
- * Will also modify `*stringPtr`, advancing it to position where it stopped reading.
412
- * @return 1 if an overflow error occurs */
413
- static int readSizeTFromCharChecked(const char** stringPtr, size_t* value)
414
- {
415
- size_t result = 0;
416
- while ((**stringPtr >='0') && (**stringPtr <='9')) {
417
- size_t const max = ((size_t)(-1)) / 10;
418
- size_t last = result;
419
- if (result > max) return 1; /* overflow error */
420
- result *= 10;
421
- result += (size_t)(**stringPtr - '0');
422
- if (result < last) return 1; /* overflow error */
423
- (*stringPtr)++ ;
424
- }
425
- if ((**stringPtr=='K') || (**stringPtr=='M')) {
426
- size_t const maxK = ((size_t)(-1)) >> 10;
427
- if (result > maxK) return 1; /* overflow error */
428
- result <<= 10;
429
- if (**stringPtr=='M') {
430
- if (result > maxK) return 1; /* overflow error */
431
- result <<= 10;
432
- }
433
- (*stringPtr)++; /* skip `K` or `M` */
434
- if (**stringPtr=='i') (*stringPtr)++;
435
- if (**stringPtr=='B') (*stringPtr)++;
436
- }
437
- *value = result;
438
- return 0;
439
- }
440
-
441
- /*! readSizeTFromChar() :
442
- * @return : size_t value read from input in `char` format.
443
- * allows and interprets K, KB, KiB, M, MB and MiB suffix.
444
- * Will also modify `*stringPtr`, advancing it to position where it stopped reading.
445
- * Note : function will exit() program if digit sequence overflows */
446
- static size_t readSizeTFromChar(const char** stringPtr) {
447
- static const char errorMsg[] = "error: numeric value overflows size_t";
448
- size_t result;
449
- if (readSizeTFromCharChecked(stringPtr, &result)) { errorOut(errorMsg); }
450
- return result;
451
- }
452
-
453
- /** longCommandWArg() :
454
- * check if *stringPtr is the same as longCommand.
455
- * If yes, @return 1 and advances *stringPtr to the position which immediately follows longCommand.
456
- * @return 0 and doesn't modify *stringPtr otherwise.
457
- */
458
- static int longCommandWArg(const char** stringPtr, const char* longCommand)
459
- {
460
- size_t const comSize = strlen(longCommand);
461
- int const result = !strncmp(*stringPtr, longCommand, comSize);
462
- if (result) *stringPtr += comSize;
463
- return result;
464
- }
465
-
466
-
467
- #ifndef ZSTD_NODICT
468
-
469
- static const unsigned kDefaultRegression = 1;
470
- /**
471
- * parseCoverParameters() :
472
- * reads cover parameters from *stringPtr (e.g. "--train-cover=k=48,d=8,steps=32") into *params
473
- * @return 1 means that cover parameters were correct
474
- * @return 0 in case of malformed parameters
475
- */
476
- static unsigned parseCoverParameters(const char* stringPtr, ZDICT_cover_params_t* params)
477
- {
478
- memset(params, 0, sizeof(*params));
479
- for (; ;) {
480
- if (longCommandWArg(&stringPtr, "k=")) { params->k = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
481
- if (longCommandWArg(&stringPtr, "d=")) { params->d = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
482
- if (longCommandWArg(&stringPtr, "steps=")) { params->steps = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
483
- if (longCommandWArg(&stringPtr, "split=")) {
484
- unsigned splitPercentage = readU32FromChar(&stringPtr);
485
- params->splitPoint = (double)splitPercentage / 100.0;
486
- if (stringPtr[0]==',') { stringPtr++; continue; } else break;
487
- }
488
- if (longCommandWArg(&stringPtr, "shrink")) {
489
- params->shrinkDictMaxRegression = kDefaultRegression;
490
- params->shrinkDict = 1;
491
- if (stringPtr[0]=='=') {
492
- stringPtr++;
493
- params->shrinkDictMaxRegression = readU32FromChar(&stringPtr);
494
- }
495
- if (stringPtr[0]==',') {
496
- stringPtr++;
497
- continue;
498
- }
499
- else break;
500
- }
501
- return 0;
502
- }
503
- if (stringPtr[0] != 0) return 0;
504
- DISPLAYLEVEL(4, "cover: k=%u\nd=%u\nsteps=%u\nsplit=%u\nshrink%u\n", params->k, params->d, params->steps, (unsigned)(params->splitPoint * 100), params->shrinkDictMaxRegression);
505
- return 1;
506
- }
507
-
508
- /**
509
- * parseFastCoverParameters() :
510
- * reads fastcover parameters from *stringPtr (e.g. "--train-fastcover=k=48,d=8,f=20,steps=32,accel=2") into *params
511
- * @return 1 means that fastcover parameters were correct
512
- * @return 0 in case of malformed parameters
513
- */
514
- static unsigned parseFastCoverParameters(const char* stringPtr, ZDICT_fastCover_params_t* params)
515
- {
516
- memset(params, 0, sizeof(*params));
517
- for (; ;) {
518
- if (longCommandWArg(&stringPtr, "k=")) { params->k = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
519
- if (longCommandWArg(&stringPtr, "d=")) { params->d = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
520
- if (longCommandWArg(&stringPtr, "f=")) { params->f = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
521
- if (longCommandWArg(&stringPtr, "steps=")) { params->steps = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
522
- if (longCommandWArg(&stringPtr, "accel=")) { params->accel = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
523
- if (longCommandWArg(&stringPtr, "split=")) {
524
- unsigned splitPercentage = readU32FromChar(&stringPtr);
525
- params->splitPoint = (double)splitPercentage / 100.0;
526
- if (stringPtr[0]==',') { stringPtr++; continue; } else break;
527
- }
528
- if (longCommandWArg(&stringPtr, "shrink")) {
529
- params->shrinkDictMaxRegression = kDefaultRegression;
530
- params->shrinkDict = 1;
531
- if (stringPtr[0]=='=') {
532
- stringPtr++;
533
- params->shrinkDictMaxRegression = readU32FromChar(&stringPtr);
534
- }
535
- if (stringPtr[0]==',') {
536
- stringPtr++;
537
- continue;
538
- }
539
- else break;
540
- }
541
- return 0;
542
- }
543
- if (stringPtr[0] != 0) return 0;
544
- DISPLAYLEVEL(4, "cover: k=%u\nd=%u\nf=%u\nsteps=%u\nsplit=%u\naccel=%u\nshrink=%u\n", params->k, params->d, params->f, params->steps, (unsigned)(params->splitPoint * 100), params->accel, params->shrinkDictMaxRegression);
545
- return 1;
546
- }
547
-
548
- /**
549
- * parseLegacyParameters() :
550
- * reads legacy dictionary builder parameters from *stringPtr (e.g. "--train-legacy=selectivity=8") into *selectivity
551
- * @return 1 means that legacy dictionary builder parameters were correct
552
- * @return 0 in case of malformed parameters
553
- */
554
- static unsigned parseLegacyParameters(const char* stringPtr, unsigned* selectivity)
555
- {
556
- if (!longCommandWArg(&stringPtr, "s=") && !longCommandWArg(&stringPtr, "selectivity=")) { return 0; }
557
- *selectivity = readU32FromChar(&stringPtr);
558
- if (stringPtr[0] != 0) return 0;
559
- DISPLAYLEVEL(4, "legacy: selectivity=%u\n", *selectivity);
560
- return 1;
561
- }
562
-
563
- static ZDICT_cover_params_t defaultCoverParams(void)
564
- {
565
- ZDICT_cover_params_t params;
566
- memset(&params, 0, sizeof(params));
567
- params.d = 8;
568
- params.steps = 4;
569
- params.splitPoint = 1.0;
570
- params.shrinkDict = 0;
571
- params.shrinkDictMaxRegression = kDefaultRegression;
572
- return params;
573
- }
574
-
575
- static ZDICT_fastCover_params_t defaultFastCoverParams(void)
576
- {
577
- ZDICT_fastCover_params_t params;
578
- memset(&params, 0, sizeof(params));
579
- params.d = 8;
580
- params.f = 20;
581
- params.steps = 4;
582
- params.splitPoint = 0.75; /* different from default splitPoint of cover */
583
- params.accel = DEFAULT_ACCEL;
584
- params.shrinkDict = 0;
585
- params.shrinkDictMaxRegression = kDefaultRegression;
586
- return params;
587
- }
588
- #endif
589
-
590
-
591
- /** parseAdaptParameters() :
592
- * reads adapt parameters from *stringPtr (e.g. "--adapt=min=1,max=19) and store them into adaptMinPtr and adaptMaxPtr.
593
- * Both adaptMinPtr and adaptMaxPtr must be already allocated and correctly initialized.
594
- * There is no guarantee that any of these values will be updated.
595
- * @return 1 means that parsing was successful,
596
- * @return 0 in case of malformed parameters
597
- */
598
- static unsigned parseAdaptParameters(const char* stringPtr, int* adaptMinPtr, int* adaptMaxPtr)
599
- {
600
- for ( ; ;) {
601
- if (longCommandWArg(&stringPtr, "min=")) { *adaptMinPtr = readIntFromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
602
- if (longCommandWArg(&stringPtr, "max=")) { *adaptMaxPtr = readIntFromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
603
- DISPLAYLEVEL(4, "invalid compression parameter \n");
604
- return 0;
605
- }
606
- if (stringPtr[0] != 0) return 0; /* check the end of string */
607
- if (*adaptMinPtr > *adaptMaxPtr) {
608
- DISPLAYLEVEL(4, "incoherent adaptation limits \n");
609
- return 0;
610
- }
611
- return 1;
612
- }
613
-
614
-
615
- /** parseCompressionParameters() :
616
- * reads compression parameters from *stringPtr (e.g. "--zstd=wlog=23,clog=23,hlog=22,slog=6,mml=3,tlen=48,strat=6") into *params
617
- * @return 1 means that compression parameters were correct
618
- * @return 0 in case of malformed parameters
619
- */
620
- static unsigned parseCompressionParameters(const char* stringPtr, ZSTD_compressionParameters* params)
621
- {
622
- for ( ; ;) {
623
- if (longCommandWArg(&stringPtr, "windowLog=") || longCommandWArg(&stringPtr, "wlog=")) { params->windowLog = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
624
- if (longCommandWArg(&stringPtr, "chainLog=") || longCommandWArg(&stringPtr, "clog=")) { params->chainLog = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
625
- if (longCommandWArg(&stringPtr, "hashLog=") || longCommandWArg(&stringPtr, "hlog=")) { params->hashLog = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
626
- if (longCommandWArg(&stringPtr, "searchLog=") || longCommandWArg(&stringPtr, "slog=")) { params->searchLog = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
627
- if (longCommandWArg(&stringPtr, "minMatch=") || longCommandWArg(&stringPtr, "mml=")) { params->minMatch = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
628
- if (longCommandWArg(&stringPtr, "targetLength=") || longCommandWArg(&stringPtr, "tlen=")) { params->targetLength = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
629
- if (longCommandWArg(&stringPtr, "strategy=") || longCommandWArg(&stringPtr, "strat=")) { params->strategy = (ZSTD_strategy)(readU32FromChar(&stringPtr)); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
630
- if (longCommandWArg(&stringPtr, "overlapLog=") || longCommandWArg(&stringPtr, "ovlog=")) { g_overlapLog = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
631
- if (longCommandWArg(&stringPtr, "ldmHashLog=") || longCommandWArg(&stringPtr, "lhlog=")) { g_ldmHashLog = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
632
- if (longCommandWArg(&stringPtr, "ldmMinMatch=") || longCommandWArg(&stringPtr, "lmml=")) { g_ldmMinMatch = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
633
- if (longCommandWArg(&stringPtr, "ldmBucketSizeLog=") || longCommandWArg(&stringPtr, "lblog=")) { g_ldmBucketSizeLog = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
634
- if (longCommandWArg(&stringPtr, "ldmHashRateLog=") || longCommandWArg(&stringPtr, "lhrlog=")) { g_ldmHashRateLog = readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; }
635
- DISPLAYLEVEL(4, "invalid compression parameter \n");
636
- return 0;
637
- }
638
-
639
- DISPLAYLEVEL(4, "windowLog=%d, chainLog=%d, hashLog=%d, searchLog=%d \n", params->windowLog, params->chainLog, params->hashLog, params->searchLog);
640
- DISPLAYLEVEL(4, "minMatch=%d, targetLength=%d, strategy=%d \n", params->minMatch, params->targetLength, params->strategy);
641
- if (stringPtr[0] != 0) return 0; /* check the end of string */
642
- return 1;
643
- }
644
-
645
- static void printVersion(void)
646
- {
647
- if (g_displayLevel < DISPLAY_LEVEL_DEFAULT) {
648
- DISPLAYOUT("%s\n", ZSTD_VERSION_STRING);
649
- return;
650
- }
651
-
652
- DISPLAYOUT(WELCOME_MESSAGE);
653
- if (g_displayLevel >= 3) {
654
- /* format support */
655
- DISPLAYOUT("*** supports: zstd");
656
- #if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>0) && (ZSTD_LEGACY_SUPPORT<8)
657
- DISPLAYOUT(", zstd legacy v0.%d+", ZSTD_LEGACY_SUPPORT);
658
- #endif
659
- #ifdef ZSTD_GZCOMPRESS
660
- DISPLAYOUT(", gzip");
661
- #endif
662
- #ifdef ZSTD_LZ4COMPRESS
663
- DISPLAYOUT(", lz4");
664
- #endif
665
- #ifdef ZSTD_LZMACOMPRESS
666
- DISPLAYOUT(", lzma, xz ");
667
- #endif
668
- DISPLAYOUT("\n");
669
- if (g_displayLevel >= 4) {
670
- /* library versions */
671
- DISPLAYOUT("zlib version %s\n", FIO_zlibVersion());
672
- DISPLAYOUT("lz4 version %s\n", FIO_lz4Version());
673
- DISPLAYOUT("lzma version %s\n", FIO_lzmaVersion());
674
-
675
- /* posix support */
676
- #ifdef _POSIX_C_SOURCE
677
- DISPLAYOUT("_POSIX_C_SOURCE defined: %ldL\n", (long) _POSIX_C_SOURCE);
678
- #endif
679
- #ifdef _POSIX_VERSION
680
- DISPLAYOUT("_POSIX_VERSION defined: %ldL \n", (long) _POSIX_VERSION);
681
- #endif
682
- #ifdef PLATFORM_POSIX_VERSION
683
- DISPLAYOUT("PLATFORM_POSIX_VERSION defined: %ldL\n", (long) PLATFORM_POSIX_VERSION);
684
- #endif
685
- } }
686
- }
687
-
688
- #define ZSTD_NB_STRATEGIES 9
689
- static const char* ZSTD_strategyMap[ZSTD_NB_STRATEGIES + 1] = { "", "ZSTD_fast",
690
- "ZSTD_dfast", "ZSTD_greedy", "ZSTD_lazy", "ZSTD_lazy2", "ZSTD_btlazy2",
691
- "ZSTD_btopt", "ZSTD_btultra", "ZSTD_btultra2"};
692
-
693
- #ifndef ZSTD_NOCOMPRESS
694
-
695
- static void printDefaultCParams(const char* filename, const char* dictFileName, int cLevel) {
696
- unsigned long long fileSize = UTIL_getFileSize(filename);
697
- const size_t dictSize = dictFileName != NULL ? (size_t)UTIL_getFileSize(dictFileName) : 0;
698
- const ZSTD_compressionParameters cParams = ZSTD_getCParams(cLevel, fileSize, dictSize);
699
- if (fileSize != UTIL_FILESIZE_UNKNOWN) DISPLAY("%s (%u bytes)\n", filename, (unsigned)fileSize);
700
- else DISPLAY("%s (src size unknown)\n", filename);
701
- DISPLAY(" - windowLog : %u\n", cParams.windowLog);
702
- DISPLAY(" - chainLog : %u\n", cParams.chainLog);
703
- DISPLAY(" - hashLog : %u\n", cParams.hashLog);
704
- DISPLAY(" - searchLog : %u\n", cParams.searchLog);
705
- DISPLAY(" - minMatch : %u\n", cParams.minMatch);
706
- DISPLAY(" - targetLength : %u\n", cParams.targetLength);
707
- assert(cParams.strategy < ZSTD_NB_STRATEGIES + 1);
708
- DISPLAY(" - strategy : %s (%u)\n", ZSTD_strategyMap[(int)cParams.strategy], (unsigned)cParams.strategy);
709
- }
710
-
711
- static void printActualCParams(const char* filename, const char* dictFileName, int cLevel, const ZSTD_compressionParameters* cParams) {
712
- unsigned long long fileSize = UTIL_getFileSize(filename);
713
- const size_t dictSize = dictFileName != NULL ? (size_t)UTIL_getFileSize(dictFileName) : 0;
714
- ZSTD_compressionParameters actualCParams = ZSTD_getCParams(cLevel, fileSize, dictSize);
715
- assert(g_displayLevel >= 4);
716
- actualCParams.windowLog = cParams->windowLog == 0 ? actualCParams.windowLog : cParams->windowLog;
717
- actualCParams.chainLog = cParams->chainLog == 0 ? actualCParams.chainLog : cParams->chainLog;
718
- actualCParams.hashLog = cParams->hashLog == 0 ? actualCParams.hashLog : cParams->hashLog;
719
- actualCParams.searchLog = cParams->searchLog == 0 ? actualCParams.searchLog : cParams->searchLog;
720
- actualCParams.minMatch = cParams->minMatch == 0 ? actualCParams.minMatch : cParams->minMatch;
721
- actualCParams.targetLength = cParams->targetLength == 0 ? actualCParams.targetLength : cParams->targetLength;
722
- actualCParams.strategy = cParams->strategy == 0 ? actualCParams.strategy : cParams->strategy;
723
- DISPLAY("--zstd=wlog=%d,clog=%d,hlog=%d,slog=%d,mml=%d,tlen=%d,strat=%d\n",
724
- actualCParams.windowLog, actualCParams.chainLog, actualCParams.hashLog, actualCParams.searchLog,
725
- actualCParams.minMatch, actualCParams.targetLength, actualCParams.strategy);
726
- }
727
-
728
- #endif
729
-
730
- /* Environment variables for parameter setting */
731
- #define ENV_CLEVEL "ZSTD_CLEVEL"
732
- #define ENV_NBTHREADS "ZSTD_NBTHREADS" /* takes lower precedence than directly specifying -T# in the CLI */
733
-
734
- /* pick up environment variable */
735
- static int init_cLevel(void) {
736
- const char* const env = getenv(ENV_CLEVEL);
737
- if (env != NULL) {
738
- const char* ptr = env;
739
- int sign = 1;
740
- if (*ptr == '-') {
741
- sign = -1;
742
- ptr++;
743
- } else if (*ptr == '+') {
744
- ptr++;
745
- }
746
-
747
- if ((*ptr>='0') && (*ptr<='9')) {
748
- unsigned absLevel;
749
- if (readU32FromCharChecked(&ptr, &absLevel)) {
750
- DISPLAYLEVEL(2, "Ignore environment variable setting %s=%s: numeric value too large \n", ENV_CLEVEL, env);
751
- return ZSTDCLI_CLEVEL_DEFAULT;
752
- } else if (*ptr == 0) {
753
- return sign * (int)absLevel;
754
- } }
755
-
756
- DISPLAYLEVEL(2, "Ignore environment variable setting %s=%s: not a valid integer value \n", ENV_CLEVEL, env);
757
- }
758
-
759
- return ZSTDCLI_CLEVEL_DEFAULT;
760
- }
761
-
762
- #ifdef ZSTD_MULTITHREAD
763
- static unsigned init_nbThreads(void) {
764
- const char* const env = getenv(ENV_NBTHREADS);
765
- if (env != NULL) {
766
- const char* ptr = env;
767
- if ((*ptr>='0') && (*ptr<='9')) {
768
- unsigned nbThreads;
769
- if (readU32FromCharChecked(&ptr, &nbThreads)) {
770
- DISPLAYLEVEL(2, "Ignore environment variable setting %s=%s: numeric value too large \n", ENV_NBTHREADS, env);
771
- return ZSTDCLI_NBTHREADS_DEFAULT;
772
- } else if (*ptr == 0) {
773
- return nbThreads;
774
- }
775
- }
776
- DISPLAYLEVEL(2, "Ignore environment variable setting %s=%s: not a valid unsigned value \n", ENV_NBTHREADS, env);
777
- }
778
-
779
- return ZSTDCLI_NBTHREADS_DEFAULT;
780
- }
781
- #endif
782
-
783
- #define NEXT_FIELD(ptr) { \
784
- if (*argument == '=') { \
785
- ptr = ++argument; \
786
- argument += strlen(ptr); \
787
- } else { \
788
- argNb++; \
789
- if (argNb >= argCount) { \
790
- DISPLAYLEVEL(1, "error: missing command argument \n"); \
791
- CLEAN_RETURN(1); \
792
- } \
793
- ptr = argv[argNb]; \
794
- assert(ptr != NULL); \
795
- if (ptr[0]=='-') { \
796
- DISPLAYLEVEL(1, "error: command cannot be separated from its argument by another command \n"); \
797
- CLEAN_RETURN(1); \
798
- } } }
799
-
800
- #define NEXT_UINT32(val32) { \
801
- const char* __nb; \
802
- NEXT_FIELD(__nb); \
803
- val32 = readU32FromChar(&__nb); \
804
- if(*__nb != 0) { \
805
- errorOut("error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB are allowed"); \
806
- } \
807
- }
808
-
809
- #define NEXT_TSIZE(valTsize) { \
810
- const char* __nb; \
811
- NEXT_FIELD(__nb); \
812
- valTsize = readSizeTFromChar(&__nb); \
813
- if(*__nb != 0) { \
814
- errorOut("error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB are allowed"); \
815
- } \
816
- }
817
-
818
- typedef enum { zom_compress, zom_decompress, zom_test, zom_bench, zom_train, zom_list } zstd_operation_mode;
819
-
820
- #define CLEAN_RETURN(i) { operationResult = (i); goto _end; }
821
-
822
- #ifdef ZSTD_NOCOMPRESS
823
- /* symbols from compression library are not defined and should not be invoked */
824
- # define MINCLEVEL -99
825
- # define MAXCLEVEL 22
826
- #else
827
- # define MINCLEVEL ZSTD_minCLevel()
828
- # define MAXCLEVEL ZSTD_maxCLevel()
829
- #endif
830
-
831
- int main(int argCount, const char* argv[])
832
- {
833
- int argNb,
834
- followLinks = 0,
835
- allowBlockDevices = 0,
836
- forceStdin = 0,
837
- forceStdout = 0,
838
- hasStdout = 0,
839
- ldmFlag = 0,
840
- main_pause = 0,
841
- adapt = 0,
842
- adaptMin = MINCLEVEL,
843
- adaptMax = MAXCLEVEL,
844
- rsyncable = 0,
845
- nextArgumentsAreFiles = 0,
846
- operationResult = 0,
847
- separateFiles = 0,
848
- setRealTimePrio = 0,
849
- singleThread = 0,
850
- defaultLogicalCores = 0,
851
- showDefaultCParams = 0,
852
- ultra=0,
853
- contentSize=1,
854
- removeSrcFile=0;
855
- ZSTD_paramSwitch_e mmapDict=ZSTD_ps_auto;
856
- ZSTD_paramSwitch_e useRowMatchFinder = ZSTD_ps_auto;
857
- FIO_compressionType_t cType = FIO_zstdCompression;
858
- unsigned nbWorkers = 0;
859
- double compressibility = -1.0; /* lorem ipsum generator */
860
- unsigned bench_nbSeconds = 3; /* would be better if this value was synchronized from bench */
861
- size_t blockSize = 0;
862
-
863
- FIO_prefs_t* const prefs = FIO_createPreferences();
864
- FIO_ctx_t* const fCtx = FIO_createContext();
865
- FIO_progressSetting_e progress = FIO_ps_auto;
866
- zstd_operation_mode operation = zom_compress;
867
- ZSTD_compressionParameters compressionParams;
868
- int cLevel = init_cLevel();
869
- int cLevelLast = MINCLEVEL - 1; /* lower than minimum */
870
- unsigned recursive = 0;
871
- unsigned memLimit = 0;
872
- FileNamesTable* filenames = UTIL_allocateFileNamesTable((size_t)argCount); /* argCount >= 1 */
873
- FileNamesTable* file_of_names = UTIL_allocateFileNamesTable((size_t)argCount); /* argCount >= 1 */
874
- const char* programName = argv[0];
875
- const char* outFileName = NULL;
876
- const char* outDirName = NULL;
877
- const char* outMirroredDirName = NULL;
878
- const char* dictFileName = NULL;
879
- const char* patchFromDictFileName = NULL;
880
- const char* suffix = ZSTD_EXTENSION;
881
- unsigned maxDictSize = g_defaultMaxDictSize;
882
- unsigned dictID = 0;
883
- size_t streamSrcSize = 0;
884
- size_t targetCBlockSize = 0;
885
- size_t srcSizeHint = 0;
886
- size_t nbInputFileNames = 0;
887
- int dictCLevel = g_defaultDictCLevel;
888
- unsigned dictSelect = g_defaultSelectivityLevel;
889
- #ifndef ZSTD_NODICT
890
- ZDICT_cover_params_t coverParams = defaultCoverParams();
891
- ZDICT_fastCover_params_t fastCoverParams = defaultFastCoverParams();
892
- dictType dict = fastCover;
893
- #endif
894
- #ifndef ZSTD_NOBENCH
895
- BMK_advancedParams_t benchParams = BMK_initAdvancedParams();
896
- #endif
897
- ZSTD_paramSwitch_e literalCompressionMode = ZSTD_ps_auto;
898
-
899
-
900
- /* init */
901
- checkLibVersion();
902
- (void)recursive; (void)cLevelLast; /* not used when ZSTD_NOBENCH set */
903
- (void)memLimit;
904
- assert(argCount >= 1);
905
- if ((filenames==NULL) || (file_of_names==NULL)) { DISPLAYLEVEL(1, "zstd: allocation error \n"); exit(1); }
906
- programName = lastNameFromPath(programName);
907
- #ifdef ZSTD_MULTITHREAD
908
- nbWorkers = init_nbThreads();
909
- #endif
910
-
911
- /* preset behaviors */
912
- if (exeNameMatch(programName, ZSTD_ZSTDMT)) nbWorkers=0, singleThread=0;
913
- if (exeNameMatch(programName, ZSTD_UNZSTD)) operation=zom_decompress;
914
- if (exeNameMatch(programName, ZSTD_CAT)) { operation=zom_decompress; FIO_overwriteMode(prefs); forceStdout=1; followLinks=1; FIO_setPassThroughFlag(prefs, 1); outFileName=stdoutmark; g_displayLevel=1; } /* supports multiple formats */
915
- if (exeNameMatch(programName, ZSTD_ZCAT)) { operation=zom_decompress; FIO_overwriteMode(prefs); forceStdout=1; followLinks=1; FIO_setPassThroughFlag(prefs, 1); outFileName=stdoutmark; g_displayLevel=1; } /* behave like zcat, also supports multiple formats */
916
- if (exeNameMatch(programName, ZSTD_GZ)) { /* behave like gzip */
917
- suffix = GZ_EXTENSION; cType = FIO_gzipCompression; removeSrcFile=1;
918
- dictCLevel = cLevel = 6; /* gzip default is -6 */
919
- }
920
- if (exeNameMatch(programName, ZSTD_GUNZIP)) { operation=zom_decompress; removeSrcFile=1; } /* behave like gunzip, also supports multiple formats */
921
- if (exeNameMatch(programName, ZSTD_GZCAT)) { operation=zom_decompress; FIO_overwriteMode(prefs); forceStdout=1; followLinks=1; FIO_setPassThroughFlag(prefs, 1); outFileName=stdoutmark; g_displayLevel=1; } /* behave like gzcat, also supports multiple formats */
922
- if (exeNameMatch(programName, ZSTD_LZMA)) { suffix = LZMA_EXTENSION; cType = FIO_lzmaCompression; removeSrcFile=1; } /* behave like lzma */
923
- if (exeNameMatch(programName, ZSTD_UNLZMA)) { operation=zom_decompress; cType = FIO_lzmaCompression; removeSrcFile=1; } /* behave like unlzma, also supports multiple formats */
924
- if (exeNameMatch(programName, ZSTD_XZ)) { suffix = XZ_EXTENSION; cType = FIO_xzCompression; removeSrcFile=1; } /* behave like xz */
925
- if (exeNameMatch(programName, ZSTD_UNXZ)) { operation=zom_decompress; cType = FIO_xzCompression; removeSrcFile=1; } /* behave like unxz, also supports multiple formats */
926
- if (exeNameMatch(programName, ZSTD_LZ4)) { suffix = LZ4_EXTENSION; cType = FIO_lz4Compression; } /* behave like lz4 */
927
- if (exeNameMatch(programName, ZSTD_UNLZ4)) { operation=zom_decompress; cType = FIO_lz4Compression; } /* behave like unlz4, also supports multiple formats */
928
- memset(&compressionParams, 0, sizeof(compressionParams));
929
-
930
- /* init crash handler */
931
- FIO_addAbortHandler();
932
-
933
- /* command switches */
934
- for (argNb=1; argNb<argCount; argNb++) {
935
- const char* argument = argv[argNb];
936
- const char* const originalArgument = argument;
937
- if (!argument) continue; /* Protection if argument empty */
938
-
939
- if (nextArgumentsAreFiles) {
940
- UTIL_refFilename(filenames, argument);
941
- continue;
942
- }
943
-
944
- /* "-" means stdin/stdout */
945
- if (!strcmp(argument, "-")){
946
- UTIL_refFilename(filenames, stdinmark);
947
- continue;
948
- }
949
-
950
- /* Decode commands (note : aggregated commands are allowed) */
951
- if (argument[0]=='-') {
952
-
953
- if (argument[1]=='-') {
954
- /* long commands (--long-word) */
955
- if (!strcmp(argument, "--")) { nextArgumentsAreFiles=1; continue; } /* only file names allowed from now on */
956
- if (!strcmp(argument, "--list")) { operation=zom_list; continue; }
957
- if (!strcmp(argument, "--compress")) { operation=zom_compress; continue; }
958
- if (!strcmp(argument, "--decompress")) { operation=zom_decompress; continue; }
959
- if (!strcmp(argument, "--uncompress")) { operation=zom_decompress; continue; }
960
- if (!strcmp(argument, "--force")) { FIO_overwriteMode(prefs); forceStdin=1; forceStdout=1; followLinks=1; allowBlockDevices=1; continue; }
961
- if (!strcmp(argument, "--version")) { printVersion(); CLEAN_RETURN(0); }
962
- if (!strcmp(argument, "--help")) { usageAdvanced(programName); CLEAN_RETURN(0); }
963
- if (!strcmp(argument, "--verbose")) { g_displayLevel++; continue; }
964
- if (!strcmp(argument, "--quiet")) { g_displayLevel--; continue; }
965
- if (!strcmp(argument, "--stdout")) { forceStdout=1; outFileName=stdoutmark; continue; }
966
- if (!strcmp(argument, "--ultra")) { ultra=1; continue; }
967
- if (!strcmp(argument, "--check")) { FIO_setChecksumFlag(prefs, 2); continue; }
968
- if (!strcmp(argument, "--no-check")) { FIO_setChecksumFlag(prefs, 0); continue; }
969
- if (!strcmp(argument, "--sparse")) { FIO_setSparseWrite(prefs, 2); continue; }
970
- if (!strcmp(argument, "--no-sparse")) { FIO_setSparseWrite(prefs, 0); continue; }
971
- if (!strcmp(argument, "--pass-through")) { FIO_setPassThroughFlag(prefs, 1); continue; }
972
- if (!strcmp(argument, "--no-pass-through")) { FIO_setPassThroughFlag(prefs, 0); continue; }
973
- if (!strcmp(argument, "--test")) { operation=zom_test; continue; }
974
- if (!strcmp(argument, "--asyncio")) { FIO_setAsyncIOFlag(prefs, 1); continue;}
975
- if (!strcmp(argument, "--no-asyncio")) { FIO_setAsyncIOFlag(prefs, 0); continue;}
976
- if (!strcmp(argument, "--train")) { operation=zom_train; if (outFileName==NULL) outFileName=g_defaultDictName; continue; }
977
- if (!strcmp(argument, "--no-dictID")) { FIO_setDictIDFlag(prefs, 0); continue; }
978
- if (!strcmp(argument, "--keep")) { removeSrcFile=0; continue; }
979
- if (!strcmp(argument, "--rm")) { removeSrcFile=1; continue; }
980
- if (!strcmp(argument, "--priority=rt")) { setRealTimePrio = 1; continue; }
981
- if (!strcmp(argument, "--show-default-cparams")) { showDefaultCParams = 1; continue; }
982
- if (!strcmp(argument, "--content-size")) { contentSize = 1; continue; }
983
- if (!strcmp(argument, "--no-content-size")) { contentSize = 0; continue; }
984
- if (!strcmp(argument, "--adapt")) { adapt = 1; continue; }
985
- if (!strcmp(argument, "--no-row-match-finder")) { useRowMatchFinder = ZSTD_ps_disable; continue; }
986
- if (!strcmp(argument, "--row-match-finder")) { useRowMatchFinder = ZSTD_ps_enable; continue; }
987
- if (longCommandWArg(&argument, "--adapt=")) { adapt = 1; if (!parseAdaptParameters(argument, &adaptMin, &adaptMax)) { badUsage(programName, originalArgument); CLEAN_RETURN(1); } continue; }
988
- if (!strcmp(argument, "--single-thread")) { nbWorkers = 0; singleThread = 1; continue; }
989
- if (!strcmp(argument, "--format=zstd")) { suffix = ZSTD_EXTENSION; cType = FIO_zstdCompression; continue; }
990
- if (!strcmp(argument, "--mmap-dict")) { mmapDict = ZSTD_ps_enable; continue; }
991
- if (!strcmp(argument, "--no-mmap-dict")) { mmapDict = ZSTD_ps_disable; continue; }
992
- #ifdef ZSTD_GZCOMPRESS
993
- if (!strcmp(argument, "--format=gzip")) { suffix = GZ_EXTENSION; cType = FIO_gzipCompression; continue; }
994
- if (exeNameMatch(programName, ZSTD_GZ)) { /* behave like gzip */
995
- if (!strcmp(argument, "--best")) { dictCLevel = cLevel = 9; continue; }
996
- if (!strcmp(argument, "--no-name")) { /* ignore for now */; continue; }
997
- }
998
- #endif
999
- #ifdef ZSTD_LZMACOMPRESS
1000
- if (!strcmp(argument, "--format=lzma")) { suffix = LZMA_EXTENSION; cType = FIO_lzmaCompression; continue; }
1001
- if (!strcmp(argument, "--format=xz")) { suffix = XZ_EXTENSION; cType = FIO_xzCompression; continue; }
1002
- #endif
1003
- #ifdef ZSTD_LZ4COMPRESS
1004
- if (!strcmp(argument, "--format=lz4")) { suffix = LZ4_EXTENSION; cType = FIO_lz4Compression; continue; }
1005
- #endif
1006
- if (!strcmp(argument, "--rsyncable")) { rsyncable = 1; continue; }
1007
- if (!strcmp(argument, "--compress-literals")) { literalCompressionMode = ZSTD_ps_enable; continue; }
1008
- if (!strcmp(argument, "--no-compress-literals")) { literalCompressionMode = ZSTD_ps_disable; continue; }
1009
- if (!strcmp(argument, "--no-progress")) { progress = FIO_ps_never; continue; }
1010
- if (!strcmp(argument, "--progress")) { progress = FIO_ps_always; continue; }
1011
- if (!strcmp(argument, "--exclude-compressed")) { FIO_setExcludeCompressedFile(prefs, 1); continue; }
1012
- if (!strcmp(argument, "--fake-stdin-is-console")) { UTIL_fakeStdinIsConsole(); continue; }
1013
- if (!strcmp(argument, "--fake-stdout-is-console")) { UTIL_fakeStdoutIsConsole(); continue; }
1014
- if (!strcmp(argument, "--fake-stderr-is-console")) { UTIL_fakeStderrIsConsole(); continue; }
1015
- if (!strcmp(argument, "--trace-file-stat")) { UTIL_traceFileStat(); continue; }
1016
-
1017
- /* long commands with arguments */
1018
- #ifndef ZSTD_NODICT
1019
- if (longCommandWArg(&argument, "--train-cover")) {
1020
- operation = zom_train;
1021
- if (outFileName == NULL)
1022
- outFileName = g_defaultDictName;
1023
- dict = cover;
1024
- /* Allow optional arguments following an = */
1025
- if (*argument == 0) { memset(&coverParams, 0, sizeof(coverParams)); }
1026
- else if (*argument++ != '=') { badUsage(programName, originalArgument); CLEAN_RETURN(1); }
1027
- else if (!parseCoverParameters(argument, &coverParams)) { badUsage(programName, originalArgument); CLEAN_RETURN(1); }
1028
- continue;
1029
- }
1030
- if (longCommandWArg(&argument, "--train-fastcover")) {
1031
- operation = zom_train;
1032
- if (outFileName == NULL)
1033
- outFileName = g_defaultDictName;
1034
- dict = fastCover;
1035
- /* Allow optional arguments following an = */
1036
- if (*argument == 0) { memset(&fastCoverParams, 0, sizeof(fastCoverParams)); }
1037
- else if (*argument++ != '=') { badUsage(programName, originalArgument); CLEAN_RETURN(1); }
1038
- else if (!parseFastCoverParameters(argument, &fastCoverParams)) { badUsage(programName, originalArgument); CLEAN_RETURN(1); }
1039
- continue;
1040
- }
1041
- if (longCommandWArg(&argument, "--train-legacy")) {
1042
- operation = zom_train;
1043
- if (outFileName == NULL)
1044
- outFileName = g_defaultDictName;
1045
- dict = legacy;
1046
- /* Allow optional arguments following an = */
1047
- if (*argument == 0) { continue; }
1048
- else if (*argument++ != '=') { badUsage(programName, originalArgument); CLEAN_RETURN(1); }
1049
- else if (!parseLegacyParameters(argument, &dictSelect)) { badUsage(programName, originalArgument); CLEAN_RETURN(1); }
1050
- continue;
1051
- }
1052
- #endif
1053
- if (longCommandWArg(&argument, "--threads")) { NEXT_UINT32(nbWorkers); continue; }
1054
- if (longCommandWArg(&argument, "--memlimit")) { NEXT_UINT32(memLimit); continue; }
1055
- if (longCommandWArg(&argument, "--memory")) { NEXT_UINT32(memLimit); continue; }
1056
- if (longCommandWArg(&argument, "--memlimit-decompress")) { NEXT_UINT32(memLimit); continue; }
1057
- if (longCommandWArg(&argument, "--block-size")) { NEXT_TSIZE(blockSize); continue; }
1058
- if (longCommandWArg(&argument, "--maxdict")) { NEXT_UINT32(maxDictSize); continue; }
1059
- if (longCommandWArg(&argument, "--dictID")) { NEXT_UINT32(dictID); continue; }
1060
- if (longCommandWArg(&argument, "--zstd=")) { if (!parseCompressionParameters(argument, &compressionParams)) { badUsage(programName, originalArgument); CLEAN_RETURN(1); } ; cType = FIO_zstdCompression; continue; }
1061
- if (longCommandWArg(&argument, "--stream-size")) { NEXT_TSIZE(streamSrcSize); continue; }
1062
- if (longCommandWArg(&argument, "--target-compressed-block-size")) { NEXT_TSIZE(targetCBlockSize); continue; }
1063
- if (longCommandWArg(&argument, "--size-hint")) { NEXT_TSIZE(srcSizeHint); continue; }
1064
- if (longCommandWArg(&argument, "--output-dir-flat")) {
1065
- NEXT_FIELD(outDirName);
1066
- if (strlen(outDirName) == 0) {
1067
- DISPLAYLEVEL(1, "error: output dir cannot be empty string (did you mean to pass '.' instead?)\n");
1068
- CLEAN_RETURN(1);
1069
- }
1070
- continue;
1071
- }
1072
- if (longCommandWArg(&argument, "--auto-threads")) {
1073
- const char* threadDefault = NULL;
1074
- NEXT_FIELD(threadDefault);
1075
- if (strcmp(threadDefault, "logical") == 0)
1076
- defaultLogicalCores = 1;
1077
- continue;
1078
- }
1079
- #ifdef UTIL_HAS_MIRRORFILELIST
1080
- if (longCommandWArg(&argument, "--output-dir-mirror")) {
1081
- NEXT_FIELD(outMirroredDirName);
1082
- if (strlen(outMirroredDirName) == 0) {
1083
- DISPLAYLEVEL(1, "error: output dir cannot be empty string (did you mean to pass '.' instead?)\n");
1084
- CLEAN_RETURN(1);
1085
- }
1086
- continue;
1087
- }
1088
- #endif
1089
- #ifndef ZSTD_NOTRACE
1090
- if (longCommandWArg(&argument, "--trace")) { char const* traceFile; NEXT_FIELD(traceFile); TRACE_enable(traceFile); continue; }
1091
- #endif
1092
- if (longCommandWArg(&argument, "--patch-from")) { NEXT_FIELD(patchFromDictFileName); continue; }
1093
- if (longCommandWArg(&argument, "--long")) {
1094
- unsigned ldmWindowLog = 0;
1095
- ldmFlag = 1;
1096
- /* Parse optional window log */
1097
- if (*argument == '=') {
1098
- ++argument;
1099
- ldmWindowLog = readU32FromChar(&argument);
1100
- } else if (*argument != 0) {
1101
- /* Invalid character following --long */
1102
- badUsage(programName, originalArgument);
1103
- CLEAN_RETURN(1);
1104
- } else {
1105
- ldmWindowLog = g_defaultMaxWindowLog;
1106
- }
1107
- /* Only set windowLog if not already set by --zstd */
1108
- if (compressionParams.windowLog == 0)
1109
- compressionParams.windowLog = ldmWindowLog;
1110
- continue;
1111
- }
1112
- #ifndef ZSTD_NOCOMPRESS /* linking ZSTD_minCLevel() requires compression support */
1113
- if (longCommandWArg(&argument, "--fast")) {
1114
- /* Parse optional acceleration factor */
1115
- if (*argument == '=') {
1116
- U32 const maxFast = (U32)-ZSTD_minCLevel();
1117
- U32 fastLevel;
1118
- ++argument;
1119
- fastLevel = readU32FromChar(&argument);
1120
- if (fastLevel > maxFast) fastLevel = maxFast;
1121
- if (fastLevel) {
1122
- dictCLevel = cLevel = -(int)fastLevel;
1123
- } else {
1124
- badUsage(programName, originalArgument);
1125
- CLEAN_RETURN(1);
1126
- }
1127
- } else if (*argument != 0) {
1128
- /* Invalid character following --fast */
1129
- badUsage(programName, originalArgument);
1130
- CLEAN_RETURN(1);
1131
- } else {
1132
- cLevel = -1; /* default for --fast */
1133
- }
1134
- continue;
1135
- }
1136
- #endif
1137
-
1138
- if (longCommandWArg(&argument, "--filelist")) {
1139
- const char* listName;
1140
- NEXT_FIELD(listName);
1141
- UTIL_refFilename(file_of_names, listName);
1142
- continue;
1143
- }
1144
-
1145
- badUsage(programName, originalArgument);
1146
- CLEAN_RETURN(1);
1147
- }
1148
-
1149
- argument++;
1150
- while (argument[0]!=0) {
1151
-
1152
- #ifndef ZSTD_NOCOMPRESS
1153
- /* compression Level */
1154
- if ((*argument>='0') && (*argument<='9')) {
1155
- dictCLevel = cLevel = (int)readU32FromChar(&argument);
1156
- continue;
1157
- }
1158
- #endif
1159
-
1160
- switch(argument[0])
1161
- {
1162
- /* Display help */
1163
- case 'V': printVersion(); CLEAN_RETURN(0); /* Version Only */
1164
- case 'H': usageAdvanced(programName); CLEAN_RETURN(0);
1165
- case 'h': usage(stdout, programName); CLEAN_RETURN(0);
1166
-
1167
- /* Compress */
1168
- case 'z': operation=zom_compress; argument++; break;
1169
-
1170
- /* Decoding */
1171
- case 'd':
1172
- #ifndef ZSTD_NOBENCH
1173
- benchParams.mode = BMK_decodeOnly;
1174
- if (operation==zom_bench) { argument++; break; } /* benchmark decode (hidden option) */
1175
- #endif
1176
- operation=zom_decompress; argument++; break;
1177
-
1178
- /* Force stdout, even if stdout==console */
1179
- case 'c': forceStdout=1; outFileName=stdoutmark; argument++; break;
1180
-
1181
- /* destination file name */
1182
- case 'o': argument++; NEXT_FIELD(outFileName); break;
1183
-
1184
- /* do not store filename - gzip compatibility - nothing to do */
1185
- case 'n': argument++; break;
1186
-
1187
- /* Use file content as dictionary */
1188
- case 'D': argument++; NEXT_FIELD(dictFileName); break;
1189
-
1190
- /* Overwrite */
1191
- case 'f': FIO_overwriteMode(prefs); forceStdin=1; forceStdout=1; followLinks=1; allowBlockDevices=1; argument++; break;
1192
-
1193
- /* Verbose mode */
1194
- case 'v': g_displayLevel++; argument++; break;
1195
-
1196
- /* Quiet mode */
1197
- case 'q': g_displayLevel--; argument++; break;
1198
-
1199
- /* keep source file (default) */
1200
- case 'k': removeSrcFile=0; argument++; break;
1201
-
1202
- /* Checksum */
1203
- case 'C': FIO_setChecksumFlag(prefs, 2); argument++; break;
1204
-
1205
- /* test compressed file */
1206
- case 't': operation=zom_test; argument++; break;
1207
-
1208
- /* limit memory */
1209
- case 'M':
1210
- argument++;
1211
- memLimit = readU32FromChar(&argument);
1212
- break;
1213
- case 'l': operation=zom_list; argument++; break;
1214
- #ifdef UTIL_HAS_CREATEFILELIST
1215
- /* recursive */
1216
- case 'r': recursive=1; argument++; break;
1217
- #endif
1218
-
1219
- #ifndef ZSTD_NOBENCH
1220
- /* Benchmark */
1221
- case 'b':
1222
- operation=zom_bench;
1223
- argument++;
1224
- break;
1225
-
1226
- /* range bench (benchmark only) */
1227
- case 'e':
1228
- /* compression Level */
1229
- argument++;
1230
- cLevelLast = (int)readU32FromChar(&argument);
1231
- break;
1232
-
1233
- /* Modify Nb Iterations (benchmark only) */
1234
- case 'i':
1235
- argument++;
1236
- bench_nbSeconds = readU32FromChar(&argument);
1237
- break;
1238
-
1239
- /* cut input into blocks (benchmark only) */
1240
- case 'B':
1241
- argument++;
1242
- blockSize = readU32FromChar(&argument);
1243
- break;
1244
-
1245
- /* benchmark files separately (hidden option) */
1246
- case 'S':
1247
- argument++;
1248
- separateFiles = 1;
1249
- break;
1250
-
1251
- #endif /* ZSTD_NOBENCH */
1252
-
1253
- /* nb of threads (hidden option) */
1254
- case 'T':
1255
- argument++;
1256
- nbWorkers = readU32FromChar(&argument);
1257
- break;
1258
-
1259
- /* Dictionary Selection level */
1260
- case 's':
1261
- argument++;
1262
- dictSelect = readU32FromChar(&argument);
1263
- break;
1264
-
1265
- /* Pause at the end (-p) or set an additional param (-p#) (hidden option) */
1266
- case 'p': argument++;
1267
- #ifndef ZSTD_NOBENCH
1268
- if ((*argument>='0') && (*argument<='9')) {
1269
- benchParams.additionalParam = (int)readU32FromChar(&argument);
1270
- } else
1271
- #endif
1272
- main_pause=1;
1273
- break;
1274
-
1275
- /* Select compressibility of synthetic sample */
1276
- case 'P':
1277
- argument++;
1278
- compressibility = (double)readU32FromChar(&argument) / 100;
1279
- break;
1280
-
1281
- /* unknown command */
1282
- default :
1283
- { char shortArgument[3] = {'-', 0, 0};
1284
- shortArgument[1] = argument[0];
1285
- badUsage(programName, shortArgument);
1286
- CLEAN_RETURN(1);
1287
- }
1288
- }
1289
- }
1290
- continue;
1291
- } /* if (argument[0]=='-') */
1292
-
1293
- /* none of the above : add filename to list */
1294
- UTIL_refFilename(filenames, argument);
1295
- }
1296
-
1297
- /* Welcome message (if verbose) */
1298
- DISPLAYLEVEL(3, WELCOME_MESSAGE);
1299
-
1300
- #ifdef ZSTD_MULTITHREAD
1301
- if ((operation==zom_decompress) && (!singleThread) && (nbWorkers > 1)) {
1302
- DISPLAYLEVEL(2, "Warning : decompression does not support multi-threading\n");
1303
- }
1304
- if ((nbWorkers==0) && (!singleThread)) {
1305
- /* automatically set # workers based on # of reported cpus */
1306
- if (defaultLogicalCores) {
1307
- nbWorkers = (unsigned)UTIL_countLogicalCores();
1308
- DISPLAYLEVEL(3, "Note: %d logical core(s) detected \n", nbWorkers);
1309
- } else {
1310
- nbWorkers = (unsigned)UTIL_countPhysicalCores();
1311
- DISPLAYLEVEL(3, "Note: %d physical core(s) detected \n", nbWorkers);
1312
- }
1313
- }
1314
- #else
1315
- (void)singleThread; (void)nbWorkers; (void)defaultLogicalCores;
1316
- #endif
1317
-
1318
- g_utilDisplayLevel = g_displayLevel;
1319
-
1320
- #ifdef UTIL_HAS_CREATEFILELIST
1321
- if (!followLinks) {
1322
- unsigned u, fileNamesNb;
1323
- unsigned const nbFilenames = (unsigned)filenames->tableSize;
1324
- for (u=0, fileNamesNb=0; u<nbFilenames; u++) {
1325
- if ( UTIL_isLink(filenames->fileNames[u])
1326
- && !UTIL_isFIFO(filenames->fileNames[u])
1327
- ) {
1328
- DISPLAYLEVEL(2, "Warning : %s is a symbolic link, ignoring \n", filenames->fileNames[u]);
1329
- } else {
1330
- filenames->fileNames[fileNamesNb++] = filenames->fileNames[u];
1331
- } }
1332
- if (fileNamesNb == 0 && nbFilenames > 0) /* all names are eliminated */
1333
- CLEAN_RETURN(1);
1334
- filenames->tableSize = fileNamesNb;
1335
- } /* if (!followLinks) */
1336
-
1337
- /* read names from a file */
1338
- if (file_of_names->tableSize) {
1339
- size_t const nbFileLists = file_of_names->tableSize;
1340
- size_t flNb;
1341
- for (flNb=0; flNb < nbFileLists; flNb++) {
1342
- FileNamesTable* const fnt = UTIL_createFileNamesTable_fromFileName(file_of_names->fileNames[flNb]);
1343
- if (fnt==NULL) {
1344
- DISPLAYLEVEL(1, "zstd: error reading %s \n", file_of_names->fileNames[flNb]);
1345
- CLEAN_RETURN(1);
1346
- }
1347
- filenames = UTIL_mergeFileNamesTable(filenames, fnt);
1348
- }
1349
- }
1350
-
1351
- nbInputFileNames = filenames->tableSize; /* saving number of input files */
1352
-
1353
- if (recursive) { /* at this stage, filenameTable is a list of paths, which can contain both files and directories */
1354
- UTIL_expandFNT(&filenames, followLinks);
1355
- }
1356
- #else
1357
- (void)followLinks;
1358
- #endif
1359
-
1360
- if (operation == zom_list) {
1361
- #ifndef ZSTD_NODECOMPRESS
1362
- int const ret = FIO_listMultipleFiles((unsigned)filenames->tableSize, filenames->fileNames, g_displayLevel);
1363
- CLEAN_RETURN(ret);
1364
- #else
1365
- DISPLAYLEVEL(1, "file information is not supported \n");
1366
- CLEAN_RETURN(1);
1367
- #endif
1368
- }
1369
-
1370
- /* Check if benchmark is selected */
1371
- if (operation==zom_bench) {
1372
- #ifndef ZSTD_NOBENCH
1373
- if (cType != FIO_zstdCompression) {
1374
- DISPLAYLEVEL(1, "benchmark mode is only compatible with zstd format \n");
1375
- CLEAN_RETURN(1);
1376
- }
1377
- benchParams.blockSize = blockSize;
1378
- benchParams.targetCBlockSize = targetCBlockSize;
1379
- benchParams.nbWorkers = (int)nbWorkers;
1380
- benchParams.realTime = (unsigned)setRealTimePrio;
1381
- benchParams.nbSeconds = bench_nbSeconds;
1382
- benchParams.ldmFlag = ldmFlag;
1383
- benchParams.ldmMinMatch = (int)g_ldmMinMatch;
1384
- benchParams.ldmHashLog = (int)g_ldmHashLog;
1385
- benchParams.useRowMatchFinder = (int)useRowMatchFinder;
1386
- if (g_ldmBucketSizeLog != LDM_PARAM_DEFAULT) {
1387
- benchParams.ldmBucketSizeLog = (int)g_ldmBucketSizeLog;
1388
- }
1389
- if (g_ldmHashRateLog != LDM_PARAM_DEFAULT) {
1390
- benchParams.ldmHashRateLog = (int)g_ldmHashRateLog;
1391
- }
1392
- benchParams.literalCompressionMode = literalCompressionMode;
1393
-
1394
- if (cLevel > ZSTD_maxCLevel()) cLevel = ZSTD_maxCLevel();
1395
- if (cLevelLast > ZSTD_maxCLevel()) cLevelLast = ZSTD_maxCLevel();
1396
- if (cLevelLast < cLevel) cLevelLast = cLevel;
1397
- if (cLevelLast > cLevel)
1398
- DISPLAYLEVEL(3, "Benchmarking levels from %d to %d\n", cLevel, cLevelLast);
1399
- if (filenames->tableSize > 0) {
1400
- if(separateFiles) {
1401
- unsigned i;
1402
- for(i = 0; i < filenames->tableSize; i++) {
1403
- int c;
1404
- DISPLAYLEVEL(3, "Benchmarking %s \n", filenames->fileNames[i]);
1405
- for(c = cLevel; c <= cLevelLast; c++) {
1406
- operationResult = BMK_benchFilesAdvanced(&filenames->fileNames[i], 1, dictFileName, c, &compressionParams, g_displayLevel, &benchParams);
1407
- } }
1408
- } else {
1409
- for(; cLevel <= cLevelLast; cLevel++) {
1410
- operationResult = BMK_benchFilesAdvanced(filenames->fileNames, (unsigned)filenames->tableSize, dictFileName, cLevel, &compressionParams, g_displayLevel, &benchParams);
1411
- } }
1412
- } else {
1413
- for(; cLevel <= cLevelLast; cLevel++) {
1414
- operationResult = BMK_syntheticTest(cLevel, compressibility, &compressionParams, g_displayLevel, &benchParams);
1415
- } }
1416
-
1417
- #else
1418
- (void)bench_nbSeconds; (void)blockSize; (void)setRealTimePrio; (void)separateFiles; (void)compressibility;
1419
- #endif
1420
- goto _end;
1421
- }
1422
-
1423
- /* Check if dictionary builder is selected */
1424
- if (operation==zom_train) {
1425
- #ifndef ZSTD_NODICT
1426
- ZDICT_params_t zParams;
1427
- zParams.compressionLevel = dictCLevel;
1428
- zParams.notificationLevel = (unsigned)g_displayLevel;
1429
- zParams.dictID = dictID;
1430
- if (dict == cover) {
1431
- int const optimize = !coverParams.k || !coverParams.d;
1432
- coverParams.nbThreads = (unsigned)nbWorkers;
1433
- coverParams.zParams = zParams;
1434
- operationResult = DiB_trainFromFiles(outFileName, maxDictSize, filenames->fileNames, (int)filenames->tableSize, blockSize, NULL, &coverParams, NULL, optimize, memLimit);
1435
- } else if (dict == fastCover) {
1436
- int const optimize = !fastCoverParams.k || !fastCoverParams.d;
1437
- fastCoverParams.nbThreads = (unsigned)nbWorkers;
1438
- fastCoverParams.zParams = zParams;
1439
- operationResult = DiB_trainFromFiles(outFileName, maxDictSize, filenames->fileNames, (int)filenames->tableSize, blockSize, NULL, NULL, &fastCoverParams, optimize, memLimit);
1440
- } else {
1441
- ZDICT_legacy_params_t dictParams;
1442
- memset(&dictParams, 0, sizeof(dictParams));
1443
- dictParams.selectivityLevel = dictSelect;
1444
- dictParams.zParams = zParams;
1445
- operationResult = DiB_trainFromFiles(outFileName, maxDictSize, filenames->fileNames, (int)filenames->tableSize, blockSize, &dictParams, NULL, NULL, 0, memLimit);
1446
- }
1447
- #else
1448
- (void)dictCLevel; (void)dictSelect; (void)dictID; (void)maxDictSize; /* not used when ZSTD_NODICT set */
1449
- DISPLAYLEVEL(1, "training mode not available \n");
1450
- operationResult = 1;
1451
- #endif
1452
- goto _end;
1453
- }
1454
-
1455
- #ifndef ZSTD_NODECOMPRESS
1456
- if (operation==zom_test) { FIO_setTestMode(prefs, 1); outFileName=nulmark; removeSrcFile=0; } /* test mode */
1457
- #endif
1458
-
1459
- /* No input filename ==> use stdin and stdout */
1460
- if (filenames->tableSize == 0) {
1461
- /* It is possible that the input
1462
- was a number of empty directories. In this case
1463
- stdin and stdout should not be used */
1464
- if (nbInputFileNames > 0 ){
1465
- DISPLAYLEVEL(1, "please provide correct input file(s) or non-empty directories -- ignored \n");
1466
- CLEAN_RETURN(0);
1467
- }
1468
- UTIL_refFilename(filenames, stdinmark);
1469
- }
1470
-
1471
- if (filenames->tableSize == 1 && !strcmp(filenames->fileNames[0], stdinmark) && !outFileName)
1472
- outFileName = stdoutmark; /* when input is stdin, default output is stdout */
1473
-
1474
- /* Check if input/output defined as console; trigger an error in this case */
1475
- if (!forceStdin
1476
- && (UTIL_searchFileNamesTable(filenames, stdinmark) != -1)
1477
- && UTIL_isConsole(stdin) ) {
1478
- DISPLAYLEVEL(1, "stdin is a console, aborting\n");
1479
- CLEAN_RETURN(1);
1480
- }
1481
- if ( (!outFileName || !strcmp(outFileName, stdoutmark))
1482
- && UTIL_isConsole(stdout)
1483
- && (UTIL_searchFileNamesTable(filenames, stdinmark) != -1)
1484
- && !forceStdout
1485
- && operation!=zom_decompress ) {
1486
- DISPLAYLEVEL(1, "stdout is a console, aborting\n");
1487
- CLEAN_RETURN(1);
1488
- }
1489
-
1490
- #ifndef ZSTD_NOCOMPRESS
1491
- /* check compression level limits */
1492
- { int const maxCLevel = ultra ? ZSTD_maxCLevel() : ZSTDCLI_CLEVEL_MAX;
1493
- if (cLevel > maxCLevel) {
1494
- DISPLAYLEVEL(2, "Warning : compression level higher than max, reduced to %i \n", maxCLevel);
1495
- cLevel = maxCLevel;
1496
- } }
1497
- #endif
1498
-
1499
- if (showDefaultCParams) {
1500
- if (operation == zom_decompress) {
1501
- DISPLAYLEVEL(1, "error : can't use --show-default-cparams in decompression mode \n");
1502
- CLEAN_RETURN(1);
1503
- }
1504
- }
1505
-
1506
- if (dictFileName != NULL && patchFromDictFileName != NULL) {
1507
- DISPLAYLEVEL(1, "error : can't use -D and --patch-from=# at the same time \n");
1508
- CLEAN_RETURN(1);
1509
- }
1510
-
1511
- if (patchFromDictFileName != NULL && filenames->tableSize > 1) {
1512
- DISPLAYLEVEL(1, "error : can't use --patch-from=# on multiple files \n");
1513
- CLEAN_RETURN(1);
1514
- }
1515
-
1516
- /* No status message by default when output is stdout */
1517
- hasStdout = outFileName && !strcmp(outFileName,stdoutmark);
1518
- if (hasStdout && (g_displayLevel==2)) g_displayLevel=1;
1519
-
1520
- /* when stderr is not the console, do not pollute it with progress updates (unless requested) */
1521
- if (!UTIL_isConsole(stderr) && (progress!=FIO_ps_always)) progress=FIO_ps_never;
1522
- FIO_setProgressSetting(progress);
1523
-
1524
- /* don't remove source files when output is stdout */;
1525
- if (hasStdout && removeSrcFile) {
1526
- DISPLAYLEVEL(3, "Note: src files are not removed when output is stdout \n");
1527
- removeSrcFile = 0;
1528
- }
1529
- FIO_setRemoveSrcFile(prefs, removeSrcFile);
1530
-
1531
- /* IO Stream/File */
1532
- FIO_setHasStdoutOutput(fCtx, hasStdout);
1533
- FIO_setNbFilesTotal(fCtx, (int)filenames->tableSize);
1534
- FIO_determineHasStdinInput(fCtx, filenames);
1535
- FIO_setNotificationLevel(g_displayLevel);
1536
- FIO_setAllowBlockDevices(prefs, allowBlockDevices);
1537
- FIO_setPatchFromMode(prefs, patchFromDictFileName != NULL);
1538
- FIO_setMMapDict(prefs, mmapDict);
1539
- if (memLimit == 0) {
1540
- if (compressionParams.windowLog == 0) {
1541
- memLimit = (U32)1 << g_defaultMaxWindowLog;
1542
- } else {
1543
- memLimit = (U32)1 << (compressionParams.windowLog & 31);
1544
- } }
1545
- if (patchFromDictFileName != NULL)
1546
- dictFileName = patchFromDictFileName;
1547
- FIO_setMemLimit(prefs, memLimit);
1548
- if (operation==zom_compress) {
1549
- #ifndef ZSTD_NOCOMPRESS
1550
- FIO_setCompressionType(prefs, cType);
1551
- FIO_setContentSize(prefs, contentSize);
1552
- FIO_setNbWorkers(prefs, (int)nbWorkers);
1553
- FIO_setBlockSize(prefs, (int)blockSize);
1554
- if (g_overlapLog!=OVERLAP_LOG_DEFAULT) FIO_setOverlapLog(prefs, (int)g_overlapLog);
1555
- FIO_setLdmFlag(prefs, (unsigned)ldmFlag);
1556
- FIO_setLdmHashLog(prefs, (int)g_ldmHashLog);
1557
- FIO_setLdmMinMatch(prefs, (int)g_ldmMinMatch);
1558
- if (g_ldmBucketSizeLog != LDM_PARAM_DEFAULT) FIO_setLdmBucketSizeLog(prefs, (int)g_ldmBucketSizeLog);
1559
- if (g_ldmHashRateLog != LDM_PARAM_DEFAULT) FIO_setLdmHashRateLog(prefs, (int)g_ldmHashRateLog);
1560
- FIO_setAdaptiveMode(prefs, adapt);
1561
- FIO_setUseRowMatchFinder(prefs, (int)useRowMatchFinder);
1562
- FIO_setAdaptMin(prefs, adaptMin);
1563
- FIO_setAdaptMax(prefs, adaptMax);
1564
- FIO_setRsyncable(prefs, rsyncable);
1565
- FIO_setStreamSrcSize(prefs, streamSrcSize);
1566
- FIO_setTargetCBlockSize(prefs, targetCBlockSize);
1567
- FIO_setSrcSizeHint(prefs, srcSizeHint);
1568
- FIO_setLiteralCompressionMode(prefs, literalCompressionMode);
1569
- FIO_setSparseWrite(prefs, 0);
1570
- if (adaptMin > cLevel) cLevel = adaptMin;
1571
- if (adaptMax < cLevel) cLevel = adaptMax;
1572
-
1573
- /* Compare strategies constant with the ground truth */
1574
- { ZSTD_bounds strategyBounds = ZSTD_cParam_getBounds(ZSTD_c_strategy);
1575
- assert(ZSTD_NB_STRATEGIES == strategyBounds.upperBound);
1576
- (void)strategyBounds; }
1577
-
1578
- if (showDefaultCParams || g_displayLevel >= 4) {
1579
- size_t fileNb;
1580
- for (fileNb = 0; fileNb < (size_t)filenames->tableSize; fileNb++) {
1581
- if (showDefaultCParams)
1582
- printDefaultCParams(filenames->fileNames[fileNb], dictFileName, cLevel);
1583
- if (g_displayLevel >= 4)
1584
- printActualCParams(filenames->fileNames[fileNb], dictFileName, cLevel, &compressionParams);
1585
- }
1586
- }
1587
-
1588
- if (g_displayLevel >= 4)
1589
- FIO_displayCompressionParameters(prefs);
1590
- if ((filenames->tableSize==1) && outFileName)
1591
- operationResult = FIO_compressFilename(fCtx, prefs, outFileName, filenames->fileNames[0], dictFileName, cLevel, compressionParams);
1592
- else
1593
- operationResult = FIO_compressMultipleFilenames(fCtx, prefs, filenames->fileNames, outMirroredDirName, outDirName, outFileName, suffix, dictFileName, cLevel, compressionParams);
1594
- #else
1595
- /* these variables are only used when compression mode is enabled */
1596
- (void)contentSize; (void)suffix; (void)adapt; (void)rsyncable;
1597
- (void)ultra; (void)cLevel; (void)ldmFlag; (void)literalCompressionMode;
1598
- (void)targetCBlockSize; (void)streamSrcSize; (void)srcSizeHint;
1599
- (void)ZSTD_strategyMap; (void)useRowMatchFinder; (void)cType;
1600
- DISPLAYLEVEL(1, "Compression not supported \n");
1601
- #endif
1602
- } else { /* decompression or test */
1603
- #ifndef ZSTD_NODECOMPRESS
1604
- if (filenames->tableSize == 1 && outFileName) {
1605
- operationResult = FIO_decompressFilename(fCtx, prefs, outFileName, filenames->fileNames[0], dictFileName);
1606
- } else {
1607
- operationResult = FIO_decompressMultipleFilenames(fCtx, prefs, filenames->fileNames, outMirroredDirName, outDirName, outFileName, dictFileName);
1608
- }
1609
- #else
1610
- DISPLAYLEVEL(1, "Decompression not supported \n");
1611
- #endif
1612
- }
1613
-
1614
- _end:
1615
- FIO_freePreferences(prefs);
1616
- FIO_freeContext(fCtx);
1617
- if (main_pause) waitEnter();
1618
- UTIL_freeFileNamesTable(filenames);
1619
- UTIL_freeFileNamesTable(file_of_names);
1620
- #ifndef ZSTD_NOTRACE
1621
- TRACE_finish();
1622
- #endif
1623
-
1624
- return operationResult;
1625
- }