exiftool-vendored.exe 12.82.0 → 12.84.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (270) hide show
  1. package/README.md +6 -0
  2. package/bin/exiftool.exe +0 -0
  3. package/bin/exiftool_files/Changes +37 -0
  4. package/bin/exiftool_files/Licenses_Strawberry_Perl.zip +0 -0
  5. package/bin/exiftool_files/README +3 -2
  6. package/bin/exiftool_files/build_geolocation +872 -0
  7. package/bin/exiftool_files/config_files/example.config +2 -2
  8. package/bin/exiftool_files/exiftool.pl +28 -6
  9. package/bin/exiftool_files/fmt_files/gpx.fmt +2 -1
  10. package/bin/exiftool_files/fmt_files/gpx_wpt.fmt +2 -1
  11. package/bin/exiftool_files/lib/Archive/Zip/Archive.pm +399 -65
  12. package/bin/exiftool_files/lib/Archive/Zip/DirectoryMember.pm +1 -1
  13. package/bin/exiftool_files/lib/Archive/Zip/FileMember.pm +1 -1
  14. package/bin/exiftool_files/lib/Archive/Zip/Member.pm +499 -195
  15. package/bin/exiftool_files/lib/Archive/Zip/NewFileMember.pm +1 -1
  16. package/bin/exiftool_files/lib/Archive/Zip/StringMember.pm +2 -2
  17. package/bin/exiftool_files/lib/Archive/Zip/ZipFileMember.pm +79 -20
  18. package/bin/exiftool_files/lib/Archive/Zip.pm +179 -29
  19. package/bin/exiftool_files/lib/AutoLoader.pm +453 -0
  20. package/bin/exiftool_files/lib/B/Deparse.pm +209 -137
  21. package/bin/exiftool_files/lib/B.pm +1 -1
  22. package/bin/exiftool_files/lib/Benchmark.pm +1123 -0
  23. package/bin/exiftool_files/lib/Class/Struct.pm +2 -2
  24. package/bin/exiftool_files/lib/Compress/Raw/Bzip2.pm +14 -9
  25. package/bin/exiftool_files/lib/Compress/Raw/Lzma.pm +982 -0
  26. package/bin/exiftool_files/lib/Compress/Raw/Zlib.pm +91 -86
  27. package/bin/exiftool_files/lib/Compress/Zlib.pm +105 -100
  28. package/bin/exiftool_files/lib/Config.pm +9 -9
  29. package/bin/exiftool_files/lib/Config_heavy.pl +36 -33
  30. package/bin/exiftool_files/lib/CryptX.pm +2 -82
  31. package/bin/exiftool_files/lib/Data/Dumper.pm +2 -2
  32. package/bin/exiftool_files/lib/Digest/MD5.pm +12 -9
  33. package/bin/exiftool_files/lib/Digest/Perl/MD5.pm +1 -191
  34. package/bin/exiftool_files/lib/Digest/base.pm +26 -20
  35. package/bin/exiftool_files/lib/DynaLoader.pm +7 -4
  36. package/bin/exiftool_files/lib/Encode.pm +3 -3
  37. package/bin/exiftool_files/lib/Errno.pm +13 -13
  38. package/bin/exiftool_files/lib/Exporter/Heavy.pm +2 -2
  39. package/bin/exiftool_files/lib/Exporter.pm +1 -1
  40. package/bin/exiftool_files/lib/ExtUtils/Command/MM.pm +323 -0
  41. package/bin/exiftool_files/lib/ExtUtils/Command.pm +382 -0
  42. package/bin/exiftool_files/lib/File/Find.pm +1 -1
  43. package/bin/exiftool_files/lib/File/Glob.pm +1 -8
  44. package/bin/exiftool_files/lib/File/GlobMapper.pm +2 -2
  45. package/bin/exiftool_files/lib/File/HomeDir/Darwin/Carbon.pm +2 -40
  46. package/bin/exiftool_files/lib/File/HomeDir/Darwin/Cocoa.pm +2 -34
  47. package/bin/exiftool_files/lib/File/HomeDir/Darwin.pm +2 -28
  48. package/bin/exiftool_files/lib/File/HomeDir/Driver.pm +2 -35
  49. package/bin/exiftool_files/lib/File/HomeDir/FreeDesktop.pm +2 -62
  50. package/bin/exiftool_files/lib/File/HomeDir/MacOS9.pm +2 -53
  51. package/bin/exiftool_files/lib/File/HomeDir/Test.pm +2 -43
  52. package/bin/exiftool_files/lib/File/HomeDir/Unix.pm +2 -53
  53. package/bin/exiftool_files/lib/File/HomeDir/Windows.pm +2 -69
  54. package/bin/exiftool_files/lib/File/HomeDir.pm +5 -416
  55. package/bin/exiftool_files/lib/File/Path.pm +3 -3
  56. package/bin/exiftool_files/lib/File/Spec/Win32.pm +2 -2
  57. package/bin/exiftool_files/lib/File/Temp.pm +70 -35
  58. package/bin/exiftool_files/lib/File/Which.pm +1 -240
  59. package/bin/exiftool_files/lib/File/stat.pm +3 -2
  60. package/bin/exiftool_files/lib/IO/Compress/Adapter/Bzip2.pm +16 -17
  61. package/bin/exiftool_files/lib/IO/Compress/Adapter/Deflate.pm +19 -20
  62. package/bin/exiftool_files/lib/IO/Compress/Base/Common.pm +5 -5
  63. package/bin/exiftool_files/lib/IO/Compress/Base.pm +35 -26
  64. package/bin/exiftool_files/lib/IO/Compress/Brotli.pm +159 -0
  65. package/bin/exiftool_files/lib/IO/Compress/Bzip2.pm +50 -25
  66. package/bin/exiftool_files/lib/IO/Compress/Gzip/Constants.pm +6 -6
  67. package/bin/exiftool_files/lib/IO/Compress/Gzip.pm +58 -32
  68. package/bin/exiftool_files/lib/IO/Compress/RawDeflate.pm +63 -38
  69. package/bin/exiftool_files/lib/IO/Compress/Zlib/Extra.pm +20 -20
  70. package/bin/exiftool_files/lib/IO/Dir.pm +1 -1
  71. package/bin/exiftool_files/lib/IO/File.pm +1 -1
  72. package/bin/exiftool_files/lib/IO/Handle.pm +1 -21
  73. package/bin/exiftool_files/lib/IO/Pipe.pm +1 -1
  74. package/bin/exiftool_files/lib/IO/Seekable.pm +1 -1
  75. package/bin/exiftool_files/lib/IO/Select.pm +16 -2
  76. package/bin/exiftool_files/lib/IO/Socket/INET.pm +14 -9
  77. package/bin/exiftool_files/lib/IO/Socket/UNIX.pm +17 -1
  78. package/bin/exiftool_files/lib/IO/Socket.pm +474 -126
  79. package/bin/exiftool_files/lib/IO/String.pm +425 -0
  80. package/bin/exiftool_files/lib/IO/Uncompress/Adapter/Inflate.pm +13 -14
  81. package/bin/exiftool_files/lib/IO/Uncompress/Base.pm +142 -132
  82. package/bin/exiftool_files/lib/IO/Uncompress/Brotli.pm +119 -0
  83. package/bin/exiftool_files/lib/IO/Uncompress/Gunzip.pm +43 -37
  84. package/bin/exiftool_files/lib/IO/Uncompress/RawInflate.pm +49 -43
  85. package/bin/exiftool_files/lib/IO.pm +2 -2
  86. package/bin/exiftool_files/lib/Image/ExifTool/Apple.pm +51 -7
  87. package/bin/exiftool_files/lib/Image/ExifTool/BuildTagLookup.pm +5 -2
  88. package/bin/exiftool_files/lib/Image/ExifTool/CanonVRD.pm +18 -5
  89. package/bin/exiftool_files/lib/Image/ExifTool/DJI.pm +29 -0
  90. package/bin/exiftool_files/lib/Image/ExifTool/Exif.pm +19 -2
  91. package/bin/exiftool_files/lib/Image/ExifTool/GM.pm +17 -8
  92. package/bin/exiftool_files/lib/Image/ExifTool/Geolocation.dat +0 -0
  93. package/bin/exiftool_files/lib/Image/ExifTool/Geolocation.pm +163 -101
  94. package/bin/exiftool_files/lib/Image/ExifTool/Geotag.pm +18 -10
  95. package/bin/exiftool_files/lib/Image/ExifTool/Nikon.pm +7 -6
  96. package/bin/exiftool_files/lib/Image/ExifTool/QuickTime.pm +6 -1
  97. package/bin/exiftool_files/lib/Image/ExifTool/QuickTimeStream.pl +5 -0
  98. package/bin/exiftool_files/lib/Image/ExifTool/Sony.pm +15 -6
  99. package/bin/exiftool_files/lib/Image/ExifTool/TagLookup.pm +18 -9
  100. package/bin/exiftool_files/lib/Image/ExifTool/TagNames.pod +24 -5
  101. package/bin/exiftool_files/lib/Image/ExifTool/WriteQuickTime.pl +2 -1
  102. package/bin/exiftool_files/lib/Image/ExifTool/Writer.pl +165 -132
  103. package/bin/exiftool_files/lib/Image/ExifTool/XMP2.pl +3 -0
  104. package/bin/exiftool_files/lib/Image/ExifTool.pm +45 -23
  105. package/bin/exiftool_files/lib/Image/ExifTool.pod +23 -14
  106. package/bin/exiftool_files/lib/List/Util.pm +97 -8
  107. package/bin/exiftool_files/lib/MIME/Base64.pm +5 -5
  108. package/bin/exiftool_files/lib/MIME/Charset/_Compat.pm +106 -0
  109. package/bin/exiftool_files/lib/MIME/Charset.pm +1303 -0
  110. package/bin/exiftool_files/lib/Math/BigFloat.pm +444 -27
  111. package/bin/exiftool_files/lib/Math/BigInt/Calc.pm +296 -313
  112. package/bin/exiftool_files/lib/Math/BigInt/FastCalc.pm +1 -1
  113. package/bin/exiftool_files/lib/Math/BigInt/GMP.pm +2 -115
  114. package/bin/exiftool_files/lib/Math/BigInt/LTM.pm +2 -24
  115. package/bin/exiftool_files/lib/Math/BigInt/Lib.pm +61 -32
  116. package/bin/exiftool_files/lib/Math/BigInt.pm +292 -107
  117. package/bin/exiftool_files/lib/POSIX.pm +1 -1
  118. package/bin/exiftool_files/lib/PerlIO/scalar.pm +41 -0
  119. package/bin/exiftool_files/lib/PerlIO.pm +397 -0
  120. package/bin/exiftool_files/lib/Portable/CPAN.pm +94 -94
  121. package/bin/exiftool_files/lib/Portable/Config.pm +94 -94
  122. package/bin/exiftool_files/lib/Portable/FileSpec.pm +180 -180
  123. package/bin/exiftool_files/lib/Portable/HomeDir.pm +110 -110
  124. package/bin/exiftool_files/lib/Portable/LoadYaml.pm +430 -430
  125. package/bin/exiftool_files/lib/Portable/minicpan.pm +55 -55
  126. package/bin/exiftool_files/lib/Portable.pm +246 -320
  127. package/bin/exiftool_files/lib/Scalar/Util.pm +9 -4
  128. package/bin/exiftool_files/lib/Socket.pm +16 -12
  129. package/bin/exiftool_files/lib/Storable.pm +1444 -1441
  130. package/bin/exiftool_files/lib/TAP/Base.pm +133 -0
  131. package/bin/exiftool_files/lib/TAP/Formatter/Base.pm +467 -0
  132. package/bin/exiftool_files/lib/TAP/Formatter/Color.pm +116 -0
  133. package/bin/exiftool_files/lib/TAP/Formatter/Console/ParallelSession.pm +201 -0
  134. package/bin/exiftool_files/lib/TAP/Formatter/Console/Session.pm +205 -0
  135. package/bin/exiftool_files/lib/TAP/Formatter/Console.pm +100 -0
  136. package/bin/exiftool_files/lib/TAP/Formatter/File/Session.pm +95 -0
  137. package/bin/exiftool_files/lib/TAP/Formatter/File.pm +56 -0
  138. package/bin/exiftool_files/lib/TAP/Formatter/Session.pm +220 -0
  139. package/bin/exiftool_files/lib/TAP/Harness/Beyond.pod +426 -0
  140. package/bin/exiftool_files/lib/TAP/Harness/Env.pm +215 -0
  141. package/bin/exiftool_files/lib/TAP/Harness.pm +1054 -0
  142. package/bin/exiftool_files/lib/TAP/Object.pm +155 -0
  143. package/bin/exiftool_files/lib/TAP/Parser/Aggregator.pm +414 -0
  144. package/bin/exiftool_files/lib/TAP/Parser/Grammar.pm +584 -0
  145. package/bin/exiftool_files/lib/TAP/Parser/Iterator/Array.pm +100 -0
  146. package/bin/exiftool_files/lib/TAP/Parser/Iterator/Process.pm +378 -0
  147. package/bin/exiftool_files/lib/TAP/Parser/Iterator/Stream.pm +116 -0
  148. package/bin/exiftool_files/lib/TAP/Parser/Iterator.pm +162 -0
  149. package/bin/exiftool_files/lib/TAP/Parser/IteratorFactory.pm +339 -0
  150. package/bin/exiftool_files/lib/TAP/Parser/Multiplexer.pm +194 -0
  151. package/bin/exiftool_files/lib/TAP/Parser/Result/Bailout.pm +62 -0
  152. package/bin/exiftool_files/lib/TAP/Parser/Result/Comment.pm +60 -0
  153. package/bin/exiftool_files/lib/TAP/Parser/Result/Plan.pm +119 -0
  154. package/bin/exiftool_files/lib/TAP/Parser/Result/Pragma.pm +62 -0
  155. package/bin/exiftool_files/lib/TAP/Parser/Result/Test.pm +271 -0
  156. package/bin/exiftool_files/lib/TAP/Parser/Result/Unknown.pm +48 -0
  157. package/bin/exiftool_files/lib/TAP/Parser/Result/Version.pm +62 -0
  158. package/bin/exiftool_files/lib/TAP/Parser/Result/YAML.pm +61 -0
  159. package/bin/exiftool_files/lib/TAP/Parser/Result.pm +297 -0
  160. package/bin/exiftool_files/lib/TAP/Parser/ResultFactory.pm +183 -0
  161. package/bin/exiftool_files/lib/TAP/Parser/Scheduler/Job.pm +127 -0
  162. package/bin/exiftool_files/lib/TAP/Parser/Scheduler/Spinner.pm +61 -0
  163. package/bin/exiftool_files/lib/TAP/Parser/Scheduler.pm +448 -0
  164. package/bin/exiftool_files/lib/TAP/Parser/Source.pm +381 -0
  165. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/Executable.pm +184 -0
  166. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/File.pm +136 -0
  167. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/Handle.pm +124 -0
  168. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/Perl.pm +370 -0
  169. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/RawTAP.pm +130 -0
  170. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler.pm +191 -0
  171. package/bin/exiftool_files/lib/TAP/Parser/YAMLish/Reader.pm +332 -0
  172. package/bin/exiftool_files/lib/TAP/Parser/YAMLish/Writer.pm +254 -0
  173. package/bin/exiftool_files/lib/TAP/Parser.pm +1931 -0
  174. package/bin/exiftool_files/lib/Test/Builder/Formatter.pm +107 -0
  175. package/bin/exiftool_files/lib/Test/Builder/IO/Scalar.pm +659 -0
  176. package/bin/exiftool_files/lib/Test/Builder/Module.pm +182 -0
  177. package/bin/exiftool_files/lib/Test/Builder/Tester/Color.pm +51 -0
  178. package/bin/exiftool_files/lib/Test/Builder/Tester.pm +675 -0
  179. package/bin/exiftool_files/lib/Test/Builder/TodoDiag.pm +68 -0
  180. package/bin/exiftool_files/lib/Test/Builder.pm +2653 -0
  181. package/bin/exiftool_files/lib/Test/Harness.pm +618 -0
  182. package/bin/exiftool_files/lib/Test/More.pm +1997 -0
  183. package/bin/exiftool_files/lib/Test/Simple.pm +220 -0
  184. package/bin/exiftool_files/lib/Test/Tester/Capture.pm +241 -0
  185. package/bin/exiftool_files/lib/Test/Tester/CaptureRunner.pm +79 -0
  186. package/bin/exiftool_files/lib/Test/Tester/Delegate.pm +45 -0
  187. package/bin/exiftool_files/lib/Test/Tester.pm +695 -0
  188. package/bin/exiftool_files/lib/Test/Tutorial.pod +618 -0
  189. package/bin/exiftool_files/lib/Test/use/ok.pm +64 -0
  190. package/bin/exiftool_files/lib/Text/ParseWords.pm +303 -0
  191. package/bin/exiftool_files/lib/Tie/StdHandle.pm +2 -2
  192. package/bin/exiftool_files/lib/Time/HiRes.pm +73 -68
  193. package/bin/exiftool_files/lib/Time/Local.pm +82 -35
  194. package/bin/exiftool_files/lib/Time/Piece.pm +19 -4
  195. package/bin/exiftool_files/lib/Time/Seconds.pm +1 -1
  196. package/bin/exiftool_files/lib/UNIVERSAL.pm +203 -0
  197. package/bin/exiftool_files/lib/Unicode/GCString.pm +60 -0
  198. package/bin/exiftool_files/lib/Unicode/LineBreak/Constants.pm +68 -0
  199. package/bin/exiftool_files/lib/Unicode/LineBreak.pm +248 -0
  200. package/bin/exiftool_files/lib/Win32/API/Struct.pm +1 -177
  201. package/bin/exiftool_files/lib/Win32/API/Type.pm +1 -100
  202. package/bin/exiftool_files/lib/Win32/API.pm +1 -830
  203. package/bin/exiftool_files/lib/Win32/FindFile.pm +2 -123
  204. package/bin/exiftool_files/lib/Win32.pm +213 -89
  205. package/bin/exiftool_files/lib/Win32API/File.pm +1 -1
  206. package/bin/exiftool_files/lib/auto/B/B.xs.dll +0 -0
  207. package/bin/exiftool_files/lib/auto/Compress/Raw/Bzip2/Bzip2.xs.dll +0 -0
  208. package/bin/exiftool_files/lib/auto/Compress/Raw/Lzma/Lzma.xs.dll +0 -0
  209. package/bin/exiftool_files/lib/auto/Compress/Raw/Lzma/autosplit.ix +3 -0
  210. package/bin/exiftool_files/lib/auto/Compress/Raw/Zlib/Zlib.xs.dll +0 -0
  211. package/bin/exiftool_files/lib/auto/CryptX/CryptX.xs.dll +0 -0
  212. package/bin/exiftool_files/lib/auto/Cwd/Cwd.xs.dll +0 -0
  213. package/bin/exiftool_files/lib/auto/Data/Dumper/Dumper.xs.dll +0 -0
  214. package/bin/exiftool_files/lib/auto/Digest/MD5/MD5.xs.dll +0 -0
  215. package/bin/exiftool_files/lib/auto/Digest/SHA/SHA.xs.dll +0 -0
  216. package/bin/exiftool_files/lib/auto/Encode/Encode.xs.dll +0 -0
  217. package/bin/exiftool_files/lib/auto/Fcntl/Fcntl.xs.dll +0 -0
  218. package/bin/exiftool_files/lib/auto/File/Glob/Glob.xs.dll +0 -0
  219. package/bin/exiftool_files/lib/auto/IO/Compress/Brotli/Brotli.xs.dll +0 -0
  220. package/bin/exiftool_files/lib/auto/IO/IO.xs.dll +0 -0
  221. package/bin/exiftool_files/lib/auto/List/Util/Util.xs.dll +0 -0
  222. package/bin/exiftool_files/lib/auto/MIME/Base64/Base64.xs.dll +0 -0
  223. package/bin/exiftool_files/lib/auto/Math/BigInt/FastCalc/FastCalc.xs.dll +0 -0
  224. package/bin/exiftool_files/lib/auto/Math/BigInt/GMP/GMP.xs.dll +0 -0
  225. package/bin/exiftool_files/lib/auto/POSIX/POSIX.xs.dll +0 -0
  226. package/bin/exiftool_files/lib/auto/PerlIO/scalar/scalar.xs.dll +0 -0
  227. package/bin/exiftool_files/lib/auto/Socket/Socket.xs.dll +0 -0
  228. package/bin/exiftool_files/lib/auto/Storable/Storable.xs.dll +0 -0
  229. package/bin/exiftool_files/lib/auto/Time/HiRes/HiRes.xs.dll +0 -0
  230. package/bin/exiftool_files/lib/auto/Time/Piece/Piece.xs.dll +0 -0
  231. package/bin/exiftool_files/lib/auto/Unicode/LineBreak/LineBreak.xs.dll +0 -0
  232. package/bin/exiftool_files/lib/auto/Win32/API/API.xs.dll +0 -0
  233. package/bin/exiftool_files/lib/auto/Win32/FindFile/FindFile.xs.dll +0 -0
  234. package/bin/exiftool_files/lib/auto/Win32/Win32.xs.dll +0 -0
  235. package/bin/exiftool_files/lib/auto/Win32API/File/File.xs.dll +0 -0
  236. package/bin/exiftool_files/lib/auto/mro/mro.xs.dll +0 -0
  237. package/bin/exiftool_files/lib/auto/re/re.xs.dll +0 -0
  238. package/bin/exiftool_files/lib/feature.pm +49 -17
  239. package/bin/exiftool_files/lib/mro.pm +4 -20
  240. package/bin/exiftool_files/lib/overload.pm +15 -15
  241. package/bin/exiftool_files/lib/parent.pm +10 -2
  242. package/bin/exiftool_files/lib/re.pm +91 -33
  243. package/bin/exiftool_files/lib/warnings.pm +17 -6
  244. package/bin/exiftool_files/libgcc_s_seh-1.dll +0 -0
  245. package/bin/exiftool_files/liblzma-5__.dll +0 -0
  246. package/bin/exiftool_files/libstdc++-6.dll +0 -0
  247. package/bin/exiftool_files/libwinpthread-1.dll +0 -0
  248. package/bin/exiftool_files/perl.exe +0 -0
  249. package/bin/exiftool_files/perl532.dll +0 -0
  250. package/package.json +6 -4
  251. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/cs.pm +0 -978
  252. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/de.pm +0 -1975
  253. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/en_ca.pm +0 -44
  254. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/en_gb.pm +0 -124
  255. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/es.pm +0 -2921
  256. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/fi.pm +0 -1116
  257. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/fr.pm +0 -3171
  258. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/it.pm +0 -2750
  259. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/ja.pm +0 -10256
  260. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/ko.pm +0 -4499
  261. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/nl.pm +0 -1270
  262. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/pl.pm +0 -3019
  263. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/ru.pm +0 -18220
  264. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/sk.pm +0 -441
  265. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/sv.pm +0 -714
  266. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/tr.pm +0 -452
  267. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/zh_cn.pm +0 -2225
  268. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/zh_tw.pm +0 -72
  269. package/bin/exiftool_files/libgcc_s_dw2-1.dll +0 -0
  270. package/bin/exiftool_files/perl530.dll +0 -0
