exiftool-vendored.exe 12.82.0 → 12.82.1

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 (225) hide show
  1. package/README.md +6 -0
  2. package/bin/exiftool.exe +0 -0
  3. package/bin/exiftool_files/Licenses_Strawberry_Perl.zip +0 -0
  4. package/bin/exiftool_files/lib/Archive/Zip/Archive.pm +399 -65
  5. package/bin/exiftool_files/lib/Archive/Zip/DirectoryMember.pm +1 -1
  6. package/bin/exiftool_files/lib/Archive/Zip/FileMember.pm +1 -1
  7. package/bin/exiftool_files/lib/Archive/Zip/Member.pm +499 -195
  8. package/bin/exiftool_files/lib/Archive/Zip/NewFileMember.pm +1 -1
  9. package/bin/exiftool_files/lib/Archive/Zip/StringMember.pm +2 -2
  10. package/bin/exiftool_files/lib/Archive/Zip/ZipFileMember.pm +79 -20
  11. package/bin/exiftool_files/lib/Archive/Zip.pm +179 -29
  12. package/bin/exiftool_files/lib/AutoLoader.pm +453 -0
  13. package/bin/exiftool_files/lib/B/Deparse.pm +209 -137
  14. package/bin/exiftool_files/lib/B.pm +1 -1
  15. package/bin/exiftool_files/lib/Benchmark.pm +1123 -0
  16. package/bin/exiftool_files/lib/Class/Struct.pm +2 -2
  17. package/bin/exiftool_files/lib/Compress/Raw/Bzip2.pm +14 -9
  18. package/bin/exiftool_files/lib/Compress/Raw/Lzma.pm +982 -0
  19. package/bin/exiftool_files/lib/Compress/Raw/Zlib.pm +91 -86
  20. package/bin/exiftool_files/lib/Compress/Zlib.pm +105 -100
  21. package/bin/exiftool_files/lib/Config.pm +9 -9
  22. package/bin/exiftool_files/lib/Config_heavy.pl +36 -33
  23. package/bin/exiftool_files/lib/CryptX.pm +2 -82
  24. package/bin/exiftool_files/lib/Data/Dumper.pm +2 -2
  25. package/bin/exiftool_files/lib/Digest/MD5.pm +12 -9
  26. package/bin/exiftool_files/lib/Digest/Perl/MD5.pm +1 -191
  27. package/bin/exiftool_files/lib/Digest/base.pm +26 -20
  28. package/bin/exiftool_files/lib/DynaLoader.pm +7 -4
  29. package/bin/exiftool_files/lib/Encode.pm +3 -3
  30. package/bin/exiftool_files/lib/Errno.pm +13 -13
  31. package/bin/exiftool_files/lib/Exporter/Heavy.pm +2 -2
  32. package/bin/exiftool_files/lib/Exporter.pm +1 -1
  33. package/bin/exiftool_files/lib/ExtUtils/Command/MM.pm +323 -0
  34. package/bin/exiftool_files/lib/ExtUtils/Command.pm +382 -0
  35. package/bin/exiftool_files/lib/File/Find.pm +1 -1
  36. package/bin/exiftool_files/lib/File/Glob.pm +1 -8
  37. package/bin/exiftool_files/lib/File/GlobMapper.pm +2 -2
  38. package/bin/exiftool_files/lib/File/HomeDir/Darwin/Carbon.pm +2 -40
  39. package/bin/exiftool_files/lib/File/HomeDir/Darwin/Cocoa.pm +2 -34
  40. package/bin/exiftool_files/lib/File/HomeDir/Darwin.pm +2 -28
  41. package/bin/exiftool_files/lib/File/HomeDir/Driver.pm +2 -35
  42. package/bin/exiftool_files/lib/File/HomeDir/FreeDesktop.pm +2 -62
  43. package/bin/exiftool_files/lib/File/HomeDir/MacOS9.pm +2 -53
  44. package/bin/exiftool_files/lib/File/HomeDir/Test.pm +2 -43
  45. package/bin/exiftool_files/lib/File/HomeDir/Unix.pm +2 -53
  46. package/bin/exiftool_files/lib/File/HomeDir/Windows.pm +2 -69
  47. package/bin/exiftool_files/lib/File/HomeDir.pm +5 -416
  48. package/bin/exiftool_files/lib/File/Path.pm +3 -3
  49. package/bin/exiftool_files/lib/File/Spec/Win32.pm +2 -2
  50. package/bin/exiftool_files/lib/File/Temp.pm +70 -35
  51. package/bin/exiftool_files/lib/File/Which.pm +1 -240
  52. package/bin/exiftool_files/lib/File/stat.pm +3 -2
  53. package/bin/exiftool_files/lib/IO/Compress/Adapter/Bzip2.pm +16 -17
  54. package/bin/exiftool_files/lib/IO/Compress/Adapter/Deflate.pm +19 -20
  55. package/bin/exiftool_files/lib/IO/Compress/Base/Common.pm +5 -5
  56. package/bin/exiftool_files/lib/IO/Compress/Base.pm +35 -26
  57. package/bin/exiftool_files/lib/IO/Compress/Brotli.pm +159 -0
  58. package/bin/exiftool_files/lib/IO/Compress/Bzip2.pm +50 -25
  59. package/bin/exiftool_files/lib/IO/Compress/Gzip/Constants.pm +6 -6
  60. package/bin/exiftool_files/lib/IO/Compress/Gzip.pm +58 -32
  61. package/bin/exiftool_files/lib/IO/Compress/RawDeflate.pm +63 -38
  62. package/bin/exiftool_files/lib/IO/Compress/Zlib/Extra.pm +20 -20
  63. package/bin/exiftool_files/lib/IO/Dir.pm +1 -1
  64. package/bin/exiftool_files/lib/IO/File.pm +1 -1
  65. package/bin/exiftool_files/lib/IO/Handle.pm +1 -21
  66. package/bin/exiftool_files/lib/IO/Pipe.pm +1 -1
  67. package/bin/exiftool_files/lib/IO/Seekable.pm +1 -1
  68. package/bin/exiftool_files/lib/IO/Select.pm +16 -2
  69. package/bin/exiftool_files/lib/IO/Socket/INET.pm +14 -9
  70. package/bin/exiftool_files/lib/IO/Socket/UNIX.pm +17 -1
  71. package/bin/exiftool_files/lib/IO/Socket.pm +474 -126
  72. package/bin/exiftool_files/lib/IO/String.pm +425 -0
  73. package/bin/exiftool_files/lib/IO/Uncompress/Adapter/Inflate.pm +13 -14
  74. package/bin/exiftool_files/lib/IO/Uncompress/Base.pm +142 -132
  75. package/bin/exiftool_files/lib/IO/Uncompress/Brotli.pm +119 -0
  76. package/bin/exiftool_files/lib/IO/Uncompress/Gunzip.pm +43 -37
  77. package/bin/exiftool_files/lib/IO/Uncompress/RawInflate.pm +49 -43
  78. package/bin/exiftool_files/lib/IO.pm +2 -2
  79. package/bin/exiftool_files/lib/List/Util.pm +97 -8
  80. package/bin/exiftool_files/lib/MIME/Base64.pm +5 -5
  81. package/bin/exiftool_files/lib/MIME/Charset/_Compat.pm +106 -0
  82. package/bin/exiftool_files/lib/MIME/Charset.pm +1303 -0
  83. package/bin/exiftool_files/lib/Math/BigFloat.pm +444 -27
  84. package/bin/exiftool_files/lib/Math/BigInt/Calc.pm +296 -313
  85. package/bin/exiftool_files/lib/Math/BigInt/FastCalc.pm +1 -1
  86. package/bin/exiftool_files/lib/Math/BigInt/GMP.pm +2 -115
  87. package/bin/exiftool_files/lib/Math/BigInt/LTM.pm +2 -24
  88. package/bin/exiftool_files/lib/Math/BigInt/Lib.pm +61 -32
  89. package/bin/exiftool_files/lib/Math/BigInt.pm +292 -107
  90. package/bin/exiftool_files/lib/POSIX.pm +1 -1
  91. package/bin/exiftool_files/lib/PerlIO/scalar.pm +41 -0
  92. package/bin/exiftool_files/lib/PerlIO.pm +397 -0
  93. package/bin/exiftool_files/lib/Portable/CPAN.pm +94 -94
  94. package/bin/exiftool_files/lib/Portable/Config.pm +94 -94
  95. package/bin/exiftool_files/lib/Portable/FileSpec.pm +180 -180
  96. package/bin/exiftool_files/lib/Portable/HomeDir.pm +110 -110
  97. package/bin/exiftool_files/lib/Portable/LoadYaml.pm +430 -430
  98. package/bin/exiftool_files/lib/Portable/minicpan.pm +55 -55
  99. package/bin/exiftool_files/lib/Portable.pm +246 -320
  100. package/bin/exiftool_files/lib/Scalar/Util.pm +9 -4
  101. package/bin/exiftool_files/lib/Socket.pm +16 -12
  102. package/bin/exiftool_files/lib/Storable.pm +1444 -1441
  103. package/bin/exiftool_files/lib/TAP/Base.pm +133 -0
  104. package/bin/exiftool_files/lib/TAP/Formatter/Base.pm +467 -0
  105. package/bin/exiftool_files/lib/TAP/Formatter/Color.pm +116 -0
  106. package/bin/exiftool_files/lib/TAP/Formatter/Console/ParallelSession.pm +201 -0
  107. package/bin/exiftool_files/lib/TAP/Formatter/Console/Session.pm +205 -0
  108. package/bin/exiftool_files/lib/TAP/Formatter/Console.pm +100 -0
  109. package/bin/exiftool_files/lib/TAP/Formatter/File/Session.pm +95 -0
  110. package/bin/exiftool_files/lib/TAP/Formatter/File.pm +56 -0
  111. package/bin/exiftool_files/lib/TAP/Formatter/Session.pm +220 -0
  112. package/bin/exiftool_files/lib/TAP/Harness/Beyond.pod +426 -0
  113. package/bin/exiftool_files/lib/TAP/Harness/Env.pm +215 -0
  114. package/bin/exiftool_files/lib/TAP/Harness.pm +1054 -0
  115. package/bin/exiftool_files/lib/TAP/Object.pm +155 -0
  116. package/bin/exiftool_files/lib/TAP/Parser/Aggregator.pm +414 -0
  117. package/bin/exiftool_files/lib/TAP/Parser/Grammar.pm +584 -0
  118. package/bin/exiftool_files/lib/TAP/Parser/Iterator/Array.pm +100 -0
  119. package/bin/exiftool_files/lib/TAP/Parser/Iterator/Process.pm +378 -0
  120. package/bin/exiftool_files/lib/TAP/Parser/Iterator/Stream.pm +116 -0
  121. package/bin/exiftool_files/lib/TAP/Parser/Iterator.pm +162 -0
  122. package/bin/exiftool_files/lib/TAP/Parser/IteratorFactory.pm +339 -0
  123. package/bin/exiftool_files/lib/TAP/Parser/Multiplexer.pm +194 -0
  124. package/bin/exiftool_files/lib/TAP/Parser/Result/Bailout.pm +62 -0
  125. package/bin/exiftool_files/lib/TAP/Parser/Result/Comment.pm +60 -0
  126. package/bin/exiftool_files/lib/TAP/Parser/Result/Plan.pm +119 -0
  127. package/bin/exiftool_files/lib/TAP/Parser/Result/Pragma.pm +62 -0
  128. package/bin/exiftool_files/lib/TAP/Parser/Result/Test.pm +271 -0
  129. package/bin/exiftool_files/lib/TAP/Parser/Result/Unknown.pm +48 -0
  130. package/bin/exiftool_files/lib/TAP/Parser/Result/Version.pm +62 -0
  131. package/bin/exiftool_files/lib/TAP/Parser/Result/YAML.pm +61 -0
  132. package/bin/exiftool_files/lib/TAP/Parser/Result.pm +297 -0
  133. package/bin/exiftool_files/lib/TAP/Parser/ResultFactory.pm +183 -0
  134. package/bin/exiftool_files/lib/TAP/Parser/Scheduler/Job.pm +127 -0
  135. package/bin/exiftool_files/lib/TAP/Parser/Scheduler/Spinner.pm +61 -0
  136. package/bin/exiftool_files/lib/TAP/Parser/Scheduler.pm +448 -0
  137. package/bin/exiftool_files/lib/TAP/Parser/Source.pm +381 -0
  138. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/Executable.pm +184 -0
  139. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/File.pm +136 -0
  140. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/Handle.pm +124 -0
  141. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/Perl.pm +370 -0
  142. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/RawTAP.pm +130 -0
  143. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler.pm +191 -0
  144. package/bin/exiftool_files/lib/TAP/Parser/YAMLish/Reader.pm +332 -0
  145. package/bin/exiftool_files/lib/TAP/Parser/YAMLish/Writer.pm +254 -0
  146. package/bin/exiftool_files/lib/TAP/Parser.pm +1931 -0
  147. package/bin/exiftool_files/lib/Test/Builder/Formatter.pm +107 -0
  148. package/bin/exiftool_files/lib/Test/Builder/IO/Scalar.pm +659 -0
  149. package/bin/exiftool_files/lib/Test/Builder/Module.pm +182 -0
  150. package/bin/exiftool_files/lib/Test/Builder/Tester/Color.pm +51 -0
  151. package/bin/exiftool_files/lib/Test/Builder/Tester.pm +675 -0
  152. package/bin/exiftool_files/lib/Test/Builder/TodoDiag.pm +68 -0
  153. package/bin/exiftool_files/lib/Test/Builder.pm +2653 -0
  154. package/bin/exiftool_files/lib/Test/Harness.pm +618 -0
  155. package/bin/exiftool_files/lib/Test/More.pm +1997 -0
  156. package/bin/exiftool_files/lib/Test/Simple.pm +220 -0
  157. package/bin/exiftool_files/lib/Test/Tester/Capture.pm +241 -0
  158. package/bin/exiftool_files/lib/Test/Tester/CaptureRunner.pm +79 -0
  159. package/bin/exiftool_files/lib/Test/Tester/Delegate.pm +45 -0
  160. package/bin/exiftool_files/lib/Test/Tester.pm +695 -0
  161. package/bin/exiftool_files/lib/Test/Tutorial.pod +618 -0
  162. package/bin/exiftool_files/lib/Test/use/ok.pm +64 -0
  163. package/bin/exiftool_files/lib/Text/ParseWords.pm +303 -0
  164. package/bin/exiftool_files/lib/Tie/StdHandle.pm +2 -2
  165. package/bin/exiftool_files/lib/Time/HiRes.pm +73 -68
  166. package/bin/exiftool_files/lib/Time/Local.pm +82 -35
  167. package/bin/exiftool_files/lib/Time/Piece.pm +19 -4
  168. package/bin/exiftool_files/lib/Time/Seconds.pm +1 -1
  169. package/bin/exiftool_files/lib/UNIVERSAL.pm +203 -0
  170. package/bin/exiftool_files/lib/Unicode/GCString.pm +60 -0
  171. package/bin/exiftool_files/lib/Unicode/LineBreak/Constants.pm +68 -0
  172. package/bin/exiftool_files/lib/Unicode/LineBreak.pm +248 -0
  173. package/bin/exiftool_files/lib/Win32/API/Struct.pm +1 -177
  174. package/bin/exiftool_files/lib/Win32/API/Type.pm +1 -100
  175. package/bin/exiftool_files/lib/Win32/API.pm +1 -830
  176. package/bin/exiftool_files/lib/Win32/FindFile.pm +2 -123
  177. package/bin/exiftool_files/lib/Win32.pm +213 -89
  178. package/bin/exiftool_files/lib/Win32API/File.pm +1 -1
  179. package/bin/exiftool_files/lib/auto/B/B.xs.dll +0 -0
  180. package/bin/exiftool_files/lib/auto/Compress/Raw/Bzip2/Bzip2.xs.dll +0 -0
  181. package/bin/exiftool_files/lib/auto/Compress/Raw/Lzma/Lzma.xs.dll +0 -0
  182. package/bin/exiftool_files/lib/auto/Compress/Raw/Lzma/autosplit.ix +3 -0
  183. package/bin/exiftool_files/lib/auto/Compress/Raw/Zlib/Zlib.xs.dll +0 -0
  184. package/bin/exiftool_files/lib/auto/CryptX/CryptX.xs.dll +0 -0
  185. package/bin/exiftool_files/lib/auto/Cwd/Cwd.xs.dll +0 -0
  186. package/bin/exiftool_files/lib/auto/Data/Dumper/Dumper.xs.dll +0 -0
  187. package/bin/exiftool_files/lib/auto/Digest/MD5/MD5.xs.dll +0 -0
  188. package/bin/exiftool_files/lib/auto/Digest/SHA/SHA.xs.dll +0 -0
  189. package/bin/exiftool_files/lib/auto/Encode/Encode.xs.dll +0 -0
  190. package/bin/exiftool_files/lib/auto/Fcntl/Fcntl.xs.dll +0 -0
  191. package/bin/exiftool_files/lib/auto/File/Glob/Glob.xs.dll +0 -0
  192. package/bin/exiftool_files/lib/auto/IO/Compress/Brotli/Brotli.xs.dll +0 -0
  193. package/bin/exiftool_files/lib/auto/IO/IO.xs.dll +0 -0
  194. package/bin/exiftool_files/lib/auto/List/Util/Util.xs.dll +0 -0
  195. package/bin/exiftool_files/lib/auto/MIME/Base64/Base64.xs.dll +0 -0
  196. package/bin/exiftool_files/lib/auto/Math/BigInt/FastCalc/FastCalc.xs.dll +0 -0
  197. package/bin/exiftool_files/lib/auto/Math/BigInt/GMP/GMP.xs.dll +0 -0
  198. package/bin/exiftool_files/lib/auto/POSIX/POSIX.xs.dll +0 -0
  199. package/bin/exiftool_files/lib/auto/PerlIO/scalar/scalar.xs.dll +0 -0
  200. package/bin/exiftool_files/lib/auto/Socket/Socket.xs.dll +0 -0
  201. package/bin/exiftool_files/lib/auto/Storable/Storable.xs.dll +0 -0
  202. package/bin/exiftool_files/lib/auto/Time/HiRes/HiRes.xs.dll +0 -0
  203. package/bin/exiftool_files/lib/auto/Time/Piece/Piece.xs.dll +0 -0
  204. package/bin/exiftool_files/lib/auto/Unicode/LineBreak/LineBreak.xs.dll +0 -0
  205. package/bin/exiftool_files/lib/auto/Win32/API/API.xs.dll +0 -0
  206. package/bin/exiftool_files/lib/auto/Win32/FindFile/FindFile.xs.dll +0 -0
  207. package/bin/exiftool_files/lib/auto/Win32/Win32.xs.dll +0 -0
  208. package/bin/exiftool_files/lib/auto/Win32API/File/File.xs.dll +0 -0
  209. package/bin/exiftool_files/lib/auto/mro/mro.xs.dll +0 -0
  210. package/bin/exiftool_files/lib/auto/re/re.xs.dll +0 -0
  211. package/bin/exiftool_files/lib/feature.pm +49 -17
  212. package/bin/exiftool_files/lib/mro.pm +4 -20
  213. package/bin/exiftool_files/lib/overload.pm +15 -15
  214. package/bin/exiftool_files/lib/parent.pm +10 -2
  215. package/bin/exiftool_files/lib/re.pm +91 -33
  216. package/bin/exiftool_files/lib/warnings.pm +17 -6
  217. package/bin/exiftool_files/libgcc_s_seh-1.dll +0 -0
  218. package/bin/exiftool_files/liblzma-5__.dll +0 -0
  219. package/bin/exiftool_files/libstdc++-6.dll +0 -0
  220. package/bin/exiftool_files/libwinpthread-1.dll +0 -0
  221. package/bin/exiftool_files/perl.exe +0 -0
  222. package/bin/exiftool_files/perl532.dll +0 -0
  223. package/package.json +5 -3
  224. package/bin/exiftool_files/libgcc_s_dw2-1.dll +0 -0
  225. package/bin/exiftool_files/perl530.dll +0 -0
