react-native-nitro-xlsx 0.2.5 → 0.2.6
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.
- package/NitroXlsx.podspec +26 -27
- package/Package.swift +31 -10
- package/README.md +1 -1
- package/android/CMakeLists.txt +20 -27
- package/package.json +2 -2
- package/scripts/run-cpp-tests.sh +1 -1
- package/thirdparty/OpenXLSX/.clang-format +118 -0
- package/thirdparty/OpenXLSX/.clang-tidy +28 -0
- package/thirdparty/OpenXLSX/.gitignore +130 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_before_XMLNode_wrappers +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespace_and_stripping +49 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespace_char_support +49 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespace_support +49 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespaced_name_disabled +49 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-08-11-benchmarks_post-XLCellIterator-Rework +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-08-14-benchmarks_post-default-row-column-style-support +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-09-02-benchmarks +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-12-19-benchmarks +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-12-30-benchmarks-post-XLSharedStrings-by-ref +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-01-09-benchmarks-post-conditionalFormatsAndSheetProtection +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-01-10-benchmarks-post-XLCellValue-bugfix +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-01-31-benchmarks-post-XLComments-implementation +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-02-02-benchmarks-post-XLRowIterator-Rework +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-07-20-benchmarks-after-hiding-pugixml-internals +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-08-29-benchmarks-after-code-review-with-libzip +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/Benchmark.cpp +249 -0
- package/thirdparty/OpenXLSX/Benchmarks/CMakeLists.txt +19 -0
- package/thirdparty/OpenXLSX/CMakeLists.txt +466 -0
- package/thirdparty/OpenXLSX/Documentation/CMakeLists.txt +31 -0
- package/thirdparty/OpenXLSX/Documentation/Doxyfile.in +2471 -0
- package/thirdparty/OpenXLSX/Documentation/DoxygenLayout.xml +194 -0
- package/thirdparty/OpenXLSX/Documentation/customdoxygen.css +1355 -0
- package/thirdparty/OpenXLSX/Examples/CMakeLists.txt +103 -0
- package/thirdparty/OpenXLSX/Examples/Demo1.cpp +279 -0
- package/thirdparty/OpenXLSX/Examples/Demo10.cpp +545 -0
- package/thirdparty/OpenXLSX/Examples/Demo1A.cpp +137 -0
- package/thirdparty/OpenXLSX/Examples/Demo2.cpp +65 -0
- package/thirdparty/OpenXLSX/Examples/Demo3.cpp +89 -0
- package/thirdparty/OpenXLSX/Examples/Demo4.cpp +86 -0
- package/thirdparty/OpenXLSX/Examples/Demo5.cpp +77 -0
- package/thirdparty/OpenXLSX/Examples/Demo6.cpp +103 -0
- package/thirdparty/OpenXLSX/Examples/Demo7.cpp +79 -0
- package/thirdparty/OpenXLSX/Examples/Demo8.cpp +117 -0
- package/thirdparty/OpenXLSX/Examples/Demo9.cpp +363 -0
- package/thirdparty/OpenXLSX/Examples/cmake/FindLIBZIP.cmake +61 -0
- package/thirdparty/OpenXLSX/Examples/external/CustomZip/CustomZip.hpp +256 -0
- package/thirdparty/OpenXLSX/LICENSE.md +29 -0
- package/thirdparty/OpenXLSX/Makefile.GNU +530 -0
- package/thirdparty/OpenXLSX/Notes/TBDs.txt +16 -0
- package/thirdparty/OpenXLSX/Notes/confirmed-TBCs.txt +8 -0
- package/thirdparty/OpenXLSX/Notes/styles-missing-support.xml +12 -0
- package/thirdparty/OpenXLSX/Notes/todo-list.txt +108 -0
- package/thirdparty/OpenXLSX/OpenXLSX/CMakeLists.txt +631 -0
- package/thirdparty/OpenXLSX/OpenXLSX/OpenXLSX.hpp +63 -0
- package/thirdparty/OpenXLSX/OpenXLSX/OpenXLSXConfig.cmake +11 -0
- package/thirdparty/OpenXLSX/OpenXLSX/cmake/bundle_static_library.cmake +198 -0
- package/thirdparty/OpenXLSX/OpenXLSX/cmake/patch_pkg_config.cmake +69 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/IZipArchive.hpp +361 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX-Exports.hpp +12 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCell.hpp +367 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellIterator.hpp +252 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellRange.hpp +223 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellReference.hpp +317 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellValue.hpp +793 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLColor.hpp +232 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLColumn.hpp +159 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCommandQuery.hpp +228 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLComments.hpp +270 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLConstants.hpp +18 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLContentTypes.hpp +264 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLDateTime.hpp +175 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLDocument.hpp +505 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLDrawing.hpp +452 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLException.hpp +161 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLFormula.hpp +375 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLIterator.hpp +40 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLMergeCells.hpp +216 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLProperties.hpp +348 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLRelationships.hpp +348 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLRow.hpp +721 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLRowData.hpp +488 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLSharedStrings.hpp +204 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLSheet.hpp +1640 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLStyles.hpp +2390 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLTables.hpp +132 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLWorkbook.hpp +404 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlData.hpp +283 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlFile.hpp +194 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlParser.hpp +282 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlParserForwardDeclarations.hpp +85 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLZipArchive.hpp +232 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/detail/LibZip.hpp +447 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/detail/OpenXLSXFileSystemTools.hpp +207 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/detail/Zippy.hpp +1375 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCell.cpp +340 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellIterator.cpp +427 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellRange.cpp +221 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellReference.cpp +408 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellValue.cpp +519 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLColor.cpp +202 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLColumn.cpp +141 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLComments.cpp +637 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLContentTypes.cpp +329 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLDateTime.cpp +269 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLDocument.cpp +1678 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLDrawing.cpp +784 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLFormula.cpp +201 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLMergeCells.cpp +357 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLProperties.cpp +810 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLRelationships.cpp +529 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLRow.cpp +918 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLRowData.cpp +508 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLSharedStrings.cpp +220 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLSheet.cpp +1970 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLStyles.cpp +3014 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLTables.cpp +125 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLWorkbook.cpp +784 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLXmlData.cpp +247 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLXmlFile.cpp +160 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLXmlParser.cpp +261 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLZipArchive.cpp +266 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/utilities/XLUtilities.hpp +478 -0
- package/thirdparty/OpenXLSX/README.md +1279 -0
- package/thirdparty/OpenXLSX/Scripts/cmake-cleanup.sh +102 -0
- package/thirdparty/OpenXLSX/Scripts/compile.sh +23 -0
- package/thirdparty/OpenXLSX/Scripts/demos-cleanup.sh +25 -0
- package/thirdparty/OpenXLSX/Scripts/demos-run-all.sh +60 -0
- package/thirdparty/OpenXLSX/Scripts/guarded-xml-format.sh +47 -0
- package/thirdparty/OpenXLSX/Scripts/make-gnu.sh +11 -0
- package/thirdparty/OpenXLSX/Scripts/uninstall-manifest.sh +48 -0
- package/thirdparty/OpenXLSX/Scripts/xml-format-all.sh +19 -0
- package/thirdparty/OpenXLSX/Scripts/xml-format.sh +38 -0
- package/thirdparty/OpenXLSX/Tests/CMakeLists.txt +37 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch.hpp +17799 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_automake.hpp +68 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_sonarqube.hpp +182 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_tap.hpp +278 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_teamcity.hpp +212 -0
- package/thirdparty/OpenXLSX/Tests/main.cpp +55 -0
- package/thirdparty/OpenXLSX/Tests/testXLCell.cpp +176 -0
- package/thirdparty/OpenXLSX/Tests/testXLCellRange.cpp +180 -0
- package/thirdparty/OpenXLSX/Tests/testXLCellReference.cpp +160 -0
- package/thirdparty/OpenXLSX/Tests/testXLCellValue.cpp +366 -0
- package/thirdparty/OpenXLSX/Tests/testXLCellValueProxy.cpp +255 -0
- package/thirdparty/OpenXLSX/Tests/testXLColor.cpp +75 -0
- package/thirdparty/OpenXLSX/Tests/testXLDateTime.cpp +229 -0
- package/thirdparty/OpenXLSX/Tests/testXLDocument.cpp +197 -0
- package/thirdparty/OpenXLSX/Tests/testXLFormula.cpp +131 -0
- package/thirdparty/OpenXLSX/Tests/testXLRow.cpp +597 -0
- package/thirdparty/OpenXLSX/Tests/testXLSheet.cpp +77 -0
- package/thirdparty/OpenXLSX/Tests/ziptest-with-libs.cpp +88 -0
- package/thirdparty/OpenXLSX/Tests/ziptest.cpp +735 -0
- package/thirdparty/OpenXLSX/cmake/get-git-HEAD-ID.cmake +45 -0
- package/thirdparty/OpenXLSX/cmake/libopenxlsxCPackOptions.cmake.in +20 -0
- package/thirdparty/OpenXLSX/cmake/manage_dependency.cmake +813 -0
- package/thirdparty/OpenXLSX/cmake/recursive_library_type_test.cmake +52 -0
- package/thirdparty/OpenXLSX/gnu-make-crutch/OpenXLSX-Exports-shared.hpp +42 -0
- package/thirdparty/OpenXLSX/gnu-make-crutch/OpenXLSX-Exports-static.hpp +42 -0
- package/thirdparty/OpenXLSX/vcpkg.json +24 -0
- package/thirdparty/README.md +42 -0
- package/thirdparty/miniz/.clang-format +47 -0
- package/thirdparty/miniz/.travis.yml +2 -0
- package/thirdparty/miniz/CMakeLists.txt +333 -0
- package/thirdparty/miniz/CMakePresets.json +31 -0
- package/thirdparty/miniz/ChangeLog.md +272 -0
- package/thirdparty/miniz/Config.cmake.in +1 -0
- package/thirdparty/miniz/LICENSE +22 -0
- package/thirdparty/miniz/amalgamate.sh +57 -0
- package/thirdparty/miniz/examples/example1.c +105 -0
- package/thirdparty/miniz/examples/example2.c +164 -0
- package/thirdparty/miniz/examples/example3.c +269 -0
- package/thirdparty/miniz/examples/example4.c +102 -0
- package/thirdparty/miniz/examples/example5.c +327 -0
- package/thirdparty/miniz/examples/example6.c +189 -0
- package/thirdparty/miniz/meson.build +21 -0
- package/thirdparty/miniz/miniz.c +646 -0
- package/thirdparty/miniz/miniz.h +615 -0
- package/thirdparty/miniz/miniz.pc.in +13 -0
- package/thirdparty/miniz/miniz_common.h +89 -0
- package/thirdparty/miniz/miniz_export.h +20 -0
- package/thirdparty/miniz/miniz_tdef.c +1602 -0
- package/thirdparty/miniz/miniz_tdef.h +199 -0
- package/thirdparty/miniz/miniz_tinfl.c +778 -0
- package/thirdparty/miniz/miniz_tinfl.h +150 -0
- package/thirdparty/miniz/miniz_zip.c +4895 -0
- package/thirdparty/miniz/miniz_zip.h +454 -0
- package/thirdparty/miniz/readme.md +46 -0
- package/thirdparty/miniz/test.sh +36 -0
- package/thirdparty/miniz/tests/add_in_place_fuzzer.c +87 -0
- package/thirdparty/miniz/tests/catch_amalgamated.cpp +10795 -0
- package/thirdparty/miniz/tests/catch_amalgamated.hpp +13143 -0
- package/thirdparty/miniz/tests/checksum_fuzzer.c +26 -0
- package/thirdparty/miniz/tests/compress_fuzzer.c +91 -0
- package/thirdparty/miniz/tests/flush_fuzzer.c +88 -0
- package/thirdparty/miniz/tests/fuzz_main.c +55 -0
- package/thirdparty/miniz/tests/large_fuzzer.c +133 -0
- package/thirdparty/miniz/tests/main.cpp +185 -0
- package/thirdparty/miniz/tests/miniz_tdefl_fuzzer.cc +115 -0
- package/thirdparty/miniz/tests/miniz_tester.cpp +1881 -0
- package/thirdparty/miniz/tests/miniz_zip_validate_fuzzer.cc +71 -0
- package/thirdparty/miniz/tests/miniz_zip_writer_fuzzer.cc +96 -0
- package/thirdparty/miniz/tests/ossfuzz.sh +48 -0
- package/thirdparty/miniz/tests/small_fuzzer.c +126 -0
- package/thirdparty/miniz/tests/timer.cpp +152 -0
- package/thirdparty/miniz/tests/timer.h +40 -0
- package/thirdparty/miniz/tests/uncompress2_fuzzer.c +21 -0
- package/thirdparty/miniz/tests/uncompress_fuzzer.c +30 -0
- package/thirdparty/miniz/tests/zip.dict +9 -0
- package/thirdparty/miniz/tests/zip_fuzzer.c +63 -0
- package/thirdparty/pugixml/.codecov.yml +7 -0
- package/thirdparty/pugixml/.gitattributes +1 -0
- package/thirdparty/pugixml/CMakeLists.txt +330 -0
- package/thirdparty/pugixml/LICENSE.md +24 -0
- package/thirdparty/pugixml/Makefile +98 -0
- package/thirdparty/pugixml/README.md +81 -0
- package/thirdparty/pugixml/SECURITY.md +9 -0
- package/thirdparty/pugixml/appveyor.yml +50 -0
- package/thirdparty/pugixml/docs/config.adoc +7 -0
- package/thirdparty/pugixml/docs/images/dom_tree.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_link1.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_link2.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_pch1.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_pch2.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_pch3.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_pch4.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2010_link1.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2010_link2.png +0 -0
- package/thirdparty/pugixml/docs/manual.adoc +3326 -0
- package/thirdparty/pugixml/docs/manual.html +6395 -0
- package/thirdparty/pugixml/docs/quickstart.adoc +287 -0
- package/thirdparty/pugixml/docs/quickstart.html +1107 -0
- package/thirdparty/pugixml/docs/samples/character.xml +8 -0
- package/thirdparty/pugixml/docs/samples/custom_memory_management.cpp +27 -0
- package/thirdparty/pugixml/docs/samples/include.cpp +64 -0
- package/thirdparty/pugixml/docs/samples/load_error_handling.cpp +33 -0
- package/thirdparty/pugixml/docs/samples/load_file.cpp +16 -0
- package/thirdparty/pugixml/docs/samples/load_memory.cpp +66 -0
- package/thirdparty/pugixml/docs/samples/load_options.cpp +30 -0
- package/thirdparty/pugixml/docs/samples/load_stream.cpp +97 -0
- package/thirdparty/pugixml/docs/samples/modify_add.cpp +29 -0
- package/thirdparty/pugixml/docs/samples/modify_base.cpp +43 -0
- package/thirdparty/pugixml/docs/samples/modify_remove.cpp +27 -0
- package/thirdparty/pugixml/docs/samples/save_custom_writer.cpp +116 -0
- package/thirdparty/pugixml/docs/samples/save_declaration.cpp +27 -0
- package/thirdparty/pugixml/docs/samples/save_file.cpp +17 -0
- package/thirdparty/pugixml/docs/samples/save_options.cpp +48 -0
- package/thirdparty/pugixml/docs/samples/save_stream.cpp +18 -0
- package/thirdparty/pugixml/docs/samples/save_subtree.cpp +26 -0
- package/thirdparty/pugixml/docs/samples/text.cpp +35 -0
- package/thirdparty/pugixml/docs/samples/transitions.xml +7 -0
- package/thirdparty/pugixml/docs/samples/traverse_base.cpp +51 -0
- package/thirdparty/pugixml/docs/samples/traverse_iter.cpp +27 -0
- package/thirdparty/pugixml/docs/samples/traverse_predicate.cpp +48 -0
- package/thirdparty/pugixml/docs/samples/traverse_rangefor.cpp +32 -0
- package/thirdparty/pugixml/docs/samples/traverse_walker.cpp +35 -0
- package/thirdparty/pugixml/docs/samples/tree.xml +12 -0
- package/thirdparty/pugixml/docs/samples/weekly-shift_jis.xml +78 -0
- package/thirdparty/pugixml/docs/samples/weekly-utf-16.xml +0 -0
- package/thirdparty/pugixml/docs/samples/weekly-utf-8.xml +78 -0
- package/thirdparty/pugixml/docs/samples/xgconsole.xml +12 -0
- package/thirdparty/pugixml/docs/samples/xpath_error.cpp +43 -0
- package/thirdparty/pugixml/docs/samples/xpath_query.cpp +36 -0
- package/thirdparty/pugixml/docs/samples/xpath_select.cpp +28 -0
- package/thirdparty/pugixml/docs/samples/xpath_variables.cpp +38 -0
- package/thirdparty/pugixml/readme.txt +50 -0
- package/thirdparty/pugixml/scripts/archive.py +54 -0
- package/thirdparty/pugixml/scripts/cocoapods_push.sh +4 -0
- package/thirdparty/pugixml/scripts/natvis/pugixml.natvis +77 -0
- package/thirdparty/pugixml/scripts/natvis/pugixml_compact.natvis +506 -0
- package/thirdparty/pugixml/scripts/nuget/build/native/pugixml-propertiesui.xml +17 -0
- package/thirdparty/pugixml/scripts/nuget/build/native/pugixml.targets +28 -0
- package/thirdparty/pugixml/scripts/nuget/pugixml.nuspec +20 -0
- package/thirdparty/pugixml/scripts/nuget_build.ps1 +60 -0
- package/thirdparty/pugixml/scripts/premake4.lua +92 -0
- package/thirdparty/pugixml/scripts/pugixml-config.cmake.in +12 -0
- package/thirdparty/pugixml/scripts/pugixml.pc.in +11 -0
- package/thirdparty/pugixml/scripts/pugixml.podspec +14 -0
- package/thirdparty/pugixml/scripts/pugixml.xcodeproj/project.pbxproj +212 -0
- package/thirdparty/pugixml/scripts/pugixml_airplay.mkf +13 -0
- package/thirdparty/pugixml/scripts/pugixml_codeblocks.cbp +44 -0
- package/thirdparty/pugixml/scripts/pugixml_codelite.project +56 -0
- package/thirdparty/pugixml/scripts/pugixml_dll.rc +45 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2005.vcproj +343 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2005_static.vcproj +343 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2008.vcproj +339 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2008_static.vcproj +339 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2010.vcxproj +191 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2010_static.vcxproj +191 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2013.vcxproj +199 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2013_static.vcxproj +199 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2015.vcxproj +172 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2015_static.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2017.vcxproj +172 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2017_static.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2019.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2019_static.vcxproj +180 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2022.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2022_static.vcxproj +180 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2026.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2026_static.vcxproj +180 -0
- package/thirdparty/pugixml/scripts/sbom.cdx.json +47 -0
- package/thirdparty/pugixml/src/pugiconfig.hpp +81 -0
- package/thirdparty/pugixml/src/pugixml.cpp +13776 -0
- package/thirdparty/pugixml/src/pugixml.hpp +1604 -0
- package/thirdparty/pugixml/tests/allocator.cpp +175 -0
- package/thirdparty/pugixml/tests/allocator.hpp +10 -0
- package/thirdparty/pugixml/tests/autotest-appveyor.ps1 +93 -0
- package/thirdparty/pugixml/tests/cmake-appveyor.ps1 +57 -0
- package/thirdparty/pugixml/tests/data/empty.xml +0 -0
- package/thirdparty/pugixml/tests/data/large.xml +1 -0
- package/thirdparty/pugixml/tests/data/latintest_latin1.xml +1 -0
- package/thirdparty/pugixml/tests/data/latintest_utf8.xml +1 -0
- package/thirdparty/pugixml/tests/data/multiline.xml +3 -0
- package/thirdparty/pugixml/tests/data/small.xml +1 -0
- package/thirdparty/pugixml/tests/data/truncation.xml +19 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_be.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_be_bom.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_be_clean.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_be_nodecl.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_le.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_le_bom.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_le_clean.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_le_nodecl.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_be.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_be_bom.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_be_clean.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_be_nodecl.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_le.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_le_bom.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_le_clean.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_le_nodecl.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf8.xml +87 -0
- package/thirdparty/pugixml/tests/data/utftest_utf8_bom.xml +87 -0
- package/thirdparty/pugixml/tests/data/utftest_utf8_clean.xml +84 -0
- package/thirdparty/pugixml/tests/data/utftest_utf8_nodecl.xml +86 -0
- package/thirdparty/pugixml/tests/data//321/202/320/265/321/201/321/202.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/basic.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/doctype.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/refs.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/types.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/utf16.xml +0 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/utf32.xml +0 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/basic.xpath +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/functions.xpath +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/math.xpath +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/path.xpath +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/predicate.xpath +1 -0
- package/thirdparty/pugixml/tests/fuzz_parse.cpp +14 -0
- package/thirdparty/pugixml/tests/fuzz_parse.dict +72 -0
- package/thirdparty/pugixml/tests/fuzz_setup.sh +11 -0
- package/thirdparty/pugixml/tests/fuzz_xpath.cpp +46 -0
- package/thirdparty/pugixml/tests/fuzz_xpath.dict +72 -0
- package/thirdparty/pugixml/tests/helpers.hpp +114 -0
- package/thirdparty/pugixml/tests/main.cpp +218 -0
- package/thirdparty/pugixml/tests/test.cpp +220 -0
- package/thirdparty/pugixml/tests/test.hpp +175 -0
- package/thirdparty/pugixml/tests/test_compact.cpp +150 -0
- package/thirdparty/pugixml/tests/test_deprecated.cpp +25 -0
- package/thirdparty/pugixml/tests/test_document.cpp +1910 -0
- package/thirdparty/pugixml/tests/test_dom_modify.cpp +2122 -0
- package/thirdparty/pugixml/tests/test_dom_text.cpp +601 -0
- package/thirdparty/pugixml/tests/test_dom_traverse.cpp +1481 -0
- package/thirdparty/pugixml/tests/test_header_guard.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_iosfwd_1.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_iosfwd_2.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_iostream_1.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_iostream_2.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_only_1.cpp +21 -0
- package/thirdparty/pugixml/tests/test_header_only_2.cpp +21 -0
- package/thirdparty/pugixml/tests/test_header_string_1.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_string_2.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_string_iostream.cpp +5 -0
- package/thirdparty/pugixml/tests/test_memory.cpp +303 -0
- package/thirdparty/pugixml/tests/test_parse.cpp +1463 -0
- package/thirdparty/pugixml/tests/test_parse_doctype.cpp +366 -0
- package/thirdparty/pugixml/tests/test_unicode.cpp +152 -0
- package/thirdparty/pugixml/tests/test_version.cpp +5 -0
- package/thirdparty/pugixml/tests/test_write.cpp +757 -0
- package/thirdparty/pugixml/tests/test_xpath.cpp +833 -0
- package/thirdparty/pugixml/tests/test_xpath_api.cpp +646 -0
- package/thirdparty/pugixml/tests/test_xpath_functions.cpp +844 -0
- package/thirdparty/pugixml/tests/test_xpath_operators.cpp +566 -0
- package/thirdparty/pugixml/tests/test_xpath_parse.cpp +428 -0
- package/thirdparty/pugixml/tests/test_xpath_paths.cpp +787 -0
- package/thirdparty/pugixml/tests/test_xpath_paths_abbrev_w3c.cpp +219 -0
- package/thirdparty/pugixml/tests/test_xpath_paths_w3c.cpp +312 -0
- package/thirdparty/pugixml/tests/test_xpath_variables.cpp +683 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_1.cpp +411 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_2.cpp +417 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_3.cpp +321 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_4.cpp +300 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_5.cpp +295 -0
- package/thirdparty/pugixml/tests/writer_string.cpp +79 -0
- package/thirdparty/pugixml/tests/writer_string.hpp +27 -0
- package/scripts/prepare-openxlsx.js +0 -126
|
@@ -0,0 +1,778 @@
|
|
|
1
|
+
/**************************************************************************
|
|
2
|
+
*
|
|
3
|
+
* Copyright 2013-2014 RAD Game Tools and Valve Software
|
|
4
|
+
* Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC
|
|
5
|
+
* All Rights Reserved.
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in
|
|
15
|
+
* all copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
* THE SOFTWARE.
|
|
24
|
+
*
|
|
25
|
+
**************************************************************************/
|
|
26
|
+
|
|
27
|
+
#include "miniz.h"
|
|
28
|
+
|
|
29
|
+
#ifndef MINIZ_NO_INFLATE_APIS
|
|
30
|
+
|
|
31
|
+
#ifdef __cplusplus
|
|
32
|
+
extern "C"
|
|
33
|
+
{
|
|
34
|
+
#endif
|
|
35
|
+
|
|
36
|
+
/* ------------------- Low-level Decompression (completely independent from all compression API's) */
|
|
37
|
+
|
|
38
|
+
#define TINFL_MEMCPY(d, s, l) memcpy(d, s, l)
|
|
39
|
+
#define TINFL_MEMSET(p, c, l) memset(p, c, l)
|
|
40
|
+
|
|
41
|
+
#define TINFL_CR_BEGIN \
|
|
42
|
+
switch (r->m_state) \
|
|
43
|
+
{ \
|
|
44
|
+
case 0:
|
|
45
|
+
#define TINFL_CR_RETURN(state_index, result) \
|
|
46
|
+
do \
|
|
47
|
+
{ \
|
|
48
|
+
status = result; \
|
|
49
|
+
r->m_state = state_index; \
|
|
50
|
+
goto common_exit; \
|
|
51
|
+
case state_index:; \
|
|
52
|
+
} \
|
|
53
|
+
MZ_MACRO_END
|
|
54
|
+
#define TINFL_CR_RETURN_FOREVER(state_index, result) \
|
|
55
|
+
do \
|
|
56
|
+
{ \
|
|
57
|
+
for (;;) \
|
|
58
|
+
{ \
|
|
59
|
+
TINFL_CR_RETURN(state_index, result); \
|
|
60
|
+
} \
|
|
61
|
+
} \
|
|
62
|
+
MZ_MACRO_END
|
|
63
|
+
#define TINFL_CR_FINISH }
|
|
64
|
+
|
|
65
|
+
#define TINFL_GET_BYTE(state_index, c) \
|
|
66
|
+
do \
|
|
67
|
+
{ \
|
|
68
|
+
while (pIn_buf_cur >= pIn_buf_end) \
|
|
69
|
+
{ \
|
|
70
|
+
TINFL_CR_RETURN(state_index, (decomp_flags & TINFL_FLAG_HAS_MORE_INPUT) ? TINFL_STATUS_NEEDS_MORE_INPUT : TINFL_STATUS_FAILED_CANNOT_MAKE_PROGRESS); \
|
|
71
|
+
} \
|
|
72
|
+
c = *pIn_buf_cur++; \
|
|
73
|
+
} \
|
|
74
|
+
MZ_MACRO_END
|
|
75
|
+
|
|
76
|
+
#define TINFL_NEED_BITS(state_index, n) \
|
|
77
|
+
do \
|
|
78
|
+
{ \
|
|
79
|
+
mz_uint c; \
|
|
80
|
+
TINFL_GET_BYTE(state_index, c); \
|
|
81
|
+
bit_buf |= (((tinfl_bit_buf_t)c) << num_bits); \
|
|
82
|
+
num_bits += 8; \
|
|
83
|
+
} while (num_bits < (mz_uint)(n))
|
|
84
|
+
#define TINFL_SKIP_BITS(state_index, n) \
|
|
85
|
+
do \
|
|
86
|
+
{ \
|
|
87
|
+
if (num_bits < (mz_uint)(n)) \
|
|
88
|
+
{ \
|
|
89
|
+
TINFL_NEED_BITS(state_index, n); \
|
|
90
|
+
} \
|
|
91
|
+
bit_buf >>= (n); \
|
|
92
|
+
num_bits -= (n); \
|
|
93
|
+
} \
|
|
94
|
+
MZ_MACRO_END
|
|
95
|
+
#define TINFL_GET_BITS(state_index, b, n) \
|
|
96
|
+
do \
|
|
97
|
+
{ \
|
|
98
|
+
if (num_bits < (mz_uint)(n)) \
|
|
99
|
+
{ \
|
|
100
|
+
TINFL_NEED_BITS(state_index, n); \
|
|
101
|
+
} \
|
|
102
|
+
b = bit_buf & ((1 << (n)) - 1); \
|
|
103
|
+
bit_buf >>= (n); \
|
|
104
|
+
num_bits -= (n); \
|
|
105
|
+
} \
|
|
106
|
+
MZ_MACRO_END
|
|
107
|
+
|
|
108
|
+
/* TINFL_HUFF_BITBUF_FILL() is only used rarely, when the number of bytes remaining in the input buffer falls below 2. */
|
|
109
|
+
/* It reads just enough bytes from the input stream that are needed to decode the next Huffman code (and absolutely no more). It works by trying to fully decode a */
|
|
110
|
+
/* Huffman code by using whatever bits are currently present in the bit buffer. If this fails, it reads another byte, and tries again until it succeeds or until the */
|
|
111
|
+
/* bit buffer contains >=15 bits (deflate's max. Huffman code size). */
|
|
112
|
+
#define TINFL_HUFF_BITBUF_FILL(state_index, pLookUp, pTree) \
|
|
113
|
+
do \
|
|
114
|
+
{ \
|
|
115
|
+
temp = pLookUp[bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]; \
|
|
116
|
+
if (temp >= 0) \
|
|
117
|
+
{ \
|
|
118
|
+
code_len = temp >> 9; \
|
|
119
|
+
if ((code_len) && (num_bits >= code_len)) \
|
|
120
|
+
break; \
|
|
121
|
+
} \
|
|
122
|
+
else if (num_bits > TINFL_FAST_LOOKUP_BITS) \
|
|
123
|
+
{ \
|
|
124
|
+
code_len = TINFL_FAST_LOOKUP_BITS; \
|
|
125
|
+
do \
|
|
126
|
+
{ \
|
|
127
|
+
temp = pTree[~temp + ((bit_buf >> code_len++) & 1)]; \
|
|
128
|
+
} while ((temp < 0) && (num_bits >= (code_len + 1))); \
|
|
129
|
+
if (temp >= 0) \
|
|
130
|
+
break; \
|
|
131
|
+
} \
|
|
132
|
+
TINFL_GET_BYTE(state_index, c); \
|
|
133
|
+
bit_buf |= (((tinfl_bit_buf_t)c) << num_bits); \
|
|
134
|
+
num_bits += 8; \
|
|
135
|
+
} while (num_bits < 15);
|
|
136
|
+
|
|
137
|
+
/* TINFL_HUFF_DECODE() decodes the next Huffman coded symbol. It's more complex than you would initially expect because the zlib API expects the decompressor to never read */
|
|
138
|
+
/* beyond the final byte of the deflate stream. (In other words, when this macro wants to read another byte from the input, it REALLY needs another byte in order to fully */
|
|
139
|
+
/* decode the next Huffman code.) Handling this properly is particularly important on raw deflate (non-zlib) streams, which aren't followed by a byte aligned adler-32. */
|
|
140
|
+
/* The slow path is only executed at the very end of the input buffer. */
|
|
141
|
+
/* v1.16: The original macro handled the case at the very end of the passed-in input buffer, but we also need to handle the case where the user passes in 1+zillion bytes */
|
|
142
|
+
/* following the deflate data and our non-conservative read-ahead path won't kick in here on this code. This is much trickier. */
|
|
143
|
+
#define TINFL_HUFF_DECODE(state_index, sym, pLookUp, pTree) \
|
|
144
|
+
do \
|
|
145
|
+
{ \
|
|
146
|
+
int temp; \
|
|
147
|
+
mz_uint code_len, c; \
|
|
148
|
+
if (num_bits < 15) \
|
|
149
|
+
{ \
|
|
150
|
+
if ((pIn_buf_end - pIn_buf_cur) < 2) \
|
|
151
|
+
{ \
|
|
152
|
+
TINFL_HUFF_BITBUF_FILL(state_index, pLookUp, pTree); \
|
|
153
|
+
} \
|
|
154
|
+
else \
|
|
155
|
+
{ \
|
|
156
|
+
bit_buf |= (((tinfl_bit_buf_t)pIn_buf_cur[0]) << num_bits) | (((tinfl_bit_buf_t)pIn_buf_cur[1]) << (num_bits + 8)); \
|
|
157
|
+
pIn_buf_cur += 2; \
|
|
158
|
+
num_bits += 16; \
|
|
159
|
+
} \
|
|
160
|
+
} \
|
|
161
|
+
if ((temp = pLookUp[bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]) >= 0) \
|
|
162
|
+
code_len = temp >> 9, temp &= 511; \
|
|
163
|
+
else \
|
|
164
|
+
{ \
|
|
165
|
+
code_len = TINFL_FAST_LOOKUP_BITS; \
|
|
166
|
+
do \
|
|
167
|
+
{ \
|
|
168
|
+
temp = pTree[~temp + ((bit_buf >> code_len++) & 1)]; \
|
|
169
|
+
} while (temp < 0); \
|
|
170
|
+
} \
|
|
171
|
+
sym = temp; \
|
|
172
|
+
bit_buf >>= code_len; \
|
|
173
|
+
num_bits -= code_len; \
|
|
174
|
+
} \
|
|
175
|
+
MZ_MACRO_END
|
|
176
|
+
|
|
177
|
+
static void tinfl_clear_tree(tinfl_decompressor *r)
|
|
178
|
+
{
|
|
179
|
+
if (r->m_type == 0)
|
|
180
|
+
MZ_CLEAR_ARR(r->m_tree_0);
|
|
181
|
+
else if (r->m_type == 1)
|
|
182
|
+
MZ_CLEAR_ARR(r->m_tree_1);
|
|
183
|
+
else
|
|
184
|
+
MZ_CLEAR_ARR(r->m_tree_2);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
tinfl_status tinfl_decompress(tinfl_decompressor *r, const mz_uint8 *pIn_buf_next, size_t *pIn_buf_size, mz_uint8 *pOut_buf_start, mz_uint8 *pOut_buf_next, size_t *pOut_buf_size, const mz_uint32 decomp_flags)
|
|
188
|
+
{
|
|
189
|
+
static const mz_uint16 s_length_base[31] = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 };
|
|
190
|
+
static const mz_uint8 s_length_extra[31] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0 };
|
|
191
|
+
static const mz_uint16 s_dist_base[32] = { 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0 };
|
|
192
|
+
static const mz_uint8 s_dist_extra[32] = { 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13 };
|
|
193
|
+
static const mz_uint8 s_length_dezigzag[19] = { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 };
|
|
194
|
+
static const mz_uint16 s_min_table_sizes[3] = { 257, 1, 4 };
|
|
195
|
+
|
|
196
|
+
mz_int16 *pTrees[3];
|
|
197
|
+
mz_uint8 *pCode_sizes[3];
|
|
198
|
+
|
|
199
|
+
tinfl_status status = TINFL_STATUS_FAILED;
|
|
200
|
+
mz_uint32 num_bits, dist, counter, num_extra;
|
|
201
|
+
tinfl_bit_buf_t bit_buf;
|
|
202
|
+
const mz_uint8 *pIn_buf_cur = pIn_buf_next, *const pIn_buf_end = pIn_buf_next + *pIn_buf_size;
|
|
203
|
+
mz_uint8 *pOut_buf_cur = pOut_buf_next, *const pOut_buf_end = pOut_buf_next ? pOut_buf_next + *pOut_buf_size : NULL;
|
|
204
|
+
size_t out_buf_size_mask = (decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF) ? (size_t)-1 : ((pOut_buf_next - pOut_buf_start) + *pOut_buf_size) - 1, dist_from_out_buf_start;
|
|
205
|
+
|
|
206
|
+
/* Ensure the output buffer's size is a power of 2, unless the output buffer is large enough to hold the entire output file (in which case it doesn't matter). */
|
|
207
|
+
if (((out_buf_size_mask + 1) & out_buf_size_mask) || (pOut_buf_next < pOut_buf_start))
|
|
208
|
+
{
|
|
209
|
+
*pIn_buf_size = *pOut_buf_size = 0;
|
|
210
|
+
return TINFL_STATUS_BAD_PARAM;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
pTrees[0] = r->m_tree_0;
|
|
214
|
+
pTrees[1] = r->m_tree_1;
|
|
215
|
+
pTrees[2] = r->m_tree_2;
|
|
216
|
+
pCode_sizes[0] = r->m_code_size_0;
|
|
217
|
+
pCode_sizes[1] = r->m_code_size_1;
|
|
218
|
+
pCode_sizes[2] = r->m_code_size_2;
|
|
219
|
+
|
|
220
|
+
num_bits = r->m_num_bits;
|
|
221
|
+
bit_buf = r->m_bit_buf;
|
|
222
|
+
dist = r->m_dist;
|
|
223
|
+
counter = r->m_counter;
|
|
224
|
+
num_extra = r->m_num_extra;
|
|
225
|
+
dist_from_out_buf_start = r->m_dist_from_out_buf_start;
|
|
226
|
+
TINFL_CR_BEGIN
|
|
227
|
+
|
|
228
|
+
bit_buf = num_bits = dist = counter = num_extra = r->m_zhdr0 = r->m_zhdr1 = 0;
|
|
229
|
+
r->m_z_adler32 = r->m_check_adler32 = 1;
|
|
230
|
+
if (decomp_flags & TINFL_FLAG_PARSE_ZLIB_HEADER)
|
|
231
|
+
{
|
|
232
|
+
TINFL_GET_BYTE(1, r->m_zhdr0);
|
|
233
|
+
TINFL_GET_BYTE(2, r->m_zhdr1);
|
|
234
|
+
counter = (((r->m_zhdr0 * 256 + r->m_zhdr1) % 31 != 0) || (r->m_zhdr1 & 32) || ((r->m_zhdr0 & 15) != 8));
|
|
235
|
+
if (!(decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF))
|
|
236
|
+
counter |= (((1U << (8U + (r->m_zhdr0 >> 4))) > 32768U) || ((out_buf_size_mask + 1) < (size_t)((size_t)1 << (8U + (r->m_zhdr0 >> 4)))));
|
|
237
|
+
if (counter)
|
|
238
|
+
{
|
|
239
|
+
TINFL_CR_RETURN_FOREVER(36, TINFL_STATUS_FAILED);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
do
|
|
244
|
+
{
|
|
245
|
+
TINFL_GET_BITS(3, r->m_final, 3);
|
|
246
|
+
r->m_type = r->m_final >> 1;
|
|
247
|
+
if (r->m_type == 0)
|
|
248
|
+
{
|
|
249
|
+
TINFL_SKIP_BITS(5, num_bits & 7);
|
|
250
|
+
for (counter = 0; counter < 4; ++counter)
|
|
251
|
+
{
|
|
252
|
+
if (num_bits)
|
|
253
|
+
TINFL_GET_BITS(6, r->m_raw_header[counter], 8);
|
|
254
|
+
else
|
|
255
|
+
TINFL_GET_BYTE(7, r->m_raw_header[counter]);
|
|
256
|
+
}
|
|
257
|
+
if ((counter = (r->m_raw_header[0] | (r->m_raw_header[1] << 8))) != (mz_uint)(0xFFFF ^ (r->m_raw_header[2] | (r->m_raw_header[3] << 8))))
|
|
258
|
+
{
|
|
259
|
+
TINFL_CR_RETURN_FOREVER(39, TINFL_STATUS_FAILED);
|
|
260
|
+
}
|
|
261
|
+
while ((counter) && (num_bits))
|
|
262
|
+
{
|
|
263
|
+
TINFL_GET_BITS(51, dist, 8);
|
|
264
|
+
while (pOut_buf_cur >= pOut_buf_end)
|
|
265
|
+
{
|
|
266
|
+
TINFL_CR_RETURN(52, TINFL_STATUS_HAS_MORE_OUTPUT);
|
|
267
|
+
}
|
|
268
|
+
*pOut_buf_cur++ = (mz_uint8)dist;
|
|
269
|
+
counter--;
|
|
270
|
+
}
|
|
271
|
+
while (counter)
|
|
272
|
+
{
|
|
273
|
+
size_t n;
|
|
274
|
+
while (pOut_buf_cur >= pOut_buf_end)
|
|
275
|
+
{
|
|
276
|
+
TINFL_CR_RETURN(9, TINFL_STATUS_HAS_MORE_OUTPUT);
|
|
277
|
+
}
|
|
278
|
+
while (pIn_buf_cur >= pIn_buf_end)
|
|
279
|
+
{
|
|
280
|
+
TINFL_CR_RETURN(38, (decomp_flags & TINFL_FLAG_HAS_MORE_INPUT) ? TINFL_STATUS_NEEDS_MORE_INPUT : TINFL_STATUS_FAILED_CANNOT_MAKE_PROGRESS);
|
|
281
|
+
}
|
|
282
|
+
n = MZ_MIN(MZ_MIN((size_t)(pOut_buf_end - pOut_buf_cur), (size_t)(pIn_buf_end - pIn_buf_cur)), counter);
|
|
283
|
+
TINFL_MEMCPY(pOut_buf_cur, pIn_buf_cur, n);
|
|
284
|
+
pIn_buf_cur += n;
|
|
285
|
+
pOut_buf_cur += n;
|
|
286
|
+
counter -= (mz_uint)n;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
else if (r->m_type == 3)
|
|
290
|
+
{
|
|
291
|
+
TINFL_CR_RETURN_FOREVER(10, TINFL_STATUS_FAILED);
|
|
292
|
+
}
|
|
293
|
+
else
|
|
294
|
+
{
|
|
295
|
+
if (r->m_type == 1)
|
|
296
|
+
{
|
|
297
|
+
mz_uint8 *p = r->m_code_size_0;
|
|
298
|
+
mz_uint i;
|
|
299
|
+
r->m_table_sizes[0] = 288;
|
|
300
|
+
r->m_table_sizes[1] = 32;
|
|
301
|
+
TINFL_MEMSET(r->m_code_size_1, 5, 32);
|
|
302
|
+
for (i = 0; i <= 143; ++i)
|
|
303
|
+
*p++ = 8;
|
|
304
|
+
for (; i <= 255; ++i)
|
|
305
|
+
*p++ = 9;
|
|
306
|
+
for (; i <= 279; ++i)
|
|
307
|
+
*p++ = 7;
|
|
308
|
+
for (; i <= 287; ++i)
|
|
309
|
+
*p++ = 8;
|
|
310
|
+
}
|
|
311
|
+
else
|
|
312
|
+
{
|
|
313
|
+
for (counter = 0; counter < 3; counter++)
|
|
314
|
+
{
|
|
315
|
+
TINFL_GET_BITS(11, r->m_table_sizes[counter], "\05\05\04"[counter]);
|
|
316
|
+
r->m_table_sizes[counter] += s_min_table_sizes[counter];
|
|
317
|
+
}
|
|
318
|
+
MZ_CLEAR_ARR(r->m_code_size_2);
|
|
319
|
+
for (counter = 0; counter < r->m_table_sizes[2]; counter++)
|
|
320
|
+
{
|
|
321
|
+
mz_uint s;
|
|
322
|
+
TINFL_GET_BITS(14, s, 3);
|
|
323
|
+
r->m_code_size_2[s_length_dezigzag[counter]] = (mz_uint8)s;
|
|
324
|
+
}
|
|
325
|
+
r->m_table_sizes[2] = 19;
|
|
326
|
+
}
|
|
327
|
+
for (; (int)r->m_type >= 0; r->m_type--)
|
|
328
|
+
{
|
|
329
|
+
int tree_next, tree_cur;
|
|
330
|
+
mz_int16 *pLookUp;
|
|
331
|
+
mz_int16 *pTree;
|
|
332
|
+
mz_uint8 *pCode_size;
|
|
333
|
+
mz_uint i, j, used_syms, total, sym_index, next_code[17], total_syms[16];
|
|
334
|
+
pLookUp = r->m_look_up[r->m_type];
|
|
335
|
+
pTree = pTrees[r->m_type];
|
|
336
|
+
pCode_size = pCode_sizes[r->m_type];
|
|
337
|
+
MZ_CLEAR_ARR(total_syms);
|
|
338
|
+
TINFL_MEMSET(pLookUp, 0, sizeof(r->m_look_up[0]));
|
|
339
|
+
tinfl_clear_tree(r);
|
|
340
|
+
for (i = 0; i < r->m_table_sizes[r->m_type]; ++i)
|
|
341
|
+
total_syms[pCode_size[i]]++;
|
|
342
|
+
used_syms = 0, total = 0;
|
|
343
|
+
next_code[0] = next_code[1] = 0;
|
|
344
|
+
for (i = 1; i <= 15; ++i)
|
|
345
|
+
{
|
|
346
|
+
used_syms += total_syms[i];
|
|
347
|
+
next_code[i + 1] = (total = ((total + total_syms[i]) << 1));
|
|
348
|
+
}
|
|
349
|
+
if ((65536 != total) && (used_syms > 1))
|
|
350
|
+
{
|
|
351
|
+
TINFL_CR_RETURN_FOREVER(35, TINFL_STATUS_FAILED);
|
|
352
|
+
}
|
|
353
|
+
for (tree_next = -1, sym_index = 0; sym_index < r->m_table_sizes[r->m_type]; ++sym_index)
|
|
354
|
+
{
|
|
355
|
+
mz_uint rev_code = 0, l, cur_code, code_size = pCode_size[sym_index];
|
|
356
|
+
if (!code_size)
|
|
357
|
+
continue;
|
|
358
|
+
cur_code = next_code[code_size]++;
|
|
359
|
+
for (l = code_size; l > 0; l--, cur_code >>= 1)
|
|
360
|
+
rev_code = (rev_code << 1) | (cur_code & 1);
|
|
361
|
+
if (code_size <= TINFL_FAST_LOOKUP_BITS)
|
|
362
|
+
{
|
|
363
|
+
mz_int16 k = (mz_int16)((code_size << 9) | sym_index);
|
|
364
|
+
while (rev_code < TINFL_FAST_LOOKUP_SIZE)
|
|
365
|
+
{
|
|
366
|
+
pLookUp[rev_code] = k;
|
|
367
|
+
rev_code += (1 << code_size);
|
|
368
|
+
}
|
|
369
|
+
continue;
|
|
370
|
+
}
|
|
371
|
+
if (0 == (tree_cur = pLookUp[rev_code & (TINFL_FAST_LOOKUP_SIZE - 1)]))
|
|
372
|
+
{
|
|
373
|
+
pLookUp[rev_code & (TINFL_FAST_LOOKUP_SIZE - 1)] = (mz_int16)tree_next;
|
|
374
|
+
tree_cur = tree_next;
|
|
375
|
+
tree_next -= 2;
|
|
376
|
+
}
|
|
377
|
+
rev_code >>= (TINFL_FAST_LOOKUP_BITS - 1);
|
|
378
|
+
for (j = code_size; j > (TINFL_FAST_LOOKUP_BITS + 1); j--)
|
|
379
|
+
{
|
|
380
|
+
tree_cur -= ((rev_code >>= 1) & 1);
|
|
381
|
+
if (!pTree[-tree_cur - 1])
|
|
382
|
+
{
|
|
383
|
+
pTree[-tree_cur - 1] = (mz_int16)tree_next;
|
|
384
|
+
tree_cur = tree_next;
|
|
385
|
+
tree_next -= 2;
|
|
386
|
+
}
|
|
387
|
+
else
|
|
388
|
+
tree_cur = pTree[-tree_cur - 1];
|
|
389
|
+
}
|
|
390
|
+
tree_cur -= ((rev_code >>= 1) & 1);
|
|
391
|
+
pTree[-tree_cur - 1] = (mz_int16)sym_index;
|
|
392
|
+
}
|
|
393
|
+
if (r->m_type == 2)
|
|
394
|
+
{
|
|
395
|
+
for (counter = 0; counter < (r->m_table_sizes[0] + r->m_table_sizes[1]);)
|
|
396
|
+
{
|
|
397
|
+
mz_uint s;
|
|
398
|
+
TINFL_HUFF_DECODE(16, dist, r->m_look_up[2], r->m_tree_2);
|
|
399
|
+
if (dist < 16)
|
|
400
|
+
{
|
|
401
|
+
r->m_len_codes[counter++] = (mz_uint8)dist;
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
if ((dist == 16) && (!counter))
|
|
405
|
+
{
|
|
406
|
+
TINFL_CR_RETURN_FOREVER(17, TINFL_STATUS_FAILED);
|
|
407
|
+
}
|
|
408
|
+
num_extra = "\02\03\07"[dist - 16];
|
|
409
|
+
TINFL_GET_BITS(18, s, num_extra);
|
|
410
|
+
s += "\03\03\013"[dist - 16];
|
|
411
|
+
TINFL_MEMSET(r->m_len_codes + counter, (dist == 16) ? r->m_len_codes[counter - 1] : 0, s);
|
|
412
|
+
counter += s;
|
|
413
|
+
}
|
|
414
|
+
if ((r->m_table_sizes[0] + r->m_table_sizes[1]) != counter)
|
|
415
|
+
{
|
|
416
|
+
TINFL_CR_RETURN_FOREVER(21, TINFL_STATUS_FAILED);
|
|
417
|
+
}
|
|
418
|
+
TINFL_MEMCPY(r->m_code_size_0, r->m_len_codes, r->m_table_sizes[0]);
|
|
419
|
+
TINFL_MEMCPY(r->m_code_size_1, r->m_len_codes + r->m_table_sizes[0], r->m_table_sizes[1]);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
for (;;)
|
|
423
|
+
{
|
|
424
|
+
mz_uint8 *pSrc;
|
|
425
|
+
for (;;)
|
|
426
|
+
{
|
|
427
|
+
if (((pIn_buf_end - pIn_buf_cur) < 4) || ((pOut_buf_end - pOut_buf_cur) < 2))
|
|
428
|
+
{
|
|
429
|
+
TINFL_HUFF_DECODE(23, counter, r->m_look_up[0], r->m_tree_0);
|
|
430
|
+
if (counter >= 256)
|
|
431
|
+
break;
|
|
432
|
+
while (pOut_buf_cur >= pOut_buf_end)
|
|
433
|
+
{
|
|
434
|
+
TINFL_CR_RETURN(24, TINFL_STATUS_HAS_MORE_OUTPUT);
|
|
435
|
+
}
|
|
436
|
+
*pOut_buf_cur++ = (mz_uint8)counter;
|
|
437
|
+
}
|
|
438
|
+
else
|
|
439
|
+
{
|
|
440
|
+
int sym2;
|
|
441
|
+
mz_uint code_len;
|
|
442
|
+
#if TINFL_USE_64BIT_BITBUF
|
|
443
|
+
if (num_bits < 30)
|
|
444
|
+
{
|
|
445
|
+
bit_buf |= (((tinfl_bit_buf_t)MZ_READ_LE32(pIn_buf_cur)) << num_bits);
|
|
446
|
+
pIn_buf_cur += 4;
|
|
447
|
+
num_bits += 32;
|
|
448
|
+
}
|
|
449
|
+
#else
|
|
450
|
+
if (num_bits < 15)
|
|
451
|
+
{
|
|
452
|
+
bit_buf |= (((tinfl_bit_buf_t)MZ_READ_LE16(pIn_buf_cur)) << num_bits);
|
|
453
|
+
pIn_buf_cur += 2;
|
|
454
|
+
num_bits += 16;
|
|
455
|
+
}
|
|
456
|
+
#endif
|
|
457
|
+
if ((sym2 = r->m_look_up[0][bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]) >= 0)
|
|
458
|
+
code_len = sym2 >> 9;
|
|
459
|
+
else
|
|
460
|
+
{
|
|
461
|
+
code_len = TINFL_FAST_LOOKUP_BITS;
|
|
462
|
+
do
|
|
463
|
+
{
|
|
464
|
+
sym2 = r->m_tree_0[~sym2 + ((bit_buf >> code_len++) & 1)];
|
|
465
|
+
} while (sym2 < 0);
|
|
466
|
+
}
|
|
467
|
+
counter = sym2;
|
|
468
|
+
bit_buf >>= code_len;
|
|
469
|
+
num_bits -= code_len;
|
|
470
|
+
if (code_len == 0)
|
|
471
|
+
{
|
|
472
|
+
TINFL_CR_RETURN_FOREVER(40, TINFL_STATUS_FAILED);
|
|
473
|
+
}
|
|
474
|
+
if (counter & 256)
|
|
475
|
+
break;
|
|
476
|
+
|
|
477
|
+
#if !TINFL_USE_64BIT_BITBUF
|
|
478
|
+
if (num_bits < 15)
|
|
479
|
+
{
|
|
480
|
+
bit_buf |= (((tinfl_bit_buf_t)MZ_READ_LE16(pIn_buf_cur)) << num_bits);
|
|
481
|
+
pIn_buf_cur += 2;
|
|
482
|
+
num_bits += 16;
|
|
483
|
+
}
|
|
484
|
+
#endif
|
|
485
|
+
if ((sym2 = r->m_look_up[0][bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]) >= 0)
|
|
486
|
+
code_len = sym2 >> 9;
|
|
487
|
+
else
|
|
488
|
+
{
|
|
489
|
+
code_len = TINFL_FAST_LOOKUP_BITS;
|
|
490
|
+
do
|
|
491
|
+
{
|
|
492
|
+
sym2 = r->m_tree_0[~sym2 + ((bit_buf >> code_len++) & 1)];
|
|
493
|
+
} while (sym2 < 0);
|
|
494
|
+
}
|
|
495
|
+
bit_buf >>= code_len;
|
|
496
|
+
num_bits -= code_len;
|
|
497
|
+
if (code_len == 0)
|
|
498
|
+
{
|
|
499
|
+
TINFL_CR_RETURN_FOREVER(54, TINFL_STATUS_FAILED);
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
pOut_buf_cur[0] = (mz_uint8)counter;
|
|
503
|
+
if (sym2 & 256)
|
|
504
|
+
{
|
|
505
|
+
pOut_buf_cur++;
|
|
506
|
+
counter = sym2;
|
|
507
|
+
break;
|
|
508
|
+
}
|
|
509
|
+
pOut_buf_cur[1] = (mz_uint8)sym2;
|
|
510
|
+
pOut_buf_cur += 2;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
if ((counter &= 511) == 256)
|
|
514
|
+
break;
|
|
515
|
+
|
|
516
|
+
num_extra = s_length_extra[counter - 257];
|
|
517
|
+
counter = s_length_base[counter - 257];
|
|
518
|
+
if (num_extra)
|
|
519
|
+
{
|
|
520
|
+
mz_uint extra_bits;
|
|
521
|
+
TINFL_GET_BITS(25, extra_bits, num_extra);
|
|
522
|
+
counter += extra_bits;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
TINFL_HUFF_DECODE(26, dist, r->m_look_up[1], r->m_tree_1);
|
|
526
|
+
num_extra = s_dist_extra[dist];
|
|
527
|
+
dist = s_dist_base[dist];
|
|
528
|
+
if (num_extra)
|
|
529
|
+
{
|
|
530
|
+
mz_uint extra_bits;
|
|
531
|
+
TINFL_GET_BITS(27, extra_bits, num_extra);
|
|
532
|
+
dist += extra_bits;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
dist_from_out_buf_start = pOut_buf_cur - pOut_buf_start;
|
|
536
|
+
if ((dist == 0 || dist > dist_from_out_buf_start || dist_from_out_buf_start == 0) && (decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF))
|
|
537
|
+
{
|
|
538
|
+
TINFL_CR_RETURN_FOREVER(37, TINFL_STATUS_FAILED);
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
pSrc = pOut_buf_start + ((dist_from_out_buf_start - dist) & out_buf_size_mask);
|
|
542
|
+
|
|
543
|
+
if ((MZ_MAX(pOut_buf_cur, pSrc) + counter) > pOut_buf_end)
|
|
544
|
+
{
|
|
545
|
+
while (counter--)
|
|
546
|
+
{
|
|
547
|
+
while (pOut_buf_cur >= pOut_buf_end)
|
|
548
|
+
{
|
|
549
|
+
TINFL_CR_RETURN(53, TINFL_STATUS_HAS_MORE_OUTPUT);
|
|
550
|
+
}
|
|
551
|
+
*pOut_buf_cur++ = pOut_buf_start[(dist_from_out_buf_start++ - dist) & out_buf_size_mask];
|
|
552
|
+
}
|
|
553
|
+
continue;
|
|
554
|
+
}
|
|
555
|
+
#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES
|
|
556
|
+
else if ((counter >= 9) && (counter <= dist))
|
|
557
|
+
{
|
|
558
|
+
const mz_uint8 *pSrc_end = pSrc + (counter & ~7);
|
|
559
|
+
do
|
|
560
|
+
{
|
|
561
|
+
#ifdef MINIZ_UNALIGNED_USE_MEMCPY
|
|
562
|
+
memcpy(pOut_buf_cur, pSrc, sizeof(mz_uint32) * 2);
|
|
563
|
+
#else
|
|
564
|
+
((mz_uint32 *)pOut_buf_cur)[0] = ((const mz_uint32 *)pSrc)[0];
|
|
565
|
+
((mz_uint32 *)pOut_buf_cur)[1] = ((const mz_uint32 *)pSrc)[1];
|
|
566
|
+
#endif
|
|
567
|
+
pOut_buf_cur += 8;
|
|
568
|
+
} while ((pSrc += 8) < pSrc_end);
|
|
569
|
+
if ((counter &= 7) < 3)
|
|
570
|
+
{
|
|
571
|
+
if (counter)
|
|
572
|
+
{
|
|
573
|
+
pOut_buf_cur[0] = pSrc[0];
|
|
574
|
+
if (counter > 1)
|
|
575
|
+
pOut_buf_cur[1] = pSrc[1];
|
|
576
|
+
pOut_buf_cur += counter;
|
|
577
|
+
}
|
|
578
|
+
continue;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
#endif
|
|
582
|
+
while (counter > 2)
|
|
583
|
+
{
|
|
584
|
+
pOut_buf_cur[0] = pSrc[0];
|
|
585
|
+
pOut_buf_cur[1] = pSrc[1];
|
|
586
|
+
pOut_buf_cur[2] = pSrc[2];
|
|
587
|
+
pOut_buf_cur += 3;
|
|
588
|
+
pSrc += 3;
|
|
589
|
+
counter -= 3;
|
|
590
|
+
}
|
|
591
|
+
if (counter > 0)
|
|
592
|
+
{
|
|
593
|
+
pOut_buf_cur[0] = pSrc[0];
|
|
594
|
+
if (counter > 1)
|
|
595
|
+
pOut_buf_cur[1] = pSrc[1];
|
|
596
|
+
pOut_buf_cur += counter;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
} while (!(r->m_final & 1));
|
|
601
|
+
|
|
602
|
+
/* Ensure byte alignment and put back any bytes from the bitbuf if we've looked ahead too far on gzip, or other Deflate streams followed by arbitrary data. */
|
|
603
|
+
/* I'm being super conservative here. A number of simplifications can be made to the byte alignment part, and the Adler32 check shouldn't ever need to worry about reading from the bitbuf now. */
|
|
604
|
+
TINFL_SKIP_BITS(32, num_bits & 7);
|
|
605
|
+
while ((pIn_buf_cur > pIn_buf_next) && (num_bits >= 8))
|
|
606
|
+
{
|
|
607
|
+
--pIn_buf_cur;
|
|
608
|
+
num_bits -= 8;
|
|
609
|
+
}
|
|
610
|
+
bit_buf &= ~(~(tinfl_bit_buf_t)0 << num_bits);
|
|
611
|
+
MZ_ASSERT(!num_bits); /* if this assert fires then we've read beyond the end of non-deflate/zlib streams with following data (such as gzip streams). */
|
|
612
|
+
|
|
613
|
+
if (decomp_flags & TINFL_FLAG_PARSE_ZLIB_HEADER)
|
|
614
|
+
{
|
|
615
|
+
for (counter = 0; counter < 4; ++counter)
|
|
616
|
+
{
|
|
617
|
+
mz_uint s;
|
|
618
|
+
if (num_bits)
|
|
619
|
+
TINFL_GET_BITS(41, s, 8);
|
|
620
|
+
else
|
|
621
|
+
TINFL_GET_BYTE(42, s);
|
|
622
|
+
r->m_z_adler32 = (r->m_z_adler32 << 8) | s;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
TINFL_CR_RETURN_FOREVER(34, TINFL_STATUS_DONE);
|
|
626
|
+
|
|
627
|
+
TINFL_CR_FINISH
|
|
628
|
+
|
|
629
|
+
common_exit:
|
|
630
|
+
/* As long as we aren't telling the caller that we NEED more input to make forward progress: */
|
|
631
|
+
/* Put back any bytes from the bitbuf in case we've looked ahead too far on gzip, or other Deflate streams followed by arbitrary data. */
|
|
632
|
+
/* We need to be very careful here to NOT push back any bytes we definitely know we need to make forward progress, though, or we'll lock the caller up into an inf loop. */
|
|
633
|
+
if ((status != TINFL_STATUS_NEEDS_MORE_INPUT) && (status != TINFL_STATUS_FAILED_CANNOT_MAKE_PROGRESS))
|
|
634
|
+
{
|
|
635
|
+
while ((pIn_buf_cur > pIn_buf_next) && (num_bits >= 8))
|
|
636
|
+
{
|
|
637
|
+
--pIn_buf_cur;
|
|
638
|
+
num_bits -= 8;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
r->m_num_bits = num_bits;
|
|
642
|
+
r->m_bit_buf = bit_buf & ~(~(tinfl_bit_buf_t)0 << num_bits);
|
|
643
|
+
r->m_dist = dist;
|
|
644
|
+
r->m_counter = counter;
|
|
645
|
+
r->m_num_extra = num_extra;
|
|
646
|
+
r->m_dist_from_out_buf_start = dist_from_out_buf_start;
|
|
647
|
+
*pIn_buf_size = pIn_buf_cur - pIn_buf_next;
|
|
648
|
+
*pOut_buf_size = pOut_buf_cur - pOut_buf_next;
|
|
649
|
+
if ((decomp_flags & (TINFL_FLAG_PARSE_ZLIB_HEADER | TINFL_FLAG_COMPUTE_ADLER32)) && (status >= 0))
|
|
650
|
+
{
|
|
651
|
+
const mz_uint8 *ptr = pOut_buf_next;
|
|
652
|
+
size_t buf_len = *pOut_buf_size;
|
|
653
|
+
mz_uint32 i, s1 = r->m_check_adler32 & 0xffff, s2 = r->m_check_adler32 >> 16;
|
|
654
|
+
size_t block_len = buf_len % 5552;
|
|
655
|
+
while (buf_len)
|
|
656
|
+
{
|
|
657
|
+
for (i = 0; i + 7 < block_len; i += 8, ptr += 8)
|
|
658
|
+
{
|
|
659
|
+
s1 += ptr[0], s2 += s1;
|
|
660
|
+
s1 += ptr[1], s2 += s1;
|
|
661
|
+
s1 += ptr[2], s2 += s1;
|
|
662
|
+
s1 += ptr[3], s2 += s1;
|
|
663
|
+
s1 += ptr[4], s2 += s1;
|
|
664
|
+
s1 += ptr[5], s2 += s1;
|
|
665
|
+
s1 += ptr[6], s2 += s1;
|
|
666
|
+
s1 += ptr[7], s2 += s1;
|
|
667
|
+
}
|
|
668
|
+
for (; i < block_len; ++i)
|
|
669
|
+
s1 += *ptr++, s2 += s1;
|
|
670
|
+
s1 %= 65521U, s2 %= 65521U;
|
|
671
|
+
buf_len -= block_len;
|
|
672
|
+
block_len = 5552;
|
|
673
|
+
}
|
|
674
|
+
r->m_check_adler32 = (s2 << 16) + s1;
|
|
675
|
+
if ((status == TINFL_STATUS_DONE) && (decomp_flags & TINFL_FLAG_PARSE_ZLIB_HEADER) && (r->m_check_adler32 != r->m_z_adler32))
|
|
676
|
+
status = TINFL_STATUS_ADLER32_MISMATCH;
|
|
677
|
+
}
|
|
678
|
+
return status;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
/* Higher level helper functions. */
|
|
682
|
+
void *tinfl_decompress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, size_t *pOut_len, int flags)
|
|
683
|
+
{
|
|
684
|
+
tinfl_decompressor decomp;
|
|
685
|
+
void *pBuf = NULL, *pNew_buf;
|
|
686
|
+
size_t src_buf_ofs = 0, out_buf_capacity = 0;
|
|
687
|
+
*pOut_len = 0;
|
|
688
|
+
tinfl_init(&decomp);
|
|
689
|
+
for (;;)
|
|
690
|
+
{
|
|
691
|
+
size_t src_buf_size = src_buf_len - src_buf_ofs, dst_buf_size = out_buf_capacity - *pOut_len, new_out_buf_capacity;
|
|
692
|
+
tinfl_status status = tinfl_decompress(&decomp, (const mz_uint8 *)pSrc_buf + src_buf_ofs, &src_buf_size, (mz_uint8 *)pBuf, pBuf ? (mz_uint8 *)pBuf + *pOut_len : NULL, &dst_buf_size,
|
|
693
|
+
(flags & ~TINFL_FLAG_HAS_MORE_INPUT) | TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF);
|
|
694
|
+
if ((status < 0) || (status == TINFL_STATUS_NEEDS_MORE_INPUT))
|
|
695
|
+
{
|
|
696
|
+
MZ_FREE(pBuf);
|
|
697
|
+
*pOut_len = 0;
|
|
698
|
+
return NULL;
|
|
699
|
+
}
|
|
700
|
+
src_buf_ofs += src_buf_size;
|
|
701
|
+
*pOut_len += dst_buf_size;
|
|
702
|
+
if (status == TINFL_STATUS_DONE)
|
|
703
|
+
break;
|
|
704
|
+
new_out_buf_capacity = out_buf_capacity * 2;
|
|
705
|
+
if (new_out_buf_capacity < 128)
|
|
706
|
+
new_out_buf_capacity = 128;
|
|
707
|
+
pNew_buf = MZ_REALLOC(pBuf, new_out_buf_capacity);
|
|
708
|
+
if (!pNew_buf)
|
|
709
|
+
{
|
|
710
|
+
MZ_FREE(pBuf);
|
|
711
|
+
*pOut_len = 0;
|
|
712
|
+
return NULL;
|
|
713
|
+
}
|
|
714
|
+
pBuf = pNew_buf;
|
|
715
|
+
out_buf_capacity = new_out_buf_capacity;
|
|
716
|
+
}
|
|
717
|
+
return pBuf;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
size_t tinfl_decompress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags)
|
|
721
|
+
{
|
|
722
|
+
tinfl_decompressor decomp;
|
|
723
|
+
tinfl_status status;
|
|
724
|
+
tinfl_init(&decomp);
|
|
725
|
+
status = tinfl_decompress(&decomp, (const mz_uint8 *)pSrc_buf, &src_buf_len, (mz_uint8 *)pOut_buf, (mz_uint8 *)pOut_buf, &out_buf_len, (flags & ~TINFL_FLAG_HAS_MORE_INPUT) | TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF);
|
|
726
|
+
return (status != TINFL_STATUS_DONE) ? TINFL_DECOMPRESS_MEM_TO_MEM_FAILED : out_buf_len;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
int tinfl_decompress_mem_to_callback(const void *pIn_buf, size_t *pIn_buf_size, tinfl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags)
|
|
730
|
+
{
|
|
731
|
+
int result = 0;
|
|
732
|
+
tinfl_decompressor decomp;
|
|
733
|
+
mz_uint8 *pDict = (mz_uint8 *)MZ_MALLOC(TINFL_LZ_DICT_SIZE);
|
|
734
|
+
size_t in_buf_ofs = 0, dict_ofs = 0;
|
|
735
|
+
if (!pDict)
|
|
736
|
+
return TINFL_STATUS_FAILED;
|
|
737
|
+
memset(pDict, 0, TINFL_LZ_DICT_SIZE);
|
|
738
|
+
tinfl_init(&decomp);
|
|
739
|
+
for (;;)
|
|
740
|
+
{
|
|
741
|
+
size_t in_buf_size = *pIn_buf_size - in_buf_ofs, dst_buf_size = TINFL_LZ_DICT_SIZE - dict_ofs;
|
|
742
|
+
tinfl_status status = tinfl_decompress(&decomp, (const mz_uint8 *)pIn_buf + in_buf_ofs, &in_buf_size, pDict, pDict + dict_ofs, &dst_buf_size,
|
|
743
|
+
(flags & ~(TINFL_FLAG_HAS_MORE_INPUT | TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF)));
|
|
744
|
+
in_buf_ofs += in_buf_size;
|
|
745
|
+
if ((dst_buf_size) && (!(*pPut_buf_func)(pDict + dict_ofs, (int)dst_buf_size, pPut_buf_user)))
|
|
746
|
+
break;
|
|
747
|
+
if (status != TINFL_STATUS_HAS_MORE_OUTPUT)
|
|
748
|
+
{
|
|
749
|
+
result = (status == TINFL_STATUS_DONE);
|
|
750
|
+
break;
|
|
751
|
+
}
|
|
752
|
+
dict_ofs = (dict_ofs + dst_buf_size) & (TINFL_LZ_DICT_SIZE - 1);
|
|
753
|
+
}
|
|
754
|
+
MZ_FREE(pDict);
|
|
755
|
+
*pIn_buf_size = in_buf_ofs;
|
|
756
|
+
return result;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
#ifndef MINIZ_NO_MALLOC
|
|
760
|
+
tinfl_decompressor *tinfl_decompressor_alloc(void)
|
|
761
|
+
{
|
|
762
|
+
tinfl_decompressor *pDecomp = (tinfl_decompressor *)MZ_MALLOC(sizeof(tinfl_decompressor));
|
|
763
|
+
if (pDecomp)
|
|
764
|
+
tinfl_init(pDecomp);
|
|
765
|
+
return pDecomp;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
void tinfl_decompressor_free(tinfl_decompressor *pDecomp)
|
|
769
|
+
{
|
|
770
|
+
MZ_FREE(pDecomp);
|
|
771
|
+
}
|
|
772
|
+
#endif
|
|
773
|
+
|
|
774
|
+
#ifdef __cplusplus
|
|
775
|
+
}
|
|
776
|
+
#endif
|
|
777
|
+
|
|
778
|
+
#endif /*#ifndef MINIZ_NO_INFLATE_APIS*/
|