@@ -6,7 +6,7 @@ use strict;
6
6
  use vars qw( $VERSION @ISA );
7
7
 
8
8
  BEGIN {
9
- $VERSION = '1.64';
9
+ $VERSION = '1.68';
10
10
  @ISA = qw( Archive::Zip );
11
11
 
12
12
  if ($^O eq 'MSWin32') {
@@ -98,9 +98,22 @@ sub newDirectoryNamed {
98
98
 
99
99
  sub new {
100
100
  my $class = shift;
101
+ # Info-Zip 3.0 (I guess) seems to use the following values
102
+ # for the version fields in local and central directory
103
+ # headers, regardless of whether the member has an zip64
104
+ # extended information extra field or not:
105
+ #
106
+ # version made by:
107
+ # 30
108
+ #
109
+ # version needed to extract:
110
+ # 10 for directory and stored entries
111
+ # 20 for anything else
101
112
  my $self = {
102
113
  'lastModFileDateTime' => 0,
103
114
  'fileAttributeFormat' => FA_UNIX,
115
+ 'zip64' => 0,
116
+ 'desiredZip64Mode' => ZIP64_AS_NEEDED,
104
117
  'versionMadeBy' => 20,
105
118
  'versionNeededToExtract' => 20,
106
119
  'bitFlag' => ($Archive::Zip::UNICODE ? 0x0800 : 0),
@@ -116,9 +129,8 @@ sub new {
116
129
  'crc32' => 0,
117
130
  'compressedSize' => 0,
118
131
  'uncompressedSize' => 0,
119
- 'isSymbolicLink' => 0,
120
- 'password' => undef, # password for encrypted data
121
- 'crc32c' => -1, # crc for decrypted data
132
+ 'password' => undef, # password for encrypted data
133
+ 'crc32c' => -1, # crc for decrypted data
122
134
  @_
123
135
  };
124
136
  bless($self, $class);
@@ -126,22 +138,11 @@ sub new {
126
138
  return $self;
127
139
  }
128
140
 
129
- sub _becomeDirectoryIfNecessary {
130
- my $self = shift;
131
- $self->_become('Archive::Zip::DirectoryMember')
132
- if $self->isDirectory();
133
- return $self;
134
- }
135
-
136
141
  # Morph into given class (do whatever cleanup I need to do)
137
142
  sub _become {
138
143
  return bless($_[0], $_[1]);
139
144
  }
140
145
 
141
- sub versionMadeBy {
142
- shift->{'versionMadeBy'};
143
- }
144
-
145
146
  sub fileAttributeFormat {
146
147
  my $self = shift;
147
148
 
@@ -153,6 +154,24 @@ sub fileAttributeFormat {
153
154
  }
154
155
  }
155
156
 
157
+ sub zip64 {
158
+ shift->{'zip64'};
159
+ }
160
+
161
+ sub desiredZip64Mode {
162
+ my $self = shift;
163
+ my $desiredZip64Mode = $self->{'desiredZip64Mode'};
164
+ if (@_) {
165
+ $self->{'desiredZip64Mode'} =
166
+ ref($_[0]) eq 'HASH' ? shift->{desiredZip64Mode} : shift;
167
+ }
168
+ return $desiredZip64Mode;
169
+ }
170
+
171
+ sub versionMadeBy {
172
+ shift->{'versionMadeBy'};
173
+ }
174
+
156
175
  sub versionNeededToExtract {
157
176
  shift->{'versionNeededToExtract'};
158
177
  }
@@ -229,7 +248,7 @@ sub fileName {
229
248
  my $self = shift;
230
249
  my $newName = shift;
231
250
  if (defined $newName) {
232
- $newName =~ s{[\\/]+}{/}g; # deal with dos/windoze problems
251
+ $newName =~ y{\\/}{/}s; # deal with dos/windoze problems
233
252
  $self->{'fileName'} = $newName;
234
253
  }
235
254
  return $self->{'fileName'};
@@ -395,8 +414,20 @@ sub localExtraField {
395
414
  my $self = shift;
396
415
 
397
416
  if (@_) {
398
- $self->{localExtraField} =
417
+ my $localExtraField =
399
418
  (ref($_[0]) eq 'HASH') ? $_[0]->{field} : $_[0];
419
+ my ($status, $zip64) =
420
+ $self->_extractZip64ExtraField($localExtraField, undef, undef);
421
+ if ($status != AZ_OK) {
422
+ return $status;
423
+ }
424
+ elsif ($zip64) {
425
+ return _formatError('invalid extra field (contains zip64 information)');
426
+ }
427
+ else {
428
+ $self->{localExtraField} = $localExtraField;
429
+ return AZ_OK;
430
+ }
400
431
  } else {
401
432
  return $self->{localExtraField};
402
433
  }
@@ -406,7 +437,20 @@ sub cdExtraField {
406
437
  my $self = shift;
407
438
 
408
439
  if (@_) {
409
- $self->{cdExtraField} = (ref($_[0]) eq 'HASH') ? $_[0]->{field} : $_[0];
440
+ my $cdExtraField =
441
+ (ref($_[0]) eq 'HASH') ? $_[0]->{field} : $_[0];
442
+ my ($status, $zip64) =
443
+ $self->_extractZip64ExtraField($cdExtraField, undef, undef);
444
+ if ($status != AZ_OK) {
445
+ return $status;
446
+ }
447
+ elsif ($zip64) {
448
+ return _formatError('invalid extra field (contains zip64 information)');
449
+ }
450
+ else {
451
+ $self->{cdExtraField} = $cdExtraField;
452
+ return AZ_OK;
453
+ }
410
454
  } else {
411
455
  return $self->{cdExtraField};
412
456
  }
@@ -492,36 +536,40 @@ sub extractToFileNamed {
492
536
 
493
537
  # local FS name
494
538
  my $name = (ref($_[0]) eq 'HASH') ? $_[0]->{name} : $_[0];
495
- $self->{'isSymbolicLink'} = 0;
496
-
497
- # Check if the file / directory is a symbolic link or not
498
- if ($self->{'externalFileAttributes'} == 0xA1FF0000) {
499
- $self->{'isSymbolicLink'} = 1;
500
- $self->{'newName'} = $name;
501
- my ($status, $fh) = _newFileHandle($name, 'r');
502
- my $retval = $self->extractToFileHandle($fh);
503
- $fh->close();
504
- } else {
505
539
 
506
- #return _writeSymbolicLink($self, $name) if $self->isSymbolicLink();
540
+ # Create directory for regular files as well as for symbolic
541
+ # links
542
+ if ($^O eq 'MSWin32' && $Archive::Zip::UNICODE) {
543
+ $name = decode_utf8(Win32::GetFullPathName($name));
544
+ mkpath_win32($name);
545
+ } else {
546
+ mkpath(dirname($name)); # croaks on error
547
+ }
507
548
 
549
+ # Check if the file / directory is a symbolic link *and* if
550
+ # the operating system supports these. Only in that case
551
+ # call method extractToFileHandle with the name of the
552
+ # symbolic link. If the operating system does not support
553
+ # symbolic links, process the member using the usual
554
+ # extraction routines, which creates a file containing the
555
+ # link target.
556
+ if ($self->isSymbolicLink() && OS_SUPPORTS_SYMLINK) {
557
+ return $self->extractToFileHandle($name);
558
+ } else {
508
559
  my ($status, $fh);
509
560
  if ($^O eq 'MSWin32' && $Archive::Zip::UNICODE) {
510
- $name = decode_utf8(Win32::GetFullPathName($name));
511
- mkpath_win32($name);
512
561
  Win32::CreateFile($name);
513
562
  ($status, $fh) = _newFileHandle(Win32::GetANSIPathName($name), 'w');
514
563
  } else {
515
- mkpath(dirname($name)); # croaks on error
516
564
  ($status, $fh) = _newFileHandle($name, 'w');
517
565
  }
518
566
  return _ioError("Can't open file $name for write") unless $status;
519
- my $retval = $self->extractToFileHandle($fh);
567
+ $status = $self->extractToFileHandle($fh);
520
568
  $fh->close();
521
569
  chmod($self->unixFileAttributes(), $name)
522
570
  or return _error("Can't chmod() ${name}: $!");
523
571
  utime($self->lastModTime(), $self->lastModTime(), $name);
524
- return $retval;
572
+ return $status;
525
573
  }
526
574
  }
527
575
 
@@ -538,25 +586,8 @@ sub mkpath_win32 {
538
586
  }
539
587
  }
540
588
 
541
- sub _writeSymbolicLink {
542
- my $self = shift;
543
- my $name = shift;
544
- my $chunkSize = $Archive::Zip::ChunkSize;
545
-
546
- #my ( $outRef, undef ) = $self->readChunk($chunkSize);
547
- my $fh;
548
- my $retval = $self->extractToFileHandle($fh);
549
- my ($outRef, undef) = $self->readChunk(100);
550
- }
551
-
552
589
  sub isSymbolicLink {
553
- my $self = shift;
554
- if ($self->{'externalFileAttributes'} == 0xA1FF0000) {
555
- $self->{'isSymbolicLink'} = 1;
556
- } else {
557
- return 0;
558
- }
559
- 1;
590
+ return shift->{'externalFileAttributes'} == 0xA1FF0000;
560
591
  }
561
592
 
562
593
  sub isDirectory {
@@ -567,6 +598,122 @@ sub externalFileName {
567
598
  return undef;
568
599
  }
569
600
 
601
+ # Search the given extra field string for a zip64 extended
602
+ # information extra field and "correct" the header fields given
603
+ # in the remaining parameters with the information from that
604
+ # extra field, if required. Writes back the extra field string
605
+ # sans the zip64 information. The extra field string and all
606
+ # header fields must be passed as lvalues or the undefined value.
607
+ #
608
+ # This method returns a pair ($status, $zip64) in list context,
609
+ # where the latter flag specifies whether a zip64 extended
610
+ # information extra field was found.
611
+ #
612
+ # This method must be called with two header fields for local
613
+ # file headers and with four header fields for Central Directory
614
+ # headers.
615
+ sub _extractZip64ExtraField
616
+ {
617
+ my $classOrSelf = shift;
618
+
619
+ my $extraField = $_[0];
620
+
621
+ my ($zip64Data, $newExtraField) = (undef, '');
622
+ while (length($extraField) >= 4) {
623
+ my ($headerId, $dataSize) = unpack('v v', $extraField);
624
+ if (length($extraField) < 4 + $dataSize) {
625
+ return _formatError('invalid extra field (bad data)');
626
+ }
627
+ elsif ($headerId != 0x0001) {
628
+ $newExtraField .= substr($extraField, 0, 4 + $dataSize);
629
+ $extraField = substr($extraField, 4 + $dataSize);
630
+ }
631
+ else {
632
+ $zip64Data = substr($extraField, 4, $dataSize);
633
+ $extraField = substr($extraField, 4 + $dataSize);
634
+ }
635
+ }
636
+ if (length($extraField) != 0) {
637
+ return _formatError('invalid extra field (bad header ID or data size)');
638
+ }
639
+
640
+ my $zip64 = 0;
641
+ if (defined($zip64Data)) {
642
+ return _zip64NotSupported() unless ZIP64_SUPPORTED;
643
+
644
+ my $dataLength = length($zip64Data);
645
+
646
+ # Try to be tolerant with respect to the fields to be
647
+ # extracted from the zip64 extended information extra
648
+ # field and derive that information from the data itself,
649
+ # if possible. This works around, for example, incorrect
650
+ # extra fields written by certain versions of package
651
+ # IO::Compress::Zip. That package provides the disk
652
+ # number start in the extra field without setting the
653
+ # corresponding regular field to 0xffff. Plus it
654
+ # provides the full set of fields even for the local file
655
+ # header.
656
+ #
657
+ # Field zero is the extra field string which we must keep
658
+ # in @_ for future modification, so account for that.
659
+ my @fields;
660
+ if (@_ == 3 && $dataLength == 16) {
661
+ @fields = (undef, 0xffffffff, 0xffffffff);
662
+ }
663
+ elsif (@_ == 3 && $dataLength == 24) {
664
+ push(@_, undef);
665
+ @fields = (undef, 0xffffffff, 0xffffffff, 0xffffffff);
666
+ }
667
+ elsif (@_ == 3 && $dataLength == 28) {
668
+ push(@_, undef, undef);
669
+ @fields = (undef, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff);
670
+ }
671
+ elsif (@_ == 5 && $dataLength == 24) {
672
+ @fields = (undef, 0xffffffff, 0xffffffff, 0xffffffff);
673
+ }
674
+ elsif (@_ == 5 && $dataLength == 28) {
675
+ @fields = (undef, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff);
676
+ }
677
+ else {
678
+ @fields = map { defined $_ ? $_ : 0 } @_;
679
+ }
680
+
681
+ my @fieldIndexes = (0);
682
+ my $fieldFormat = '';
683
+ my $expDataLength = 0;
684
+ if ($fields[1] == 0xffffffff) {
685
+ push(@fieldIndexes, 1);
686
+ $fieldFormat .= 'Q< ';
687
+ $expDataLength += 8;
688
+ }
689
+ if ($fields[2] == 0xffffffff) {
690
+ push(@fieldIndexes, 2);
691
+ $fieldFormat .= 'Q< ';
692
+ $expDataLength += 8;
693
+ }
694
+ if (@fields > 3 && $fields[3] == 0xffffffff) {
695
+ push(@fieldIndexes, 3);
696
+ $fieldFormat .= 'Q< ';
697
+ $expDataLength += 8;
698
+ }
699
+ if (@fields > 3 && $fields[4] == 0xffff) {
700
+ push(@fieldIndexes, 4);
701
+ $fieldFormat .= 'L< ';
702
+ $expDataLength += 4;
703
+ }
704
+
705
+ if ($dataLength == $expDataLength) {
706
+ @_[@fieldIndexes] = ($newExtraField, unpack($fieldFormat, $zip64Data));
707
+ $zip64 = 1;
708
+ }
709
+ else {
710
+ return _formatError('invalid zip64 extended information extra field');
711
+ }
712
+ }
713
+
714
+ return (AZ_OK, $zip64);
715
+ }
716
+
570
717
  # The following are used when copying data
571
718
  sub _writeOffset {
572
719
  shift->{'writeOffset'};
@@ -580,7 +727,10 @@ sub writeLocalHeaderRelativeOffset {
580
727
  shift->{'writeLocalHeaderRelativeOffset'};
581
728
  }
582
729
 
583
- sub wasWritten { shift->{'wasWritten'} }
730
+ # Maintained in method Archive::Zip::Archive::writeToFileHandle
731
+ sub wasWritten {
732
+ shift->{'wasWritten'}
733
+ }
584
734
 
585
735
  sub _dataEnded {
586
736
  shift->{'dataEnded'};
@@ -598,31 +748,6 @@ sub _deflater {
598
748
  shift->{'deflater'};
599
749
  }
600
750
 
601
- # Return the total size of my local header
602
- sub _localHeaderSize {
603
- my $self = shift;
604
- {
605
- use bytes;
606
- return SIGNATURE_LENGTH +
607
- LOCAL_FILE_HEADER_LENGTH +
608
- length($self->fileName()) +
609
- length($self->localExtraField());
610
- }
611
- }
612
-
613
- # Return the total size of my CD header
614
- sub _centralDirectoryHeaderSize {
615
- my $self = shift;
616
- {
617
- use bytes;
618
- return SIGNATURE_LENGTH +
619
- CENTRAL_DIRECTORY_FILE_HEADER_LENGTH +
620
- length($self->fileName()) +
621
- length($self->cdExtraField()) +
622
- length($self->fileComment());
623
- }
624
- }
625
-
626
751
  # DOS date/time format
627
752
  # 0-4 (5) Second divided by 2
628
753
  # 5-10 (6) Minute (0-59)
@@ -654,7 +779,7 @@ sub _dosToUnixTime {
654
779
 
655
780
  # Note, this is not exactly UTC 1980, it's 1980 + 12 hours and 1
656
781
  # minute so that nothing timezoney can muck us up.
657
- my $safe_epoch = 31.646060;
782
+ my $safe_epoch = 31.686060;
658
783
 
659
784
  # convert a unix time to DOS date/time
660
785
  # NOT AN OBJECT METHOD!
@@ -679,101 +804,242 @@ sub _unixToDosTime {
679
804
  return $dt;
680
805
  }
681
806
 
682
- sub head {
683
- my ($self, $mode) = (@_, 0);
684
-
685
- use bytes;
686
- return pack LOCAL_FILE_HEADER_FORMAT,
687
- $self->versionNeededToExtract(),
688
- $self->{'bitFlag'},
689
- $self->desiredCompressionMethod(),
690
- $self->lastModFileDateTime(),
691
- $self->hasDataDescriptor()
692
- ? (0,0,0) # crc, compr & uncompr all zero if data descriptor present
693
- : (
694
- $self->crc32(),
695
- $mode
696
- ? $self->_writeOffset() # compressed size
697
- : $self->compressedSize(), # may need to be re-written later
698
- $self->uncompressedSize(),
699
- ),
700
- length($self->fileNameAsBytes()),
701
- length($self->localExtraField());
702
- }
703
-
704
807
  # Write my local header to a file handle.
705
- # Stores the offset to the start of the header in my
706
- # writeLocalHeaderRelativeOffset member.
707
- # Returns AZ_OK on success.
808
+ # Returns a pair (AZ_OK, $headerSize) on success.
708
809
  sub _writeLocalFileHeader {
709
- my $self = shift;
710
- my $fh = shift;
810
+ my $self = shift;
811
+ my $fh = shift;
812
+ my $refresh = @_ ? shift : 0;
813
+
814
+ my $zip64 = $self->zip64();
815
+ my $hasDataDescriptor = $self->hasDataDescriptor();
816
+
817
+ my $versionNeededToExtract = $self->versionNeededToExtract();
818
+ my $crc32;
819
+ my $compressedSize;
820
+ my $uncompressedSize;
821
+ my $localExtraField = $self->localExtraField();
822
+
823
+ if (! $zip64) {
824
+ if ($refresh) {
825
+ $crc32 = $self->crc32();
826
+ $compressedSize = $self->_writeOffset();
827
+ $uncompressedSize = $self->uncompressedSize();
828
+
829
+ # Handle a brain-dead corner case gracefully.
830
+ # Otherwise we a) would always need to write zip64
831
+ # format or b) re-write the complete member data on
832
+ # refresh (which might not always be possible).
833
+ if ($compressedSize > 0xffffffff) {
834
+ return _formatError('compressed size too large for refresh');
835
+ }
836
+ }
837
+ elsif ($hasDataDescriptor) {
838
+ $crc32 = 0;
839
+ $compressedSize = 0;
840
+ $uncompressedSize = 0;
841
+ }
842
+ else {
843
+ $crc32 = $self->crc32();
844
+ $compressedSize = $self->_writeOffset();
845
+ $uncompressedSize = $self->uncompressedSize();
846
+ }
847
+ }
848
+ else {
849
+ return _zip64NotSupported() unless ZIP64_SUPPORTED;
850
+
851
+ $versionNeededToExtract = 45 if ($versionNeededToExtract < 45);
852
+
853
+ my $zip64CompressedSize;
854
+ my $zip64UncompressedSize;
855
+ if ($refresh) {
856
+ $crc32 = $self->crc32();
857
+ $compressedSize = 0xffffffff;
858
+ $uncompressedSize = 0xffffffff;
859
+ $zip64CompressedSize = $self->_writeOffset();
860
+ $zip64UncompressedSize = $self->uncompressedSize();
861
+ }
862
+ elsif ($hasDataDescriptor) {
863
+ $crc32 = 0;
864
+ $compressedSize = 0xffffffff;
865
+ $uncompressedSize = 0xffffffff;
866
+ $zip64CompressedSize = 0;
867
+ $zip64UncompressedSize = 0;
868
+ }
869
+ else {
870
+ $crc32 = $self->crc32();
871
+ $compressedSize = 0xffffffff;
872
+ $uncompressedSize = 0xffffffff;
873
+ $zip64CompressedSize = $self->_writeOffset();
874
+ $zip64UncompressedSize = $self->uncompressedSize();
875
+ }
876
+
877
+ $localExtraField .= pack('S< S< Q< Q<',
878
+ 0x0001, 16,
879
+ $zip64UncompressedSize,
880
+ $zip64CompressedSize);
881
+ }
882
+
883
+ my $fileNameLength = length($self->fileNameAsBytes());
884
+ my $localFieldLength = length($localExtraField);
711
885
 
712
886
  my $signatureData = pack(SIGNATURE_FORMAT, LOCAL_FILE_HEADER_SIGNATURE);
713
887
  $self->_print($fh, $signatureData)
714
888
  or return _ioError("writing local header signature");
715
889
 
716
- my $header = $self->head(1);
717
-
718
- $self->_print($fh, $header) or return _ioError("writing local header");
890
+ my $header =
891
+ pack(LOCAL_FILE_HEADER_FORMAT,
892
+ $versionNeededToExtract,
893
+ $self->{'bitFlag'},
894
+ $self->desiredCompressionMethod(),
895
+ $self->lastModFileDateTime(),
896
+ $crc32,
897
+ $compressedSize,
898
+ $uncompressedSize,
899
+ $fileNameLength,
900
+ $localFieldLength);
901
+ $self->_print($fh, $header)
902
+ or return _ioError("writing local header");
719
903
 
720
- # Check for a valid filename or a filename equal to a literal `0'
721
- if ($self->fileName() || $self->fileName eq '0') {
722
- $self->_print($fh, $self->fileNameAsBytes())
723
- or return _ioError("writing local header filename");
724
- }
725
- if ($self->localExtraField()) {
726
- $self->_print($fh, $self->localExtraField())
727
- or return _ioError("writing local extra field");
904
+ # Write these only if required
905
+ if (! $refresh || $zip64) {
906
+ if ($fileNameLength) {
907
+ $self->_print($fh, $self->fileNameAsBytes())
908
+ or return _ioError("writing local header filename");
909
+ }
910
+ if ($localFieldLength) {
911
+ $self->_print($fh, $localExtraField)
912
+ or return _ioError("writing local extra field");
913
+ }
728
914
  }
729
915
 
730
- return AZ_OK;
916
+ return
917
+ (AZ_OK,
918
+ LOCAL_FILE_HEADER_LENGTH +
919
+ SIGNATURE_LENGTH +
920
+ $fileNameLength +
921
+ $localFieldLength);
731
922
  }
732
923
 
733
- sub _writeCentralDirectoryFileHeader {
924
+ # Re-writes the local file header with new crc32 and compressedSize fields.
925
+ # To be called after writing the data stream.
926
+ # Assumes that filename and extraField sizes didn't change since last written.
927
+ sub _refreshLocalFileHeader {
734
928
  my $self = shift;
735
929
  my $fh = shift;
736
930
 
931
+ my $here = $fh->tell();
932
+ $fh->seek($self->writeLocalHeaderRelativeOffset(), IO::Seekable::SEEK_SET)
933
+ or return _ioError("seeking to rewrite local header");
934
+
935
+ my ($status, undef) = $self->_writeLocalFileHeader($fh, 1);
936
+ return $status if $status != AZ_OK;
937
+
938
+ $fh->seek($here, IO::Seekable::SEEK_SET)
939
+ or return _ioError("seeking after rewrite of local header");
940
+
941
+ return AZ_OK;
942
+ }
943
+
944
+ # Write central directory file header.
945
+ # Returns a pair (AZ_OK, $headerSize) on success.
946
+ sub _writeCentralDirectoryFileHeader {
947
+ my $self = shift;
948
+ my $fh = shift;
949
+ my $adz64m = shift; # $archiveDesiredZip64Mode
950
+
951
+ # (Re-)Determine whether to write zip64 format. Assume
952
+ # {'diskNumberStart'} is always zero.
953
+ my $zip64 = $adz64m == ZIP64_HEADERS
954
+ || $self->desiredZip64Mode() == ZIP64_HEADERS
955
+ || $self->_writeOffset() > 0xffffffff
956
+ || $self->uncompressedSize() > 0xffffffff
957
+ || $self->writeLocalHeaderRelativeOffset() > 0xffffffff;
958
+
959
+ $self->{'zip64'} ||= $zip64;
960
+
961
+ my $versionMadeBy = $self->versionMadeBy();
962
+ my $versionNeededToExtract = $self->versionNeededToExtract();
963
+ my $compressedSize = $self->_writeOffset();
964
+ my $uncompressedSize = $self->uncompressedSize();
965
+ my $localHeaderRelativeOffset = $self->writeLocalHeaderRelativeOffset();
966
+ my $cdExtraField = $self->cdExtraField();
967
+
968
+ if (!$zip64) {
969
+ # no-op
970
+ }
971
+ else {
972
+ return _zip64NotSupported() unless ZIP64_SUPPORTED;
973
+
974
+ $versionNeededToExtract = 45 if ($versionNeededToExtract < 45);
975
+
976
+ my $extraFieldFormat = '';
977
+ my @extraFieldValues = ();
978
+ my $extraFieldSize = 0;
979
+ if ($uncompressedSize > 0xffffffff) {
980
+ $extraFieldFormat .= 'Q< ';
981
+ push(@extraFieldValues, $uncompressedSize);
982
+ $extraFieldSize += 8;
983
+ $uncompressedSize = 0xffffffff;
984
+ }
985
+ if ($compressedSize > 0xffffffff) {
986
+ $extraFieldFormat .= 'Q< ';
987
+ push(@extraFieldValues, $compressedSize);
988
+ $extraFieldSize += 8;
989
+ $compressedSize = 0xffffffff;
990
+ }
991
+ # Avoid empty zip64 extended information extra fields
992
+ if ( $localHeaderRelativeOffset > 0xffffffff
993
+ || @extraFieldValues == 0) {
994
+ $extraFieldFormat .= 'Q< ';
995
+ push(@extraFieldValues, $localHeaderRelativeOffset);
996
+ $extraFieldSize += 8;
997
+ $localHeaderRelativeOffset = 0xffffffff;
998
+ }
999
+
1000
+ $cdExtraField .=
1001
+ pack("S< S< $extraFieldFormat",
1002
+ 0x0001, $extraFieldSize,
1003
+ @extraFieldValues);
1004
+ }
1005
+
1006
+ my $fileNameLength = length($self->fileNameAsBytes());
1007
+ my $extraFieldLength = length($cdExtraField);
1008
+ my $fileCommentLength = length($self->fileComment());
1009
+
737
1010
  my $sigData =
738
1011
  pack(SIGNATURE_FORMAT, CENTRAL_DIRECTORY_FILE_HEADER_SIGNATURE);
739
1012
  $self->_print($fh, $sigData)
740
1013
  or return _ioError("writing central directory header signature");
741
1014
 
742
- my ($fileNameLength, $extraFieldLength, $fileCommentLength);
743
- {
744
- use bytes;
745
- $fileNameLength = length($self->fileNameAsBytes());
746
- $extraFieldLength = length($self->cdExtraField());
747
- $fileCommentLength = length($self->fileComment());
748
- }
749
-
750
1015
  my $header = pack(
751
1016
  CENTRAL_DIRECTORY_FILE_HEADER_FORMAT,
752
- $self->versionMadeBy(),
1017
+ $versionMadeBy,
753
1018
  $self->fileAttributeFormat(),
754
- $self->versionNeededToExtract(),
1019
+ $versionNeededToExtract,
755
1020
  $self->bitFlag(),
756
1021
  $self->desiredCompressionMethod(),
757
1022
  $self->lastModFileDateTime(),
758
1023
  $self->crc32(), # these three fields should have been updated
759
- $self->_writeOffset(), # by writing the data stream out
760
- $self->uncompressedSize(), #
1024
+ $compressedSize, # by writing the data stream out
1025
+ $uncompressedSize, #
761
1026
  $fileNameLength,
762
1027
  $extraFieldLength,
763
1028
  $fileCommentLength,
764
1029
  0, # {'diskNumberStart'},
765
1030
  $self->internalFileAttributes(),
766
1031
  $self->externalFileAttributes(),
767
- $self->writeLocalHeaderRelativeOffset());
1032
+ $localHeaderRelativeOffset);
768
1033
 
769
1034
  $self->_print($fh, $header)
770
1035
  or return _ioError("writing central directory header");
1036
+
771
1037
  if ($fileNameLength) {
772
1038
  $self->_print($fh, $self->fileNameAsBytes())
773
1039
  or return _ioError("writing central directory header signature");
774
1040
  }
775
1041
  if ($extraFieldLength) {
776
- $self->_print($fh, $self->cdExtraField())
1042
+ $self->_print($fh, $cdExtraField)
777
1043
  or return _ioError("writing central directory extra field");
778
1044
  }
779
1045
  if ($fileCommentLength) {
@@ -781,49 +1047,56 @@ sub _writeCentralDirectoryFileHeader {
781
1047
  or return _ioError("writing central directory file comment");
782
1048
  }
783
1049
 
784
- return AZ_OK;
1050
+ # Update object members with information which might have
1051
+ # changed while writing this member. We already did the
1052
+ # zip64 flag. We must not update the extra fields with any
1053
+ # zip64 information, since we consider that internal.
1054
+ $self->{'versionNeededToExtract'} = $versionNeededToExtract;
1055
+ $self->{'compressedSize'} = $self->_writeOffset();
1056
+
1057
+ return
1058
+ (AZ_OK,
1059
+ CENTRAL_DIRECTORY_FILE_HEADER_LENGTH +
1060
+ SIGNATURE_LENGTH +
1061
+ $fileNameLength +
1062
+ $extraFieldLength +
1063
+ $fileCommentLength)
785
1064
  }
786
1065
 
787
1066
  # This writes a data descriptor to the given file handle.
788
1067
  # Assumes that crc32, writeOffset, and uncompressedSize are
789
1068
  # set correctly (they should be after a write).
1069
+ # Returns a pair (AZ_OK, $dataDescriptorSize) on success.
790
1070
  # Further, the local file header should have the
791
1071
  # GPBF_HAS_DATA_DESCRIPTOR_MASK bit set.
792
1072
  sub _writeDataDescriptor {
793
1073
  my $self = shift;
794
1074
  my $fh = shift;
795
- my $header = pack(
796
- SIGNATURE_FORMAT . DATA_DESCRIPTOR_FORMAT,
797
- DATA_DESCRIPTOR_SIGNATURE,
798
- $self->crc32(),
799
- $self->_writeOffset(), # compressed size
800
- $self->uncompressedSize());
801
-
802
- $self->_print($fh, $header)
803
- or return _ioError("writing data descriptor");
804
- return AZ_OK;
805
- }
806
-
807
- # Re-writes the local file header with new crc32 and compressedSize fields.
808
- # To be called after writing the data stream.
809
- # Assumes that filename and extraField sizes didn't change since last written.
810
- sub _refreshLocalFileHeader {
811
- my $self = shift;
812
- my $fh = shift;
813
-
814
- my $here = $fh->tell();
815
- $fh->seek($self->writeLocalHeaderRelativeOffset() + SIGNATURE_LENGTH,
816
- IO::Seekable::SEEK_SET)
817
- or return _ioError("seeking to rewrite local header");
818
1075
 
819
- my $header = $self->head(1);
1076
+ my $descriptor;
1077
+ if (! $self->zip64()) {
1078
+ $descriptor =
1079
+ pack(SIGNATURE_FORMAT . DATA_DESCRIPTOR_FORMAT,
1080
+ DATA_DESCRIPTOR_SIGNATURE,
1081
+ $self->crc32(),
1082
+ $self->_writeOffset(), # compressed size
1083
+ $self->uncompressedSize());
1084
+ }
1085
+ else {
1086
+ return _zip64NotSupported() unless ZIP64_SUPPORTED;
1087
+
1088
+ $descriptor =
1089
+ pack(SIGNATURE_FORMAT . DATA_DESCRIPTOR_ZIP64_FORMAT,
1090
+ DATA_DESCRIPTOR_SIGNATURE,
1091
+ $self->crc32(),
1092
+ $self->_writeOffset(), # compressed size
1093
+ $self->uncompressedSize());
1094
+ }
820
1095
 
821
- $self->_print($fh, $header)
822
- or return _ioError("re-writing local header");
823
- $fh->seek($here, IO::Seekable::SEEK_SET)
824
- or return _ioError("seeking after rewrite of local header");
1096
+ $self->_print($fh, $descriptor)
1097
+ or return _ioError("writing data descriptor");
825
1098
 
826
- return AZ_OK;
1099
+ return (AZ_OK, length($descriptor));
827
1100
  }
828
1101
 
829
1102
  sub readChunk {
@@ -997,16 +1270,27 @@ sub contents {
997
1270
 
998
1271
  if (defined($newContents)) {
999
1272
 
1000
- # change our type and call the subclass contents method.
1273
+ # Change our type and ensure that succeeded to avoid
1274
+ # endless recursion
1001
1275
  $self->_become('Archive::Zip::StringMember');
1002
- return $self->contents(pack('C0a*', $newContents)); # in case of Unicode
1276
+ $self->_ISA('Archive::Zip::StringMember') or
1277
+ return
1278
+ wantarray
1279
+ ? (undef, $self->_error('becoming Archive::Zip::StringMember'))
1280
+ : undef;
1281
+
1282
+ # Now call the subclass contents method
1283
+ my $retval =
1284
+ $self->contents(pack('C0a*', $newContents)); # in case of Unicode
1285
+
1286
+ return wantarray ? ($retval, AZ_OK) : $retval;
1003
1287
  } else {
1004
1288
  my $oldCompression =
1005
1289
  $self->desiredCompressionMethod(COMPRESSION_STORED);
1006
1290
  my $status = $self->rewindData(@_);
1007
1291
  if ($status != AZ_OK) {
1008
1292
  $self->endRead();
1009
- return $status;
1293
+ return wantarray ? (undef, $status) : undef;
1010
1294
  }
1011
1295
  my $retval = '';
1012
1296
  while ($status == AZ_OK) {
@@ -1030,74 +1314,94 @@ sub contents {
1030
1314
 
1031
1315
  sub extractToFileHandle {
1032
1316
  my $self = shift;
1033
- my $fh = (ref($_[0]) eq 'HASH') ? shift->{fileHandle} : shift;
1034
- _binmode($fh);
1317
+ # This can be the link name when "extracting" symbolic links
1318
+ my $fhOrName = (ref($_[0]) eq 'HASH') ? shift->{fileHandle} : shift;
1319
+ _binmode($fhOrName) if ref($fhOrName);
1035
1320
  my $oldCompression = $self->desiredCompressionMethod(COMPRESSION_STORED);
1036
1321
  my $status = $self->rewindData(@_);
1037
- $status = $self->_writeData($fh) if $status == AZ_OK;
1322
+ $status = $self->_writeData($fhOrName) if $status == AZ_OK;
1038
1323
  $self->desiredCompressionMethod($oldCompression);
1039
1324
  $self->endRead();
1040
1325
  return $status;
1041
1326
  }
1042
1327
 
1043
- # write local header and data stream to file handle
1328
+ # write local header and data stream to file handle.
1329
+ # Returns a pair ($status, $memberSize) if successful.
1330
+ # Stores the offset to the start of the header in my
1331
+ # writeLocalHeaderRelativeOffset member.
1044
1332
  sub _writeToFileHandle {
1045
1333
  my $self = shift;
1046
1334
  my $fh = shift;
1047
1335
  my $fhIsSeekable = shift;
1048
1336
  my $offset = shift;
1337
+ my $adz64m = shift; # $archiveDesiredZip64Mode
1049
1338
 
1050
1339
  return _error("no member name given for $self")
1051
1340
  if $self->fileName() eq '';
1052
1341
 
1053
1342
  $self->{'writeLocalHeaderRelativeOffset'} = $offset;
1054
- $self->{'wasWritten'} = 0;
1343
+
1344
+ # Determine if I need to refresh the header in a second pass
1345
+ # later. If in doubt, I'd rather refresh, since it does not
1346
+ # seem to be worth the hassle to save the extra seeks and
1347
+ # writes. In addition, having below condition independent of
1348
+ # any specific compression methods helps me piping through
1349
+ # members with unknown compression methods unchanged. See
1350
+ # test t/26_bzip2.t for details.
1351
+ my $headerFieldsUnknown = $self->uncompressedSize() > 0;
1055
1352
 
1056
1353
  # Determine if I need to write a data descriptor
1057
1354
  # I need to do this if I can't refresh the header
1058
1355
  # and I don't know compressed size or crc32 fields.
1059
- my $headerFieldsUnknown = (
1060
- ($self->uncompressedSize() > 0)
1061
- and ($self->compressionMethod() == COMPRESSION_STORED
1062
- or $self->desiredCompressionMethod() == COMPRESSION_DEFLATED));
1063
-
1064
1356
  my $shouldWriteDataDescriptor =
1065
1357
  ($headerFieldsUnknown and not $fhIsSeekable);
1066
1358
 
1067
1359
  $self->hasDataDescriptor(1)
1068
1360
  if ($shouldWriteDataDescriptor);
1069
1361
 
1362
+ # Determine whether to write zip64 format
1363
+ my $zip64 = $adz64m == ZIP64_HEADERS
1364
+ || $self->desiredZip64Mode() == ZIP64_HEADERS
1365
+ || $self->uncompressedSize() > 0xffffffff;
1366
+
1367
+ $self->{'zip64'} ||= $zip64;
1368
+
1070
1369
  $self->{'writeOffset'} = 0;
1071
1370
 
1072
1371
  my $status = $self->rewindData();
1073
- ($status = $self->_writeLocalFileHeader($fh))
1074
- if $status == AZ_OK;
1075
- ($status = $self->_writeData($fh))
1076
- if $status == AZ_OK;
1077
- if ($status == AZ_OK) {
1078
- $self->{'wasWritten'} = 1;
1079
- if ($self->hasDataDescriptor()) {
1080
- $status = $self->_writeDataDescriptor($fh);
1081
- } elsif ($headerFieldsUnknown) {
1082
- $status = $self->_refreshLocalFileHeader($fh);
1083
- }
1372
+ return $status if $status != AZ_OK;
1373
+
1374
+ my $memberSize;
1375
+ ($status, $memberSize) = $self->_writeLocalFileHeader($fh);
1376
+ return $status if $status != AZ_OK;
1377
+
1378
+ $status = $self->_writeData($fh);
1379
+ return $status if $status != AZ_OK;
1380
+ $memberSize += $self->_writeOffset();
1381
+
1382
+ if ($self->hasDataDescriptor()) {
1383
+ my $ddSize;
1384
+ ($status, $ddSize) = $self->_writeDataDescriptor($fh);
1385
+ $memberSize += $ddSize;
1386
+ } elsif ($headerFieldsUnknown) {
1387
+ $status = $self->_refreshLocalFileHeader($fh);
1084
1388
  }
1389
+ return $status if $status != AZ_OK;
1085
1390
 
1086
- return $status;
1391
+ return ($status, $memberSize);
1087
1392
  }
1088
1393
 
1089
1394
  # Copy my (possibly compressed) data to given file handle.
1090
1395
  # Returns C<AZ_OK> on success
1091
1396
  sub _writeData {
1092
- my $self = shift;
1093
- my $writeFh = shift;
1397
+ my $self = shift;
1398
+ my $fhOrName = shift;
1094
1399
 
1095
- # If symbolic link, just create one if the operating system is Linux, Unix, BSD or VMS
1096
- # TODO: Add checks for other operating systems
1097
- if ($self->{'isSymbolicLink'} == 1 && OS_SUPPORTS_SYMLINK) {
1400
+ if ($self->isSymbolicLink() && OS_SUPPORTS_SYMLINK) {
1098
1401
  my $chunkSize = $Archive::Zip::ChunkSize;
1099
1402
  my ($outRef, $status) = $self->readChunk($chunkSize);
1100
- symlink $$outRef, $self->{'newName'};
1403
+ symlink($$outRef, $fhOrName)
1404
+ or return _ioError("creating symbolic link");
1101
1405
  } else {
1102
1406
  return AZ_OK if ($self->uncompressedSize() == 0);
1103
1407
  my $status;
@@ -1108,7 +1412,7 @@ sub _writeData {
1108
1412
  return $status if ($status != AZ_OK and $status != AZ_STREAM_END);
1109
1413
 
1110
1414
  if (length($$outRef) > 0) {
1111
- $self->_print($writeFh, $$outRef)
1415
+ $self->_print($fhOrName, $$outRef)
1112
1416
  or return _ioError("write error during copy");
1113
1417
  }
1114
1418