@@ -0,0 +1,982 @@
1
+ package Compress::Raw::Lzma;
2
+
3
+ use strict ;
4
+ use warnings ;
5
+
6
+ require 5.006 ;
7
+ require Exporter;
8
+ use AutoLoader;
9
+ use Carp ;
10
+
11
+ use bytes ;
12
+ our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD);
13
+
14
+ $VERSION = '2.100';
15
+ $XS_VERSION = $VERSION;
16
+ $VERSION = eval $VERSION;
17
+
18
+ @ISA = qw(Exporter);
19
+ # Items to export into callers namespace by default. Note: do not export
20
+ # names by default without a very good reason. Use EXPORT_OK instead.
21
+ # Do not simply export all your public functions/methods/constants.
22
+ @EXPORT = qw(
23
+
24
+ LZMA_OK
25
+ LZMA_STREAM_END
26
+ LZMA_NO_CHECK
27
+ LZMA_UNSUPPORTED_CHECK
28
+ LZMA_GET_CHECK
29
+ LZMA_MEM_ERROR
30
+ LZMA_MEMLIMIT_ERROR
31
+ LZMA_FORMAT_ERROR
32
+ LZMA_OPTIONS_ERROR
33
+ LZMA_DATA_ERROR
34
+ LZMA_BUF_ERROR
35
+ LZMA_PROG_ERROR
36
+
37
+ LZMA_RUN
38
+ LZMA_SYNC_FLUSH
39
+ LZMA_FULL_FLUSH
40
+ LZMA_FINISH
41
+
42
+ LZMA_FILTER_X86
43
+ LZMA_FILTER_POWERPC
44
+ LZMA_FILTER_IA64
45
+ LZMA_FILTER_ARM
46
+ LZMA_FILTER_ARMTHUMB
47
+ LZMA_FILTER_SPARC
48
+
49
+
50
+ LZMA_BLOCK_HEADER_SIZE_MIN
51
+ LZMA_BLOCK_HEADER_SIZE_MAX
52
+
53
+ LZMA_CHECK_NONE
54
+ LZMA_CHECK_CRC32
55
+ LZMA_CHECK_CRC64
56
+ LZMA_CHECK_SHA256
57
+
58
+ LZMA_CHECK_ID_MAX
59
+ LZMA_CHECK_SIZE_MAX
60
+
61
+ LZMA_PRESET_DEFAULT
62
+ LZMA_PRESET_LEVEL_MASK
63
+ LZMA_PRESET_EXTREME
64
+
65
+ LZMA_TELL_NO_CHECK
66
+ LZMA_TELL_UNSUPPORTED_CHECK
67
+ LZMA_TELL_ANY_CHECK
68
+ LZMA_CONCATENATED
69
+
70
+
71
+ LZMA_FILTER_DELTA
72
+ LZMA_DELTA_DIST_MIN
73
+ LZMA_DELTA_DIST_MAX
74
+ LZMA_DELTA_TYPE_BYTE
75
+
76
+ LZMA_FILTERS_MAX
77
+
78
+ LZMA_FILTER_LZMA2
79
+
80
+ LZMA_MF_HC3
81
+ LZMA_MF_HC4
82
+ LZMA_MF_BT2
83
+ LZMA_MF_BT3
84
+ LZMA_MF_BT4
85
+
86
+ LZMA_MODE_FAST
87
+ LZMA_MODE_NORMAL
88
+
89
+ LZMA_DICT_SIZE_MIN
90
+ LZMA_DICT_SIZE_DEFAULT
91
+
92
+ LZMA_LCLP_MIN
93
+ LZMA_LCLP_MAX
94
+ LZMA_LC_DEFAULT
95
+
96
+ LZMA_LP_DEFAULT
97
+
98
+ LZMA_PB_MIN
99
+ LZMA_PB_MAX
100
+ LZMA_PB_DEFAULT
101
+
102
+ LZMA_STREAM_HEADER_SIZE
103
+
104
+ LZMA_BACKWARD_SIZE_MIN
105
+
106
+ LZMA_FILTER_SUBBLOCK
107
+
108
+ LZMA_SUBFILTER_NONE
109
+ LZMA_SUBFILTER_SET
110
+ LZMA_SUBFILTER_RUN
111
+ LZMA_SUBFILTER_FINISH
112
+
113
+ LZMA_SUBBLOCK_ALIGNMENT_MIN
114
+ LZMA_SUBBLOCK_ALIGNMENT_MAX
115
+ LZMA_SUBBLOCK_ALIGNMENT_DEFAULT
116
+
117
+ LZMA_SUBBLOCK_DATA_SIZE_MIN
118
+ LZMA_SUBBLOCK_DATA_SIZE_MAX
119
+ LZMA_SUBBLOCK_DATA_SIZE_DEFAULT
120
+
121
+ LZMA_SUBBLOCK_RLE_OFF
122
+ LZMA_SUBBLOCK_RLE_MIN
123
+ LZMA_SUBBLOCK_RLE_MAX
124
+
125
+ LZMA_VERSION
126
+ LZMA_VERSION_MAJOR
127
+ LZMA_VERSION_MINOR
128
+ LZMA_VERSION_PATCH
129
+ LZMA_VERSION_STABILITY
130
+
131
+ LZMA_VERSION_STABILITY_STRING
132
+ LZMA_VERSION_STRING
133
+ );
134
+
135
+ #LZMA_VLI_MAX
136
+ #LZMA_VLI_UNKNOWN
137
+ #LZMA_VLI_BYTES_MAX
138
+
139
+ sub AUTOLOAD {
140
+ my($constname);
141
+ ($constname = $AUTOLOAD) =~ s/.*:://;
142
+ my ($error, $val) = constant($constname);
143
+ Carp::croak $error if $error;
144
+ no strict 'refs';
145
+ *{$AUTOLOAD} = sub { $val };
146
+ goto &{$AUTOLOAD};
147
+
148
+ }
149
+
150
+ use constant FLAG_APPEND => 1 ;
151
+ use constant FLAG_CRC => 2 ;
152
+ use constant FLAG_ADLER => 4 ;
153
+ use constant FLAG_CONSUME_INPUT => 8 ;
154
+ use constant FLAG_LIMIT_OUTPUT => 16 ;
155
+
156
+ eval {
157
+ require XSLoader;
158
+ XSLoader::load('Compress::Raw::Lzma', $XS_VERSION);
159
+ 1;
160
+ }
161
+ or do {
162
+ require DynaLoader;
163
+ local @ISA = qw(DynaLoader);
164
+ bootstrap Compress::Raw::Lzma $XS_VERSION ;
165
+ };
166
+
167
+ use constant Parse_any => 0x01;
168
+ use constant Parse_unsigned => 0x02;
169
+ use constant Parse_signed => 0x04;
170
+ use constant Parse_boolean => 0x08;
171
+ use constant Parse_string => 0x10;
172
+ use constant Parse_custom => 0x12;
173
+
174
+ use constant Parse_store_ref => 0x100 ;
175
+
176
+ use constant OFF_PARSED => 0 ;
177
+ use constant OFF_TYPE => 1 ;
178
+ use constant OFF_DEFAULT => 2 ;
179
+ use constant OFF_FIXED => 3 ;
180
+ use constant OFF_FIRST_ONLY => 4 ;
181
+ use constant OFF_STICKY => 5 ;
182
+
183
+
184
+
185
+ sub ParseParameters
186
+ {
187
+ my $level = shift || 0 ;
188
+
189
+ my $sub = (caller($level + 1))[3] ;
190
+ #local $Carp::CarpLevel = 1 ;
191
+ my $p = new Compress::Raw::Lzma::Parameters() ;
192
+ $p->parse(@_)
193
+ or croak "$sub: $p->{Error}" ;
194
+
195
+ return $p;
196
+ }
197
+
198
+
199
+ sub Compress::Raw::Lzma::Parameters::new
200
+ {
201
+ my $class = shift ;
202
+
203
+ my $obj = { Error => '',
204
+ Got => {},
205
+ } ;
206
+
207
+ #return bless $obj, ref($class) || $class || __PACKAGE__ ;
208
+ return bless $obj, 'Compress::Raw::Lzma::Parameters' ;
209
+ }
210
+
211
+ sub Compress::Raw::Lzma::Parameters::setError
212
+ {
213
+ my $self = shift ;
214
+ my $error = shift ;
215
+ my $retval = @_ ? shift : undef ;
216
+
217
+ $self->{Error} = $error ;
218
+ return $retval;
219
+ }
220
+
221
+ #sub getError
222
+ #{
223
+ # my $self = shift ;
224
+ # return $self->{Error} ;
225
+ #}
226
+
227
+ sub Compress::Raw::Lzma::Parameters::parse
228
+ {
229
+ my $self = shift ;
230
+
231
+ my $default = shift ;
232
+
233
+ my $got = $self->{Got} ;
234
+ my $firstTime = keys %{ $got } == 0 ;
235
+
236
+ my (@Bad) ;
237
+ my @entered = () ;
238
+
239
+ # Allow the options to be passed as a hash reference or
240
+ # as the complete hash.
241
+ if (@_ == 0) {
242
+ @entered = () ;
243
+ }
244
+ elsif (@_ == 1) {
245
+ my $href = $_[0] ;
246
+ return $self->setError("Expected even number of parameters, got 1")
247
+ if ! defined $href or ! ref $href or ref $href ne "HASH" ;
248
+
249
+ foreach my $key (keys %$href) {
250
+ push @entered, $key ;
251
+ push @entered, \$href->{$key} ;
252
+ }
253
+ }
254
+ else {
255
+ my $count = @_;
256
+ return $self->setError("Expected even number of parameters, got $count")
257
+ if $count % 2 != 0 ;
258
+
259
+ for my $i (0.. $count / 2 - 1) {
260
+ push @entered, $_[2* $i] ;
261
+ push @entered, \$_[2* $i+1] ;
262
+ }
263
+ }
264
+
265
+
266
+ while (my ($key, $v) = each %$default)
267
+ {
268
+ croak "need 4 params [@$v]"
269
+ if @$v != 4 ;
270
+
271
+ my ($first_only, $sticky, $type, $value) = @$v ;
272
+ my $x ;
273
+ $self->_checkType($key, \$value, $type, 0, \$x)
274
+ or return undef ;
275
+
276
+ $key = lc $key;
277
+
278
+ if ($firstTime || ! $sticky) {
279
+ $got->{$key} = [0, $type, $value, $x, $first_only, $sticky] ;
280
+ }
281
+
282
+ $got->{$key}[OFF_PARSED] = 0 ;
283
+ }
284
+
285
+ for my $i (0.. @entered / 2 - 1) {
286
+ my $key = $entered[2* $i] ;
287
+ my $value = $entered[2* $i+1] ;
288
+
289
+ #print "Key [$key] Value [$value]" ;
290
+ #print defined $$value ? "[$$value]\n" : "[undef]\n";
291
+
292
+ $key =~ s/^-// ;
293
+ my $canonkey = lc $key;
294
+
295
+ if ($got->{$canonkey} && ($firstTime ||
296
+ ! $got->{$canonkey}[OFF_FIRST_ONLY] ))
297
+ {
298
+ my $type = $got->{$canonkey}[OFF_TYPE] ;
299
+ my $s ;
300
+ $self->_checkType($key, $value, $type, 1, \$s)
301
+ or return undef ;
302
+ #$value = $$value unless $type & Parse_store_ref ;
303
+ $value = $$value ;
304
+ $got->{$canonkey} = [1, $type, $value, $s] ;
305
+ }
306
+ else
307
+ { push (@Bad, $key) }
308
+ }
309
+
310
+ if (@Bad) {
311
+ my ($bad) = join(", ", @Bad) ;
312
+ return $self->setError("unknown key value(s) @Bad") ;
313
+ }
314
+
315
+ return 1;
316
+ }
317
+
318
+ sub Compress::Raw::Lzma::Parameters::_checkType
319
+ {
320
+ my $self = shift ;
321
+
322
+ my $key = shift ;
323
+ my $value = shift ;
324
+ my $type = shift ;
325
+ my $validate = shift ;
326
+ my $output = shift;
327
+
328
+ #local $Carp::CarpLevel = $level ;
329
+ #print "PARSE $type $key $value $validate $sub\n" ;
330
+ if ( $type & Parse_store_ref)
331
+ {
332
+ #$value = $$value
333
+ # if ref ${ $value } ;
334
+
335
+ $$output = $value ;
336
+ return 1;
337
+ }
338
+
339
+ $value = $$value ;
340
+
341
+ if ($type & Parse_any)
342
+ {
343
+ $$output = $value ;
344
+ return 1;
345
+ }
346
+ elsif ($type & Parse_unsigned)
347
+ {
348
+ return $self->setError("Parameter '$key' must be an unsigned int, got 'undef'")
349
+ if $validate && ! defined $value ;
350
+ return $self->setError("Parameter '$key' must be an unsigned int, got '$value'")
351
+ if $validate && $value !~ /^\d+$/;
352
+
353
+ $$output = defined $value ? $value : 0 ;
354
+ return 1;
355
+ }
356
+ elsif ($type & Parse_signed)
357
+ {
358
+ return $self->setError("Parameter '$key' must be a signed int, got 'undef'")
359
+ if $validate && ! defined $value ;
360
+ return $self->setError("Parameter '$key' must be a signed int, got '$value'")
361
+ if $validate && $value !~ /^-?\d+$/;
362
+
363
+ $$output = defined $value ? $value : 0 ;
364
+ return 1 ;
365
+ }
366
+ elsif ($type & Parse_boolean)
367
+ {
368
+ return $self->setError("Parameter '$key' must be an int, got '$value'")
369
+ if $validate && defined $value && $value !~ /^\d*$/;
370
+ $$output = defined $value ? $value != 0 : 0 ;
371
+ return 1;
372
+ }
373
+ elsif ($type & Parse_string)
374
+ {
375
+ $$output = defined $value ? $value : "" ;
376
+ return 1;
377
+ }
378
+
379
+ $$output = $value ;
380
+ return 1;
381
+ }
382
+
383
+
384
+
385
+ sub Compress::Raw::Lzma::Parameters::parsed
386
+ {
387
+ my $self = shift ;
388
+ my $name = shift ;
389
+
390
+ return $self->{Got}{lc $name}[OFF_PARSED] ;
391
+ }
392
+
393
+ sub Compress::Raw::Lzma::Parameters::value
394
+ {
395
+ my $self = shift ;
396
+ my $name = shift ;
397
+
398
+ if (@_)
399
+ {
400
+ $self->{Got}{lc $name}[OFF_PARSED] = 1;
401
+ $self->{Got}{lc $name}[OFF_DEFAULT] = $_[0] ;
402
+ $self->{Got}{lc $name}[OFF_FIXED] = $_[0] ;
403
+ }
404
+
405
+ return $self->{Got}{lc $name}[OFF_FIXED] ;
406
+ }
407
+
408
+
409
+ sub Compress::Raw::Lzma::Encoder::STORABLE_freeze
410
+ {
411
+ my $type = ref shift;
412
+ croak "Cannot freeze $type object\n";
413
+ }
414
+
415
+ sub Compress::Raw::Lzma::Encoder::STORABLE_thaw
416
+ {
417
+ my $type = ref shift;
418
+ croak "Cannot thaw $type object\n";
419
+ }
420
+
421
+
422
+ @Compress::Raw::Lzma::EasyEncoder::ISA = qw(Compress::Raw::Lzma::Encoder);
423
+
424
+ sub Compress::Raw::Lzma::EasyEncoder::new
425
+ {
426
+ my $pkg = shift ;
427
+ my ($got) = ParseParameters(0,
428
+ {
429
+ 'AppendOutput' => [1, 1, Parse_boolean, 0],
430
+ 'Bufsize' => [1, 1, Parse_unsigned, 16 * 1024],
431
+
432
+ 'Preset' => [1, 1, Parse_unsigned, LZMA_PRESET_DEFAULT()],
433
+ 'Extreme' => [1, 1, Parse_boolean, 0],
434
+ 'Check' => [1, 1, Parse_unsigned, LZMA_CHECK_CRC32()],
435
+ }, @_) ;
436
+
437
+
438
+ # croak "Compress::Raw::Lzma::EasyEncoder::new: Bufsize must be >= 1, you specified " .
439
+ # $got->value('Bufsize')
440
+ # unless $got->value('Bufsize') >= 1;
441
+
442
+ my $flags = 0 ;
443
+ $flags |= FLAG_APPEND if $got->value('AppendOutput') ;
444
+
445
+ my $preset = $got->value('Preset');
446
+
447
+ if ($got->value('Extreme')) {
448
+ $preset |= LZMA_PRESET_EXTREME();
449
+ }
450
+
451
+ lzma_easy_encoder($pkg, $flags,
452
+ $got->value('Bufsize'),
453
+ $preset,
454
+ $got->value('Check')) ;
455
+
456
+ }
457
+
458
+ @Compress::Raw::Lzma::AloneEncoder::ISA = qw(Compress::Raw::Lzma::Encoder);
459
+
460
+ sub Compress::Raw::Lzma::AloneEncoder::new
461
+ {
462
+ my $pkg = shift ;
463
+ my ($got) = ParseParameters(0,
464
+ {
465
+ 'AppendOutput' => [1, 1, Parse_boolean, 0],
466
+ 'Bufsize' => [1, 1, Parse_unsigned, 16 * 1024],
467
+ 'Filter' => [1, 1, Parse_any, [] ],
468
+
469
+ }, @_) ;
470
+
471
+
472
+ my $flags = 0 ;
473
+ $flags |= FLAG_APPEND if $got->value('AppendOutput') ;
474
+
475
+ my $filters = Lzma::Filters::validateFilters(1, 0, $got->value('Filter')) ;
476
+ # TODO - check max of 1 filter & it is a reference to Lzma::Filter::Lzma1
477
+
478
+ lzma_alone_encoder($pkg, $flags,
479
+ $got->value('Bufsize'),
480
+ $filters);
481
+
482
+ }
483
+
484
+ @Compress::Raw::Lzma::StreamEncoder::ISA = qw(Compress::Raw::Lzma::Encoder);
485
+
486
+ sub Compress::Raw::Lzma::StreamEncoder::new
487
+ {
488
+ my $pkg = shift ;
489
+ my ($got) = ParseParameters(0,
490
+ {
491
+ 'AppendOutput' => [1, 1, Parse_boolean, 0],
492
+ 'Bufsize' => [1, 1, Parse_unsigned, 16 * 1024],
493
+ 'Filter' => [1, 1, Parse_any, [] ],
494
+ 'Check' => [1, 1, Parse_unsigned, LZMA_CHECK_CRC32()],
495
+
496
+ }, @_) ;
497
+
498
+
499
+ my $flags = 0 ;
500
+ $flags |= FLAG_APPEND if $got->value('AppendOutput') ;
501
+
502
+ my $filters = Lzma::Filters::validateFilters(1, 1, $got->value('Filter')) ;
503
+
504
+ lzma_stream_encoder($pkg, $flags,
505
+ $got->value('Bufsize'),
506
+ $filters,
507
+ $got->value('Check'));
508
+
509
+ }
510
+
511
+ @Compress::Raw::Lzma::RawEncoder::ISA = qw(Compress::Raw::Lzma::Encoder);
512
+
513
+ sub Compress::Raw::Lzma::RawEncoder::new
514
+ {
515
+ my $pkg = shift ;
516
+ my ($got) = ParseParameters(0,
517
+ {
518
+ 'ForZip' => [1, 1, Parse_boolean, 0],
519
+ 'AppendOutput' => [1, 1, Parse_boolean, 0],
520
+ 'Bufsize' => [1, 1, Parse_unsigned, 16 * 1024],
521
+ 'Filter' => [1, 1, Parse_any, [] ],
522
+
523
+ }, @_) ;
524
+
525
+
526
+ my $flags = 0 ;
527
+ $flags |= FLAG_APPEND if $got->value('AppendOutput') ;
528
+
529
+ my $forZip = $got->value('ForZip');
530
+
531
+ my $filters = Lzma::Filters::validateFilters(1, ! $forZip, $got->value('Filter')) ;
532
+
533
+ lzma_raw_encoder($pkg, $flags,
534
+ $got->value('Bufsize'),
535
+ $filters,
536
+ $forZip);
537
+
538
+ }
539
+
540
+ @Compress::Raw::Lzma::AutoDecoder::ISA = qw(Compress::Raw::Lzma::Decoder);
541
+
542
+ sub Compress::Raw::Lzma::AutoDecoder::new
543
+ {
544
+ my $pkg = shift ;
545
+ my ($got) = ParseParameters(0,
546
+ {
547
+ 'AppendOutput' => [1, 1, Parse_boolean, 0],
548
+ 'LimitOutput' => [1, 1, Parse_boolean, 0],
549
+ 'ConsumeInput' => [1, 1, Parse_boolean, 1],
550
+ 'Bufsize' => [1, 1, Parse_unsigned, 16 * 1024],
551
+
552
+ 'MemLimit' => [1, 1, Parse_unsigned, 128 *1024 *1024],
553
+
554
+ }, @_) ;
555
+
556
+
557
+ my $flags = 0 ;
558
+ $flags |= FLAG_APPEND if $got->value('AppendOutput') ;
559
+ $flags |= FLAG_CONSUME_INPUT if $got->value('ConsumeInput') ;
560
+ $flags |= FLAG_LIMIT_OUTPUT if $got->value('LimitOutput') ;
561
+
562
+ lzma_auto_decoder($pkg, $flags, $got->value('MemLimit'));
563
+ }
564
+
565
+ @Compress::Raw::Lzma::AloneDecoder::ISA = qw(Compress::Raw::Lzma::Decoder);
566
+
567
+ sub Compress::Raw::Lzma::AloneDecoder::new
568
+ {
569
+ my $pkg = shift ;
570
+ my ($got) = ParseParameters(0,
571
+ {
572
+ 'AppendOutput' => [1, 1, Parse_boolean, 0],
573
+ 'LimitOutput' => [1, 1, Parse_boolean, 0],
574
+ 'ConsumeInput' => [1, 1, Parse_boolean, 1],
575
+ 'Bufsize' => [1, 1, Parse_unsigned, 16 * 1024],
576
+
577
+ 'MemLimit' => [1, 1, Parse_unsigned, 128 *1024 *1024],
578
+
579
+ }, @_) ;
580
+
581
+
582
+ my $flags = 0 ;
583
+ $flags |= FLAG_APPEND if $got->value('AppendOutput') ;
584
+ $flags |= FLAG_CONSUME_INPUT if $got->value('ConsumeInput') ;
585
+ $flags |= FLAG_LIMIT_OUTPUT if $got->value('LimitOutput') ;
586
+
587
+ lzma_alone_decoder($pkg,
588
+ $flags,
589
+ $got->value('Bufsize'),
590
+ $got->value('MemLimit'));
591
+ }
592
+
593
+ @Compress::Raw::Lzma::StreamDecoder::ISA = qw(Compress::Raw::Lzma::Decoder);
594
+
595
+ sub Compress::Raw::Lzma::StreamDecoder::new
596
+ {
597
+ my $pkg = shift ;
598
+ my ($got) = ParseParameters(0,
599
+ {
600
+ 'AppendOutput' => [1, 1, Parse_boolean, 0],
601
+ 'LimitOutput' => [1, 1, Parse_boolean, 0],
602
+ 'ConsumeInput' => [1, 1, Parse_boolean, 1],
603
+ 'Bufsize' => [1, 1, Parse_unsigned, 16 * 1024],
604
+
605
+ 'MemLimit' => [1, 1, Parse_unsigned, 128 *1024 *1024],
606
+ 'Flags' => [1, 1, Parse_unsigned, 0],
607
+
608
+ }, @_) ;
609
+
610
+
611
+ my $flags = 0 ;
612
+ $flags |= FLAG_APPEND if $got->value('AppendOutput') ;
613
+ $flags |= FLAG_CONSUME_INPUT if $got->value('ConsumeInput') ;
614
+ $flags |= FLAG_LIMIT_OUTPUT if $got->value('LimitOutput') ;
615
+
616
+ lzma_stream_decoder($pkg,
617
+ $flags,
618
+ $got->value('Bufsize'),
619
+ $got->value('MemLimit'),
620
+ $got->value('Flags'));
621
+ }
622
+
623
+ @Compress::Raw::Lzma::RawDecoder::ISA = qw(Compress::Raw::Lzma::Decoder);
624
+
625
+ sub Compress::Raw::Lzma::RawDecoder::new
626
+ {
627
+ my $pkg = shift ;
628
+ my ($got) = ParseParameters(0,
629
+ {
630
+ 'AppendOutput' => [1, 1, Parse_boolean, 0],
631
+ 'LimitOutput' => [1, 1, Parse_boolean, 0],
632
+ 'ConsumeInput' => [1, 1, Parse_boolean, 1],
633
+ 'Bufsize' => [1, 1, Parse_unsigned, 16 * 1024],
634
+ 'Filter' => [1, 1, Parse_any, [] ],
635
+ 'Properties' => [1, 1, Parse_any, undef],
636
+ }, @_) ;
637
+
638
+
639
+ my $flags = 0 ;
640
+ $flags |= FLAG_APPEND if $got->value('AppendOutput') ;
641
+ $flags |= FLAG_CONSUME_INPUT if $got->value('ConsumeInput') ;
642
+ $flags |= FLAG_LIMIT_OUTPUT if $got->value('LimitOutput') ;
643
+
644
+ my $filters = Lzma::Filters::validateFilters(0, ! defined $got->value('Properties'),
645
+ $got->value('Filter')) ;
646
+
647
+ lzma_raw_decoder($pkg,
648
+ $flags,
649
+ $got->value('Bufsize'),
650
+ $filters,
651
+ $got->value('Properties'));
652
+ }
653
+
654
+ # LZMA1/2
655
+ # Preset
656
+ # Dict
657
+ # Lc
658
+ # Lp
659
+ # Pb
660
+ # Mode LZMA_MODE_FAST, LZMA_MODE_NORMAL
661
+ # Nice
662
+ # Mf LZMA_MF_HC3 LZMA_MF_HC4 LZMA_MF_BT2 LZMA_MF_BT3 LZMA_MF_BT4
663
+ # Depth
664
+
665
+ # BCJ
666
+ # LZMA_FILTER_X86
667
+ # LZMA_FILTER_POWERPC
668
+ # LZMA_FILTER_IA64
669
+ # LZMA_FILTER_ARM
670
+ # LZMA_FILTER_ARMTHUMB
671
+ # LZMA_FILTER_SPARC
672
+ #
673
+ # BCJ => LZMA_FILTER_X86 -- this assumes offset is 0
674
+ # BCJ => [LZMA_FILTER_X86, offset]
675
+
676
+ # Delta
677
+ # Dist 1 - 256, 1
678
+
679
+ # Subblock
680
+ # Size
681
+ # RLE
682
+ # Align
683
+
684
+ # Preset (0-9) LZMA_PRESET_EXTREME LZMA_PRESET_DEFAULT -- call lzma_lzma_preset
685
+
686
+ # Memory
687
+
688
+ # Check => LZMA_CHECK_NONE, LZMA_CHECK_CRC32, LZMA_CHECK_CRC64, LZMA_CHECK_SHA256
689
+
690
+ # my $bool = lzma_check_is_supported(LZMA_CHECK_CRC32);
691
+ # my $int = lzma_check_size(LZMA_CHECK_CRC32);
692
+ # my $int = $lzma->lzma_get_check();
693
+
694
+
695
+
696
+
697
+ #sub Compress::Raw::Lzma::new
698
+ #{
699
+ # my $class = shift ;
700
+ # my ($ptr, $status) = _new(@_);
701
+ # return wantarray ? (undef, $status) : undef
702
+ # unless $ptr ;
703
+ # my $obj = bless [$ptr], $class ;
704
+ # return wantarray ? ($obj, $status) : $obj;
705
+ #}
706
+ #
707
+ #package Compress::Raw::UnLzma ;
708
+ #
709
+ #sub Compress::Raw::UnLzma::new
710
+ #{
711
+ # my $class = shift ;
712
+ # my ($ptr, $status) = _new(@_);
713
+ # return wantarray ? (undef, $status) : undef
714
+ # unless $ptr ;
715
+ # my $obj = bless [$ptr], $class ;
716
+ # return wantarray ? ($obj, $status) : $obj;
717
+ #}
718
+
719
+
720
+ sub Lzma::Filters::validateFilters
721
+ {
722
+ use UNIVERSAL ;
723
+ use Scalar::Util qw(blessed );
724
+
725
+ my $encoding = shift; # not decoding
726
+ my $lzma2 = shift;
727
+
728
+ # my $objType = $lzma2 ? "Lzma::Filter::Lzma2"
729
+ # : "Lzma::Filter::Lzma" ;
730
+
731
+ my $objType = "Lzma::Filter::Lzma" ;
732
+
733
+ # if only one, convert into an array reference
734
+ if (blessed $_[0] ) {
735
+ die "filter object $_[0] is not an $objType object"
736
+ unless UNIVERSAL::isa($_[0], $objType);
737
+
738
+ #$_[0] = [ $_[0] ] ;
739
+ return [ $_[0] ] ;
740
+ }
741
+
742
+ if (ref $_[0] ne 'ARRAY')
743
+ { die "$_[0] not Lzma::Filter object or ARRAY ref" }
744
+
745
+ my $filters = $_[0] ;
746
+ my $count = @$filters;
747
+
748
+ # check number of filters
749
+ die sprintf "Too many filters ($count), max is %d", LZMA_FILTERS_MAX()
750
+ if $count > LZMA_FILTERS_MAX();
751
+
752
+ # TODO - add more tests here
753
+ # Check that all filters inherit from Lzma::Filter
754
+ # check that filters are supported
755
+ # check memory requirements
756
+ # need exactly one lzma1/2 filter
757
+ # lzma1/2 is the last thing in the list
758
+ for (my $i = 0; $i < @$filters ; ++$i)
759
+ {
760
+ my $filt = $filters->[$i];
761
+ die "filter is not an Lzma::Filter object"
762
+ unless UNIVERSAL::isa($filt, 'Lzma::Filter');
763
+ die "Lzma filter must be last"
764
+ if UNIVERSAL::isa($filt, 'Lzma::Filter::Lzma') && $i < $count -1 ;
765
+
766
+ #die "xxx" unless lzma_filter_encoder_is_supported($filt->id());
767
+ }
768
+
769
+ if (@$filters == 0)
770
+ {
771
+ push @$filters, $lzma2 ? Lzma::Filter::Lzma2()
772
+ : Lzma::Filter::Lzma1();
773
+ }
774
+
775
+ return $filters;
776
+ }
777
+
778
+ #package Lzma::Filter;
779
+ #package Lzma::Filter::Lzma;
780
+
781
+ #our ($VERSION, @ISA, @EXPORT, $AUTOLOAD);
782
+ @Lzma::Filter::Lzma::ISA = qw(Lzma::Filter);
783
+
784
+ sub Lzma::Filter::Lzma::mk
785
+ {
786
+ my $type = shift;
787
+
788
+ my $got = Compress::Raw::Lzma::ParseParameters(0,
789
+ {
790
+ 'DictSize' => [1, 1, Parse_unsigned(), LZMA_DICT_SIZE_DEFAULT()],
791
+ 'PresetDict' => [1, 1, Parse_string(), undef],
792
+ 'Lc' => [1, 1, Parse_unsigned(), LZMA_LC_DEFAULT()],
793
+ 'Lp' => [1, 1, Parse_unsigned(), LZMA_LP_DEFAULT()],
794
+ 'Pb' => [1, 1, Parse_unsigned(), LZMA_PB_DEFAULT()],
795
+ 'Mode' => [1, 1, Parse_unsigned(), LZMA_MODE_NORMAL()],
796
+ 'Nice' => [1, 1, Parse_unsigned(), 64],
797
+ 'Mf' => [1, 1, Parse_unsigned(), LZMA_MF_BT4()],
798
+ 'Depth' => [1, 1, Parse_unsigned(), 0],
799
+ }, @_) ;
800
+
801
+ my $pkg = (caller(1))[3] ;
802
+
803
+ my $DictSize = $got->value('DictSize');
804
+ die "Dictsize $DictSize not in range 4KiB - 1536Mib"
805
+ if $DictSize < 1024 * 4 ||
806
+ $DictSize > 1024 * 1024 * 1536 ;
807
+
808
+ my $Lc = $got->value('Lc');
809
+ die "Lc $Lc not in range 0-4"
810
+ if $Lc < 0 || $Lc > 4;
811
+
812
+ my $Lp = $got->value('Lp');
813
+ die "Lp $Lp not in range 0-4"
814
+ if $Lp < 0 || $Lp > 4;
815
+
816
+ die "Lc + Lp must be <= 4"
817
+ if $Lc + $Lp > 4;
818
+
819
+ my $Pb = $got->value('Pb');
820
+ die "Pb $Pb not in range 0-4"
821
+ if $Pb < 0 || $Pb > 4;
822
+
823
+ my $Mode = $got->value('Mode');
824
+ die "Mode $Mode not LZMA_MODE_FAST or LZMA_MODE_NORMAL"
825
+ if $Mode != LZMA_MODE_FAST() && $Mode != LZMA_MODE_NORMAL();
826
+
827
+ my $Mf = $got->value('Mf');
828
+ die "Mf $Mf not valid"
829
+ if ! grep { $Mf == $_ }
830
+ ( LZMA_MF_HC3(),
831
+ LZMA_MF_HC4(),
832
+ LZMA_MF_BT2(),
833
+ LZMA_MF_BT3(),
834
+ LZMA_MF_BT4());
835
+
836
+ my $Nice = $got->value('Nice');
837
+ die "Nice $Nice not in range 2-273"
838
+ if $Nice < 2 || $Nice > 273;
839
+
840
+ my $obj = Lzma::Filter::Lzma::_mk($type,
841
+ $DictSize,
842
+ $Lc,
843
+ $Lp,
844
+ $Pb,
845
+ $Mode,
846
+ $Nice,
847
+ $Mf,
848
+ $got->value('Depth'),
849
+ $got->value('PresetDict'),
850
+ );
851
+
852
+ bless $obj, $pkg
853
+ if defined $obj;
854
+
855
+ $obj;
856
+ }
857
+
858
+ sub Lzma::Filter::Lzma::mkPreset
859
+ {
860
+ my $type = shift;
861
+
862
+ my $preset = shift;
863
+ my $pkg = (caller(1))[3] ;
864
+
865
+ my $obj = Lzma::Filter::Lzma::_mkPreset($type, $preset);
866
+
867
+ bless $obj, $pkg
868
+ if defined $obj;
869
+
870
+ $obj;
871
+ }
872
+
873
+ @Lzma::Filter::Lzma1::ISA = qw(Lzma::Filter::Lzma);
874
+ sub Lzma::Filter::Lzma1
875
+ {
876
+ Lzma::Filter::Lzma::mk(0, @_);
877
+ }
878
+
879
+ @Lzma::Filter::Lzma1::Preset::ISA = qw(Lzma::Filter::Lzma);
880
+ sub Lzma::Filter::Lzma1::Preset
881
+ {
882
+ Lzma::Filter::Lzma::mkPreset(0, @_);
883
+ }
884
+
885
+ @Lzma::Filter::Lzma2::ISA = qw(Lzma::Filter::Lzma);
886
+ sub Lzma::Filter::Lzma2
887
+ {
888
+ Lzma::Filter::Lzma::mk(1, @_);
889
+ }
890
+
891
+ @Lzma::Filter::Lzma2::Preset::ISA = qw(Lzma::Filter::Lzma);
892
+ sub Lzma::Filter::Lzma2::Preset
893
+ {
894
+ Lzma::Filter::Lzma::mkPreset(1, @_);
895
+ }
896
+
897
+ @Lzma::Filter::BCJ::ISA = qw(Lzma::Filter);
898
+
899
+ sub Lzma::Filter::BCJ::mk
900
+ {
901
+ my $type = shift;
902
+ my $got = Compress::Raw::Lzma::ParseParameters(0,
903
+ {
904
+ 'Offset' => [1, 1, Parse_unsigned(), 0],
905
+ }, @_) ;
906
+
907
+ my $pkg = (caller(1))[3] ;
908
+ my $obj = Lzma::Filter::BCJ::_mk($type, $got->value('Offset')) ;
909
+ bless $obj, $pkg
910
+ if defined $obj;
911
+
912
+ $obj;
913
+ }
914
+
915
+ @Lzma::Filter::X86::ISA = qw(Lzma::Filter::BCJ);
916
+
917
+ sub Lzma::Filter::X86
918
+ {
919
+ Lzma::Filter::BCJ::mk(LZMA_FILTER_X86(), @_);
920
+ }
921
+
922
+ @Lzma::Filter::PowerPC::ISA = qw(Lzma::Filter::BCJ);
923
+
924
+ sub Lzma::Filter::PowerPC
925
+ {
926
+ Lzma::Filter::BCJ::mk(LZMA_FILTER_POWERPC(), @_);
927
+ }
928
+
929
+ @Lzma::Filter::IA64::ISA = qw(Lzma::Filter::BCJ);
930
+
931
+ sub Lzma::Filter::IA64
932
+ {
933
+ Lzma::Filter::BCJ::mk(LZMA_FILTER_IA64(), @_);
934
+ }
935
+
936
+ @Lzma::Filter::ARM::ISA = qw(Lzma::Filter::BCJ);
937
+
938
+ sub Lzma::Filter::ARM
939
+ {
940
+ Lzma::Filter::BCJ::mk(LZMA_FILTER_ARM(), @_);
941
+ }
942
+
943
+ @Lzma::Filter::ARMThumb::ISA = qw(Lzma::Filter::BCJ);
944
+
945
+ sub Lzma::Filter::ARMThumb
946
+ {
947
+ Lzma::Filter::BCJ::mk(LZMA_FILTER_ARMTHUMB(), @_);
948
+ }
949
+
950
+ @Lzma::Filter::Sparc::ISA = qw(Lzma::Filter::BCJ);
951
+
952
+ sub Lzma::Filter::Sparc
953
+ {
954
+ Lzma::Filter::BCJ::mk(LZMA_FILTER_SPARC(), @_);
955
+ }
956
+
957
+
958
+ @Lzma::Filter::Delta::ISA = qw(Lzma::Filter);
959
+ sub Lzma::Filter::Delta
960
+ {
961
+ #my $pkg = shift ;
962
+ my ($got) = Compress::Raw::Lzma::ParseParameters(0,
963
+ {
964
+ 'Type' => [1, 1, Parse_unsigned, LZMA_DELTA_TYPE_BYTE()],
965
+ 'Distance' => [1, 1, Parse_unsigned, LZMA_DELTA_DIST_MIN()],
966
+ }, @_) ;
967
+
968
+ Lzma::Filter::Delta::_mk($got->value('Type'),
969
+ $got->value('Distance')) ;
970
+ }
971
+
972
+ #package Lzma::Filter::SubBlock;
973
+
974
+
975
+ package Compress::Raw::Lzma;
976
+
977
+ 1;
978
+
979
+ __END__
980
+
981
+
982
+ #line 1721