mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
Merge pull request #112135 from akien-mga/4.0-fix-gcc-warnings
[4.0] CI: Fix build with latest MinGW-GCC 15 and Xcode 16
This commit is contained in:
commit
83673ed3db
75 changed files with 2203 additions and 2906 deletions
5
.github/workflows/macos_builds.yml
vendored
5
.github/workflows/macos_builds.yml
vendored
|
|
@ -39,11 +39,6 @@ jobs:
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
- name: Setup Xcode
|
|
||||||
uses: maxim-lobanov/setup-xcode@v1
|
|
||||||
with:
|
|
||||||
xcode-version: '15.3'
|
|
||||||
|
|
||||||
- name: Restore Godot build cache
|
- name: Restore Godot build cache
|
||||||
uses: ./.github/actions/godot-cache-restore
|
uses: ./.github/actions/godot-cache-restore
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
|
|
@ -259,8 +259,8 @@ License: BSD-3-clause
|
||||||
|
|
||||||
Files: ./thirdparty/libpng/
|
Files: ./thirdparty/libpng/
|
||||||
Comment: libpng
|
Comment: libpng
|
||||||
Copyright: 1995-2019, The PNG Reference Library Authors.
|
Copyright: 1995-2024, The PNG Reference Library Authors.
|
||||||
2018-2019, Cosmin Truta.
|
2018-2024, Cosmin Truta.
|
||||||
2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
|
2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
|
||||||
1996-1997, Andreas Dilger.
|
1996-1997, Andreas Dilger.
|
||||||
1995-1996, Guy Eric Schalnat, Group 42, Inc.
|
1995-1996, Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
@ -478,7 +478,7 @@ License: Expat
|
||||||
|
|
||||||
Files: ./thirdparty/zlib/
|
Files: ./thirdparty/zlib/
|
||||||
Comment: zlib
|
Comment: zlib
|
||||||
Copyright: 1995-2022, Jean-loup Gailly and Mark Adler
|
Copyright: 1995-2024, Jean-loup Gailly and Mark Adler
|
||||||
License: Zlib
|
License: Zlib
|
||||||
|
|
||||||
Files: ./thirdparty/zstd/
|
Files: ./thirdparty/zstd/
|
||||||
|
|
|
||||||
|
|
@ -2336,6 +2336,10 @@ void Image::initialize_data(const char **p_xpm) {
|
||||||
} break;
|
} break;
|
||||||
case READING_PIXELS: {
|
case READING_PIXELS: {
|
||||||
int y = line - colormap_size - 1;
|
int y = line - colormap_size - 1;
|
||||||
|
#if defined(__GNUC__) && !defined(__clang__)
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic warning "-Wstringop-overflow=0"
|
||||||
|
#endif
|
||||||
for (int x = 0; x < size_width; x++) {
|
for (int x = 0; x < size_width; x++) {
|
||||||
char pixelstr[6] = { 0, 0, 0, 0, 0, 0 };
|
char pixelstr[6] = { 0, 0, 0, 0, 0, 0 };
|
||||||
for (int i = 0; i < pixelchars; i++) {
|
for (int i = 0; i < pixelchars; i++) {
|
||||||
|
|
@ -2350,6 +2354,9 @@ void Image::initialize_data(const char **p_xpm) {
|
||||||
}
|
}
|
||||||
_put_pixelb(x, y, pixel_size, data_write, pixel);
|
_put_pixelb(x, y, pixel_size, data_write, pixel);
|
||||||
}
|
}
|
||||||
|
#if defined(__GNUC__) && !defined(__clang__)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
if (y == (size_height - 1)) {
|
if (y == (size_height - 1)) {
|
||||||
status = DONE;
|
status = DONE;
|
||||||
|
|
|
||||||
|
|
@ -324,19 +324,18 @@ MessageQueue::~MessageQueue() {
|
||||||
|
|
||||||
while (read_pos < buffer_end) {
|
while (read_pos < buffer_end) {
|
||||||
Message *message = (Message *)&buffer[read_pos];
|
Message *message = (Message *)&buffer[read_pos];
|
||||||
|
read_pos += sizeof(Message);
|
||||||
|
|
||||||
Variant *args = (Variant *)(message + 1);
|
Variant *args = (Variant *)(message + 1);
|
||||||
int argc = message->args;
|
int argc = message->args;
|
||||||
if ((message->type & FLAG_MASK) != TYPE_NOTIFICATION) {
|
if ((message->type & FLAG_MASK) != TYPE_NOTIFICATION) {
|
||||||
for (int i = 0; i < argc; i++) {
|
for (int i = 0; i < argc; i++) {
|
||||||
args[i].~Variant();
|
args[i].~Variant();
|
||||||
}
|
}
|
||||||
|
read_pos += sizeof(Variant) * argc;
|
||||||
}
|
}
|
||||||
message->~Message();
|
|
||||||
|
|
||||||
read_pos += sizeof(Message);
|
message->~Message();
|
||||||
if ((message->type & FLAG_MASK) != TYPE_NOTIFICATION) {
|
|
||||||
read_pos += sizeof(Variant) * message->args;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
singleton = nullptr;
|
singleton = nullptr;
|
||||||
|
|
|
||||||
|
|
@ -55,9 +55,9 @@ class MessageQueue {
|
||||||
|
|
||||||
struct Message {
|
struct Message {
|
||||||
Callable callable;
|
Callable callable;
|
||||||
int16_t type;
|
int16_t type = 0;
|
||||||
union {
|
union {
|
||||||
int16_t notification;
|
int16_t notification = 0;
|
||||||
int16_t args;
|
int16_t args;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1394,7 +1394,7 @@ void TextureStorage::update_texture_atlas() {
|
||||||
//generate atlas
|
//generate atlas
|
||||||
Vector<TextureAtlas::SortItem> itemsv;
|
Vector<TextureAtlas::SortItem> itemsv;
|
||||||
itemsv.resize(texture_atlas.textures.size());
|
itemsv.resize(texture_atlas.textures.size());
|
||||||
int base_size = 8;
|
uint32_t base_size = 8;
|
||||||
|
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
|
|
@ -1407,7 +1407,7 @@ void TextureStorage::update_texture_atlas() {
|
||||||
si.size.height = (src_tex->height / border) + 1;
|
si.size.height = (src_tex->height / border) + 1;
|
||||||
si.pixel_size = Size2i(src_tex->width, src_tex->height);
|
si.pixel_size = Size2i(src_tex->width, src_tex->height);
|
||||||
|
|
||||||
if (base_size < si.size.width) {
|
if (base_size < (uint32_t)si.size.width) {
|
||||||
base_size = nearest_power_of_2_templated(si.size.width);
|
base_size = nearest_power_of_2_templated(si.size.width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1438,7 +1438,7 @@ void TextureStorage::update_texture_atlas() {
|
||||||
TextureAtlas::SortItem &si = items[i];
|
TextureAtlas::SortItem &si = items[i];
|
||||||
int best_idx = -1;
|
int best_idx = -1;
|
||||||
int best_height = 0x7FFFFFFF;
|
int best_height = 0x7FFFFFFF;
|
||||||
for (int j = 0; j <= base_size - si.size.width; j++) {
|
for (uint32_t j = 0; j <= base_size - si.size.width; j++) {
|
||||||
int height = 0;
|
int height = 0;
|
||||||
for (int k = 0; k < si.size.width; k++) {
|
for (int k = 0; k < si.size.width; k++) {
|
||||||
int h = v_offsets[k + j];
|
int h = v_offsets[k + j];
|
||||||
|
|
@ -1469,7 +1469,7 @@ void TextureStorage::update_texture_atlas() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (max_height <= base_size * 2) {
|
if ((uint32_t)max_height <= base_size * 2) {
|
||||||
atlas_height = max_height;
|
atlas_height = max_height;
|
||||||
break; //good ratio, break;
|
break; //good ratio, break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
42
drivers/vulkan/godot_vulkan.h
Normal file
42
drivers/vulkan/godot_vulkan.h
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
/**************************************************************************/
|
||||||
|
/* godot_vulkan.h */
|
||||||
|
/**************************************************************************/
|
||||||
|
/* This file is part of: */
|
||||||
|
/* GODOT ENGINE */
|
||||||
|
/* https://godotengine.org */
|
||||||
|
/**************************************************************************/
|
||||||
|
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||||
|
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||||
|
/* */
|
||||||
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||||
|
/* a copy of this software and associated documentation files (the */
|
||||||
|
/* "Software"), to deal in the Software without restriction, including */
|
||||||
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||||
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||||
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||||
|
/* the following conditions: */
|
||||||
|
/* */
|
||||||
|
/* The above copyright notice and this permission notice shall be */
|
||||||
|
/* included in all copies or substantial portions of the Software. */
|
||||||
|
/* */
|
||||||
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||||
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||||
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||||
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||||
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||||
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
|
/**************************************************************************/
|
||||||
|
|
||||||
|
#ifndef GODOT_VULKAN_H
|
||||||
|
#define GODOT_VULKAN_H
|
||||||
|
|
||||||
|
#ifdef USE_VOLK
|
||||||
|
#include <volk.h>
|
||||||
|
#else
|
||||||
|
#include <stdint.h>
|
||||||
|
#define VK_NO_STDINT_H
|
||||||
|
#include <vulkan/vulkan.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // GODOT_VULKAN_H
|
||||||
|
|
@ -44,11 +44,7 @@
|
||||||
#endif
|
#endif
|
||||||
#include "vk_mem_alloc.h"
|
#include "vk_mem_alloc.h"
|
||||||
|
|
||||||
#ifdef USE_VOLK
|
#include "drivers/vulkan/godot_vulkan.h"
|
||||||
#include <volk.h>
|
|
||||||
#else
|
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class VulkanContext;
|
class VulkanContext;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,11 +40,7 @@
|
||||||
#include "servers/display_server.h"
|
#include "servers/display_server.h"
|
||||||
#include "servers/rendering/rendering_device.h"
|
#include "servers/rendering/rendering_device.h"
|
||||||
|
|
||||||
#ifdef USE_VOLK
|
#include "drivers/vulkan/godot_vulkan.h"
|
||||||
#include <volk.h>
|
|
||||||
#else
|
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "vulkan_hooks.h"
|
#include "vulkan_hooks.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,11 +31,7 @@
|
||||||
#ifndef VULKAN_HOOKS_H
|
#ifndef VULKAN_HOOKS_H
|
||||||
#define VULKAN_HOOKS_H
|
#define VULKAN_HOOKS_H
|
||||||
|
|
||||||
#ifdef USE_VOLK
|
#include "drivers/vulkan/godot_vulkan.h"
|
||||||
#include <volk.h>
|
|
||||||
#else
|
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class VulkanHooks {
|
class VulkanHooks {
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ __CRT_UUID_DECL(IAudioClient3, 0x7ED4EE07, 0x8E67, 0x4CD4, 0x8C, 0x1A, 0x2B, 0x7
|
||||||
|
|
||||||
#endif // __MINGW32__ || __MINGW64__
|
#endif // __MINGW32__ || __MINGW64__
|
||||||
|
|
||||||
#ifndef PKEY_Device_FriendlyName
|
#ifndef PKEY_Device_FriendlyNameGodot
|
||||||
|
|
||||||
#undef DEFINE_PROPERTYKEY
|
#undef DEFINE_PROPERTYKEY
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
|
|
@ -97,7 +97,7 @@ __CRT_UUID_DECL(IAudioClient3, 0x7ED4EE07, 0x8E67, 0x4CD4, 0x8C, 0x1A, 0x2B, 0x7
|
||||||
const PROPERTYKEY id = { { a, b, c, { d, e, f, g, h, i, j, k, } }, l };
|
const PROPERTYKEY id = { { a, b, c, { d, e, f, g, h, i, j, k, } }, l };
|
||||||
/* clang-format on */
|
/* clang-format on */
|
||||||
|
|
||||||
DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14);
|
DEFINE_PROPERTYKEY(PKEY_Device_FriendlyNameGodot, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);
|
const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);
|
||||||
|
|
@ -237,7 +237,7 @@ Error AudioDriverWASAPI::audio_device_init(AudioDeviceWASAPI *p_device, bool p_i
|
||||||
PROPVARIANT propvar;
|
PROPVARIANT propvar;
|
||||||
PropVariantInit(&propvar);
|
PropVariantInit(&propvar);
|
||||||
|
|
||||||
hr = props->GetValue(PKEY_Device_FriendlyName, &propvar);
|
hr = props->GetValue(PKEY_Device_FriendlyNameGodot, &propvar);
|
||||||
ERR_BREAK(hr != S_OK);
|
ERR_BREAK(hr != S_OK);
|
||||||
|
|
||||||
if (p_device->device_name == String(propvar.pwszVal)) {
|
if (p_device->device_name == String(propvar.pwszVal)) {
|
||||||
|
|
@ -611,7 +611,7 @@ PackedStringArray AudioDriverWASAPI::audio_device_get_list(bool p_input) {
|
||||||
PROPVARIANT propvar;
|
PROPVARIANT propvar;
|
||||||
PropVariantInit(&propvar);
|
PropVariantInit(&propvar);
|
||||||
|
|
||||||
hr = props->GetValue(PKEY_Device_FriendlyName, &propvar);
|
hr = props->GetValue(PKEY_Device_FriendlyNameGodot, &propvar);
|
||||||
ERR_BREAK(hr != S_OK);
|
ERR_BREAK(hr != S_OK);
|
||||||
|
|
||||||
list.push_back(String(propvar.pwszVal));
|
list.push_back(String(propvar.pwszVal));
|
||||||
|
|
|
||||||
|
|
@ -32,11 +32,7 @@
|
||||||
|
|
||||||
#include "vulkan_context_android.h"
|
#include "vulkan_context_android.h"
|
||||||
|
|
||||||
#ifdef USE_VOLK
|
#include "drivers/vulkan/godot_vulkan.h"
|
||||||
#include <volk.h>
|
|
||||||
#else
|
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *VulkanContextAndroid::_get_platform_surface_extension() const {
|
const char *VulkanContextAndroid::_get_platform_surface_extension() const {
|
||||||
return VK_KHR_ANDROID_SURFACE_EXTENSION_NAME;
|
return VK_KHR_ANDROID_SURFACE_EXTENSION_NAME;
|
||||||
|
|
|
||||||
|
|
@ -40,12 +40,8 @@
|
||||||
|
|
||||||
#include "vulkan_context_ios.h"
|
#include "vulkan_context_ios.h"
|
||||||
|
|
||||||
#ifdef USE_VOLK
|
#include "drivers/vulkan/godot_vulkan.h"
|
||||||
#include <volk.h>
|
#endif // VULKAN_ENABLED
|
||||||
#else
|
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(GLES3_ENABLED)
|
#if defined(GLES3_ENABLED)
|
||||||
#include "drivers/gles3/rasterizer_gles3.h"
|
#include "drivers/gles3/rasterizer_gles3.h"
|
||||||
|
|
|
||||||
|
|
@ -50,13 +50,9 @@
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
|
|
||||||
#if defined(VULKAN_ENABLED)
|
#if defined(VULKAN_ENABLED)
|
||||||
|
#include "drivers/vulkan/godot_vulkan.h"
|
||||||
#include "servers/rendering/renderer_rd/renderer_compositor_rd.h"
|
#include "servers/rendering/renderer_rd/renderer_compositor_rd.h"
|
||||||
#import <QuartzCore/CAMetalLayer.h>
|
#import <QuartzCore/CAMetalLayer.h>
|
||||||
#ifdef USE_VOLK
|
|
||||||
#include <volk.h>
|
|
||||||
#else
|
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Initialization order between compilation units is not guaranteed,
|
// Initialization order between compilation units is not guaranteed,
|
||||||
|
|
|
||||||
|
|
@ -32,11 +32,7 @@
|
||||||
|
|
||||||
#include "vulkan_context_x11.h"
|
#include "vulkan_context_x11.h"
|
||||||
|
|
||||||
#ifdef USE_VOLK
|
#include "drivers/vulkan/godot_vulkan.h"
|
||||||
#include <volk.h>
|
|
||||||
#else
|
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *VulkanContextX11::_get_platform_surface_extension() const {
|
const char *VulkanContextX11::_get_platform_surface_extension() const {
|
||||||
return VK_KHR_XLIB_SURFACE_EXTENSION_NAME;
|
return VK_KHR_XLIB_SURFACE_EXTENSION_NAME;
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,8 @@
|
||||||
|
|
||||||
#ifdef VULKAN_ENABLED
|
#ifdef VULKAN_ENABLED
|
||||||
#include "vulkan_context_macos.h"
|
#include "vulkan_context_macos.h"
|
||||||
#ifdef USE_VOLK
|
|
||||||
#include <volk.h>
|
#include "drivers/vulkan/godot_vulkan.h"
|
||||||
#else
|
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *VulkanContextMacOS::_get_platform_surface_extension() const {
|
const char *VulkanContextMacOS::_get_platform_surface_extension() const {
|
||||||
return VK_MVK_MACOS_SURFACE_EXTENSION_NAME;
|
return VK_MVK_MACOS_SURFACE_EXTENSION_NAME;
|
||||||
|
|
|
||||||
|
|
@ -31,11 +31,8 @@
|
||||||
#if defined(WINDOWS_ENABLED) && defined(VULKAN_ENABLED)
|
#if defined(WINDOWS_ENABLED) && defined(VULKAN_ENABLED)
|
||||||
|
|
||||||
#include "vulkan_context_win.h"
|
#include "vulkan_context_win.h"
|
||||||
#ifdef USE_VOLK
|
|
||||||
#include <volk.h>
|
#include "drivers/vulkan/godot_vulkan.h"
|
||||||
#else
|
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *VulkanContextWindows::_get_platform_surface_extension() const {
|
const char *VulkanContextWindows::_get_platform_surface_extension() const {
|
||||||
return VK_KHR_WIN32_SURFACE_EXTENSION_NAME;
|
return VK_KHR_WIN32_SURFACE_EXTENSION_NAME;
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,7 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
|
||||||
const NodeData *nd = &nodes[0];
|
const NodeData *nd = &nodes[0];
|
||||||
|
|
||||||
Node **ret_nodes = (Node **)alloca(sizeof(Node *) * nc);
|
Node **ret_nodes = (Node **)alloca(sizeof(Node *) * nc);
|
||||||
|
ret_nodes[0] = nullptr; // Sidesteps "maybe uninitialized" false-positives on GCC.
|
||||||
|
|
||||||
bool gen_node_path_cache = p_edit_state != GEN_EDIT_STATE_DISABLED && node_path_cache.is_empty();
|
bool gen_node_path_cache = p_edit_state != GEN_EDIT_STATE_DISABLED && node_path_cache.is_empty();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2084,7 +2084,7 @@ void TextureStorage::update_decal_atlas() {
|
||||||
//generate atlas
|
//generate atlas
|
||||||
Vector<DecalAtlas::SortItem> itemsv;
|
Vector<DecalAtlas::SortItem> itemsv;
|
||||||
itemsv.resize(decal_atlas.textures.size());
|
itemsv.resize(decal_atlas.textures.size());
|
||||||
int base_size = 8;
|
uint32_t base_size = 8;
|
||||||
|
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
|
|
@ -2097,7 +2097,7 @@ void TextureStorage::update_decal_atlas() {
|
||||||
si.size.height = (src_tex->height / border) + 1;
|
si.size.height = (src_tex->height / border) + 1;
|
||||||
si.pixel_size = Size2i(src_tex->width, src_tex->height);
|
si.pixel_size = Size2i(src_tex->width, src_tex->height);
|
||||||
|
|
||||||
if (base_size < si.size.width) {
|
if (base_size < (uint32_t)si.size.width) {
|
||||||
base_size = nearest_power_of_2_templated(si.size.width);
|
base_size = nearest_power_of_2_templated(si.size.width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2128,7 +2128,7 @@ void TextureStorage::update_decal_atlas() {
|
||||||
DecalAtlas::SortItem &si = items[i];
|
DecalAtlas::SortItem &si = items[i];
|
||||||
int best_idx = -1;
|
int best_idx = -1;
|
||||||
int best_height = 0x7FFFFFFF;
|
int best_height = 0x7FFFFFFF;
|
||||||
for (int j = 0; j <= base_size - si.size.width; j++) {
|
for (uint32_t j = 0; j <= base_size - si.size.width; j++) {
|
||||||
int height = 0;
|
int height = 0;
|
||||||
for (int k = 0; k < si.size.width; k++) {
|
for (int k = 0; k < si.size.width; k++) {
|
||||||
int h = v_offsets[k + j];
|
int h = v_offsets[k + j];
|
||||||
|
|
@ -2159,7 +2159,7 @@ void TextureStorage::update_decal_atlas() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (max_height <= base_size * 2) {
|
if ((uint32_t)max_height <= base_size * 2) {
|
||||||
atlas_height = max_height;
|
atlas_height = max_height;
|
||||||
break; //good ratio, break;
|
break; //good ratio, break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
8
thirdparty/README.md
vendored
8
thirdparty/README.md
vendored
|
|
@ -319,7 +319,7 @@ Files extracted from upstream source:
|
||||||
## libpng
|
## libpng
|
||||||
|
|
||||||
- Upstream: http://libpng.org/pub/png/libpng.html
|
- Upstream: http://libpng.org/pub/png/libpng.html
|
||||||
- Version: 1.6.38 (0a158f3506502dfa23edfc42790dfaed82efba17, 2022)
|
- Version: 1.6.43 (ed217e3e601d8e462f7fd1e04bed43ac42212429, 2024)
|
||||||
- License: libpng/zlib
|
- License: libpng/zlib
|
||||||
|
|
||||||
Files extracted from upstream source:
|
Files extracted from upstream source:
|
||||||
|
|
@ -443,7 +443,7 @@ that file when upgrading.
|
||||||
## minizip
|
## minizip
|
||||||
|
|
||||||
- Upstream: https://www.zlib.net
|
- Upstream: https://www.zlib.net
|
||||||
- Version: 1.2.13 (zlib contrib, 2022)
|
- Version: 1.3.1 (zlib contrib, 2024)
|
||||||
- License: zlib
|
- License: zlib
|
||||||
|
|
||||||
Files extracted from the upstream source:
|
Files extracted from the upstream source:
|
||||||
|
|
@ -797,12 +797,12 @@ Files extracted from upstream source:
|
||||||
## zlib
|
## zlib
|
||||||
|
|
||||||
- Upstream: https://www.zlib.net
|
- Upstream: https://www.zlib.net
|
||||||
- Version: 1.2.13 (2022)
|
- Version: 1.3.1 (2024)
|
||||||
- License: zlib
|
- License: zlib
|
||||||
|
|
||||||
Files extracted from upstream source:
|
Files extracted from upstream source:
|
||||||
|
|
||||||
- All `*.c` and `*.h` files
|
- All `*.c` and `*.h` files, minus `infback.c`
|
||||||
- `LICENSE`
|
- `LICENSE`
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
4
thirdparty/libpng/LICENSE
vendored
4
thirdparty/libpng/LICENSE
vendored
|
|
@ -4,8 +4,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
|
||||||
PNG Reference Library License version 2
|
PNG Reference Library License version 2
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
* Copyright (c) 1995-2022 The PNG Reference Library Authors.
|
* Copyright (c) 1995-2024 The PNG Reference Library Authors.
|
||||||
* Copyright (c) 2018-2022 Cosmin Truta.
|
* Copyright (c) 2018-2024 Cosmin Truta.
|
||||||
* Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
|
* Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger.
|
* Copyright (c) 1996-1997 Andreas Dilger.
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
|
||||||
110
thirdparty/libpng/png.c
vendored
110
thirdparty/libpng/png.c
vendored
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* png.c - location for general purpose libpng functions
|
/* png.c - location for general purpose libpng functions
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2022 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
@ -14,27 +14,7 @@
|
||||||
#include "pngpriv.h"
|
#include "pngpriv.h"
|
||||||
|
|
||||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||||
typedef png_libpng_version_1_6_39 Your_png_h_is_not_version_1_6_39;
|
typedef png_libpng_version_1_6_43 Your_png_h_is_not_version_1_6_43;
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
/* The version tests may need to be added to, but the problem warning has
|
|
||||||
* consistently been fixed in GCC versions which obtain wide-spread release.
|
|
||||||
* The problem is that many versions of GCC rearrange comparison expressions in
|
|
||||||
* the optimizer in such a way that the results of the comparison will change
|
|
||||||
* if signed integer overflow occurs. Such comparisons are not permitted in
|
|
||||||
* ANSI C90, however GCC isn't clever enough to work out that that do not occur
|
|
||||||
* below in png_ascii_from_fp and png_muldiv, so it produces a warning with
|
|
||||||
* -Wextra. Unfortunately this is highly dependent on the optimizer and the
|
|
||||||
* machine architecture so the warning comes and goes unpredictably and is
|
|
||||||
* impossible to "fix", even were that a good idea.
|
|
||||||
*/
|
|
||||||
#if __GNUC__ == 7 && __GNUC_MINOR__ == 1
|
|
||||||
#define GCC_STRICT_OVERFLOW 1
|
|
||||||
#endif /* GNU 7.1.x */
|
|
||||||
#endif /* GNU */
|
|
||||||
#ifndef GCC_STRICT_OVERFLOW
|
|
||||||
#define GCC_STRICT_OVERFLOW 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Tells libpng that we have already handled the first "num_bytes" bytes
|
/* Tells libpng that we have already handled the first "num_bytes" bytes
|
||||||
* of the PNG file signature. If the PNG data is embedded into another
|
* of the PNG file signature. If the PNG data is embedded into another
|
||||||
|
|
@ -73,21 +53,21 @@ png_set_sig_bytes(png_structrp png_ptr, int num_bytes)
|
||||||
int PNGAPI
|
int PNGAPI
|
||||||
png_sig_cmp(png_const_bytep sig, size_t start, size_t num_to_check)
|
png_sig_cmp(png_const_bytep sig, size_t start, size_t num_to_check)
|
||||||
{
|
{
|
||||||
png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
static const png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
||||||
|
|
||||||
if (num_to_check > 8)
|
if (num_to_check > 8)
|
||||||
num_to_check = 8;
|
num_to_check = 8;
|
||||||
|
|
||||||
else if (num_to_check < 1)
|
else if (num_to_check < 1)
|
||||||
return (-1);
|
return -1;
|
||||||
|
|
||||||
if (start > 7)
|
if (start > 7)
|
||||||
return (-1);
|
return -1;
|
||||||
|
|
||||||
if (start + num_to_check > 8)
|
if (start + num_to_check > 8)
|
||||||
num_to_check = 8 - start;
|
num_to_check = 8 - start;
|
||||||
|
|
||||||
return ((int)(memcmp(&sig[start], &png_signature[start], num_to_check)));
|
return memcmp(&sig[start], &png_signature[start], num_to_check);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* READ */
|
#endif /* READ */
|
||||||
|
|
@ -447,7 +427,6 @@ png_info_init_3,(png_infopp ptr_ptr, size_t png_info_struct_size),
|
||||||
memset(info_ptr, 0, (sizeof *info_ptr));
|
memset(info_ptr, 0, (sizeof *info_ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The following API is not called internally */
|
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_data_freer(png_const_structrp png_ptr, png_inforp info_ptr,
|
png_data_freer(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
int freer, png_uint_32 mask)
|
int freer, png_uint_32 mask)
|
||||||
|
|
@ -686,9 +665,9 @@ png_voidp PNGAPI
|
||||||
png_get_io_ptr(png_const_structrp png_ptr)
|
png_get_io_ptr(png_const_structrp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return (NULL);
|
return NULL;
|
||||||
|
|
||||||
return (png_ptr->io_ptr);
|
return png_ptr->io_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
||||||
|
|
@ -752,7 +731,7 @@ png_convert_to_rfc1123_buffer(char out[29], png_const_timep ptime)
|
||||||
|
|
||||||
{
|
{
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
char number_buf[5]; /* enough for a four-digit year */
|
char number_buf[5] = {0, 0, 0, 0, 0}; /* enough for a four-digit year */
|
||||||
|
|
||||||
# define APPEND_STRING(string) pos = png_safecat(out, 29, pos, (string))
|
# define APPEND_STRING(string) pos = png_safecat(out, 29, pos, (string))
|
||||||
# define APPEND_NUMBER(format, value)\
|
# define APPEND_NUMBER(format, value)\
|
||||||
|
|
@ -815,8 +794,8 @@ png_get_copyright(png_const_structrp png_ptr)
|
||||||
return PNG_STRING_COPYRIGHT
|
return PNG_STRING_COPYRIGHT
|
||||||
#else
|
#else
|
||||||
return PNG_STRING_NEWLINE \
|
return PNG_STRING_NEWLINE \
|
||||||
"libpng version 1.6.39" PNG_STRING_NEWLINE \
|
"libpng version 1.6.43" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 2018-2022 Cosmin Truta" PNG_STRING_NEWLINE \
|
"Copyright (c) 2018-2024 Cosmin Truta" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
|
"Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
|
||||||
PNG_STRING_NEWLINE \
|
PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||||
|
|
@ -977,7 +956,7 @@ png_reset_zstream(png_structrp png_ptr)
|
||||||
return Z_STREAM_ERROR;
|
return Z_STREAM_ERROR;
|
||||||
|
|
||||||
/* WARNING: this resets the window bits to the maximum! */
|
/* WARNING: this resets the window bits to the maximum! */
|
||||||
return (inflateReset(&png_ptr->zstream));
|
return inflateReset(&png_ptr->zstream);
|
||||||
}
|
}
|
||||||
#endif /* READ */
|
#endif /* READ */
|
||||||
|
|
||||||
|
|
@ -986,7 +965,7 @@ png_uint_32 PNGAPI
|
||||||
png_access_version_number(void)
|
png_access_version_number(void)
|
||||||
{
|
{
|
||||||
/* Version of *.c files used when building libpng */
|
/* Version of *.c files used when building libpng */
|
||||||
return((png_uint_32)PNG_LIBPNG_VER);
|
return (png_uint_32)PNG_LIBPNG_VER;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
||||||
|
|
@ -1842,14 +1821,14 @@ png_icc_profile_error(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
||||||
}
|
}
|
||||||
# ifdef PNG_WARNINGS_SUPPORTED
|
# ifdef PNG_WARNINGS_SUPPORTED
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char number[PNG_NUMBER_BUFFER_SIZE]; /* +24 = 114 */
|
char number[PNG_NUMBER_BUFFER_SIZE]; /* +24 = 114 */
|
||||||
|
|
||||||
pos = png_safecat(message, (sizeof message), pos,
|
pos = png_safecat(message, (sizeof message), pos,
|
||||||
png_format_number(number, number+(sizeof number),
|
png_format_number(number, number+(sizeof number),
|
||||||
PNG_NUMBER_FORMAT_x, value));
|
PNG_NUMBER_FORMAT_x, value));
|
||||||
pos = png_safecat(message, (sizeof message), pos, "h: "); /* +2 = 116 */
|
pos = png_safecat(message, (sizeof message), pos, "h: "); /* +2 = 116 */
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
/* The 'reason' is an arbitrary message, allow +79 maximum 195 */
|
/* The 'reason' is an arbitrary message, allow +79 maximum 195 */
|
||||||
pos = png_safecat(message, (sizeof message), pos, reason);
|
pos = png_safecat(message, (sizeof message), pos, reason);
|
||||||
|
|
@ -2532,17 +2511,6 @@ png_colorspace_set_rgb_coefficients(png_structrp png_ptr)
|
||||||
|
|
||||||
#endif /* COLORSPACE */
|
#endif /* COLORSPACE */
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
/* This exists solely to work round a warning from GNU C. */
|
|
||||||
static int /* PRIVATE */
|
|
||||||
png_gt(size_t a, size_t b)
|
|
||||||
{
|
|
||||||
return a > b;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
# define png_gt(a,b) ((a) > (b))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_check_IHDR(png_const_structrp png_ptr,
|
png_check_IHDR(png_const_structrp png_ptr,
|
||||||
png_uint_32 width, png_uint_32 height, int bit_depth,
|
png_uint_32 width, png_uint_32 height, int bit_depth,
|
||||||
|
|
@ -2564,8 +2532,16 @@ png_check_IHDR(png_const_structrp png_ptr,
|
||||||
error = 1;
|
error = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (png_gt(((width + 7) & (~7U)),
|
/* The bit mask on the first line below must be at least as big as a
|
||||||
((PNG_SIZE_MAX
|
* png_uint_32. "~7U" is not adequate on 16-bit systems because it will
|
||||||
|
* be an unsigned 16-bit value. Casting to (png_alloc_size_t) makes the
|
||||||
|
* type of the result at least as bit (in bits) as the RHS of the > operator
|
||||||
|
* which also avoids a common warning on 64-bit systems that the comparison
|
||||||
|
* of (png_uint_32) against the constant value on the RHS will always be
|
||||||
|
* false.
|
||||||
|
*/
|
||||||
|
if (((width + 7) & ~(png_alloc_size_t)7) >
|
||||||
|
(((PNG_SIZE_MAX
|
||||||
- 48 /* big_row_buf hack */
|
- 48 /* big_row_buf hack */
|
||||||
- 1) /* filter byte */
|
- 1) /* filter byte */
|
||||||
/ 8) /* 8-byte RGBA pixels */
|
/ 8) /* 8-byte RGBA pixels */
|
||||||
|
|
@ -2891,14 +2867,6 @@ png_pow10(int power)
|
||||||
/* Function to format a floating point value in ASCII with a given
|
/* Function to format a floating point value in ASCII with a given
|
||||||
* precision.
|
* precision.
|
||||||
*/
|
*/
|
||||||
#if GCC_STRICT_OVERFLOW
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
/* The problem arises below with exp_b10, which can never overflow because it
|
|
||||||
* comes, originally, from frexp and is therefore limited to a range which is
|
|
||||||
* typically +/-710 (log2(DBL_MAX)/log2(DBL_MIN)).
|
|
||||||
*/
|
|
||||||
#pragma GCC diagnostic warning "-Wstrict-overflow=2"
|
|
||||||
#endif /* GCC_STRICT_OVERFLOW */
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, size_t size,
|
png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, size_t size,
|
||||||
double fp, unsigned int precision)
|
double fp, unsigned int precision)
|
||||||
|
|
@ -3220,10 +3188,6 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, size_t size,
|
||||||
/* Here on buffer too small. */
|
/* Here on buffer too small. */
|
||||||
png_error(png_ptr, "ASCII conversion buffer too small");
|
png_error(png_ptr, "ASCII conversion buffer too small");
|
||||||
}
|
}
|
||||||
#if GCC_STRICT_OVERFLOW
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
#endif /* GCC_STRICT_OVERFLOW */
|
|
||||||
|
|
||||||
# endif /* FLOATING_POINT */
|
# endif /* FLOATING_POINT */
|
||||||
|
|
||||||
# ifdef PNG_FIXED_POINT_SUPPORTED
|
# ifdef PNG_FIXED_POINT_SUPPORTED
|
||||||
|
|
@ -3251,7 +3215,7 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
|
||||||
if (num <= 0x80000000) /* else overflowed */
|
if (num <= 0x80000000) /* else overflowed */
|
||||||
{
|
{
|
||||||
unsigned int ndigits = 0, first = 16 /* flag value */;
|
unsigned int ndigits = 0, first = 16 /* flag value */;
|
||||||
char digits[10];
|
char digits[10] = {0};
|
||||||
|
|
||||||
while (num)
|
while (num)
|
||||||
{
|
{
|
||||||
|
|
@ -3336,15 +3300,6 @@ png_fixed(png_const_structrp png_ptr, double fp, png_const_charp text)
|
||||||
* the nearest .00001). Overflow and divide by zero are signalled in
|
* the nearest .00001). Overflow and divide by zero are signalled in
|
||||||
* the result, a boolean - true on success, false on overflow.
|
* the result, a boolean - true on success, false on overflow.
|
||||||
*/
|
*/
|
||||||
#if GCC_STRICT_OVERFLOW /* from above */
|
|
||||||
/* It is not obvious which comparison below gets optimized in such a way that
|
|
||||||
* signed overflow would change the result; looking through the code does not
|
|
||||||
* reveal any tests which have the form GCC complains about, so presumably the
|
|
||||||
* optimizer is moving an add or subtract into the 'if' somewhere.
|
|
||||||
*/
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic warning "-Wstrict-overflow=2"
|
|
||||||
#endif /* GCC_STRICT_OVERFLOW */
|
|
||||||
int
|
int
|
||||||
png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
|
png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
|
||||||
png_int_32 divisor)
|
png_int_32 divisor)
|
||||||
|
|
@ -3459,9 +3414,6 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#if GCC_STRICT_OVERFLOW
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
#endif /* GCC_STRICT_OVERFLOW */
|
|
||||||
#endif /* READ_GAMMA || INCH_CONVERSIONS */
|
#endif /* READ_GAMMA || INCH_CONVERSIONS */
|
||||||
|
|
||||||
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED)
|
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED)
|
||||||
|
|
|
||||||
63
thirdparty/libpng/png.h
vendored
63
thirdparty/libpng/png.h
vendored
|
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
/* png.h - header file for PNG reference library
|
/* png.h - header file for PNG reference library
|
||||||
*
|
*
|
||||||
* libpng version 1.6.39 - November 20, 2022
|
* libpng version 1.6.43
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2022 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
|
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||||
* libpng versions 0.97, January 1998, through 1.6.35, July 2018:
|
* libpng versions 0.97, January 1998, through 1.6.35, July 2018:
|
||||||
* Glenn Randers-Pehrson
|
* Glenn Randers-Pehrson
|
||||||
* libpng versions 1.6.36, December 2018, through 1.6.39, November 2022:
|
* libpng versions 1.6.36, December 2018, through 1.6.43, February 2024:
|
||||||
* Cosmin Truta
|
* Cosmin Truta
|
||||||
* See also "Contributing Authors", below.
|
* See also "Contributing Authors", below.
|
||||||
*/
|
*/
|
||||||
|
|
@ -27,8 +27,8 @@
|
||||||
* PNG Reference Library License version 2
|
* PNG Reference Library License version 2
|
||||||
* ---------------------------------------
|
* ---------------------------------------
|
||||||
*
|
*
|
||||||
* * Copyright (c) 1995-2022 The PNG Reference Library Authors.
|
* * Copyright (c) 1995-2024 The PNG Reference Library Authors.
|
||||||
* * Copyright (c) 2018-2022 Cosmin Truta.
|
* * Copyright (c) 2018-2024 Cosmin Truta.
|
||||||
* * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
|
* * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
|
||||||
* * Copyright (c) 1996-1997 Andreas Dilger.
|
* * Copyright (c) 1996-1997 Andreas Dilger.
|
||||||
* * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
@ -239,7 +239,7 @@
|
||||||
* ...
|
* ...
|
||||||
* 1.5.30 15 10530 15.so.15.30[.0]
|
* 1.5.30 15 10530 15.so.15.30[.0]
|
||||||
* ...
|
* ...
|
||||||
* 1.6.39 16 10639 16.so.16.39[.0]
|
* 1.6.43 16 10643 16.so.16.43[.0]
|
||||||
*
|
*
|
||||||
* Henceforth the source version will match the shared-library major and
|
* Henceforth the source version will match the shared-library major and
|
||||||
* minor numbers; the shared-library major version number will be used for
|
* minor numbers; the shared-library major version number will be used for
|
||||||
|
|
@ -255,9 +255,6 @@
|
||||||
* to the info_ptr or png_ptr members through png.h, and the compiled
|
* to the info_ptr or png_ptr members through png.h, and the compiled
|
||||||
* application is loaded with a different version of the library.
|
* application is loaded with a different version of the library.
|
||||||
*
|
*
|
||||||
* DLLNUM will change each time there are forward or backward changes
|
|
||||||
* in binary compatibility (e.g., when a new feature is added).
|
|
||||||
*
|
|
||||||
* See libpng.txt or libpng.3 for more information. The PNG specification
|
* See libpng.txt or libpng.3 for more information. The PNG specification
|
||||||
* is available as a W3C Recommendation and as an ISO/IEC Standard; see
|
* is available as a W3C Recommendation and as an ISO/IEC Standard; see
|
||||||
* <https://www.w3.org/TR/2003/REC-PNG-20031110/>
|
* <https://www.w3.org/TR/2003/REC-PNG-20031110/>
|
||||||
|
|
@ -278,19 +275,21 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Version information for png.h - this should match the version in png.c */
|
/* Version information for png.h - this should match the version in png.c */
|
||||||
#define PNG_LIBPNG_VER_STRING "1.6.39"
|
#define PNG_LIBPNG_VER_STRING "1.6.43"
|
||||||
#define PNG_HEADER_VERSION_STRING " libpng version 1.6.39 - November 20, 2022\n"
|
#define PNG_HEADER_VERSION_STRING " libpng version " PNG_LIBPNG_VER_STRING "\n"
|
||||||
|
|
||||||
#define PNG_LIBPNG_VER_SONUM 16
|
/* The versions of shared library builds should stay in sync, going forward */
|
||||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
#define PNG_LIBPNG_VER_SHAREDLIB 16
|
||||||
|
#define PNG_LIBPNG_VER_SONUM PNG_LIBPNG_VER_SHAREDLIB /* [Deprecated] */
|
||||||
|
#define PNG_LIBPNG_VER_DLLNUM PNG_LIBPNG_VER_SHAREDLIB /* [Deprecated] */
|
||||||
|
|
||||||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||||
#define PNG_LIBPNG_VER_MAJOR 1
|
#define PNG_LIBPNG_VER_MAJOR 1
|
||||||
#define PNG_LIBPNG_VER_MINOR 6
|
#define PNG_LIBPNG_VER_MINOR 6
|
||||||
#define PNG_LIBPNG_VER_RELEASE 39
|
#define PNG_LIBPNG_VER_RELEASE 43
|
||||||
|
|
||||||
/* This should be zero for a public release, or non-zero for a
|
/* This should be zero for a public release, or non-zero for a
|
||||||
* development version. [Deprecated]
|
* development version.
|
||||||
*/
|
*/
|
||||||
#define PNG_LIBPNG_VER_BUILD 0
|
#define PNG_LIBPNG_VER_BUILD 0
|
||||||
|
|
||||||
|
|
@ -318,7 +317,7 @@
|
||||||
* From version 1.0.1 it is:
|
* From version 1.0.1 it is:
|
||||||
* XXYYZZ, where XX=major, YY=minor, ZZ=release
|
* XXYYZZ, where XX=major, YY=minor, ZZ=release
|
||||||
*/
|
*/
|
||||||
#define PNG_LIBPNG_VER 10639 /* 1.6.39 */
|
#define PNG_LIBPNG_VER 10643 /* 1.6.43 */
|
||||||
|
|
||||||
/* Library configuration: these options cannot be changed after
|
/* Library configuration: these options cannot be changed after
|
||||||
* the library has been built.
|
* the library has been built.
|
||||||
|
|
@ -428,7 +427,7 @@ extern "C" {
|
||||||
/* This triggers a compiler error in png.c, if png.c and png.h
|
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||||
* do not agree upon the version number.
|
* do not agree upon the version number.
|
||||||
*/
|
*/
|
||||||
typedef char* png_libpng_version_1_6_39;
|
typedef char* png_libpng_version_1_6_43;
|
||||||
|
|
||||||
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
||||||
*
|
*
|
||||||
|
|
@ -849,7 +848,7 @@ PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), PNGARG((jmp_buf, int)), typedef);
|
||||||
#define PNG_TRANSFORM_GRAY_TO_RGB 0x2000 /* read only */
|
#define PNG_TRANSFORM_GRAY_TO_RGB 0x2000 /* read only */
|
||||||
/* Added to libpng-1.5.4 */
|
/* Added to libpng-1.5.4 */
|
||||||
#define PNG_TRANSFORM_EXPAND_16 0x4000 /* read only */
|
#define PNG_TRANSFORM_EXPAND_16 0x4000 /* read only */
|
||||||
#if INT_MAX >= 0x8000 /* else this might break */
|
#if ~0U > 0xffffU /* or else this might break on a 16-bit machine */
|
||||||
#define PNG_TRANSFORM_SCALE_16 0x8000 /* read only */
|
#define PNG_TRANSFORM_SCALE_16 0x8000 /* read only */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -908,15 +907,15 @@ PNG_EXPORT(2, void, png_set_sig_bytes, (png_structrp png_ptr, int num_bytes));
|
||||||
/* Check sig[start] through sig[start + num_to_check - 1] to see if it's a
|
/* Check sig[start] through sig[start + num_to_check - 1] to see if it's a
|
||||||
* PNG file. Returns zero if the supplied bytes match the 8-byte PNG
|
* PNG file. Returns zero if the supplied bytes match the 8-byte PNG
|
||||||
* signature, and non-zero otherwise. Having num_to_check == 0 or
|
* signature, and non-zero otherwise. Having num_to_check == 0 or
|
||||||
* start > 7 will always fail (ie return non-zero).
|
* start > 7 will always fail (i.e. return non-zero).
|
||||||
*/
|
*/
|
||||||
PNG_EXPORT(3, int, png_sig_cmp, (png_const_bytep sig, size_t start,
|
PNG_EXPORT(3, int, png_sig_cmp, (png_const_bytep sig, size_t start,
|
||||||
size_t num_to_check));
|
size_t num_to_check));
|
||||||
|
|
||||||
/* Simple signature checking function. This is the same as calling
|
/* Simple signature checking function. This is the same as calling
|
||||||
* png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n).
|
* png_check_sig(sig, n) := (png_sig_cmp(sig, 0, n) == 0).
|
||||||
*/
|
*/
|
||||||
#define png_check_sig(sig, n) !png_sig_cmp((sig), 0, (n))
|
#define png_check_sig(sig, n) (png_sig_cmp((sig), 0, (n)) == 0) /* DEPRECATED */
|
||||||
|
|
||||||
/* Allocate and initialize png_ptr struct for reading, and any other memory. */
|
/* Allocate and initialize png_ptr struct for reading, and any other memory. */
|
||||||
PNG_EXPORTA(4, png_structp, png_create_read_struct,
|
PNG_EXPORTA(4, png_structp, png_create_read_struct,
|
||||||
|
|
@ -1730,12 +1729,9 @@ PNG_EXPORT(97, void, png_free, (png_const_structrp png_ptr, png_voidp ptr));
|
||||||
PNG_EXPORT(98, void, png_free_data, (png_const_structrp png_ptr,
|
PNG_EXPORT(98, void, png_free_data, (png_const_structrp png_ptr,
|
||||||
png_inforp info_ptr, png_uint_32 free_me, int num));
|
png_inforp info_ptr, png_uint_32 free_me, int num));
|
||||||
|
|
||||||
/* Reassign responsibility for freeing existing data, whether allocated
|
/* Reassign the responsibility for freeing existing data, whether allocated
|
||||||
* by libpng or by the application; this works on the png_info structure passed
|
* by libpng or by the application; this works on the png_info structure passed
|
||||||
* in, it does not change the state for other png_info structures.
|
* in, without changing the state for other png_info structures.
|
||||||
*
|
|
||||||
* It is unlikely that this function works correctly as of 1.6.0 and using it
|
|
||||||
* may result either in memory leaks or double free of allocated data.
|
|
||||||
*/
|
*/
|
||||||
PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr,
|
PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr,
|
||||||
png_inforp info_ptr, int freer, png_uint_32 mask));
|
png_inforp info_ptr, int freer, png_uint_32 mask));
|
||||||
|
|
@ -3207,11 +3203,18 @@ PNG_EXPORT(245, int, png_image_write_to_memory, (png_imagep image, void *memory,
|
||||||
#ifdef PNG_MIPS_MSA_API_SUPPORTED
|
#ifdef PNG_MIPS_MSA_API_SUPPORTED
|
||||||
# define PNG_MIPS_MSA 6 /* HARDWARE: MIPS Msa SIMD instructions supported */
|
# define PNG_MIPS_MSA 6 /* HARDWARE: MIPS Msa SIMD instructions supported */
|
||||||
#endif
|
#endif
|
||||||
#define PNG_IGNORE_ADLER32 8
|
#ifdef PNG_DISABLE_ADLER32_CHECK_SUPPORTED
|
||||||
#ifdef PNG_POWERPC_VSX_API_SUPPORTED
|
# define PNG_IGNORE_ADLER32 8 /* SOFTWARE: disable Adler32 check on IDAT */
|
||||||
# define PNG_POWERPC_VSX 10 /* HARDWARE: PowerPC VSX SIMD instructions supported */
|
|
||||||
#endif
|
#endif
|
||||||
#define PNG_OPTION_NEXT 12 /* Next option - numbers must be even */
|
#ifdef PNG_POWERPC_VSX_API_SUPPORTED
|
||||||
|
# define PNG_POWERPC_VSX 10 /* HARDWARE: PowerPC VSX SIMD instructions
|
||||||
|
* supported */
|
||||||
|
#endif
|
||||||
|
#ifdef PNG_MIPS_MMI_API_SUPPORTED
|
||||||
|
# define PNG_MIPS_MMI 12 /* HARDWARE: MIPS MMI SIMD instructions supported */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PNG_OPTION_NEXT 14 /* Next option - numbers must be even */
|
||||||
|
|
||||||
/* Return values: NOTE: there are four values and 'off' is *not* zero */
|
/* Return values: NOTE: there are four values and 'off' is *not* zero */
|
||||||
#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */
|
#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */
|
||||||
|
|
|
||||||
4
thirdparty/libpng/pngconf.h
vendored
4
thirdparty/libpng/pngconf.h
vendored
|
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
/* pngconf.h - machine-configurable file for libpng
|
/* pngconf.h - machine-configurable file for libpng
|
||||||
*
|
*
|
||||||
* libpng version 1.6.39
|
* libpng version 1.6.43
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2022 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
|
||||||
34
thirdparty/libpng/pngerror.c
vendored
34
thirdparty/libpng/pngerror.c
vendored
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* pngerror.c - stub functions for i/o and memory allocation
|
/* pngerror.c - stub functions for i/o and memory allocation
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
@ -255,7 +255,7 @@ void
|
||||||
png_warning_parameter_unsigned(png_warning_parameters p, int number, int format,
|
png_warning_parameter_unsigned(png_warning_parameters p, int number, int format,
|
||||||
png_alloc_size_t value)
|
png_alloc_size_t value)
|
||||||
{
|
{
|
||||||
char buffer[PNG_NUMBER_BUFFER_SIZE];
|
char buffer[PNG_NUMBER_BUFFER_SIZE] = {0};
|
||||||
png_warning_parameter(p, number, PNG_FORMAT_NUMBER(buffer, format, value));
|
png_warning_parameter(p, number, PNG_FORMAT_NUMBER(buffer, format, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -265,7 +265,7 @@ png_warning_parameter_signed(png_warning_parameters p, int number, int format,
|
||||||
{
|
{
|
||||||
png_alloc_size_t u;
|
png_alloc_size_t u;
|
||||||
png_charp str;
|
png_charp str;
|
||||||
char buffer[PNG_NUMBER_BUFFER_SIZE];
|
char buffer[PNG_NUMBER_BUFFER_SIZE] = {0};
|
||||||
|
|
||||||
/* Avoid overflow by doing the negate in a png_alloc_size_t: */
|
/* Avoid overflow by doing the negate in a png_alloc_size_t: */
|
||||||
u = (png_alloc_size_t)value;
|
u = (png_alloc_size_t)value;
|
||||||
|
|
@ -858,7 +858,7 @@ png_get_error_ptr(png_const_structrp png_ptr)
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return ((png_voidp)png_ptr->error_ptr);
|
return (png_voidp)png_ptr->error_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -933,31 +933,25 @@ png_safe_warning(png_structp png_nonconst_ptr, png_const_charp warning_message)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int /* PRIVATE */
|
int /* PRIVATE */
|
||||||
png_safe_execute(png_imagep image_in, int (*function)(png_voidp), png_voidp arg)
|
png_safe_execute(png_imagep image, int (*function)(png_voidp), png_voidp arg)
|
||||||
{
|
{
|
||||||
volatile png_imagep image = image_in;
|
png_voidp saved_error_buf = image->opaque->error_buf;
|
||||||
volatile int result;
|
|
||||||
volatile png_voidp saved_error_buf;
|
|
||||||
jmp_buf safe_jmpbuf;
|
jmp_buf safe_jmpbuf;
|
||||||
|
int result;
|
||||||
|
|
||||||
/* Safely execute function(arg) with png_error returning to this function. */
|
/* Safely execute function(arg), with png_error returning back here. */
|
||||||
saved_error_buf = image->opaque->error_buf;
|
if (setjmp(safe_jmpbuf) == 0)
|
||||||
result = setjmp(safe_jmpbuf) == 0;
|
|
||||||
|
|
||||||
if (result != 0)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
image->opaque->error_buf = safe_jmpbuf;
|
image->opaque->error_buf = safe_jmpbuf;
|
||||||
result = function(arg);
|
result = function(arg);
|
||||||
|
image->opaque->error_buf = saved_error_buf;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* On png_error, return via longjmp, pop the jmpbuf, and free the image. */
|
||||||
image->opaque->error_buf = saved_error_buf;
|
image->opaque->error_buf = saved_error_buf;
|
||||||
|
png_image_free(image);
|
||||||
/* And do the cleanup prior to any failure return. */
|
return 0;
|
||||||
if (result == 0)
|
|
||||||
png_image_free(image);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
#endif /* SIMPLIFIED READ || SIMPLIFIED_WRITE */
|
#endif /* SIMPLIFIED READ || SIMPLIFIED_WRITE */
|
||||||
#endif /* READ || WRITE */
|
#endif /* READ || WRITE */
|
||||||
|
|
|
||||||
254
thirdparty/libpng/pngget.c
vendored
254
thirdparty/libpng/pngget.c
vendored
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* pngget.c - retrieval of values from info struct
|
/* pngget.c - retrieval of values from info struct
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
@ -21,18 +21,29 @@ png_get_valid(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
png_uint_32 flag)
|
png_uint_32 flag)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
return(info_ptr->valid & flag);
|
{
|
||||||
|
#ifdef PNG_READ_tRNS_SUPPORTED
|
||||||
|
/* png_handle_PLTE() may have canceled a valid tRNS chunk but left the
|
||||||
|
* 'valid' flag for the detection of duplicate chunks. Do not report a
|
||||||
|
* valid tRNS chunk in this case.
|
||||||
|
*/
|
||||||
|
if (flag == PNG_INFO_tRNS && png_ptr->num_trans == 0)
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
return(0);
|
return info_ptr->valid & flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t PNGAPI
|
size_t PNGAPI
|
||||||
png_get_rowbytes(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
png_get_rowbytes(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
return(info_ptr->rowbytes);
|
return info_ptr->rowbytes;
|
||||||
|
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_INFO_IMAGE_SUPPORTED
|
#ifdef PNG_INFO_IMAGE_SUPPORTED
|
||||||
|
|
@ -40,9 +51,9 @@ png_bytepp PNGAPI
|
||||||
png_get_rows(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
png_get_rows(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
return(info_ptr->row_pointers);
|
return info_ptr->row_pointers;
|
||||||
|
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -54,7 +65,7 @@ png_get_image_width(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
return info_ptr->width;
|
return info_ptr->width;
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
|
|
@ -63,7 +74,7 @@ png_get_image_height(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
return info_ptr->height;
|
return info_ptr->height;
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_byte PNGAPI
|
png_byte PNGAPI
|
||||||
|
|
@ -72,7 +83,7 @@ png_get_bit_depth(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
return info_ptr->bit_depth;
|
return info_ptr->bit_depth;
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_byte PNGAPI
|
png_byte PNGAPI
|
||||||
|
|
@ -81,7 +92,7 @@ png_get_color_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
return info_ptr->color_type;
|
return info_ptr->color_type;
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_byte PNGAPI
|
png_byte PNGAPI
|
||||||
|
|
@ -90,7 +101,7 @@ png_get_filter_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
return info_ptr->filter_type;
|
return info_ptr->filter_type;
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_byte PNGAPI
|
png_byte PNGAPI
|
||||||
|
|
@ -99,7 +110,7 @@ png_get_interlace_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
return info_ptr->interlace_type;
|
return info_ptr->interlace_type;
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_byte PNGAPI
|
png_byte PNGAPI
|
||||||
|
|
@ -108,7 +119,7 @@ png_get_compression_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
return info_ptr->compression_type;
|
return info_ptr->compression_type;
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
|
|
@ -116,21 +127,20 @@ png_get_x_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
|
||||||
info_ptr)
|
info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_pHYs_SUPPORTED
|
#ifdef PNG_pHYs_SUPPORTED
|
||||||
|
png_debug(1, "in png_get_x_pixels_per_meter");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function",
|
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
|
||||||
"png_get_x_pixels_per_meter");
|
return info_ptr->x_pixels_per_unit;
|
||||||
|
}
|
||||||
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
|
|
||||||
return (info_ptr->x_pixels_per_unit);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
PNG_UNUSED(png_ptr)
|
PNG_UNUSED(png_ptr)
|
||||||
PNG_UNUSED(info_ptr)
|
PNG_UNUSED(info_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
|
|
@ -138,42 +148,41 @@ png_get_y_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
|
||||||
info_ptr)
|
info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_pHYs_SUPPORTED
|
#ifdef PNG_pHYs_SUPPORTED
|
||||||
|
png_debug(1, "in png_get_y_pixels_per_meter");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function",
|
|
||||||
"png_get_y_pixels_per_meter");
|
|
||||||
|
|
||||||
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
|
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
|
||||||
return (info_ptr->y_pixels_per_unit);
|
return info_ptr->y_pixels_per_unit;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
PNG_UNUSED(png_ptr)
|
PNG_UNUSED(png_ptr)
|
||||||
PNG_UNUSED(info_ptr)
|
PNG_UNUSED(info_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
png_get_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_pHYs_SUPPORTED
|
#ifdef PNG_pHYs_SUPPORTED
|
||||||
|
png_debug(1, "in png_get_pixels_per_meter");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "png_get_pixels_per_meter");
|
|
||||||
|
|
||||||
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER &&
|
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER &&
|
||||||
info_ptr->x_pixels_per_unit == info_ptr->y_pixels_per_unit)
|
info_ptr->x_pixels_per_unit == info_ptr->y_pixels_per_unit)
|
||||||
return (info_ptr->x_pixels_per_unit);
|
return info_ptr->x_pixels_per_unit;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
PNG_UNUSED(png_ptr)
|
PNG_UNUSED(png_ptr)
|
||||||
PNG_UNUSED(info_ptr)
|
PNG_UNUSED(info_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
|
|
@ -182,21 +191,21 @@ png_get_pixel_aspect_ratio(png_const_structrp png_ptr, png_const_inforp
|
||||||
info_ptr)
|
info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_READ_pHYs_SUPPORTED
|
#ifdef PNG_READ_pHYs_SUPPORTED
|
||||||
|
png_debug(1, "in png_get_pixel_aspect_ratio");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio");
|
|
||||||
|
|
||||||
if (info_ptr->x_pixels_per_unit != 0)
|
if (info_ptr->x_pixels_per_unit != 0)
|
||||||
return ((float)((float)info_ptr->y_pixels_per_unit
|
return (float)info_ptr->y_pixels_per_unit
|
||||||
/(float)info_ptr->x_pixels_per_unit));
|
/ (float)info_ptr->x_pixels_per_unit;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
PNG_UNUSED(png_ptr)
|
PNG_UNUSED(png_ptr)
|
||||||
PNG_UNUSED(info_ptr)
|
PNG_UNUSED(info_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ((float)0.0);
|
return (float)0.0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -206,6 +215,8 @@ png_get_pixel_aspect_ratio_fixed(png_const_structrp png_ptr,
|
||||||
png_const_inforp info_ptr)
|
png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_READ_pHYs_SUPPORTED
|
#ifdef PNG_READ_pHYs_SUPPORTED
|
||||||
|
png_debug(1, "in png_get_pixel_aspect_ratio_fixed");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_pHYs) != 0 &&
|
(info_ptr->valid & PNG_INFO_pHYs) != 0 &&
|
||||||
info_ptr->x_pixels_per_unit > 0 && info_ptr->y_pixels_per_unit > 0 &&
|
info_ptr->x_pixels_per_unit > 0 && info_ptr->y_pixels_per_unit > 0 &&
|
||||||
|
|
@ -214,8 +225,6 @@ png_get_pixel_aspect_ratio_fixed(png_const_structrp png_ptr,
|
||||||
{
|
{
|
||||||
png_fixed_point res;
|
png_fixed_point res;
|
||||||
|
|
||||||
png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio_fixed");
|
|
||||||
|
|
||||||
/* The following casts work because a PNG 4 byte integer only has a valid
|
/* The following casts work because a PNG 4 byte integer only has a valid
|
||||||
* range of 0..2^31-1; otherwise the cast might overflow.
|
* range of 0..2^31-1; otherwise the cast might overflow.
|
||||||
*/
|
*/
|
||||||
|
|
@ -236,80 +245,80 @@ png_int_32 PNGAPI
|
||||||
png_get_x_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
png_get_x_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_oFFs_SUPPORTED
|
#ifdef PNG_oFFs_SUPPORTED
|
||||||
|
png_debug(1, "in png_get_x_offset_microns");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
|
|
||||||
|
|
||||||
if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
|
if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
|
||||||
return (info_ptr->x_offset);
|
return info_ptr->x_offset;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
PNG_UNUSED(png_ptr)
|
PNG_UNUSED(png_ptr)
|
||||||
PNG_UNUSED(info_ptr)
|
PNG_UNUSED(info_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_int_32 PNGAPI
|
png_int_32 PNGAPI
|
||||||
png_get_y_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
png_get_y_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_oFFs_SUPPORTED
|
#ifdef PNG_oFFs_SUPPORTED
|
||||||
|
png_debug(1, "in png_get_y_offset_microns");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
|
|
||||||
|
|
||||||
if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
|
if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
|
||||||
return (info_ptr->y_offset);
|
return info_ptr->y_offset;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
PNG_UNUSED(png_ptr)
|
PNG_UNUSED(png_ptr)
|
||||||
PNG_UNUSED(info_ptr)
|
PNG_UNUSED(info_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_int_32 PNGAPI
|
png_int_32 PNGAPI
|
||||||
png_get_x_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
png_get_x_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_oFFs_SUPPORTED
|
#ifdef PNG_oFFs_SUPPORTED
|
||||||
|
png_debug(1, "in png_get_x_offset_pixels");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "png_get_x_offset_pixels");
|
|
||||||
|
|
||||||
if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
|
if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
|
||||||
return (info_ptr->x_offset);
|
return info_ptr->x_offset;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
PNG_UNUSED(png_ptr)
|
PNG_UNUSED(png_ptr)
|
||||||
PNG_UNUSED(info_ptr)
|
PNG_UNUSED(info_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_int_32 PNGAPI
|
png_int_32 PNGAPI
|
||||||
png_get_y_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
png_get_y_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_oFFs_SUPPORTED
|
#ifdef PNG_oFFs_SUPPORTED
|
||||||
|
png_debug(1, "in png_get_y_offset_pixels");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "png_get_y_offset_pixels");
|
|
||||||
|
|
||||||
if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
|
if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
|
||||||
return (info_ptr->y_offset);
|
return info_ptr->y_offset;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
PNG_UNUSED(png_ptr)
|
PNG_UNUSED(png_ptr)
|
||||||
PNG_UNUSED(info_ptr)
|
PNG_UNUSED(info_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_INCH_CONVERSIONS_SUPPORTED
|
#ifdef PNG_INCH_CONVERSIONS_SUPPORTED
|
||||||
|
|
@ -423,11 +432,11 @@ png_get_pHYs_dpi(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
{
|
{
|
||||||
png_uint_32 retval = 0;
|
png_uint_32 retval = 0;
|
||||||
|
|
||||||
|
png_debug1(1, "in %s retrieval function", "pHYs");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "pHYs");
|
|
||||||
|
|
||||||
if (res_x != NULL)
|
if (res_x != NULL)
|
||||||
{
|
{
|
||||||
*res_x = info_ptr->x_pixels_per_unit;
|
*res_x = info_ptr->x_pixels_per_unit;
|
||||||
|
|
@ -453,7 +462,7 @@ png_get_pHYs_dpi(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (retval);
|
return retval;
|
||||||
}
|
}
|
||||||
#endif /* pHYs */
|
#endif /* pHYs */
|
||||||
#endif /* INCH_CONVERSIONS */
|
#endif /* INCH_CONVERSIONS */
|
||||||
|
|
@ -467,9 +476,9 @@ png_byte PNGAPI
|
||||||
png_get_channels(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
png_get_channels(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
return(info_ptr->channels);
|
return info_ptr->channels;
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
#ifdef PNG_READ_SUPPORTED
|
||||||
|
|
@ -477,9 +486,9 @@ png_const_bytep PNGAPI
|
||||||
png_get_signature(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
png_get_signature(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
return(info_ptr->signature);
|
return info_ptr->signature;
|
||||||
|
|
||||||
return (NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -488,17 +497,17 @@ png_uint_32 PNGAPI
|
||||||
png_get_bKGD(png_const_structrp png_ptr, png_inforp info_ptr,
|
png_get_bKGD(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
png_color_16p *background)
|
png_color_16p *background)
|
||||||
{
|
{
|
||||||
|
png_debug1(1, "in %s retrieval function", "bKGD");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_bKGD) != 0 &&
|
(info_ptr->valid & PNG_INFO_bKGD) != 0 &&
|
||||||
background != NULL)
|
background != NULL)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "bKGD");
|
|
||||||
|
|
||||||
*background = &(info_ptr->background);
|
*background = &(info_ptr->background);
|
||||||
return (PNG_INFO_bKGD);
|
return PNG_INFO_bKGD;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -513,6 +522,8 @@ png_get_cHRM(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
double *white_x, double *white_y, double *red_x, double *red_y,
|
double *white_x, double *white_y, double *red_x, double *red_y,
|
||||||
double *green_x, double *green_y, double *blue_x, double *blue_y)
|
double *green_x, double *green_y, double *blue_x, double *blue_y)
|
||||||
{
|
{
|
||||||
|
png_debug1(1, "in %s retrieval function", "cHRM");
|
||||||
|
|
||||||
/* Quiet API change: this code used to only return the end points if a cHRM
|
/* Quiet API change: this code used to only return the end points if a cHRM
|
||||||
* chunk was present, but the end points can also come from iCCP or sRGB
|
* chunk was present, but the end points can also come from iCCP or sRGB
|
||||||
* chunks, so in 1.6.0 the png_get_ APIs return the end points regardless and
|
* chunks, so in 1.6.0 the png_get_ APIs return the end points regardless and
|
||||||
|
|
@ -522,8 +533,6 @@ png_get_cHRM(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
|
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "cHRM");
|
|
||||||
|
|
||||||
if (white_x != NULL)
|
if (white_x != NULL)
|
||||||
*white_x = png_float(png_ptr,
|
*white_x = png_float(png_ptr,
|
||||||
info_ptr->colorspace.end_points_xy.whitex, "cHRM white X");
|
info_ptr->colorspace.end_points_xy.whitex, "cHRM white X");
|
||||||
|
|
@ -548,10 +557,10 @@ png_get_cHRM(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
if (blue_y != NULL)
|
if (blue_y != NULL)
|
||||||
*blue_y = png_float(png_ptr, info_ptr->colorspace.end_points_xy.bluey,
|
*blue_y = png_float(png_ptr, info_ptr->colorspace.end_points_xy.bluey,
|
||||||
"cHRM blue Y");
|
"cHRM blue Y");
|
||||||
return (PNG_INFO_cHRM);
|
return PNG_INFO_cHRM;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
|
|
@ -560,11 +569,11 @@ png_get_cHRM_XYZ(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
double *green_Y, double *green_Z, double *blue_X, double *blue_Y,
|
double *green_Y, double *green_Z, double *blue_X, double *blue_Y,
|
||||||
double *blue_Z)
|
double *blue_Z)
|
||||||
{
|
{
|
||||||
|
png_debug1(1, "in %s retrieval function", "cHRM_XYZ(float)");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
|
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "cHRM_XYZ(float)");
|
|
||||||
|
|
||||||
if (red_X != NULL)
|
if (red_X != NULL)
|
||||||
*red_X = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_X,
|
*red_X = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_X,
|
||||||
"cHRM red X");
|
"cHRM red X");
|
||||||
|
|
@ -592,10 +601,10 @@ png_get_cHRM_XYZ(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
if (blue_Z != NULL)
|
if (blue_Z != NULL)
|
||||||
*blue_Z = png_float(png_ptr,
|
*blue_Z = png_float(png_ptr,
|
||||||
info_ptr->colorspace.end_points_XYZ.blue_Z, "cHRM blue Z");
|
info_ptr->colorspace.end_points_XYZ.blue_Z, "cHRM blue Z");
|
||||||
return (PNG_INFO_cHRM);
|
return PNG_INFO_cHRM;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
|
@ -608,11 +617,11 @@ png_get_cHRM_XYZ_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y,
|
png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y,
|
||||||
png_fixed_point *int_blue_Z)
|
png_fixed_point *int_blue_Z)
|
||||||
{
|
{
|
||||||
|
png_debug1(1, "in %s retrieval function", "cHRM_XYZ");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
|
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "cHRM_XYZ");
|
|
||||||
|
|
||||||
if (int_red_X != NULL)
|
if (int_red_X != NULL)
|
||||||
*int_red_X = info_ptr->colorspace.end_points_XYZ.red_X;
|
*int_red_X = info_ptr->colorspace.end_points_XYZ.red_X;
|
||||||
if (int_red_Y != NULL)
|
if (int_red_Y != NULL)
|
||||||
|
|
@ -631,10 +640,10 @@ png_get_cHRM_XYZ_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
*int_blue_Y = info_ptr->colorspace.end_points_XYZ.blue_Y;
|
*int_blue_Y = info_ptr->colorspace.end_points_XYZ.blue_Y;
|
||||||
if (int_blue_Z != NULL)
|
if (int_blue_Z != NULL)
|
||||||
*int_blue_Z = info_ptr->colorspace.end_points_XYZ.blue_Z;
|
*int_blue_Z = info_ptr->colorspace.end_points_XYZ.blue_Z;
|
||||||
return (PNG_INFO_cHRM);
|
return PNG_INFO_cHRM;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
|
|
@ -664,10 +673,10 @@ png_get_cHRM_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
*blue_x = info_ptr->colorspace.end_points_xy.bluex;
|
*blue_x = info_ptr->colorspace.end_points_xy.bluex;
|
||||||
if (blue_y != NULL)
|
if (blue_y != NULL)
|
||||||
*blue_y = info_ptr->colorspace.end_points_xy.bluey;
|
*blue_y = info_ptr->colorspace.end_points_xy.bluey;
|
||||||
return (PNG_INFO_cHRM);
|
return PNG_INFO_cHRM;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -685,10 +694,10 @@ png_get_gAMA_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
file_gamma != NULL)
|
file_gamma != NULL)
|
||||||
{
|
{
|
||||||
*file_gamma = info_ptr->colorspace.gamma;
|
*file_gamma = info_ptr->colorspace.gamma;
|
||||||
return (PNG_INFO_gAMA);
|
return PNG_INFO_gAMA;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
|
@ -705,10 +714,10 @@ png_get_gAMA(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
{
|
{
|
||||||
*file_gamma = png_float(png_ptr, info_ptr->colorspace.gamma,
|
*file_gamma = png_float(png_ptr, info_ptr->colorspace.gamma,
|
||||||
"png_get_gAMA");
|
"png_get_gAMA");
|
||||||
return (PNG_INFO_gAMA);
|
return PNG_INFO_gAMA;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -724,10 +733,10 @@ png_get_sRGB(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
(info_ptr->valid & PNG_INFO_sRGB) != 0 && file_srgb_intent != NULL)
|
(info_ptr->valid & PNG_INFO_sRGB) != 0 && file_srgb_intent != NULL)
|
||||||
{
|
{
|
||||||
*file_srgb_intent = info_ptr->colorspace.rendering_intent;
|
*file_srgb_intent = info_ptr->colorspace.rendering_intent;
|
||||||
return (PNG_INFO_sRGB);
|
return PNG_INFO_sRGB;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -751,10 +760,10 @@ png_get_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
*/
|
*/
|
||||||
if (compression_type != NULL)
|
if (compression_type != NULL)
|
||||||
*compression_type = PNG_COMPRESSION_TYPE_BASE;
|
*compression_type = PNG_COMPRESSION_TYPE_BASE;
|
||||||
return (PNG_INFO_iCCP);
|
return PNG_INFO_iCCP;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -764,13 +773,15 @@ int PNGAPI
|
||||||
png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr,
|
png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
png_sPLT_tpp spalettes)
|
png_sPLT_tpp spalettes)
|
||||||
{
|
{
|
||||||
|
png_debug1(1, "in %s retrieval function", "sPLT");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL)
|
if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL)
|
||||||
{
|
{
|
||||||
*spalettes = info_ptr->splt_palettes;
|
*spalettes = info_ptr->splt_palettes;
|
||||||
return info_ptr->splt_palettes_num;
|
return info_ptr->splt_palettes_num;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -796,10 +807,10 @@ png_get_eXIf_1(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
{
|
{
|
||||||
*num_exif = info_ptr->num_exif;
|
*num_exif = info_ptr->num_exif;
|
||||||
*exif = info_ptr->exif;
|
*exif = info_ptr->exif;
|
||||||
return (PNG_INFO_eXIf);
|
return PNG_INFO_eXIf;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -814,10 +825,10 @@ png_get_hIST(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
(info_ptr->valid & PNG_INFO_hIST) != 0 && hist != NULL)
|
(info_ptr->valid & PNG_INFO_hIST) != 0 && hist != NULL)
|
||||||
{
|
{
|
||||||
*hist = info_ptr->hist;
|
*hist = info_ptr->hist;
|
||||||
return (PNG_INFO_hIST);
|
return PNG_INFO_hIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -830,7 +841,7 @@ png_get_IHDR(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
png_debug1(1, "in %s retrieval function", "IHDR");
|
png_debug1(1, "in %s retrieval function", "IHDR");
|
||||||
|
|
||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
return (0);
|
return 0;
|
||||||
|
|
||||||
if (width != NULL)
|
if (width != NULL)
|
||||||
*width = info_ptr->width;
|
*width = info_ptr->width;
|
||||||
|
|
@ -862,7 +873,7 @@ png_get_IHDR(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
info_ptr->bit_depth, info_ptr->color_type, info_ptr->interlace_type,
|
info_ptr->bit_depth, info_ptr->color_type, info_ptr->interlace_type,
|
||||||
info_ptr->compression_type, info_ptr->filter_type);
|
info_ptr->compression_type, info_ptr->filter_type);
|
||||||
|
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_oFFs_SUPPORTED
|
#ifdef PNG_oFFs_SUPPORTED
|
||||||
|
|
@ -879,10 +890,10 @@ png_get_oFFs(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
*offset_x = info_ptr->x_offset;
|
*offset_x = info_ptr->x_offset;
|
||||||
*offset_y = info_ptr->y_offset;
|
*offset_y = info_ptr->y_offset;
|
||||||
*unit_type = (int)info_ptr->offset_unit_type;
|
*unit_type = (int)info_ptr->offset_unit_type;
|
||||||
return (PNG_INFO_oFFs);
|
return PNG_INFO_oFFs;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -906,10 +917,10 @@ png_get_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
*nparams = (int)info_ptr->pcal_nparams;
|
*nparams = (int)info_ptr->pcal_nparams;
|
||||||
*units = info_ptr->pcal_units;
|
*units = info_ptr->pcal_units;
|
||||||
*params = info_ptr->pcal_params;
|
*params = info_ptr->pcal_params;
|
||||||
return (PNG_INFO_pCAL);
|
return PNG_INFO_pCAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -921,6 +932,8 @@ png_uint_32 PNGAPI
|
||||||
png_get_sCAL_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
png_get_sCAL_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
int *unit, png_fixed_point *width, png_fixed_point *height)
|
int *unit, png_fixed_point *width, png_fixed_point *height)
|
||||||
{
|
{
|
||||||
|
png_debug1(1, "in %s retrieval function", "sCAL");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_sCAL) != 0)
|
(info_ptr->valid & PNG_INFO_sCAL) != 0)
|
||||||
{
|
{
|
||||||
|
|
@ -932,10 +945,10 @@ png_get_sCAL_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
*width = png_fixed(png_ptr, atof(info_ptr->scal_s_width), "sCAL width");
|
*width = png_fixed(png_ptr, atof(info_ptr->scal_s_width), "sCAL width");
|
||||||
*height = png_fixed(png_ptr, atof(info_ptr->scal_s_height),
|
*height = png_fixed(png_ptr, atof(info_ptr->scal_s_height),
|
||||||
"sCAL height");
|
"sCAL height");
|
||||||
return (PNG_INFO_sCAL);
|
return PNG_INFO_sCAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
# endif /* FLOATING_ARITHMETIC */
|
# endif /* FLOATING_ARITHMETIC */
|
||||||
# endif /* FIXED_POINT */
|
# endif /* FIXED_POINT */
|
||||||
|
|
@ -944,32 +957,36 @@ png_uint_32 PNGAPI
|
||||||
png_get_sCAL(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
png_get_sCAL(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
int *unit, double *width, double *height)
|
int *unit, double *width, double *height)
|
||||||
{
|
{
|
||||||
|
png_debug1(1, "in %s retrieval function", "sCAL(float)");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_sCAL) != 0)
|
(info_ptr->valid & PNG_INFO_sCAL) != 0)
|
||||||
{
|
{
|
||||||
*unit = info_ptr->scal_unit;
|
*unit = info_ptr->scal_unit;
|
||||||
*width = atof(info_ptr->scal_s_width);
|
*width = atof(info_ptr->scal_s_width);
|
||||||
*height = atof(info_ptr->scal_s_height);
|
*height = atof(info_ptr->scal_s_height);
|
||||||
return (PNG_INFO_sCAL);
|
return PNG_INFO_sCAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
# endif /* FLOATING POINT */
|
# endif /* FLOATING POINT */
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_sCAL_s(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
png_get_sCAL_s(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
int *unit, png_charpp width, png_charpp height)
|
int *unit, png_charpp width, png_charpp height)
|
||||||
{
|
{
|
||||||
|
png_debug1(1, "in %s retrieval function", "sCAL(str)");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_sCAL) != 0)
|
(info_ptr->valid & PNG_INFO_sCAL) != 0)
|
||||||
{
|
{
|
||||||
*unit = info_ptr->scal_unit;
|
*unit = info_ptr->scal_unit;
|
||||||
*width = info_ptr->scal_s_width;
|
*width = info_ptr->scal_s_width;
|
||||||
*height = info_ptr->scal_s_height;
|
*height = info_ptr->scal_s_height;
|
||||||
return (PNG_INFO_sCAL);
|
return PNG_INFO_sCAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* sCAL */
|
#endif /* sCAL */
|
||||||
|
|
||||||
|
|
@ -1004,7 +1021,7 @@ png_get_pHYs(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (retval);
|
return retval;
|
||||||
}
|
}
|
||||||
#endif /* pHYs */
|
#endif /* pHYs */
|
||||||
|
|
||||||
|
|
@ -1020,10 +1037,10 @@ png_get_PLTE(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
*palette = info_ptr->palette;
|
*palette = info_ptr->palette;
|
||||||
*num_palette = info_ptr->num_palette;
|
*num_palette = info_ptr->num_palette;
|
||||||
png_debug1(3, "num_palette = %d", *num_palette);
|
png_debug1(3, "num_palette = %d", *num_palette);
|
||||||
return (PNG_INFO_PLTE);
|
return PNG_INFO_PLTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_sBIT_SUPPORTED
|
#ifdef PNG_sBIT_SUPPORTED
|
||||||
|
|
@ -1037,10 +1054,10 @@ png_get_sBIT(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
(info_ptr->valid & PNG_INFO_sBIT) != 0 && sig_bit != NULL)
|
(info_ptr->valid & PNG_INFO_sBIT) != 0 && sig_bit != NULL)
|
||||||
{
|
{
|
||||||
*sig_bit = &(info_ptr->sig_bit);
|
*sig_bit = &(info_ptr->sig_bit);
|
||||||
return (PNG_INFO_sBIT);
|
return PNG_INFO_sBIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -1051,7 +1068,7 @@ png_get_text(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0)
|
if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in 0x%lx retrieval function",
|
png_debug1(1, "in text retrieval function, chunk typeid = 0x%lx",
|
||||||
(unsigned long)png_ptr->chunk_name);
|
(unsigned long)png_ptr->chunk_name);
|
||||||
|
|
||||||
if (text_ptr != NULL)
|
if (text_ptr != NULL)
|
||||||
|
|
@ -1066,7 +1083,7 @@ png_get_text(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
if (num_text != NULL)
|
if (num_text != NULL)
|
||||||
*num_text = 0;
|
*num_text = 0;
|
||||||
|
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -1081,10 +1098,10 @@ png_get_tIME(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
(info_ptr->valid & PNG_INFO_tIME) != 0 && mod_time != NULL)
|
(info_ptr->valid & PNG_INFO_tIME) != 0 && mod_time != NULL)
|
||||||
{
|
{
|
||||||
*mod_time = &(info_ptr->mod_time);
|
*mod_time = &(info_ptr->mod_time);
|
||||||
return (PNG_INFO_tIME);
|
return PNG_INFO_tIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -1094,11 +1111,12 @@ png_get_tRNS(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)
|
png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)
|
||||||
{
|
{
|
||||||
png_uint_32 retval = 0;
|
png_uint_32 retval = 0;
|
||||||
|
|
||||||
|
png_debug1(1, "in %s retrieval function", "tRNS");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_tRNS) != 0)
|
(info_ptr->valid & PNG_INFO_tRNS) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "tRNS");
|
|
||||||
|
|
||||||
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
{
|
{
|
||||||
if (trans_alpha != NULL)
|
if (trans_alpha != NULL)
|
||||||
|
|
@ -1130,7 +1148,7 @@ png_get_tRNS(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (retval);
|
return retval;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -1145,7 +1163,7 @@ png_get_unknown_chunks(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
return info_ptr->unknown_chunks_num;
|
return info_ptr->unknown_chunks_num;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -1241,7 +1259,7 @@ png_get_palette_max(png_const_structp png_ptr, png_const_infop info_ptr)
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
return png_ptr->num_palette_max;
|
return png_ptr->num_palette_max;
|
||||||
|
|
||||||
return (-1);
|
return -1;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
9
thirdparty/libpng/pnglibconf.h
vendored
9
thirdparty/libpng/pnglibconf.h
vendored
|
|
@ -1,8 +1,8 @@
|
||||||
/* pnglibconf.h - library build configuration */
|
/* pnglibconf.h - library build configuration */
|
||||||
|
|
||||||
/* libpng version 1.6.39 */
|
/* libpng version 1.6.43 */
|
||||||
|
|
||||||
/* Copyright (c) 2018-2022 Cosmin Truta */
|
/* Copyright (c) 2018-2024 Cosmin Truta */
|
||||||
/* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */
|
/* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */
|
||||||
|
|
||||||
/* This code is released under the libpng license. */
|
/* This code is released under the libpng license. */
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
#define PNG_COLORSPACE_SUPPORTED
|
#define PNG_COLORSPACE_SUPPORTED
|
||||||
#define PNG_CONSOLE_IO_SUPPORTED
|
#define PNG_CONSOLE_IO_SUPPORTED
|
||||||
#define PNG_CONVERT_tIME_SUPPORTED
|
#define PNG_CONVERT_tIME_SUPPORTED
|
||||||
|
/*#undef PNG_DISABLE_ADLER32_CHECK_SUPPORTED*/
|
||||||
#define PNG_EASY_ACCESS_SUPPORTED
|
#define PNG_EASY_ACCESS_SUPPORTED
|
||||||
/*#undef PNG_ERROR_NUMBERS_SUPPORTED*/
|
/*#undef PNG_ERROR_NUMBERS_SUPPORTED*/
|
||||||
#define PNG_ERROR_TEXT_SUPPORTED
|
#define PNG_ERROR_TEXT_SUPPORTED
|
||||||
|
|
@ -41,6 +42,10 @@
|
||||||
#define PNG_INCH_CONVERSIONS_SUPPORTED
|
#define PNG_INCH_CONVERSIONS_SUPPORTED
|
||||||
#define PNG_INFO_IMAGE_SUPPORTED
|
#define PNG_INFO_IMAGE_SUPPORTED
|
||||||
#define PNG_IO_STATE_SUPPORTED
|
#define PNG_IO_STATE_SUPPORTED
|
||||||
|
/*#undef PNG_MIPS_MMI_API_SUPPORTED*/
|
||||||
|
/*#undef PNG_MIPS_MMI_CHECK_SUPPORTED*/
|
||||||
|
/*#undef PNG_MIPS_MSA_API_SUPPORTED*/
|
||||||
|
/*#undef PNG_MIPS_MSA_CHECK_SUPPORTED*/
|
||||||
#define PNG_MNG_FEATURES_SUPPORTED
|
#define PNG_MNG_FEATURES_SUPPORTED
|
||||||
#define PNG_POINTER_INDEXING_SUPPORTED
|
#define PNG_POINTER_INDEXING_SUPPORTED
|
||||||
/*#undef PNG_POWERPC_VSX_API_SUPPORTED*/
|
/*#undef PNG_POWERPC_VSX_API_SUPPORTED*/
|
||||||
|
|
|
||||||
16
thirdparty/libpng/pngpread.c
vendored
16
thirdparty/libpng/pngpread.c
vendored
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* pngpread.c - read a png file in push mode
|
/* pngpread.c - read a png file in push mode
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
@ -145,10 +145,10 @@ png_push_read_sig(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
num_to_check);
|
num_to_check);
|
||||||
png_ptr->sig_bytes = (png_byte)(png_ptr->sig_bytes + num_to_check);
|
png_ptr->sig_bytes = (png_byte)(png_ptr->sig_bytes + num_to_check);
|
||||||
|
|
||||||
if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check))
|
if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check) != 0)
|
||||||
{
|
{
|
||||||
if (num_checked < 4 &&
|
if (num_checked < 4 &&
|
||||||
png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4))
|
png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4) != 0)
|
||||||
png_error(png_ptr, "Not a PNG file");
|
png_error(png_ptr, "Not a PNG file");
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
@ -294,6 +294,14 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
png_handle_cHRM(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_cHRM(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#ifdef PNG_READ_eXIf_SUPPORTED
|
||||||
|
else if (png_ptr->chunk_name == png_eXIf)
|
||||||
|
{
|
||||||
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
|
png_handle_eXIf(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef PNG_READ_sRGB_SUPPORTED
|
#ifdef PNG_READ_sRGB_SUPPORTED
|
||||||
else if (chunk_name == png_sRGB)
|
else if (chunk_name == png_sRGB)
|
||||||
|
|
@ -1089,7 +1097,7 @@ png_voidp PNGAPI
|
||||||
png_get_progressive_ptr(png_const_structrp png_ptr)
|
png_get_progressive_ptr(png_const_structrp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return (NULL);
|
return NULL;
|
||||||
|
|
||||||
return png_ptr->io_ptr;
|
return png_ptr->io_ptr;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
122
thirdparty/libpng/pngpriv.h
vendored
122
thirdparty/libpng/pngpriv.h
vendored
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* pngpriv.h - private declarations for use inside libpng
|
/* pngpriv.h - private declarations for use inside libpng
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2022 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
* still required (as of 2011-05-02.)
|
* still required (as of 2011-05-02.)
|
||||||
*/
|
*/
|
||||||
#ifndef _POSIX_SOURCE
|
#ifndef _POSIX_SOURCE
|
||||||
# define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */
|
# define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PNG_VERSION_INFO_ONLY
|
#ifndef PNG_VERSION_INFO_ONLY
|
||||||
|
|
@ -190,13 +190,27 @@
|
||||||
#endif /* PNG_ARM_NEON_OPT > 0 */
|
#endif /* PNG_ARM_NEON_OPT > 0 */
|
||||||
|
|
||||||
#ifndef PNG_MIPS_MSA_OPT
|
#ifndef PNG_MIPS_MSA_OPT
|
||||||
# if defined(__mips_msa) && (__mips_isa_rev >= 5) && defined(PNG_ALIGNED_MEMORY_SUPPORTED)
|
# if defined(__mips_msa) && (__mips_isa_rev >= 5) && \
|
||||||
|
defined(PNG_ALIGNED_MEMORY_SUPPORTED)
|
||||||
# define PNG_MIPS_MSA_OPT 2
|
# define PNG_MIPS_MSA_OPT 2
|
||||||
# else
|
# else
|
||||||
# define PNG_MIPS_MSA_OPT 0
|
# define PNG_MIPS_MSA_OPT 0
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef PNG_MIPS_MMI_OPT
|
||||||
|
# ifdef PNG_MIPS_MMI
|
||||||
|
# if defined(__mips_loongson_mmi) && (_MIPS_SIM == _ABI64) && \
|
||||||
|
defined(PNG_ALIGNED_MEMORY_SUPPORTED)
|
||||||
|
# define PNG_MIPS_MMI_OPT 1
|
||||||
|
# else
|
||||||
|
# define PNG_MIPS_MMI_OPT 0
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# define PNG_MIPS_MMI_OPT 0
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef PNG_POWERPC_VSX_OPT
|
#ifndef PNG_POWERPC_VSX_OPT
|
||||||
# if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__)
|
# if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__)
|
||||||
# define PNG_POWERPC_VSX_OPT 2
|
# define PNG_POWERPC_VSX_OPT 2
|
||||||
|
|
@ -205,13 +219,21 @@
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef PNG_LOONGARCH_LSX_OPT
|
||||||
|
# if defined(__loongarch_sx)
|
||||||
|
# define PNG_LOONGARCH_LSX_OPT 1
|
||||||
|
# else
|
||||||
|
# define PNG_LOONGARCH_LSX_OPT 0
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef PNG_INTEL_SSE_OPT
|
#ifndef PNG_INTEL_SSE_OPT
|
||||||
# ifdef PNG_INTEL_SSE
|
# ifdef PNG_INTEL_SSE
|
||||||
/* Only check for SSE if the build configuration has been modified to
|
/* Only check for SSE if the build configuration has been modified to
|
||||||
* enable SSE optimizations. This means that these optimizations will
|
* enable SSE optimizations. This means that these optimizations will
|
||||||
* be off by default. See contrib/intel for more details.
|
* be off by default. See contrib/intel for more details.
|
||||||
*/
|
*/
|
||||||
# if defined(__SSE4_1__) || defined(__AVX__) || defined(__SSSE3__) || \
|
# if defined(__SSE4_1__) || defined(__AVX__) || defined(__SSSE3__) || \
|
||||||
defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \
|
defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \
|
||||||
(defined(_M_IX86_FP) && _M_IX86_FP >= 2)
|
(defined(_M_IX86_FP) && _M_IX86_FP >= 2)
|
||||||
# define PNG_INTEL_SSE_OPT 1
|
# define PNG_INTEL_SSE_OPT 1
|
||||||
|
|
@ -248,7 +270,6 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if PNG_MIPS_MSA_OPT > 0
|
#if PNG_MIPS_MSA_OPT > 0
|
||||||
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_msa
|
|
||||||
# ifndef PNG_MIPS_MSA_IMPLEMENTATION
|
# ifndef PNG_MIPS_MSA_IMPLEMENTATION
|
||||||
# if defined(__mips_msa)
|
# if defined(__mips_msa)
|
||||||
# if defined(__clang__)
|
# if defined(__clang__)
|
||||||
|
|
@ -264,11 +285,28 @@
|
||||||
|
|
||||||
# ifndef PNG_MIPS_MSA_IMPLEMENTATION
|
# ifndef PNG_MIPS_MSA_IMPLEMENTATION
|
||||||
# define PNG_MIPS_MSA_IMPLEMENTATION 1
|
# define PNG_MIPS_MSA_IMPLEMENTATION 1
|
||||||
|
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_mips
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# define PNG_MIPS_MSA_IMPLEMENTATION 0
|
# define PNG_MIPS_MSA_IMPLEMENTATION 0
|
||||||
#endif /* PNG_MIPS_MSA_OPT > 0 */
|
#endif /* PNG_MIPS_MSA_OPT > 0 */
|
||||||
|
|
||||||
|
#if PNG_MIPS_MMI_OPT > 0
|
||||||
|
# ifndef PNG_MIPS_MMI_IMPLEMENTATION
|
||||||
|
# if defined(__mips_loongson_mmi) && (_MIPS_SIM == _ABI64)
|
||||||
|
# define PNG_MIPS_MMI_IMPLEMENTATION 2
|
||||||
|
# else /* !defined __mips_loongson_mmi || _MIPS_SIM != _ABI64 */
|
||||||
|
# define PNG_MIPS_MMI_IMPLEMENTATION 0
|
||||||
|
# endif /* __mips_loongson_mmi && _MIPS_SIM == _ABI64 */
|
||||||
|
# endif /* !PNG_MIPS_MMI_IMPLEMENTATION */
|
||||||
|
|
||||||
|
# if PNG_MIPS_MMI_IMPLEMENTATION > 0
|
||||||
|
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_mips
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define PNG_MIPS_MMI_IMPLEMENTATION 0
|
||||||
|
#endif /* PNG_MIPS_MMI_OPT > 0 */
|
||||||
|
|
||||||
#if PNG_POWERPC_VSX_OPT > 0
|
#if PNG_POWERPC_VSX_OPT > 0
|
||||||
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_vsx
|
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_vsx
|
||||||
# define PNG_POWERPC_VSX_IMPLEMENTATION 1
|
# define PNG_POWERPC_VSX_IMPLEMENTATION 1
|
||||||
|
|
@ -276,6 +314,12 @@
|
||||||
# define PNG_POWERPC_VSX_IMPLEMENTATION 0
|
# define PNG_POWERPC_VSX_IMPLEMENTATION 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if PNG_LOONGARCH_LSX_OPT > 0
|
||||||
|
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_lsx
|
||||||
|
# define PNG_LOONGARCH_LSX_IMPLEMENTATION 1
|
||||||
|
#else
|
||||||
|
# define PNG_LOONGARCH_LSX_IMPLEMENTATION 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Is this a build of a DLL where compilation of the object modules requires
|
/* Is this a build of a DLL where compilation of the object modules requires
|
||||||
* different preprocessor settings to those required for a simple library? If
|
* different preprocessor settings to those required for a simple library? If
|
||||||
|
|
@ -514,18 +558,8 @@
|
||||||
*/
|
*/
|
||||||
# include <float.h>
|
# include <float.h>
|
||||||
|
|
||||||
# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
|
# include <math.h>
|
||||||
defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
|
|
||||||
/* We need to check that <math.h> hasn't already been included earlier
|
|
||||||
* as it seems it doesn't agree with <fp.h>, yet we should really use
|
|
||||||
* <fp.h> if possible.
|
|
||||||
*/
|
|
||||||
# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
|
|
||||||
# include <fp.h>
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
# include <math.h>
|
|
||||||
# endif
|
|
||||||
# if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
|
# if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
|
||||||
/* Amiga SAS/C: We must include builtin FPU functions when compiling using
|
/* Amiga SAS/C: We must include builtin FPU functions when compiling using
|
||||||
* MATH=68881
|
* MATH=68881
|
||||||
|
|
@ -626,7 +660,7 @@
|
||||||
#define PNG_BACKGROUND_IS_GRAY 0x800U
|
#define PNG_BACKGROUND_IS_GRAY 0x800U
|
||||||
#define PNG_HAVE_PNG_SIGNATURE 0x1000U
|
#define PNG_HAVE_PNG_SIGNATURE 0x1000U
|
||||||
#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000U /* Have another chunk after IDAT */
|
#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000U /* Have another chunk after IDAT */
|
||||||
/* 0x4000U (unused) */
|
#define PNG_WROTE_eXIf 0x4000U
|
||||||
#define PNG_IS_READ_STRUCT 0x8000U /* Else is a write struct */
|
#define PNG_IS_READ_STRUCT 0x8000U /* Else is a write struct */
|
||||||
|
|
||||||
/* Flags for the transformations the PNG library does on the image data */
|
/* Flags for the transformations the PNG library does on the image data */
|
||||||
|
|
@ -1306,7 +1340,7 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_neon,(png_row_infop
|
||||||
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if PNG_MIPS_MSA_OPT > 0
|
#if PNG_MIPS_MSA_IMPLEMENTATION == 1
|
||||||
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_msa,(png_row_infop row_info,
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_msa,(png_row_infop row_info,
|
||||||
png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_msa,(png_row_infop
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_msa,(png_row_infop
|
||||||
|
|
@ -1323,6 +1357,23 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_msa,(png_row_infop
|
||||||
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if PNG_MIPS_MMI_IMPLEMENTATION > 0
|
||||||
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_mmi,(png_row_infop row_info,
|
||||||
|
png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_mmi,(png_row_infop
|
||||||
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_mmi,(png_row_infop
|
||||||
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_mmi,(png_row_infop
|
||||||
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_mmi,(png_row_infop
|
||||||
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_mmi,(png_row_infop
|
||||||
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_mmi,(png_row_infop
|
||||||
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if PNG_POWERPC_VSX_OPT > 0
|
#if PNG_POWERPC_VSX_OPT > 0
|
||||||
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_vsx,(png_row_infop row_info,
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_vsx,(png_row_infop row_info,
|
||||||
png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
|
|
@ -1355,6 +1406,23 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_sse2,(png_row_infop
|
||||||
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if PNG_LOONGARCH_LSX_IMPLEMENTATION == 1
|
||||||
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_lsx,(png_row_infop
|
||||||
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_lsx,(png_row_infop
|
||||||
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_lsx,(png_row_infop
|
||||||
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_lsx,(png_row_infop
|
||||||
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_lsx,(png_row_infop
|
||||||
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_lsx,(png_row_infop
|
||||||
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_lsx,(png_row_infop
|
||||||
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Choose the best filter to use and filter the row data */
|
/* Choose the best filter to use and filter the row data */
|
||||||
PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr,
|
PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr,
|
||||||
png_row_infop row_info),PNG_EMPTY);
|
png_row_infop row_info),PNG_EMPTY);
|
||||||
|
|
@ -1910,7 +1978,7 @@ PNG_INTERNAL_FUNCTION(void,png_ascii_from_fixed,(png_const_structrp png_ptr,
|
||||||
*/
|
*/
|
||||||
#define PNG_FP_INVALID 512 /* Available for callers as a distinct value */
|
#define PNG_FP_INVALID 512 /* Available for callers as a distinct value */
|
||||||
|
|
||||||
/* Result codes for the parser (boolean - true meants ok, false means
|
/* Result codes for the parser (boolean - true means ok, false means
|
||||||
* not ok yet.)
|
* not ok yet.)
|
||||||
*/
|
*/
|
||||||
#define PNG_FP_MAYBE 0 /* The number may be valid in the future */
|
#define PNG_FP_MAYBE 0 /* The number may be valid in the future */
|
||||||
|
|
@ -2094,17 +2162,27 @@ PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
|
||||||
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if PNG_MIPS_MSA_OPT > 0
|
#if PNG_MIPS_MSA_IMPLEMENTATION == 1
|
||||||
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_msa,
|
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_mips,
|
||||||
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
# if PNG_MIPS_MMI_IMPLEMENTATION > 0
|
||||||
|
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_mips,
|
||||||
|
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
||||||
|
# endif
|
||||||
|
|
||||||
# if PNG_INTEL_SSE_IMPLEMENTATION > 0
|
# if PNG_INTEL_SSE_IMPLEMENTATION > 0
|
||||||
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2,
|
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2,
|
||||||
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if PNG_LOONGARCH_LSX_OPT > 0
|
||||||
|
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_lsx,
|
||||||
|
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
||||||
|
#endif
|
||||||
|
|
||||||
PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,
|
PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,
|
||||||
png_const_charp key, png_bytep new_key), PNG_EMPTY);
|
png_const_charp key, png_bytep new_key), PNG_EMPTY);
|
||||||
|
|
||||||
|
|
|
||||||
12
thirdparty/libpng/pngread.c
vendored
12
thirdparty/libpng/pngread.c
vendored
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* pngread.c - read a PNG file
|
/* pngread.c - read a PNG file
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2019 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
@ -568,7 +568,11 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
|
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
|
||||||
if (png_ptr->transformations)
|
if (png_ptr->transformations
|
||||||
|
# ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||||
|
|| png_ptr->num_palette_max >= 0
|
||||||
|
# endif
|
||||||
|
)
|
||||||
png_do_read_transformations(png_ptr, &row_info);
|
png_do_read_transformations(png_ptr, &row_info);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -785,7 +789,7 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
#ifdef PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
#ifdef PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||||
/* Report invalid palette index; added at libng-1.5.10 */
|
/* Report invalid palette index; added at libng-1.5.10 */
|
||||||
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
|
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
|
||||||
png_ptr->num_palette_max > png_ptr->num_palette)
|
png_ptr->num_palette_max >= png_ptr->num_palette)
|
||||||
png_benign_error(png_ptr, "Read palette index exceeding num_palette");
|
png_benign_error(png_ptr, "Read palette index exceeding num_palette");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -1049,6 +1053,8 @@ void PNGAPI
|
||||||
png_read_png(png_structrp png_ptr, png_inforp info_ptr,
|
png_read_png(png_structrp png_ptr, png_inforp info_ptr,
|
||||||
int transforms, voidp params)
|
int transforms, voidp params)
|
||||||
{
|
{
|
||||||
|
png_debug(1, "in png_read_png");
|
||||||
|
|
||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
34
thirdparty/libpng/pngrtran.c
vendored
34
thirdparty/libpng/pngrtran.c
vendored
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2019 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
@ -290,21 +290,20 @@ png_set_alpha_mode_fixed(png_structrp png_ptr, int mode,
|
||||||
int compose = 0;
|
int compose = 0;
|
||||||
png_fixed_point file_gamma;
|
png_fixed_point file_gamma;
|
||||||
|
|
||||||
png_debug(1, "in png_set_alpha_mode");
|
png_debug(1, "in png_set_alpha_mode_fixed");
|
||||||
|
|
||||||
if (png_rtran_ok(png_ptr, 0) == 0)
|
if (png_rtran_ok(png_ptr, 0) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
output_gamma = translate_gamma_flags(png_ptr, output_gamma, 1/*screen*/);
|
output_gamma = translate_gamma_flags(png_ptr, output_gamma, 1/*screen*/);
|
||||||
|
|
||||||
/* Validate the value to ensure it is in a reasonable range. The value
|
/* Validate the value to ensure it is in a reasonable range. The value
|
||||||
* is expected to be 1 or greater, but this range test allows for some
|
* is expected to be 1 or greater, but this range test allows for some
|
||||||
* viewing correction values. The intent is to weed out users of this API
|
* viewing correction values. The intent is to weed out the API users
|
||||||
* who use the inverse of the gamma value accidentally! Since some of these
|
* who might use the inverse of the gamma value accidentally!
|
||||||
* values are reasonable this may have to be changed:
|
|
||||||
*
|
*
|
||||||
* 1.6.x: changed from 0.07..3 to 0.01..100 (to accommodate the optimal 16-bit
|
* In libpng 1.6.0, we changed from 0.07..3 to 0.01..100, to accommodate
|
||||||
* gamma of 36, and its reciprocal.)
|
* the optimal 16-bit gamma of 36 and its reciprocal.
|
||||||
*/
|
*/
|
||||||
if (output_gamma < 1000 || output_gamma > 10000000)
|
if (output_gamma < 1000 || output_gamma > 10000000)
|
||||||
png_error(png_ptr, "output gamma out of expected range");
|
png_error(png_ptr, "output gamma out of expected range");
|
||||||
|
|
@ -441,7 +440,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr,
|
png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte))));
|
(png_alloc_size_t)num_palette);
|
||||||
for (i = 0; i < num_palette; i++)
|
for (i = 0; i < num_palette; i++)
|
||||||
png_ptr->quantize_index[i] = (png_byte)i;
|
png_ptr->quantize_index[i] = (png_byte)i;
|
||||||
}
|
}
|
||||||
|
|
@ -458,7 +457,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
||||||
|
|
||||||
/* Initialize an array to sort colors */
|
/* Initialize an array to sort colors */
|
||||||
png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr,
|
png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte))));
|
(png_alloc_size_t)num_palette);
|
||||||
|
|
||||||
/* Initialize the quantize_sort array */
|
/* Initialize the quantize_sort array */
|
||||||
for (i = 0; i < num_palette; i++)
|
for (i = 0; i < num_palette; i++)
|
||||||
|
|
@ -592,11 +591,9 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
||||||
|
|
||||||
/* Initialize palette index arrays */
|
/* Initialize palette index arrays */
|
||||||
png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr,
|
png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_alloc_size_t)((png_uint_32)num_palette *
|
(png_alloc_size_t)num_palette);
|
||||||
(sizeof (png_byte))));
|
|
||||||
png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr,
|
png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_alloc_size_t)((png_uint_32)num_palette *
|
(png_alloc_size_t)num_palette);
|
||||||
(sizeof (png_byte))));
|
|
||||||
|
|
||||||
/* Initialize the sort array */
|
/* Initialize the sort array */
|
||||||
for (i = 0; i < num_palette; i++)
|
for (i = 0; i < num_palette; i++)
|
||||||
|
|
@ -761,12 +758,11 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
||||||
size_t num_entries = ((size_t)1 << total_bits);
|
size_t num_entries = ((size_t)1 << total_bits);
|
||||||
|
|
||||||
png_ptr->palette_lookup = (png_bytep)png_calloc(png_ptr,
|
png_ptr->palette_lookup = (png_bytep)png_calloc(png_ptr,
|
||||||
(png_alloc_size_t)(num_entries * (sizeof (png_byte))));
|
(png_alloc_size_t)(num_entries));
|
||||||
|
|
||||||
distance = (png_bytep)png_malloc(png_ptr, (png_alloc_size_t)(num_entries *
|
distance = (png_bytep)png_malloc(png_ptr, (png_alloc_size_t)num_entries);
|
||||||
(sizeof (png_byte))));
|
|
||||||
|
|
||||||
memset(distance, 0xff, num_entries * (sizeof (png_byte)));
|
memset(distance, 0xff, num_entries);
|
||||||
|
|
||||||
for (i = 0; i < num_palette; i++)
|
for (i = 0; i < num_palette; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -970,7 +966,7 @@ void PNGFAPI
|
||||||
png_set_rgb_to_gray_fixed(png_structrp png_ptr, int error_action,
|
png_set_rgb_to_gray_fixed(png_structrp png_ptr, int error_action,
|
||||||
png_fixed_point red, png_fixed_point green)
|
png_fixed_point red, png_fixed_point green)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_rgb_to_gray");
|
png_debug(1, "in png_set_rgb_to_gray_fixed");
|
||||||
|
|
||||||
/* Need the IHDR here because of the check on color_type below. */
|
/* Need the IHDR here because of the check on color_type below. */
|
||||||
/* TODO: fix this */
|
/* TODO: fix this */
|
||||||
|
|
|
||||||
19
thirdparty/libpng/pngrutil.c
vendored
19
thirdparty/libpng/pngrutil.c
vendored
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* pngrutil.c - utilities to read a PNG file
|
/* pngrutil.c - utilities to read a PNG file
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2022 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
@ -26,7 +26,7 @@ png_get_uint_31(png_const_structrp png_ptr, png_const_bytep buf)
|
||||||
if (uval > PNG_UINT_31_MAX)
|
if (uval > PNG_UINT_31_MAX)
|
||||||
png_error(png_ptr, "PNG unsigned integer out of range");
|
png_error(png_ptr, "PNG unsigned integer out of range");
|
||||||
|
|
||||||
return (uval);
|
return uval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_READ_gAMA_SUPPORTED) || defined(PNG_READ_cHRM_SUPPORTED)
|
#if defined(PNG_READ_gAMA_SUPPORTED) || defined(PNG_READ_cHRM_SUPPORTED)
|
||||||
|
|
@ -140,7 +140,7 @@ png_read_sig(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check) != 0)
|
if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check) != 0)
|
||||||
{
|
{
|
||||||
if (num_checked < 4 &&
|
if (num_checked < 4 &&
|
||||||
png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4))
|
png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4) != 0)
|
||||||
png_error(png_ptr, "Not a PNG file");
|
png_error(png_ptr, "Not a PNG file");
|
||||||
else
|
else
|
||||||
png_error(png_ptr, "PNG file corrupted by ASCII conversion");
|
png_error(png_ptr, "PNG file corrupted by ASCII conversion");
|
||||||
|
|
@ -171,7 +171,7 @@ png_read_chunk_header(png_structrp png_ptr)
|
||||||
/* Put the chunk name into png_ptr->chunk_name. */
|
/* Put the chunk name into png_ptr->chunk_name. */
|
||||||
png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(buf+4);
|
png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(buf+4);
|
||||||
|
|
||||||
png_debug2(0, "Reading %lx chunk, length = %lu",
|
png_debug2(0, "Reading chunk typeid = 0x%lx, length = %lu",
|
||||||
(unsigned long)png_ptr->chunk_name, (unsigned long)length);
|
(unsigned long)png_ptr->chunk_name, (unsigned long)length);
|
||||||
|
|
||||||
/* Reset the crc and run it over the chunk name. */
|
/* Reset the crc and run it over the chunk name. */
|
||||||
|
|
@ -238,10 +238,10 @@ png_crc_finish(png_structrp png_ptr, png_uint_32 skip)
|
||||||
else
|
else
|
||||||
png_chunk_error(png_ptr, "CRC error");
|
png_chunk_error(png_ptr, "CRC error");
|
||||||
|
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compare the CRC stored in the PNG file with that calculated by libpng from
|
/* Compare the CRC stored in the PNG file with that calculated by libpng from
|
||||||
|
|
@ -277,11 +277,11 @@ png_crc_error(png_structrp png_ptr)
|
||||||
if (need_crc != 0)
|
if (need_crc != 0)
|
||||||
{
|
{
|
||||||
crc = png_get_uint_32(crc_bytes);
|
crc = png_get_uint_32(crc_bytes);
|
||||||
return ((int)(crc != png_ptr->crc));
|
return crc != png_ptr->crc;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_READ_iCCP_SUPPORTED) || defined(PNG_READ_iTXt_SUPPORTED) ||\
|
#if defined(PNG_READ_iCCP_SUPPORTED) || defined(PNG_READ_iTXt_SUPPORTED) ||\
|
||||||
|
|
@ -421,8 +421,7 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
|
||||||
png_ptr->flags |= PNG_FLAG_ZSTREAM_INITIALIZED;
|
png_ptr->flags |= PNG_FLAG_ZSTREAM_INITIALIZED;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ZLIB_VERNUM >= 0x1290 && \
|
#ifdef PNG_DISABLE_ADLER32_CHECK_SUPPORTED
|
||||||
defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_IGNORE_ADLER32)
|
|
||||||
if (((png_ptr->options >> PNG_IGNORE_ADLER32) & 3) == PNG_OPTION_ON)
|
if (((png_ptr->options >> PNG_IGNORE_ADLER32) & 3) == PNG_OPTION_ON)
|
||||||
/* Turn off validation of the ADLER32 checksum in IDAT chunks */
|
/* Turn off validation of the ADLER32 checksum in IDAT chunks */
|
||||||
ret = inflateValidate(&png_ptr->zstream, 0);
|
ret = inflateValidate(&png_ptr->zstream, 0);
|
||||||
|
|
|
||||||
82
thirdparty/libpng/pngset.c
vendored
82
thirdparty/libpng/pngset.c
vendored
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* pngset.c - storage of image information into info struct
|
/* pngset.c - storage of image information into info struct
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2022 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
@ -137,46 +137,40 @@ png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X,
|
||||||
#ifdef PNG_eXIf_SUPPORTED
|
#ifdef PNG_eXIf_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
|
png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
png_bytep eXIf_buf)
|
png_bytep exif)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "png_set_eXIf does not work; use png_set_eXIf_1");
|
png_warning(png_ptr, "png_set_eXIf does not work; use png_set_eXIf_1");
|
||||||
PNG_UNUSED(info_ptr)
|
PNG_UNUSED(info_ptr)
|
||||||
PNG_UNUSED(eXIf_buf)
|
PNG_UNUSED(exif)
|
||||||
}
|
}
|
||||||
|
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_eXIf_1(png_const_structrp png_ptr, png_inforp info_ptr,
|
png_set_eXIf_1(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
png_uint_32 num_exif, png_bytep eXIf_buf)
|
png_uint_32 num_exif, png_bytep exif)
|
||||||
{
|
{
|
||||||
int i;
|
png_bytep new_exif;
|
||||||
|
|
||||||
png_debug1(1, "in %s storage function", "eXIf");
|
png_debug1(1, "in %s storage function", "eXIf");
|
||||||
|
|
||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL ||
|
||||||
|
(png_ptr->mode & PNG_WROTE_eXIf) != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (info_ptr->exif)
|
new_exif = png_voidcast(png_bytep, png_malloc_warn(png_ptr, num_exif));
|
||||||
{
|
|
||||||
png_free(png_ptr, info_ptr->exif);
|
|
||||||
info_ptr->exif = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
info_ptr->num_exif = num_exif;
|
if (new_exif == NULL)
|
||||||
|
|
||||||
info_ptr->exif = png_voidcast(png_bytep, png_malloc_warn(png_ptr,
|
|
||||||
info_ptr->num_exif));
|
|
||||||
|
|
||||||
if (info_ptr->exif == NULL)
|
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Insufficient memory for eXIf chunk data");
|
png_warning(png_ptr, "Insufficient memory for eXIf chunk data");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memcpy(new_exif, exif, (size_t)num_exif);
|
||||||
|
|
||||||
|
png_free_data(png_ptr, info_ptr, PNG_FREE_EXIF, 0);
|
||||||
|
|
||||||
|
info_ptr->num_exif = num_exif;
|
||||||
|
info_ptr->exif = new_exif;
|
||||||
info_ptr->free_me |= PNG_FREE_EXIF;
|
info_ptr->free_me |= PNG_FREE_EXIF;
|
||||||
|
|
||||||
for (i = 0; i < (int) info_ptr->num_exif; i++)
|
|
||||||
info_ptr->exif[i] = eXIf_buf[i];
|
|
||||||
|
|
||||||
info_ptr->valid |= PNG_INFO_eXIf;
|
info_ptr->valid |= PNG_INFO_eXIf;
|
||||||
}
|
}
|
||||||
#endif /* eXIf */
|
#endif /* eXIf */
|
||||||
|
|
@ -237,15 +231,13 @@ png_set_hIST(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
if (info_ptr->hist == NULL)
|
if (info_ptr->hist == NULL)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Insufficient memory for hIST chunk data");
|
png_warning(png_ptr, "Insufficient memory for hIST chunk data");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
info_ptr->free_me |= PNG_FREE_HIST;
|
|
||||||
|
|
||||||
for (i = 0; i < info_ptr->num_palette; i++)
|
for (i = 0; i < info_ptr->num_palette; i++)
|
||||||
info_ptr->hist[i] = hist[i];
|
info_ptr->hist[i] = hist[i];
|
||||||
|
|
||||||
|
info_ptr->free_me |= PNG_FREE_HIST;
|
||||||
info_ptr->valid |= PNG_INFO_hIST;
|
info_ptr->valid |= PNG_INFO_hIST;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -367,6 +359,8 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
|
|
||||||
memcpy(info_ptr->pcal_purpose, purpose, length);
|
memcpy(info_ptr->pcal_purpose, purpose, length);
|
||||||
|
|
||||||
|
info_ptr->free_me |= PNG_FREE_PCAL;
|
||||||
|
|
||||||
png_debug(3, "storing X0, X1, type, and nparams in info");
|
png_debug(3, "storing X0, X1, type, and nparams in info");
|
||||||
info_ptr->pcal_X0 = X0;
|
info_ptr->pcal_X0 = X0;
|
||||||
info_ptr->pcal_X1 = X1;
|
info_ptr->pcal_X1 = X1;
|
||||||
|
|
@ -383,7 +377,6 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
if (info_ptr->pcal_units == NULL)
|
if (info_ptr->pcal_units == NULL)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Insufficient memory for pCAL units");
|
png_warning(png_ptr, "Insufficient memory for pCAL units");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -395,7 +388,6 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
if (info_ptr->pcal_params == NULL)
|
if (info_ptr->pcal_params == NULL)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Insufficient memory for pCAL params");
|
png_warning(png_ptr, "Insufficient memory for pCAL params");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -413,7 +405,6 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
if (info_ptr->pcal_params[i] == NULL)
|
if (info_ptr->pcal_params[i] == NULL)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Insufficient memory for pCAL parameter");
|
png_warning(png_ptr, "Insufficient memory for pCAL parameter");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -421,7 +412,6 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
}
|
}
|
||||||
|
|
||||||
info_ptr->valid |= PNG_INFO_pCAL;
|
info_ptr->valid |= PNG_INFO_pCAL;
|
||||||
info_ptr->free_me |= PNG_FREE_PCAL;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -478,18 +468,17 @@ png_set_sCAL_s(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
|
|
||||||
if (info_ptr->scal_s_height == NULL)
|
if (info_ptr->scal_s_height == NULL)
|
||||||
{
|
{
|
||||||
png_free (png_ptr, info_ptr->scal_s_width);
|
png_free(png_ptr, info_ptr->scal_s_width);
|
||||||
info_ptr->scal_s_width = NULL;
|
info_ptr->scal_s_width = NULL;
|
||||||
|
|
||||||
png_warning(png_ptr, "Memory allocation failed while processing sCAL");
|
png_warning(png_ptr, "Memory allocation failed while processing sCAL");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(info_ptr->scal_s_height, sheight, lengthh);
|
memcpy(info_ptr->scal_s_height, sheight, lengthh);
|
||||||
|
|
||||||
info_ptr->valid |= PNG_INFO_sCAL;
|
|
||||||
info_ptr->free_me |= PNG_FREE_SCAL;
|
info_ptr->free_me |= PNG_FREE_SCAL;
|
||||||
|
info_ptr->valid |= PNG_INFO_sCAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
|
|
@ -625,11 +614,10 @@ png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr,
|
||||||
if (num_palette > 0)
|
if (num_palette > 0)
|
||||||
memcpy(png_ptr->palette, palette, (unsigned int)num_palette *
|
memcpy(png_ptr->palette, palette, (unsigned int)num_palette *
|
||||||
(sizeof (png_color)));
|
(sizeof (png_color)));
|
||||||
|
|
||||||
info_ptr->palette = png_ptr->palette;
|
info_ptr->palette = png_ptr->palette;
|
||||||
info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;
|
info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;
|
||||||
|
|
||||||
info_ptr->free_me |= PNG_FREE_PLTE;
|
info_ptr->free_me |= PNG_FREE_PLTE;
|
||||||
|
|
||||||
info_ptr->valid |= PNG_INFO_PLTE;
|
info_ptr->valid |= PNG_INFO_PLTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -775,11 +763,11 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
png_debug1(1, "in %lx storage function", png_ptr == NULL ? 0xabadca11U :
|
png_debug1(1, "in text storage function, chunk typeid = 0x%lx",
|
||||||
(unsigned long)png_ptr->chunk_name);
|
png_ptr == NULL ? 0xabadca11UL : (unsigned long)png_ptr->chunk_name);
|
||||||
|
|
||||||
if (png_ptr == NULL || info_ptr == NULL || num_text <= 0 || text_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL || num_text <= 0 || text_ptr == NULL)
|
||||||
return(0);
|
return 0;
|
||||||
|
|
||||||
/* Make sure we have enough space in the "text" array in info_struct
|
/* Make sure we have enough space in the "text" array in info_struct
|
||||||
* to hold all of the incoming text_ptr objects. This compare can't overflow
|
* to hold all of the incoming text_ptr objects. This compare can't overflow
|
||||||
|
|
@ -959,7 +947,7 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
png_debug1(3, "transferred text chunk %d", info_ptr->num_text);
|
png_debug1(3, "transferred text chunk %d", info_ptr->num_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -1020,8 +1008,8 @@ png_set_tRNS(png_structrp png_ptr, png_inforp info_ptr,
|
||||||
png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH));
|
png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH));
|
||||||
memcpy(info_ptr->trans_alpha, trans_alpha, (size_t)num_trans);
|
memcpy(info_ptr->trans_alpha, trans_alpha, (size_t)num_trans);
|
||||||
|
|
||||||
info_ptr->valid |= PNG_INFO_tRNS;
|
|
||||||
info_ptr->free_me |= PNG_FREE_TRNS;
|
info_ptr->free_me |= PNG_FREE_TRNS;
|
||||||
|
info_ptr->valid |= PNG_INFO_tRNS;
|
||||||
}
|
}
|
||||||
png_ptr->trans_alpha = info_ptr->trans_alpha;
|
png_ptr->trans_alpha = info_ptr->trans_alpha;
|
||||||
}
|
}
|
||||||
|
|
@ -1054,8 +1042,8 @@ png_set_tRNS(png_structrp png_ptr, png_inforp info_ptr,
|
||||||
|
|
||||||
if (num_trans != 0)
|
if (num_trans != 0)
|
||||||
{
|
{
|
||||||
info_ptr->valid |= PNG_INFO_tRNS;
|
|
||||||
info_ptr->free_me |= PNG_FREE_TRNS;
|
info_ptr->free_me |= PNG_FREE_TRNS;
|
||||||
|
info_ptr->valid |= PNG_INFO_tRNS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1075,6 +1063,8 @@ png_set_sPLT(png_const_structrp png_ptr,
|
||||||
{
|
{
|
||||||
png_sPLT_tp np;
|
png_sPLT_tp np;
|
||||||
|
|
||||||
|
png_debug1(1, "in %s storage function", "sPLT");
|
||||||
|
|
||||||
if (png_ptr == NULL || info_ptr == NULL || nentries <= 0 || entries == NULL)
|
if (png_ptr == NULL || info_ptr == NULL || nentries <= 0 || entries == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1089,11 +1079,11 @@ png_set_sPLT(png_const_structrp png_ptr,
|
||||||
{
|
{
|
||||||
/* Out of memory or too many chunks */
|
/* Out of memory or too many chunks */
|
||||||
png_chunk_report(png_ptr, "too many sPLT chunks", PNG_CHUNK_WRITE_ERROR);
|
png_chunk_report(png_ptr, "too many sPLT chunks", PNG_CHUNK_WRITE_ERROR);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_free(png_ptr, info_ptr->splt_palettes);
|
png_free(png_ptr, info_ptr->splt_palettes);
|
||||||
|
|
||||||
info_ptr->splt_palettes = np;
|
info_ptr->splt_palettes = np;
|
||||||
info_ptr->free_me |= PNG_FREE_SPLT;
|
info_ptr->free_me |= PNG_FREE_SPLT;
|
||||||
|
|
||||||
|
|
@ -1247,11 +1237,11 @@ png_set_unknown_chunks(png_const_structrp png_ptr,
|
||||||
{
|
{
|
||||||
png_chunk_report(png_ptr, "too many unknown chunks",
|
png_chunk_report(png_ptr, "too many unknown chunks",
|
||||||
PNG_CHUNK_WRITE_ERROR);
|
PNG_CHUNK_WRITE_ERROR);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_free(png_ptr, info_ptr->unknown_chunks);
|
png_free(png_ptr, info_ptr->unknown_chunks);
|
||||||
|
|
||||||
info_ptr->unknown_chunks = np; /* safe because it is initialized */
|
info_ptr->unknown_chunks = np; /* safe because it is initialized */
|
||||||
info_ptr->free_me |= PNG_FREE_UNKN;
|
info_ptr->free_me |= PNG_FREE_UNKN;
|
||||||
|
|
||||||
|
|
@ -1549,7 +1539,7 @@ void PNGAPI
|
||||||
png_set_rows(png_const_structrp png_ptr, png_inforp info_ptr,
|
png_set_rows(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
png_bytepp row_pointers)
|
png_bytepp row_pointers)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s storage function", "rows");
|
png_debug(1, "in png_set_rows");
|
||||||
|
|
||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1568,6 +1558,8 @@ png_set_rows(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_compression_buffer_size(png_structrp png_ptr, size_t size)
|
png_set_compression_buffer_size(png_structrp png_ptr, size_t size)
|
||||||
{
|
{
|
||||||
|
png_debug(1, "in png_set_compression_buffer_size");
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1639,6 +1631,8 @@ void PNGAPI
|
||||||
png_set_user_limits(png_structrp png_ptr, png_uint_32 user_width_max,
|
png_set_user_limits(png_structrp png_ptr, png_uint_32 user_width_max,
|
||||||
png_uint_32 user_height_max)
|
png_uint_32 user_height_max)
|
||||||
{
|
{
|
||||||
|
png_debug(1, "in png_set_user_limits");
|
||||||
|
|
||||||
/* Images with dimensions larger than these limits will be
|
/* Images with dimensions larger than these limits will be
|
||||||
* rejected by png_set_IHDR(). To accept any PNG datastream
|
* rejected by png_set_IHDR(). To accept any PNG datastream
|
||||||
* regardless of dimensions, set both limits to 0x7fffffff.
|
* regardless of dimensions, set both limits to 0x7fffffff.
|
||||||
|
|
@ -1654,6 +1648,8 @@ png_set_user_limits(png_structrp png_ptr, png_uint_32 user_width_max,
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_chunk_cache_max(png_structrp png_ptr, png_uint_32 user_chunk_cache_max)
|
png_set_chunk_cache_max(png_structrp png_ptr, png_uint_32 user_chunk_cache_max)
|
||||||
{
|
{
|
||||||
|
png_debug(1, "in png_set_chunk_cache_max");
|
||||||
|
|
||||||
if (png_ptr != NULL)
|
if (png_ptr != NULL)
|
||||||
png_ptr->user_chunk_cache_max = user_chunk_cache_max;
|
png_ptr->user_chunk_cache_max = user_chunk_cache_max;
|
||||||
}
|
}
|
||||||
|
|
@ -1663,6 +1659,8 @@ void PNGAPI
|
||||||
png_set_chunk_malloc_max(png_structrp png_ptr,
|
png_set_chunk_malloc_max(png_structrp png_ptr,
|
||||||
png_alloc_size_t user_chunk_malloc_max)
|
png_alloc_size_t user_chunk_malloc_max)
|
||||||
{
|
{
|
||||||
|
png_debug(1, "in png_set_chunk_malloc_max");
|
||||||
|
|
||||||
if (png_ptr != NULL)
|
if (png_ptr != NULL)
|
||||||
png_ptr->user_chunk_malloc_max = user_chunk_malloc_max;
|
png_ptr->user_chunk_malloc_max = user_chunk_malloc_max;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
14
thirdparty/libpng/pngtrans.c
vendored
14
thirdparty/libpng/pngtrans.c
vendored
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
@ -103,10 +103,10 @@ png_set_interlace_handling(png_structrp png_ptr)
|
||||||
if (png_ptr != 0 && png_ptr->interlaced != 0)
|
if (png_ptr != 0 && png_ptr->interlaced != 0)
|
||||||
{
|
{
|
||||||
png_ptr->transformations |= PNG_INTERLACE;
|
png_ptr->transformations |= PNG_INTERLACE;
|
||||||
return (7);
|
return 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -498,6 +498,8 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
||||||
png_bytep dp = row; /* destination pointer */
|
png_bytep dp = row; /* destination pointer */
|
||||||
png_bytep ep = row + row_info->rowbytes; /* One beyond end of row */
|
png_bytep ep = row + row_info->rowbytes; /* One beyond end of row */
|
||||||
|
|
||||||
|
png_debug(1, "in png_do_strip_channel");
|
||||||
|
|
||||||
/* At the start sp will point to the first byte to copy and dp to where
|
/* At the start sp will point to the first byte to copy and dp to where
|
||||||
* it is copied to. ep always points just beyond the end of the row, so
|
* it is copied to. ep always points just beyond the end of the row, so
|
||||||
* the loop simply copies (channels-1) channels until sp reaches ep.
|
* the loop simply copies (channels-1) channels until sp reaches ep.
|
||||||
|
|
@ -698,6 +700,8 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
|
png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
|
||||||
{
|
{
|
||||||
|
png_debug(1, "in png_do_check_palette_indexes");
|
||||||
|
|
||||||
if (png_ptr->num_palette < (1 << row_info->bit_depth) &&
|
if (png_ptr->num_palette < (1 << row_info->bit_depth) &&
|
||||||
png_ptr->num_palette > 0) /* num_palette can be 0 in MNG files */
|
png_ptr->num_palette > 0) /* num_palette can be 0 in MNG files */
|
||||||
{
|
{
|
||||||
|
|
@ -708,7 +712,7 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
|
||||||
* forms produced on either GCC or MSVC.
|
* forms produced on either GCC or MSVC.
|
||||||
*/
|
*/
|
||||||
int padding = PNG_PADBITS(row_info->pixel_depth, row_info->width);
|
int padding = PNG_PADBITS(row_info->pixel_depth, row_info->width);
|
||||||
png_bytep rp = png_ptr->row_buf + row_info->rowbytes - 1;
|
png_bytep rp = png_ptr->row_buf + row_info->rowbytes;
|
||||||
|
|
||||||
switch (row_info->bit_depth)
|
switch (row_info->bit_depth)
|
||||||
{
|
{
|
||||||
|
|
@ -833,7 +837,7 @@ png_voidp PNGAPI
|
||||||
png_get_user_transform_ptr(png_const_structrp png_ptr)
|
png_get_user_transform_ptr(png_const_structrp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return (NULL);
|
return NULL;
|
||||||
|
|
||||||
return png_ptr->user_transform_ptr;
|
return png_ptr->user_transform_ptr;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
27
thirdparty/libpng/pngwrite.c
vendored
27
thirdparty/libpng/pngwrite.c
vendored
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* pngwrite.c - general routines to write a PNG file
|
/* pngwrite.c - general routines to write a PNG file
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2022 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
@ -239,7 +239,10 @@ png_write_info(png_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
|
|
||||||
#ifdef PNG_WRITE_eXIf_SUPPORTED
|
#ifdef PNG_WRITE_eXIf_SUPPORTED
|
||||||
if ((info_ptr->valid & PNG_INFO_eXIf) != 0)
|
if ((info_ptr->valid & PNG_INFO_eXIf) != 0)
|
||||||
|
{
|
||||||
png_write_eXIf(png_ptr, info_ptr->exif, info_ptr->num_exif);
|
png_write_eXIf(png_ptr, info_ptr->exif, info_ptr->num_exif);
|
||||||
|
png_ptr->mode |= PNG_WROTE_eXIf;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_hIST_SUPPORTED
|
#ifdef PNG_WRITE_hIST_SUPPORTED
|
||||||
|
|
@ -366,7 +369,8 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
png_error(png_ptr, "No IDATs written into file");
|
png_error(png_ptr, "No IDATs written into file");
|
||||||
|
|
||||||
#ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
#ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||||
if (png_ptr->num_palette_max > png_ptr->num_palette)
|
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
|
||||||
|
png_ptr->num_palette_max >= png_ptr->num_palette)
|
||||||
png_benign_error(png_ptr, "Wrote palette index exceeding num_palette");
|
png_benign_error(png_ptr, "Wrote palette index exceeding num_palette");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -439,8 +443,9 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_eXIf_SUPPORTED
|
#ifdef PNG_WRITE_eXIf_SUPPORTED
|
||||||
if ((info_ptr->valid & PNG_INFO_eXIf) != 0)
|
if ((info_ptr->valid & PNG_INFO_eXIf) != 0 &&
|
||||||
png_write_eXIf(png_ptr, info_ptr->exif, info_ptr->num_exif);
|
(png_ptr->mode & PNG_WROTE_eXIf) == 0)
|
||||||
|
png_write_eXIf(png_ptr, info_ptr->exif, info_ptr->num_exif);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
|
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
|
|
@ -710,12 +715,12 @@ png_write_row(png_structrp png_ptr, png_const_bytep row)
|
||||||
/* 1.5.6: moved from png_struct to be a local structure: */
|
/* 1.5.6: moved from png_struct to be a local structure: */
|
||||||
png_row_info row_info;
|
png_row_info row_info;
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
png_debug2(1, "in png_write_row (row %u, pass %d)",
|
png_debug2(1, "in png_write_row (row %u, pass %d)",
|
||||||
png_ptr->row_number, png_ptr->pass);
|
png_ptr->row_number, png_ptr->pass);
|
||||||
|
|
||||||
|
if (png_ptr == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
/* Initialize transformations and other stuff if first time */
|
/* Initialize transformations and other stuff if first time */
|
||||||
if (png_ptr->row_number == 0 && png_ptr->pass == 0)
|
if (png_ptr->row_number == 0 && png_ptr->pass == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -1206,6 +1211,8 @@ png_set_compression_strategy(png_structrp png_ptr, int strategy)
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_compression_window_bits(png_structrp png_ptr, int window_bits)
|
png_set_compression_window_bits(png_structrp png_ptr, int window_bits)
|
||||||
{
|
{
|
||||||
|
png_debug(1, "in png_set_compression_window_bits");
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1289,6 +1296,8 @@ png_set_text_compression_strategy(png_structrp png_ptr, int strategy)
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_text_compression_window_bits(png_structrp png_ptr, int window_bits)
|
png_set_text_compression_window_bits(png_structrp png_ptr, int window_bits)
|
||||||
{
|
{
|
||||||
|
png_debug(1, "in png_set_text_compression_window_bits");
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1326,6 +1335,8 @@ png_set_text_compression_method(png_structrp png_ptr, int method)
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_write_status_fn(png_structrp png_ptr, png_write_status_ptr write_row_fn)
|
png_set_write_status_fn(png_structrp png_ptr, png_write_status_ptr write_row_fn)
|
||||||
{
|
{
|
||||||
|
png_debug(1, "in png_set_write_status_fn");
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1353,6 +1364,8 @@ void PNGAPI
|
||||||
png_write_png(png_structrp png_ptr, png_inforp info_ptr,
|
png_write_png(png_structrp png_ptr, png_inforp info_ptr,
|
||||||
int transforms, voidp params)
|
int transforms, voidp params)
|
||||||
{
|
{
|
||||||
|
png_debug(1, "in png_write_png");
|
||||||
|
|
||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
10
thirdparty/libpng/pngwutil.c
vendored
10
thirdparty/libpng/pngwutil.c
vendored
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* pngwutil.c - utilities to write a PNG file
|
/* pngwutil.c - utilities to write a PNG file
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2022 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
@ -2311,7 +2311,7 @@ png_setup_sub_row(png_structrp png_ptr, png_uint_32 bpp,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (sum);
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void /* PRIVATE */
|
static void /* PRIVATE */
|
||||||
|
|
@ -2361,7 +2361,7 @@ png_setup_up_row(png_structrp png_ptr, size_t row_bytes, size_t lmins)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (sum);
|
return sum;
|
||||||
}
|
}
|
||||||
static void /* PRIVATE */
|
static void /* PRIVATE */
|
||||||
png_setup_up_row_only(png_structrp png_ptr, size_t row_bytes)
|
png_setup_up_row_only(png_structrp png_ptr, size_t row_bytes)
|
||||||
|
|
@ -2417,7 +2417,7 @@ png_setup_avg_row(png_structrp png_ptr, png_uint_32 bpp,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (sum);
|
return sum;
|
||||||
}
|
}
|
||||||
static void /* PRIVATE */
|
static void /* PRIVATE */
|
||||||
png_setup_avg_row_only(png_structrp png_ptr, png_uint_32 bpp,
|
png_setup_avg_row_only(png_structrp png_ptr, png_uint_32 bpp,
|
||||||
|
|
@ -2500,7 +2500,7 @@ png_setup_paeth_row(png_structrp png_ptr, png_uint_32 bpp,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (sum);
|
return sum;
|
||||||
}
|
}
|
||||||
static void /* PRIVATE */
|
static void /* PRIVATE */
|
||||||
png_setup_paeth_row_only(png_structrp png_ptr, png_uint_32 bpp,
|
png_setup_paeth_row_only(png_structrp png_ptr, png_uint_32 bpp,
|
||||||
|
|
|
||||||
12
thirdparty/minizip/crypt.h
vendored
12
thirdparty/minizip/crypt.h
vendored
|
|
@ -32,8 +32,7 @@
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Return the next byte in the pseudo-random sequence
|
* Return the next byte in the pseudo-random sequence
|
||||||
*/
|
*/
|
||||||
static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab)
|
static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab) {
|
||||||
{
|
|
||||||
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
|
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
|
||||||
* unpredictable manner on 16-bit systems; not a problem
|
* unpredictable manner on 16-bit systems; not a problem
|
||||||
* with any known compiler so far, though */
|
* with any known compiler so far, though */
|
||||||
|
|
@ -46,8 +45,7 @@ static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab)
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Update the encryption keys with the next byte of plain text
|
* Update the encryption keys with the next byte of plain text
|
||||||
*/
|
*/
|
||||||
static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c)
|
static int update_keys(unsigned long* pkeys, const z_crc_t* pcrc_32_tab, int c) {
|
||||||
{
|
|
||||||
(*(pkeys+0)) = CRC32((*(pkeys+0)), c);
|
(*(pkeys+0)) = CRC32((*(pkeys+0)), c);
|
||||||
(*(pkeys+1)) += (*(pkeys+0)) & 0xff;
|
(*(pkeys+1)) += (*(pkeys+0)) & 0xff;
|
||||||
(*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
|
(*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
|
||||||
|
|
@ -63,8 +61,7 @@ static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c)
|
||||||
* Initialize the encryption keys and the random header according to
|
* Initialize the encryption keys and the random header according to
|
||||||
* the given password.
|
* the given password.
|
||||||
*/
|
*/
|
||||||
static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t* pcrc_32_tab)
|
static void init_keys(const char* passwd, unsigned long* pkeys, const z_crc_t* pcrc_32_tab) {
|
||||||
{
|
|
||||||
*(pkeys+0) = 305419896L;
|
*(pkeys+0) = 305419896L;
|
||||||
*(pkeys+1) = 591751049L;
|
*(pkeys+1) = 591751049L;
|
||||||
*(pkeys+2) = 878082192L;
|
*(pkeys+2) = 878082192L;
|
||||||
|
|
@ -93,8 +90,7 @@ static unsigned crypthead(const char* passwd, /* password string */
|
||||||
int bufSize,
|
int bufSize,
|
||||||
unsigned long* pkeys,
|
unsigned long* pkeys,
|
||||||
const z_crc_t* pcrc_32_tab,
|
const z_crc_t* pcrc_32_tab,
|
||||||
unsigned long crcForCrypting)
|
unsigned long crcForCrypting) {
|
||||||
{
|
|
||||||
unsigned n; /* index in random header */
|
unsigned n; /* index in random header */
|
||||||
int t; /* temporary */
|
int t; /* temporary */
|
||||||
int c; /* random byte */
|
int c; /* random byte */
|
||||||
|
|
|
||||||
62
thirdparty/minizip/ioapi.c
vendored
62
thirdparty/minizip/ioapi.c
vendored
|
|
@ -14,7 +14,7 @@
|
||||||
#define _CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__APPLE__) || defined(IOAPI_NO_64)
|
#if defined(__APPLE__) || defined(IOAPI_NO_64) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64)
|
||||||
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
|
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
|
||||||
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
|
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
|
||||||
#define FTELLO_FUNC(stream) ftello(stream)
|
#define FTELLO_FUNC(stream) ftello(stream)
|
||||||
|
|
@ -28,8 +28,7 @@
|
||||||
|
|
||||||
#include "ioapi.h"
|
#include "ioapi.h"
|
||||||
|
|
||||||
voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)
|
voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc, const void*filename, int mode) {
|
||||||
{
|
|
||||||
if (pfilefunc->zfile_func64.zopen64_file != NULL)
|
if (pfilefunc->zfile_func64.zopen64_file != NULL)
|
||||||
return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode);
|
return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode);
|
||||||
else
|
else
|
||||||
|
|
@ -38,8 +37,7 @@ voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin)
|
long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin) {
|
||||||
{
|
|
||||||
if (pfilefunc->zfile_func64.zseek64_file != NULL)
|
if (pfilefunc->zfile_func64.zseek64_file != NULL)
|
||||||
return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin);
|
return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin);
|
||||||
else
|
else
|
||||||
|
|
@ -52,8 +50,7 @@ long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream)
|
ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc, voidpf filestream) {
|
||||||
{
|
|
||||||
if (pfilefunc->zfile_func64.zseek64_file != NULL)
|
if (pfilefunc->zfile_func64.zseek64_file != NULL)
|
||||||
return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream);
|
return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream);
|
||||||
else
|
else
|
||||||
|
|
@ -66,11 +63,9 @@ ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32)
|
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32, const zlib_filefunc_def* p_filefunc32) {
|
||||||
{
|
|
||||||
p_filefunc64_32->zfile_func64.zopen64_file = NULL;
|
p_filefunc64_32->zfile_func64.zopen64_file = NULL;
|
||||||
p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file;
|
p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file;
|
||||||
p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file;
|
|
||||||
p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file;
|
p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file;
|
||||||
p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file;
|
p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file;
|
||||||
p_filefunc64_32->zfile_func64.ztell64_file = NULL;
|
p_filefunc64_32->zfile_func64.ztell64_file = NULL;
|
||||||
|
|
@ -91,16 +86,7 @@ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filef
|
||||||
// GODOT end
|
// GODOT end
|
||||||
|
|
||||||
|
|
||||||
static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode));
|
static voidpf ZCALLBACK fopen_file_func(voidpf opaque, const char* filename, int mode) {
|
||||||
static uLong ZCALLBACK fread_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size));
|
|
||||||
static uLong ZCALLBACK fwrite_file_func OF((voidpf opaque, voidpf stream, const void* buf,uLong size));
|
|
||||||
static ZPOS64_T ZCALLBACK ftell64_file_func OF((voidpf opaque, voidpf stream));
|
|
||||||
static long ZCALLBACK fseek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
|
|
||||||
static int ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream));
|
|
||||||
static int ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream));
|
|
||||||
|
|
||||||
static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode)
|
|
||||||
{
|
|
||||||
FILE* file = NULL;
|
FILE* file = NULL;
|
||||||
const char* mode_fopen = NULL;
|
const char* mode_fopen = NULL;
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
|
|
@ -118,8 +104,7 @@ static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, in
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode)
|
static voidpf ZCALLBACK fopen64_file_func(voidpf opaque, const void* filename, int mode) {
|
||||||
{
|
|
||||||
FILE* file = NULL;
|
FILE* file = NULL;
|
||||||
const char* mode_fopen = NULL;
|
const char* mode_fopen = NULL;
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
|
|
@ -138,24 +123,21 @@ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size)
|
static uLong ZCALLBACK fread_file_func(voidpf opaque, voidpf stream, void* buf, uLong size) {
|
||||||
{
|
|
||||||
uLong ret;
|
uLong ret;
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
|
ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size)
|
static uLong ZCALLBACK fwrite_file_func(voidpf opaque, voidpf stream, const void* buf, uLong size) {
|
||||||
{
|
|
||||||
uLong ret;
|
uLong ret;
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
|
ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
|
static long ZCALLBACK ftell_file_func(voidpf opaque, voidpf stream) {
|
||||||
{
|
|
||||||
long ret;
|
long ret;
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
ret = ftell((FILE *)stream);
|
ret = ftell((FILE *)stream);
|
||||||
|
|
@ -163,16 +145,14 @@ static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
|
static ZPOS64_T ZCALLBACK ftell64_file_func(voidpf opaque, voidpf stream) {
|
||||||
{
|
|
||||||
ZPOS64_T ret;
|
ZPOS64_T ret;
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
ret = (ZPOS64_T)FTELLO_FUNC((FILE *)stream);
|
ret = (ZPOS64_T)FTELLO_FUNC((FILE *)stream);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin)
|
static long ZCALLBACK fseek_file_func(voidpf opaque, voidpf stream, uLong offset, int origin) {
|
||||||
{
|
|
||||||
int fseek_origin=0;
|
int fseek_origin=0;
|
||||||
long ret;
|
long ret;
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
|
|
@ -195,8 +175,7 @@ static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offs
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)
|
static long ZCALLBACK fseek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) {
|
||||||
{
|
|
||||||
int fseek_origin=0;
|
int fseek_origin=0;
|
||||||
long ret;
|
long ret;
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
|
|
@ -215,32 +194,28 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T
|
||||||
}
|
}
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
if(FSEEKO_FUNC((FILE *)stream, (z_off_t)offset, fseek_origin) != 0)
|
if(FSEEKO_FUNC((FILE *)stream, (z_off64_t)offset, fseek_origin) != 0)
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream)
|
static int ZCALLBACK fclose_file_func(voidpf opaque, voidpf stream) {
|
||||||
{
|
|
||||||
int ret;
|
int ret;
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
ret = fclose((FILE *)stream);
|
ret = fclose((FILE *)stream);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream)
|
static int ZCALLBACK ferror_file_func(voidpf opaque, voidpf stream) {
|
||||||
{
|
|
||||||
int ret;
|
int ret;
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
ret = ferror((FILE *)stream);
|
ret = ferror((FILE *)stream);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fill_fopen_filefunc (pzlib_filefunc_def)
|
void fill_fopen_filefunc(zlib_filefunc_def* pzlib_filefunc_def) {
|
||||||
zlib_filefunc_def* pzlib_filefunc_def;
|
|
||||||
{
|
|
||||||
pzlib_filefunc_def->zopen_file = fopen_file_func;
|
pzlib_filefunc_def->zopen_file = fopen_file_func;
|
||||||
pzlib_filefunc_def->zread_file = fread_file_func;
|
pzlib_filefunc_def->zread_file = fread_file_func;
|
||||||
pzlib_filefunc_def->zwrite_file = fwrite_file_func;
|
pzlib_filefunc_def->zwrite_file = fwrite_file_func;
|
||||||
|
|
@ -251,8 +226,7 @@ void fill_fopen_filefunc (pzlib_filefunc_def)
|
||||||
pzlib_filefunc_def->opaque = NULL;
|
pzlib_filefunc_def->opaque = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def)
|
void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def) {
|
||||||
{
|
|
||||||
pzlib_filefunc_def->zopen64_file = fopen64_file_func;
|
pzlib_filefunc_def->zopen64_file = fopen64_file_func;
|
||||||
pzlib_filefunc_def->zread_file = fread_file_func;
|
pzlib_filefunc_def->zread_file = fread_file_func;
|
||||||
pzlib_filefunc_def->zwrite_file = fwrite_file_func;
|
pzlib_filefunc_def->zwrite_file = fwrite_file_func;
|
||||||
|
|
|
||||||
54
thirdparty/minizip/ioapi.h
vendored
54
thirdparty/minizip/ioapi.h
vendored
|
|
@ -45,28 +45,12 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "zlib.h"
|
#include "zlib.h"
|
||||||
|
|
||||||
/* GODOT start */
|
|
||||||
/* Mighty Gentoo saves the day by breaking the API of their zlib.h,
|
|
||||||
* removing this definition of OF(args) for no practical reason
|
|
||||||
* worth breaking compatibility with all projects that embed minizip
|
|
||||||
* while trying not to diverge too much from upstream zlib.
|
|
||||||
* Cf. https://github.com/godotengine/godot/issues/10539
|
|
||||||
*
|
|
||||||
* "By and large, this is good open source behaviour, and fits with
|
|
||||||
* the gentoo _don't fuck with upstream's releases_ philosophy"
|
|
||||||
* -- Gentoo philosopher
|
|
||||||
*/
|
|
||||||
#ifndef OF /* function prototypes */
|
|
||||||
#define OF(args) args
|
|
||||||
#endif
|
|
||||||
/* GODOT end */
|
|
||||||
|
|
||||||
#if defined(USE_FILE32API)
|
#if defined(USE_FILE32API)
|
||||||
#define fopen64 fopen
|
#define fopen64 fopen
|
||||||
#define ftello64 ftell
|
#define ftello64 ftell
|
||||||
#define fseeko64 fseek
|
#define fseeko64 fseek
|
||||||
#else
|
#else
|
||||||
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
|
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64)
|
||||||
#define fopen64 fopen
|
#define fopen64 fopen
|
||||||
#define ftello64 ftello
|
#define ftello64 ftello
|
||||||
#define fseeko64 fseeko
|
#define fseeko64 fseeko
|
||||||
|
|
@ -98,7 +82,7 @@
|
||||||
#include "mz64conf.h"
|
#include "mz64conf.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* a type choosen by DEFINE */
|
/* a type chosen by DEFINE */
|
||||||
#ifdef HAVE_64BIT_INT_CUSTOM
|
#ifdef HAVE_64BIT_INT_CUSTOM
|
||||||
typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
|
typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
|
||||||
#else
|
#else
|
||||||
|
|
@ -150,17 +134,17 @@ extern "C" {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
|
typedef voidpf (ZCALLBACK *open_file_func) (voidpf opaque, const char* filename, int mode);
|
||||||
typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
|
typedef uLong (ZCALLBACK *read_file_func) (voidpf opaque, voidpf stream, void* buf, uLong size);
|
||||||
typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
|
typedef uLong (ZCALLBACK *write_file_func) (voidpf opaque, voidpf stream, const void* buf, uLong size);
|
||||||
typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
|
typedef int (ZCALLBACK *close_file_func) (voidpf opaque, voidpf stream);
|
||||||
typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
|
typedef int (ZCALLBACK *testerror_file_func) (voidpf opaque, voidpf stream);
|
||||||
|
|
||||||
typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
|
typedef long (ZCALLBACK *tell_file_func) (voidpf opaque, voidpf stream);
|
||||||
typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
|
typedef long (ZCALLBACK *seek_file_func) (voidpf opaque, voidpf stream, uLong offset, int origin);
|
||||||
|
|
||||||
|
|
||||||
/* here is the "old" 32 bits structure structure */
|
/* here is the "old" 32 bits structure */
|
||||||
typedef struct zlib_filefunc_def_s
|
typedef struct zlib_filefunc_def_s
|
||||||
{
|
{
|
||||||
open_file_func zopen_file;
|
open_file_func zopen_file;
|
||||||
|
|
@ -177,9 +161,9 @@ typedef struct zlib_filefunc_def_s
|
||||||
/* GODOT end */
|
/* GODOT end */
|
||||||
} zlib_filefunc_def;
|
} zlib_filefunc_def;
|
||||||
|
|
||||||
typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream));
|
typedef ZPOS64_T (ZCALLBACK *tell64_file_func) (voidpf opaque, voidpf stream);
|
||||||
typedef long (ZCALLBACK *seek64_file_func) OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
|
typedef long (ZCALLBACK *seek64_file_func) (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin);
|
||||||
typedef voidpf (ZCALLBACK *open64_file_func) OF((voidpf opaque, const void* filename, int mode));
|
typedef voidpf (ZCALLBACK *open64_file_func) (voidpf opaque, const void* filename, int mode);
|
||||||
|
|
||||||
typedef struct zlib_filefunc64_def_s
|
typedef struct zlib_filefunc64_def_s
|
||||||
{
|
{
|
||||||
|
|
@ -197,8 +181,8 @@ typedef struct zlib_filefunc64_def_s
|
||||||
/* GODOT end */
|
/* GODOT end */
|
||||||
} zlib_filefunc64_def;
|
} zlib_filefunc64_def;
|
||||||
|
|
||||||
void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def));
|
void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def);
|
||||||
void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
|
void fill_fopen_filefunc(zlib_filefunc_def* pzlib_filefunc_def);
|
||||||
|
|
||||||
/* now internal definition, only for zip.c and unzip.h */
|
/* now internal definition, only for zip.c and unzip.h */
|
||||||
typedef struct zlib_filefunc64_32_def_s
|
typedef struct zlib_filefunc64_32_def_s
|
||||||
|
|
@ -217,11 +201,11 @@ typedef struct zlib_filefunc64_32_def_s
|
||||||
#define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream))
|
#define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream))
|
||||||
#define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream))
|
#define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream))
|
||||||
|
|
||||||
voidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode));
|
voidpf call_zopen64(const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode);
|
||||||
long call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin));
|
long call_zseek64(const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin);
|
||||||
ZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream));
|
ZPOS64_T call_ztell64(const zlib_filefunc64_32_def* pfilefunc,voidpf filestream);
|
||||||
|
|
||||||
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32);
|
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32);
|
||||||
|
|
||||||
#define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode)))
|
#define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode)))
|
||||||
#define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream)))
|
#define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream)))
|
||||||
|
|
|
||||||
54
thirdparty/minizip/patches/godot-seek.patch
vendored
54
thirdparty/minizip/patches/godot-seek.patch
vendored
|
|
@ -1,8 +1,8 @@
|
||||||
diff --git a/thirdparty/minizip/ioapi.c b/thirdparty/minizip/ioapi.c
|
diff --git a/thirdparty/minizip/ioapi.c b/thirdparty/minizip/ioapi.c
|
||||||
index 814a6fd38c..b50db35ac1 100644
|
index 782d32469a..2e89f5f41a 100644
|
||||||
--- a/thirdparty/minizip/ioapi.c
|
--- a/thirdparty/minizip/ioapi.c
|
||||||
+++ b/thirdparty/minizip/ioapi.c
|
+++ b/thirdparty/minizip/ioapi.c
|
||||||
@@ -80,8 +80,15 @@ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filef
|
@@ -75,8 +75,15 @@ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filef
|
||||||
p_filefunc64_32->zfile_func64.opaque = p_filefunc32->opaque;
|
p_filefunc64_32->zfile_func64.opaque = p_filefunc32->opaque;
|
||||||
p_filefunc64_32->zseek32_file = p_filefunc32->zseek_file;
|
p_filefunc64_32->zseek32_file = p_filefunc32->zseek_file;
|
||||||
p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file;
|
p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file;
|
||||||
|
|
@ -17,8 +17,8 @@ index 814a6fd38c..b50db35ac1 100644
|
||||||
+// GODOT end
|
+// GODOT end
|
||||||
|
|
||||||
|
|
||||||
static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode));
|
static voidpf ZCALLBACK fopen_file_func(voidpf opaque, const char* filename, int mode) {
|
||||||
@@ -255,3 +262,6 @@ void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def)
|
@@ -229,3 +236,6 @@ void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def) {
|
||||||
pzlib_filefunc_def->zerror_file = ferror_file_func;
|
pzlib_filefunc_def->zerror_file = ferror_file_func;
|
||||||
pzlib_filefunc_def->opaque = NULL;
|
pzlib_filefunc_def->opaque = NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -26,7 +26,7 @@ index 814a6fd38c..b50db35ac1 100644
|
||||||
+*/
|
+*/
|
||||||
+/* GODOT end */
|
+/* GODOT end */
|
||||||
diff --git a/thirdparty/minizip/ioapi.h b/thirdparty/minizip/ioapi.h
|
diff --git a/thirdparty/minizip/ioapi.h b/thirdparty/minizip/ioapi.h
|
||||||
index ae9ca7e833..6c73fc4ec3 100644
|
index a2d2e6e60d..509b52da8a 100644
|
||||||
--- a/thirdparty/minizip/ioapi.h
|
--- a/thirdparty/minizip/ioapi.h
|
||||||
+++ b/thirdparty/minizip/ioapi.h
|
+++ b/thirdparty/minizip/ioapi.h
|
||||||
@@ -155,6 +155,10 @@ typedef struct zlib_filefunc_def_s
|
@@ -155,6 +155,10 @@ typedef struct zlib_filefunc_def_s
|
||||||
|
|
@ -39,7 +39,7 @@ index ae9ca7e833..6c73fc4ec3 100644
|
||||||
+ /* GODOT end */
|
+ /* GODOT end */
|
||||||
} zlib_filefunc_def;
|
} zlib_filefunc_def;
|
||||||
|
|
||||||
typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream));
|
typedef ZPOS64_T (ZCALLBACK *tell64_file_func) (voidpf opaque, voidpf stream);
|
||||||
@@ -171,6 +175,10 @@ typedef struct zlib_filefunc64_def_s
|
@@ -171,6 +175,10 @@ typedef struct zlib_filefunc64_def_s
|
||||||
close_file_func zclose_file;
|
close_file_func zclose_file;
|
||||||
testerror_file_func zerror_file;
|
testerror_file_func zerror_file;
|
||||||
|
|
@ -50,12 +50,12 @@ index ae9ca7e833..6c73fc4ec3 100644
|
||||||
+ /* GODOT end */
|
+ /* GODOT end */
|
||||||
} zlib_filefunc64_def;
|
} zlib_filefunc64_def;
|
||||||
|
|
||||||
void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def));
|
void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def);
|
||||||
diff --git a/thirdparty/minizip/unzip.c b/thirdparty/minizip/unzip.c
|
diff --git a/thirdparty/minizip/unzip.c b/thirdparty/minizip/unzip.c
|
||||||
index 3036b470b7..e83aff2773 100644
|
index ea05b7d62a..981ba3c0cb 100644
|
||||||
--- a/thirdparty/minizip/unzip.c
|
--- a/thirdparty/minizip/unzip.c
|
||||||
+++ b/thirdparty/minizip/unzip.c
|
+++ b/thirdparty/minizip/unzip.c
|
||||||
@@ -157,6 +157,9 @@ typedef struct
|
@@ -152,6 +152,9 @@ typedef struct
|
||||||
uLong compression_method; /* compression method (0==store) */
|
uLong compression_method; /* compression method (0==store) */
|
||||||
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
|
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
|
||||||
int raw;
|
int raw;
|
||||||
|
|
@ -65,7 +65,7 @@ index 3036b470b7..e83aff2773 100644
|
||||||
} file_in_zip64_read_info_s;
|
} file_in_zip64_read_info_s;
|
||||||
|
|
||||||
|
|
||||||
@@ -606,9 +609,10 @@ local unzFile unzOpenInternal (const void *path,
|
@@ -513,9 +516,10 @@ local unzFile unzOpenInternal(const void *path,
|
||||||
us.z_filefunc.zseek32_file = NULL;
|
us.z_filefunc.zseek32_file = NULL;
|
||||||
us.z_filefunc.ztell32_file = NULL;
|
us.z_filefunc.ztell32_file = NULL;
|
||||||
if (pzlib_filefunc64_32_def==NULL)
|
if (pzlib_filefunc64_32_def==NULL)
|
||||||
|
|
@ -79,7 +79,7 @@ index 3036b470b7..e83aff2773 100644
|
||||||
us.is64bitOpenFunction = is64bitOpenFunction;
|
us.is64bitOpenFunction = is64bitOpenFunction;
|
||||||
|
|
||||||
|
|
||||||
@@ -800,6 +804,18 @@ extern unzFile ZEXPORT unzOpen64 (const void *path)
|
@@ -703,6 +707,18 @@ extern unzFile ZEXPORT unzOpen64(const void *path) {
|
||||||
return unzOpenInternal(path, NULL, 1);
|
return unzOpenInternal(path, NULL, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -98,7 +98,7 @@ index 3036b470b7..e83aff2773 100644
|
||||||
/*
|
/*
|
||||||
Close a ZipFile opened with unzOpen.
|
Close a ZipFile opened with unzOpen.
|
||||||
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
|
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
|
||||||
@@ -1018,10 +1034,23 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
|
@@ -905,10 +921,23 @@ local int unz64local_GetCurrentFileInfoInternal(unzFile file,
|
||||||
|
|
||||||
if (lSeek!=0)
|
if (lSeek!=0)
|
||||||
{
|
{
|
||||||
|
|
@ -122,7 +122,7 @@ index 3036b470b7..e83aff2773 100644
|
||||||
}
|
}
|
||||||
|
|
||||||
while(acc < file_info.size_file_extra)
|
while(acc < file_info.size_file_extra)
|
||||||
@@ -1576,8 +1605,10 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
|
@@ -1446,8 +1475,10 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
|
||||||
}
|
}
|
||||||
else if ((s->cur_file_info.compression_method==Z_DEFLATED) && (!raw))
|
else if ((s->cur_file_info.compression_method==Z_DEFLATED) && (!raw))
|
||||||
{
|
{
|
||||||
|
|
@ -135,7 +135,7 @@ index 3036b470b7..e83aff2773 100644
|
||||||
pfile_in_zip_read_info->stream.opaque = (voidpf)0;
|
pfile_in_zip_read_info->stream.opaque = (voidpf)0;
|
||||||
pfile_in_zip_read_info->stream.next_in = 0;
|
pfile_in_zip_read_info->stream.next_in = 0;
|
||||||
pfile_in_zip_read_info->stream.avail_in = 0;
|
pfile_in_zip_read_info->stream.avail_in = 0;
|
||||||
@@ -1610,6 +1641,9 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
|
@@ -1480,6 +1511,9 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
|
||||||
iSizeVar;
|
iSizeVar;
|
||||||
|
|
||||||
pfile_in_zip_read_info->stream.avail_in = (uInt)0;
|
pfile_in_zip_read_info->stream.avail_in = (uInt)0;
|
||||||
|
|
@ -145,7 +145,7 @@ index 3036b470b7..e83aff2773 100644
|
||||||
|
|
||||||
s->pfile_in_zip_read = pfile_in_zip_read_info;
|
s->pfile_in_zip_read = pfile_in_zip_read_info;
|
||||||
s->encrypted = 0;
|
s->encrypted = 0;
|
||||||
@@ -1640,6 +1674,85 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
|
@@ -1510,6 +1544,85 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
|
||||||
return UNZ_OK;
|
return UNZ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -228,14 +228,14 @@ index 3036b470b7..e83aff2773 100644
|
||||||
+}
|
+}
|
||||||
+/* GODOT end */
|
+/* GODOT end */
|
||||||
+
|
+
|
||||||
extern int ZEXPORT unzOpenCurrentFile (unzFile file)
|
extern int ZEXPORT unzOpenCurrentFile(unzFile file) {
|
||||||
{
|
|
||||||
return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);
|
return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);
|
||||||
|
}
|
||||||
diff --git a/thirdparty/minizip/unzip.h b/thirdparty/minizip/unzip.h
|
diff --git a/thirdparty/minizip/unzip.h b/thirdparty/minizip/unzip.h
|
||||||
index 6f95e94d75..71a7d89692 100644
|
index 5cfc9c6274..0639674574 100644
|
||||||
--- a/thirdparty/minizip/unzip.h
|
--- a/thirdparty/minizip/unzip.h
|
||||||
+++ b/thirdparty/minizip/unzip.h
|
+++ b/thirdparty/minizip/unzip.h
|
||||||
@@ -202,6 +202,10 @@ extern int ZEXPORT unzClose OF((unzFile file));
|
@@ -202,6 +202,10 @@ extern int ZEXPORT unzClose(unzFile file);
|
||||||
these files MUST be closed with unzCloseCurrentFile before call unzClose.
|
these files MUST be closed with unzCloseCurrentFile before call unzClose.
|
||||||
return UNZ_OK if there is no problem. */
|
return UNZ_OK if there is no problem. */
|
||||||
|
|
||||||
|
|
@ -243,10 +243,10 @@ index 6f95e94d75..71a7d89692 100644
|
||||||
+extern void* unzGetOpaque(unzFile file);
|
+extern void* unzGetOpaque(unzFile file);
|
||||||
+/* GODOT end */
|
+/* GODOT end */
|
||||||
+
|
+
|
||||||
extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
|
extern int ZEXPORT unzGetGlobalInfo(unzFile file,
|
||||||
unz_global_info *pglobal_info));
|
unz_global_info *pglobal_info);
|
||||||
|
|
||||||
@@ -390,6 +394,13 @@ extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
|
@@ -390,6 +394,13 @@ extern int ZEXPORT unzReadCurrentFile(unzFile file,
|
||||||
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
|
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -257,14 +257,14 @@ index 6f95e94d75..71a7d89692 100644
|
||||||
+*/
|
+*/
|
||||||
+/* GODOT end */
|
+/* GODOT end */
|
||||||
+
|
+
|
||||||
extern z_off_t ZEXPORT unztell OF((unzFile file));
|
extern z_off_t ZEXPORT unztell(unzFile file);
|
||||||
|
|
||||||
extern ZPOS64_T ZEXPORT unztell64 OF((unzFile file));
|
extern ZPOS64_T ZEXPORT unztell64(unzFile file);
|
||||||
diff --git a/thirdparty/minizip/zip.c b/thirdparty/minizip/zip.c
|
diff --git a/thirdparty/minizip/zip.c b/thirdparty/minizip/zip.c
|
||||||
index 66d693f85a..ddcc14132b 100644
|
index 60bdffac34..1d2d918e72 100644
|
||||||
--- a/thirdparty/minizip/zip.c
|
--- a/thirdparty/minizip/zip.c
|
||||||
+++ b/thirdparty/minizip/zip.c
|
+++ b/thirdparty/minizip/zip.c
|
||||||
@@ -854,9 +854,11 @@ extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* gl
|
@@ -820,9 +820,11 @@ extern zipFile ZEXPORT zipOpen3(const void *pathname, int append, zipcharpc* glo
|
||||||
|
|
||||||
ziinit.z_filefunc.zseek32_file = NULL;
|
ziinit.z_filefunc.zseek32_file = NULL;
|
||||||
ziinit.z_filefunc.ztell32_file = NULL;
|
ziinit.z_filefunc.ztell32_file = NULL;
|
||||||
|
|
@ -279,7 +279,7 @@ index 66d693f85a..ddcc14132b 100644
|
||||||
ziinit.z_filefunc = *pzlib_filefunc64_32_def;
|
ziinit.z_filefunc = *pzlib_filefunc64_32_def;
|
||||||
|
|
||||||
ziinit.filestream = ZOPEN64(ziinit.z_filefunc,
|
ziinit.filestream = ZOPEN64(ziinit.z_filefunc,
|
||||||
@@ -1211,8 +1213,10 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
|
@@ -1182,8 +1184,10 @@ extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, c
|
||||||
{
|
{
|
||||||
if(zi->ci.method == Z_DEFLATED)
|
if(zi->ci.method == Z_DEFLATED)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
27
thirdparty/minizip/patches/unbreak-gentoo.patch
vendored
27
thirdparty/minizip/patches/unbreak-gentoo.patch
vendored
|
|
@ -1,27 +0,0 @@
|
||||||
diff --git a/thirdparty/minizip/ioapi.h b/thirdparty/minizip/ioapi.h
|
|
||||||
index 6c73fc4ec3..083062ffe6 100644
|
|
||||||
--- a/thirdparty/minizip/ioapi.h
|
|
||||||
+++ b/thirdparty/minizip/ioapi.h
|
|
||||||
@@ -45,6 +45,22 @@
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include "zlib.h"
|
|
||||||
|
|
||||||
+/* GODOT start */
|
|
||||||
+/* Mighty Gentoo saves the day by breaking the API of their zlib.h,
|
|
||||||
+ * removing this definition of OF(args) for no practical reason
|
|
||||||
+ * worth breaking compatibility with all projects that embed minizip
|
|
||||||
+ * while trying not to diverge too much from upstream zlib.
|
|
||||||
+ * Cf. https://github.com/godotengine/godot/issues/10539
|
|
||||||
+ *
|
|
||||||
+ * "By and large, this is good open source behaviour, and fits with
|
|
||||||
+ * the gentoo _don't fuck with upstream's releases_ philosophy"
|
|
||||||
+ * -- Gentoo philosopher
|
|
||||||
+ */
|
|
||||||
+#ifndef OF /* function prototypes */
|
|
||||||
+ #define OF(args) args
|
|
||||||
+#endif
|
|
||||||
+/* GODOT end */
|
|
||||||
+
|
|
||||||
#if defined(USE_FILE32API)
|
|
||||||
#define fopen64 fopen
|
|
||||||
#define ftello64 ftell
|
|
||||||
527
thirdparty/minizip/unzip.c
vendored
527
thirdparty/minizip/unzip.c
vendored
|
|
@ -49,12 +49,12 @@
|
||||||
Copyright (C) 2007-2008 Even Rouault
|
Copyright (C) 2007-2008 Even Rouault
|
||||||
|
|
||||||
|
|
||||||
Oct-2009 - Mathias Svensson - Removed cpl_* from symbol names (Even Rouault added them but since this is now moved to a new project (minizip64) I renamed them again).
|
Oct-2009 - Mathias Svensson - Removed cpl_* from symbol names (Even Rouault added them but since this is now moved to a new project (minizip64) I renamed them again).
|
||||||
Oct-2009 - Mathias Svensson - Fixed problem if uncompressed size was > 4G and compressed size was <4G
|
Oct-2009 - Mathias Svensson - Fixed problem if uncompressed size was > 4G and compressed size was <4G
|
||||||
should only read the compressed/uncompressed size from the Zip64 format if
|
should only read the compressed/uncompressed size from the Zip64 format if
|
||||||
the size from normal header was 0xFFFFFFFF
|
the size from normal header was 0xFFFFFFFF
|
||||||
Oct-2009 - Mathias Svensson - Applied some bug fixes from paches recived from Gilles Vollant
|
Oct-2009 - Mathias Svensson - Applied some bug fixes from patches received from Gilles Vollant
|
||||||
Oct-2009 - Mathias Svensson - Applied support to unzip files with compression mathod BZIP2 (bzip2 lib is required)
|
Oct-2009 - Mathias Svensson - Applied support to unzip files with compression method BZIP2 (bzip2 lib is required)
|
||||||
Patch created by Daniel Borca
|
Patch created by Daniel Borca
|
||||||
|
|
||||||
Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer
|
Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer
|
||||||
|
|
@ -77,8 +77,6 @@
|
||||||
|
|
||||||
#ifdef STDC
|
#ifdef STDC
|
||||||
# include <stddef.h>
|
# include <stddef.h>
|
||||||
# include <string.h>
|
|
||||||
# include <stdlib.h>
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef NO_ERRNO_H
|
#ifdef NO_ERRNO_H
|
||||||
extern int errno;
|
extern int errno;
|
||||||
|
|
@ -111,9 +109,6 @@
|
||||||
#ifndef ALLOC
|
#ifndef ALLOC
|
||||||
# define ALLOC(size) (malloc(size))
|
# define ALLOC(size) (malloc(size))
|
||||||
#endif
|
#endif
|
||||||
#ifndef TRYFREE
|
|
||||||
# define TRYFREE(p) { free(p);}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SIZECENTRALDIRITEM (0x2e)
|
#define SIZECENTRALDIRITEM (0x2e)
|
||||||
#define SIZEZIPLOCALHEADER (0x1e)
|
#define SIZEZIPLOCALHEADER (0x1e)
|
||||||
|
|
@ -122,7 +117,7 @@
|
||||||
const char unz_copyright[] =
|
const char unz_copyright[] =
|
||||||
" unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
|
" unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
|
||||||
|
|
||||||
/* unz_file_info_interntal contain internal info about a file in zipfile*/
|
/* unz_file_info64_internal contain internal info about a file in zipfile*/
|
||||||
typedef struct unz_file_info64_internal_s
|
typedef struct unz_file_info64_internal_s
|
||||||
{
|
{
|
||||||
ZPOS64_T offset_curfile;/* relative offset of local header 8 bytes */
|
ZPOS64_T offset_curfile;/* relative offset of local header 8 bytes */
|
||||||
|
|
@ -153,7 +148,7 @@ typedef struct
|
||||||
ZPOS64_T rest_read_compressed; /* number of byte to be decompressed */
|
ZPOS64_T rest_read_compressed; /* number of byte to be decompressed */
|
||||||
ZPOS64_T rest_read_uncompressed;/*number of byte to be obtained after decomp*/
|
ZPOS64_T rest_read_uncompressed;/*number of byte to be obtained after decomp*/
|
||||||
zlib_filefunc64_32_def z_filefunc;
|
zlib_filefunc64_32_def z_filefunc;
|
||||||
voidpf filestream; /* io structore of the zipfile */
|
voidpf filestream; /* io structure of the zipfile */
|
||||||
uLong compression_method; /* compression method (0==store) */
|
uLong compression_method; /* compression method (0==store) */
|
||||||
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
|
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
|
||||||
int raw;
|
int raw;
|
||||||
|
|
@ -169,7 +164,7 @@ typedef struct
|
||||||
{
|
{
|
||||||
zlib_filefunc64_32_def z_filefunc;
|
zlib_filefunc64_32_def z_filefunc;
|
||||||
int is64bitOpenFunction;
|
int is64bitOpenFunction;
|
||||||
voidpf filestream; /* io structore of the zipfile */
|
voidpf filestream; /* io structure of the zipfile */
|
||||||
unz_global_info64 gi; /* public global information */
|
unz_global_info64 gi; /* public global information */
|
||||||
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
|
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
|
||||||
ZPOS64_T num_file; /* number of the current file in the zipfile*/
|
ZPOS64_T num_file; /* number of the current file in the zipfile*/
|
||||||
|
|
@ -200,29 +195,44 @@ typedef struct
|
||||||
#include "crypt.h"
|
#include "crypt.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
Read a byte from a gz_stream; update next_in and avail_in. Return EOF
|
Reads a long in LSB order from the given gz_stream. Sets
|
||||||
for end of file.
|
|
||||||
IN assertion: the stream s has been successfully opened for reading.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
local int unz64local_getShort(const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
||||||
local int unz64local_getByte OF((
|
voidpf filestream,
|
||||||
const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
uLong *pX) {
|
||||||
voidpf filestream,
|
unsigned char c[2];
|
||||||
int *pi));
|
int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,c,2);
|
||||||
|
if (err==2)
|
||||||
local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi)
|
|
||||||
{
|
|
||||||
unsigned char c;
|
|
||||||
int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1);
|
|
||||||
if (err==1)
|
|
||||||
{
|
{
|
||||||
*pi = (int)c;
|
*pX = c[0] | ((uLong)c[1] << 8);
|
||||||
return UNZ_OK;
|
return UNZ_OK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
*pX = 0;
|
||||||
|
if (ZERROR64(*pzlib_filefunc_def,filestream))
|
||||||
|
return UNZ_ERRNO;
|
||||||
|
else
|
||||||
|
return UNZ_EOF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
local int unz64local_getLong(const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
||||||
|
voidpf filestream,
|
||||||
|
uLong *pX) {
|
||||||
|
unsigned char c[4];
|
||||||
|
int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,c,4);
|
||||||
|
if (err==4)
|
||||||
|
{
|
||||||
|
*pX = c[0] | ((uLong)c[1] << 8) | ((uLong)c[2] << 16) | ((uLong)c[3] << 24);
|
||||||
|
return UNZ_OK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*pX = 0;
|
||||||
if (ZERROR64(*pzlib_filefunc_def,filestream))
|
if (ZERROR64(*pzlib_filefunc_def,filestream))
|
||||||
return UNZ_ERRNO;
|
return UNZ_ERRNO;
|
||||||
else
|
else
|
||||||
|
|
@ -231,126 +241,29 @@ local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ===========================================================================
|
local int unz64local_getLong64(const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
||||||
Reads a long in LSB order from the given gz_stream. Sets
|
voidpf filestream,
|
||||||
*/
|
ZPOS64_T *pX) {
|
||||||
local int unz64local_getShort OF((
|
unsigned char c[8];
|
||||||
const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,c,8);
|
||||||
voidpf filestream,
|
if (err==8)
|
||||||
uLong *pX));
|
{
|
||||||
|
*pX = c[0] | ((ZPOS64_T)c[1] << 8) | ((ZPOS64_T)c[2] << 16) | ((ZPOS64_T)c[3] << 24)
|
||||||
local int unz64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
| ((ZPOS64_T)c[4] << 32) | ((ZPOS64_T)c[5] << 40) | ((ZPOS64_T)c[6] << 48) | ((ZPOS64_T)c[7] << 56);
|
||||||
voidpf filestream,
|
return UNZ_OK;
|
||||||
uLong *pX)
|
}
|
||||||
{
|
|
||||||
uLong x ;
|
|
||||||
int i = 0;
|
|
||||||
int err;
|
|
||||||
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x = (uLong)i;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x |= ((uLong)i)<<8;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
*pX = x;
|
|
||||||
else
|
else
|
||||||
|
{
|
||||||
*pX = 0;
|
*pX = 0;
|
||||||
return err;
|
if (ZERROR64(*pzlib_filefunc_def,filestream))
|
||||||
}
|
return UNZ_ERRNO;
|
||||||
|
else
|
||||||
local int unz64local_getLong OF((
|
return UNZ_EOF;
|
||||||
const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
}
|
||||||
voidpf filestream,
|
|
||||||
uLong *pX));
|
|
||||||
|
|
||||||
local int unz64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
|
||||||
voidpf filestream,
|
|
||||||
uLong *pX)
|
|
||||||
{
|
|
||||||
uLong x ;
|
|
||||||
int i = 0;
|
|
||||||
int err;
|
|
||||||
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x = (uLong)i;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x |= ((uLong)i)<<8;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x |= ((uLong)i)<<16;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x += ((uLong)i)<<24;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
*pX = x;
|
|
||||||
else
|
|
||||||
*pX = 0;
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
local int unz64local_getLong64 OF((
|
|
||||||
const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
|
||||||
voidpf filestream,
|
|
||||||
ZPOS64_T *pX));
|
|
||||||
|
|
||||||
|
|
||||||
local int unz64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
|
||||||
voidpf filestream,
|
|
||||||
ZPOS64_T *pX)
|
|
||||||
{
|
|
||||||
ZPOS64_T x ;
|
|
||||||
int i = 0;
|
|
||||||
int err;
|
|
||||||
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x = (ZPOS64_T)i;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x |= ((ZPOS64_T)i)<<8;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x |= ((ZPOS64_T)i)<<16;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x |= ((ZPOS64_T)i)<<24;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x |= ((ZPOS64_T)i)<<32;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x |= ((ZPOS64_T)i)<<40;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x |= ((ZPOS64_T)i)<<48;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
err = unz64local_getByte(pzlib_filefunc_def,filestream,&i);
|
|
||||||
x |= ((ZPOS64_T)i)<<56;
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
|
||||||
*pX = x;
|
|
||||||
else
|
|
||||||
*pX = 0;
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* My own strcmpi / strcasecmp */
|
/* My own strcmpi / strcasecmp */
|
||||||
local int strcmpcasenosensitive_internal (const char* fileName1, const char* fileName2)
|
local int strcmpcasenosensitive_internal(const char* fileName1, const char* fileName2) {
|
||||||
{
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
char c1=*(fileName1++);
|
char c1=*(fileName1++);
|
||||||
|
|
@ -382,19 +295,17 @@ local int strcmpcasenosensitive_internal (const char* fileName1, const char* fil
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Compare two filename (fileName1,fileName2).
|
Compare two filenames (fileName1,fileName2).
|
||||||
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
|
If iCaseSensitivity = 1, comparison is case sensitive (like strcmp)
|
||||||
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
|
If iCaseSensitivity = 2, comparison is not case sensitive (like strcmpi
|
||||||
or strcasecmp)
|
or strcasecmp)
|
||||||
If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
|
If iCaseSensitivity = 0, case sensitivity is default of your operating system
|
||||||
(like 1 on Unix, 2 on Windows)
|
(like 1 on Unix, 2 on Windows)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
extern int ZEXPORT unzStringFileNameCompare (const char* fileName1,
|
extern int ZEXPORT unzStringFileNameCompare (const char* fileName1,
|
||||||
const char* fileName2,
|
const char* fileName2,
|
||||||
int iCaseSensitivity)
|
int iCaseSensitivity) {
|
||||||
|
|
||||||
{
|
|
||||||
if (iCaseSensitivity==0)
|
if (iCaseSensitivity==0)
|
||||||
iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;
|
iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;
|
||||||
|
|
||||||
|
|
@ -408,21 +319,23 @@ extern int ZEXPORT unzStringFileNameCompare (const char* fileName1,
|
||||||
#define BUFREADCOMMENT (0x400)
|
#define BUFREADCOMMENT (0x400)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CENTRALDIRINVALID
|
||||||
|
#define CENTRALDIRINVALID ((ZPOS64_T)(-1))
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Locate the Central directory of a zipfile (at the end, just before
|
Locate the Central directory of a zipfile (at the end, just before
|
||||||
the global comment)
|
the global comment)
|
||||||
*/
|
*/
|
||||||
local ZPOS64_T unz64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream));
|
local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
|
||||||
local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
|
|
||||||
{
|
|
||||||
unsigned char* buf;
|
unsigned char* buf;
|
||||||
ZPOS64_T uSizeFile;
|
ZPOS64_T uSizeFile;
|
||||||
ZPOS64_T uBackRead;
|
ZPOS64_T uBackRead;
|
||||||
ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
|
ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
|
||||||
ZPOS64_T uPosFound=0;
|
ZPOS64_T uPosFound=CENTRALDIRINVALID;
|
||||||
|
|
||||||
if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
|
if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
|
|
||||||
uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
|
uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
|
||||||
|
|
@ -432,7 +345,7 @@ local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
|
||||||
|
|
||||||
buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
|
buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
|
||||||
if (buf==NULL)
|
if (buf==NULL)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
uBackRead = 4;
|
uBackRead = 4;
|
||||||
while (uBackRead<uMaxBack)
|
while (uBackRead<uMaxBack)
|
||||||
|
|
@ -462,10 +375,10 @@ local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uPosFound!=0)
|
if (uPosFound!=CENTRALDIRINVALID)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
TRYFREE(buf);
|
free(buf);
|
||||||
return uPosFound;
|
return uPosFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -474,23 +387,18 @@ local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
|
||||||
Locate the Central directory 64 of a zipfile (at the end, just before
|
Locate the Central directory 64 of a zipfile (at the end, just before
|
||||||
the global comment)
|
the global comment)
|
||||||
*/
|
*/
|
||||||
local ZPOS64_T unz64local_SearchCentralDir64 OF((
|
|
||||||
const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
|
||||||
voidpf filestream));
|
|
||||||
|
|
||||||
local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
||||||
voidpf filestream)
|
voidpf filestream) {
|
||||||
{
|
|
||||||
unsigned char* buf;
|
unsigned char* buf;
|
||||||
ZPOS64_T uSizeFile;
|
ZPOS64_T uSizeFile;
|
||||||
ZPOS64_T uBackRead;
|
ZPOS64_T uBackRead;
|
||||||
ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
|
ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
|
||||||
ZPOS64_T uPosFound=0;
|
ZPOS64_T uPosFound=CENTRALDIRINVALID;
|
||||||
uLong uL;
|
uLong uL;
|
||||||
ZPOS64_T relativeOffset;
|
ZPOS64_T relativeOffset;
|
||||||
|
|
||||||
if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
|
if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
|
|
||||||
uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
|
uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
|
||||||
|
|
@ -500,7 +408,7 @@ local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
|
||||||
|
|
||||||
buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
|
buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
|
||||||
if (buf==NULL)
|
if (buf==NULL)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
uBackRead = 4;
|
uBackRead = 4;
|
||||||
while (uBackRead<uMaxBack)
|
while (uBackRead<uMaxBack)
|
||||||
|
|
@ -530,47 +438,47 @@ local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uPosFound!=0)
|
if (uPosFound!=CENTRALDIRINVALID)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
TRYFREE(buf);
|
free(buf);
|
||||||
if (uPosFound == 0)
|
if (uPosFound == CENTRALDIRINVALID)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
/* Zip64 end of central directory locator */
|
/* Zip64 end of central directory locator */
|
||||||
if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0)
|
if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
/* the signature, already checked */
|
/* the signature, already checked */
|
||||||
if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
|
if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
/* number of the disk with the start of the zip64 end of central directory */
|
/* number of the disk with the start of the zip64 end of central directory */
|
||||||
if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
|
if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
if (uL != 0)
|
if (uL != 0)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
/* relative offset of the zip64 end of central directory record */
|
/* relative offset of the zip64 end of central directory record */
|
||||||
if (unz64local_getLong64(pzlib_filefunc_def,filestream,&relativeOffset)!=UNZ_OK)
|
if (unz64local_getLong64(pzlib_filefunc_def,filestream,&relativeOffset)!=UNZ_OK)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
/* total number of disks */
|
/* total number of disks */
|
||||||
if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
|
if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
if (uL != 1)
|
if (uL != 1)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
/* Goto end of central directory record */
|
/* Goto end of central directory record */
|
||||||
if (ZSEEK64(*pzlib_filefunc_def,filestream, relativeOffset,ZLIB_FILEFUNC_SEEK_SET)!=0)
|
if (ZSEEK64(*pzlib_filefunc_def,filestream, relativeOffset,ZLIB_FILEFUNC_SEEK_SET)!=0)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
/* the signature */
|
/* the signature */
|
||||||
if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
|
if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
if (uL != 0x06064b50)
|
if (uL != 0x06064b50)
|
||||||
return 0;
|
return CENTRALDIRINVALID;
|
||||||
|
|
||||||
return relativeOffset;
|
return relativeOffset;
|
||||||
}
|
}
|
||||||
|
|
@ -584,19 +492,18 @@ local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
|
||||||
Else, the return value is a unzFile Handle, usable with other function
|
Else, the return value is a unzFile Handle, usable with other function
|
||||||
of this unzip package.
|
of this unzip package.
|
||||||
*/
|
*/
|
||||||
local unzFile unzOpenInternal (const void *path,
|
local unzFile unzOpenInternal(const void *path,
|
||||||
zlib_filefunc64_32_def* pzlib_filefunc64_32_def,
|
zlib_filefunc64_32_def* pzlib_filefunc64_32_def,
|
||||||
int is64bitOpenFunction)
|
int is64bitOpenFunction) {
|
||||||
{
|
|
||||||
unz64_s us;
|
unz64_s us;
|
||||||
unz64_s *s;
|
unz64_s *s;
|
||||||
ZPOS64_T central_pos;
|
ZPOS64_T central_pos;
|
||||||
uLong uL;
|
uLong uL;
|
||||||
|
|
||||||
uLong number_disk; /* number of the current dist, used for
|
uLong number_disk; /* number of the current disk, used for
|
||||||
spaning ZIP, unsupported, always 0*/
|
spanning ZIP, unsupported, always 0*/
|
||||||
uLong number_disk_with_CD; /* number the the disk with central dir, used
|
uLong number_disk_with_CD; /* number the disk with central dir, used
|
||||||
for spaning ZIP, unsupported, always 0*/
|
for spanning ZIP, unsupported, always 0*/
|
||||||
ZPOS64_T number_entry_CD; /* total number of entries in
|
ZPOS64_T number_entry_CD; /* total number of entries in
|
||||||
the central dir
|
the central dir
|
||||||
(same than number_entry on nospan) */
|
(same than number_entry on nospan) */
|
||||||
|
|
@ -625,7 +532,7 @@ local unzFile unzOpenInternal (const void *path,
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
central_pos = unz64local_SearchCentralDir64(&us.z_filefunc,us.filestream);
|
central_pos = unz64local_SearchCentralDir64(&us.z_filefunc,us.filestream);
|
||||||
if (central_pos)
|
if (central_pos!=CENTRALDIRINVALID)
|
||||||
{
|
{
|
||||||
uLong uS;
|
uLong uS;
|
||||||
ZPOS64_T uL64;
|
ZPOS64_T uL64;
|
||||||
|
|
@ -687,7 +594,7 @@ local unzFile unzOpenInternal (const void *path,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
central_pos = unz64local_SearchCentralDir(&us.z_filefunc,us.filestream);
|
central_pos = unz64local_SearchCentralDir(&us.z_filefunc,us.filestream);
|
||||||
if (central_pos==0)
|
if (central_pos==CENTRALDIRINVALID)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
|
|
||||||
us.isZip64 = 0;
|
us.isZip64 = 0;
|
||||||
|
|
@ -766,9 +673,8 @@ local unzFile unzOpenInternal (const void *path,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern unzFile ZEXPORT unzOpen2 (const char *path,
|
extern unzFile ZEXPORT unzOpen2(const char *path,
|
||||||
zlib_filefunc_def* pzlib_filefunc32_def)
|
zlib_filefunc_def* pzlib_filefunc32_def) {
|
||||||
{
|
|
||||||
if (pzlib_filefunc32_def != NULL)
|
if (pzlib_filefunc32_def != NULL)
|
||||||
{
|
{
|
||||||
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
|
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
|
||||||
|
|
@ -779,9 +685,8 @@ extern unzFile ZEXPORT unzOpen2 (const char *path,
|
||||||
return unzOpenInternal(path, NULL, 0);
|
return unzOpenInternal(path, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern unzFile ZEXPORT unzOpen2_64 (const void *path,
|
extern unzFile ZEXPORT unzOpen2_64(const void *path,
|
||||||
zlib_filefunc64_def* pzlib_filefunc_def)
|
zlib_filefunc64_def* pzlib_filefunc_def) {
|
||||||
{
|
|
||||||
if (pzlib_filefunc_def != NULL)
|
if (pzlib_filefunc_def != NULL)
|
||||||
{
|
{
|
||||||
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
|
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
|
||||||
|
|
@ -794,13 +699,11 @@ extern unzFile ZEXPORT unzOpen2_64 (const void *path,
|
||||||
return unzOpenInternal(path, NULL, 1);
|
return unzOpenInternal(path, NULL, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern unzFile ZEXPORT unzOpen (const char *path)
|
extern unzFile ZEXPORT unzOpen(const char *path) {
|
||||||
{
|
|
||||||
return unzOpenInternal(path, NULL, 0);
|
return unzOpenInternal(path, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern unzFile ZEXPORT unzOpen64 (const void *path)
|
extern unzFile ZEXPORT unzOpen64(const void *path) {
|
||||||
{
|
|
||||||
return unzOpenInternal(path, NULL, 1);
|
return unzOpenInternal(path, NULL, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -821,8 +724,7 @@ extern void* unzGetOpaque(unzFile file) {
|
||||||
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
|
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
|
||||||
these files MUST be closed with unzCloseCurrentFile before call unzClose.
|
these files MUST be closed with unzCloseCurrentFile before call unzClose.
|
||||||
return UNZ_OK if there is no problem. */
|
return UNZ_OK if there is no problem. */
|
||||||
extern int ZEXPORT unzClose (unzFile file)
|
extern int ZEXPORT unzClose(unzFile file) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
if (file==NULL)
|
if (file==NULL)
|
||||||
return UNZ_PARAMERROR;
|
return UNZ_PARAMERROR;
|
||||||
|
|
@ -832,7 +734,7 @@ extern int ZEXPORT unzClose (unzFile file)
|
||||||
unzCloseCurrentFile(file);
|
unzCloseCurrentFile(file);
|
||||||
|
|
||||||
ZCLOSE64(s->z_filefunc, s->filestream);
|
ZCLOSE64(s->z_filefunc, s->filestream);
|
||||||
TRYFREE(s);
|
free(s);
|
||||||
return UNZ_OK;
|
return UNZ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -841,8 +743,7 @@ extern int ZEXPORT unzClose (unzFile file)
|
||||||
Write info about the ZipFile in the *pglobal_info structure.
|
Write info about the ZipFile in the *pglobal_info structure.
|
||||||
No preparation of the structure is needed
|
No preparation of the structure is needed
|
||||||
return UNZ_OK if there is no problem. */
|
return UNZ_OK if there is no problem. */
|
||||||
extern int ZEXPORT unzGetGlobalInfo64 (unzFile file, unz_global_info64* pglobal_info)
|
extern int ZEXPORT unzGetGlobalInfo64(unzFile file, unz_global_info64* pglobal_info) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
if (file==NULL)
|
if (file==NULL)
|
||||||
return UNZ_PARAMERROR;
|
return UNZ_PARAMERROR;
|
||||||
|
|
@ -851,8 +752,7 @@ extern int ZEXPORT unzGetGlobalInfo64 (unzFile file, unz_global_info64* pglobal_
|
||||||
return UNZ_OK;
|
return UNZ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT unzGetGlobalInfo (unzFile file, unz_global_info* pglobal_info32)
|
extern int ZEXPORT unzGetGlobalInfo(unzFile file, unz_global_info* pglobal_info32) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
if (file==NULL)
|
if (file==NULL)
|
||||||
return UNZ_PARAMERROR;
|
return UNZ_PARAMERROR;
|
||||||
|
|
@ -863,10 +763,9 @@ extern int ZEXPORT unzGetGlobalInfo (unzFile file, unz_global_info* pglobal_info
|
||||||
return UNZ_OK;
|
return UNZ_OK;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
Translate date/time from Dos format to tm_unz (readable more easilty)
|
Translate date/time from Dos format to tm_unz (readable more easily)
|
||||||
*/
|
*/
|
||||||
local void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm)
|
local void unz64local_DosDateToTmuDate(ZPOS64_T ulDosDate, tm_unz* ptm) {
|
||||||
{
|
|
||||||
ZPOS64_T uDate;
|
ZPOS64_T uDate;
|
||||||
uDate = (ZPOS64_T)(ulDosDate>>16);
|
uDate = (ZPOS64_T)(ulDosDate>>16);
|
||||||
ptm->tm_mday = (int)(uDate&0x1f) ;
|
ptm->tm_mday = (int)(uDate&0x1f) ;
|
||||||
|
|
@ -881,28 +780,16 @@ local void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm)
|
||||||
/*
|
/*
|
||||||
Get Info about the current file in the zipfile, with internal only info
|
Get Info about the current file in the zipfile, with internal only info
|
||||||
*/
|
*/
|
||||||
local int unz64local_GetCurrentFileInfoInternal OF((unzFile file,
|
local int unz64local_GetCurrentFileInfoInternal(unzFile file,
|
||||||
unz_file_info64 *pfile_info,
|
unz_file_info64 *pfile_info,
|
||||||
unz_file_info64_internal
|
unz_file_info64_internal
|
||||||
*pfile_info_internal,
|
*pfile_info_internal,
|
||||||
char *szFileName,
|
char *szFileName,
|
||||||
uLong fileNameBufferSize,
|
uLong fileNameBufferSize,
|
||||||
void *extraField,
|
void *extraField,
|
||||||
uLong extraFieldBufferSize,
|
uLong extraFieldBufferSize,
|
||||||
char *szComment,
|
char *szComment,
|
||||||
uLong commentBufferSize));
|
uLong commentBufferSize) {
|
||||||
|
|
||||||
local int unz64local_GetCurrentFileInfoInternal (unzFile file,
|
|
||||||
unz_file_info64 *pfile_info,
|
|
||||||
unz_file_info64_internal
|
|
||||||
*pfile_info_internal,
|
|
||||||
char *szFileName,
|
|
||||||
uLong fileNameBufferSize,
|
|
||||||
void *extraField,
|
|
||||||
uLong extraFieldBufferSize,
|
|
||||||
char *szComment,
|
|
||||||
uLong commentBufferSize)
|
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
unz_file_info64 file_info;
|
unz_file_info64 file_info;
|
||||||
unz_file_info64_internal file_info_internal;
|
unz_file_info64_internal file_info_internal;
|
||||||
|
|
@ -1067,33 +954,31 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
|
||||||
/* ZIP64 extra fields */
|
/* ZIP64 extra fields */
|
||||||
if (headerId == 0x0001)
|
if (headerId == 0x0001)
|
||||||
{
|
{
|
||||||
uLong uL;
|
if(file_info.uncompressed_size == MAXU32)
|
||||||
|
{
|
||||||
|
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
|
||||||
|
err=UNZ_ERRNO;
|
||||||
|
}
|
||||||
|
|
||||||
if(file_info.uncompressed_size == MAXU32)
|
if(file_info.compressed_size == MAXU32)
|
||||||
{
|
{
|
||||||
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
|
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(file_info.compressed_size == MAXU32)
|
if(file_info_internal.offset_curfile == MAXU32)
|
||||||
{
|
{
|
||||||
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
|
/* Relative Header offset */
|
||||||
err=UNZ_ERRNO;
|
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
|
||||||
}
|
err=UNZ_ERRNO;
|
||||||
|
}
|
||||||
|
|
||||||
if(file_info_internal.offset_curfile == MAXU32)
|
if(file_info.disk_num_start == 0xffff)
|
||||||
{
|
{
|
||||||
/* Relative Header offset */
|
/* Disk Start Number */
|
||||||
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
|
if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.disk_num_start) != UNZ_OK)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(file_info.disk_num_start == MAXU32)
|
|
||||||
{
|
|
||||||
/* Disk Start Number */
|
|
||||||
if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
|
|
||||||
err=UNZ_ERRNO;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1150,24 +1035,22 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
|
||||||
No preparation of the structure is needed
|
No preparation of the structure is needed
|
||||||
return UNZ_OK if there is no problem.
|
return UNZ_OK if there is no problem.
|
||||||
*/
|
*/
|
||||||
extern int ZEXPORT unzGetCurrentFileInfo64 (unzFile file,
|
extern int ZEXPORT unzGetCurrentFileInfo64(unzFile file,
|
||||||
unz_file_info64 * pfile_info,
|
unz_file_info64 * pfile_info,
|
||||||
char * szFileName, uLong fileNameBufferSize,
|
char * szFileName, uLong fileNameBufferSize,
|
||||||
void *extraField, uLong extraFieldBufferSize,
|
void *extraField, uLong extraFieldBufferSize,
|
||||||
char* szComment, uLong commentBufferSize)
|
char* szComment, uLong commentBufferSize) {
|
||||||
{
|
|
||||||
return unz64local_GetCurrentFileInfoInternal(file,pfile_info,NULL,
|
return unz64local_GetCurrentFileInfoInternal(file,pfile_info,NULL,
|
||||||
szFileName,fileNameBufferSize,
|
szFileName,fileNameBufferSize,
|
||||||
extraField,extraFieldBufferSize,
|
extraField,extraFieldBufferSize,
|
||||||
szComment,commentBufferSize);
|
szComment,commentBufferSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT unzGetCurrentFileInfo (unzFile file,
|
extern int ZEXPORT unzGetCurrentFileInfo(unzFile file,
|
||||||
unz_file_info * pfile_info,
|
unz_file_info * pfile_info,
|
||||||
char * szFileName, uLong fileNameBufferSize,
|
char * szFileName, uLong fileNameBufferSize,
|
||||||
void *extraField, uLong extraFieldBufferSize,
|
void *extraField, uLong extraFieldBufferSize,
|
||||||
char* szComment, uLong commentBufferSize)
|
char* szComment, uLong commentBufferSize) {
|
||||||
{
|
|
||||||
int err;
|
int err;
|
||||||
unz_file_info64 file_info64;
|
unz_file_info64 file_info64;
|
||||||
err = unz64local_GetCurrentFileInfoInternal(file,&file_info64,NULL,
|
err = unz64local_GetCurrentFileInfoInternal(file,&file_info64,NULL,
|
||||||
|
|
@ -1191,7 +1074,7 @@ extern int ZEXPORT unzGetCurrentFileInfo (unzFile file,
|
||||||
pfile_info->internal_fa = file_info64.internal_fa;
|
pfile_info->internal_fa = file_info64.internal_fa;
|
||||||
pfile_info->external_fa = file_info64.external_fa;
|
pfile_info->external_fa = file_info64.external_fa;
|
||||||
|
|
||||||
pfile_info->tmu_date = file_info64.tmu_date,
|
pfile_info->tmu_date = file_info64.tmu_date;
|
||||||
|
|
||||||
|
|
||||||
pfile_info->compressed_size = (uLong)file_info64.compressed_size;
|
pfile_info->compressed_size = (uLong)file_info64.compressed_size;
|
||||||
|
|
@ -1204,8 +1087,7 @@ extern int ZEXPORT unzGetCurrentFileInfo (unzFile file,
|
||||||
Set the current file of the zipfile to the first file.
|
Set the current file of the zipfile to the first file.
|
||||||
return UNZ_OK if there is no problem
|
return UNZ_OK if there is no problem
|
||||||
*/
|
*/
|
||||||
extern int ZEXPORT unzGoToFirstFile (unzFile file)
|
extern int ZEXPORT unzGoToFirstFile(unzFile file) {
|
||||||
{
|
|
||||||
int err=UNZ_OK;
|
int err=UNZ_OK;
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
if (file==NULL)
|
if (file==NULL)
|
||||||
|
|
@ -1225,8 +1107,7 @@ extern int ZEXPORT unzGoToFirstFile (unzFile file)
|
||||||
return UNZ_OK if there is no problem
|
return UNZ_OK if there is no problem
|
||||||
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
|
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
|
||||||
*/
|
*/
|
||||||
extern int ZEXPORT unzGoToNextFile (unzFile file)
|
extern int ZEXPORT unzGoToNextFile(unzFile file) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
|
@ -1258,8 +1139,7 @@ extern int ZEXPORT unzGoToNextFile (unzFile file)
|
||||||
UNZ_OK if the file is found. It becomes the current file.
|
UNZ_OK if the file is found. It becomes the current file.
|
||||||
UNZ_END_OF_LIST_OF_FILE if the file is not found
|
UNZ_END_OF_LIST_OF_FILE if the file is not found
|
||||||
*/
|
*/
|
||||||
extern int ZEXPORT unzLocateFile (unzFile file, const char *szFileName, int iCaseSensitivity)
|
extern int ZEXPORT unzLocateFile(unzFile file, const char *szFileName, int iCaseSensitivity) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
|
@ -1334,8 +1214,7 @@ typedef struct unz_file_pos_s
|
||||||
} unz_file_pos;
|
} unz_file_pos;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos* file_pos)
|
extern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos* file_pos) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
|
|
||||||
if (file==NULL || file_pos==NULL)
|
if (file==NULL || file_pos==NULL)
|
||||||
|
|
@ -1350,10 +1229,7 @@ extern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos* file_pos)
|
||||||
return UNZ_OK;
|
return UNZ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT unzGetFilePos(
|
extern int ZEXPORT unzGetFilePos(unzFile file, unz_file_pos* file_pos) {
|
||||||
unzFile file,
|
|
||||||
unz_file_pos* file_pos)
|
|
||||||
{
|
|
||||||
unz64_file_pos file_pos64;
|
unz64_file_pos file_pos64;
|
||||||
int err = unzGetFilePos64(file,&file_pos64);
|
int err = unzGetFilePos64(file,&file_pos64);
|
||||||
if (err==UNZ_OK)
|
if (err==UNZ_OK)
|
||||||
|
|
@ -1364,8 +1240,7 @@ extern int ZEXPORT unzGetFilePos(
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos* file_pos)
|
extern int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos* file_pos) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
|
@ -1386,10 +1261,7 @@ extern int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos* file_pos
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT unzGoToFilePos(
|
extern int ZEXPORT unzGoToFilePos(unzFile file, unz_file_pos* file_pos) {
|
||||||
unzFile file,
|
|
||||||
unz_file_pos* file_pos)
|
|
||||||
{
|
|
||||||
unz64_file_pos file_pos64;
|
unz64_file_pos file_pos64;
|
||||||
if (file_pos == NULL)
|
if (file_pos == NULL)
|
||||||
return UNZ_PARAMERROR;
|
return UNZ_PARAMERROR;
|
||||||
|
|
@ -1411,10 +1283,9 @@ extern int ZEXPORT unzGoToFilePos(
|
||||||
store in *piSizeVar the size of extra info in local header
|
store in *piSizeVar the size of extra info in local header
|
||||||
(filename and size of extra field data)
|
(filename and size of extra field data)
|
||||||
*/
|
*/
|
||||||
local int unz64local_CheckCurrentFileCoherencyHeader (unz64_s* s, uInt* piSizeVar,
|
local int unz64local_CheckCurrentFileCoherencyHeader(unz64_s* s, uInt* piSizeVar,
|
||||||
ZPOS64_T * poffset_local_extrafield,
|
ZPOS64_T * poffset_local_extrafield,
|
||||||
uInt * psize_local_extrafield)
|
uInt * psize_local_extrafield) {
|
||||||
{
|
|
||||||
uLong uMagic,uData,uFlags;
|
uLong uMagic,uData,uFlags;
|
||||||
uLong size_filename;
|
uLong size_filename;
|
||||||
uLong size_extra_field;
|
uLong size_extra_field;
|
||||||
|
|
@ -1498,9 +1369,8 @@ local int unz64local_CheckCurrentFileCoherencyHeader (unz64_s* s, uInt* piSizeVa
|
||||||
Open for reading data the current file in the zipfile.
|
Open for reading data the current file in the zipfile.
|
||||||
If there is no error and the file is opened, the return value is UNZ_OK.
|
If there is no error and the file is opened, the return value is UNZ_OK.
|
||||||
*/
|
*/
|
||||||
extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
|
extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
|
||||||
int* level, int raw, const char* password)
|
int* level, int raw, const char* password) {
|
||||||
{
|
|
||||||
int err=UNZ_OK;
|
int err=UNZ_OK;
|
||||||
uInt iSizeVar;
|
uInt iSizeVar;
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
|
|
@ -1538,7 +1408,7 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
|
||||||
|
|
||||||
if (pfile_in_zip_read_info->read_buffer==NULL)
|
if (pfile_in_zip_read_info->read_buffer==NULL)
|
||||||
{
|
{
|
||||||
TRYFREE(pfile_in_zip_read_info);
|
free(pfile_in_zip_read_info);
|
||||||
return UNZ_INTERNALERROR;
|
return UNZ_INTERNALERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1595,8 +1465,8 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
|
||||||
pfile_in_zip_read_info->stream_initialised=Z_BZIP2ED;
|
pfile_in_zip_read_info->stream_initialised=Z_BZIP2ED;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TRYFREE(pfile_in_zip_read_info->read_buffer);
|
free(pfile_in_zip_read_info->read_buffer);
|
||||||
TRYFREE(pfile_in_zip_read_info);
|
free(pfile_in_zip_read_info);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
@ -1618,8 +1488,8 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
|
||||||
pfile_in_zip_read_info->stream_initialised=Z_DEFLATED;
|
pfile_in_zip_read_info->stream_initialised=Z_DEFLATED;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TRYFREE(pfile_in_zip_read_info->read_buffer);
|
free(pfile_in_zip_read_info->read_buffer);
|
||||||
TRYFREE(pfile_in_zip_read_info);
|
free(pfile_in_zip_read_info);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
/* windowBits is passed < 0 to tell that there is no zlib header.
|
/* windowBits is passed < 0 to tell that there is no zlib header.
|
||||||
|
|
@ -1753,25 +1623,21 @@ extern int ZEXPORT unzSeekCurrentFile(unzFile file, int pos) {
|
||||||
}
|
}
|
||||||
/* GODOT end */
|
/* GODOT end */
|
||||||
|
|
||||||
extern int ZEXPORT unzOpenCurrentFile (unzFile file)
|
extern int ZEXPORT unzOpenCurrentFile(unzFile file) {
|
||||||
{
|
|
||||||
return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);
|
return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT unzOpenCurrentFilePassword (unzFile file, const char* password)
|
extern int ZEXPORT unzOpenCurrentFilePassword(unzFile file, const char* password) {
|
||||||
{
|
|
||||||
return unzOpenCurrentFile3(file, NULL, NULL, 0, password);
|
return unzOpenCurrentFile3(file, NULL, NULL, 0, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT unzOpenCurrentFile2 (unzFile file, int* method, int* level, int raw)
|
extern int ZEXPORT unzOpenCurrentFile2(unzFile file, int* method, int* level, int raw) {
|
||||||
{
|
|
||||||
return unzOpenCurrentFile3(file, method, level, raw, NULL);
|
return unzOpenCurrentFile3(file, method, level, raw, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Addition for GDAL : START */
|
/** Addition for GDAL : START */
|
||||||
|
|
||||||
extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64( unzFile file)
|
extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64(unzFile file) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
file_in_zip64_read_info_s* pfile_in_zip_read_info;
|
file_in_zip64_read_info_s* pfile_in_zip_read_info;
|
||||||
s=(unz64_s*)file;
|
s=(unz64_s*)file;
|
||||||
|
|
@ -1791,13 +1657,12 @@ extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64( unzFile file)
|
||||||
buf contain buffer where data must be copied
|
buf contain buffer where data must be copied
|
||||||
len the size of buf.
|
len the size of buf.
|
||||||
|
|
||||||
return the number of byte copied if somes bytes are copied
|
return the number of byte copied if some bytes are copied
|
||||||
return 0 if the end of file was reached
|
return 0 if the end of file was reached
|
||||||
return <0 with error code if there is an error
|
return <0 with error code if there is an error
|
||||||
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
|
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
|
||||||
*/
|
*/
|
||||||
extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len)
|
extern int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, unsigned len) {
|
||||||
{
|
|
||||||
int err=UNZ_OK;
|
int err=UNZ_OK;
|
||||||
uInt iRead = 0;
|
uInt iRead = 0;
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
|
|
@ -2004,8 +1869,7 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len)
|
||||||
/*
|
/*
|
||||||
Give the current position in uncompressed data
|
Give the current position in uncompressed data
|
||||||
*/
|
*/
|
||||||
extern z_off_t ZEXPORT unztell (unzFile file)
|
extern z_off_t ZEXPORT unztell(unzFile file) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
file_in_zip64_read_info_s* pfile_in_zip_read_info;
|
file_in_zip64_read_info_s* pfile_in_zip_read_info;
|
||||||
if (file==NULL)
|
if (file==NULL)
|
||||||
|
|
@ -2019,8 +1883,7 @@ extern z_off_t ZEXPORT unztell (unzFile file)
|
||||||
return (z_off_t)pfile_in_zip_read_info->stream.total_out;
|
return (z_off_t)pfile_in_zip_read_info->stream.total_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern ZPOS64_T ZEXPORT unztell64 (unzFile file)
|
extern ZPOS64_T ZEXPORT unztell64(unzFile file) {
|
||||||
{
|
|
||||||
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
file_in_zip64_read_info_s* pfile_in_zip_read_info;
|
file_in_zip64_read_info_s* pfile_in_zip_read_info;
|
||||||
|
|
@ -2039,8 +1902,7 @@ extern ZPOS64_T ZEXPORT unztell64 (unzFile file)
|
||||||
/*
|
/*
|
||||||
return 1 if the end of file was reached, 0 elsewhere
|
return 1 if the end of file was reached, 0 elsewhere
|
||||||
*/
|
*/
|
||||||
extern int ZEXPORT unzeof (unzFile file)
|
extern int ZEXPORT unzeof(unzFile file) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
file_in_zip64_read_info_s* pfile_in_zip_read_info;
|
file_in_zip64_read_info_s* pfile_in_zip_read_info;
|
||||||
if (file==NULL)
|
if (file==NULL)
|
||||||
|
|
@ -2071,8 +1933,7 @@ more info in the local-header version than in the central-header)
|
||||||
the return value is the number of bytes copied in buf, or (if <0)
|
the return value is the number of bytes copied in buf, or (if <0)
|
||||||
the error code
|
the error code
|
||||||
*/
|
*/
|
||||||
extern int ZEXPORT unzGetLocalExtrafield (unzFile file, voidp buf, unsigned len)
|
extern int ZEXPORT unzGetLocalExtrafield(unzFile file, voidp buf, unsigned len) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
file_in_zip64_read_info_s* pfile_in_zip_read_info;
|
file_in_zip64_read_info_s* pfile_in_zip_read_info;
|
||||||
uInt read_now;
|
uInt read_now;
|
||||||
|
|
@ -2119,8 +1980,7 @@ extern int ZEXPORT unzGetLocalExtrafield (unzFile file, voidp buf, unsigned len)
|
||||||
Close the file in zip opened with unzOpenCurrentFile
|
Close the file in zip opened with unzOpenCurrentFile
|
||||||
Return UNZ_CRCERROR if all the file was read but the CRC is not good
|
Return UNZ_CRCERROR if all the file was read but the CRC is not good
|
||||||
*/
|
*/
|
||||||
extern int ZEXPORT unzCloseCurrentFile (unzFile file)
|
extern int ZEXPORT unzCloseCurrentFile(unzFile file) {
|
||||||
{
|
|
||||||
int err=UNZ_OK;
|
int err=UNZ_OK;
|
||||||
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
|
|
@ -2142,7 +2002,7 @@ extern int ZEXPORT unzCloseCurrentFile (unzFile file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TRYFREE(pfile_in_zip_read_info->read_buffer);
|
free(pfile_in_zip_read_info->read_buffer);
|
||||||
pfile_in_zip_read_info->read_buffer = NULL;
|
pfile_in_zip_read_info->read_buffer = NULL;
|
||||||
if (pfile_in_zip_read_info->stream_initialised == Z_DEFLATED)
|
if (pfile_in_zip_read_info->stream_initialised == Z_DEFLATED)
|
||||||
inflateEnd(&pfile_in_zip_read_info->stream);
|
inflateEnd(&pfile_in_zip_read_info->stream);
|
||||||
|
|
@ -2153,7 +2013,7 @@ extern int ZEXPORT unzCloseCurrentFile (unzFile file)
|
||||||
|
|
||||||
|
|
||||||
pfile_in_zip_read_info->stream_initialised = 0;
|
pfile_in_zip_read_info->stream_initialised = 0;
|
||||||
TRYFREE(pfile_in_zip_read_info);
|
free(pfile_in_zip_read_info);
|
||||||
|
|
||||||
s->pfile_in_zip_read=NULL;
|
s->pfile_in_zip_read=NULL;
|
||||||
|
|
||||||
|
|
@ -2166,8 +2026,7 @@ extern int ZEXPORT unzCloseCurrentFile (unzFile file)
|
||||||
uSizeBuf is the size of the szComment buffer.
|
uSizeBuf is the size of the szComment buffer.
|
||||||
return the number of byte copied or an error code <0
|
return the number of byte copied or an error code <0
|
||||||
*/
|
*/
|
||||||
extern int ZEXPORT unzGetGlobalComment (unzFile file, char * szComment, uLong uSizeBuf)
|
extern int ZEXPORT unzGetGlobalComment(unzFile file, char * szComment, uLong uSizeBuf) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
uLong uReadThis ;
|
uLong uReadThis ;
|
||||||
if (file==NULL)
|
if (file==NULL)
|
||||||
|
|
@ -2194,8 +2053,7 @@ extern int ZEXPORT unzGetGlobalComment (unzFile file, char * szComment, uLong uS
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Additions by RX '2004 */
|
/* Additions by RX '2004 */
|
||||||
extern ZPOS64_T ZEXPORT unzGetOffset64(unzFile file)
|
extern ZPOS64_T ZEXPORT unzGetOffset64(unzFile file) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
|
|
||||||
if (file==NULL)
|
if (file==NULL)
|
||||||
|
|
@ -2209,8 +2067,7 @@ extern ZPOS64_T ZEXPORT unzGetOffset64(unzFile file)
|
||||||
return s->pos_in_central_dir;
|
return s->pos_in_central_dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern uLong ZEXPORT unzGetOffset (unzFile file)
|
extern uLong ZEXPORT unzGetOffset(unzFile file) {
|
||||||
{
|
|
||||||
ZPOS64_T offset64;
|
ZPOS64_T offset64;
|
||||||
|
|
||||||
if (file==NULL)
|
if (file==NULL)
|
||||||
|
|
@ -2219,8 +2076,7 @@ extern uLong ZEXPORT unzGetOffset (unzFile file)
|
||||||
return (uLong)offset64;
|
return (uLong)offset64;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos)
|
extern int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos) {
|
||||||
{
|
|
||||||
unz64_s* s;
|
unz64_s* s;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
|
@ -2237,7 +2093,6 @@ extern int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT unzSetOffset (unzFile file, uLong pos)
|
extern int ZEXPORT unzSetOffset (unzFile file, uLong pos) {
|
||||||
{
|
|
||||||
return unzSetOffset64(file,pos);
|
return unzSetOffset64(file,pos);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
136
thirdparty/minizip/unzip.h
vendored
136
thirdparty/minizip/unzip.h
vendored
|
|
@ -150,21 +150,21 @@ typedef struct unz_file_info_s
|
||||||
tm_unz tmu_date;
|
tm_unz tmu_date;
|
||||||
} unz_file_info;
|
} unz_file_info;
|
||||||
|
|
||||||
extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
|
extern int ZEXPORT unzStringFileNameCompare(const char* fileName1,
|
||||||
const char* fileName2,
|
const char* fileName2,
|
||||||
int iCaseSensitivity));
|
int iCaseSensitivity);
|
||||||
/*
|
/*
|
||||||
Compare two filename (fileName1,fileName2).
|
Compare two filenames (fileName1,fileName2).
|
||||||
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
|
If iCaseSensitivity = 1, comparison is case sensitive (like strcmp)
|
||||||
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
|
If iCaseSensitivity = 2, comparison is not case sensitive (like strcmpi
|
||||||
or strcasecmp)
|
or strcasecmp)
|
||||||
If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
|
If iCaseSensitivity = 0, case sensitivity is default of your operating system
|
||||||
(like 1 on Unix, 2 on Windows)
|
(like 1 on Unix, 2 on Windows)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
extern unzFile ZEXPORT unzOpen OF((const char *path));
|
extern unzFile ZEXPORT unzOpen(const char *path);
|
||||||
extern unzFile ZEXPORT unzOpen64 OF((const void *path));
|
extern unzFile ZEXPORT unzOpen64(const void *path);
|
||||||
/*
|
/*
|
||||||
Open a Zip file. path contain the full pathname (by example,
|
Open a Zip file. path contain the full pathname (by example,
|
||||||
on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
|
on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
|
||||||
|
|
@ -181,21 +181,21 @@ extern unzFile ZEXPORT unzOpen64 OF((const void *path));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
extern unzFile ZEXPORT unzOpen2 OF((const char *path,
|
extern unzFile ZEXPORT unzOpen2(const char *path,
|
||||||
zlib_filefunc_def* pzlib_filefunc_def));
|
zlib_filefunc_def* pzlib_filefunc_def);
|
||||||
/*
|
/*
|
||||||
Open a Zip file, like unzOpen, but provide a set of file low level API
|
Open a Zip file, like unzOpen, but provide a set of file low level API
|
||||||
for read/write the zip file (see ioapi.h)
|
for read/write the zip file (see ioapi.h)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern unzFile ZEXPORT unzOpen2_64 OF((const void *path,
|
extern unzFile ZEXPORT unzOpen2_64(const void *path,
|
||||||
zlib_filefunc64_def* pzlib_filefunc_def));
|
zlib_filefunc64_def* pzlib_filefunc_def);
|
||||||
/*
|
/*
|
||||||
Open a Zip file, like unz64Open, but provide a set of file low level API
|
Open a Zip file, like unz64Open, but provide a set of file low level API
|
||||||
for read/write the zip file (see ioapi.h)
|
for read/write the zip file (see ioapi.h)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT unzClose OF((unzFile file));
|
extern int ZEXPORT unzClose(unzFile file);
|
||||||
/*
|
/*
|
||||||
Close a ZipFile opened with unzOpen.
|
Close a ZipFile opened with unzOpen.
|
||||||
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
|
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
|
||||||
|
|
@ -206,20 +206,20 @@ extern int ZEXPORT unzClose OF((unzFile file));
|
||||||
extern void* unzGetOpaque(unzFile file);
|
extern void* unzGetOpaque(unzFile file);
|
||||||
/* GODOT end */
|
/* GODOT end */
|
||||||
|
|
||||||
extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
|
extern int ZEXPORT unzGetGlobalInfo(unzFile file,
|
||||||
unz_global_info *pglobal_info));
|
unz_global_info *pglobal_info);
|
||||||
|
|
||||||
extern int ZEXPORT unzGetGlobalInfo64 OF((unzFile file,
|
extern int ZEXPORT unzGetGlobalInfo64(unzFile file,
|
||||||
unz_global_info64 *pglobal_info));
|
unz_global_info64 *pglobal_info);
|
||||||
/*
|
/*
|
||||||
Write info about the ZipFile in the *pglobal_info structure.
|
Write info about the ZipFile in the *pglobal_info structure.
|
||||||
No preparation of the structure is needed
|
No preparation of the structure is needed
|
||||||
return UNZ_OK if there is no problem. */
|
return UNZ_OK if there is no problem. */
|
||||||
|
|
||||||
|
|
||||||
extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
|
extern int ZEXPORT unzGetGlobalComment(unzFile file,
|
||||||
char *szComment,
|
char *szComment,
|
||||||
uLong uSizeBuf));
|
uLong uSizeBuf);
|
||||||
/*
|
/*
|
||||||
Get the global comment string of the ZipFile, in the szComment buffer.
|
Get the global comment string of the ZipFile, in the szComment buffer.
|
||||||
uSizeBuf is the size of the szComment buffer.
|
uSizeBuf is the size of the szComment buffer.
|
||||||
|
|
@ -230,22 +230,22 @@ extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* Unzip package allow you browse the directory of the zipfile */
|
/* Unzip package allow you browse the directory of the zipfile */
|
||||||
|
|
||||||
extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
|
extern int ZEXPORT unzGoToFirstFile(unzFile file);
|
||||||
/*
|
/*
|
||||||
Set the current file of the zipfile to the first file.
|
Set the current file of the zipfile to the first file.
|
||||||
return UNZ_OK if there is no problem
|
return UNZ_OK if there is no problem
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT unzGoToNextFile OF((unzFile file));
|
extern int ZEXPORT unzGoToNextFile(unzFile file);
|
||||||
/*
|
/*
|
||||||
Set the current file of the zipfile to the next file.
|
Set the current file of the zipfile to the next file.
|
||||||
return UNZ_OK if there is no problem
|
return UNZ_OK if there is no problem
|
||||||
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
|
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT unzLocateFile OF((unzFile file,
|
extern int ZEXPORT unzLocateFile(unzFile file,
|
||||||
const char *szFileName,
|
const char *szFileName,
|
||||||
int iCaseSensitivity));
|
int iCaseSensitivity);
|
||||||
/*
|
/*
|
||||||
Try locate the file szFileName in the zipfile.
|
Try locate the file szFileName in the zipfile.
|
||||||
For the iCaseSensitivity signification, see unzStringFileNameCompare
|
For the iCaseSensitivity signification, see unzStringFileNameCompare
|
||||||
|
|
@ -289,28 +289,28 @@ extern int ZEXPORT unzGoToFilePos64(
|
||||||
|
|
||||||
/* ****************************************** */
|
/* ****************************************** */
|
||||||
|
|
||||||
extern int ZEXPORT unzGetCurrentFileInfo64 OF((unzFile file,
|
extern int ZEXPORT unzGetCurrentFileInfo64(unzFile file,
|
||||||
unz_file_info64 *pfile_info,
|
unz_file_info64 *pfile_info,
|
||||||
char *szFileName,
|
char *szFileName,
|
||||||
uLong fileNameBufferSize,
|
uLong fileNameBufferSize,
|
||||||
void *extraField,
|
void *extraField,
|
||||||
uLong extraFieldBufferSize,
|
uLong extraFieldBufferSize,
|
||||||
char *szComment,
|
char *szComment,
|
||||||
uLong commentBufferSize));
|
uLong commentBufferSize);
|
||||||
|
|
||||||
extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
|
extern int ZEXPORT unzGetCurrentFileInfo(unzFile file,
|
||||||
unz_file_info *pfile_info,
|
unz_file_info *pfile_info,
|
||||||
char *szFileName,
|
char *szFileName,
|
||||||
uLong fileNameBufferSize,
|
uLong fileNameBufferSize,
|
||||||
void *extraField,
|
void *extraField,
|
||||||
uLong extraFieldBufferSize,
|
uLong extraFieldBufferSize,
|
||||||
char *szComment,
|
char *szComment,
|
||||||
uLong commentBufferSize));
|
uLong commentBufferSize);
|
||||||
/*
|
/*
|
||||||
Get Info about the current file
|
Get Info about the current file
|
||||||
if pfile_info!=NULL, the *pfile_info structure will contain somes info about
|
if pfile_info!=NULL, the *pfile_info structure will contain some info about
|
||||||
the current file
|
the current file
|
||||||
if szFileName!=NULL, the filemane string will be copied in szFileName
|
if szFileName!=NULL, the filename string will be copied in szFileName
|
||||||
(fileNameBufferSize is the size of the buffer)
|
(fileNameBufferSize is the size of the buffer)
|
||||||
if extraField!=NULL, the extra field information will be copied in extraField
|
if extraField!=NULL, the extra field information will be copied in extraField
|
||||||
(extraFieldBufferSize is the size of the buffer).
|
(extraFieldBufferSize is the size of the buffer).
|
||||||
|
|
@ -322,7 +322,7 @@ extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
|
||||||
|
|
||||||
/** Addition for GDAL : START */
|
/** Addition for GDAL : START */
|
||||||
|
|
||||||
extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file));
|
extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64(unzFile file);
|
||||||
|
|
||||||
/** Addition for GDAL : END */
|
/** Addition for GDAL : END */
|
||||||
|
|
||||||
|
|
@ -332,24 +332,24 @@ extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file));
|
||||||
from it, and close it (you can close it before reading all the file)
|
from it, and close it (you can close it before reading all the file)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
|
extern int ZEXPORT unzOpenCurrentFile(unzFile file);
|
||||||
/*
|
/*
|
||||||
Open for reading data the current file in the zipfile.
|
Open for reading data the current file in the zipfile.
|
||||||
If there is no error, the return value is UNZ_OK.
|
If there is no error, the return value is UNZ_OK.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file,
|
extern int ZEXPORT unzOpenCurrentFilePassword(unzFile file,
|
||||||
const char* password));
|
const char* password);
|
||||||
/*
|
/*
|
||||||
Open for reading data the current file in the zipfile.
|
Open for reading data the current file in the zipfile.
|
||||||
password is a crypting password
|
password is a crypting password
|
||||||
If there is no error, the return value is UNZ_OK.
|
If there is no error, the return value is UNZ_OK.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
|
extern int ZEXPORT unzOpenCurrentFile2(unzFile file,
|
||||||
int* method,
|
int* method,
|
||||||
int* level,
|
int* level,
|
||||||
int raw));
|
int raw);
|
||||||
/*
|
/*
|
||||||
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
|
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
|
||||||
if raw==1
|
if raw==1
|
||||||
|
|
@ -359,11 +359,11 @@ extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
|
||||||
but you CANNOT set method parameter as NULL
|
but you CANNOT set method parameter as NULL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,
|
extern int ZEXPORT unzOpenCurrentFile3(unzFile file,
|
||||||
int* method,
|
int* method,
|
||||||
int* level,
|
int* level,
|
||||||
int raw,
|
int raw,
|
||||||
const char* password));
|
const char* password);
|
||||||
/*
|
/*
|
||||||
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
|
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
|
||||||
if raw==1
|
if raw==1
|
||||||
|
|
@ -374,21 +374,21 @@ extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
|
extern int ZEXPORT unzCloseCurrentFile(unzFile file);
|
||||||
/*
|
/*
|
||||||
Close the file in zip opened with unzOpenCurrentFile
|
Close the file in zip opened with unzOpenCurrentFile
|
||||||
Return UNZ_CRCERROR if all the file was read but the CRC is not good
|
Return UNZ_CRCERROR if all the file was read but the CRC is not good
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
|
extern int ZEXPORT unzReadCurrentFile(unzFile file,
|
||||||
voidp buf,
|
voidp buf,
|
||||||
unsigned len));
|
unsigned len);
|
||||||
/*
|
/*
|
||||||
Read bytes from the current file (opened by unzOpenCurrentFile)
|
Read bytes from the current file (opened by unzOpenCurrentFile)
|
||||||
buf contain buffer where data must be copied
|
buf contain buffer where data must be copied
|
||||||
len the size of buf.
|
len the size of buf.
|
||||||
|
|
||||||
return the number of byte copied if somes bytes are copied
|
return the number of byte copied if some bytes are copied
|
||||||
return 0 if the end of file was reached
|
return 0 if the end of file was reached
|
||||||
return <0 with error code if there is an error
|
return <0 with error code if there is an error
|
||||||
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
|
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
|
||||||
|
|
@ -401,21 +401,21 @@ extern int ZEXPORT unzSeekCurrentFile(unzFile file, int pos);
|
||||||
*/
|
*/
|
||||||
/* GODOT end */
|
/* GODOT end */
|
||||||
|
|
||||||
extern z_off_t ZEXPORT unztell OF((unzFile file));
|
extern z_off_t ZEXPORT unztell(unzFile file);
|
||||||
|
|
||||||
extern ZPOS64_T ZEXPORT unztell64 OF((unzFile file));
|
extern ZPOS64_T ZEXPORT unztell64(unzFile file);
|
||||||
/*
|
/*
|
||||||
Give the current position in uncompressed data
|
Give the current position in uncompressed data
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT unzeof OF((unzFile file));
|
extern int ZEXPORT unzeof(unzFile file);
|
||||||
/*
|
/*
|
||||||
return 1 if the end of file was reached, 0 elsewhere
|
return 1 if the end of file was reached, 0 elsewhere
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
|
extern int ZEXPORT unzGetLocalExtrafield(unzFile file,
|
||||||
voidp buf,
|
voidp buf,
|
||||||
unsigned len));
|
unsigned len);
|
||||||
/*
|
/*
|
||||||
Read extra field from the current file (opened by unzOpenCurrentFile)
|
Read extra field from the current file (opened by unzOpenCurrentFile)
|
||||||
This is the local-header version of the extra field (sometimes, there is
|
This is the local-header version of the extra field (sometimes, there is
|
||||||
|
|
|
||||||
325
thirdparty/minizip/zip.c
vendored
325
thirdparty/minizip/zip.c
vendored
|
|
@ -14,7 +14,7 @@
|
||||||
Oct-2009 - Mathias Svensson - Added Zip64 Support when creating new file archives
|
Oct-2009 - Mathias Svensson - Added Zip64 Support when creating new file archives
|
||||||
Oct-2009 - Mathias Svensson - Did some code cleanup and refactoring to get better overview of some functions.
|
Oct-2009 - Mathias Svensson - Did some code cleanup and refactoring to get better overview of some functions.
|
||||||
Oct-2009 - Mathias Svensson - Added zipRemoveExtraInfoBlock to strip extra field data from its ZIP64 data
|
Oct-2009 - Mathias Svensson - Added zipRemoveExtraInfoBlock to strip extra field data from its ZIP64 data
|
||||||
It is used when recreting zip archive with RAW when deleting items from a zip.
|
It is used when recreating zip archive with RAW when deleting items from a zip.
|
||||||
ZIP64 data is automatically added to items that needs it, and existing ZIP64 data need to be removed.
|
ZIP64 data is automatically added to items that needs it, and existing ZIP64 data need to be removed.
|
||||||
Oct-2009 - Mathias Svensson - Added support for BZIP2 as compression mode (bzip2 lib is required)
|
Oct-2009 - Mathias Svensson - Added support for BZIP2 as compression mode (bzip2 lib is required)
|
||||||
Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer
|
Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer
|
||||||
|
|
@ -25,14 +25,13 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "zlib.h"
|
#include "zlib.h"
|
||||||
#include "zip.h"
|
#include "zip.h"
|
||||||
|
|
||||||
#ifdef STDC
|
#ifdef STDC
|
||||||
# include <stddef.h>
|
# include <stddef.h>
|
||||||
# include <string.h>
|
|
||||||
# include <stdlib.h>
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef NO_ERRNO_H
|
#ifdef NO_ERRNO_H
|
||||||
extern int errno;
|
extern int errno;
|
||||||
|
|
@ -47,7 +46,7 @@
|
||||||
/* compile with -Dlocal if your debugger can't find static symbols */
|
/* compile with -Dlocal if your debugger can't find static symbols */
|
||||||
|
|
||||||
#ifndef VERSIONMADEBY
|
#ifndef VERSIONMADEBY
|
||||||
# define VERSIONMADEBY (0x0) /* platform depedent */
|
# define VERSIONMADEBY (0x0) /* platform dependent */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef Z_BUFSIZE
|
#ifndef Z_BUFSIZE
|
||||||
|
|
@ -61,9 +60,6 @@
|
||||||
#ifndef ALLOC
|
#ifndef ALLOC
|
||||||
# define ALLOC(size) (malloc(size))
|
# define ALLOC(size) (malloc(size))
|
||||||
#endif
|
#endif
|
||||||
#ifndef TRYFREE
|
|
||||||
# define TRYFREE(p) {if (p) free(p);}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#define SIZECENTRALDIRITEM (0x2e)
|
#define SIZECENTRALDIRITEM (0x2e)
|
||||||
|
|
@ -138,20 +134,20 @@ typedef struct
|
||||||
uInt pos_in_buffered_data; /* last written byte in buffered_data */
|
uInt pos_in_buffered_data; /* last written byte in buffered_data */
|
||||||
|
|
||||||
ZPOS64_T pos_local_header; /* offset of the local header of the file
|
ZPOS64_T pos_local_header; /* offset of the local header of the file
|
||||||
currenty writing */
|
currently writing */
|
||||||
char* central_header; /* central header data for the current file */
|
char* central_header; /* central header data for the current file */
|
||||||
uLong size_centralExtra;
|
uLong size_centralExtra;
|
||||||
uLong size_centralheader; /* size of the central header for cur file */
|
uLong size_centralheader; /* size of the central header for cur file */
|
||||||
uLong size_centralExtraFree; /* Extra bytes allocated to the centralheader but that are not used */
|
uLong size_centralExtraFree; /* Extra bytes allocated to the centralheader but that are not used */
|
||||||
uLong flag; /* flag of the file currently writing */
|
uLong flag; /* flag of the file currently writing */
|
||||||
|
|
||||||
int method; /* compression method of file currenty wr.*/
|
int method; /* compression method of file currently wr.*/
|
||||||
int raw; /* 1 for directly writing raw data */
|
int raw; /* 1 for directly writing raw data */
|
||||||
Byte buffered_data[Z_BUFSIZE];/* buffer contain compressed data to be writ*/
|
Byte buffered_data[Z_BUFSIZE];/* buffer contain compressed data to be writ*/
|
||||||
uLong dosDate;
|
uLong dosDate;
|
||||||
uLong crc32;
|
uLong crc32;
|
||||||
int encrypt;
|
int encrypt;
|
||||||
int zip64; /* Add ZIP64 extened information in the extra field */
|
int zip64; /* Add ZIP64 extended information in the extra field */
|
||||||
ZPOS64_T pos_zip64extrainfo;
|
ZPOS64_T pos_zip64extrainfo;
|
||||||
ZPOS64_T totalCompressedData;
|
ZPOS64_T totalCompressedData;
|
||||||
ZPOS64_T totalUncompressedData;
|
ZPOS64_T totalUncompressedData;
|
||||||
|
|
@ -165,10 +161,10 @@ typedef struct
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
zlib_filefunc64_32_def z_filefunc;
|
zlib_filefunc64_32_def z_filefunc;
|
||||||
voidpf filestream; /* io structore of the zipfile */
|
voidpf filestream; /* io structure of the zipfile */
|
||||||
linkedlist_data central_dir;/* datablock with central dir in construction*/
|
linkedlist_data central_dir;/* datablock with central dir in construction*/
|
||||||
int in_opened_file_inzip; /* 1 if a file in the zip is currently writ.*/
|
int in_opened_file_inzip; /* 1 if a file in the zip is currently writ.*/
|
||||||
curfile64_info ci; /* info on the file curretly writing */
|
curfile64_info ci; /* info on the file currently writing */
|
||||||
|
|
||||||
ZPOS64_T begin_pos; /* position of the beginning of the zipfile */
|
ZPOS64_T begin_pos; /* position of the beginning of the zipfile */
|
||||||
ZPOS64_T add_position_when_writing_offset;
|
ZPOS64_T add_position_when_writing_offset;
|
||||||
|
|
@ -186,8 +182,7 @@ typedef struct
|
||||||
#include "crypt.h"
|
#include "crypt.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
local linkedlist_datablock_internal* allocate_new_datablock()
|
local linkedlist_datablock_internal* allocate_new_datablock(void) {
|
||||||
{
|
|
||||||
linkedlist_datablock_internal* ldi;
|
linkedlist_datablock_internal* ldi;
|
||||||
ldi = (linkedlist_datablock_internal*)
|
ldi = (linkedlist_datablock_internal*)
|
||||||
ALLOC(sizeof(linkedlist_datablock_internal));
|
ALLOC(sizeof(linkedlist_datablock_internal));
|
||||||
|
|
@ -200,30 +195,26 @@ local linkedlist_datablock_internal* allocate_new_datablock()
|
||||||
return ldi;
|
return ldi;
|
||||||
}
|
}
|
||||||
|
|
||||||
local void free_datablock(linkedlist_datablock_internal* ldi)
|
local void free_datablock(linkedlist_datablock_internal* ldi) {
|
||||||
{
|
|
||||||
while (ldi!=NULL)
|
while (ldi!=NULL)
|
||||||
{
|
{
|
||||||
linkedlist_datablock_internal* ldinext = ldi->next_datablock;
|
linkedlist_datablock_internal* ldinext = ldi->next_datablock;
|
||||||
TRYFREE(ldi);
|
free(ldi);
|
||||||
ldi = ldinext;
|
ldi = ldinext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
local void init_linkedlist(linkedlist_data* ll)
|
local void init_linkedlist(linkedlist_data* ll) {
|
||||||
{
|
|
||||||
ll->first_block = ll->last_block = NULL;
|
ll->first_block = ll->last_block = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
local void free_linkedlist(linkedlist_data* ll)
|
local void free_linkedlist(linkedlist_data* ll) {
|
||||||
{
|
|
||||||
free_datablock(ll->first_block);
|
free_datablock(ll->first_block);
|
||||||
ll->first_block = ll->last_block = NULL;
|
ll->first_block = ll->last_block = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len)
|
local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len) {
|
||||||
{
|
|
||||||
linkedlist_datablock_internal* ldi;
|
linkedlist_datablock_internal* ldi;
|
||||||
const unsigned char* from_copy;
|
const unsigned char* from_copy;
|
||||||
|
|
||||||
|
|
@ -238,7 +229,7 @@ local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len)
|
||||||
}
|
}
|
||||||
|
|
||||||
ldi = ll->last_block;
|
ldi = ll->last_block;
|
||||||
from_copy = (unsigned char*)buf;
|
from_copy = (const unsigned char*)buf;
|
||||||
|
|
||||||
while (len>0)
|
while (len>0)
|
||||||
{
|
{
|
||||||
|
|
@ -283,9 +274,7 @@ local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len)
|
||||||
nbByte == 1, 2 ,4 or 8 (byte, short or long, ZPOS64_T)
|
nbByte == 1, 2 ,4 or 8 (byte, short or long, ZPOS64_T)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
local int zip64local_putValue OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte));
|
local int zip64local_putValue(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte) {
|
||||||
local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte)
|
|
||||||
{
|
|
||||||
unsigned char buf[8];
|
unsigned char buf[8];
|
||||||
int n;
|
int n;
|
||||||
for (n = 0; n < nbByte; n++)
|
for (n = 0; n < nbByte; n++)
|
||||||
|
|
@ -307,9 +296,7 @@ local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
||||||
return ZIP_OK;
|
return ZIP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
local void zip64local_putValue_inmemory OF((void* dest, ZPOS64_T x, int nbByte));
|
local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte) {
|
||||||
local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte)
|
|
||||||
{
|
|
||||||
unsigned char* buf=(unsigned char*)dest;
|
unsigned char* buf=(unsigned char*)dest;
|
||||||
int n;
|
int n;
|
||||||
for (n = 0; n < nbByte; n++) {
|
for (n = 0; n < nbByte; n++) {
|
||||||
|
|
@ -329,8 +316,7 @@ local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte)
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm)
|
local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm) {
|
||||||
{
|
|
||||||
uLong year = (uLong)ptm->tm_year;
|
uLong year = (uLong)ptm->tm_year;
|
||||||
if (year>=1980)
|
if (year>=1980)
|
||||||
year-=1980;
|
year-=1980;
|
||||||
|
|
@ -344,10 +330,7 @@ local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm)
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
local int zip64local_getByte OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi));
|
local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int* pi) {
|
||||||
|
|
||||||
local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def,voidpf filestream,int* pi)
|
|
||||||
{
|
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1);
|
int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1);
|
||||||
if (err==1)
|
if (err==1)
|
||||||
|
|
@ -368,10 +351,7 @@ local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def,vo
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
Reads a long in LSB order from the given gz_stream. Sets
|
Reads a long in LSB order from the given gz_stream. Sets
|
||||||
*/
|
*/
|
||||||
local int zip64local_getShort OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX));
|
local int zip64local_getShort(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX) {
|
||||||
|
|
||||||
local int zip64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX)
|
|
||||||
{
|
|
||||||
uLong x ;
|
uLong x ;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int err;
|
int err;
|
||||||
|
|
@ -390,10 +370,7 @@ local int zip64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
local int zip64local_getLong OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX));
|
local int zip64local_getLong(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX) {
|
||||||
|
|
||||||
local int zip64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX)
|
|
||||||
{
|
|
||||||
uLong x ;
|
uLong x ;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int err;
|
int err;
|
||||||
|
|
@ -420,11 +397,8 @@ local int zip64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
local int zip64local_getLong64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX));
|
|
||||||
|
|
||||||
|
local int zip64local_getLong64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX) {
|
||||||
local int zip64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX)
|
|
||||||
{
|
|
||||||
ZPOS64_T x;
|
ZPOS64_T x;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int err;
|
int err;
|
||||||
|
|
@ -475,10 +449,7 @@ local int zip64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def
|
||||||
Locate the Central directory of a zipfile (at the end, just before
|
Locate the Central directory of a zipfile (at the end, just before
|
||||||
the global comment)
|
the global comment)
|
||||||
*/
|
*/
|
||||||
local ZPOS64_T zip64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream));
|
local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
|
||||||
|
|
||||||
local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
|
|
||||||
{
|
|
||||||
unsigned char* buf;
|
unsigned char* buf;
|
||||||
ZPOS64_T uSizeFile;
|
ZPOS64_T uSizeFile;
|
||||||
ZPOS64_T uBackRead;
|
ZPOS64_T uBackRead;
|
||||||
|
|
@ -529,7 +500,7 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
|
||||||
if (uPosFound!=0)
|
if (uPosFound!=0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
TRYFREE(buf);
|
free(buf);
|
||||||
return uPosFound;
|
return uPosFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -537,10 +508,7 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
|
||||||
Locate the End of Zip64 Central directory locator and from there find the CD of a zipfile (at the end, just before
|
Locate the End of Zip64 Central directory locator and from there find the CD of a zipfile (at the end, just before
|
||||||
the global comment)
|
the global comment)
|
||||||
*/
|
*/
|
||||||
local ZPOS64_T zip64local_SearchCentralDir64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream));
|
local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
|
||||||
|
|
||||||
local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
|
|
||||||
{
|
|
||||||
unsigned char* buf;
|
unsigned char* buf;
|
||||||
ZPOS64_T uSizeFile;
|
ZPOS64_T uSizeFile;
|
||||||
ZPOS64_T uBackRead;
|
ZPOS64_T uBackRead;
|
||||||
|
|
@ -595,7 +563,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRYFREE(buf);
|
free(buf);
|
||||||
if (uPosFound == 0)
|
if (uPosFound == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
@ -607,7 +575,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
|
||||||
if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK)
|
if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* number of the disk with the start of the zip64 end of central directory */
|
/* number of the disk with the start of the zip64 end of central directory */
|
||||||
if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK)
|
if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK)
|
||||||
return 0;
|
return 0;
|
||||||
if (uL != 0)
|
if (uL != 0)
|
||||||
|
|
@ -637,8 +605,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
|
||||||
return relativeOffset;
|
return relativeOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
local int LoadCentralDirectoryRecord(zip64_internal* pziinit)
|
local int LoadCentralDirectoryRecord(zip64_internal* pziinit) {
|
||||||
{
|
|
||||||
int err=ZIP_OK;
|
int err=ZIP_OK;
|
||||||
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
|
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
|
||||||
|
|
||||||
|
|
@ -647,10 +614,10 @@ local int LoadCentralDirectoryRecord(zip64_internal* pziinit)
|
||||||
ZPOS64_T central_pos;
|
ZPOS64_T central_pos;
|
||||||
uLong uL;
|
uLong uL;
|
||||||
|
|
||||||
uLong number_disk; /* number of the current dist, used for
|
uLong number_disk; /* number of the current disk, used for
|
||||||
spaning ZIP, unsupported, always 0*/
|
spanning ZIP, unsupported, always 0*/
|
||||||
uLong number_disk_with_CD; /* number the the disk with central dir, used
|
uLong number_disk_with_CD; /* number of the disk with central dir, used
|
||||||
for spaning ZIP, unsupported, always 0*/
|
for spanning ZIP, unsupported, always 0*/
|
||||||
ZPOS64_T number_entry;
|
ZPOS64_T number_entry;
|
||||||
ZPOS64_T number_entry_CD; /* total number of entries in
|
ZPOS64_T number_entry_CD; /* total number of entries in
|
||||||
the central dir
|
the central dir
|
||||||
|
|
@ -830,7 +797,7 @@ local int LoadCentralDirectoryRecord(zip64_internal* pziinit)
|
||||||
|
|
||||||
size_central_dir_to_read-=read_this;
|
size_central_dir_to_read-=read_this;
|
||||||
}
|
}
|
||||||
TRYFREE(buf_read);
|
free(buf_read);
|
||||||
}
|
}
|
||||||
pziinit->begin_pos = byte_before_the_zipfile;
|
pziinit->begin_pos = byte_before_the_zipfile;
|
||||||
pziinit->number_entry = number_entry_CD;
|
pziinit->number_entry = number_entry_CD;
|
||||||
|
|
@ -846,8 +813,7 @@ local int LoadCentralDirectoryRecord(zip64_internal* pziinit)
|
||||||
|
|
||||||
|
|
||||||
/************************************************************/
|
/************************************************************/
|
||||||
extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_32_def* pzlib_filefunc64_32_def)
|
extern zipFile ZEXPORT zipOpen3(const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_32_def* pzlib_filefunc64_32_def) {
|
||||||
{
|
|
||||||
zip64_internal ziinit;
|
zip64_internal ziinit;
|
||||||
zip64_internal* zi;
|
zip64_internal* zi;
|
||||||
int err=ZIP_OK;
|
int err=ZIP_OK;
|
||||||
|
|
@ -907,9 +873,9 @@ extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* gl
|
||||||
if (err != ZIP_OK)
|
if (err != ZIP_OK)
|
||||||
{
|
{
|
||||||
# ifndef NO_ADDFILEINEXISTINGZIP
|
# ifndef NO_ADDFILEINEXISTINGZIP
|
||||||
TRYFREE(ziinit.globalcomment);
|
free(ziinit.globalcomment);
|
||||||
# endif /* !NO_ADDFILEINEXISTINGZIP*/
|
# endif /* !NO_ADDFILEINEXISTINGZIP*/
|
||||||
TRYFREE(zi);
|
free(zi);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -919,8 +885,7 @@ extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* gl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern zipFile ZEXPORT zipOpen2 (const char *pathname, int append, zipcharpc* globalcomment, zlib_filefunc_def* pzlib_filefunc32_def)
|
extern zipFile ZEXPORT zipOpen2(const char *pathname, int append, zipcharpc* globalcomment, zlib_filefunc_def* pzlib_filefunc32_def) {
|
||||||
{
|
|
||||||
if (pzlib_filefunc32_def != NULL)
|
if (pzlib_filefunc32_def != NULL)
|
||||||
{
|
{
|
||||||
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
|
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
|
||||||
|
|
@ -931,8 +896,7 @@ extern zipFile ZEXPORT zipOpen2 (const char *pathname, int append, zipcharpc* gl
|
||||||
return zipOpen3(pathname, append, globalcomment, NULL);
|
return zipOpen3(pathname, append, globalcomment, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern zipFile ZEXPORT zipOpen2_64 (const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_def* pzlib_filefunc_def)
|
extern zipFile ZEXPORT zipOpen2_64(const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_def* pzlib_filefunc_def) {
|
||||||
{
|
|
||||||
if (pzlib_filefunc_def != NULL)
|
if (pzlib_filefunc_def != NULL)
|
||||||
{
|
{
|
||||||
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
|
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
|
||||||
|
|
@ -947,18 +911,15 @@ extern zipFile ZEXPORT zipOpen2_64 (const void *pathname, int append, zipcharpc*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern zipFile ZEXPORT zipOpen (const char* pathname, int append)
|
extern zipFile ZEXPORT zipOpen(const char* pathname, int append) {
|
||||||
{
|
|
||||||
return zipOpen3((const void*)pathname,append,NULL,NULL);
|
return zipOpen3((const void*)pathname,append,NULL,NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern zipFile ZEXPORT zipOpen64 (const void* pathname, int append)
|
extern zipFile ZEXPORT zipOpen64(const void* pathname, int append) {
|
||||||
{
|
|
||||||
return zipOpen3(pathname,append,NULL,NULL);
|
return zipOpen3(pathname,append,NULL,NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
local int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local)
|
local int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local) {
|
||||||
{
|
|
||||||
/* write the local header */
|
/* write the local header */
|
||||||
int err;
|
int err;
|
||||||
uInt size_filename = (uInt)strlen(filename);
|
uInt size_filename = (uInt)strlen(filename);
|
||||||
|
|
@ -1054,14 +1015,13 @@ local int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt s
|
||||||
It is not done here because then we need to realloc a new buffer since parameters are 'const' and I want to minimize
|
It is not done here because then we need to realloc a new buffer since parameters are 'const' and I want to minimize
|
||||||
unnecessary allocations.
|
unnecessary allocations.
|
||||||
*/
|
*/
|
||||||
extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||||
const void* extrafield_local, uInt size_extrafield_local,
|
const void* extrafield_local, uInt size_extrafield_local,
|
||||||
const void* extrafield_global, uInt size_extrafield_global,
|
const void* extrafield_global, uInt size_extrafield_global,
|
||||||
const char* comment, int method, int level, int raw,
|
const char* comment, int method, int level, int raw,
|
||||||
int windowBits,int memLevel, int strategy,
|
int windowBits,int memLevel, int strategy,
|
||||||
const char* password, uLong crcForCrypting,
|
const char* password, uLong crcForCrypting,
|
||||||
uLong versionMadeBy, uLong flagBase, int zip64)
|
uLong versionMadeBy, uLong flagBase, int zip64) {
|
||||||
{
|
|
||||||
zip64_internal* zi;
|
zip64_internal* zi;
|
||||||
uInt size_filename;
|
uInt size_filename;
|
||||||
uInt size_comment;
|
uInt size_comment;
|
||||||
|
|
@ -1266,35 +1226,33 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip4 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
extern int ZEXPORT zipOpenNewFileInZip4(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||||
const void* extrafield_local, uInt size_extrafield_local,
|
const void* extrafield_local, uInt size_extrafield_local,
|
||||||
const void* extrafield_global, uInt size_extrafield_global,
|
const void* extrafield_global, uInt size_extrafield_global,
|
||||||
const char* comment, int method, int level, int raw,
|
const char* comment, int method, int level, int raw,
|
||||||
int windowBits,int memLevel, int strategy,
|
int windowBits,int memLevel, int strategy,
|
||||||
const char* password, uLong crcForCrypting,
|
const char* password, uLong crcForCrypting,
|
||||||
uLong versionMadeBy, uLong flagBase)
|
uLong versionMadeBy, uLong flagBase) {
|
||||||
{
|
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
||||||
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
|
extrafield_local, size_extrafield_local,
|
||||||
extrafield_local, size_extrafield_local,
|
extrafield_global, size_extrafield_global,
|
||||||
extrafield_global, size_extrafield_global,
|
comment, method, level, raw,
|
||||||
comment, method, level, raw,
|
windowBits, memLevel, strategy,
|
||||||
windowBits, memLevel, strategy,
|
password, crcForCrypting, versionMadeBy, flagBase, 0);
|
||||||
password, crcForCrypting, versionMadeBy, flagBase, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip3 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
extern int ZEXPORT zipOpenNewFileInZip3(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||||
const void* extrafield_local, uInt size_extrafield_local,
|
const void* extrafield_local, uInt size_extrafield_local,
|
||||||
const void* extrafield_global, uInt size_extrafield_global,
|
const void* extrafield_global, uInt size_extrafield_global,
|
||||||
const char* comment, int method, int level, int raw,
|
const char* comment, int method, int level, int raw,
|
||||||
int windowBits,int memLevel, int strategy,
|
int windowBits,int memLevel, int strategy,
|
||||||
const char* password, uLong crcForCrypting)
|
const char* password, uLong crcForCrypting) {
|
||||||
{
|
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
||||||
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
|
extrafield_local, size_extrafield_local,
|
||||||
extrafield_local, size_extrafield_local,
|
extrafield_global, size_extrafield_global,
|
||||||
extrafield_global, size_extrafield_global,
|
comment, method, level, raw,
|
||||||
comment, method, level, raw,
|
windowBits, memLevel, strategy,
|
||||||
windowBits, memLevel, strategy,
|
password, crcForCrypting, VERSIONMADEBY, 0, 0);
|
||||||
password, crcForCrypting, VERSIONMADEBY, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||||
|
|
@ -1302,70 +1260,64 @@ extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char* filename, c
|
||||||
const void* extrafield_global, uInt size_extrafield_global,
|
const void* extrafield_global, uInt size_extrafield_global,
|
||||||
const char* comment, int method, int level, int raw,
|
const char* comment, int method, int level, int raw,
|
||||||
int windowBits,int memLevel, int strategy,
|
int windowBits,int memLevel, int strategy,
|
||||||
const char* password, uLong crcForCrypting, int zip64)
|
const char* password, uLong crcForCrypting, int zip64) {
|
||||||
{
|
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
||||||
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
|
extrafield_local, size_extrafield_local,
|
||||||
extrafield_local, size_extrafield_local,
|
extrafield_global, size_extrafield_global,
|
||||||
extrafield_global, size_extrafield_global,
|
comment, method, level, raw,
|
||||||
comment, method, level, raw,
|
windowBits, memLevel, strategy,
|
||||||
windowBits, memLevel, strategy,
|
password, crcForCrypting, VERSIONMADEBY, 0, zip64);
|
||||||
password, crcForCrypting, VERSIONMADEBY, 0, zip64);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip2(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
extern int ZEXPORT zipOpenNewFileInZip2(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||||
const void* extrafield_local, uInt size_extrafield_local,
|
const void* extrafield_local, uInt size_extrafield_local,
|
||||||
const void* extrafield_global, uInt size_extrafield_global,
|
const void* extrafield_global, uInt size_extrafield_global,
|
||||||
const char* comment, int method, int level, int raw)
|
const char* comment, int method, int level, int raw) {
|
||||||
{
|
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
||||||
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
|
extrafield_local, size_extrafield_local,
|
||||||
extrafield_local, size_extrafield_local,
|
extrafield_global, size_extrafield_global,
|
||||||
extrafield_global, size_extrafield_global,
|
comment, method, level, raw,
|
||||||
comment, method, level, raw,
|
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
||||||
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
NULL, 0, VERSIONMADEBY, 0, 0);
|
||||||
NULL, 0, VERSIONMADEBY, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||||
const void* extrafield_local, uInt size_extrafield_local,
|
const void* extrafield_local, uInt size_extrafield_local,
|
||||||
const void* extrafield_global, uInt size_extrafield_global,
|
const void* extrafield_global, uInt size_extrafield_global,
|
||||||
const char* comment, int method, int level, int raw, int zip64)
|
const char* comment, int method, int level, int raw, int zip64) {
|
||||||
{
|
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
||||||
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
|
extrafield_local, size_extrafield_local,
|
||||||
extrafield_local, size_extrafield_local,
|
extrafield_global, size_extrafield_global,
|
||||||
extrafield_global, size_extrafield_global,
|
comment, method, level, raw,
|
||||||
comment, method, level, raw,
|
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
||||||
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
NULL, 0, VERSIONMADEBY, 0, zip64);
|
||||||
NULL, 0, VERSIONMADEBY, 0, zip64);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip64 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
extern int ZEXPORT zipOpenNewFileInZip64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||||
const void* extrafield_local, uInt size_extrafield_local,
|
const void* extrafield_local, uInt size_extrafield_local,
|
||||||
const void*extrafield_global, uInt size_extrafield_global,
|
const void*extrafield_global, uInt size_extrafield_global,
|
||||||
const char* comment, int method, int level, int zip64)
|
const char* comment, int method, int level, int zip64) {
|
||||||
{
|
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
||||||
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
|
extrafield_local, size_extrafield_local,
|
||||||
extrafield_local, size_extrafield_local,
|
extrafield_global, size_extrafield_global,
|
||||||
extrafield_global, size_extrafield_global,
|
comment, method, level, 0,
|
||||||
comment, method, level, 0,
|
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
||||||
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
NULL, 0, VERSIONMADEBY, 0, zip64);
|
||||||
NULL, 0, VERSIONMADEBY, 0, zip64);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip (zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
extern int ZEXPORT zipOpenNewFileInZip(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||||
const void* extrafield_local, uInt size_extrafield_local,
|
const void* extrafield_local, uInt size_extrafield_local,
|
||||||
const void*extrafield_global, uInt size_extrafield_global,
|
const void*extrafield_global, uInt size_extrafield_global,
|
||||||
const char* comment, int method, int level)
|
const char* comment, int method, int level) {
|
||||||
{
|
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
||||||
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
|
extrafield_local, size_extrafield_local,
|
||||||
extrafield_local, size_extrafield_local,
|
extrafield_global, size_extrafield_global,
|
||||||
extrafield_global, size_extrafield_global,
|
comment, method, level, 0,
|
||||||
comment, method, level, 0,
|
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
||||||
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
NULL, 0, VERSIONMADEBY, 0, 0);
|
||||||
NULL, 0, VERSIONMADEBY, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local int zip64FlushWriteBuffer(zip64_internal* zi)
|
local int zip64FlushWriteBuffer(zip64_internal* zi) {
|
||||||
{
|
|
||||||
int err=ZIP_OK;
|
int err=ZIP_OK;
|
||||||
|
|
||||||
if (zi->ci.encrypt != 0)
|
if (zi->ci.encrypt != 0)
|
||||||
|
|
@ -1403,8 +1355,7 @@ local int zip64FlushWriteBuffer(zip64_internal* zi)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned int len)
|
extern int ZEXPORT zipWriteInFileInZip(zipFile file, const void* buf, unsigned int len) {
|
||||||
{
|
|
||||||
zip64_internal* zi;
|
zip64_internal* zi;
|
||||||
int err=ZIP_OK;
|
int err=ZIP_OK;
|
||||||
|
|
||||||
|
|
@ -1454,7 +1405,7 @@ extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned in
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
zi->ci.stream.next_in = (Bytef*)buf;
|
zi->ci.stream.next_in = (Bytef*)(uintptr_t)buf;
|
||||||
zi->ci.stream.avail_in = len;
|
zi->ci.stream.avail_in = len;
|
||||||
|
|
||||||
while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0))
|
while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0))
|
||||||
|
|
@ -1505,13 +1456,11 @@ extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned in
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipCloseFileInZipRaw (zipFile file, uLong uncompressed_size, uLong crc32)
|
extern int ZEXPORT zipCloseFileInZipRaw(zipFile file, uLong uncompressed_size, uLong crc32) {
|
||||||
{
|
|
||||||
return zipCloseFileInZipRaw64 (file, uncompressed_size, crc32);
|
return zipCloseFileInZipRaw64 (file, uncompressed_size, crc32);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_size, uLong crc32)
|
extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, ZPOS64_T uncompressed_size, uLong crc32) {
|
||||||
{
|
|
||||||
zip64_internal* zi;
|
zip64_internal* zi;
|
||||||
ZPOS64_T compressed_size;
|
ZPOS64_T compressed_size;
|
||||||
uLong invalidValue = 0xffffffff;
|
uLong invalidValue = 0xffffffff;
|
||||||
|
|
@ -1652,7 +1601,7 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s
|
||||||
|
|
||||||
if((uLong)(datasize + 4) > zi->ci.size_centralExtraFree)
|
if((uLong)(datasize + 4) > zi->ci.size_centralExtraFree)
|
||||||
{
|
{
|
||||||
// we can not write more data to the buffer that we have room for.
|
// we cannot write more data to the buffer that we have room for.
|
||||||
return ZIP_BADZIPFILE;
|
return ZIP_BADZIPFILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1746,13 +1695,11 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipCloseFileInZip (zipFile file)
|
extern int ZEXPORT zipCloseFileInZip(zipFile file) {
|
||||||
{
|
|
||||||
return zipCloseFileInZipRaw (file,0,0);
|
return zipCloseFileInZipRaw (file,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
local int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip)
|
local int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip) {
|
||||||
{
|
|
||||||
int err = ZIP_OK;
|
int err = ZIP_OK;
|
||||||
ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writing_offset;
|
ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writing_offset;
|
||||||
|
|
||||||
|
|
@ -1773,8 +1720,7 @@ local int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T z
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
local int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
|
local int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) {
|
||||||
{
|
|
||||||
int err = ZIP_OK;
|
int err = ZIP_OK;
|
||||||
|
|
||||||
uLong Zip64DataSize = 44;
|
uLong Zip64DataSize = 44;
|
||||||
|
|
@ -1812,8 +1758,8 @@ local int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
local int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
|
|
||||||
{
|
local int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) {
|
||||||
int err = ZIP_OK;
|
int err = ZIP_OK;
|
||||||
|
|
||||||
/*signature*/
|
/*signature*/
|
||||||
|
|
@ -1860,8 +1806,7 @@ local int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centr
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
local int Write_GlobalComment(zip64_internal* zi, const char* global_comment)
|
local int Write_GlobalComment(zip64_internal* zi, const char* global_comment) {
|
||||||
{
|
|
||||||
int err = ZIP_OK;
|
int err = ZIP_OK;
|
||||||
uInt size_global_comment = 0;
|
uInt size_global_comment = 0;
|
||||||
|
|
||||||
|
|
@ -1878,8 +1823,7 @@ local int Write_GlobalComment(zip64_internal* zi, const char* global_comment)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipClose (zipFile file, const char* global_comment)
|
extern int ZEXPORT zipClose(zipFile file, const char* global_comment) {
|
||||||
{
|
|
||||||
zip64_internal* zi;
|
zip64_internal* zi;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
uLong size_centraldir = 0;
|
uLong size_centraldir = 0;
|
||||||
|
|
@ -1921,7 +1865,7 @@ extern int ZEXPORT zipClose (zipFile file, const char* global_comment)
|
||||||
free_linkedlist(&(zi->central_dir));
|
free_linkedlist(&(zi->central_dir));
|
||||||
|
|
||||||
pos = centraldir_pos_inzip - zi->add_position_when_writing_offset;
|
pos = centraldir_pos_inzip - zi->add_position_when_writing_offset;
|
||||||
if(pos >= 0xffffffff || zi->number_entry > 0xFFFF)
|
if(pos >= 0xffffffff || zi->number_entry >= 0xFFFF)
|
||||||
{
|
{
|
||||||
ZPOS64_T Zip64EOCDpos = ZTELL64(zi->z_filefunc,zi->filestream);
|
ZPOS64_T Zip64EOCDpos = ZTELL64(zi->z_filefunc,zi->filestream);
|
||||||
Write_Zip64EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip);
|
Write_Zip64EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip);
|
||||||
|
|
@ -1940,15 +1884,14 @@ extern int ZEXPORT zipClose (zipFile file, const char* global_comment)
|
||||||
err = ZIP_ERRNO;
|
err = ZIP_ERRNO;
|
||||||
|
|
||||||
#ifndef NO_ADDFILEINEXISTINGZIP
|
#ifndef NO_ADDFILEINEXISTINGZIP
|
||||||
TRYFREE(zi->globalcomment);
|
free(zi->globalcomment);
|
||||||
#endif
|
#endif
|
||||||
TRYFREE(zi);
|
free(zi);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHeader)
|
extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHeader) {
|
||||||
{
|
|
||||||
char* p = pData;
|
char* p = pData;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
char* pNewHeader;
|
char* pNewHeader;
|
||||||
|
|
@ -2000,7 +1943,7 @@ extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHe
|
||||||
else
|
else
|
||||||
retVal = ZIP_ERRNO;
|
retVal = ZIP_ERRNO;
|
||||||
|
|
||||||
TRYFREE(pNewHeader);
|
free(pNewHeader);
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
289
thirdparty/minizip/zip.h
vendored
289
thirdparty/minizip/zip.h
vendored
|
|
@ -113,8 +113,8 @@ typedef const char* zipcharpc;
|
||||||
#define APPEND_STATUS_CREATEAFTER (1)
|
#define APPEND_STATUS_CREATEAFTER (1)
|
||||||
#define APPEND_STATUS_ADDINZIP (2)
|
#define APPEND_STATUS_ADDINZIP (2)
|
||||||
|
|
||||||
extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append));
|
extern zipFile ZEXPORT zipOpen(const char *pathname, int append);
|
||||||
extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append));
|
extern zipFile ZEXPORT zipOpen64(const void *pathname, int append);
|
||||||
/*
|
/*
|
||||||
Create a zipfile.
|
Create a zipfile.
|
||||||
pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
|
pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
|
||||||
|
|
@ -131,55 +131,55 @@ extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append));
|
||||||
|
|
||||||
/* Note : there is no delete function into a zipfile.
|
/* Note : there is no delete function into a zipfile.
|
||||||
If you want delete file into a zipfile, you must open a zipfile, and create another
|
If you want delete file into a zipfile, you must open a zipfile, and create another
|
||||||
Of couse, you can use RAW reading and writing to copy the file you did not want delte
|
Of course, you can use RAW reading and writing to copy the file you did not want delete
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern zipFile ZEXPORT zipOpen2 OF((const char *pathname,
|
extern zipFile ZEXPORT zipOpen2(const char *pathname,
|
||||||
|
int append,
|
||||||
|
zipcharpc* globalcomment,
|
||||||
|
zlib_filefunc_def* pzlib_filefunc_def);
|
||||||
|
|
||||||
|
extern zipFile ZEXPORT zipOpen2_64(const void *pathname,
|
||||||
int append,
|
int append,
|
||||||
zipcharpc* globalcomment,
|
zipcharpc* globalcomment,
|
||||||
zlib_filefunc_def* pzlib_filefunc_def));
|
zlib_filefunc64_def* pzlib_filefunc_def);
|
||||||
|
|
||||||
extern zipFile ZEXPORT zipOpen2_64 OF((const void *pathname,
|
extern zipFile ZEXPORT zipOpen3(const void *pathname,
|
||||||
int append,
|
int append,
|
||||||
zipcharpc* globalcomment,
|
zipcharpc* globalcomment,
|
||||||
zlib_filefunc64_def* pzlib_filefunc_def));
|
zlib_filefunc64_32_def* pzlib_filefunc64_32_def);
|
||||||
|
|
||||||
extern zipFile ZEXPORT zipOpen3 OF((const void *pathname,
|
extern int ZEXPORT zipOpenNewFileInZip(zipFile file,
|
||||||
int append,
|
const char* filename,
|
||||||
zipcharpc* globalcomment,
|
const zip_fileinfo* zipfi,
|
||||||
zlib_filefunc64_32_def* pzlib_filefunc64_32_def));
|
const void* extrafield_local,
|
||||||
|
uInt size_extrafield_local,
|
||||||
|
const void* extrafield_global,
|
||||||
|
uInt size_extrafield_global,
|
||||||
|
const char* comment,
|
||||||
|
int method,
|
||||||
|
int level);
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
|
extern int ZEXPORT zipOpenNewFileInZip64(zipFile file,
|
||||||
const char* filename,
|
const char* filename,
|
||||||
const zip_fileinfo* zipfi,
|
const zip_fileinfo* zipfi,
|
||||||
const void* extrafield_local,
|
const void* extrafield_local,
|
||||||
uInt size_extrafield_local,
|
uInt size_extrafield_local,
|
||||||
const void* extrafield_global,
|
const void* extrafield_global,
|
||||||
uInt size_extrafield_global,
|
uInt size_extrafield_global,
|
||||||
const char* comment,
|
const char* comment,
|
||||||
int method,
|
int method,
|
||||||
int level));
|
int level,
|
||||||
|
int zip64);
|
||||||
extern int ZEXPORT zipOpenNewFileInZip64 OF((zipFile file,
|
|
||||||
const char* filename,
|
|
||||||
const zip_fileinfo* zipfi,
|
|
||||||
const void* extrafield_local,
|
|
||||||
uInt size_extrafield_local,
|
|
||||||
const void* extrafield_global,
|
|
||||||
uInt size_extrafield_global,
|
|
||||||
const char* comment,
|
|
||||||
int method,
|
|
||||||
int level,
|
|
||||||
int zip64));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Open a file in the ZIP for writing.
|
Open a file in the ZIP for writing.
|
||||||
filename : the filename in zip (if NULL, '-' without quote will be used
|
filename : the filename in zip (if NULL, '-' without quote will be used
|
||||||
*zipfi contain supplemental information
|
*zipfi contain supplemental information
|
||||||
if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
|
if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
|
||||||
contains the extrafield data the the local header
|
contains the extrafield data for the local header
|
||||||
if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
|
if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
|
||||||
contains the extrafield data the the local header
|
contains the extrafield data for the global header
|
||||||
if comment != NULL, comment contain the comment string
|
if comment != NULL, comment contain the comment string
|
||||||
method contain the compression method (0 for store, Z_DEFLATED for deflate)
|
method contain the compression method (0 for store, Z_DEFLATED for deflate)
|
||||||
level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
|
level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
|
||||||
|
|
@ -189,70 +189,69 @@ extern int ZEXPORT zipOpenNewFileInZip64 OF((zipFile file,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file,
|
extern int ZEXPORT zipOpenNewFileInZip2(zipFile file,
|
||||||
const char* filename,
|
const char* filename,
|
||||||
const zip_fileinfo* zipfi,
|
const zip_fileinfo* zipfi,
|
||||||
const void* extrafield_local,
|
const void* extrafield_local,
|
||||||
uInt size_extrafield_local,
|
uInt size_extrafield_local,
|
||||||
const void* extrafield_global,
|
const void* extrafield_global,
|
||||||
uInt size_extrafield_global,
|
uInt size_extrafield_global,
|
||||||
const char* comment,
|
const char* comment,
|
||||||
int method,
|
int method,
|
||||||
int level,
|
int level,
|
||||||
int raw));
|
int raw);
|
||||||
|
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip2_64 OF((zipFile file,
|
extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file,
|
||||||
const char* filename,
|
const char* filename,
|
||||||
const zip_fileinfo* zipfi,
|
const zip_fileinfo* zipfi,
|
||||||
const void* extrafield_local,
|
const void* extrafield_local,
|
||||||
uInt size_extrafield_local,
|
uInt size_extrafield_local,
|
||||||
const void* extrafield_global,
|
const void* extrafield_global,
|
||||||
uInt size_extrafield_global,
|
uInt size_extrafield_global,
|
||||||
const char* comment,
|
const char* comment,
|
||||||
int method,
|
int method,
|
||||||
int level,
|
int level,
|
||||||
int raw,
|
int raw,
|
||||||
int zip64));
|
int zip64);
|
||||||
/*
|
/*
|
||||||
Same than zipOpenNewFileInZip, except if raw=1, we write raw file
|
Same than zipOpenNewFileInZip, except if raw=1, we write raw file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file,
|
extern int ZEXPORT zipOpenNewFileInZip3(zipFile file,
|
||||||
const char* filename,
|
const char* filename,
|
||||||
const zip_fileinfo* zipfi,
|
const zip_fileinfo* zipfi,
|
||||||
const void* extrafield_local,
|
const void* extrafield_local,
|
||||||
uInt size_extrafield_local,
|
uInt size_extrafield_local,
|
||||||
const void* extrafield_global,
|
const void* extrafield_global,
|
||||||
uInt size_extrafield_global,
|
uInt size_extrafield_global,
|
||||||
const char* comment,
|
const char* comment,
|
||||||
int method,
|
int method,
|
||||||
int level,
|
int level,
|
||||||
int raw,
|
int raw,
|
||||||
int windowBits,
|
int windowBits,
|
||||||
int memLevel,
|
int memLevel,
|
||||||
int strategy,
|
int strategy,
|
||||||
const char* password,
|
const char* password,
|
||||||
uLong crcForCrypting));
|
uLong crcForCrypting);
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip3_64 OF((zipFile file,
|
extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file,
|
||||||
const char* filename,
|
const char* filename,
|
||||||
const zip_fileinfo* zipfi,
|
const zip_fileinfo* zipfi,
|
||||||
const void* extrafield_local,
|
const void* extrafield_local,
|
||||||
uInt size_extrafield_local,
|
uInt size_extrafield_local,
|
||||||
const void* extrafield_global,
|
const void* extrafield_global,
|
||||||
uInt size_extrafield_global,
|
uInt size_extrafield_global,
|
||||||
const char* comment,
|
const char* comment,
|
||||||
int method,
|
int method,
|
||||||
int level,
|
int level,
|
||||||
int raw,
|
int raw,
|
||||||
int windowBits,
|
int windowBits,
|
||||||
int memLevel,
|
int memLevel,
|
||||||
int strategy,
|
int strategy,
|
||||||
const char* password,
|
const char* password,
|
||||||
uLong crcForCrypting,
|
uLong crcForCrypting,
|
||||||
int zip64
|
int zip64);
|
||||||
));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Same than zipOpenNewFileInZip2, except
|
Same than zipOpenNewFileInZip2, except
|
||||||
|
|
@ -261,47 +260,45 @@ extern int ZEXPORT zipOpenNewFileInZip3_64 OF((zipFile file,
|
||||||
crcForCrypting : crc of file to compress (needed for crypting)
|
crcForCrypting : crc of file to compress (needed for crypting)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip4 OF((zipFile file,
|
extern int ZEXPORT zipOpenNewFileInZip4(zipFile file,
|
||||||
const char* filename,
|
const char* filename,
|
||||||
const zip_fileinfo* zipfi,
|
const zip_fileinfo* zipfi,
|
||||||
const void* extrafield_local,
|
const void* extrafield_local,
|
||||||
uInt size_extrafield_local,
|
uInt size_extrafield_local,
|
||||||
const void* extrafield_global,
|
const void* extrafield_global,
|
||||||
uInt size_extrafield_global,
|
uInt size_extrafield_global,
|
||||||
const char* comment,
|
const char* comment,
|
||||||
int method,
|
int method,
|
||||||
int level,
|
int level,
|
||||||
int raw,
|
int raw,
|
||||||
int windowBits,
|
int windowBits,
|
||||||
int memLevel,
|
int memLevel,
|
||||||
int strategy,
|
int strategy,
|
||||||
const char* password,
|
const char* password,
|
||||||
uLong crcForCrypting,
|
uLong crcForCrypting,
|
||||||
uLong versionMadeBy,
|
uLong versionMadeBy,
|
||||||
uLong flagBase
|
uLong flagBase);
|
||||||
));
|
|
||||||
|
|
||||||
|
|
||||||
extern int ZEXPORT zipOpenNewFileInZip4_64 OF((zipFile file,
|
extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file,
|
||||||
const char* filename,
|
const char* filename,
|
||||||
const zip_fileinfo* zipfi,
|
const zip_fileinfo* zipfi,
|
||||||
const void* extrafield_local,
|
const void* extrafield_local,
|
||||||
uInt size_extrafield_local,
|
uInt size_extrafield_local,
|
||||||
const void* extrafield_global,
|
const void* extrafield_global,
|
||||||
uInt size_extrafield_global,
|
uInt size_extrafield_global,
|
||||||
const char* comment,
|
const char* comment,
|
||||||
int method,
|
int method,
|
||||||
int level,
|
int level,
|
||||||
int raw,
|
int raw,
|
||||||
int windowBits,
|
int windowBits,
|
||||||
int memLevel,
|
int memLevel,
|
||||||
int strategy,
|
int strategy,
|
||||||
const char* password,
|
const char* password,
|
||||||
uLong crcForCrypting,
|
uLong crcForCrypting,
|
||||||
uLong versionMadeBy,
|
uLong versionMadeBy,
|
||||||
uLong flagBase,
|
uLong flagBase,
|
||||||
int zip64
|
int zip64);
|
||||||
));
|
|
||||||
/*
|
/*
|
||||||
Same than zipOpenNewFileInZip4, except
|
Same than zipOpenNewFileInZip4, except
|
||||||
versionMadeBy : value for Version made by field
|
versionMadeBy : value for Version made by field
|
||||||
|
|
@ -309,25 +306,25 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 OF((zipFile file,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
extern int ZEXPORT zipWriteInFileInZip OF((zipFile file,
|
extern int ZEXPORT zipWriteInFileInZip(zipFile file,
|
||||||
const void* buf,
|
const void* buf,
|
||||||
unsigned len));
|
unsigned len);
|
||||||
/*
|
/*
|
||||||
Write data in the zipfile
|
Write data in the zipfile
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT zipCloseFileInZip OF((zipFile file));
|
extern int ZEXPORT zipCloseFileInZip(zipFile file);
|
||||||
/*
|
/*
|
||||||
Close the current file in the zipfile
|
Close the current file in the zipfile
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file,
|
extern int ZEXPORT zipCloseFileInZipRaw(zipFile file,
|
||||||
uLong uncompressed_size,
|
uLong uncompressed_size,
|
||||||
uLong crc32));
|
uLong crc32);
|
||||||
|
|
||||||
extern int ZEXPORT zipCloseFileInZipRaw64 OF((zipFile file,
|
extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file,
|
||||||
ZPOS64_T uncompressed_size,
|
ZPOS64_T uncompressed_size,
|
||||||
uLong crc32));
|
uLong crc32);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Close the current file in the zipfile, for file opened with
|
Close the current file in the zipfile, for file opened with
|
||||||
|
|
@ -335,14 +332,14 @@ extern int ZEXPORT zipCloseFileInZipRaw64 OF((zipFile file,
|
||||||
uncompressed_size and crc32 are value for the uncompressed size
|
uncompressed_size and crc32 are value for the uncompressed size
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int ZEXPORT zipClose OF((zipFile file,
|
extern int ZEXPORT zipClose(zipFile file,
|
||||||
const char* global_comment));
|
const char* global_comment);
|
||||||
/*
|
/*
|
||||||
Close the zipfile
|
Close the zipfile
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
extern int ZEXPORT zipRemoveExtraInfoBlock OF((char* pData, int* dataLen, short sHeader));
|
extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHeader);
|
||||||
/*
|
/*
|
||||||
zipRemoveExtraInfoBlock - Added by Mathias Svensson
|
zipRemoveExtraInfoBlock - Added by Mathias Svensson
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ extern "C" {
|
||||||
|
|
||||||
|
|
||||||
#define vulkan_video_codec_h264std 1
|
#define vulkan_video_codec_h264std 1
|
||||||
#include <stdint.h>
|
#include "vulkan_video_codecs_common.h"
|
||||||
#define STD_VIDEO_H264_CPB_CNT_LIST_SIZE 32
|
#define STD_VIDEO_H264_CPB_CNT_LIST_SIZE 32
|
||||||
#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_LISTS 6
|
#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_LISTS 6
|
||||||
#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS 16
|
#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS 16
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,10 @@ extern "C" {
|
||||||
|
|
||||||
|
|
||||||
#define vulkan_video_codecs_common 1
|
#define vulkan_video_codecs_common 1
|
||||||
|
#if !defined(VK_NO_STDINT_H)
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define VK_MAKE_VIDEO_STD_VERSION(major, minor, patch) \
|
#define VK_MAKE_VIDEO_STD_VERSION(major, minor, patch) \
|
||||||
((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch)))
|
((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch)))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,16 @@
|
||||||
diff --git a/thirdparty/vulkan/vk_enum_string_helper.h b/thirdparty/vulkan/vk_enum_string_helper.h
|
diff --git a/thirdparty/vulkan/vk_enum_string_helper.h b/thirdparty/vulkan/vk_enum_string_helper.h
|
||||||
index 65b3322c07..e8c61aaf15 100644
|
index 005cc21ea8..16f1adc605 100644
|
||||||
--- a/thirdparty/vulkan/vk_enum_string_helper.h
|
--- a/thirdparty/vulkan/vk_enum_string_helper.h
|
||||||
+++ b/thirdparty/vulkan/vk_enum_string_helper.h
|
+++ b/thirdparty/vulkan/vk_enum_string_helper.h
|
||||||
@@ -37,7 +37,11 @@
|
@@ -36,8 +36,10 @@
|
||||||
|
#pragma warning( disable : 4065 )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
+#ifdef __cplusplus
|
||||||
#include <string>
|
#include <string>
|
||||||
-#include <vulkan/vulkan.h>
|
-#include <vulkan/vulkan.h>
|
||||||
+#ifdef USE_VOLK
|
|
||||||
+ #include <volk.h>
|
|
||||||
+#else
|
|
||||||
+ #include <vulkan/vulkan.h>
|
|
||||||
+#endif
|
+#endif
|
||||||
|
+#include "drivers/vulkan/godot_vulkan.h"
|
||||||
|
|
||||||
|
|
||||||
static inline const char* string_VkResult(VkResult input_value)
|
static inline const char* string_VkResult(VkResult input_value)
|
||||||
15
thirdparty/vulkan/patches/VMA-use-godot-vulkan.patch
vendored
Normal file
15
thirdparty/vulkan/patches/VMA-use-godot-vulkan.patch
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
diff --git a/thirdparty/vulkan/vk_mem_alloc.h b/thirdparty/vulkan/vk_mem_alloc.h
|
||||||
|
index 6819219b00..0cde2e2172 100644
|
||||||
|
--- a/thirdparty/vulkan/vk_mem_alloc.h
|
||||||
|
+++ b/thirdparty/vulkan/vk_mem_alloc.h
|
||||||
|
@@ -121,9 +121,7 @@ for user-defined purpose without allocating any real GPU memory.
|
||||||
|
See documentation chapter: \ref statistics.
|
||||||
|
*/
|
||||||
|
|
||||||
|
-#ifndef VULKAN_H_
|
||||||
|
- #include <vulkan/vulkan.h>
|
||||||
|
-#endif
|
||||||
|
+#include "drivers/vulkan/godot_vulkan.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
17
thirdparty/vulkan/patches/VMA-use-volk.patch
vendored
17
thirdparty/vulkan/patches/VMA-use-volk.patch
vendored
|
|
@ -1,17 +0,0 @@
|
||||||
diff --git a/thirdparty/vulkan/vk_mem_alloc.h b/thirdparty/vulkan/vk_mem_alloc.h
|
|
||||||
index 44affc5ca4..d96f2dacc0 100644
|
|
||||||
--- a/thirdparty/vulkan/vk_mem_alloc.h
|
|
||||||
+++ b/thirdparty/vulkan/vk_mem_alloc.h
|
|
||||||
@@ -127,7 +127,11 @@ extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef VULKAN_H_
|
|
||||||
- #include <vulkan/vulkan.h>
|
|
||||||
+ #ifdef USE_VOLK
|
|
||||||
+ #include <volk.h>
|
|
||||||
+ #else
|
|
||||||
+ #include <vulkan/vulkan.h>
|
|
||||||
+ #endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Define this macro to declare maximum supported Vulkan version in format AAABBBCCC,
|
|
||||||
28
thirdparty/vulkan/patches/vulkan-fix-apple-llvm-extern-c.patch
vendored
Normal file
28
thirdparty/vulkan/patches/vulkan-fix-apple-llvm-extern-c.patch
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
diff --git a/thirdparty/vulkan/include/vk_video/vulkan_video_codec_h264std.h b/thirdparty/vulkan/include/vk_video/vulkan_video_codec_h264std.h
|
||||||
|
index 21c7b667fd..089f30912c 100644
|
||||||
|
--- a/thirdparty/vulkan/include/vk_video/vulkan_video_codec_h264std.h
|
||||||
|
+++ b/thirdparty/vulkan/include/vk_video/vulkan_video_codec_h264std.h
|
||||||
|
@@ -20,7 +20,7 @@ extern "C" {
|
||||||
|
|
||||||
|
|
||||||
|
#define vulkan_video_codec_h264std 1
|
||||||
|
-#include <stdint.h>
|
||||||
|
+#include "vulkan_video_codecs_common.h"
|
||||||
|
#define STD_VIDEO_H264_CPB_CNT_LIST_SIZE 32
|
||||||
|
#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_LISTS 6
|
||||||
|
#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS 16
|
||||||
|
diff --git a/thirdparty/vulkan/include/vk_video/vulkan_video_codecs_common.h b/thirdparty/vulkan/include/vk_video/vulkan_video_codecs_common.h
|
||||||
|
index f486d3ca3f..43bfcd09ad 100644
|
||||||
|
--- a/thirdparty/vulkan/include/vk_video/vulkan_video_codecs_common.h
|
||||||
|
+++ b/thirdparty/vulkan/include/vk_video/vulkan_video_codecs_common.h
|
||||||
|
@@ -20,6 +20,10 @@ extern "C" {
|
||||||
|
|
||||||
|
|
||||||
|
#define vulkan_video_codecs_common 1
|
||||||
|
+#if !defined(VK_NO_STDINT_H)
|
||||||
|
+ #include <stdint.h>
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
#define VK_MAKE_VIDEO_STD_VERSION(major, minor, patch) \
|
||||||
|
((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch)))
|
||||||
|
|
||||||
6
thirdparty/vulkan/vk_enum_string_helper.h
vendored
6
thirdparty/vulkan/vk_enum_string_helper.h
vendored
|
|
@ -36,12 +36,10 @@
|
||||||
#pragma warning( disable : 4065 )
|
#pragma warning( disable : 4065 )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
#include <string>
|
#include <string>
|
||||||
#ifdef USE_VOLK
|
|
||||||
#include <volk.h>
|
|
||||||
#else
|
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
#include "drivers/vulkan/godot_vulkan.h"
|
||||||
|
|
||||||
|
|
||||||
static inline const char* string_VkResult(VkResult input_value)
|
static inline const char* string_VkResult(VkResult input_value)
|
||||||
|
|
|
||||||
9
thirdparty/vulkan/vk_mem_alloc.h
vendored
9
thirdparty/vulkan/vk_mem_alloc.h
vendored
|
|
@ -121,19 +121,12 @@ for user-defined purpose without allocating any real GPU memory.
|
||||||
See documentation chapter: \ref statistics.
|
See documentation chapter: \ref statistics.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "drivers/vulkan/godot_vulkan.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef VULKAN_H_
|
|
||||||
#ifdef USE_VOLK
|
|
||||||
#include <volk.h>
|
|
||||||
#else
|
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Define this macro to declare maximum supported Vulkan version in format AAABBBCCC,
|
// Define this macro to declare maximum supported Vulkan version in format AAABBBCCC,
|
||||||
// where AAA = major, BBB = minor, CCC = patch.
|
// where AAA = major, BBB = minor, CCC = patch.
|
||||||
// If you want to use version > 1.0, it still needs to be enabled via VmaAllocatorCreateInfo::vulkanApiVersion.
|
// If you want to use version > 1.0, it still needs to be enabled via VmaAllocatorCreateInfo::vulkanApiVersion.
|
||||||
|
|
|
||||||
32
thirdparty/zlib/adler32.c
vendored
32
thirdparty/zlib/adler32.c
vendored
|
|
@ -7,8 +7,6 @@
|
||||||
|
|
||||||
#include "zutil.h"
|
#include "zutil.h"
|
||||||
|
|
||||||
local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
|
|
||||||
|
|
||||||
#define BASE 65521U /* largest prime smaller than 65536 */
|
#define BASE 65521U /* largest prime smaller than 65536 */
|
||||||
#define NMAX 5552
|
#define NMAX 5552
|
||||||
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
|
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
|
||||||
|
|
@ -60,11 +58,7 @@ local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
uLong ZEXPORT adler32_z(adler, buf, len)
|
uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, z_size_t len) {
|
||||||
uLong adler;
|
|
||||||
const Bytef *buf;
|
|
||||||
z_size_t len;
|
|
||||||
{
|
|
||||||
unsigned long sum2;
|
unsigned long sum2;
|
||||||
unsigned n;
|
unsigned n;
|
||||||
|
|
||||||
|
|
@ -131,20 +125,12 @@ uLong ZEXPORT adler32_z(adler, buf, len)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
uLong ZEXPORT adler32(adler, buf, len)
|
uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len) {
|
||||||
uLong adler;
|
|
||||||
const Bytef *buf;
|
|
||||||
uInt len;
|
|
||||||
{
|
|
||||||
return adler32_z(adler, buf, len);
|
return adler32_z(adler, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
local uLong adler32_combine_(adler1, adler2, len2)
|
local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2) {
|
||||||
uLong adler1;
|
|
||||||
uLong adler2;
|
|
||||||
z_off64_t len2;
|
|
||||||
{
|
|
||||||
unsigned long sum1;
|
unsigned long sum1;
|
||||||
unsigned long sum2;
|
unsigned long sum2;
|
||||||
unsigned rem;
|
unsigned rem;
|
||||||
|
|
@ -169,18 +155,10 @@ local uLong adler32_combine_(adler1, adler2, len2)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
uLong ZEXPORT adler32_combine(adler1, adler2, len2)
|
uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2, z_off_t len2) {
|
||||||
uLong adler1;
|
|
||||||
uLong adler2;
|
|
||||||
z_off_t len2;
|
|
||||||
{
|
|
||||||
return adler32_combine_(adler1, adler2, len2);
|
return adler32_combine_(adler1, adler2, len2);
|
||||||
}
|
}
|
||||||
|
|
||||||
uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
|
uLong ZEXPORT adler32_combine64(uLong adler1, uLong adler2, z_off64_t len2) {
|
||||||
uLong adler1;
|
|
||||||
uLong adler2;
|
|
||||||
z_off64_t len2;
|
|
||||||
{
|
|
||||||
return adler32_combine_(adler1, adler2, len2);
|
return adler32_combine_(adler1, adler2, len2);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
21
thirdparty/zlib/compress.c
vendored
21
thirdparty/zlib/compress.c
vendored
|
|
@ -19,13 +19,8 @@
|
||||||
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
|
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
|
||||||
Z_STREAM_ERROR if the level parameter is invalid.
|
Z_STREAM_ERROR if the level parameter is invalid.
|
||||||
*/
|
*/
|
||||||
int ZEXPORT compress2(dest, destLen, source, sourceLen, level)
|
int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source,
|
||||||
Bytef *dest;
|
uLong sourceLen, int level) {
|
||||||
uLongf *destLen;
|
|
||||||
const Bytef *source;
|
|
||||||
uLong sourceLen;
|
|
||||||
int level;
|
|
||||||
{
|
|
||||||
z_stream stream;
|
z_stream stream;
|
||||||
int err;
|
int err;
|
||||||
const uInt max = (uInt)-1;
|
const uInt max = (uInt)-1;
|
||||||
|
|
@ -65,12 +60,8 @@ int ZEXPORT compress2(dest, destLen, source, sourceLen, level)
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
*/
|
*/
|
||||||
int ZEXPORT compress(dest, destLen, source, sourceLen)
|
int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source,
|
||||||
Bytef *dest;
|
uLong sourceLen) {
|
||||||
uLongf *destLen;
|
|
||||||
const Bytef *source;
|
|
||||||
uLong sourceLen;
|
|
||||||
{
|
|
||||||
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
|
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -78,9 +69,7 @@ int ZEXPORT compress(dest, destLen, source, sourceLen)
|
||||||
If the default memLevel or windowBits for deflateInit() is changed, then
|
If the default memLevel or windowBits for deflateInit() is changed, then
|
||||||
this function needs to be updated.
|
this function needs to be updated.
|
||||||
*/
|
*/
|
||||||
uLong ZEXPORT compressBound(sourceLen)
|
uLong ZEXPORT compressBound(uLong sourceLen) {
|
||||||
uLong sourceLen;
|
|
||||||
{
|
|
||||||
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
|
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
|
||||||
(sourceLen >> 25) + 13;
|
(sourceLen >> 25) + 13;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
248
thirdparty/zlib/crc32.c
vendored
248
thirdparty/zlib/crc32.c
vendored
|
|
@ -103,19 +103,6 @@
|
||||||
# define ARMCRC32
|
# define ARMCRC32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Local functions. */
|
|
||||||
local z_crc_t multmodp OF((z_crc_t a, z_crc_t b));
|
|
||||||
local z_crc_t x2nmodp OF((z_off64_t n, unsigned k));
|
|
||||||
|
|
||||||
#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE))
|
|
||||||
local z_word_t byte_swap OF((z_word_t word));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(W) && !defined(ARMCRC32)
|
|
||||||
local z_crc_t crc_word OF((z_word_t data));
|
|
||||||
local z_word_t crc_word_big OF((z_word_t data));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE))
|
#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE))
|
||||||
/*
|
/*
|
||||||
Swap the bytes in a z_word_t to convert between little and big endian. Any
|
Swap the bytes in a z_word_t to convert between little and big endian. Any
|
||||||
|
|
@ -123,9 +110,7 @@ local z_crc_t x2nmodp OF((z_off64_t n, unsigned k));
|
||||||
instruction, if one is available. This assumes that word_t is either 32 bits
|
instruction, if one is available. This assumes that word_t is either 32 bits
|
||||||
or 64 bits.
|
or 64 bits.
|
||||||
*/
|
*/
|
||||||
local z_word_t byte_swap(word)
|
local z_word_t byte_swap(z_word_t word) {
|
||||||
z_word_t word;
|
|
||||||
{
|
|
||||||
# if W == 8
|
# if W == 8
|
||||||
return
|
return
|
||||||
(word & 0xff00000000000000) >> 56 |
|
(word & 0xff00000000000000) >> 56 |
|
||||||
|
|
@ -146,24 +131,77 @@ local z_word_t byte_swap(word)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DYNAMIC_CRC_TABLE
|
||||||
|
/* =========================================================================
|
||||||
|
* Table of powers of x for combining CRC-32s, filled in by make_crc_table()
|
||||||
|
* below.
|
||||||
|
*/
|
||||||
|
local z_crc_t FAR x2n_table[32];
|
||||||
|
#else
|
||||||
|
/* =========================================================================
|
||||||
|
* Tables for byte-wise and braided CRC-32 calculations, and a table of powers
|
||||||
|
* of x for combining CRC-32s, all made by make_crc_table().
|
||||||
|
*/
|
||||||
|
# include "crc32.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* CRC polynomial. */
|
/* CRC polynomial. */
|
||||||
#define POLY 0xedb88320 /* p(x) reflected, with x^32 implied */
|
#define POLY 0xedb88320 /* p(x) reflected, with x^32 implied */
|
||||||
|
|
||||||
#ifdef DYNAMIC_CRC_TABLE
|
/*
|
||||||
|
Return a(x) multiplied by b(x) modulo p(x), where p(x) is the CRC polynomial,
|
||||||
|
reflected. For speed, this requires that a not be zero.
|
||||||
|
*/
|
||||||
|
local z_crc_t multmodp(z_crc_t a, z_crc_t b) {
|
||||||
|
z_crc_t m, p;
|
||||||
|
|
||||||
|
m = (z_crc_t)1 << 31;
|
||||||
|
p = 0;
|
||||||
|
for (;;) {
|
||||||
|
if (a & m) {
|
||||||
|
p ^= b;
|
||||||
|
if ((a & (m - 1)) == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
m >>= 1;
|
||||||
|
b = b & 1 ? (b >> 1) ^ POLY : b >> 1;
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Return x^(n * 2^k) modulo p(x). Requires that x2n_table[] has been
|
||||||
|
initialized.
|
||||||
|
*/
|
||||||
|
local z_crc_t x2nmodp(z_off64_t n, unsigned k) {
|
||||||
|
z_crc_t p;
|
||||||
|
|
||||||
|
p = (z_crc_t)1 << 31; /* x^0 == 1 */
|
||||||
|
while (n) {
|
||||||
|
if (n & 1)
|
||||||
|
p = multmodp(x2n_table[k & 31], p);
|
||||||
|
n >>= 1;
|
||||||
|
k++;
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DYNAMIC_CRC_TABLE
|
||||||
|
/* =========================================================================
|
||||||
|
* Build the tables for byte-wise and braided CRC-32 calculations, and a table
|
||||||
|
* of powers of x for combining CRC-32s.
|
||||||
|
*/
|
||||||
local z_crc_t FAR crc_table[256];
|
local z_crc_t FAR crc_table[256];
|
||||||
local z_crc_t FAR x2n_table[32];
|
|
||||||
local void make_crc_table OF((void));
|
|
||||||
#ifdef W
|
#ifdef W
|
||||||
local z_word_t FAR crc_big_table[256];
|
local z_word_t FAR crc_big_table[256];
|
||||||
local z_crc_t FAR crc_braid_table[W][256];
|
local z_crc_t FAR crc_braid_table[W][256];
|
||||||
local z_word_t FAR crc_braid_big_table[W][256];
|
local z_word_t FAR crc_braid_big_table[W][256];
|
||||||
local void braid OF((z_crc_t [][256], z_word_t [][256], int, int));
|
local void braid(z_crc_t [][256], z_word_t [][256], int, int);
|
||||||
#endif
|
#endif
|
||||||
#ifdef MAKECRCH
|
#ifdef MAKECRCH
|
||||||
local void write_table OF((FILE *, const z_crc_t FAR *, int));
|
local void write_table(FILE *, const z_crc_t FAR *, int);
|
||||||
local void write_table32hi OF((FILE *, const z_word_t FAR *, int));
|
local void write_table32hi(FILE *, const z_word_t FAR *, int);
|
||||||
local void write_table64 OF((FILE *, const z_word_t FAR *, int));
|
local void write_table64(FILE *, const z_word_t FAR *, int);
|
||||||
#endif /* MAKECRCH */
|
#endif /* MAKECRCH */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -176,7 +214,6 @@ local void make_crc_table OF((void));
|
||||||
|
|
||||||
/* Definition of once functionality. */
|
/* Definition of once functionality. */
|
||||||
typedef struct once_s once_t;
|
typedef struct once_s once_t;
|
||||||
local void once OF((once_t *, void (*)(void)));
|
|
||||||
|
|
||||||
/* Check for the availability of atomics. */
|
/* Check for the availability of atomics. */
|
||||||
#if defined(__STDC__) && __STDC_VERSION__ >= 201112L && \
|
#if defined(__STDC__) && __STDC_VERSION__ >= 201112L && \
|
||||||
|
|
@ -196,10 +233,7 @@ struct once_s {
|
||||||
invoke once() at the same time. The state must be a once_t initialized with
|
invoke once() at the same time. The state must be a once_t initialized with
|
||||||
ONCE_INIT.
|
ONCE_INIT.
|
||||||
*/
|
*/
|
||||||
local void once(state, init)
|
local void once(once_t *state, void (*init)(void)) {
|
||||||
once_t *state;
|
|
||||||
void (*init)(void);
|
|
||||||
{
|
|
||||||
if (!atomic_load(&state->done)) {
|
if (!atomic_load(&state->done)) {
|
||||||
if (atomic_flag_test_and_set(&state->begun))
|
if (atomic_flag_test_and_set(&state->begun))
|
||||||
while (!atomic_load(&state->done))
|
while (!atomic_load(&state->done))
|
||||||
|
|
@ -222,10 +256,7 @@ struct once_s {
|
||||||
|
|
||||||
/* Test and set. Alas, not atomic, but tries to minimize the period of
|
/* Test and set. Alas, not atomic, but tries to minimize the period of
|
||||||
vulnerability. */
|
vulnerability. */
|
||||||
local int test_and_set OF((int volatile *));
|
local int test_and_set(int volatile *flag) {
|
||||||
local int test_and_set(flag)
|
|
||||||
int volatile *flag;
|
|
||||||
{
|
|
||||||
int was;
|
int was;
|
||||||
|
|
||||||
was = *flag;
|
was = *flag;
|
||||||
|
|
@ -234,10 +265,7 @@ local int test_and_set(flag)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Run the provided init() function once. This is not thread-safe. */
|
/* Run the provided init() function once. This is not thread-safe. */
|
||||||
local void once(state, init)
|
local void once(once_t *state, void (*init)(void)) {
|
||||||
once_t *state;
|
|
||||||
void (*init)(void);
|
|
||||||
{
|
|
||||||
if (!state->done) {
|
if (!state->done) {
|
||||||
if (test_and_set(&state->begun))
|
if (test_and_set(&state->begun))
|
||||||
while (!state->done)
|
while (!state->done)
|
||||||
|
|
@ -279,8 +307,7 @@ local once_t made = ONCE_INIT;
|
||||||
combinations of CRC register values and incoming bytes.
|
combinations of CRC register values and incoming bytes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
local void make_crc_table()
|
local void make_crc_table(void) {
|
||||||
{
|
|
||||||
unsigned i, j, n;
|
unsigned i, j, n;
|
||||||
z_crc_t p;
|
z_crc_t p;
|
||||||
|
|
||||||
|
|
@ -447,11 +474,7 @@ local void make_crc_table()
|
||||||
Write the 32-bit values in table[0..k-1] to out, five per line in
|
Write the 32-bit values in table[0..k-1] to out, five per line in
|
||||||
hexadecimal separated by commas.
|
hexadecimal separated by commas.
|
||||||
*/
|
*/
|
||||||
local void write_table(out, table, k)
|
local void write_table(FILE *out, const z_crc_t FAR *table, int k) {
|
||||||
FILE *out;
|
|
||||||
const z_crc_t FAR *table;
|
|
||||||
int k;
|
|
||||||
{
|
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
for (n = 0; n < k; n++)
|
for (n = 0; n < k; n++)
|
||||||
|
|
@ -464,11 +487,7 @@ local void write_table(out, table, k)
|
||||||
Write the high 32-bits of each value in table[0..k-1] to out, five per line
|
Write the high 32-bits of each value in table[0..k-1] to out, five per line
|
||||||
in hexadecimal separated by commas.
|
in hexadecimal separated by commas.
|
||||||
*/
|
*/
|
||||||
local void write_table32hi(out, table, k)
|
local void write_table32hi(FILE *out, const z_word_t FAR *table, int k) {
|
||||||
FILE *out;
|
|
||||||
const z_word_t FAR *table;
|
|
||||||
int k;
|
|
||||||
{
|
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
for (n = 0; n < k; n++)
|
for (n = 0; n < k; n++)
|
||||||
|
|
@ -484,11 +503,7 @@ int k;
|
||||||
bits. If not, then the type cast and format string can be adjusted
|
bits. If not, then the type cast and format string can be adjusted
|
||||||
accordingly.
|
accordingly.
|
||||||
*/
|
*/
|
||||||
local void write_table64(out, table, k)
|
local void write_table64(FILE *out, const z_word_t FAR *table, int k) {
|
||||||
FILE *out;
|
|
||||||
const z_word_t FAR *table;
|
|
||||||
int k;
|
|
||||||
{
|
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
for (n = 0; n < k; n++)
|
for (n = 0; n < k; n++)
|
||||||
|
|
@ -498,8 +513,7 @@ local void write_table64(out, table, k)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Actually do the deed. */
|
/* Actually do the deed. */
|
||||||
int main()
|
int main(void) {
|
||||||
{
|
|
||||||
make_crc_table();
|
make_crc_table();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -511,12 +525,7 @@ int main()
|
||||||
Generate the little and big-endian braid tables for the given n and z_word_t
|
Generate the little and big-endian braid tables for the given n and z_word_t
|
||||||
size w. Each array must have room for w blocks of 256 elements.
|
size w. Each array must have room for w blocks of 256 elements.
|
||||||
*/
|
*/
|
||||||
local void braid(ltl, big, n, w)
|
local void braid(z_crc_t ltl[][256], z_word_t big[][256], int n, int w) {
|
||||||
z_crc_t ltl[][256];
|
|
||||||
z_word_t big[][256];
|
|
||||||
int n;
|
|
||||||
int w;
|
|
||||||
{
|
|
||||||
int k;
|
int k;
|
||||||
z_crc_t i, p, q;
|
z_crc_t i, p, q;
|
||||||
for (k = 0; k < w; k++) {
|
for (k = 0; k < w; k++) {
|
||||||
|
|
@ -531,69 +540,13 @@ local void braid(ltl, big, n, w)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else /* !DYNAMIC_CRC_TABLE */
|
|
||||||
/* ========================================================================
|
|
||||||
* Tables for byte-wise and braided CRC-32 calculations, and a table of powers
|
|
||||||
* of x for combining CRC-32s, all made by make_crc_table().
|
|
||||||
*/
|
|
||||||
#include "crc32.h"
|
|
||||||
#endif /* DYNAMIC_CRC_TABLE */
|
#endif /* DYNAMIC_CRC_TABLE */
|
||||||
|
|
||||||
/* ========================================================================
|
|
||||||
* Routines used for CRC calculation. Some are also required for the table
|
|
||||||
* generation above.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
Return a(x) multiplied by b(x) modulo p(x), where p(x) is the CRC polynomial,
|
|
||||||
reflected. For speed, this requires that a not be zero.
|
|
||||||
*/
|
|
||||||
local z_crc_t multmodp(a, b)
|
|
||||||
z_crc_t a;
|
|
||||||
z_crc_t b;
|
|
||||||
{
|
|
||||||
z_crc_t m, p;
|
|
||||||
|
|
||||||
m = (z_crc_t)1 << 31;
|
|
||||||
p = 0;
|
|
||||||
for (;;) {
|
|
||||||
if (a & m) {
|
|
||||||
p ^= b;
|
|
||||||
if ((a & (m - 1)) == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
m >>= 1;
|
|
||||||
b = b & 1 ? (b >> 1) ^ POLY : b >> 1;
|
|
||||||
}
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Return x^(n * 2^k) modulo p(x). Requires that x2n_table[] has been
|
|
||||||
initialized.
|
|
||||||
*/
|
|
||||||
local z_crc_t x2nmodp(n, k)
|
|
||||||
z_off64_t n;
|
|
||||||
unsigned k;
|
|
||||||
{
|
|
||||||
z_crc_t p;
|
|
||||||
|
|
||||||
p = (z_crc_t)1 << 31; /* x^0 == 1 */
|
|
||||||
while (n) {
|
|
||||||
if (n & 1)
|
|
||||||
p = multmodp(x2n_table[k & 31], p);
|
|
||||||
n >>= 1;
|
|
||||||
k++;
|
|
||||||
}
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* =========================================================================
|
/* =========================================================================
|
||||||
* This function can be used by asm versions of crc32(), and to force the
|
* This function can be used by asm versions of crc32(), and to force the
|
||||||
* generation of the CRC tables in a threaded application.
|
* generation of the CRC tables in a threaded application.
|
||||||
*/
|
*/
|
||||||
const z_crc_t FAR * ZEXPORT get_crc_table()
|
const z_crc_t FAR * ZEXPORT get_crc_table(void) {
|
||||||
{
|
|
||||||
#ifdef DYNAMIC_CRC_TABLE
|
#ifdef DYNAMIC_CRC_TABLE
|
||||||
once(&made, make_crc_table);
|
once(&made, make_crc_table);
|
||||||
#endif /* DYNAMIC_CRC_TABLE */
|
#endif /* DYNAMIC_CRC_TABLE */
|
||||||
|
|
@ -619,11 +572,8 @@ const z_crc_t FAR * ZEXPORT get_crc_table()
|
||||||
#define Z_BATCH_ZEROS 0xa10d3d0c /* computed from Z_BATCH = 3990 */
|
#define Z_BATCH_ZEROS 0xa10d3d0c /* computed from Z_BATCH = 3990 */
|
||||||
#define Z_BATCH_MIN 800 /* fewest words in a final batch */
|
#define Z_BATCH_MIN 800 /* fewest words in a final batch */
|
||||||
|
|
||||||
unsigned long ZEXPORT crc32_z(crc, buf, len)
|
unsigned long ZEXPORT crc32_z(unsigned long crc, const unsigned char FAR *buf,
|
||||||
unsigned long crc;
|
z_size_t len) {
|
||||||
const unsigned char FAR *buf;
|
|
||||||
z_size_t len;
|
|
||||||
{
|
|
||||||
z_crc_t val;
|
z_crc_t val;
|
||||||
z_word_t crc1, crc2;
|
z_word_t crc1, crc2;
|
||||||
const z_word_t *word;
|
const z_word_t *word;
|
||||||
|
|
@ -723,18 +673,14 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
|
||||||
least-significant byte of the word as the first byte of data, without any pre
|
least-significant byte of the word as the first byte of data, without any pre
|
||||||
or post conditioning. This is used to combine the CRCs of each braid.
|
or post conditioning. This is used to combine the CRCs of each braid.
|
||||||
*/
|
*/
|
||||||
local z_crc_t crc_word(data)
|
local z_crc_t crc_word(z_word_t data) {
|
||||||
z_word_t data;
|
|
||||||
{
|
|
||||||
int k;
|
int k;
|
||||||
for (k = 0; k < W; k++)
|
for (k = 0; k < W; k++)
|
||||||
data = (data >> 8) ^ crc_table[data & 0xff];
|
data = (data >> 8) ^ crc_table[data & 0xff];
|
||||||
return (z_crc_t)data;
|
return (z_crc_t)data;
|
||||||
}
|
}
|
||||||
|
|
||||||
local z_word_t crc_word_big(data)
|
local z_word_t crc_word_big(z_word_t data) {
|
||||||
z_word_t data;
|
|
||||||
{
|
|
||||||
int k;
|
int k;
|
||||||
for (k = 0; k < W; k++)
|
for (k = 0; k < W; k++)
|
||||||
data = (data << 8) ^
|
data = (data << 8) ^
|
||||||
|
|
@ -745,11 +691,8 @@ local z_word_t crc_word_big(data)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
unsigned long ZEXPORT crc32_z(crc, buf, len)
|
unsigned long ZEXPORT crc32_z(unsigned long crc, const unsigned char FAR *buf,
|
||||||
unsigned long crc;
|
z_size_t len) {
|
||||||
const unsigned char FAR *buf;
|
|
||||||
z_size_t len;
|
|
||||||
{
|
|
||||||
/* Return initial CRC, if requested. */
|
/* Return initial CRC, if requested. */
|
||||||
if (buf == Z_NULL) return 0;
|
if (buf == Z_NULL) return 0;
|
||||||
|
|
||||||
|
|
@ -781,8 +724,8 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
|
||||||
words = (z_word_t const *)buf;
|
words = (z_word_t const *)buf;
|
||||||
|
|
||||||
/* Do endian check at execution time instead of compile time, since ARM
|
/* Do endian check at execution time instead of compile time, since ARM
|
||||||
processors can change the endianess at execution time. If the
|
processors can change the endianness at execution time. If the
|
||||||
compiler knows what the endianess will be, it can optimize out the
|
compiler knows what the endianness will be, it can optimize out the
|
||||||
check and the unused branch. */
|
check and the unused branch. */
|
||||||
endian = 1;
|
endian = 1;
|
||||||
if (*(unsigned char *)&endian) {
|
if (*(unsigned char *)&endian) {
|
||||||
|
|
@ -1069,20 +1012,13 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
unsigned long ZEXPORT crc32(crc, buf, len)
|
unsigned long ZEXPORT crc32(unsigned long crc, const unsigned char FAR *buf,
|
||||||
unsigned long crc;
|
uInt len) {
|
||||||
const unsigned char FAR *buf;
|
|
||||||
uInt len;
|
|
||||||
{
|
|
||||||
return crc32_z(crc, buf, len);
|
return crc32_z(crc, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
|
uLong ZEXPORT crc32_combine64(uLong crc1, uLong crc2, z_off64_t len2) {
|
||||||
uLong crc1;
|
|
||||||
uLong crc2;
|
|
||||||
z_off64_t len2;
|
|
||||||
{
|
|
||||||
#ifdef DYNAMIC_CRC_TABLE
|
#ifdef DYNAMIC_CRC_TABLE
|
||||||
once(&made, make_crc_table);
|
once(&made, make_crc_table);
|
||||||
#endif /* DYNAMIC_CRC_TABLE */
|
#endif /* DYNAMIC_CRC_TABLE */
|
||||||
|
|
@ -1090,18 +1026,12 @@ uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
uLong ZEXPORT crc32_combine(crc1, crc2, len2)
|
uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2) {
|
||||||
uLong crc1;
|
|
||||||
uLong crc2;
|
|
||||||
z_off_t len2;
|
|
||||||
{
|
|
||||||
return crc32_combine64(crc1, crc2, (z_off64_t)len2);
|
return crc32_combine64(crc1, crc2, (z_off64_t)len2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
uLong ZEXPORT crc32_combine_gen64(len2)
|
uLong ZEXPORT crc32_combine_gen64(z_off64_t len2) {
|
||||||
z_off64_t len2;
|
|
||||||
{
|
|
||||||
#ifdef DYNAMIC_CRC_TABLE
|
#ifdef DYNAMIC_CRC_TABLE
|
||||||
once(&made, make_crc_table);
|
once(&made, make_crc_table);
|
||||||
#endif /* DYNAMIC_CRC_TABLE */
|
#endif /* DYNAMIC_CRC_TABLE */
|
||||||
|
|
@ -1109,17 +1039,11 @@ uLong ZEXPORT crc32_combine_gen64(len2)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
uLong ZEXPORT crc32_combine_gen(len2)
|
uLong ZEXPORT crc32_combine_gen(z_off_t len2) {
|
||||||
z_off_t len2;
|
|
||||||
{
|
|
||||||
return crc32_combine_gen64((z_off64_t)len2);
|
return crc32_combine_gen64((z_off64_t)len2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
uLong ZEXPORT crc32_combine_op(crc1, crc2, op)
|
uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op) {
|
||||||
uLong crc1;
|
|
||||||
uLong crc2;
|
|
||||||
uLong op;
|
|
||||||
{
|
|
||||||
return multmodp(op, crc1) ^ (crc2 & 0xffffffff);
|
return multmodp(op, crc1) ^ (crc2 & 0xffffffff);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
612
thirdparty/zlib/deflate.c
vendored
612
thirdparty/zlib/deflate.c
vendored
|
|
@ -1,5 +1,5 @@
|
||||||
/* deflate.c -- compress data using the deflation algorithm
|
/* deflate.c -- compress data using the deflation algorithm
|
||||||
* Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler
|
* Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
#include "deflate.h"
|
#include "deflate.h"
|
||||||
|
|
||||||
const char deflate_copyright[] =
|
const char deflate_copyright[] =
|
||||||
" deflate 1.2.13 Copyright 1995-2022 Jean-loup Gailly and Mark Adler ";
|
" deflate 1.3.1 Copyright 1995-2024 Jean-loup Gailly and Mark Adler ";
|
||||||
/*
|
/*
|
||||||
If you use the zlib library in a product, an acknowledgment is welcome
|
If you use the zlib library in a product, an acknowledgment is welcome
|
||||||
in the documentation of your product. If for some reason you cannot
|
in the documentation of your product. If for some reason you cannot
|
||||||
|
|
@ -60,9 +60,6 @@ const char deflate_copyright[] =
|
||||||
copyright string in the executable of your product.
|
copyright string in the executable of your product.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* ===========================================================================
|
|
||||||
* Function prototypes.
|
|
||||||
*/
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
need_more, /* block not completed, need more input or more output */
|
need_more, /* block not completed, need more input or more output */
|
||||||
block_done, /* block flush performed */
|
block_done, /* block flush performed */
|
||||||
|
|
@ -70,29 +67,16 @@ typedef enum {
|
||||||
finish_done /* finish done, accept no more input or output */
|
finish_done /* finish done, accept no more input or output */
|
||||||
} block_state;
|
} block_state;
|
||||||
|
|
||||||
typedef block_state (*compress_func) OF((deflate_state *s, int flush));
|
typedef block_state (*compress_func)(deflate_state *s, int flush);
|
||||||
/* Compression function. Returns the block state after the call. */
|
/* Compression function. Returns the block state after the call. */
|
||||||
|
|
||||||
local int deflateStateCheck OF((z_streamp strm));
|
local block_state deflate_stored(deflate_state *s, int flush);
|
||||||
local void slide_hash OF((deflate_state *s));
|
local block_state deflate_fast(deflate_state *s, int flush);
|
||||||
local void fill_window OF((deflate_state *s));
|
|
||||||
local block_state deflate_stored OF((deflate_state *s, int flush));
|
|
||||||
local block_state deflate_fast OF((deflate_state *s, int flush));
|
|
||||||
#ifndef FASTEST
|
#ifndef FASTEST
|
||||||
local block_state deflate_slow OF((deflate_state *s, int flush));
|
local block_state deflate_slow(deflate_state *s, int flush);
|
||||||
#endif
|
|
||||||
local block_state deflate_rle OF((deflate_state *s, int flush));
|
|
||||||
local block_state deflate_huff OF((deflate_state *s, int flush));
|
|
||||||
local void lm_init OF((deflate_state *s));
|
|
||||||
local void putShortMSB OF((deflate_state *s, uInt b));
|
|
||||||
local void flush_pending OF((z_streamp strm));
|
|
||||||
local unsigned read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
|
|
||||||
local uInt longest_match OF((deflate_state *s, IPos cur_match));
|
|
||||||
|
|
||||||
#ifdef ZLIB_DEBUG
|
|
||||||
local void check_match OF((deflate_state *s, IPos start, IPos match,
|
|
||||||
int length));
|
|
||||||
#endif
|
#endif
|
||||||
|
local block_state deflate_rle(deflate_state *s, int flush);
|
||||||
|
local block_state deflate_huff(deflate_state *s, int flush);
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Local data
|
* Local data
|
||||||
|
|
@ -195,9 +179,12 @@ local const config configuration_table[10] = {
|
||||||
* bit values at the expense of memory usage). We slide even when level == 0 to
|
* bit values at the expense of memory usage). We slide even when level == 0 to
|
||||||
* keep the hash table consistent if we switch back to level > 0 later.
|
* keep the hash table consistent if we switch back to level > 0 later.
|
||||||
*/
|
*/
|
||||||
local void slide_hash(s)
|
#if defined(__has_feature)
|
||||||
deflate_state *s;
|
# if __has_feature(memory_sanitizer)
|
||||||
{
|
__attribute__((no_sanitize("memory")))
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
local void slide_hash(deflate_state *s) {
|
||||||
unsigned n, m;
|
unsigned n, m;
|
||||||
Posf *p;
|
Posf *p;
|
||||||
uInt wsize = s->w_size;
|
uInt wsize = s->w_size;
|
||||||
|
|
@ -221,30 +208,177 @@ local void slide_hash(s)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ===========================================================================
|
||||||
|
* Read a new buffer from the current input stream, update the adler32
|
||||||
|
* and total number of bytes read. All deflate() input goes through
|
||||||
|
* this function so some applications may wish to modify it to avoid
|
||||||
|
* allocating a large strm->next_in buffer and copying from it.
|
||||||
|
* (See also flush_pending()).
|
||||||
|
*/
|
||||||
|
local unsigned read_buf(z_streamp strm, Bytef *buf, unsigned size) {
|
||||||
|
unsigned len = strm->avail_in;
|
||||||
|
|
||||||
|
if (len > size) len = size;
|
||||||
|
if (len == 0) return 0;
|
||||||
|
|
||||||
|
strm->avail_in -= len;
|
||||||
|
|
||||||
|
zmemcpy(buf, strm->next_in, len);
|
||||||
|
if (strm->state->wrap == 1) {
|
||||||
|
strm->adler = adler32(strm->adler, buf, len);
|
||||||
|
}
|
||||||
|
#ifdef GZIP
|
||||||
|
else if (strm->state->wrap == 2) {
|
||||||
|
strm->adler = crc32(strm->adler, buf, len);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
strm->next_in += len;
|
||||||
|
strm->total_in += len;
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===========================================================================
|
||||||
|
* Fill the window when the lookahead becomes insufficient.
|
||||||
|
* Updates strstart and lookahead.
|
||||||
|
*
|
||||||
|
* IN assertion: lookahead < MIN_LOOKAHEAD
|
||||||
|
* OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
|
||||||
|
* At least one byte has been read, or avail_in == 0; reads are
|
||||||
|
* performed for at least two bytes (required for the zip translate_eol
|
||||||
|
* option -- not supported here).
|
||||||
|
*/
|
||||||
|
local void fill_window(deflate_state *s) {
|
||||||
|
unsigned n;
|
||||||
|
unsigned more; /* Amount of free space at the end of the window. */
|
||||||
|
uInt wsize = s->w_size;
|
||||||
|
|
||||||
|
Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
|
||||||
|
|
||||||
|
do {
|
||||||
|
more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
|
||||||
|
|
||||||
|
/* Deal with !@#$% 64K limit: */
|
||||||
|
if (sizeof(int) <= 2) {
|
||||||
|
if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
|
||||||
|
more = wsize;
|
||||||
|
|
||||||
|
} else if (more == (unsigned)(-1)) {
|
||||||
|
/* Very unlikely, but possible on 16 bit machine if
|
||||||
|
* strstart == 0 && lookahead == 1 (input done a byte at time)
|
||||||
|
*/
|
||||||
|
more--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If the window is almost full and there is insufficient lookahead,
|
||||||
|
* move the upper half to the lower one to make room in the upper half.
|
||||||
|
*/
|
||||||
|
if (s->strstart >= wsize + MAX_DIST(s)) {
|
||||||
|
|
||||||
|
zmemcpy(s->window, s->window + wsize, (unsigned)wsize - more);
|
||||||
|
s->match_start -= wsize;
|
||||||
|
s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
|
||||||
|
s->block_start -= (long) wsize;
|
||||||
|
if (s->insert > s->strstart)
|
||||||
|
s->insert = s->strstart;
|
||||||
|
slide_hash(s);
|
||||||
|
more += wsize;
|
||||||
|
}
|
||||||
|
if (s->strm->avail_in == 0) break;
|
||||||
|
|
||||||
|
/* If there was no sliding:
|
||||||
|
* strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
|
||||||
|
* more == window_size - lookahead - strstart
|
||||||
|
* => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
|
||||||
|
* => more >= window_size - 2*WSIZE + 2
|
||||||
|
* In the BIG_MEM or MMAP case (not yet supported),
|
||||||
|
* window_size == input_size + MIN_LOOKAHEAD &&
|
||||||
|
* strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
|
||||||
|
* Otherwise, window_size == 2*WSIZE so more >= 2.
|
||||||
|
* If there was sliding, more >= WSIZE. So in all cases, more >= 2.
|
||||||
|
*/
|
||||||
|
Assert(more >= 2, "more < 2");
|
||||||
|
|
||||||
|
n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
|
||||||
|
s->lookahead += n;
|
||||||
|
|
||||||
|
/* Initialize the hash value now that we have some input: */
|
||||||
|
if (s->lookahead + s->insert >= MIN_MATCH) {
|
||||||
|
uInt str = s->strstart - s->insert;
|
||||||
|
s->ins_h = s->window[str];
|
||||||
|
UPDATE_HASH(s, s->ins_h, s->window[str + 1]);
|
||||||
|
#if MIN_MATCH != 3
|
||||||
|
Call UPDATE_HASH() MIN_MATCH-3 more times
|
||||||
|
#endif
|
||||||
|
while (s->insert) {
|
||||||
|
UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
|
||||||
|
#ifndef FASTEST
|
||||||
|
s->prev[str & s->w_mask] = s->head[s->ins_h];
|
||||||
|
#endif
|
||||||
|
s->head[s->ins_h] = (Pos)str;
|
||||||
|
str++;
|
||||||
|
s->insert--;
|
||||||
|
if (s->lookahead + s->insert < MIN_MATCH)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
|
||||||
|
* but this is not important since only literal bytes will be emitted.
|
||||||
|
*/
|
||||||
|
|
||||||
|
} while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
|
||||||
|
|
||||||
|
/* If the WIN_INIT bytes after the end of the current data have never been
|
||||||
|
* written, then zero those bytes in order to avoid memory check reports of
|
||||||
|
* the use of uninitialized (or uninitialised as Julian writes) bytes by
|
||||||
|
* the longest match routines. Update the high water mark for the next
|
||||||
|
* time through here. WIN_INIT is set to MAX_MATCH since the longest match
|
||||||
|
* routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
|
||||||
|
*/
|
||||||
|
if (s->high_water < s->window_size) {
|
||||||
|
ulg curr = s->strstart + (ulg)(s->lookahead);
|
||||||
|
ulg init;
|
||||||
|
|
||||||
|
if (s->high_water < curr) {
|
||||||
|
/* Previous high water mark below current data -- zero WIN_INIT
|
||||||
|
* bytes or up to end of window, whichever is less.
|
||||||
|
*/
|
||||||
|
init = s->window_size - curr;
|
||||||
|
if (init > WIN_INIT)
|
||||||
|
init = WIN_INIT;
|
||||||
|
zmemzero(s->window + curr, (unsigned)init);
|
||||||
|
s->high_water = curr + init;
|
||||||
|
}
|
||||||
|
else if (s->high_water < (ulg)curr + WIN_INIT) {
|
||||||
|
/* High water mark at or above current data, but below current data
|
||||||
|
* plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
|
||||||
|
* to end of window, whichever is less.
|
||||||
|
*/
|
||||||
|
init = (ulg)curr + WIN_INIT - s->high_water;
|
||||||
|
if (init > s->window_size - s->high_water)
|
||||||
|
init = s->window_size - s->high_water;
|
||||||
|
zmemzero(s->window + s->high_water, (unsigned)init);
|
||||||
|
s->high_water += init;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
|
||||||
|
"not enough room for search");
|
||||||
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
int ZEXPORT deflateInit_(strm, level, version, stream_size)
|
int ZEXPORT deflateInit_(z_streamp strm, int level, const char *version,
|
||||||
z_streamp strm;
|
int stream_size) {
|
||||||
int level;
|
|
||||||
const char *version;
|
|
||||||
int stream_size;
|
|
||||||
{
|
|
||||||
return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
|
return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
|
||||||
Z_DEFAULT_STRATEGY, version, stream_size);
|
Z_DEFAULT_STRATEGY, version, stream_size);
|
||||||
/* To do: ignore strm->next_in if we use it as window */
|
/* To do: ignore strm->next_in if we use it as window */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
int ZEXPORT deflateInit2_(z_streamp strm, int level, int method,
|
||||||
version, stream_size)
|
int windowBits, int memLevel, int strategy,
|
||||||
z_streamp strm;
|
const char *version, int stream_size) {
|
||||||
int level;
|
|
||||||
int method;
|
|
||||||
int windowBits;
|
|
||||||
int memLevel;
|
|
||||||
int strategy;
|
|
||||||
const char *version;
|
|
||||||
int stream_size;
|
|
||||||
{
|
|
||||||
deflate_state *s;
|
deflate_state *s;
|
||||||
int wrap = 1;
|
int wrap = 1;
|
||||||
static const char my_version[] = ZLIB_VERSION;
|
static const char my_version[] = ZLIB_VERSION;
|
||||||
|
|
@ -359,7 +493,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
||||||
* symbols from which it is being constructed.
|
* symbols from which it is being constructed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4);
|
s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, LIT_BUFS);
|
||||||
s->pending_buf_size = (ulg)s->lit_bufsize * 4;
|
s->pending_buf_size = (ulg)s->lit_bufsize * 4;
|
||||||
|
|
||||||
if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
|
if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
|
||||||
|
|
@ -369,8 +503,14 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
||||||
deflateEnd (strm);
|
deflateEnd (strm);
|
||||||
return Z_MEM_ERROR;
|
return Z_MEM_ERROR;
|
||||||
}
|
}
|
||||||
|
#ifdef LIT_MEM
|
||||||
|
s->d_buf = (ushf *)(s->pending_buf + (s->lit_bufsize << 1));
|
||||||
|
s->l_buf = s->pending_buf + (s->lit_bufsize << 2);
|
||||||
|
s->sym_end = s->lit_bufsize - 1;
|
||||||
|
#else
|
||||||
s->sym_buf = s->pending_buf + s->lit_bufsize;
|
s->sym_buf = s->pending_buf + s->lit_bufsize;
|
||||||
s->sym_end = (s->lit_bufsize - 1) * 3;
|
s->sym_end = (s->lit_bufsize - 1) * 3;
|
||||||
|
#endif
|
||||||
/* We avoid equality with lit_bufsize*3 because of wraparound at 64K
|
/* We avoid equality with lit_bufsize*3 because of wraparound at 64K
|
||||||
* on 16 bit machines and because stored blocks are restricted to
|
* on 16 bit machines and because stored blocks are restricted to
|
||||||
* 64K-1 bytes.
|
* 64K-1 bytes.
|
||||||
|
|
@ -386,9 +526,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
||||||
/* =========================================================================
|
/* =========================================================================
|
||||||
* Check for a valid deflate stream state. Return 0 if ok, 1 if not.
|
* Check for a valid deflate stream state. Return 0 if ok, 1 if not.
|
||||||
*/
|
*/
|
||||||
local int deflateStateCheck(strm)
|
local int deflateStateCheck(z_streamp strm) {
|
||||||
z_streamp strm;
|
|
||||||
{
|
|
||||||
deflate_state *s;
|
deflate_state *s;
|
||||||
if (strm == Z_NULL ||
|
if (strm == Z_NULL ||
|
||||||
strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
|
strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
|
||||||
|
|
@ -409,11 +547,8 @@ local int deflateStateCheck(strm)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
int ZEXPORT deflateSetDictionary(strm, dictionary, dictLength)
|
int ZEXPORT deflateSetDictionary(z_streamp strm, const Bytef *dictionary,
|
||||||
z_streamp strm;
|
uInt dictLength) {
|
||||||
const Bytef *dictionary;
|
|
||||||
uInt dictLength;
|
|
||||||
{
|
|
||||||
deflate_state *s;
|
deflate_state *s;
|
||||||
uInt str, n;
|
uInt str, n;
|
||||||
int wrap;
|
int wrap;
|
||||||
|
|
@ -478,11 +613,8 @@ int ZEXPORT deflateSetDictionary(strm, dictionary, dictLength)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
int ZEXPORT deflateGetDictionary(strm, dictionary, dictLength)
|
int ZEXPORT deflateGetDictionary(z_streamp strm, Bytef *dictionary,
|
||||||
z_streamp strm;
|
uInt *dictLength) {
|
||||||
Bytef *dictionary;
|
|
||||||
uInt *dictLength;
|
|
||||||
{
|
|
||||||
deflate_state *s;
|
deflate_state *s;
|
||||||
uInt len;
|
uInt len;
|
||||||
|
|
||||||
|
|
@ -500,9 +632,7 @@ int ZEXPORT deflateGetDictionary(strm, dictionary, dictLength)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
int ZEXPORT deflateResetKeep(strm)
|
int ZEXPORT deflateResetKeep(z_streamp strm) {
|
||||||
z_streamp strm;
|
|
||||||
{
|
|
||||||
deflate_state *s;
|
deflate_state *s;
|
||||||
|
|
||||||
if (deflateStateCheck(strm)) {
|
if (deflateStateCheck(strm)) {
|
||||||
|
|
@ -537,10 +667,32 @@ int ZEXPORT deflateResetKeep(strm)
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ===========================================================================
|
||||||
|
* Initialize the "longest match" routines for a new zlib stream
|
||||||
|
*/
|
||||||
|
local void lm_init(deflate_state *s) {
|
||||||
|
s->window_size = (ulg)2L*s->w_size;
|
||||||
|
|
||||||
|
CLEAR_HASH(s);
|
||||||
|
|
||||||
|
/* Set the default configuration parameters:
|
||||||
|
*/
|
||||||
|
s->max_lazy_match = configuration_table[s->level].max_lazy;
|
||||||
|
s->good_match = configuration_table[s->level].good_length;
|
||||||
|
s->nice_match = configuration_table[s->level].nice_length;
|
||||||
|
s->max_chain_length = configuration_table[s->level].max_chain;
|
||||||
|
|
||||||
|
s->strstart = 0;
|
||||||
|
s->block_start = 0L;
|
||||||
|
s->lookahead = 0;
|
||||||
|
s->insert = 0;
|
||||||
|
s->match_length = s->prev_length = MIN_MATCH-1;
|
||||||
|
s->match_available = 0;
|
||||||
|
s->ins_h = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
int ZEXPORT deflateReset(strm)
|
int ZEXPORT deflateReset(z_streamp strm) {
|
||||||
z_streamp strm;
|
|
||||||
{
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = deflateResetKeep(strm);
|
ret = deflateResetKeep(strm);
|
||||||
|
|
@ -550,10 +702,7 @@ int ZEXPORT deflateReset(strm)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
int ZEXPORT deflateSetHeader(strm, head)
|
int ZEXPORT deflateSetHeader(z_streamp strm, gz_headerp head) {
|
||||||
z_streamp strm;
|
|
||||||
gz_headerp head;
|
|
||||||
{
|
|
||||||
if (deflateStateCheck(strm) || strm->state->wrap != 2)
|
if (deflateStateCheck(strm) || strm->state->wrap != 2)
|
||||||
return Z_STREAM_ERROR;
|
return Z_STREAM_ERROR;
|
||||||
strm->state->gzhead = head;
|
strm->state->gzhead = head;
|
||||||
|
|
@ -561,11 +710,7 @@ int ZEXPORT deflateSetHeader(strm, head)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
int ZEXPORT deflatePending(strm, pending, bits)
|
int ZEXPORT deflatePending(z_streamp strm, unsigned *pending, int *bits) {
|
||||||
unsigned *pending;
|
|
||||||
int *bits;
|
|
||||||
z_streamp strm;
|
|
||||||
{
|
|
||||||
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
|
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
|
||||||
if (pending != Z_NULL)
|
if (pending != Z_NULL)
|
||||||
*pending = strm->state->pending;
|
*pending = strm->state->pending;
|
||||||
|
|
@ -575,19 +720,21 @@ int ZEXPORT deflatePending(strm, pending, bits)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
int ZEXPORT deflatePrime(strm, bits, value)
|
int ZEXPORT deflatePrime(z_streamp strm, int bits, int value) {
|
||||||
z_streamp strm;
|
|
||||||
int bits;
|
|
||||||
int value;
|
|
||||||
{
|
|
||||||
deflate_state *s;
|
deflate_state *s;
|
||||||
int put;
|
int put;
|
||||||
|
|
||||||
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
|
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
|
||||||
s = strm->state;
|
s = strm->state;
|
||||||
|
#ifdef LIT_MEM
|
||||||
|
if (bits < 0 || bits > 16 ||
|
||||||
|
(uchf *)s->d_buf < s->pending_out + ((Buf_size + 7) >> 3))
|
||||||
|
return Z_BUF_ERROR;
|
||||||
|
#else
|
||||||
if (bits < 0 || bits > 16 ||
|
if (bits < 0 || bits > 16 ||
|
||||||
s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3))
|
s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3))
|
||||||
return Z_BUF_ERROR;
|
return Z_BUF_ERROR;
|
||||||
|
#endif
|
||||||
do {
|
do {
|
||||||
put = Buf_size - s->bi_valid;
|
put = Buf_size - s->bi_valid;
|
||||||
if (put > bits)
|
if (put > bits)
|
||||||
|
|
@ -602,11 +749,7 @@ int ZEXPORT deflatePrime(strm, bits, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
int ZEXPORT deflateParams(strm, level, strategy)
|
int ZEXPORT deflateParams(z_streamp strm, int level, int strategy) {
|
||||||
z_streamp strm;
|
|
||||||
int level;
|
|
||||||
int strategy;
|
|
||||||
{
|
|
||||||
deflate_state *s;
|
deflate_state *s;
|
||||||
compress_func func;
|
compress_func func;
|
||||||
|
|
||||||
|
|
@ -651,13 +794,8 @@ int ZEXPORT deflateParams(strm, level, strategy)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
|
int ZEXPORT deflateTune(z_streamp strm, int good_length, int max_lazy,
|
||||||
z_streamp strm;
|
int nice_length, int max_chain) {
|
||||||
int good_length;
|
|
||||||
int max_lazy;
|
|
||||||
int nice_length;
|
|
||||||
int max_chain;
|
|
||||||
{
|
|
||||||
deflate_state *s;
|
deflate_state *s;
|
||||||
|
|
||||||
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
|
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
|
||||||
|
|
@ -693,10 +831,7 @@ int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
|
||||||
*
|
*
|
||||||
* Shifts are used to approximate divisions, for speed.
|
* Shifts are used to approximate divisions, for speed.
|
||||||
*/
|
*/
|
||||||
uLong ZEXPORT deflateBound(strm, sourceLen)
|
uLong ZEXPORT deflateBound(z_streamp strm, uLong sourceLen) {
|
||||||
z_streamp strm;
|
|
||||||
uLong sourceLen;
|
|
||||||
{
|
|
||||||
deflate_state *s;
|
deflate_state *s;
|
||||||
uLong fixedlen, storelen, wraplen;
|
uLong fixedlen, storelen, wraplen;
|
||||||
|
|
||||||
|
|
@ -752,7 +887,8 @@ uLong ZEXPORT deflateBound(strm, sourceLen)
|
||||||
|
|
||||||
/* if not default parameters, return one of the conservative bounds */
|
/* if not default parameters, return one of the conservative bounds */
|
||||||
if (s->w_bits != 15 || s->hash_bits != 8 + 7)
|
if (s->w_bits != 15 || s->hash_bits != 8 + 7)
|
||||||
return (s->w_bits <= s->hash_bits ? fixedlen : storelen) + wraplen;
|
return (s->w_bits <= s->hash_bits && s->level ? fixedlen : storelen) +
|
||||||
|
wraplen;
|
||||||
|
|
||||||
/* default settings: return tight bound for that case -- ~0.03% overhead
|
/* default settings: return tight bound for that case -- ~0.03% overhead
|
||||||
plus a small constant */
|
plus a small constant */
|
||||||
|
|
@ -765,10 +901,7 @@ uLong ZEXPORT deflateBound(strm, sourceLen)
|
||||||
* IN assertion: the stream state is correct and there is enough room in
|
* IN assertion: the stream state is correct and there is enough room in
|
||||||
* pending_buf.
|
* pending_buf.
|
||||||
*/
|
*/
|
||||||
local void putShortMSB(s, b)
|
local void putShortMSB(deflate_state *s, uInt b) {
|
||||||
deflate_state *s;
|
|
||||||
uInt b;
|
|
||||||
{
|
|
||||||
put_byte(s, (Byte)(b >> 8));
|
put_byte(s, (Byte)(b >> 8));
|
||||||
put_byte(s, (Byte)(b & 0xff));
|
put_byte(s, (Byte)(b & 0xff));
|
||||||
}
|
}
|
||||||
|
|
@ -779,9 +912,7 @@ local void putShortMSB(s, b)
|
||||||
* applications may wish to modify it to avoid allocating a large
|
* applications may wish to modify it to avoid allocating a large
|
||||||
* strm->next_out buffer and copying into it. (See also read_buf()).
|
* strm->next_out buffer and copying into it. (See also read_buf()).
|
||||||
*/
|
*/
|
||||||
local void flush_pending(strm)
|
local void flush_pending(z_streamp strm) {
|
||||||
z_streamp strm;
|
|
||||||
{
|
|
||||||
unsigned len;
|
unsigned len;
|
||||||
deflate_state *s = strm->state;
|
deflate_state *s = strm->state;
|
||||||
|
|
||||||
|
|
@ -812,10 +943,7 @@ local void flush_pending(strm)
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
int ZEXPORT deflate(strm, flush)
|
int ZEXPORT deflate(z_streamp strm, int flush) {
|
||||||
z_streamp strm;
|
|
||||||
int flush;
|
|
||||||
{
|
|
||||||
int old_flush; /* value of flush param for previous deflate call */
|
int old_flush; /* value of flush param for previous deflate call */
|
||||||
deflate_state *s;
|
deflate_state *s;
|
||||||
|
|
||||||
|
|
@ -1127,9 +1255,7 @@ int ZEXPORT deflate(strm, flush)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
int ZEXPORT deflateEnd(strm)
|
int ZEXPORT deflateEnd(z_streamp strm) {
|
||||||
z_streamp strm;
|
|
||||||
{
|
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
|
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
|
||||||
|
|
@ -1153,11 +1279,10 @@ int ZEXPORT deflateEnd(strm)
|
||||||
* To simplify the source, this is not supported for 16-bit MSDOS (which
|
* To simplify the source, this is not supported for 16-bit MSDOS (which
|
||||||
* doesn't have enough memory anyway to duplicate compression states).
|
* doesn't have enough memory anyway to duplicate compression states).
|
||||||
*/
|
*/
|
||||||
int ZEXPORT deflateCopy(dest, source)
|
int ZEXPORT deflateCopy(z_streamp dest, z_streamp source) {
|
||||||
z_streamp dest;
|
|
||||||
z_streamp source;
|
|
||||||
{
|
|
||||||
#ifdef MAXSEG_64K
|
#ifdef MAXSEG_64K
|
||||||
|
(void)dest;
|
||||||
|
(void)source;
|
||||||
return Z_STREAM_ERROR;
|
return Z_STREAM_ERROR;
|
||||||
#else
|
#else
|
||||||
deflate_state *ds;
|
deflate_state *ds;
|
||||||
|
|
@ -1181,7 +1306,7 @@ int ZEXPORT deflateCopy(dest, source)
|
||||||
ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
|
ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
|
||||||
ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
|
ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
|
||||||
ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
|
ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
|
||||||
ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4);
|
ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, LIT_BUFS);
|
||||||
|
|
||||||
if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
|
if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
|
||||||
ds->pending_buf == Z_NULL) {
|
ds->pending_buf == Z_NULL) {
|
||||||
|
|
@ -1192,10 +1317,15 @@ int ZEXPORT deflateCopy(dest, source)
|
||||||
zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
|
zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
|
||||||
zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos));
|
zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos));
|
||||||
zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos));
|
zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos));
|
||||||
zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
|
zmemcpy(ds->pending_buf, ss->pending_buf, ds->lit_bufsize * LIT_BUFS);
|
||||||
|
|
||||||
ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
|
ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
|
||||||
|
#ifdef LIT_MEM
|
||||||
|
ds->d_buf = (ushf *)(ds->pending_buf + (ds->lit_bufsize << 1));
|
||||||
|
ds->l_buf = ds->pending_buf + (ds->lit_bufsize << 2);
|
||||||
|
#else
|
||||||
ds->sym_buf = ds->pending_buf + ds->lit_bufsize;
|
ds->sym_buf = ds->pending_buf + ds->lit_bufsize;
|
||||||
|
#endif
|
||||||
|
|
||||||
ds->l_desc.dyn_tree = ds->dyn_ltree;
|
ds->l_desc.dyn_tree = ds->dyn_ltree;
|
||||||
ds->d_desc.dyn_tree = ds->dyn_dtree;
|
ds->d_desc.dyn_tree = ds->dyn_dtree;
|
||||||
|
|
@ -1205,66 +1335,6 @@ int ZEXPORT deflateCopy(dest, source)
|
||||||
#endif /* MAXSEG_64K */
|
#endif /* MAXSEG_64K */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===========================================================================
|
|
||||||
* Read a new buffer from the current input stream, update the adler32
|
|
||||||
* and total number of bytes read. All deflate() input goes through
|
|
||||||
* this function so some applications may wish to modify it to avoid
|
|
||||||
* allocating a large strm->next_in buffer and copying from it.
|
|
||||||
* (See also flush_pending()).
|
|
||||||
*/
|
|
||||||
local unsigned read_buf(strm, buf, size)
|
|
||||||
z_streamp strm;
|
|
||||||
Bytef *buf;
|
|
||||||
unsigned size;
|
|
||||||
{
|
|
||||||
unsigned len = strm->avail_in;
|
|
||||||
|
|
||||||
if (len > size) len = size;
|
|
||||||
if (len == 0) return 0;
|
|
||||||
|
|
||||||
strm->avail_in -= len;
|
|
||||||
|
|
||||||
zmemcpy(buf, strm->next_in, len);
|
|
||||||
if (strm->state->wrap == 1) {
|
|
||||||
strm->adler = adler32(strm->adler, buf, len);
|
|
||||||
}
|
|
||||||
#ifdef GZIP
|
|
||||||
else if (strm->state->wrap == 2) {
|
|
||||||
strm->adler = crc32(strm->adler, buf, len);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
strm->next_in += len;
|
|
||||||
strm->total_in += len;
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ===========================================================================
|
|
||||||
* Initialize the "longest match" routines for a new zlib stream
|
|
||||||
*/
|
|
||||||
local void lm_init(s)
|
|
||||||
deflate_state *s;
|
|
||||||
{
|
|
||||||
s->window_size = (ulg)2L*s->w_size;
|
|
||||||
|
|
||||||
CLEAR_HASH(s);
|
|
||||||
|
|
||||||
/* Set the default configuration parameters:
|
|
||||||
*/
|
|
||||||
s->max_lazy_match = configuration_table[s->level].max_lazy;
|
|
||||||
s->good_match = configuration_table[s->level].good_length;
|
|
||||||
s->nice_match = configuration_table[s->level].nice_length;
|
|
||||||
s->max_chain_length = configuration_table[s->level].max_chain;
|
|
||||||
|
|
||||||
s->strstart = 0;
|
|
||||||
s->block_start = 0L;
|
|
||||||
s->lookahead = 0;
|
|
||||||
s->insert = 0;
|
|
||||||
s->match_length = s->prev_length = MIN_MATCH-1;
|
|
||||||
s->match_available = 0;
|
|
||||||
s->ins_h = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef FASTEST
|
#ifndef FASTEST
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Set match_start to the longest match starting at the given string and
|
* Set match_start to the longest match starting at the given string and
|
||||||
|
|
@ -1275,10 +1345,7 @@ local void lm_init(s)
|
||||||
* string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
|
* string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
|
||||||
* OUT assertion: the match length is not greater than s->lookahead.
|
* OUT assertion: the match length is not greater than s->lookahead.
|
||||||
*/
|
*/
|
||||||
local uInt longest_match(s, cur_match)
|
local uInt longest_match(deflate_state *s, IPos cur_match) {
|
||||||
deflate_state *s;
|
|
||||||
IPos cur_match; /* current match */
|
|
||||||
{
|
|
||||||
unsigned chain_length = s->max_chain_length;/* max hash chain length */
|
unsigned chain_length = s->max_chain_length;/* max hash chain length */
|
||||||
register Bytef *scan = s->window + s->strstart; /* current string */
|
register Bytef *scan = s->window + s->strstart; /* current string */
|
||||||
register Bytef *match; /* matched string */
|
register Bytef *match; /* matched string */
|
||||||
|
|
@ -1426,10 +1493,7 @@ local uInt longest_match(s, cur_match)
|
||||||
/* ---------------------------------------------------------------------------
|
/* ---------------------------------------------------------------------------
|
||||||
* Optimized version for FASTEST only
|
* Optimized version for FASTEST only
|
||||||
*/
|
*/
|
||||||
local uInt longest_match(s, cur_match)
|
local uInt longest_match(deflate_state *s, IPos cur_match) {
|
||||||
deflate_state *s;
|
|
||||||
IPos cur_match; /* current match */
|
|
||||||
{
|
|
||||||
register Bytef *scan = s->window + s->strstart; /* current string */
|
register Bytef *scan = s->window + s->strstart; /* current string */
|
||||||
register Bytef *match; /* matched string */
|
register Bytef *match; /* matched string */
|
||||||
register int len; /* length of current match */
|
register int len; /* length of current match */
|
||||||
|
|
@ -1490,19 +1554,23 @@ local uInt longest_match(s, cur_match)
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Check that the match at match_start is indeed a match.
|
* Check that the match at match_start is indeed a match.
|
||||||
*/
|
*/
|
||||||
local void check_match(s, start, match, length)
|
local void check_match(deflate_state *s, IPos start, IPos match, int length) {
|
||||||
deflate_state *s;
|
|
||||||
IPos start, match;
|
|
||||||
int length;
|
|
||||||
{
|
|
||||||
/* check that the match is indeed a match */
|
/* check that the match is indeed a match */
|
||||||
if (zmemcmp(s->window + match,
|
Bytef *back = s->window + (int)match, *here = s->window + start;
|
||||||
s->window + start, length) != EQUAL) {
|
IPos len = length;
|
||||||
fprintf(stderr, " start %u, match %u, length %d\n",
|
if (match == (IPos)-1) {
|
||||||
start, match, length);
|
/* match starts one byte before the current window -- just compare the
|
||||||
|
subsequent length-1 bytes */
|
||||||
|
back++;
|
||||||
|
here++;
|
||||||
|
len--;
|
||||||
|
}
|
||||||
|
if (zmemcmp(back, here, len) != EQUAL) {
|
||||||
|
fprintf(stderr, " start %u, match %d, length %d\n",
|
||||||
|
start, (int)match, length);
|
||||||
do {
|
do {
|
||||||
fprintf(stderr, "%c%c", s->window[match++], s->window[start++]);
|
fprintf(stderr, "(%02x %02x)", *back++, *here++);
|
||||||
} while (--length != 0);
|
} while (--len != 0);
|
||||||
z_error("invalid match");
|
z_error("invalid match");
|
||||||
}
|
}
|
||||||
if (z_verbose > 1) {
|
if (z_verbose > 1) {
|
||||||
|
|
@ -1514,137 +1582,6 @@ local void check_match(s, start, match, length)
|
||||||
# define check_match(s, start, match, length)
|
# define check_match(s, start, match, length)
|
||||||
#endif /* ZLIB_DEBUG */
|
#endif /* ZLIB_DEBUG */
|
||||||
|
|
||||||
/* ===========================================================================
|
|
||||||
* Fill the window when the lookahead becomes insufficient.
|
|
||||||
* Updates strstart and lookahead.
|
|
||||||
*
|
|
||||||
* IN assertion: lookahead < MIN_LOOKAHEAD
|
|
||||||
* OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
|
|
||||||
* At least one byte has been read, or avail_in == 0; reads are
|
|
||||||
* performed for at least two bytes (required for the zip translate_eol
|
|
||||||
* option -- not supported here).
|
|
||||||
*/
|
|
||||||
local void fill_window(s)
|
|
||||||
deflate_state *s;
|
|
||||||
{
|
|
||||||
unsigned n;
|
|
||||||
unsigned more; /* Amount of free space at the end of the window. */
|
|
||||||
uInt wsize = s->w_size;
|
|
||||||
|
|
||||||
Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
|
|
||||||
|
|
||||||
do {
|
|
||||||
more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
|
|
||||||
|
|
||||||
/* Deal with !@#$% 64K limit: */
|
|
||||||
if (sizeof(int) <= 2) {
|
|
||||||
if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
|
|
||||||
more = wsize;
|
|
||||||
|
|
||||||
} else if (more == (unsigned)(-1)) {
|
|
||||||
/* Very unlikely, but possible on 16 bit machine if
|
|
||||||
* strstart == 0 && lookahead == 1 (input done a byte at time)
|
|
||||||
*/
|
|
||||||
more--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If the window is almost full and there is insufficient lookahead,
|
|
||||||
* move the upper half to the lower one to make room in the upper half.
|
|
||||||
*/
|
|
||||||
if (s->strstart >= wsize + MAX_DIST(s)) {
|
|
||||||
|
|
||||||
zmemcpy(s->window, s->window + wsize, (unsigned)wsize - more);
|
|
||||||
s->match_start -= wsize;
|
|
||||||
s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
|
|
||||||
s->block_start -= (long) wsize;
|
|
||||||
if (s->insert > s->strstart)
|
|
||||||
s->insert = s->strstart;
|
|
||||||
slide_hash(s);
|
|
||||||
more += wsize;
|
|
||||||
}
|
|
||||||
if (s->strm->avail_in == 0) break;
|
|
||||||
|
|
||||||
/* If there was no sliding:
|
|
||||||
* strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
|
|
||||||
* more == window_size - lookahead - strstart
|
|
||||||
* => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
|
|
||||||
* => more >= window_size - 2*WSIZE + 2
|
|
||||||
* In the BIG_MEM or MMAP case (not yet supported),
|
|
||||||
* window_size == input_size + MIN_LOOKAHEAD &&
|
|
||||||
* strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
|
|
||||||
* Otherwise, window_size == 2*WSIZE so more >= 2.
|
|
||||||
* If there was sliding, more >= WSIZE. So in all cases, more >= 2.
|
|
||||||
*/
|
|
||||||
Assert(more >= 2, "more < 2");
|
|
||||||
|
|
||||||
n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
|
|
||||||
s->lookahead += n;
|
|
||||||
|
|
||||||
/* Initialize the hash value now that we have some input: */
|
|
||||||
if (s->lookahead + s->insert >= MIN_MATCH) {
|
|
||||||
uInt str = s->strstart - s->insert;
|
|
||||||
s->ins_h = s->window[str];
|
|
||||||
UPDATE_HASH(s, s->ins_h, s->window[str + 1]);
|
|
||||||
#if MIN_MATCH != 3
|
|
||||||
Call UPDATE_HASH() MIN_MATCH-3 more times
|
|
||||||
#endif
|
|
||||||
while (s->insert) {
|
|
||||||
UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
|
|
||||||
#ifndef FASTEST
|
|
||||||
s->prev[str & s->w_mask] = s->head[s->ins_h];
|
|
||||||
#endif
|
|
||||||
s->head[s->ins_h] = (Pos)str;
|
|
||||||
str++;
|
|
||||||
s->insert--;
|
|
||||||
if (s->lookahead + s->insert < MIN_MATCH)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
|
|
||||||
* but this is not important since only literal bytes will be emitted.
|
|
||||||
*/
|
|
||||||
|
|
||||||
} while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
|
|
||||||
|
|
||||||
/* If the WIN_INIT bytes after the end of the current data have never been
|
|
||||||
* written, then zero those bytes in order to avoid memory check reports of
|
|
||||||
* the use of uninitialized (or uninitialised as Julian writes) bytes by
|
|
||||||
* the longest match routines. Update the high water mark for the next
|
|
||||||
* time through here. WIN_INIT is set to MAX_MATCH since the longest match
|
|
||||||
* routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
|
|
||||||
*/
|
|
||||||
if (s->high_water < s->window_size) {
|
|
||||||
ulg curr = s->strstart + (ulg)(s->lookahead);
|
|
||||||
ulg init;
|
|
||||||
|
|
||||||
if (s->high_water < curr) {
|
|
||||||
/* Previous high water mark below current data -- zero WIN_INIT
|
|
||||||
* bytes or up to end of window, whichever is less.
|
|
||||||
*/
|
|
||||||
init = s->window_size - curr;
|
|
||||||
if (init > WIN_INIT)
|
|
||||||
init = WIN_INIT;
|
|
||||||
zmemzero(s->window + curr, (unsigned)init);
|
|
||||||
s->high_water = curr + init;
|
|
||||||
}
|
|
||||||
else if (s->high_water < (ulg)curr + WIN_INIT) {
|
|
||||||
/* High water mark at or above current data, but below current data
|
|
||||||
* plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
|
|
||||||
* to end of window, whichever is less.
|
|
||||||
*/
|
|
||||||
init = (ulg)curr + WIN_INIT - s->high_water;
|
|
||||||
if (init > s->window_size - s->high_water)
|
|
||||||
init = s->window_size - s->high_water;
|
|
||||||
zmemzero(s->window + s->high_water, (unsigned)init);
|
|
||||||
s->high_water += init;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
|
|
||||||
"not enough room for search");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Flush the current block, with given end-of-file flag.
|
* Flush the current block, with given end-of-file flag.
|
||||||
* IN assertion: strstart is set to the end of the current match.
|
* IN assertion: strstart is set to the end of the current match.
|
||||||
|
|
@ -1687,10 +1624,7 @@ local void fill_window(s)
|
||||||
* copied. It is most efficient with large input and output buffers, which
|
* copied. It is most efficient with large input and output buffers, which
|
||||||
* maximizes the opportunities to have a single copy from next_in to next_out.
|
* maximizes the opportunities to have a single copy from next_in to next_out.
|
||||||
*/
|
*/
|
||||||
local block_state deflate_stored(s, flush)
|
local block_state deflate_stored(deflate_state *s, int flush) {
|
||||||
deflate_state *s;
|
|
||||||
int flush;
|
|
||||||
{
|
|
||||||
/* Smallest worthy block size when not flushing or finishing. By default
|
/* Smallest worthy block size when not flushing or finishing. By default
|
||||||
* this is 32K. This can be as small as 507 bytes for memLevel == 1. For
|
* this is 32K. This can be as small as 507 bytes for memLevel == 1. For
|
||||||
* large input and output buffers, the stored block size will be larger.
|
* large input and output buffers, the stored block size will be larger.
|
||||||
|
|
@ -1874,10 +1808,7 @@ local block_state deflate_stored(s, flush)
|
||||||
* new strings in the dictionary only for unmatched strings or for short
|
* new strings in the dictionary only for unmatched strings or for short
|
||||||
* matches. It is used only for the fast compression options.
|
* matches. It is used only for the fast compression options.
|
||||||
*/
|
*/
|
||||||
local block_state deflate_fast(s, flush)
|
local block_state deflate_fast(deflate_state *s, int flush) {
|
||||||
deflate_state *s;
|
|
||||||
int flush;
|
|
||||||
{
|
|
||||||
IPos hash_head; /* head of the hash chain */
|
IPos hash_head; /* head of the hash chain */
|
||||||
int bflush; /* set if current block must be flushed */
|
int bflush; /* set if current block must be flushed */
|
||||||
|
|
||||||
|
|
@ -1976,10 +1907,7 @@ local block_state deflate_fast(s, flush)
|
||||||
* evaluation for matches: a match is finally adopted only if there is
|
* evaluation for matches: a match is finally adopted only if there is
|
||||||
* no better match at the next window position.
|
* no better match at the next window position.
|
||||||
*/
|
*/
|
||||||
local block_state deflate_slow(s, flush)
|
local block_state deflate_slow(deflate_state *s, int flush) {
|
||||||
deflate_state *s;
|
|
||||||
int flush;
|
|
||||||
{
|
|
||||||
IPos hash_head; /* head of hash chain */
|
IPos hash_head; /* head of hash chain */
|
||||||
int bflush; /* set if current block must be flushed */
|
int bflush; /* set if current block must be flushed */
|
||||||
|
|
||||||
|
|
@ -2107,10 +2035,7 @@ local block_state deflate_slow(s, flush)
|
||||||
* one. Do not maintain a hash table. (It will be regenerated if this run of
|
* one. Do not maintain a hash table. (It will be regenerated if this run of
|
||||||
* deflate switches away from Z_RLE.)
|
* deflate switches away from Z_RLE.)
|
||||||
*/
|
*/
|
||||||
local block_state deflate_rle(s, flush)
|
local block_state deflate_rle(deflate_state *s, int flush) {
|
||||||
deflate_state *s;
|
|
||||||
int flush;
|
|
||||||
{
|
|
||||||
int bflush; /* set if current block must be flushed */
|
int bflush; /* set if current block must be flushed */
|
||||||
uInt prev; /* byte at distance one to match */
|
uInt prev; /* byte at distance one to match */
|
||||||
Bytef *scan, *strend; /* scan goes up to strend for length of run */
|
Bytef *scan, *strend; /* scan goes up to strend for length of run */
|
||||||
|
|
@ -2181,10 +2106,7 @@ local block_state deflate_rle(s, flush)
|
||||||
* For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.
|
* For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.
|
||||||
* (It will be regenerated if this run of deflate switches away from Huffman.)
|
* (It will be regenerated if this run of deflate switches away from Huffman.)
|
||||||
*/
|
*/
|
||||||
local block_state deflate_huff(s, flush)
|
local block_state deflate_huff(deflate_state *s, int flush) {
|
||||||
deflate_state *s;
|
|
||||||
int flush;
|
|
||||||
{
|
|
||||||
int bflush; /* set if current block must be flushed */
|
int bflush; /* set if current block must be flushed */
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
|
||||||
51
thirdparty/zlib/deflate.h
vendored
51
thirdparty/zlib/deflate.h
vendored
|
|
@ -1,5 +1,5 @@
|
||||||
/* deflate.h -- internal compression state
|
/* deflate.h -- internal compression state
|
||||||
* Copyright (C) 1995-2018 Jean-loup Gailly
|
* Copyright (C) 1995-2024 Jean-loup Gailly
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -23,6 +23,10 @@
|
||||||
# define GZIP
|
# define GZIP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* define LIT_MEM to slightly increase the speed of deflate (order 1% to 2%) at
|
||||||
|
the cost of a larger memory footprint */
|
||||||
|
/* #define LIT_MEM */
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Internal compression state.
|
* Internal compression state.
|
||||||
*/
|
*/
|
||||||
|
|
@ -217,7 +221,14 @@ typedef struct internal_state {
|
||||||
/* Depth of each subtree used as tie breaker for trees of equal frequency
|
/* Depth of each subtree used as tie breaker for trees of equal frequency
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef LIT_MEM
|
||||||
|
# define LIT_BUFS 5
|
||||||
|
ushf *d_buf; /* buffer for distances */
|
||||||
|
uchf *l_buf; /* buffer for literals/lengths */
|
||||||
|
#else
|
||||||
|
# define LIT_BUFS 4
|
||||||
uchf *sym_buf; /* buffer for distances and literals/lengths */
|
uchf *sym_buf; /* buffer for distances and literals/lengths */
|
||||||
|
#endif
|
||||||
|
|
||||||
uInt lit_bufsize;
|
uInt lit_bufsize;
|
||||||
/* Size of match buffer for literals/lengths. There are 4 reasons for
|
/* Size of match buffer for literals/lengths. There are 4 reasons for
|
||||||
|
|
@ -239,7 +250,7 @@ typedef struct internal_state {
|
||||||
* - I can't count above 4
|
* - I can't count above 4
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uInt sym_next; /* running index in sym_buf */
|
uInt sym_next; /* running index in symbol buffer */
|
||||||
uInt sym_end; /* symbol table full when sym_next reaches this */
|
uInt sym_end; /* symbol table full when sym_next reaches this */
|
||||||
|
|
||||||
ulg opt_len; /* bit length of current block with optimal trees */
|
ulg opt_len; /* bit length of current block with optimal trees */
|
||||||
|
|
@ -291,14 +302,14 @@ typedef struct internal_state {
|
||||||
memory checker errors from longest match routines */
|
memory checker errors from longest match routines */
|
||||||
|
|
||||||
/* in trees.c */
|
/* in trees.c */
|
||||||
void ZLIB_INTERNAL _tr_init OF((deflate_state *s));
|
void ZLIB_INTERNAL _tr_init(deflate_state *s);
|
||||||
int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
|
int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc);
|
||||||
void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf,
|
void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf,
|
||||||
ulg stored_len, int last));
|
ulg stored_len, int last);
|
||||||
void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s));
|
void ZLIB_INTERNAL _tr_flush_bits(deflate_state *s);
|
||||||
void ZLIB_INTERNAL _tr_align OF((deflate_state *s));
|
void ZLIB_INTERNAL _tr_align(deflate_state *s);
|
||||||
void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
|
void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, charf *buf,
|
||||||
ulg stored_len, int last));
|
ulg stored_len, int last);
|
||||||
|
|
||||||
#define d_code(dist) \
|
#define d_code(dist) \
|
||||||
((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
|
((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
|
||||||
|
|
@ -318,6 +329,25 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
|
||||||
extern const uch ZLIB_INTERNAL _dist_code[];
|
extern const uch ZLIB_INTERNAL _dist_code[];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef LIT_MEM
|
||||||
|
# define _tr_tally_lit(s, c, flush) \
|
||||||
|
{ uch cc = (c); \
|
||||||
|
s->d_buf[s->sym_next] = 0; \
|
||||||
|
s->l_buf[s->sym_next++] = cc; \
|
||||||
|
s->dyn_ltree[cc].Freq++; \
|
||||||
|
flush = (s->sym_next == s->sym_end); \
|
||||||
|
}
|
||||||
|
# define _tr_tally_dist(s, distance, length, flush) \
|
||||||
|
{ uch len = (uch)(length); \
|
||||||
|
ush dist = (ush)(distance); \
|
||||||
|
s->d_buf[s->sym_next] = dist; \
|
||||||
|
s->l_buf[s->sym_next++] = len; \
|
||||||
|
dist--; \
|
||||||
|
s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
|
||||||
|
s->dyn_dtree[d_code(dist)].Freq++; \
|
||||||
|
flush = (s->sym_next == s->sym_end); \
|
||||||
|
}
|
||||||
|
#else
|
||||||
# define _tr_tally_lit(s, c, flush) \
|
# define _tr_tally_lit(s, c, flush) \
|
||||||
{ uch cc = (c); \
|
{ uch cc = (c); \
|
||||||
s->sym_buf[s->sym_next++] = 0; \
|
s->sym_buf[s->sym_next++] = 0; \
|
||||||
|
|
@ -337,6 +367,7 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
|
||||||
s->dyn_dtree[d_code(dist)].Freq++; \
|
s->dyn_dtree[d_code(dist)].Freq++; \
|
||||||
flush = (s->sym_next == s->sym_end); \
|
flush = (s->sym_next == s->sym_end); \
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
|
# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
|
||||||
# define _tr_tally_dist(s, distance, length, flush) \
|
# define _tr_tally_dist(s, distance, length, flush) \
|
||||||
|
|
|
||||||
4
thirdparty/zlib/gzclose.c
vendored
4
thirdparty/zlib/gzclose.c
vendored
|
|
@ -8,9 +8,7 @@
|
||||||
/* gzclose() is in a separate file so that it is linked in only if it is used.
|
/* gzclose() is in a separate file so that it is linked in only if it is used.
|
||||||
That way the other gzclose functions can be used instead to avoid linking in
|
That way the other gzclose functions can be used instead to avoid linking in
|
||||||
unneeded compression or decompression routines. */
|
unneeded compression or decompression routines. */
|
||||||
int ZEXPORT gzclose(file)
|
int ZEXPORT gzclose(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
#ifndef NO_GZCOMPRESS
|
#ifndef NO_GZCOMPRESS
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
|
|
|
||||||
31
thirdparty/zlib/gzguts.h
vendored
31
thirdparty/zlib/gzguts.h
vendored
|
|
@ -1,5 +1,5 @@
|
||||||
/* gzguts.h -- zlib internal header definitions for gz* operations
|
/* gzguts.h -- zlib internal header definitions for gz* operations
|
||||||
* Copyright (C) 2004-2019 Mark Adler
|
* Copyright (C) 2004-2024 Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -7,9 +7,8 @@
|
||||||
# ifndef _LARGEFILE_SOURCE
|
# ifndef _LARGEFILE_SOURCE
|
||||||
# define _LARGEFILE_SOURCE 1
|
# define _LARGEFILE_SOURCE 1
|
||||||
# endif
|
# endif
|
||||||
# ifdef _FILE_OFFSET_BITS
|
# undef _FILE_OFFSET_BITS
|
||||||
# undef _FILE_OFFSET_BITS
|
# undef _TIME_BITS
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_HIDDEN
|
#ifdef HAVE_HIDDEN
|
||||||
|
|
@ -119,8 +118,8 @@
|
||||||
|
|
||||||
/* gz* functions always use library allocation functions */
|
/* gz* functions always use library allocation functions */
|
||||||
#ifndef STDC
|
#ifndef STDC
|
||||||
extern voidp malloc OF((uInt size));
|
extern voidp malloc(uInt size);
|
||||||
extern void free OF((voidpf ptr));
|
extern void free(voidpf ptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* get errno and strerror definition */
|
/* get errno and strerror definition */
|
||||||
|
|
@ -138,10 +137,10 @@
|
||||||
|
|
||||||
/* provide prototypes for these when building zlib without LFS */
|
/* provide prototypes for these when building zlib without LFS */
|
||||||
#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
|
#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
|
||||||
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
|
ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *);
|
||||||
ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
|
ZEXTERN z_off64_t ZEXPORT gzseek64(gzFile, z_off64_t, int);
|
||||||
ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
|
ZEXTERN z_off64_t ZEXPORT gztell64(gzFile);
|
||||||
ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
|
ZEXTERN z_off64_t ZEXPORT gzoffset64(gzFile);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* default memLevel */
|
/* default memLevel */
|
||||||
|
|
@ -203,17 +202,13 @@ typedef struct {
|
||||||
typedef gz_state FAR *gz_statep;
|
typedef gz_state FAR *gz_statep;
|
||||||
|
|
||||||
/* shared functions */
|
/* shared functions */
|
||||||
void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *));
|
void ZLIB_INTERNAL gz_error(gz_statep, int, const char *);
|
||||||
#if defined UNDER_CE
|
#if defined UNDER_CE
|
||||||
char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error));
|
char ZLIB_INTERNAL *gz_strwinerror(DWORD error);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
|
/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
|
||||||
value -- needed when comparing unsigned to z_off64_t, which is signed
|
value -- needed when comparing unsigned to z_off64_t, which is signed
|
||||||
(possible z_off64_t types off_t, off64_t, and long are all signed) */
|
(possible z_off64_t types off_t, off64_t, and long are all signed) */
|
||||||
#ifdef INT_MAX
|
unsigned ZLIB_INTERNAL gz_intmax(void);
|
||||||
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
|
#define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
|
||||||
#else
|
|
||||||
unsigned ZLIB_INTERNAL gz_intmax OF((void));
|
|
||||||
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
|
|
||||||
#endif
|
|
||||||
|
|
|
||||||
113
thirdparty/zlib/gzlib.c
vendored
113
thirdparty/zlib/gzlib.c
vendored
|
|
@ -1,5 +1,5 @@
|
||||||
/* gzlib.c -- zlib functions common to reading and writing gzip files
|
/* gzlib.c -- zlib functions common to reading and writing gzip files
|
||||||
* Copyright (C) 2004-2019 Mark Adler
|
* Copyright (C) 2004-2024 Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -15,10 +15,6 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Local functions */
|
|
||||||
local void gz_reset OF((gz_statep));
|
|
||||||
local gzFile gz_open OF((const void *, int, const char *));
|
|
||||||
|
|
||||||
#if defined UNDER_CE
|
#if defined UNDER_CE
|
||||||
|
|
||||||
/* Map the Windows error number in ERROR to a locale-dependent error message
|
/* Map the Windows error number in ERROR to a locale-dependent error message
|
||||||
|
|
@ -30,9 +26,7 @@ local gzFile gz_open OF((const void *, int, const char *));
|
||||||
|
|
||||||
The gz_strwinerror function does not change the current setting of
|
The gz_strwinerror function does not change the current setting of
|
||||||
GetLastError. */
|
GetLastError. */
|
||||||
char ZLIB_INTERNAL *gz_strwinerror(error)
|
char ZLIB_INTERNAL *gz_strwinerror(DWORD error) {
|
||||||
DWORD error;
|
|
||||||
{
|
|
||||||
static char buf[1024];
|
static char buf[1024];
|
||||||
|
|
||||||
wchar_t *msgbuf;
|
wchar_t *msgbuf;
|
||||||
|
|
@ -72,9 +66,7 @@ char ZLIB_INTERNAL *gz_strwinerror(error)
|
||||||
#endif /* UNDER_CE */
|
#endif /* UNDER_CE */
|
||||||
|
|
||||||
/* Reset gzip file state */
|
/* Reset gzip file state */
|
||||||
local void gz_reset(state)
|
local void gz_reset(gz_statep state) {
|
||||||
gz_statep state;
|
|
||||||
{
|
|
||||||
state->x.have = 0; /* no output data available */
|
state->x.have = 0; /* no output data available */
|
||||||
if (state->mode == GZ_READ) { /* for reading ... */
|
if (state->mode == GZ_READ) { /* for reading ... */
|
||||||
state->eof = 0; /* not at end of file */
|
state->eof = 0; /* not at end of file */
|
||||||
|
|
@ -90,11 +82,7 @@ local void gz_reset(state)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open a gzip file either by name or file descriptor. */
|
/* Open a gzip file either by name or file descriptor. */
|
||||||
local gzFile gz_open(path, fd, mode)
|
local gzFile gz_open(const void *path, int fd, const char *mode) {
|
||||||
const void *path;
|
|
||||||
int fd;
|
|
||||||
const char *mode;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
z_size_t len;
|
z_size_t len;
|
||||||
int oflag;
|
int oflag;
|
||||||
|
|
@ -269,26 +257,17 @@ local gzFile gz_open(path, fd, mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
gzFile ZEXPORT gzopen(path, mode)
|
gzFile ZEXPORT gzopen(const char *path, const char *mode) {
|
||||||
const char *path;
|
|
||||||
const char *mode;
|
|
||||||
{
|
|
||||||
return gz_open(path, -1, mode);
|
return gz_open(path, -1, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
gzFile ZEXPORT gzopen64(path, mode)
|
gzFile ZEXPORT gzopen64(const char *path, const char *mode) {
|
||||||
const char *path;
|
|
||||||
const char *mode;
|
|
||||||
{
|
|
||||||
return gz_open(path, -1, mode);
|
return gz_open(path, -1, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
gzFile ZEXPORT gzdopen(fd, mode)
|
gzFile ZEXPORT gzdopen(int fd, const char *mode) {
|
||||||
int fd;
|
|
||||||
const char *mode;
|
|
||||||
{
|
|
||||||
char *path; /* identifier for error messages */
|
char *path; /* identifier for error messages */
|
||||||
gzFile gz;
|
gzFile gz;
|
||||||
|
|
||||||
|
|
@ -306,19 +285,13 @@ gzFile ZEXPORT gzdopen(fd, mode)
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
#ifdef WIDECHAR
|
#ifdef WIDECHAR
|
||||||
gzFile ZEXPORT gzopen_w(path, mode)
|
gzFile ZEXPORT gzopen_w(const wchar_t *path, const char *mode) {
|
||||||
const wchar_t *path;
|
|
||||||
const char *mode;
|
|
||||||
{
|
|
||||||
return gz_open(path, -2, mode);
|
return gz_open(path, -2, mode);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzbuffer(file, size)
|
int ZEXPORT gzbuffer(gzFile file, unsigned size) {
|
||||||
gzFile file;
|
|
||||||
unsigned size;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
/* get internal structure and check integrity */
|
/* get internal structure and check integrity */
|
||||||
|
|
@ -335,16 +308,14 @@ int ZEXPORT gzbuffer(file, size)
|
||||||
/* check and set requested size */
|
/* check and set requested size */
|
||||||
if ((size << 1) < size)
|
if ((size << 1) < size)
|
||||||
return -1; /* need to be able to double it */
|
return -1; /* need to be able to double it */
|
||||||
if (size < 2)
|
if (size < 8)
|
||||||
size = 2; /* need two bytes to check magic header */
|
size = 8; /* needed to behave well with flushing */
|
||||||
state->want = size;
|
state->want = size;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzrewind(file)
|
int ZEXPORT gzrewind(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
/* get internal structure */
|
/* get internal structure */
|
||||||
|
|
@ -365,11 +336,7 @@ int ZEXPORT gzrewind(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
z_off64_t ZEXPORT gzseek64(file, offset, whence)
|
z_off64_t ZEXPORT gzseek64(gzFile file, z_off64_t offset, int whence) {
|
||||||
gzFile file;
|
|
||||||
z_off64_t offset;
|
|
||||||
int whence;
|
|
||||||
{
|
|
||||||
unsigned n;
|
unsigned n;
|
||||||
z_off64_t ret;
|
z_off64_t ret;
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
@ -442,11 +409,7 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
z_off_t ZEXPORT gzseek(file, offset, whence)
|
z_off_t ZEXPORT gzseek(gzFile file, z_off_t offset, int whence) {
|
||||||
gzFile file;
|
|
||||||
z_off_t offset;
|
|
||||||
int whence;
|
|
||||||
{
|
|
||||||
z_off64_t ret;
|
z_off64_t ret;
|
||||||
|
|
||||||
ret = gzseek64(file, (z_off64_t)offset, whence);
|
ret = gzseek64(file, (z_off64_t)offset, whence);
|
||||||
|
|
@ -454,9 +417,7 @@ z_off_t ZEXPORT gzseek(file, offset, whence)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
z_off64_t ZEXPORT gztell64(file)
|
z_off64_t ZEXPORT gztell64(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
/* get internal structure and check integrity */
|
/* get internal structure and check integrity */
|
||||||
|
|
@ -471,9 +432,7 @@ z_off64_t ZEXPORT gztell64(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
z_off_t ZEXPORT gztell(file)
|
z_off_t ZEXPORT gztell(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
z_off64_t ret;
|
z_off64_t ret;
|
||||||
|
|
||||||
ret = gztell64(file);
|
ret = gztell64(file);
|
||||||
|
|
@ -481,9 +440,7 @@ z_off_t ZEXPORT gztell(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
z_off64_t ZEXPORT gzoffset64(file)
|
z_off64_t ZEXPORT gzoffset64(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
z_off64_t offset;
|
z_off64_t offset;
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
|
|
@ -504,9 +461,7 @@ z_off64_t ZEXPORT gzoffset64(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
z_off_t ZEXPORT gzoffset(file)
|
z_off_t ZEXPORT gzoffset(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
z_off64_t ret;
|
z_off64_t ret;
|
||||||
|
|
||||||
ret = gzoffset64(file);
|
ret = gzoffset64(file);
|
||||||
|
|
@ -514,9 +469,7 @@ z_off_t ZEXPORT gzoffset(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzeof(file)
|
int ZEXPORT gzeof(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
/* get internal structure and check integrity */
|
/* get internal structure and check integrity */
|
||||||
|
|
@ -531,10 +484,7 @@ int ZEXPORT gzeof(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
const char * ZEXPORT gzerror(file, errnum)
|
const char * ZEXPORT gzerror(gzFile file, int *errnum) {
|
||||||
gzFile file;
|
|
||||||
int *errnum;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
/* get internal structure and check integrity */
|
/* get internal structure and check integrity */
|
||||||
|
|
@ -552,9 +502,7 @@ const char * ZEXPORT gzerror(file, errnum)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
void ZEXPORT gzclearerr(file)
|
void ZEXPORT gzclearerr(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
/* get internal structure and check integrity */
|
/* get internal structure and check integrity */
|
||||||
|
|
@ -578,11 +526,7 @@ void ZEXPORT gzclearerr(file)
|
||||||
memory). Simply save the error message as a static string. If there is an
|
memory). Simply save the error message as a static string. If there is an
|
||||||
allocation failure constructing the error message, then convert the error to
|
allocation failure constructing the error message, then convert the error to
|
||||||
out of memory. */
|
out of memory. */
|
||||||
void ZLIB_INTERNAL gz_error(state, err, msg)
|
void ZLIB_INTERNAL gz_error(gz_statep state, int err, const char *msg) {
|
||||||
gz_statep state;
|
|
||||||
int err;
|
|
||||||
const char *msg;
|
|
||||||
{
|
|
||||||
/* free previously allocated message and clear */
|
/* free previously allocated message and clear */
|
||||||
if (state->msg != NULL) {
|
if (state->msg != NULL) {
|
||||||
if (state->err != Z_MEM_ERROR)
|
if (state->err != Z_MEM_ERROR)
|
||||||
|
|
@ -619,21 +563,20 @@ void ZLIB_INTERNAL gz_error(state, err, msg)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef INT_MAX
|
|
||||||
/* portably return maximum value for an int (when limits.h presumed not
|
/* portably return maximum value for an int (when limits.h presumed not
|
||||||
available) -- we need to do this to cover cases where 2's complement not
|
available) -- we need to do this to cover cases where 2's complement not
|
||||||
used, since C standard permits 1's complement and sign-bit representations,
|
used, since C standard permits 1's complement and sign-bit representations,
|
||||||
otherwise we could just use ((unsigned)-1) >> 1 */
|
otherwise we could just use ((unsigned)-1) >> 1 */
|
||||||
unsigned ZLIB_INTERNAL gz_intmax()
|
unsigned ZLIB_INTERNAL gz_intmax(void) {
|
||||||
{
|
#ifdef INT_MAX
|
||||||
unsigned p, q;
|
return INT_MAX;
|
||||||
|
#else
|
||||||
p = 1;
|
unsigned p = 1, q;
|
||||||
do {
|
do {
|
||||||
q = p;
|
q = p;
|
||||||
p <<= 1;
|
p <<= 1;
|
||||||
p++;
|
p++;
|
||||||
} while (p > q);
|
} while (p > q);
|
||||||
return q >> 1;
|
return q >> 1;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
|
||||||
88
thirdparty/zlib/gzread.c
vendored
88
thirdparty/zlib/gzread.c
vendored
|
|
@ -5,25 +5,12 @@
|
||||||
|
|
||||||
#include "gzguts.h"
|
#include "gzguts.h"
|
||||||
|
|
||||||
/* Local functions */
|
|
||||||
local int gz_load OF((gz_statep, unsigned char *, unsigned, unsigned *));
|
|
||||||
local int gz_avail OF((gz_statep));
|
|
||||||
local int gz_look OF((gz_statep));
|
|
||||||
local int gz_decomp OF((gz_statep));
|
|
||||||
local int gz_fetch OF((gz_statep));
|
|
||||||
local int gz_skip OF((gz_statep, z_off64_t));
|
|
||||||
local z_size_t gz_read OF((gz_statep, voidp, z_size_t));
|
|
||||||
|
|
||||||
/* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from
|
/* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from
|
||||||
state->fd, and update state->eof, state->err, and state->msg as appropriate.
|
state->fd, and update state->eof, state->err, and state->msg as appropriate.
|
||||||
This function needs to loop on read(), since read() is not guaranteed to
|
This function needs to loop on read(), since read() is not guaranteed to
|
||||||
read the number of bytes requested, depending on the type of descriptor. */
|
read the number of bytes requested, depending on the type of descriptor. */
|
||||||
local int gz_load(state, buf, len, have)
|
local int gz_load(gz_statep state, unsigned char *buf, unsigned len,
|
||||||
gz_statep state;
|
unsigned *have) {
|
||||||
unsigned char *buf;
|
|
||||||
unsigned len;
|
|
||||||
unsigned *have;
|
|
||||||
{
|
|
||||||
int ret;
|
int ret;
|
||||||
unsigned get, max = ((unsigned)-1 >> 2) + 1;
|
unsigned get, max = ((unsigned)-1 >> 2) + 1;
|
||||||
|
|
||||||
|
|
@ -53,9 +40,7 @@ local int gz_load(state, buf, len, have)
|
||||||
If strm->avail_in != 0, then the current data is moved to the beginning of
|
If strm->avail_in != 0, then the current data is moved to the beginning of
|
||||||
the input buffer, and then the remainder of the buffer is loaded with the
|
the input buffer, and then the remainder of the buffer is loaded with the
|
||||||
available data from the input file. */
|
available data from the input file. */
|
||||||
local int gz_avail(state)
|
local int gz_avail(gz_statep state) {
|
||||||
gz_statep state;
|
|
||||||
{
|
|
||||||
unsigned got;
|
unsigned got;
|
||||||
z_streamp strm = &(state->strm);
|
z_streamp strm = &(state->strm);
|
||||||
|
|
||||||
|
|
@ -88,9 +73,7 @@ local int gz_avail(state)
|
||||||
case, all further file reads will be directly to either the output buffer or
|
case, all further file reads will be directly to either the output buffer or
|
||||||
a user buffer. If decompressing, the inflate state will be initialized.
|
a user buffer. If decompressing, the inflate state will be initialized.
|
||||||
gz_look() will return 0 on success or -1 on failure. */
|
gz_look() will return 0 on success or -1 on failure. */
|
||||||
local int gz_look(state)
|
local int gz_look(gz_statep state) {
|
||||||
gz_statep state;
|
|
||||||
{
|
|
||||||
z_streamp strm = &(state->strm);
|
z_streamp strm = &(state->strm);
|
||||||
|
|
||||||
/* allocate read buffers and inflate memory */
|
/* allocate read buffers and inflate memory */
|
||||||
|
|
@ -170,9 +153,7 @@ local int gz_look(state)
|
||||||
data. If the gzip stream completes, state->how is reset to LOOK to look for
|
data. If the gzip stream completes, state->how is reset to LOOK to look for
|
||||||
the next gzip stream or raw data, once state->x.have is depleted. Returns 0
|
the next gzip stream or raw data, once state->x.have is depleted. Returns 0
|
||||||
on success, -1 on failure. */
|
on success, -1 on failure. */
|
||||||
local int gz_decomp(state)
|
local int gz_decomp(gz_statep state) {
|
||||||
gz_statep state;
|
|
||||||
{
|
|
||||||
int ret = Z_OK;
|
int ret = Z_OK;
|
||||||
unsigned had;
|
unsigned had;
|
||||||
z_streamp strm = &(state->strm);
|
z_streamp strm = &(state->strm);
|
||||||
|
|
@ -224,9 +205,7 @@ local int gz_decomp(state)
|
||||||
looked for to determine whether to copy or decompress. Returns -1 on error,
|
looked for to determine whether to copy or decompress. Returns -1 on error,
|
||||||
otherwise 0. gz_fetch() will leave state->how as COPY or GZIP unless the
|
otherwise 0. gz_fetch() will leave state->how as COPY or GZIP unless the
|
||||||
end of the input file has been reached and all data has been processed. */
|
end of the input file has been reached and all data has been processed. */
|
||||||
local int gz_fetch(state)
|
local int gz_fetch(gz_statep state) {
|
||||||
gz_statep state;
|
|
||||||
{
|
|
||||||
z_streamp strm = &(state->strm);
|
z_streamp strm = &(state->strm);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
@ -254,10 +233,7 @@ local int gz_fetch(state)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */
|
/* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */
|
||||||
local int gz_skip(state, len)
|
local int gz_skip(gz_statep state, z_off64_t len) {
|
||||||
gz_statep state;
|
|
||||||
z_off64_t len;
|
|
||||||
{
|
|
||||||
unsigned n;
|
unsigned n;
|
||||||
|
|
||||||
/* skip over len bytes or reach end-of-file, whichever comes first */
|
/* skip over len bytes or reach end-of-file, whichever comes first */
|
||||||
|
|
@ -289,11 +265,7 @@ local int gz_skip(state, len)
|
||||||
input. Return the number of bytes read. If zero is returned, either the
|
input. Return the number of bytes read. If zero is returned, either the
|
||||||
end of file was reached, or there was an error. state->err must be
|
end of file was reached, or there was an error. state->err must be
|
||||||
consulted in that case to determine which. */
|
consulted in that case to determine which. */
|
||||||
local z_size_t gz_read(state, buf, len)
|
local z_size_t gz_read(gz_statep state, voidp buf, z_size_t len) {
|
||||||
gz_statep state;
|
|
||||||
voidp buf;
|
|
||||||
z_size_t len;
|
|
||||||
{
|
|
||||||
z_size_t got;
|
z_size_t got;
|
||||||
unsigned n;
|
unsigned n;
|
||||||
|
|
||||||
|
|
@ -370,11 +342,7 @@ local z_size_t gz_read(state, buf, len)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzread(file, buf, len)
|
int ZEXPORT gzread(gzFile file, voidp buf, unsigned len) {
|
||||||
gzFile file;
|
|
||||||
voidp buf;
|
|
||||||
unsigned len;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
/* get internal structure */
|
/* get internal structure */
|
||||||
|
|
@ -406,12 +374,7 @@ int ZEXPORT gzread(file, buf, len)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
z_size_t ZEXPORT gzfread(buf, size, nitems, file)
|
z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems, gzFile file) {
|
||||||
voidp buf;
|
|
||||||
z_size_t size;
|
|
||||||
z_size_t nitems;
|
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
z_size_t len;
|
z_size_t len;
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
|
|
@ -442,9 +405,7 @@ z_size_t ZEXPORT gzfread(buf, size, nitems, file)
|
||||||
#else
|
#else
|
||||||
# undef gzgetc
|
# undef gzgetc
|
||||||
#endif
|
#endif
|
||||||
int ZEXPORT gzgetc(file)
|
int ZEXPORT gzgetc(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
unsigned char buf[1];
|
unsigned char buf[1];
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
|
|
@ -469,17 +430,12 @@ int ZEXPORT gzgetc(file)
|
||||||
return gz_read(state, buf, 1) < 1 ? -1 : buf[0];
|
return gz_read(state, buf, 1) < 1 ? -1 : buf[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT gzgetc_(file)
|
int ZEXPORT gzgetc_(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
return gzgetc(file);
|
return gzgetc(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzungetc(c, file)
|
int ZEXPORT gzungetc(int c, gzFile file) {
|
||||||
int c;
|
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
/* get internal structure */
|
/* get internal structure */
|
||||||
|
|
@ -487,6 +443,10 @@ int ZEXPORT gzungetc(c, file)
|
||||||
return -1;
|
return -1;
|
||||||
state = (gz_statep)file;
|
state = (gz_statep)file;
|
||||||
|
|
||||||
|
/* in case this was just opened, set up the input buffer */
|
||||||
|
if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0)
|
||||||
|
(void)gz_look(state);
|
||||||
|
|
||||||
/* check that we're reading and that there's no (serious) error */
|
/* check that we're reading and that there's no (serious) error */
|
||||||
if (state->mode != GZ_READ ||
|
if (state->mode != GZ_READ ||
|
||||||
(state->err != Z_OK && state->err != Z_BUF_ERROR))
|
(state->err != Z_OK && state->err != Z_BUF_ERROR))
|
||||||
|
|
@ -536,11 +496,7 @@ int ZEXPORT gzungetc(c, file)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
char * ZEXPORT gzgets(file, buf, len)
|
char * ZEXPORT gzgets(gzFile file, char *buf, int len) {
|
||||||
gzFile file;
|
|
||||||
char *buf;
|
|
||||||
int len;
|
|
||||||
{
|
|
||||||
unsigned left, n;
|
unsigned left, n;
|
||||||
char *str;
|
char *str;
|
||||||
unsigned char *eol;
|
unsigned char *eol;
|
||||||
|
|
@ -600,9 +556,7 @@ char * ZEXPORT gzgets(file, buf, len)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzdirect(file)
|
int ZEXPORT gzdirect(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
/* get internal structure */
|
/* get internal structure */
|
||||||
|
|
@ -620,9 +574,7 @@ int ZEXPORT gzdirect(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzclose_r(file)
|
int ZEXPORT gzclose_r(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
int ret, err;
|
int ret, err;
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
|
|
|
||||||
84
thirdparty/zlib/gzwrite.c
vendored
84
thirdparty/zlib/gzwrite.c
vendored
|
|
@ -5,18 +5,10 @@
|
||||||
|
|
||||||
#include "gzguts.h"
|
#include "gzguts.h"
|
||||||
|
|
||||||
/* Local functions */
|
|
||||||
local int gz_init OF((gz_statep));
|
|
||||||
local int gz_comp OF((gz_statep, int));
|
|
||||||
local int gz_zero OF((gz_statep, z_off64_t));
|
|
||||||
local z_size_t gz_write OF((gz_statep, voidpc, z_size_t));
|
|
||||||
|
|
||||||
/* Initialize state for writing a gzip file. Mark initialization by setting
|
/* Initialize state for writing a gzip file. Mark initialization by setting
|
||||||
state->size to non-zero. Return -1 on a memory allocation failure, or 0 on
|
state->size to non-zero. Return -1 on a memory allocation failure, or 0 on
|
||||||
success. */
|
success. */
|
||||||
local int gz_init(state)
|
local int gz_init(gz_statep state) {
|
||||||
gz_statep state;
|
|
||||||
{
|
|
||||||
int ret;
|
int ret;
|
||||||
z_streamp strm = &(state->strm);
|
z_streamp strm = &(state->strm);
|
||||||
|
|
||||||
|
|
@ -70,10 +62,7 @@ local int gz_init(state)
|
||||||
deflate() flush value. If flush is Z_FINISH, then the deflate() state is
|
deflate() flush value. If flush is Z_FINISH, then the deflate() state is
|
||||||
reset to start a new gzip stream. If gz->direct is true, then simply write
|
reset to start a new gzip stream. If gz->direct is true, then simply write
|
||||||
to the output file without compressing, and ignore flush. */
|
to the output file without compressing, and ignore flush. */
|
||||||
local int gz_comp(state, flush)
|
local int gz_comp(gz_statep state, int flush) {
|
||||||
gz_statep state;
|
|
||||||
int flush;
|
|
||||||
{
|
|
||||||
int ret, writ;
|
int ret, writ;
|
||||||
unsigned have, put, max = ((unsigned)-1 >> 2) + 1;
|
unsigned have, put, max = ((unsigned)-1 >> 2) + 1;
|
||||||
z_streamp strm = &(state->strm);
|
z_streamp strm = &(state->strm);
|
||||||
|
|
@ -151,10 +140,7 @@ local int gz_comp(state, flush)
|
||||||
|
|
||||||
/* Compress len zeros to output. Return -1 on a write error or memory
|
/* Compress len zeros to output. Return -1 on a write error or memory
|
||||||
allocation failure by gz_comp(), or 0 on success. */
|
allocation failure by gz_comp(), or 0 on success. */
|
||||||
local int gz_zero(state, len)
|
local int gz_zero(gz_statep state, z_off64_t len) {
|
||||||
gz_statep state;
|
|
||||||
z_off64_t len;
|
|
||||||
{
|
|
||||||
int first;
|
int first;
|
||||||
unsigned n;
|
unsigned n;
|
||||||
z_streamp strm = &(state->strm);
|
z_streamp strm = &(state->strm);
|
||||||
|
|
@ -184,11 +170,7 @@ local int gz_zero(state, len)
|
||||||
|
|
||||||
/* Write len bytes from buf to file. Return the number of bytes written. If
|
/* Write len bytes from buf to file. Return the number of bytes written. If
|
||||||
the returned value is less than len, then there was an error. */
|
the returned value is less than len, then there was an error. */
|
||||||
local z_size_t gz_write(state, buf, len)
|
local z_size_t gz_write(gz_statep state, voidpc buf, z_size_t len) {
|
||||||
gz_statep state;
|
|
||||||
voidpc buf;
|
|
||||||
z_size_t len;
|
|
||||||
{
|
|
||||||
z_size_t put = len;
|
z_size_t put = len;
|
||||||
|
|
||||||
/* if len is zero, avoid unnecessary operations */
|
/* if len is zero, avoid unnecessary operations */
|
||||||
|
|
@ -252,11 +234,7 @@ local z_size_t gz_write(state, buf, len)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzwrite(file, buf, len)
|
int ZEXPORT gzwrite(gzFile file, voidpc buf, unsigned len) {
|
||||||
gzFile file;
|
|
||||||
voidpc buf;
|
|
||||||
unsigned len;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
/* get internal structure */
|
/* get internal structure */
|
||||||
|
|
@ -280,12 +258,8 @@ int ZEXPORT gzwrite(file, buf, len)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
z_size_t ZEXPORT gzfwrite(buf, size, nitems, file)
|
z_size_t ZEXPORT gzfwrite(voidpc buf, z_size_t size, z_size_t nitems,
|
||||||
voidpc buf;
|
gzFile file) {
|
||||||
z_size_t size;
|
|
||||||
z_size_t nitems;
|
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
z_size_t len;
|
z_size_t len;
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
|
|
@ -310,10 +284,7 @@ z_size_t ZEXPORT gzfwrite(buf, size, nitems, file)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzputc(file, c)
|
int ZEXPORT gzputc(gzFile file, int c) {
|
||||||
gzFile file;
|
|
||||||
int c;
|
|
||||||
{
|
|
||||||
unsigned have;
|
unsigned have;
|
||||||
unsigned char buf[1];
|
unsigned char buf[1];
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
@ -358,10 +329,7 @@ int ZEXPORT gzputc(file, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzputs(file, s)
|
int ZEXPORT gzputs(gzFile file, const char *s) {
|
||||||
gzFile file;
|
|
||||||
const char *s;
|
|
||||||
{
|
|
||||||
z_size_t len, put;
|
z_size_t len, put;
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
|
|
@ -388,8 +356,7 @@ int ZEXPORT gzputs(file, s)
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va)
|
int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va) {
|
||||||
{
|
|
||||||
int len;
|
int len;
|
||||||
unsigned left;
|
unsigned left;
|
||||||
char *next;
|
char *next;
|
||||||
|
|
@ -460,8 +427,7 @@ int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va)
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORTVA gzprintf(gzFile file, const char *format, ...)
|
int ZEXPORTVA gzprintf(gzFile file, const char *format, ...) {
|
||||||
{
|
|
||||||
va_list va;
|
va_list va;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|
@ -474,13 +440,10 @@ int ZEXPORTVA gzprintf(gzFile file, const char *format, ...)
|
||||||
#else /* !STDC && !Z_HAVE_STDARG_H */
|
#else /* !STDC && !Z_HAVE_STDARG_H */
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORTVA gzprintf(file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
|
int ZEXPORTVA gzprintf(gzFile file, const char *format, int a1, int a2, int a3,
|
||||||
a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
int a4, int a5, int a6, int a7, int a8, int a9, int a10,
|
||||||
gzFile file;
|
int a11, int a12, int a13, int a14, int a15, int a16,
|
||||||
const char *format;
|
int a17, int a18, int a19, int a20) {
|
||||||
int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
|
|
||||||
a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
|
|
||||||
{
|
|
||||||
unsigned len, left;
|
unsigned len, left;
|
||||||
char *next;
|
char *next;
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
@ -562,10 +525,7 @@ int ZEXPORTVA gzprintf(file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzflush(file, flush)
|
int ZEXPORT gzflush(gzFile file, int flush) {
|
||||||
gzFile file;
|
|
||||||
int flush;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
/* get internal structure */
|
/* get internal structure */
|
||||||
|
|
@ -594,11 +554,7 @@ int ZEXPORT gzflush(file, flush)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzsetparams(file, level, strategy)
|
int ZEXPORT gzsetparams(gzFile file, int level, int strategy) {
|
||||||
gzFile file;
|
|
||||||
int level;
|
|
||||||
int strategy;
|
|
||||||
{
|
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
z_streamp strm;
|
z_streamp strm;
|
||||||
|
|
||||||
|
|
@ -609,7 +565,7 @@ int ZEXPORT gzsetparams(file, level, strategy)
|
||||||
strm = &(state->strm);
|
strm = &(state->strm);
|
||||||
|
|
||||||
/* check that we're writing and that there's no error */
|
/* check that we're writing and that there's no error */
|
||||||
if (state->mode != GZ_WRITE || state->err != Z_OK)
|
if (state->mode != GZ_WRITE || state->err != Z_OK || state->direct)
|
||||||
return Z_STREAM_ERROR;
|
return Z_STREAM_ERROR;
|
||||||
|
|
||||||
/* if no change is requested, then do nothing */
|
/* if no change is requested, then do nothing */
|
||||||
|
|
@ -636,9 +592,7 @@ int ZEXPORT gzsetparams(file, level, strategy)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzclose_w(file)
|
int ZEXPORT gzclose_w(gzFile file) {
|
||||||
gzFile file;
|
|
||||||
{
|
|
||||||
int ret = Z_OK;
|
int ret = Z_OK;
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
|
|
|
||||||
30
thirdparty/zlib/infback.c
vendored
30
thirdparty/zlib/infback.c
vendored
|
|
@ -15,9 +15,6 @@
|
||||||
#include "inflate.h"
|
#include "inflate.h"
|
||||||
#include "inffast.h"
|
#include "inffast.h"
|
||||||
|
|
||||||
/* function prototypes */
|
|
||||||
local void fixedtables OF((struct inflate_state FAR *state));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
strm provides memory allocation functions in zalloc and zfree, or
|
strm provides memory allocation functions in zalloc and zfree, or
|
||||||
Z_NULL to use the library memory allocation functions.
|
Z_NULL to use the library memory allocation functions.
|
||||||
|
|
@ -25,13 +22,9 @@ local void fixedtables OF((struct inflate_state FAR *state));
|
||||||
windowBits is in the range 8..15, and window is a user-supplied
|
windowBits is in the range 8..15, and window is a user-supplied
|
||||||
window and output buffer that is 2**windowBits bytes.
|
window and output buffer that is 2**windowBits bytes.
|
||||||
*/
|
*/
|
||||||
int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size)
|
int ZEXPORT inflateBackInit_(z_streamp strm, int windowBits,
|
||||||
z_streamp strm;
|
unsigned char FAR *window, const char *version,
|
||||||
int windowBits;
|
int stream_size) {
|
||||||
unsigned char FAR *window;
|
|
||||||
const char *version;
|
|
||||||
int stream_size;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
|
if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
|
||||||
|
|
@ -80,9 +73,7 @@ int stream_size;
|
||||||
used for threaded applications, since the rewriting of the tables and virgin
|
used for threaded applications, since the rewriting of the tables and virgin
|
||||||
may not be thread-safe.
|
may not be thread-safe.
|
||||||
*/
|
*/
|
||||||
local void fixedtables(state)
|
local void fixedtables(struct inflate_state FAR *state) {
|
||||||
struct inflate_state FAR *state;
|
|
||||||
{
|
|
||||||
#ifdef BUILDFIXED
|
#ifdef BUILDFIXED
|
||||||
static int virgin = 1;
|
static int virgin = 1;
|
||||||
static code *lenfix, *distfix;
|
static code *lenfix, *distfix;
|
||||||
|
|
@ -248,13 +239,8 @@ struct inflate_state FAR *state;
|
||||||
inflateBack() can also return Z_STREAM_ERROR if the input parameters
|
inflateBack() can also return Z_STREAM_ERROR if the input parameters
|
||||||
are not correct, i.e. strm is Z_NULL or the state was not initialized.
|
are not correct, i.e. strm is Z_NULL or the state was not initialized.
|
||||||
*/
|
*/
|
||||||
int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc)
|
int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc,
|
||||||
z_streamp strm;
|
out_func out, void FAR *out_desc) {
|
||||||
in_func in;
|
|
||||||
void FAR *in_desc;
|
|
||||||
out_func out;
|
|
||||||
void FAR *out_desc;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
z_const unsigned char FAR *next; /* next input */
|
z_const unsigned char FAR *next; /* next input */
|
||||||
unsigned char FAR *put; /* next output */
|
unsigned char FAR *put; /* next output */
|
||||||
|
|
@ -632,9 +618,7 @@ void FAR *out_desc;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateBackEnd(strm)
|
int ZEXPORT inflateBackEnd(z_streamp strm) {
|
||||||
z_streamp strm;
|
|
||||||
{
|
|
||||||
if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
|
if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
|
||||||
return Z_STREAM_ERROR;
|
return Z_STREAM_ERROR;
|
||||||
ZFREE(strm, strm->state);
|
ZFREE(strm, strm->state);
|
||||||
|
|
|
||||||
5
thirdparty/zlib/inffast.c
vendored
5
thirdparty/zlib/inffast.c
vendored
|
|
@ -47,10 +47,7 @@
|
||||||
requires strm->avail_out >= 258 for each loop to avoid checking for
|
requires strm->avail_out >= 258 for each loop to avoid checking for
|
||||||
output space.
|
output space.
|
||||||
*/
|
*/
|
||||||
void ZLIB_INTERNAL inflate_fast(strm, start)
|
void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) {
|
||||||
z_streamp strm;
|
|
||||||
unsigned start; /* inflate()'s starting value for strm->avail_out */
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
z_const unsigned char FAR *in; /* local strm->next_in */
|
z_const unsigned char FAR *in; /* local strm->next_in */
|
||||||
z_const unsigned char FAR *last; /* have enough input while in < last */
|
z_const unsigned char FAR *last; /* have enough input while in < last */
|
||||||
|
|
|
||||||
2
thirdparty/zlib/inffast.h
vendored
2
thirdparty/zlib/inffast.h
vendored
|
|
@ -8,4 +8,4 @@
|
||||||
subject to change. Applications should only use zlib.h.
|
subject to change. Applications should only use zlib.h.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
|
void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start);
|
||||||
|
|
|
||||||
131
thirdparty/zlib/inflate.c
vendored
131
thirdparty/zlib/inflate.c
vendored
|
|
@ -91,20 +91,7 @@
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* function prototypes */
|
local int inflateStateCheck(z_streamp strm) {
|
||||||
local int inflateStateCheck OF((z_streamp strm));
|
|
||||||
local void fixedtables OF((struct inflate_state FAR *state));
|
|
||||||
local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
|
|
||||||
unsigned copy));
|
|
||||||
#ifdef BUILDFIXED
|
|
||||||
void makefixed OF((void));
|
|
||||||
#endif
|
|
||||||
local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf,
|
|
||||||
unsigned len));
|
|
||||||
|
|
||||||
local int inflateStateCheck(strm)
|
|
||||||
z_streamp strm;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
if (strm == Z_NULL ||
|
if (strm == Z_NULL ||
|
||||||
strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
|
strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
|
||||||
|
|
@ -116,9 +103,7 @@ z_streamp strm;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateResetKeep(strm)
|
int ZEXPORT inflateResetKeep(z_streamp strm) {
|
||||||
z_streamp strm;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
||||||
|
|
@ -142,9 +127,7 @@ z_streamp strm;
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateReset(strm)
|
int ZEXPORT inflateReset(z_streamp strm) {
|
||||||
z_streamp strm;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
||||||
|
|
@ -155,10 +138,7 @@ z_streamp strm;
|
||||||
return inflateResetKeep(strm);
|
return inflateResetKeep(strm);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateReset2(strm, windowBits)
|
int ZEXPORT inflateReset2(z_streamp strm, int windowBits) {
|
||||||
z_streamp strm;
|
|
||||||
int windowBits;
|
|
||||||
{
|
|
||||||
int wrap;
|
int wrap;
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
|
|
@ -195,12 +175,8 @@ int windowBits;
|
||||||
return inflateReset(strm);
|
return inflateReset(strm);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
|
int ZEXPORT inflateInit2_(z_streamp strm, int windowBits,
|
||||||
z_streamp strm;
|
const char *version, int stream_size) {
|
||||||
int windowBits;
|
|
||||||
const char *version;
|
|
||||||
int stream_size;
|
|
||||||
{
|
|
||||||
int ret;
|
int ret;
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
|
|
@ -239,22 +215,17 @@ int stream_size;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateInit_(strm, version, stream_size)
|
int ZEXPORT inflateInit_(z_streamp strm, const char *version,
|
||||||
z_streamp strm;
|
int stream_size) {
|
||||||
const char *version;
|
|
||||||
int stream_size;
|
|
||||||
{
|
|
||||||
return inflateInit2_(strm, DEF_WBITS, version, stream_size);
|
return inflateInit2_(strm, DEF_WBITS, version, stream_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflatePrime(strm, bits, value)
|
int ZEXPORT inflatePrime(z_streamp strm, int bits, int value) {
|
||||||
z_streamp strm;
|
|
||||||
int bits;
|
|
||||||
int value;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
||||||
|
if (bits == 0)
|
||||||
|
return Z_OK;
|
||||||
state = (struct inflate_state FAR *)strm->state;
|
state = (struct inflate_state FAR *)strm->state;
|
||||||
if (bits < 0) {
|
if (bits < 0) {
|
||||||
state->hold = 0;
|
state->hold = 0;
|
||||||
|
|
@ -278,9 +249,7 @@ int value;
|
||||||
used for threaded applications, since the rewriting of the tables and virgin
|
used for threaded applications, since the rewriting of the tables and virgin
|
||||||
may not be thread-safe.
|
may not be thread-safe.
|
||||||
*/
|
*/
|
||||||
local void fixedtables(state)
|
local void fixedtables(struct inflate_state FAR *state) {
|
||||||
struct inflate_state FAR *state;
|
|
||||||
{
|
|
||||||
#ifdef BUILDFIXED
|
#ifdef BUILDFIXED
|
||||||
static int virgin = 1;
|
static int virgin = 1;
|
||||||
static code *lenfix, *distfix;
|
static code *lenfix, *distfix;
|
||||||
|
|
@ -342,7 +311,7 @@ struct inflate_state FAR *state;
|
||||||
|
|
||||||
a.out > inffixed.h
|
a.out > inffixed.h
|
||||||
*/
|
*/
|
||||||
void makefixed()
|
void makefixed(void)
|
||||||
{
|
{
|
||||||
unsigned low, size;
|
unsigned low, size;
|
||||||
struct inflate_state state;
|
struct inflate_state state;
|
||||||
|
|
@ -396,11 +365,7 @@ void makefixed()
|
||||||
output will fall in the output data, making match copies simpler and faster.
|
output will fall in the output data, making match copies simpler and faster.
|
||||||
The advantage may be dependent on the size of the processor's data caches.
|
The advantage may be dependent on the size of the processor's data caches.
|
||||||
*/
|
*/
|
||||||
local int updatewindow(strm, end, copy)
|
local int updatewindow(z_streamp strm, const Bytef *end, unsigned copy) {
|
||||||
z_streamp strm;
|
|
||||||
const Bytef *end;
|
|
||||||
unsigned copy;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
unsigned dist;
|
unsigned dist;
|
||||||
|
|
||||||
|
|
@ -622,10 +587,7 @@ unsigned copy;
|
||||||
will return Z_BUF_ERROR if it has not reached the end of the stream.
|
will return Z_BUF_ERROR if it has not reached the end of the stream.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int ZEXPORT inflate(strm, flush)
|
int ZEXPORT inflate(z_streamp strm, int flush) {
|
||||||
z_streamp strm;
|
|
||||||
int flush;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
z_const unsigned char FAR *next; /* next input */
|
z_const unsigned char FAR *next; /* next input */
|
||||||
unsigned char FAR *put; /* next output */
|
unsigned char FAR *put; /* next output */
|
||||||
|
|
@ -1301,9 +1263,7 @@ int flush;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateEnd(strm)
|
int ZEXPORT inflateEnd(z_streamp strm) {
|
||||||
z_streamp strm;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
if (inflateStateCheck(strm))
|
if (inflateStateCheck(strm))
|
||||||
return Z_STREAM_ERROR;
|
return Z_STREAM_ERROR;
|
||||||
|
|
@ -1315,11 +1275,8 @@ z_streamp strm;
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength)
|
int ZEXPORT inflateGetDictionary(z_streamp strm, Bytef *dictionary,
|
||||||
z_streamp strm;
|
uInt *dictLength) {
|
||||||
Bytef *dictionary;
|
|
||||||
uInt *dictLength;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
|
|
@ -1338,11 +1295,8 @@ uInt *dictLength;
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength)
|
int ZEXPORT inflateSetDictionary(z_streamp strm, const Bytef *dictionary,
|
||||||
z_streamp strm;
|
uInt dictLength) {
|
||||||
const Bytef *dictionary;
|
|
||||||
uInt dictLength;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
unsigned long dictid;
|
unsigned long dictid;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
@ -1373,10 +1327,7 @@ uInt dictLength;
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateGetHeader(strm, head)
|
int ZEXPORT inflateGetHeader(z_streamp strm, gz_headerp head) {
|
||||||
z_streamp strm;
|
|
||||||
gz_headerp head;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
|
|
@ -1401,11 +1352,8 @@ gz_headerp head;
|
||||||
called again with more data and the *have state. *have is initialized to
|
called again with more data and the *have state. *have is initialized to
|
||||||
zero for the first call.
|
zero for the first call.
|
||||||
*/
|
*/
|
||||||
local unsigned syncsearch(have, buf, len)
|
local unsigned syncsearch(unsigned FAR *have, const unsigned char FAR *buf,
|
||||||
unsigned FAR *have;
|
unsigned len) {
|
||||||
const unsigned char FAR *buf;
|
|
||||||
unsigned len;
|
|
||||||
{
|
|
||||||
unsigned got;
|
unsigned got;
|
||||||
unsigned next;
|
unsigned next;
|
||||||
|
|
||||||
|
|
@ -1424,9 +1372,7 @@ unsigned len;
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateSync(strm)
|
int ZEXPORT inflateSync(z_streamp strm) {
|
||||||
z_streamp strm;
|
|
||||||
{
|
|
||||||
unsigned len; /* number of bytes to look at or looked at */
|
unsigned len; /* number of bytes to look at or looked at */
|
||||||
int flags; /* temporary to save header status */
|
int flags; /* temporary to save header status */
|
||||||
unsigned long in, out; /* temporary to save total_in and total_out */
|
unsigned long in, out; /* temporary to save total_in and total_out */
|
||||||
|
|
@ -1441,7 +1387,7 @@ z_streamp strm;
|
||||||
/* if first time, start search in bit buffer */
|
/* if first time, start search in bit buffer */
|
||||||
if (state->mode != SYNC) {
|
if (state->mode != SYNC) {
|
||||||
state->mode = SYNC;
|
state->mode = SYNC;
|
||||||
state->hold <<= state->bits & 7;
|
state->hold >>= state->bits & 7;
|
||||||
state->bits -= state->bits & 7;
|
state->bits -= state->bits & 7;
|
||||||
len = 0;
|
len = 0;
|
||||||
while (state->bits >= 8) {
|
while (state->bits >= 8) {
|
||||||
|
|
@ -1482,9 +1428,7 @@ z_streamp strm;
|
||||||
block. When decompressing, PPP checks that at the end of input packet,
|
block. When decompressing, PPP checks that at the end of input packet,
|
||||||
inflate is waiting for these length bytes.
|
inflate is waiting for these length bytes.
|
||||||
*/
|
*/
|
||||||
int ZEXPORT inflateSyncPoint(strm)
|
int ZEXPORT inflateSyncPoint(z_streamp strm) {
|
||||||
z_streamp strm;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
||||||
|
|
@ -1492,10 +1436,7 @@ z_streamp strm;
|
||||||
return state->mode == STORED && state->bits == 0;
|
return state->mode == STORED && state->bits == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateCopy(dest, source)
|
int ZEXPORT inflateCopy(z_streamp dest, z_streamp source) {
|
||||||
z_streamp dest;
|
|
||||||
z_streamp source;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
struct inflate_state FAR *copy;
|
struct inflate_state FAR *copy;
|
||||||
unsigned char FAR *window;
|
unsigned char FAR *window;
|
||||||
|
|
@ -1539,10 +1480,7 @@ z_streamp source;
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateUndermine(strm, subvert)
|
int ZEXPORT inflateUndermine(z_streamp strm, int subvert) {
|
||||||
z_streamp strm;
|
|
||||||
int subvert;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
||||||
|
|
@ -1557,10 +1495,7 @@ int subvert;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateValidate(strm, check)
|
int ZEXPORT inflateValidate(z_streamp strm, int check) {
|
||||||
z_streamp strm;
|
|
||||||
int check;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
||||||
|
|
@ -1572,9 +1507,7 @@ int check;
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
long ZEXPORT inflateMark(strm)
|
long ZEXPORT inflateMark(z_streamp strm) {
|
||||||
z_streamp strm;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
if (inflateStateCheck(strm))
|
if (inflateStateCheck(strm))
|
||||||
|
|
@ -1585,9 +1518,7 @@ z_streamp strm;
|
||||||
(state->mode == MATCH ? state->was - state->length : 0));
|
(state->mode == MATCH ? state->was - state->length : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long ZEXPORT inflateCodesUsed(strm)
|
unsigned long ZEXPORT inflateCodesUsed(z_streamp strm) {
|
||||||
z_streamp strm;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
if (inflateStateCheck(strm)) return (unsigned long)-1;
|
if (inflateStateCheck(strm)) return (unsigned long)-1;
|
||||||
state = (struct inflate_state FAR *)strm->state;
|
state = (struct inflate_state FAR *)strm->state;
|
||||||
|
|
|
||||||
17
thirdparty/zlib/inftrees.c
vendored
17
thirdparty/zlib/inftrees.c
vendored
|
|
@ -1,5 +1,5 @@
|
||||||
/* inftrees.c -- generate Huffman trees for efficient decoding
|
/* inftrees.c -- generate Huffman trees for efficient decoding
|
||||||
* Copyright (C) 1995-2022 Mark Adler
|
* Copyright (C) 1995-2024 Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
#define MAXBITS 15
|
#define MAXBITS 15
|
||||||
|
|
||||||
const char inflate_copyright[] =
|
const char inflate_copyright[] =
|
||||||
" inflate 1.2.13 Copyright 1995-2022 Mark Adler ";
|
" inflate 1.3.1 Copyright 1995-2024 Mark Adler ";
|
||||||
/*
|
/*
|
||||||
If you use the zlib library in a product, an acknowledgment is welcome
|
If you use the zlib library in a product, an acknowledgment is welcome
|
||||||
in the documentation of your product. If for some reason you cannot
|
in the documentation of your product. If for some reason you cannot
|
||||||
|
|
@ -29,14 +29,9 @@ const char inflate_copyright[] =
|
||||||
table index bits. It will differ if the request is greater than the
|
table index bits. It will differ if the request is greater than the
|
||||||
longest code or if it is less than the shortest code.
|
longest code or if it is less than the shortest code.
|
||||||
*/
|
*/
|
||||||
int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work)
|
int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens,
|
||||||
codetype type;
|
unsigned codes, code FAR * FAR *table,
|
||||||
unsigned short FAR *lens;
|
unsigned FAR *bits, unsigned short FAR *work) {
|
||||||
unsigned codes;
|
|
||||||
code FAR * FAR *table;
|
|
||||||
unsigned FAR *bits;
|
|
||||||
unsigned short FAR *work;
|
|
||||||
{
|
|
||||||
unsigned len; /* a code's length in bits */
|
unsigned len; /* a code's length in bits */
|
||||||
unsigned sym; /* index of code symbols */
|
unsigned sym; /* index of code symbols */
|
||||||
unsigned min, max; /* minimum and maximum code lengths */
|
unsigned min, max; /* minimum and maximum code lengths */
|
||||||
|
|
@ -62,7 +57,7 @@ unsigned short FAR *work;
|
||||||
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
|
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
|
||||||
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
|
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
|
||||||
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
|
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
|
||||||
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 194, 65};
|
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 203, 77};
|
||||||
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
|
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
|
||||||
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
|
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,
|
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
|
||||||
|
|
|
||||||
10
thirdparty/zlib/inftrees.h
vendored
10
thirdparty/zlib/inftrees.h
vendored
|
|
@ -41,8 +41,8 @@ typedef struct {
|
||||||
examples/enough.c found in the zlib distribution. The arguments to that
|
examples/enough.c found in the zlib distribution. The arguments to that
|
||||||
program are the number of symbols, the initial root table size, and the
|
program are the number of symbols, the initial root table size, and the
|
||||||
maximum bit length of a code. "enough 286 9 15" for literal/length codes
|
maximum bit length of a code. "enough 286 9 15" for literal/length codes
|
||||||
returns returns 852, and "enough 30 6 15" for distance codes returns 592.
|
returns 852, and "enough 30 6 15" for distance codes returns 592. The
|
||||||
The initial root table size (9 or 6) is found in the fifth argument of the
|
initial root table size (9 or 6) is found in the fifth argument of the
|
||||||
inflate_table() calls in inflate.c and infback.c. If the root table size is
|
inflate_table() calls in inflate.c and infback.c. If the root table size is
|
||||||
changed, then these maximum sizes would be need to be recalculated and
|
changed, then these maximum sizes would be need to be recalculated and
|
||||||
updated. */
|
updated. */
|
||||||
|
|
@ -57,6 +57,6 @@ typedef enum {
|
||||||
DISTS
|
DISTS
|
||||||
} codetype;
|
} codetype;
|
||||||
|
|
||||||
int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
|
int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens,
|
||||||
unsigned codes, code FAR * FAR *table,
|
unsigned codes, code FAR * FAR *table,
|
||||||
unsigned FAR *bits, unsigned short FAR *work));
|
unsigned FAR *bits, unsigned short FAR *work);
|
||||||
|
|
|
||||||
542
thirdparty/zlib/trees.c
vendored
542
thirdparty/zlib/trees.c
vendored
|
|
@ -1,5 +1,5 @@
|
||||||
/* trees.c -- output deflated data using Huffman coding
|
/* trees.c -- output deflated data using Huffman coding
|
||||||
* Copyright (C) 1995-2021 Jean-loup Gailly
|
* Copyright (C) 1995-2024 Jean-loup Gailly
|
||||||
* detect_data_type() function provided freely by Cosmin Truta, 2006
|
* detect_data_type() function provided freely by Cosmin Truta, 2006
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
@ -122,39 +122,116 @@ struct static_tree_desc_s {
|
||||||
int max_length; /* max bit length for the codes */
|
int max_length; /* max bit length for the codes */
|
||||||
};
|
};
|
||||||
|
|
||||||
local const static_tree_desc static_l_desc =
|
#ifdef NO_INIT_GLOBAL_POINTERS
|
||||||
|
# define TCONST
|
||||||
|
#else
|
||||||
|
# define TCONST const
|
||||||
|
#endif
|
||||||
|
|
||||||
|
local TCONST static_tree_desc static_l_desc =
|
||||||
{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS};
|
{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS};
|
||||||
|
|
||||||
local const static_tree_desc static_d_desc =
|
local TCONST static_tree_desc static_d_desc =
|
||||||
{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS};
|
{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS};
|
||||||
|
|
||||||
local const static_tree_desc static_bl_desc =
|
local TCONST static_tree_desc static_bl_desc =
|
||||||
{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS};
|
{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS};
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Local (static) routines in this file.
|
* Output a short LSB first on the stream.
|
||||||
|
* IN assertion: there is enough room in pendingBuf.
|
||||||
*/
|
*/
|
||||||
|
#define put_short(s, w) { \
|
||||||
|
put_byte(s, (uch)((w) & 0xff)); \
|
||||||
|
put_byte(s, (uch)((ush)(w) >> 8)); \
|
||||||
|
}
|
||||||
|
|
||||||
local void tr_static_init OF((void));
|
/* ===========================================================================
|
||||||
local void init_block OF((deflate_state *s));
|
* Reverse the first len bits of a code, using straightforward code (a faster
|
||||||
local void pqdownheap OF((deflate_state *s, ct_data *tree, int k));
|
* method would use a table)
|
||||||
local void gen_bitlen OF((deflate_state *s, tree_desc *desc));
|
* IN assertion: 1 <= len <= 15
|
||||||
local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count));
|
*/
|
||||||
local void build_tree OF((deflate_state *s, tree_desc *desc));
|
local unsigned bi_reverse(unsigned code, int len) {
|
||||||
local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code));
|
register unsigned res = 0;
|
||||||
local void send_tree OF((deflate_state *s, ct_data *tree, int max_code));
|
do {
|
||||||
local int build_bl_tree OF((deflate_state *s));
|
res |= code & 1;
|
||||||
local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
|
code >>= 1, res <<= 1;
|
||||||
int blcodes));
|
} while (--len > 0);
|
||||||
local void compress_block OF((deflate_state *s, const ct_data *ltree,
|
return res >> 1;
|
||||||
const ct_data *dtree));
|
}
|
||||||
local int detect_data_type OF((deflate_state *s));
|
|
||||||
local unsigned bi_reverse OF((unsigned code, int len));
|
/* ===========================================================================
|
||||||
local void bi_windup OF((deflate_state *s));
|
* Flush the bit buffer, keeping at most 7 bits in it.
|
||||||
local void bi_flush OF((deflate_state *s));
|
*/
|
||||||
|
local void bi_flush(deflate_state *s) {
|
||||||
|
if (s->bi_valid == 16) {
|
||||||
|
put_short(s, s->bi_buf);
|
||||||
|
s->bi_buf = 0;
|
||||||
|
s->bi_valid = 0;
|
||||||
|
} else if (s->bi_valid >= 8) {
|
||||||
|
put_byte(s, (Byte)s->bi_buf);
|
||||||
|
s->bi_buf >>= 8;
|
||||||
|
s->bi_valid -= 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===========================================================================
|
||||||
|
* Flush the bit buffer and align the output on a byte boundary
|
||||||
|
*/
|
||||||
|
local void bi_windup(deflate_state *s) {
|
||||||
|
if (s->bi_valid > 8) {
|
||||||
|
put_short(s, s->bi_buf);
|
||||||
|
} else if (s->bi_valid > 0) {
|
||||||
|
put_byte(s, (Byte)s->bi_buf);
|
||||||
|
}
|
||||||
|
s->bi_buf = 0;
|
||||||
|
s->bi_valid = 0;
|
||||||
|
#ifdef ZLIB_DEBUG
|
||||||
|
s->bits_sent = (s->bits_sent + 7) & ~7;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===========================================================================
|
||||||
|
* Generate the codes for a given tree and bit counts (which need not be
|
||||||
|
* optimal).
|
||||||
|
* IN assertion: the array bl_count contains the bit length statistics for
|
||||||
|
* the given tree and the field len is set for all tree elements.
|
||||||
|
* OUT assertion: the field code is set for all tree elements of non
|
||||||
|
* zero code length.
|
||||||
|
*/
|
||||||
|
local void gen_codes(ct_data *tree, int max_code, ushf *bl_count) {
|
||||||
|
ush next_code[MAX_BITS+1]; /* next code value for each bit length */
|
||||||
|
unsigned code = 0; /* running code value */
|
||||||
|
int bits; /* bit index */
|
||||||
|
int n; /* code index */
|
||||||
|
|
||||||
|
/* The distribution counts are first used to generate the code values
|
||||||
|
* without bit reversal.
|
||||||
|
*/
|
||||||
|
for (bits = 1; bits <= MAX_BITS; bits++) {
|
||||||
|
code = (code + bl_count[bits - 1]) << 1;
|
||||||
|
next_code[bits] = (ush)code;
|
||||||
|
}
|
||||||
|
/* Check that the bit counts in bl_count are consistent. The last code
|
||||||
|
* must be all ones.
|
||||||
|
*/
|
||||||
|
Assert (code + bl_count[MAX_BITS] - 1 == (1 << MAX_BITS) - 1,
|
||||||
|
"inconsistent bit counts");
|
||||||
|
Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
|
||||||
|
|
||||||
|
for (n = 0; n <= max_code; n++) {
|
||||||
|
int len = tree[n].Len;
|
||||||
|
if (len == 0) continue;
|
||||||
|
/* Now reverse the bits */
|
||||||
|
tree[n].Code = (ush)bi_reverse(next_code[len]++, len);
|
||||||
|
|
||||||
|
Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
|
||||||
|
n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len] - 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef GEN_TREES_H
|
#ifdef GEN_TREES_H
|
||||||
local void gen_trees_header OF((void));
|
local void gen_trees_header(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ZLIB_DEBUG
|
#ifndef ZLIB_DEBUG
|
||||||
|
|
@ -167,27 +244,12 @@ local void gen_trees_header OF((void));
|
||||||
send_bits(s, tree[c].Code, tree[c].Len); }
|
send_bits(s, tree[c].Code, tree[c].Len); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ===========================================================================
|
|
||||||
* Output a short LSB first on the stream.
|
|
||||||
* IN assertion: there is enough room in pendingBuf.
|
|
||||||
*/
|
|
||||||
#define put_short(s, w) { \
|
|
||||||
put_byte(s, (uch)((w) & 0xff)); \
|
|
||||||
put_byte(s, (uch)((ush)(w) >> 8)); \
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Send a value on a given number of bits.
|
* Send a value on a given number of bits.
|
||||||
* IN assertion: length <= 16 and value fits in length bits.
|
* IN assertion: length <= 16 and value fits in length bits.
|
||||||
*/
|
*/
|
||||||
#ifdef ZLIB_DEBUG
|
#ifdef ZLIB_DEBUG
|
||||||
local void send_bits OF((deflate_state *s, int value, int length));
|
local void send_bits(deflate_state *s, int value, int length) {
|
||||||
|
|
||||||
local void send_bits(s, value, length)
|
|
||||||
deflate_state *s;
|
|
||||||
int value; /* value to send */
|
|
||||||
int length; /* number of bits */
|
|
||||||
{
|
|
||||||
Tracevv((stderr," l %2d v %4x ", length, value));
|
Tracevv((stderr," l %2d v %4x ", length, value));
|
||||||
Assert(length > 0 && length <= 15, "invalid length");
|
Assert(length > 0 && length <= 15, "invalid length");
|
||||||
s->bits_sent += (ulg)length;
|
s->bits_sent += (ulg)length;
|
||||||
|
|
@ -229,8 +291,7 @@ local void send_bits(s, value, length)
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Initialize the various 'constant' tables.
|
* Initialize the various 'constant' tables.
|
||||||
*/
|
*/
|
||||||
local void tr_static_init()
|
local void tr_static_init(void) {
|
||||||
{
|
|
||||||
#if defined(GEN_TREES_H) || !defined(STDC)
|
#if defined(GEN_TREES_H) || !defined(STDC)
|
||||||
static int static_init_done = 0;
|
static int static_init_done = 0;
|
||||||
int n; /* iterates over tree elements */
|
int n; /* iterates over tree elements */
|
||||||
|
|
@ -323,8 +384,7 @@ local void tr_static_init()
|
||||||
((i) == (last)? "\n};\n\n" : \
|
((i) == (last)? "\n};\n\n" : \
|
||||||
((i) % (width) == (width) - 1 ? ",\n" : ", "))
|
((i) % (width) == (width) - 1 ? ",\n" : ", "))
|
||||||
|
|
||||||
void gen_trees_header()
|
void gen_trees_header(void) {
|
||||||
{
|
|
||||||
FILE *header = fopen("trees.h", "w");
|
FILE *header = fopen("trees.h", "w");
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -373,12 +433,26 @@ void gen_trees_header()
|
||||||
}
|
}
|
||||||
#endif /* GEN_TREES_H */
|
#endif /* GEN_TREES_H */
|
||||||
|
|
||||||
|
/* ===========================================================================
|
||||||
|
* Initialize a new block.
|
||||||
|
*/
|
||||||
|
local void init_block(deflate_state *s) {
|
||||||
|
int n; /* iterates over tree elements */
|
||||||
|
|
||||||
|
/* Initialize the trees. */
|
||||||
|
for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0;
|
||||||
|
for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0;
|
||||||
|
for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
|
||||||
|
|
||||||
|
s->dyn_ltree[END_BLOCK].Freq = 1;
|
||||||
|
s->opt_len = s->static_len = 0L;
|
||||||
|
s->sym_next = s->matches = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Initialize the tree data structures for a new zlib stream.
|
* Initialize the tree data structures for a new zlib stream.
|
||||||
*/
|
*/
|
||||||
void ZLIB_INTERNAL _tr_init(s)
|
void ZLIB_INTERNAL _tr_init(deflate_state *s) {
|
||||||
deflate_state *s;
|
|
||||||
{
|
|
||||||
tr_static_init();
|
tr_static_init();
|
||||||
|
|
||||||
s->l_desc.dyn_tree = s->dyn_ltree;
|
s->l_desc.dyn_tree = s->dyn_ltree;
|
||||||
|
|
@ -401,24 +475,6 @@ void ZLIB_INTERNAL _tr_init(s)
|
||||||
init_block(s);
|
init_block(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===========================================================================
|
|
||||||
* Initialize a new block.
|
|
||||||
*/
|
|
||||||
local void init_block(s)
|
|
||||||
deflate_state *s;
|
|
||||||
{
|
|
||||||
int n; /* iterates over tree elements */
|
|
||||||
|
|
||||||
/* Initialize the trees. */
|
|
||||||
for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0;
|
|
||||||
for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0;
|
|
||||||
for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
|
|
||||||
|
|
||||||
s->dyn_ltree[END_BLOCK].Freq = 1;
|
|
||||||
s->opt_len = s->static_len = 0L;
|
|
||||||
s->sym_next = s->matches = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SMALLEST 1
|
#define SMALLEST 1
|
||||||
/* Index within the heap array of least frequent node in the Huffman tree */
|
/* Index within the heap array of least frequent node in the Huffman tree */
|
||||||
|
|
||||||
|
|
@ -448,11 +504,7 @@ local void init_block(s)
|
||||||
* when the heap property is re-established (each father smaller than its
|
* when the heap property is re-established (each father smaller than its
|
||||||
* two sons).
|
* two sons).
|
||||||
*/
|
*/
|
||||||
local void pqdownheap(s, tree, k)
|
local void pqdownheap(deflate_state *s, ct_data *tree, int k) {
|
||||||
deflate_state *s;
|
|
||||||
ct_data *tree; /* the tree to restore */
|
|
||||||
int k; /* node to move down */
|
|
||||||
{
|
|
||||||
int v = s->heap[k];
|
int v = s->heap[k];
|
||||||
int j = k << 1; /* left son of k */
|
int j = k << 1; /* left son of k */
|
||||||
while (j <= s->heap_len) {
|
while (j <= s->heap_len) {
|
||||||
|
|
@ -483,10 +535,7 @@ local void pqdownheap(s, tree, k)
|
||||||
* The length opt_len is updated; static_len is also updated if stree is
|
* The length opt_len is updated; static_len is also updated if stree is
|
||||||
* not null.
|
* not null.
|
||||||
*/
|
*/
|
||||||
local void gen_bitlen(s, desc)
|
local void gen_bitlen(deflate_state *s, tree_desc *desc) {
|
||||||
deflate_state *s;
|
|
||||||
tree_desc *desc; /* the tree descriptor */
|
|
||||||
{
|
|
||||||
ct_data *tree = desc->dyn_tree;
|
ct_data *tree = desc->dyn_tree;
|
||||||
int max_code = desc->max_code;
|
int max_code = desc->max_code;
|
||||||
const ct_data *stree = desc->stat_desc->static_tree;
|
const ct_data *stree = desc->stat_desc->static_tree;
|
||||||
|
|
@ -561,48 +610,9 @@ local void gen_bitlen(s, desc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===========================================================================
|
#ifdef DUMP_BL_TREE
|
||||||
* Generate the codes for a given tree and bit counts (which need not be
|
# include <stdio.h>
|
||||||
* optimal).
|
#endif
|
||||||
* IN assertion: the array bl_count contains the bit length statistics for
|
|
||||||
* the given tree and the field len is set for all tree elements.
|
|
||||||
* OUT assertion: the field code is set for all tree elements of non
|
|
||||||
* zero code length.
|
|
||||||
*/
|
|
||||||
local void gen_codes(tree, max_code, bl_count)
|
|
||||||
ct_data *tree; /* the tree to decorate */
|
|
||||||
int max_code; /* largest code with non zero frequency */
|
|
||||||
ushf *bl_count; /* number of codes at each bit length */
|
|
||||||
{
|
|
||||||
ush next_code[MAX_BITS+1]; /* next code value for each bit length */
|
|
||||||
unsigned code = 0; /* running code value */
|
|
||||||
int bits; /* bit index */
|
|
||||||
int n; /* code index */
|
|
||||||
|
|
||||||
/* The distribution counts are first used to generate the code values
|
|
||||||
* without bit reversal.
|
|
||||||
*/
|
|
||||||
for (bits = 1; bits <= MAX_BITS; bits++) {
|
|
||||||
code = (code + bl_count[bits - 1]) << 1;
|
|
||||||
next_code[bits] = (ush)code;
|
|
||||||
}
|
|
||||||
/* Check that the bit counts in bl_count are consistent. The last code
|
|
||||||
* must be all ones.
|
|
||||||
*/
|
|
||||||
Assert (code + bl_count[MAX_BITS] - 1 == (1 << MAX_BITS) - 1,
|
|
||||||
"inconsistent bit counts");
|
|
||||||
Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
|
|
||||||
|
|
||||||
for (n = 0; n <= max_code; n++) {
|
|
||||||
int len = tree[n].Len;
|
|
||||||
if (len == 0) continue;
|
|
||||||
/* Now reverse the bits */
|
|
||||||
tree[n].Code = (ush)bi_reverse(next_code[len]++, len);
|
|
||||||
|
|
||||||
Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
|
|
||||||
n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len] - 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Construct one Huffman tree and assigns the code bit strings and lengths.
|
* Construct one Huffman tree and assigns the code bit strings and lengths.
|
||||||
|
|
@ -612,10 +622,7 @@ local void gen_codes(tree, max_code, bl_count)
|
||||||
* and corresponding code. The length opt_len is updated; static_len is
|
* and corresponding code. The length opt_len is updated; static_len is
|
||||||
* also updated if stree is not null. The field max_code is set.
|
* also updated if stree is not null. The field max_code is set.
|
||||||
*/
|
*/
|
||||||
local void build_tree(s, desc)
|
local void build_tree(deflate_state *s, tree_desc *desc) {
|
||||||
deflate_state *s;
|
|
||||||
tree_desc *desc; /* the tree descriptor */
|
|
||||||
{
|
|
||||||
ct_data *tree = desc->dyn_tree;
|
ct_data *tree = desc->dyn_tree;
|
||||||
const ct_data *stree = desc->stat_desc->static_tree;
|
const ct_data *stree = desc->stat_desc->static_tree;
|
||||||
int elems = desc->stat_desc->elems;
|
int elems = desc->stat_desc->elems;
|
||||||
|
|
@ -700,11 +707,7 @@ local void build_tree(s, desc)
|
||||||
* Scan a literal or distance tree to determine the frequencies of the codes
|
* Scan a literal or distance tree to determine the frequencies of the codes
|
||||||
* in the bit length tree.
|
* in the bit length tree.
|
||||||
*/
|
*/
|
||||||
local void scan_tree(s, tree, max_code)
|
local void scan_tree(deflate_state *s, ct_data *tree, int max_code) {
|
||||||
deflate_state *s;
|
|
||||||
ct_data *tree; /* the tree to be scanned */
|
|
||||||
int max_code; /* and its largest code of non zero frequency */
|
|
||||||
{
|
|
||||||
int n; /* iterates over all tree elements */
|
int n; /* iterates over all tree elements */
|
||||||
int prevlen = -1; /* last emitted length */
|
int prevlen = -1; /* last emitted length */
|
||||||
int curlen; /* length of current code */
|
int curlen; /* length of current code */
|
||||||
|
|
@ -745,11 +748,7 @@ local void scan_tree(s, tree, max_code)
|
||||||
* Send a literal or distance tree in compressed form, using the codes in
|
* Send a literal or distance tree in compressed form, using the codes in
|
||||||
* bl_tree.
|
* bl_tree.
|
||||||
*/
|
*/
|
||||||
local void send_tree(s, tree, max_code)
|
local void send_tree(deflate_state *s, ct_data *tree, int max_code) {
|
||||||
deflate_state *s;
|
|
||||||
ct_data *tree; /* the tree to be scanned */
|
|
||||||
int max_code; /* and its largest code of non zero frequency */
|
|
||||||
{
|
|
||||||
int n; /* iterates over all tree elements */
|
int n; /* iterates over all tree elements */
|
||||||
int prevlen = -1; /* last emitted length */
|
int prevlen = -1; /* last emitted length */
|
||||||
int curlen; /* length of current code */
|
int curlen; /* length of current code */
|
||||||
|
|
@ -796,9 +795,7 @@ local void send_tree(s, tree, max_code)
|
||||||
* Construct the Huffman tree for the bit lengths and return the index in
|
* Construct the Huffman tree for the bit lengths and return the index in
|
||||||
* bl_order of the last bit length code to send.
|
* bl_order of the last bit length code to send.
|
||||||
*/
|
*/
|
||||||
local int build_bl_tree(s)
|
local int build_bl_tree(deflate_state *s) {
|
||||||
deflate_state *s;
|
|
||||||
{
|
|
||||||
int max_blindex; /* index of last bit length code of non zero freq */
|
int max_blindex; /* index of last bit length code of non zero freq */
|
||||||
|
|
||||||
/* Determine the bit length frequencies for literal and distance trees */
|
/* Determine the bit length frequencies for literal and distance trees */
|
||||||
|
|
@ -831,10 +828,8 @@ local int build_bl_tree(s)
|
||||||
* lengths of the bit length codes, the literal tree and the distance tree.
|
* lengths of the bit length codes, the literal tree and the distance tree.
|
||||||
* IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
|
* IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
|
||||||
*/
|
*/
|
||||||
local void send_all_trees(s, lcodes, dcodes, blcodes)
|
local void send_all_trees(deflate_state *s, int lcodes, int dcodes,
|
||||||
deflate_state *s;
|
int blcodes) {
|
||||||
int lcodes, dcodes, blcodes; /* number of codes for each tree */
|
|
||||||
{
|
|
||||||
int rank; /* index in bl_order */
|
int rank; /* index in bl_order */
|
||||||
|
|
||||||
Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
|
Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
|
||||||
|
|
@ -860,12 +855,8 @@ local void send_all_trees(s, lcodes, dcodes, blcodes)
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Send a stored block
|
* Send a stored block
|
||||||
*/
|
*/
|
||||||
void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
|
void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, charf *buf,
|
||||||
deflate_state *s;
|
ulg stored_len, int last) {
|
||||||
charf *buf; /* input block */
|
|
||||||
ulg stored_len; /* length of input block */
|
|
||||||
int last; /* one if this is the last block for a file */
|
|
||||||
{
|
|
||||||
send_bits(s, (STORED_BLOCK<<1) + last, 3); /* send block type */
|
send_bits(s, (STORED_BLOCK<<1) + last, 3); /* send block type */
|
||||||
bi_windup(s); /* align on byte boundary */
|
bi_windup(s); /* align on byte boundary */
|
||||||
put_short(s, (ush)stored_len);
|
put_short(s, (ush)stored_len);
|
||||||
|
|
@ -884,9 +875,7 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Flush the bits in the bit buffer to pending output (leaves at most 7 bits)
|
* Flush the bits in the bit buffer to pending output (leaves at most 7 bits)
|
||||||
*/
|
*/
|
||||||
void ZLIB_INTERNAL _tr_flush_bits(s)
|
void ZLIB_INTERNAL _tr_flush_bits(deflate_state *s) {
|
||||||
deflate_state *s;
|
|
||||||
{
|
|
||||||
bi_flush(s);
|
bi_flush(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -894,9 +883,7 @@ void ZLIB_INTERNAL _tr_flush_bits(s)
|
||||||
* Send one empty static block to give enough lookahead for inflate.
|
* Send one empty static block to give enough lookahead for inflate.
|
||||||
* This takes 10 bits, of which 7 may remain in the bit buffer.
|
* This takes 10 bits, of which 7 may remain in the bit buffer.
|
||||||
*/
|
*/
|
||||||
void ZLIB_INTERNAL _tr_align(s)
|
void ZLIB_INTERNAL _tr_align(deflate_state *s) {
|
||||||
deflate_state *s;
|
|
||||||
{
|
|
||||||
send_bits(s, STATIC_TREES<<1, 3);
|
send_bits(s, STATIC_TREES<<1, 3);
|
||||||
send_code(s, END_BLOCK, static_ltree);
|
send_code(s, END_BLOCK, static_ltree);
|
||||||
#ifdef ZLIB_DEBUG
|
#ifdef ZLIB_DEBUG
|
||||||
|
|
@ -905,16 +892,108 @@ void ZLIB_INTERNAL _tr_align(s)
|
||||||
bi_flush(s);
|
bi_flush(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ===========================================================================
|
||||||
|
* Send the block data compressed using the given Huffman trees
|
||||||
|
*/
|
||||||
|
local void compress_block(deflate_state *s, const ct_data *ltree,
|
||||||
|
const ct_data *dtree) {
|
||||||
|
unsigned dist; /* distance of matched string */
|
||||||
|
int lc; /* match length or unmatched char (if dist == 0) */
|
||||||
|
unsigned sx = 0; /* running index in symbol buffers */
|
||||||
|
unsigned code; /* the code to send */
|
||||||
|
int extra; /* number of extra bits to send */
|
||||||
|
|
||||||
|
if (s->sym_next != 0) do {
|
||||||
|
#ifdef LIT_MEM
|
||||||
|
dist = s->d_buf[sx];
|
||||||
|
lc = s->l_buf[sx++];
|
||||||
|
#else
|
||||||
|
dist = s->sym_buf[sx++] & 0xff;
|
||||||
|
dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8;
|
||||||
|
lc = s->sym_buf[sx++];
|
||||||
|
#endif
|
||||||
|
if (dist == 0) {
|
||||||
|
send_code(s, lc, ltree); /* send a literal byte */
|
||||||
|
Tracecv(isgraph(lc), (stderr," '%c' ", lc));
|
||||||
|
} else {
|
||||||
|
/* Here, lc is the match length - MIN_MATCH */
|
||||||
|
code = _length_code[lc];
|
||||||
|
send_code(s, code + LITERALS + 1, ltree); /* send length code */
|
||||||
|
extra = extra_lbits[code];
|
||||||
|
if (extra != 0) {
|
||||||
|
lc -= base_length[code];
|
||||||
|
send_bits(s, lc, extra); /* send the extra length bits */
|
||||||
|
}
|
||||||
|
dist--; /* dist is now the match distance - 1 */
|
||||||
|
code = d_code(dist);
|
||||||
|
Assert (code < D_CODES, "bad d_code");
|
||||||
|
|
||||||
|
send_code(s, code, dtree); /* send the distance code */
|
||||||
|
extra = extra_dbits[code];
|
||||||
|
if (extra != 0) {
|
||||||
|
dist -= (unsigned)base_dist[code];
|
||||||
|
send_bits(s, dist, extra); /* send the extra distance bits */
|
||||||
|
}
|
||||||
|
} /* literal or match pair ? */
|
||||||
|
|
||||||
|
/* Check for no overlay of pending_buf on needed symbols */
|
||||||
|
#ifdef LIT_MEM
|
||||||
|
Assert(s->pending < 2 * (s->lit_bufsize + sx), "pendingBuf overflow");
|
||||||
|
#else
|
||||||
|
Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} while (sx < s->sym_next);
|
||||||
|
|
||||||
|
send_code(s, END_BLOCK, ltree);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===========================================================================
|
||||||
|
* Check if the data type is TEXT or BINARY, using the following algorithm:
|
||||||
|
* - TEXT if the two conditions below are satisfied:
|
||||||
|
* a) There are no non-portable control characters belonging to the
|
||||||
|
* "block list" (0..6, 14..25, 28..31).
|
||||||
|
* b) There is at least one printable character belonging to the
|
||||||
|
* "allow list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).
|
||||||
|
* - BINARY otherwise.
|
||||||
|
* - The following partially-portable control characters form a
|
||||||
|
* "gray list" that is ignored in this detection algorithm:
|
||||||
|
* (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).
|
||||||
|
* IN assertion: the fields Freq of dyn_ltree are set.
|
||||||
|
*/
|
||||||
|
local int detect_data_type(deflate_state *s) {
|
||||||
|
/* block_mask is the bit mask of block-listed bytes
|
||||||
|
* set bits 0..6, 14..25, and 28..31
|
||||||
|
* 0xf3ffc07f = binary 11110011111111111100000001111111
|
||||||
|
*/
|
||||||
|
unsigned long block_mask = 0xf3ffc07fUL;
|
||||||
|
int n;
|
||||||
|
|
||||||
|
/* Check for non-textual ("block-listed") bytes. */
|
||||||
|
for (n = 0; n <= 31; n++, block_mask >>= 1)
|
||||||
|
if ((block_mask & 1) && (s->dyn_ltree[n].Freq != 0))
|
||||||
|
return Z_BINARY;
|
||||||
|
|
||||||
|
/* Check for textual ("allow-listed") bytes. */
|
||||||
|
if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0
|
||||||
|
|| s->dyn_ltree[13].Freq != 0)
|
||||||
|
return Z_TEXT;
|
||||||
|
for (n = 32; n < LITERALS; n++)
|
||||||
|
if (s->dyn_ltree[n].Freq != 0)
|
||||||
|
return Z_TEXT;
|
||||||
|
|
||||||
|
/* There are no "block-listed" or "allow-listed" bytes:
|
||||||
|
* this stream either is empty or has tolerated ("gray-listed") bytes only.
|
||||||
|
*/
|
||||||
|
return Z_BINARY;
|
||||||
|
}
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Determine the best encoding for the current block: dynamic trees, static
|
* Determine the best encoding for the current block: dynamic trees, static
|
||||||
* trees or store, and write out the encoded block.
|
* trees or store, and write out the encoded block.
|
||||||
*/
|
*/
|
||||||
void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
|
void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf,
|
||||||
deflate_state *s;
|
ulg stored_len, int last) {
|
||||||
charf *buf; /* input block, or NULL if too old */
|
|
||||||
ulg stored_len; /* length of input block */
|
|
||||||
int last; /* one if this is the last block for a file */
|
|
||||||
{
|
|
||||||
ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
|
ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
|
||||||
int max_blindex = 0; /* index of last bit length code of non zero freq */
|
int max_blindex = 0; /* index of last bit length code of non zero freq */
|
||||||
|
|
||||||
|
|
@ -1011,14 +1090,15 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
|
||||||
* Save the match info and tally the frequency counts. Return true if
|
* Save the match info and tally the frequency counts. Return true if
|
||||||
* the current block must be flushed.
|
* the current block must be flushed.
|
||||||
*/
|
*/
|
||||||
int ZLIB_INTERNAL _tr_tally(s, dist, lc)
|
int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc) {
|
||||||
deflate_state *s;
|
#ifdef LIT_MEM
|
||||||
unsigned dist; /* distance of matched string */
|
s->d_buf[s->sym_next] = (ush)dist;
|
||||||
unsigned lc; /* match length - MIN_MATCH or unmatched char (dist==0) */
|
s->l_buf[s->sym_next++] = (uch)lc;
|
||||||
{
|
#else
|
||||||
s->sym_buf[s->sym_next++] = (uch)dist;
|
s->sym_buf[s->sym_next++] = (uch)dist;
|
||||||
s->sym_buf[s->sym_next++] = (uch)(dist >> 8);
|
s->sym_buf[s->sym_next++] = (uch)(dist >> 8);
|
||||||
s->sym_buf[s->sym_next++] = (uch)lc;
|
s->sym_buf[s->sym_next++] = (uch)lc;
|
||||||
|
#endif
|
||||||
if (dist == 0) {
|
if (dist == 0) {
|
||||||
/* lc is the unmatched char */
|
/* lc is the unmatched char */
|
||||||
s->dyn_ltree[lc].Freq++;
|
s->dyn_ltree[lc].Freq++;
|
||||||
|
|
@ -1035,147 +1115,3 @@ int ZLIB_INTERNAL _tr_tally(s, dist, lc)
|
||||||
}
|
}
|
||||||
return (s->sym_next == s->sym_end);
|
return (s->sym_next == s->sym_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===========================================================================
|
|
||||||
* Send the block data compressed using the given Huffman trees
|
|
||||||
*/
|
|
||||||
local void compress_block(s, ltree, dtree)
|
|
||||||
deflate_state *s;
|
|
||||||
const ct_data *ltree; /* literal tree */
|
|
||||||
const ct_data *dtree; /* distance tree */
|
|
||||||
{
|
|
||||||
unsigned dist; /* distance of matched string */
|
|
||||||
int lc; /* match length or unmatched char (if dist == 0) */
|
|
||||||
unsigned sx = 0; /* running index in sym_buf */
|
|
||||||
unsigned code; /* the code to send */
|
|
||||||
int extra; /* number of extra bits to send */
|
|
||||||
|
|
||||||
if (s->sym_next != 0) do {
|
|
||||||
dist = s->sym_buf[sx++] & 0xff;
|
|
||||||
dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8;
|
|
||||||
lc = s->sym_buf[sx++];
|
|
||||||
if (dist == 0) {
|
|
||||||
send_code(s, lc, ltree); /* send a literal byte */
|
|
||||||
Tracecv(isgraph(lc), (stderr," '%c' ", lc));
|
|
||||||
} else {
|
|
||||||
/* Here, lc is the match length - MIN_MATCH */
|
|
||||||
code = _length_code[lc];
|
|
||||||
send_code(s, code + LITERALS + 1, ltree); /* send length code */
|
|
||||||
extra = extra_lbits[code];
|
|
||||||
if (extra != 0) {
|
|
||||||
lc -= base_length[code];
|
|
||||||
send_bits(s, lc, extra); /* send the extra length bits */
|
|
||||||
}
|
|
||||||
dist--; /* dist is now the match distance - 1 */
|
|
||||||
code = d_code(dist);
|
|
||||||
Assert (code < D_CODES, "bad d_code");
|
|
||||||
|
|
||||||
send_code(s, code, dtree); /* send the distance code */
|
|
||||||
extra = extra_dbits[code];
|
|
||||||
if (extra != 0) {
|
|
||||||
dist -= (unsigned)base_dist[code];
|
|
||||||
send_bits(s, dist, extra); /* send the extra distance bits */
|
|
||||||
}
|
|
||||||
} /* literal or match pair ? */
|
|
||||||
|
|
||||||
/* Check that the overlay between pending_buf and sym_buf is ok: */
|
|
||||||
Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow");
|
|
||||||
|
|
||||||
} while (sx < s->sym_next);
|
|
||||||
|
|
||||||
send_code(s, END_BLOCK, ltree);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ===========================================================================
|
|
||||||
* Check if the data type is TEXT or BINARY, using the following algorithm:
|
|
||||||
* - TEXT if the two conditions below are satisfied:
|
|
||||||
* a) There are no non-portable control characters belonging to the
|
|
||||||
* "block list" (0..6, 14..25, 28..31).
|
|
||||||
* b) There is at least one printable character belonging to the
|
|
||||||
* "allow list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).
|
|
||||||
* - BINARY otherwise.
|
|
||||||
* - The following partially-portable control characters form a
|
|
||||||
* "gray list" that is ignored in this detection algorithm:
|
|
||||||
* (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).
|
|
||||||
* IN assertion: the fields Freq of dyn_ltree are set.
|
|
||||||
*/
|
|
||||||
local int detect_data_type(s)
|
|
||||||
deflate_state *s;
|
|
||||||
{
|
|
||||||
/* block_mask is the bit mask of block-listed bytes
|
|
||||||
* set bits 0..6, 14..25, and 28..31
|
|
||||||
* 0xf3ffc07f = binary 11110011111111111100000001111111
|
|
||||||
*/
|
|
||||||
unsigned long block_mask = 0xf3ffc07fUL;
|
|
||||||
int n;
|
|
||||||
|
|
||||||
/* Check for non-textual ("block-listed") bytes. */
|
|
||||||
for (n = 0; n <= 31; n++, block_mask >>= 1)
|
|
||||||
if ((block_mask & 1) && (s->dyn_ltree[n].Freq != 0))
|
|
||||||
return Z_BINARY;
|
|
||||||
|
|
||||||
/* Check for textual ("allow-listed") bytes. */
|
|
||||||
if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0
|
|
||||||
|| s->dyn_ltree[13].Freq != 0)
|
|
||||||
return Z_TEXT;
|
|
||||||
for (n = 32; n < LITERALS; n++)
|
|
||||||
if (s->dyn_ltree[n].Freq != 0)
|
|
||||||
return Z_TEXT;
|
|
||||||
|
|
||||||
/* There are no "block-listed" or "allow-listed" bytes:
|
|
||||||
* this stream either is empty or has tolerated ("gray-listed") bytes only.
|
|
||||||
*/
|
|
||||||
return Z_BINARY;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ===========================================================================
|
|
||||||
* Reverse the first len bits of a code, using straightforward code (a faster
|
|
||||||
* method would use a table)
|
|
||||||
* IN assertion: 1 <= len <= 15
|
|
||||||
*/
|
|
||||||
local unsigned bi_reverse(code, len)
|
|
||||||
unsigned code; /* the value to invert */
|
|
||||||
int len; /* its bit length */
|
|
||||||
{
|
|
||||||
register unsigned res = 0;
|
|
||||||
do {
|
|
||||||
res |= code & 1;
|
|
||||||
code >>= 1, res <<= 1;
|
|
||||||
} while (--len > 0);
|
|
||||||
return res >> 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ===========================================================================
|
|
||||||
* Flush the bit buffer, keeping at most 7 bits in it.
|
|
||||||
*/
|
|
||||||
local void bi_flush(s)
|
|
||||||
deflate_state *s;
|
|
||||||
{
|
|
||||||
if (s->bi_valid == 16) {
|
|
||||||
put_short(s, s->bi_buf);
|
|
||||||
s->bi_buf = 0;
|
|
||||||
s->bi_valid = 0;
|
|
||||||
} else if (s->bi_valid >= 8) {
|
|
||||||
put_byte(s, (Byte)s->bi_buf);
|
|
||||||
s->bi_buf >>= 8;
|
|
||||||
s->bi_valid -= 8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ===========================================================================
|
|
||||||
* Flush the bit buffer and align the output on a byte boundary
|
|
||||||
*/
|
|
||||||
local void bi_windup(s)
|
|
||||||
deflate_state *s;
|
|
||||||
{
|
|
||||||
if (s->bi_valid > 8) {
|
|
||||||
put_short(s, s->bi_buf);
|
|
||||||
} else if (s->bi_valid > 0) {
|
|
||||||
put_byte(s, (Byte)s->bi_buf);
|
|
||||||
}
|
|
||||||
s->bi_buf = 0;
|
|
||||||
s->bi_valid = 0;
|
|
||||||
#ifdef ZLIB_DEBUG
|
|
||||||
s->bits_sent = (s->bits_sent + 7) & ~7;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
|
||||||
16
thirdparty/zlib/uncompr.c
vendored
16
thirdparty/zlib/uncompr.c
vendored
|
|
@ -24,12 +24,8 @@
|
||||||
Z_DATA_ERROR if the input data was corrupted, including if the input data is
|
Z_DATA_ERROR if the input data was corrupted, including if the input data is
|
||||||
an incomplete zlib stream.
|
an incomplete zlib stream.
|
||||||
*/
|
*/
|
||||||
int ZEXPORT uncompress2(dest, destLen, source, sourceLen)
|
int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen, const Bytef *source,
|
||||||
Bytef *dest;
|
uLong *sourceLen) {
|
||||||
uLongf *destLen;
|
|
||||||
const Bytef *source;
|
|
||||||
uLong *sourceLen;
|
|
||||||
{
|
|
||||||
z_stream stream;
|
z_stream stream;
|
||||||
int err;
|
int err;
|
||||||
const uInt max = (uInt)-1;
|
const uInt max = (uInt)-1;
|
||||||
|
|
@ -83,11 +79,7 @@ int ZEXPORT uncompress2(dest, destLen, source, sourceLen)
|
||||||
err;
|
err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT uncompress(dest, destLen, source, sourceLen)
|
int ZEXPORT uncompress(Bytef *dest, uLongf *destLen, const Bytef *source,
|
||||||
Bytef *dest;
|
uLong sourceLen) {
|
||||||
uLongf *destLen;
|
|
||||||
const Bytef *source;
|
|
||||||
uLong sourceLen;
|
|
||||||
{
|
|
||||||
return uncompress2(dest, destLen, source, &sourceLen);
|
return uncompress2(dest, destLen, source, &sourceLen);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
18
thirdparty/zlib/zconf.h
vendored
18
thirdparty/zlib/zconf.h
vendored
|
|
@ -1,5 +1,5 @@
|
||||||
/* zconf.h -- configuration of the zlib compression library
|
/* zconf.h -- configuration of the zlib compression library
|
||||||
* Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
|
* Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -241,7 +241,11 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Z_SOLO
|
#ifdef Z_SOLO
|
||||||
typedef unsigned long z_size_t;
|
# ifdef _WIN64
|
||||||
|
typedef unsigned long long z_size_t;
|
||||||
|
# else
|
||||||
|
typedef unsigned long z_size_t;
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
# define z_longlong long long
|
# define z_longlong long long
|
||||||
# if defined(NO_SIZE_T)
|
# if defined(NO_SIZE_T)
|
||||||
|
|
@ -296,14 +300,6 @@
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef Z_ARG /* function prototypes for stdarg */
|
|
||||||
# if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
|
||||||
# define Z_ARG(args) args
|
|
||||||
# else
|
|
||||||
# define Z_ARG(args) ()
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The following definitions for FAR are needed only for MSDOS mixed
|
/* The following definitions for FAR are needed only for MSDOS mixed
|
||||||
* model programming (small or medium model with some far allocations).
|
* model programming (small or medium model with some far allocations).
|
||||||
* This was tested only with MSC; for other MSDOS compilers you may have
|
* This was tested only with MSC; for other MSDOS compilers you may have
|
||||||
|
|
@ -520,7 +516,7 @@ typedef uLong FAR uLongf;
|
||||||
#if !defined(_WIN32) && defined(Z_LARGE64)
|
#if !defined(_WIN32) && defined(Z_LARGE64)
|
||||||
# define z_off64_t off64_t
|
# define z_off64_t off64_t
|
||||||
#else
|
#else
|
||||||
# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
|
# if defined(_WIN32) && !defined(__GNUC__)
|
||||||
# define z_off64_t __int64
|
# define z_off64_t __int64
|
||||||
# else
|
# else
|
||||||
# define z_off64_t z_off_t
|
# define z_off64_t z_off_t
|
||||||
|
|
|
||||||
391
thirdparty/zlib/zlib.h
vendored
391
thirdparty/zlib/zlib.h
vendored
|
|
@ -1,7 +1,7 @@
|
||||||
/* zlib.h -- interface of the 'zlib' general purpose compression library
|
/* zlib.h -- interface of the 'zlib' general purpose compression library
|
||||||
version 1.2.13, October 13th, 2022
|
version 1.3.1, January 22nd, 2024
|
||||||
|
|
||||||
Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler
|
Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|
@ -37,11 +37,11 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ZLIB_VERSION "1.2.13"
|
#define ZLIB_VERSION "1.3.1"
|
||||||
#define ZLIB_VERNUM 0x12d0
|
#define ZLIB_VERNUM 0x1310
|
||||||
#define ZLIB_VER_MAJOR 1
|
#define ZLIB_VER_MAJOR 1
|
||||||
#define ZLIB_VER_MINOR 2
|
#define ZLIB_VER_MINOR 3
|
||||||
#define ZLIB_VER_REVISION 13
|
#define ZLIB_VER_REVISION 1
|
||||||
#define ZLIB_VER_SUBREVISION 0
|
#define ZLIB_VER_SUBREVISION 0
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -78,8 +78,8 @@ extern "C" {
|
||||||
even in the case of corrupted input.
|
even in the case of corrupted input.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
|
typedef voidpf (*alloc_func)(voidpf opaque, uInt items, uInt size);
|
||||||
typedef void (*free_func) OF((voidpf opaque, voidpf address));
|
typedef void (*free_func)(voidpf opaque, voidpf address);
|
||||||
|
|
||||||
struct internal_state;
|
struct internal_state;
|
||||||
|
|
||||||
|
|
@ -217,7 +217,7 @@ typedef gz_header FAR *gz_headerp;
|
||||||
|
|
||||||
/* basic functions */
|
/* basic functions */
|
||||||
|
|
||||||
ZEXTERN const char * ZEXPORT zlibVersion OF((void));
|
ZEXTERN const char * ZEXPORT zlibVersion(void);
|
||||||
/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
|
/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
|
||||||
If the first character differs, the library code actually used is not
|
If the first character differs, the library code actually used is not
|
||||||
compatible with the zlib.h header file used by the application. This check
|
compatible with the zlib.h header file used by the application. This check
|
||||||
|
|
@ -225,12 +225,12 @@ ZEXTERN const char * ZEXPORT zlibVersion OF((void));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
|
ZEXTERN int ZEXPORT deflateInit(z_streamp strm, int level);
|
||||||
|
|
||||||
Initializes the internal stream state for compression. The fields
|
Initializes the internal stream state for compression. The fields
|
||||||
zalloc, zfree and opaque must be initialized before by the caller. If
|
zalloc, zfree and opaque must be initialized before by the caller. If
|
||||||
zalloc and zfree are set to Z_NULL, deflateInit updates them to use default
|
zalloc and zfree are set to Z_NULL, deflateInit updates them to use default
|
||||||
allocation functions.
|
allocation functions. total_in, total_out, adler, and msg are initialized.
|
||||||
|
|
||||||
The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
|
The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
|
||||||
1 gives best speed, 9 gives best compression, 0 gives no compression at all
|
1 gives best speed, 9 gives best compression, 0 gives no compression at all
|
||||||
|
|
@ -247,7 +247,7 @@ ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
|
ZEXTERN int ZEXPORT deflate(z_streamp strm, int flush);
|
||||||
/*
|
/*
|
||||||
deflate compresses as much data as possible, and stops when the input
|
deflate compresses as much data as possible, and stops when the input
|
||||||
buffer becomes empty or the output buffer becomes full. It may introduce
|
buffer becomes empty or the output buffer becomes full. It may introduce
|
||||||
|
|
@ -320,8 +320,8 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
|
||||||
with the same value of the flush parameter and more output space (updated
|
with the same value of the flush parameter and more output space (updated
|
||||||
avail_out), until the flush is complete (deflate returns with non-zero
|
avail_out), until the flush is complete (deflate returns with non-zero
|
||||||
avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
|
avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
|
||||||
avail_out is greater than six to avoid repeated flush markers due to
|
avail_out is greater than six when the flush marker begins, in order to avoid
|
||||||
avail_out == 0 on return.
|
repeated flush markers upon calling deflate() again when avail_out == 0.
|
||||||
|
|
||||||
If the parameter flush is set to Z_FINISH, pending input is processed,
|
If the parameter flush is set to Z_FINISH, pending input is processed,
|
||||||
pending output is flushed and deflate returns with Z_STREAM_END if there was
|
pending output is flushed and deflate returns with Z_STREAM_END if there was
|
||||||
|
|
@ -360,7 +360,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
|
ZEXTERN int ZEXPORT deflateEnd(z_streamp strm);
|
||||||
/*
|
/*
|
||||||
All dynamically allocated data structures for this stream are freed.
|
All dynamically allocated data structures for this stream are freed.
|
||||||
This function discards any unprocessed input and does not flush any pending
|
This function discards any unprocessed input and does not flush any pending
|
||||||
|
|
@ -375,7 +375,7 @@ ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
|
ZEXTERN int ZEXPORT inflateInit(z_streamp strm);
|
||||||
|
|
||||||
Initializes the internal stream state for decompression. The fields
|
Initializes the internal stream state for decompression. The fields
|
||||||
next_in, avail_in, zalloc, zfree and opaque must be initialized before by
|
next_in, avail_in, zalloc, zfree and opaque must be initialized before by
|
||||||
|
|
@ -383,7 +383,8 @@ ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
|
||||||
read or consumed. The allocation of a sliding window will be deferred to
|
read or consumed. The allocation of a sliding window will be deferred to
|
||||||
the first call of inflate (if the decompression does not complete on the
|
the first call of inflate (if the decompression does not complete on the
|
||||||
first call). If zalloc and zfree are set to Z_NULL, inflateInit updates
|
first call). If zalloc and zfree are set to Z_NULL, inflateInit updates
|
||||||
them to use default allocation functions.
|
them to use default allocation functions. total_in, total_out, adler, and
|
||||||
|
msg are initialized.
|
||||||
|
|
||||||
inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
|
inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
|
||||||
memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
|
memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
|
||||||
|
|
@ -397,7 +398,7 @@ ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
|
ZEXTERN int ZEXPORT inflate(z_streamp strm, int flush);
|
||||||
/*
|
/*
|
||||||
inflate decompresses as much data as possible, and stops when the input
|
inflate decompresses as much data as possible, and stops when the input
|
||||||
buffer becomes empty or the output buffer becomes full. It may introduce
|
buffer becomes empty or the output buffer becomes full. It may introduce
|
||||||
|
|
@ -517,7 +518,7 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
|
ZEXTERN int ZEXPORT inflateEnd(z_streamp strm);
|
||||||
/*
|
/*
|
||||||
All dynamically allocated data structures for this stream are freed.
|
All dynamically allocated data structures for this stream are freed.
|
||||||
This function discards any unprocessed input and does not flush any pending
|
This function discards any unprocessed input and does not flush any pending
|
||||||
|
|
@ -535,12 +536,12 @@ ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
|
ZEXTERN int ZEXPORT deflateInit2(z_streamp strm,
|
||||||
int level,
|
int level,
|
||||||
int method,
|
int method,
|
||||||
int windowBits,
|
int windowBits,
|
||||||
int memLevel,
|
int memLevel,
|
||||||
int strategy));
|
int strategy);
|
||||||
|
|
||||||
This is another version of deflateInit with more compression options. The
|
This is another version of deflateInit with more compression options. The
|
||||||
fields zalloc, zfree and opaque must be initialized before by the caller.
|
fields zalloc, zfree and opaque must be initialized before by the caller.
|
||||||
|
|
@ -607,9 +608,9 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
|
||||||
compression: this will be done by deflate().
|
compression: this will be done by deflate().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
|
ZEXTERN int ZEXPORT deflateSetDictionary(z_streamp strm,
|
||||||
const Bytef *dictionary,
|
const Bytef *dictionary,
|
||||||
uInt dictLength));
|
uInt dictLength);
|
||||||
/*
|
/*
|
||||||
Initializes the compression dictionary from the given byte sequence
|
Initializes the compression dictionary from the given byte sequence
|
||||||
without producing any compressed output. When using the zlib format, this
|
without producing any compressed output. When using the zlib format, this
|
||||||
|
|
@ -651,9 +652,9 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
|
||||||
not perform any compression: this will be done by deflate().
|
not perform any compression: this will be done by deflate().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm,
|
ZEXTERN int ZEXPORT deflateGetDictionary(z_streamp strm,
|
||||||
Bytef *dictionary,
|
Bytef *dictionary,
|
||||||
uInt *dictLength));
|
uInt *dictLength);
|
||||||
/*
|
/*
|
||||||
Returns the sliding dictionary being maintained by deflate. dictLength is
|
Returns the sliding dictionary being maintained by deflate. dictLength is
|
||||||
set to the number of bytes in the dictionary, and that many bytes are copied
|
set to the number of bytes in the dictionary, and that many bytes are copied
|
||||||
|
|
@ -673,8 +674,8 @@ ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm,
|
||||||
stream state is inconsistent.
|
stream state is inconsistent.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
|
ZEXTERN int ZEXPORT deflateCopy(z_streamp dest,
|
||||||
z_streamp source));
|
z_streamp source);
|
||||||
/*
|
/*
|
||||||
Sets the destination stream as a complete copy of the source stream.
|
Sets the destination stream as a complete copy of the source stream.
|
||||||
|
|
||||||
|
|
@ -691,20 +692,20 @@ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
|
||||||
destination.
|
destination.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
|
ZEXTERN int ZEXPORT deflateReset(z_streamp strm);
|
||||||
/*
|
/*
|
||||||
This function is equivalent to deflateEnd followed by deflateInit, but
|
This function is equivalent to deflateEnd followed by deflateInit, but
|
||||||
does not free and reallocate the internal compression state. The stream
|
does not free and reallocate the internal compression state. The stream
|
||||||
will leave the compression level and any other attributes that may have been
|
will leave the compression level and any other attributes that may have been
|
||||||
set unchanged.
|
set unchanged. total_in, total_out, adler, and msg are initialized.
|
||||||
|
|
||||||
deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
|
deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
|
||||||
stream state was inconsistent (such as zalloc or state being Z_NULL).
|
stream state was inconsistent (such as zalloc or state being Z_NULL).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
|
ZEXTERN int ZEXPORT deflateParams(z_streamp strm,
|
||||||
int level,
|
int level,
|
||||||
int strategy));
|
int strategy);
|
||||||
/*
|
/*
|
||||||
Dynamically update the compression level and compression strategy. The
|
Dynamically update the compression level and compression strategy. The
|
||||||
interpretation of level and strategy is as in deflateInit2(). This can be
|
interpretation of level and strategy is as in deflateInit2(). This can be
|
||||||
|
|
@ -729,7 +730,7 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
|
||||||
Then no more input data should be provided before the deflateParams() call.
|
Then no more input data should be provided before the deflateParams() call.
|
||||||
If this is done, the old level and strategy will be applied to the data
|
If this is done, the old level and strategy will be applied to the data
|
||||||
compressed before deflateParams(), and the new level and strategy will be
|
compressed before deflateParams(), and the new level and strategy will be
|
||||||
applied to the the data compressed after deflateParams().
|
applied to the data compressed after deflateParams().
|
||||||
|
|
||||||
deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream
|
deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream
|
||||||
state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if
|
state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if
|
||||||
|
|
@ -740,11 +741,11 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
|
||||||
retried with more output space.
|
retried with more output space.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
|
ZEXTERN int ZEXPORT deflateTune(z_streamp strm,
|
||||||
int good_length,
|
int good_length,
|
||||||
int max_lazy,
|
int max_lazy,
|
||||||
int nice_length,
|
int nice_length,
|
||||||
int max_chain));
|
int max_chain);
|
||||||
/*
|
/*
|
||||||
Fine tune deflate's internal compression parameters. This should only be
|
Fine tune deflate's internal compression parameters. This should only be
|
||||||
used by someone who understands the algorithm used by zlib's deflate for
|
used by someone who understands the algorithm used by zlib's deflate for
|
||||||
|
|
@ -757,8 +758,8 @@ ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
|
||||||
returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
|
returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
|
ZEXTERN uLong ZEXPORT deflateBound(z_streamp strm,
|
||||||
uLong sourceLen));
|
uLong sourceLen);
|
||||||
/*
|
/*
|
||||||
deflateBound() returns an upper bound on the compressed size after
|
deflateBound() returns an upper bound on the compressed size after
|
||||||
deflation of sourceLen bytes. It must be called after deflateInit() or
|
deflation of sourceLen bytes. It must be called after deflateInit() or
|
||||||
|
|
@ -772,9 +773,9 @@ ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
|
||||||
than Z_FINISH or Z_NO_FLUSH are used.
|
than Z_FINISH or Z_NO_FLUSH are used.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm,
|
ZEXTERN int ZEXPORT deflatePending(z_streamp strm,
|
||||||
unsigned *pending,
|
unsigned *pending,
|
||||||
int *bits));
|
int *bits);
|
||||||
/*
|
/*
|
||||||
deflatePending() returns the number of bytes and bits of output that have
|
deflatePending() returns the number of bytes and bits of output that have
|
||||||
been generated, but not yet provided in the available output. The bytes not
|
been generated, but not yet provided in the available output. The bytes not
|
||||||
|
|
@ -787,9 +788,9 @@ ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm,
|
||||||
stream state was inconsistent.
|
stream state was inconsistent.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
|
ZEXTERN int ZEXPORT deflatePrime(z_streamp strm,
|
||||||
int bits,
|
int bits,
|
||||||
int value));
|
int value);
|
||||||
/*
|
/*
|
||||||
deflatePrime() inserts bits in the deflate output stream. The intent
|
deflatePrime() inserts bits in the deflate output stream. The intent
|
||||||
is that this function is used to start off the deflate output with the bits
|
is that this function is used to start off the deflate output with the bits
|
||||||
|
|
@ -804,8 +805,8 @@ ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
|
||||||
source stream state was inconsistent.
|
source stream state was inconsistent.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
|
ZEXTERN int ZEXPORT deflateSetHeader(z_streamp strm,
|
||||||
gz_headerp head));
|
gz_headerp head);
|
||||||
/*
|
/*
|
||||||
deflateSetHeader() provides gzip header information for when a gzip
|
deflateSetHeader() provides gzip header information for when a gzip
|
||||||
stream is requested by deflateInit2(). deflateSetHeader() may be called
|
stream is requested by deflateInit2(). deflateSetHeader() may be called
|
||||||
|
|
@ -821,16 +822,17 @@ ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
|
||||||
gzip file" and give up.
|
gzip file" and give up.
|
||||||
|
|
||||||
If deflateSetHeader is not used, the default gzip header has text false,
|
If deflateSetHeader is not used, the default gzip header has text false,
|
||||||
the time set to zero, and os set to 255, with no extra, name, or comment
|
the time set to zero, and os set to the current operating system, with no
|
||||||
fields. The gzip header is returned to the default state by deflateReset().
|
extra, name, or comment fields. The gzip header is returned to the default
|
||||||
|
state by deflateReset().
|
||||||
|
|
||||||
deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
|
deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
|
||||||
stream state was inconsistent.
|
stream state was inconsistent.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
|
ZEXTERN int ZEXPORT inflateInit2(z_streamp strm,
|
||||||
int windowBits));
|
int windowBits);
|
||||||
|
|
||||||
This is another version of inflateInit with an extra parameter. The
|
This is another version of inflateInit with an extra parameter. The
|
||||||
fields next_in, avail_in, zalloc, zfree and opaque must be initialized
|
fields next_in, avail_in, zalloc, zfree and opaque must be initialized
|
||||||
|
|
@ -883,9 +885,9 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
|
||||||
deferred until inflate() is called.
|
deferred until inflate() is called.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
|
ZEXTERN int ZEXPORT inflateSetDictionary(z_streamp strm,
|
||||||
const Bytef *dictionary,
|
const Bytef *dictionary,
|
||||||
uInt dictLength));
|
uInt dictLength);
|
||||||
/*
|
/*
|
||||||
Initializes the decompression dictionary from the given uncompressed byte
|
Initializes the decompression dictionary from the given uncompressed byte
|
||||||
sequence. This function must be called immediately after a call of inflate,
|
sequence. This function must be called immediately after a call of inflate,
|
||||||
|
|
@ -906,9 +908,9 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
|
||||||
inflate().
|
inflate().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm,
|
ZEXTERN int ZEXPORT inflateGetDictionary(z_streamp strm,
|
||||||
Bytef *dictionary,
|
Bytef *dictionary,
|
||||||
uInt *dictLength));
|
uInt *dictLength);
|
||||||
/*
|
/*
|
||||||
Returns the sliding dictionary being maintained by inflate. dictLength is
|
Returns the sliding dictionary being maintained by inflate. dictLength is
|
||||||
set to the number of bytes in the dictionary, and that many bytes are copied
|
set to the number of bytes in the dictionary, and that many bytes are copied
|
||||||
|
|
@ -921,7 +923,7 @@ ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm,
|
||||||
stream state is inconsistent.
|
stream state is inconsistent.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
|
ZEXTERN int ZEXPORT inflateSync(z_streamp strm);
|
||||||
/*
|
/*
|
||||||
Skips invalid compressed data until a possible full flush point (see above
|
Skips invalid compressed data until a possible full flush point (see above
|
||||||
for the description of deflate with Z_FULL_FLUSH) can be found, or until all
|
for the description of deflate with Z_FULL_FLUSH) can be found, or until all
|
||||||
|
|
@ -934,14 +936,14 @@ ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
|
||||||
inflateSync returns Z_OK if a possible full flush point has been found,
|
inflateSync returns Z_OK if a possible full flush point has been found,
|
||||||
Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point
|
Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point
|
||||||
has been found, or Z_STREAM_ERROR if the stream structure was inconsistent.
|
has been found, or Z_STREAM_ERROR if the stream structure was inconsistent.
|
||||||
In the success case, the application may save the current current value of
|
In the success case, the application may save the current value of total_in
|
||||||
total_in which indicates where valid compressed data was found. In the
|
which indicates where valid compressed data was found. In the error case,
|
||||||
error case, the application may repeatedly call inflateSync, providing more
|
the application may repeatedly call inflateSync, providing more input each
|
||||||
input each time, until success or end of the input data.
|
time, until success or end of the input data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
|
ZEXTERN int ZEXPORT inflateCopy(z_streamp dest,
|
||||||
z_streamp source));
|
z_streamp source);
|
||||||
/*
|
/*
|
||||||
Sets the destination stream as a complete copy of the source stream.
|
Sets the destination stream as a complete copy of the source stream.
|
||||||
|
|
||||||
|
|
@ -956,18 +958,19 @@ ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
|
||||||
destination.
|
destination.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
|
ZEXTERN int ZEXPORT inflateReset(z_streamp strm);
|
||||||
/*
|
/*
|
||||||
This function is equivalent to inflateEnd followed by inflateInit,
|
This function is equivalent to inflateEnd followed by inflateInit,
|
||||||
but does not free and reallocate the internal decompression state. The
|
but does not free and reallocate the internal decompression state. The
|
||||||
stream will keep attributes that may have been set by inflateInit2.
|
stream will keep attributes that may have been set by inflateInit2.
|
||||||
|
total_in, total_out, adler, and msg are initialized.
|
||||||
|
|
||||||
inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
|
inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
|
||||||
stream state was inconsistent (such as zalloc or state being Z_NULL).
|
stream state was inconsistent (such as zalloc or state being Z_NULL).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
|
ZEXTERN int ZEXPORT inflateReset2(z_streamp strm,
|
||||||
int windowBits));
|
int windowBits);
|
||||||
/*
|
/*
|
||||||
This function is the same as inflateReset, but it also permits changing
|
This function is the same as inflateReset, but it also permits changing
|
||||||
the wrap and window size requests. The windowBits parameter is interpreted
|
the wrap and window size requests. The windowBits parameter is interpreted
|
||||||
|
|
@ -980,9 +983,9 @@ ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
|
||||||
the windowBits parameter is invalid.
|
the windowBits parameter is invalid.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
|
ZEXTERN int ZEXPORT inflatePrime(z_streamp strm,
|
||||||
int bits,
|
int bits,
|
||||||
int value));
|
int value);
|
||||||
/*
|
/*
|
||||||
This function inserts bits in the inflate input stream. The intent is
|
This function inserts bits in the inflate input stream. The intent is
|
||||||
that this function is used to start inflating at a bit position in the
|
that this function is used to start inflating at a bit position in the
|
||||||
|
|
@ -1001,7 +1004,7 @@ ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
|
||||||
stream state was inconsistent.
|
stream state was inconsistent.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));
|
ZEXTERN long ZEXPORT inflateMark(z_streamp strm);
|
||||||
/*
|
/*
|
||||||
This function returns two values, one in the lower 16 bits of the return
|
This function returns two values, one in the lower 16 bits of the return
|
||||||
value, and the other in the remaining upper bits, obtained by shifting the
|
value, and the other in the remaining upper bits, obtained by shifting the
|
||||||
|
|
@ -1029,8 +1032,8 @@ ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));
|
||||||
source stream state was inconsistent.
|
source stream state was inconsistent.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
|
ZEXTERN int ZEXPORT inflateGetHeader(z_streamp strm,
|
||||||
gz_headerp head));
|
gz_headerp head);
|
||||||
/*
|
/*
|
||||||
inflateGetHeader() requests that gzip header information be stored in the
|
inflateGetHeader() requests that gzip header information be stored in the
|
||||||
provided gz_header structure. inflateGetHeader() may be called after
|
provided gz_header structure. inflateGetHeader() may be called after
|
||||||
|
|
@ -1070,8 +1073,8 @@ ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
|
ZEXTERN int ZEXPORT inflateBackInit(z_streamp strm, int windowBits,
|
||||||
unsigned char FAR *window));
|
unsigned char FAR *window);
|
||||||
|
|
||||||
Initialize the internal stream state for decompression using inflateBack()
|
Initialize the internal stream state for decompression using inflateBack()
|
||||||
calls. The fields zalloc, zfree and opaque in strm must be initialized
|
calls. The fields zalloc, zfree and opaque in strm must be initialized
|
||||||
|
|
@ -1091,13 +1094,13 @@ ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
|
||||||
the version of the header file.
|
the version of the header file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef unsigned (*in_func) OF((void FAR *,
|
typedef unsigned (*in_func)(void FAR *,
|
||||||
z_const unsigned char FAR * FAR *));
|
z_const unsigned char FAR * FAR *);
|
||||||
typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
|
typedef int (*out_func)(void FAR *, unsigned char FAR *, unsigned);
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
|
ZEXTERN int ZEXPORT inflateBack(z_streamp strm,
|
||||||
in_func in, void FAR *in_desc,
|
in_func in, void FAR *in_desc,
|
||||||
out_func out, void FAR *out_desc));
|
out_func out, void FAR *out_desc);
|
||||||
/*
|
/*
|
||||||
inflateBack() does a raw inflate with a single call using a call-back
|
inflateBack() does a raw inflate with a single call using a call-back
|
||||||
interface for input and output. This is potentially more efficient than
|
interface for input and output. This is potentially more efficient than
|
||||||
|
|
@ -1165,7 +1168,7 @@ ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
|
||||||
cannot return Z_OK.
|
cannot return Z_OK.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
|
ZEXTERN int ZEXPORT inflateBackEnd(z_streamp strm);
|
||||||
/*
|
/*
|
||||||
All memory allocated by inflateBackInit() is freed.
|
All memory allocated by inflateBackInit() is freed.
|
||||||
|
|
||||||
|
|
@ -1173,7 +1176,7 @@ ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
|
||||||
state was inconsistent.
|
state was inconsistent.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
|
ZEXTERN uLong ZEXPORT zlibCompileFlags(void);
|
||||||
/* Return flags indicating compile-time options.
|
/* Return flags indicating compile-time options.
|
||||||
|
|
||||||
Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
|
Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
|
||||||
|
|
@ -1226,8 +1229,8 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
|
||||||
you need special options.
|
you need special options.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
|
ZEXTERN int ZEXPORT compress(Bytef *dest, uLongf *destLen,
|
||||||
const Bytef *source, uLong sourceLen));
|
const Bytef *source, uLong sourceLen);
|
||||||
/*
|
/*
|
||||||
Compresses the source buffer into the destination buffer. sourceLen is
|
Compresses the source buffer into the destination buffer. sourceLen is
|
||||||
the byte length of the source buffer. Upon entry, destLen is the total size
|
the byte length of the source buffer. Upon entry, destLen is the total size
|
||||||
|
|
@ -1241,9 +1244,9 @@ ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
|
||||||
buffer.
|
buffer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
|
ZEXTERN int ZEXPORT compress2(Bytef *dest, uLongf *destLen,
|
||||||
const Bytef *source, uLong sourceLen,
|
const Bytef *source, uLong sourceLen,
|
||||||
int level));
|
int level);
|
||||||
/*
|
/*
|
||||||
Compresses the source buffer into the destination buffer. The level
|
Compresses the source buffer into the destination buffer. The level
|
||||||
parameter has the same meaning as in deflateInit. sourceLen is the byte
|
parameter has the same meaning as in deflateInit. sourceLen is the byte
|
||||||
|
|
@ -1257,15 +1260,15 @@ ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
|
||||||
Z_STREAM_ERROR if the level parameter is invalid.
|
Z_STREAM_ERROR if the level parameter is invalid.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
|
ZEXTERN uLong ZEXPORT compressBound(uLong sourceLen);
|
||||||
/*
|
/*
|
||||||
compressBound() returns an upper bound on the compressed size after
|
compressBound() returns an upper bound on the compressed size after
|
||||||
compress() or compress2() on sourceLen bytes. It would be used before a
|
compress() or compress2() on sourceLen bytes. It would be used before a
|
||||||
compress() or compress2() call to allocate the destination buffer.
|
compress() or compress2() call to allocate the destination buffer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
|
ZEXTERN int ZEXPORT uncompress(Bytef *dest, uLongf *destLen,
|
||||||
const Bytef *source, uLong sourceLen));
|
const Bytef *source, uLong sourceLen);
|
||||||
/*
|
/*
|
||||||
Decompresses the source buffer into the destination buffer. sourceLen is
|
Decompresses the source buffer into the destination buffer. sourceLen is
|
||||||
the byte length of the source buffer. Upon entry, destLen is the total size
|
the byte length of the source buffer. Upon entry, destLen is the total size
|
||||||
|
|
@ -1282,8 +1285,8 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
|
||||||
buffer with the uncompressed data up to that point.
|
buffer with the uncompressed data up to that point.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest, uLongf *destLen,
|
ZEXTERN int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen,
|
||||||
const Bytef *source, uLong *sourceLen));
|
const Bytef *source, uLong *sourceLen);
|
||||||
/*
|
/*
|
||||||
Same as uncompress, except that sourceLen is a pointer, where the
|
Same as uncompress, except that sourceLen is a pointer, where the
|
||||||
length of the source is *sourceLen. On return, *sourceLen is the number of
|
length of the source is *sourceLen. On return, *sourceLen is the number of
|
||||||
|
|
@ -1302,7 +1305,7 @@ ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest, uLongf *destLen,
|
||||||
typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */
|
typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
|
ZEXTERN gzFile ZEXPORT gzopen(const char *path, const char *mode);
|
||||||
|
|
||||||
Open the gzip (.gz) file at path for reading and decompressing, or
|
Open the gzip (.gz) file at path for reading and decompressing, or
|
||||||
compressing and writing. The mode parameter is as in fopen ("rb" or "wb")
|
compressing and writing. The mode parameter is as in fopen ("rb" or "wb")
|
||||||
|
|
@ -1339,7 +1342,7 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
|
||||||
file could not be opened.
|
file could not be opened.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
|
ZEXTERN gzFile ZEXPORT gzdopen(int fd, const char *mode);
|
||||||
/*
|
/*
|
||||||
Associate a gzFile with the file descriptor fd. File descriptors are
|
Associate a gzFile with the file descriptor fd. File descriptors are
|
||||||
obtained from calls like open, dup, creat, pipe or fileno (if the file has
|
obtained from calls like open, dup, creat, pipe or fileno (if the file has
|
||||||
|
|
@ -1362,7 +1365,7 @@ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
|
||||||
will not detect if fd is invalid (unless fd is -1).
|
will not detect if fd is invalid (unless fd is -1).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
|
ZEXTERN int ZEXPORT gzbuffer(gzFile file, unsigned size);
|
||||||
/*
|
/*
|
||||||
Set the internal buffer size used by this library's functions for file to
|
Set the internal buffer size used by this library's functions for file to
|
||||||
size. The default buffer size is 8192 bytes. This function must be called
|
size. The default buffer size is 8192 bytes. This function must be called
|
||||||
|
|
@ -1378,7 +1381,7 @@ ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
|
||||||
too late.
|
too late.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
|
ZEXTERN int ZEXPORT gzsetparams(gzFile file, int level, int strategy);
|
||||||
/*
|
/*
|
||||||
Dynamically update the compression level and strategy for file. See the
|
Dynamically update the compression level and strategy for file. See the
|
||||||
description of deflateInit2 for the meaning of these parameters. Previously
|
description of deflateInit2 for the meaning of these parameters. Previously
|
||||||
|
|
@ -1389,7 +1392,7 @@ ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
|
||||||
or Z_MEM_ERROR if there is a memory allocation error.
|
or Z_MEM_ERROR if there is a memory allocation error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
|
ZEXTERN int ZEXPORT gzread(gzFile file, voidp buf, unsigned len);
|
||||||
/*
|
/*
|
||||||
Read and decompress up to len uncompressed bytes from file into buf. If
|
Read and decompress up to len uncompressed bytes from file into buf. If
|
||||||
the input file is not in gzip format, gzread copies the given number of
|
the input file is not in gzip format, gzread copies the given number of
|
||||||
|
|
@ -1419,8 +1422,8 @@ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
|
||||||
Z_STREAM_ERROR.
|
Z_STREAM_ERROR.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems,
|
ZEXTERN z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems,
|
||||||
gzFile file));
|
gzFile file);
|
||||||
/*
|
/*
|
||||||
Read and decompress up to nitems items of size size from file into buf,
|
Read and decompress up to nitems items of size size from file into buf,
|
||||||
otherwise operating as gzread() does. This duplicates the interface of
|
otherwise operating as gzread() does. This duplicates the interface of
|
||||||
|
|
@ -1445,14 +1448,14 @@ ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems,
|
||||||
file, resetting and retrying on end-of-file, when size is not 1.
|
file, resetting and retrying on end-of-file, when size is not 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzwrite OF((gzFile file, voidpc buf, unsigned len));
|
ZEXTERN int ZEXPORT gzwrite(gzFile file, voidpc buf, unsigned len);
|
||||||
/*
|
/*
|
||||||
Compress and write the len uncompressed bytes at buf to file. gzwrite
|
Compress and write the len uncompressed bytes at buf to file. gzwrite
|
||||||
returns the number of uncompressed bytes written or 0 in case of error.
|
returns the number of uncompressed bytes written or 0 in case of error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size,
|
ZEXTERN z_size_t ZEXPORT gzfwrite(voidpc buf, z_size_t size,
|
||||||
z_size_t nitems, gzFile file));
|
z_size_t nitems, gzFile file);
|
||||||
/*
|
/*
|
||||||
Compress and write nitems items of size size from buf to file, duplicating
|
Compress and write nitems items of size size from buf to file, duplicating
|
||||||
the interface of stdio's fwrite(), with size_t request and return types. If
|
the interface of stdio's fwrite(), with size_t request and return types. If
|
||||||
|
|
@ -1465,7 +1468,7 @@ ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size,
|
||||||
is returned, and the error state is set to Z_STREAM_ERROR.
|
is returned, and the error state is set to Z_STREAM_ERROR.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...));
|
ZEXTERN int ZEXPORTVA gzprintf(gzFile file, const char *format, ...);
|
||||||
/*
|
/*
|
||||||
Convert, format, compress, and write the arguments (...) to file under
|
Convert, format, compress, and write the arguments (...) to file under
|
||||||
control of the string format, as in fprintf. gzprintf returns the number of
|
control of the string format, as in fprintf. gzprintf returns the number of
|
||||||
|
|
@ -1480,7 +1483,7 @@ ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...));
|
||||||
This can be determined using zlibCompileFlags().
|
This can be determined using zlibCompileFlags().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
|
ZEXTERN int ZEXPORT gzputs(gzFile file, const char *s);
|
||||||
/*
|
/*
|
||||||
Compress and write the given null-terminated string s to file, excluding
|
Compress and write the given null-terminated string s to file, excluding
|
||||||
the terminating null character.
|
the terminating null character.
|
||||||
|
|
@ -1488,7 +1491,7 @@ ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
|
||||||
gzputs returns the number of characters written, or -1 in case of error.
|
gzputs returns the number of characters written, or -1 in case of error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
|
ZEXTERN char * ZEXPORT gzgets(gzFile file, char *buf, int len);
|
||||||
/*
|
/*
|
||||||
Read and decompress bytes from file into buf, until len-1 characters are
|
Read and decompress bytes from file into buf, until len-1 characters are
|
||||||
read, or until a newline character is read and transferred to buf, or an
|
read, or until a newline character is read and transferred to buf, or an
|
||||||
|
|
@ -1502,13 +1505,13 @@ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
|
||||||
buf are indeterminate.
|
buf are indeterminate.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
|
ZEXTERN int ZEXPORT gzputc(gzFile file, int c);
|
||||||
/*
|
/*
|
||||||
Compress and write c, converted to an unsigned char, into file. gzputc
|
Compress and write c, converted to an unsigned char, into file. gzputc
|
||||||
returns the value that was written, or -1 in case of error.
|
returns the value that was written, or -1 in case of error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
|
ZEXTERN int ZEXPORT gzgetc(gzFile file);
|
||||||
/*
|
/*
|
||||||
Read and decompress one byte from file. gzgetc returns this byte or -1
|
Read and decompress one byte from file. gzgetc returns this byte or -1
|
||||||
in case of end of file or error. This is implemented as a macro for speed.
|
in case of end of file or error. This is implemented as a macro for speed.
|
||||||
|
|
@ -1517,7 +1520,7 @@ ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
|
||||||
points to has been clobbered or not.
|
points to has been clobbered or not.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
|
ZEXTERN int ZEXPORT gzungetc(int c, gzFile file);
|
||||||
/*
|
/*
|
||||||
Push c back onto the stream for file to be read as the first character on
|
Push c back onto the stream for file to be read as the first character on
|
||||||
the next read. At least one character of push-back is always allowed.
|
the next read. At least one character of push-back is always allowed.
|
||||||
|
|
@ -1529,7 +1532,7 @@ ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
|
||||||
gzseek() or gzrewind().
|
gzseek() or gzrewind().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
|
ZEXTERN int ZEXPORT gzflush(gzFile file, int flush);
|
||||||
/*
|
/*
|
||||||
Flush all pending output to file. The parameter flush is as in the
|
Flush all pending output to file. The parameter flush is as in the
|
||||||
deflate() function. The return value is the zlib error number (see function
|
deflate() function. The return value is the zlib error number (see function
|
||||||
|
|
@ -1545,8 +1548,8 @@ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
|
ZEXTERN z_off_t ZEXPORT gzseek(gzFile file,
|
||||||
z_off_t offset, int whence));
|
z_off_t offset, int whence);
|
||||||
|
|
||||||
Set the starting position to offset relative to whence for the next gzread
|
Set the starting position to offset relative to whence for the next gzread
|
||||||
or gzwrite on file. The offset represents a number of bytes in the
|
or gzwrite on file. The offset represents a number of bytes in the
|
||||||
|
|
@ -1564,7 +1567,7 @@ ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
|
||||||
would be before the current position.
|
would be before the current position.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
|
ZEXTERN int ZEXPORT gzrewind(gzFile file);
|
||||||
/*
|
/*
|
||||||
Rewind file. This function is supported only for reading.
|
Rewind file. This function is supported only for reading.
|
||||||
|
|
||||||
|
|
@ -1572,7 +1575,7 @@ ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
|
ZEXTERN z_off_t ZEXPORT gztell(gzFile file);
|
||||||
|
|
||||||
Return the starting position for the next gzread or gzwrite on file.
|
Return the starting position for the next gzread or gzwrite on file.
|
||||||
This position represents a number of bytes in the uncompressed data stream,
|
This position represents a number of bytes in the uncompressed data stream,
|
||||||
|
|
@ -1583,7 +1586,7 @@ ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));
|
ZEXTERN z_off_t ZEXPORT gzoffset(gzFile file);
|
||||||
|
|
||||||
Return the current compressed (actual) read or write offset of file. This
|
Return the current compressed (actual) read or write offset of file. This
|
||||||
offset includes the count of bytes that precede the gzip stream, for example
|
offset includes the count of bytes that precede the gzip stream, for example
|
||||||
|
|
@ -1592,7 +1595,7 @@ ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));
|
||||||
be used for a progress indicator. On error, gzoffset() returns -1.
|
be used for a progress indicator. On error, gzoffset() returns -1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzeof OF((gzFile file));
|
ZEXTERN int ZEXPORT gzeof(gzFile file);
|
||||||
/*
|
/*
|
||||||
Return true (1) if the end-of-file indicator for file has been set while
|
Return true (1) if the end-of-file indicator for file has been set while
|
||||||
reading, false (0) otherwise. Note that the end-of-file indicator is set
|
reading, false (0) otherwise. Note that the end-of-file indicator is set
|
||||||
|
|
@ -1607,7 +1610,7 @@ ZEXTERN int ZEXPORT gzeof OF((gzFile file));
|
||||||
has grown since the previous end of file was detected.
|
has grown since the previous end of file was detected.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
|
ZEXTERN int ZEXPORT gzdirect(gzFile file);
|
||||||
/*
|
/*
|
||||||
Return true (1) if file is being copied directly while reading, or false
|
Return true (1) if file is being copied directly while reading, or false
|
||||||
(0) if file is a gzip stream being decompressed.
|
(0) if file is a gzip stream being decompressed.
|
||||||
|
|
@ -1628,7 +1631,7 @@ ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
|
||||||
gzip file reading and decompression, which may not be desired.)
|
gzip file reading and decompression, which may not be desired.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzclose OF((gzFile file));
|
ZEXTERN int ZEXPORT gzclose(gzFile file);
|
||||||
/*
|
/*
|
||||||
Flush all pending output for file, if necessary, close file and
|
Flush all pending output for file, if necessary, close file and
|
||||||
deallocate the (de)compression state. Note that once file is closed, you
|
deallocate the (de)compression state. Note that once file is closed, you
|
||||||
|
|
@ -1641,8 +1644,8 @@ ZEXTERN int ZEXPORT gzclose OF((gzFile file));
|
||||||
last read ended in the middle of a gzip stream, or Z_OK on success.
|
last read ended in the middle of a gzip stream, or Z_OK on success.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzclose_r OF((gzFile file));
|
ZEXTERN int ZEXPORT gzclose_r(gzFile file);
|
||||||
ZEXTERN int ZEXPORT gzclose_w OF((gzFile file));
|
ZEXTERN int ZEXPORT gzclose_w(gzFile file);
|
||||||
/*
|
/*
|
||||||
Same as gzclose(), but gzclose_r() is only for use when reading, and
|
Same as gzclose(), but gzclose_r() is only for use when reading, and
|
||||||
gzclose_w() is only for use when writing or appending. The advantage to
|
gzclose_w() is only for use when writing or appending. The advantage to
|
||||||
|
|
@ -1653,7 +1656,7 @@ ZEXTERN int ZEXPORT gzclose_w OF((gzFile file));
|
||||||
zlib library.
|
zlib library.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
|
ZEXTERN const char * ZEXPORT gzerror(gzFile file, int *errnum);
|
||||||
/*
|
/*
|
||||||
Return the error message for the last error which occurred on file.
|
Return the error message for the last error which occurred on file.
|
||||||
errnum is set to zlib error number. If an error occurred in the file system
|
errnum is set to zlib error number. If an error occurred in the file system
|
||||||
|
|
@ -1669,7 +1672,7 @@ ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
|
||||||
functions above that do not distinguish those cases in their return values.
|
functions above that do not distinguish those cases in their return values.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
|
ZEXTERN void ZEXPORT gzclearerr(gzFile file);
|
||||||
/*
|
/*
|
||||||
Clear the error and end-of-file flags for file. This is analogous to the
|
Clear the error and end-of-file flags for file. This is analogous to the
|
||||||
clearerr() function in stdio. This is useful for continuing to read a gzip
|
clearerr() function in stdio. This is useful for continuing to read a gzip
|
||||||
|
|
@ -1686,7 +1689,7 @@ ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
|
||||||
library.
|
library.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
|
ZEXTERN uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len);
|
||||||
/*
|
/*
|
||||||
Update a running Adler-32 checksum with the bytes buf[0..len-1] and
|
Update a running Adler-32 checksum with the bytes buf[0..len-1] and
|
||||||
return the updated checksum. An Adler-32 value is in the range of a 32-bit
|
return the updated checksum. An Adler-32 value is in the range of a 32-bit
|
||||||
|
|
@ -1706,15 +1709,15 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
|
||||||
if (adler != original_adler) error();
|
if (adler != original_adler) error();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN uLong ZEXPORT adler32_z OF((uLong adler, const Bytef *buf,
|
ZEXTERN uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf,
|
||||||
z_size_t len));
|
z_size_t len);
|
||||||
/*
|
/*
|
||||||
Same as adler32(), but with a size_t length.
|
Same as adler32(), but with a size_t length.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
|
ZEXTERN uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2,
|
||||||
z_off_t len2));
|
z_off_t len2);
|
||||||
|
|
||||||
Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
|
Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
|
||||||
and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
|
and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
|
||||||
|
|
@ -1724,7 +1727,7 @@ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
|
||||||
negative, the result has no meaning or utility.
|
negative, the result has no meaning or utility.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
|
ZEXTERN uLong ZEXPORT crc32(uLong crc, const Bytef *buf, uInt len);
|
||||||
/*
|
/*
|
||||||
Update a running CRC-32 with the bytes buf[0..len-1] and return the
|
Update a running CRC-32 with the bytes buf[0..len-1] and return the
|
||||||
updated CRC-32. A CRC-32 value is in the range of a 32-bit unsigned integer.
|
updated CRC-32. A CRC-32 value is in the range of a 32-bit unsigned integer.
|
||||||
|
|
@ -1742,30 +1745,30 @@ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
|
||||||
if (crc != original_crc) error();
|
if (crc != original_crc) error();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN uLong ZEXPORT crc32_z OF((uLong crc, const Bytef *buf,
|
ZEXTERN uLong ZEXPORT crc32_z(uLong crc, const Bytef *buf,
|
||||||
z_size_t len));
|
z_size_t len);
|
||||||
/*
|
/*
|
||||||
Same as crc32(), but with a size_t length.
|
Same as crc32(), but with a size_t length.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
|
ZEXTERN uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2);
|
||||||
|
|
||||||
Combine two CRC-32 check values into one. For two sequences of bytes,
|
Combine two CRC-32 check values into one. For two sequences of bytes,
|
||||||
seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
|
seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
|
||||||
calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
|
calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
|
||||||
check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
|
check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
|
||||||
len2.
|
len2. len2 must be non-negative.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t len2));
|
ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2);
|
||||||
|
|
||||||
Return the operator corresponding to length len2, to be used with
|
Return the operator corresponding to length len2, to be used with
|
||||||
crc32_combine_op().
|
crc32_combine_op(). len2 must be non-negative.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN uLong ZEXPORT crc32_combine_op OF((uLong crc1, uLong crc2, uLong op));
|
ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op);
|
||||||
/*
|
/*
|
||||||
Give the same result as crc32_combine(), using op in place of len2. op is
|
Give the same result as crc32_combine(), using op in place of len2. op is
|
||||||
is generated from len2 by crc32_combine_gen(). This will be faster than
|
is generated from len2 by crc32_combine_gen(). This will be faster than
|
||||||
|
|
@ -1778,20 +1781,20 @@ ZEXTERN uLong ZEXPORT crc32_combine_op OF((uLong crc1, uLong crc2, uLong op));
|
||||||
/* deflateInit and inflateInit are macros to allow checking the zlib version
|
/* deflateInit and inflateInit are macros to allow checking the zlib version
|
||||||
* and the compiler's view of z_stream:
|
* and the compiler's view of z_stream:
|
||||||
*/
|
*/
|
||||||
ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
|
ZEXTERN int ZEXPORT deflateInit_(z_streamp strm, int level,
|
||||||
const char *version, int stream_size));
|
const char *version, int stream_size);
|
||||||
ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
|
ZEXTERN int ZEXPORT inflateInit_(z_streamp strm,
|
||||||
const char *version, int stream_size));
|
const char *version, int stream_size);
|
||||||
ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
|
ZEXTERN int ZEXPORT deflateInit2_(z_streamp strm, int level, int method,
|
||||||
int windowBits, int memLevel,
|
int windowBits, int memLevel,
|
||||||
int strategy, const char *version,
|
int strategy, const char *version,
|
||||||
int stream_size));
|
int stream_size);
|
||||||
ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
|
ZEXTERN int ZEXPORT inflateInit2_(z_streamp strm, int windowBits,
|
||||||
const char *version, int stream_size));
|
const char *version, int stream_size);
|
||||||
ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
|
ZEXTERN int ZEXPORT inflateBackInit_(z_streamp strm, int windowBits,
|
||||||
unsigned char FAR *window,
|
unsigned char FAR *window,
|
||||||
const char *version,
|
const char *version,
|
||||||
int stream_size));
|
int stream_size);
|
||||||
#ifdef Z_PREFIX_SET
|
#ifdef Z_PREFIX_SET
|
||||||
# define z_deflateInit(strm, level) \
|
# define z_deflateInit(strm, level) \
|
||||||
deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
|
deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
|
||||||
|
|
@ -1836,7 +1839,7 @@ struct gzFile_s {
|
||||||
unsigned char *next;
|
unsigned char *next;
|
||||||
z_off64_t pos;
|
z_off64_t pos;
|
||||||
};
|
};
|
||||||
ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
|
ZEXTERN int ZEXPORT gzgetc_(gzFile file); /* backward compatibility */
|
||||||
#ifdef Z_PREFIX_SET
|
#ifdef Z_PREFIX_SET
|
||||||
# undef z_gzgetc
|
# undef z_gzgetc
|
||||||
# define z_gzgetc(g) \
|
# define z_gzgetc(g) \
|
||||||
|
|
@ -1853,13 +1856,13 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
|
||||||
* without large file support, _LFS64_LARGEFILE must also be true
|
* without large file support, _LFS64_LARGEFILE must also be true
|
||||||
*/
|
*/
|
||||||
#ifdef Z_LARGE64
|
#ifdef Z_LARGE64
|
||||||
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
|
ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *);
|
||||||
ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
|
ZEXTERN z_off64_t ZEXPORT gzseek64(gzFile, z_off64_t, int);
|
||||||
ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
|
ZEXTERN z_off64_t ZEXPORT gztell64(gzFile);
|
||||||
ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
|
ZEXTERN z_off64_t ZEXPORT gzoffset64(gzFile);
|
||||||
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));
|
ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off64_t);
|
||||||
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
|
ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off64_t);
|
||||||
ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off64_t));
|
ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off64_t);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64)
|
#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64)
|
||||||
|
|
@ -1881,50 +1884,50 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
|
||||||
# define crc32_combine_gen crc32_combine_gen64
|
# define crc32_combine_gen crc32_combine_gen64
|
||||||
# endif
|
# endif
|
||||||
# ifndef Z_LARGE64
|
# ifndef Z_LARGE64
|
||||||
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
|
ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *);
|
||||||
ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
|
ZEXTERN z_off_t ZEXPORT gzseek64(gzFile, z_off_t, int);
|
||||||
ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
|
ZEXTERN z_off_t ZEXPORT gztell64(gzFile);
|
||||||
ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile));
|
ZEXTERN z_off_t ZEXPORT gzoffset64(gzFile);
|
||||||
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
|
ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off_t);
|
||||||
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
|
ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off_t);
|
||||||
ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off_t));
|
ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off_t);
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));
|
ZEXTERN gzFile ZEXPORT gzopen(const char *, const char *);
|
||||||
ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int));
|
ZEXTERN z_off_t ZEXPORT gzseek(gzFile, z_off_t, int);
|
||||||
ZEXTERN z_off_t ZEXPORT gztell OF((gzFile));
|
ZEXTERN z_off_t ZEXPORT gztell(gzFile);
|
||||||
ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile));
|
ZEXTERN z_off_t ZEXPORT gzoffset(gzFile);
|
||||||
ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
|
ZEXTERN uLong ZEXPORT adler32_combine(uLong, uLong, z_off_t);
|
||||||
ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
|
ZEXTERN uLong ZEXPORT crc32_combine(uLong, uLong, z_off_t);
|
||||||
ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t));
|
ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else /* Z_SOLO */
|
#else /* Z_SOLO */
|
||||||
|
|
||||||
ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
|
ZEXTERN uLong ZEXPORT adler32_combine(uLong, uLong, z_off_t);
|
||||||
ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
|
ZEXTERN uLong ZEXPORT crc32_combine(uLong, uLong, z_off_t);
|
||||||
ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t));
|
ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t);
|
||||||
|
|
||||||
#endif /* !Z_SOLO */
|
#endif /* !Z_SOLO */
|
||||||
|
|
||||||
/* undocumented functions */
|
/* undocumented functions */
|
||||||
ZEXTERN const char * ZEXPORT zError OF((int));
|
ZEXTERN const char * ZEXPORT zError(int);
|
||||||
ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp));
|
ZEXTERN int ZEXPORT inflateSyncPoint(z_streamp);
|
||||||
ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void));
|
ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table(void);
|
||||||
ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int));
|
ZEXTERN int ZEXPORT inflateUndermine(z_streamp, int);
|
||||||
ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int));
|
ZEXTERN int ZEXPORT inflateValidate(z_streamp, int);
|
||||||
ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF((z_streamp));
|
ZEXTERN unsigned long ZEXPORT inflateCodesUsed(z_streamp);
|
||||||
ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp));
|
ZEXTERN int ZEXPORT inflateResetKeep(z_streamp);
|
||||||
ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp));
|
ZEXTERN int ZEXPORT deflateResetKeep(z_streamp);
|
||||||
#if defined(_WIN32) && !defined(Z_SOLO)
|
#if defined(_WIN32) && !defined(Z_SOLO)
|
||||||
ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path,
|
ZEXTERN gzFile ZEXPORT gzopen_w(const wchar_t *path,
|
||||||
const char *mode));
|
const char *mode);
|
||||||
#endif
|
#endif
|
||||||
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
||||||
# ifndef Z_SOLO
|
# ifndef Z_SOLO
|
||||||
ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file,
|
ZEXTERN int ZEXPORTVA gzvprintf(gzFile file,
|
||||||
const char *format,
|
const char *format,
|
||||||
va_list va));
|
va_list va);
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
60
thirdparty/zlib/zutil.c
vendored
60
thirdparty/zlib/zutil.c
vendored
|
|
@ -24,13 +24,11 @@ z_const char * const z_errmsg[10] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const char * ZEXPORT zlibVersion()
|
const char * ZEXPORT zlibVersion(void) {
|
||||||
{
|
|
||||||
return ZLIB_VERSION;
|
return ZLIB_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
uLong ZEXPORT zlibCompileFlags()
|
uLong ZEXPORT zlibCompileFlags(void) {
|
||||||
{
|
|
||||||
uLong flags;
|
uLong flags;
|
||||||
|
|
||||||
flags = 0;
|
flags = 0;
|
||||||
|
|
@ -121,9 +119,7 @@ uLong ZEXPORT zlibCompileFlags()
|
||||||
# endif
|
# endif
|
||||||
int ZLIB_INTERNAL z_verbose = verbose;
|
int ZLIB_INTERNAL z_verbose = verbose;
|
||||||
|
|
||||||
void ZLIB_INTERNAL z_error(m)
|
void ZLIB_INTERNAL z_error(char *m) {
|
||||||
char *m;
|
|
||||||
{
|
|
||||||
fprintf(stderr, "%s\n", m);
|
fprintf(stderr, "%s\n", m);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
@ -132,9 +128,7 @@ void ZLIB_INTERNAL z_error(m)
|
||||||
/* exported to allow conversion of error code to string for compress() and
|
/* exported to allow conversion of error code to string for compress() and
|
||||||
* uncompress()
|
* uncompress()
|
||||||
*/
|
*/
|
||||||
const char * ZEXPORT zError(err)
|
const char * ZEXPORT zError(int err) {
|
||||||
int err;
|
|
||||||
{
|
|
||||||
return ERR_MSG(err);
|
return ERR_MSG(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -148,22 +142,14 @@ const char * ZEXPORT zError(err)
|
||||||
|
|
||||||
#ifndef HAVE_MEMCPY
|
#ifndef HAVE_MEMCPY
|
||||||
|
|
||||||
void ZLIB_INTERNAL zmemcpy(dest, source, len)
|
void ZLIB_INTERNAL zmemcpy(Bytef* dest, const Bytef* source, uInt len) {
|
||||||
Bytef* dest;
|
|
||||||
const Bytef* source;
|
|
||||||
uInt len;
|
|
||||||
{
|
|
||||||
if (len == 0) return;
|
if (len == 0) return;
|
||||||
do {
|
do {
|
||||||
*dest++ = *source++; /* ??? to be unrolled */
|
*dest++ = *source++; /* ??? to be unrolled */
|
||||||
} while (--len != 0);
|
} while (--len != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZLIB_INTERNAL zmemcmp(s1, s2, len)
|
int ZLIB_INTERNAL zmemcmp(const Bytef* s1, const Bytef* s2, uInt len) {
|
||||||
const Bytef* s1;
|
|
||||||
const Bytef* s2;
|
|
||||||
uInt len;
|
|
||||||
{
|
|
||||||
uInt j;
|
uInt j;
|
||||||
|
|
||||||
for (j = 0; j < len; j++) {
|
for (j = 0; j < len; j++) {
|
||||||
|
|
@ -172,10 +158,7 @@ int ZLIB_INTERNAL zmemcmp(s1, s2, len)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZLIB_INTERNAL zmemzero(dest, len)
|
void ZLIB_INTERNAL zmemzero(Bytef* dest, uInt len) {
|
||||||
Bytef* dest;
|
|
||||||
uInt len;
|
|
||||||
{
|
|
||||||
if (len == 0) return;
|
if (len == 0) return;
|
||||||
do {
|
do {
|
||||||
*dest++ = 0; /* ??? to be unrolled */
|
*dest++ = 0; /* ??? to be unrolled */
|
||||||
|
|
@ -216,8 +199,7 @@ local ptr_table table[MAX_PTR];
|
||||||
* a protected system like OS/2. Use Microsoft C instead.
|
* a protected system like OS/2. Use Microsoft C instead.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size)
|
voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) {
|
||||||
{
|
|
||||||
voidpf buf;
|
voidpf buf;
|
||||||
ulg bsize = (ulg)items*size;
|
ulg bsize = (ulg)items*size;
|
||||||
|
|
||||||
|
|
@ -242,8 +224,7 @@ voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size)
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr)
|
void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
|
||||||
{
|
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
|
|
@ -279,14 +260,12 @@ void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr)
|
||||||
# define _hfree hfree
|
# define _hfree hfree
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, uInt items, uInt size)
|
voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, uInt items, uInt size) {
|
||||||
{
|
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
return _halloc((long)items, size);
|
return _halloc((long)items, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr)
|
void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
|
||||||
{
|
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
_hfree(ptr);
|
_hfree(ptr);
|
||||||
}
|
}
|
||||||
|
|
@ -299,25 +278,18 @@ void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr)
|
||||||
#ifndef MY_ZCALLOC /* Any system without a special alloc function */
|
#ifndef MY_ZCALLOC /* Any system without a special alloc function */
|
||||||
|
|
||||||
#ifndef STDC
|
#ifndef STDC
|
||||||
extern voidp malloc OF((uInt size));
|
extern voidp malloc(uInt size);
|
||||||
extern voidp calloc OF((uInt items, uInt size));
|
extern voidp calloc(uInt items, uInt size);
|
||||||
extern void free OF((voidpf ptr));
|
extern void free(voidpf ptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
voidpf ZLIB_INTERNAL zcalloc(opaque, items, size)
|
voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) {
|
||||||
voidpf opaque;
|
|
||||||
unsigned items;
|
|
||||||
unsigned size;
|
|
||||||
{
|
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
|
return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
|
||||||
(voidpf)calloc(items, size);
|
(voidpf)calloc(items, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZLIB_INTERNAL zcfree(opaque, ptr)
|
void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
|
||||||
voidpf opaque;
|
|
||||||
voidpf ptr;
|
|
||||||
{
|
|
||||||
(void)opaque;
|
(void)opaque;
|
||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
47
thirdparty/zlib/zutil.h
vendored
47
thirdparty/zlib/zutil.h
vendored
|
|
@ -1,5 +1,5 @@
|
||||||
/* zutil.h -- internal interface and configuration of the compression library
|
/* zutil.h -- internal interface and configuration of the compression library
|
||||||
* Copyright (C) 1995-2022 Jean-loup Gailly, Mark Adler
|
* Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -56,7 +56,7 @@ typedef unsigned long ulg;
|
||||||
extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||||
/* (size given to avoid silly warnings with Visual C++) */
|
/* (size given to avoid silly warnings with Visual C++) */
|
||||||
|
|
||||||
#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
|
#define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)]
|
||||||
|
|
||||||
#define ERR_RETURN(strm,err) \
|
#define ERR_RETURN(strm,err) \
|
||||||
return (strm->msg = ERR_MSG(err), (err))
|
return (strm->msg = ERR_MSG(err), (err))
|
||||||
|
|
@ -137,17 +137,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MACOS) || defined(TARGET_OS_MAC)
|
#if defined(MACOS)
|
||||||
# define OS_CODE 7
|
# define OS_CODE 7
|
||||||
# ifndef Z_SOLO
|
|
||||||
# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
|
|
||||||
# include <unix.h> /* for fdopen */
|
|
||||||
# else
|
|
||||||
# ifndef fdopen
|
|
||||||
# define fdopen(fd,mode) NULL /* No fdopen() */
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __acorn
|
#ifdef __acorn
|
||||||
|
|
@ -170,18 +161,6 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||||
# define OS_CODE 19
|
# define OS_CODE 19
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_BEOS_) || defined(RISCOS)
|
|
||||||
# define fdopen(fd,mode) NULL /* No fdopen() */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
|
|
||||||
# if defined(_WIN32_WCE)
|
|
||||||
# define fdopen(fd,mode) NULL /* No fdopen() */
|
|
||||||
# else
|
|
||||||
# define fdopen(fd,type) _fdopen(fd,type)
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__BORLANDC__) && !defined(MSDOS)
|
#if defined(__BORLANDC__) && !defined(MSDOS)
|
||||||
#pragma warn -8004
|
#pragma warn -8004
|
||||||
#pragma warn -8008
|
#pragma warn -8008
|
||||||
|
|
@ -191,9 +170,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||||
/* provide prototypes for these when building zlib without LFS */
|
/* provide prototypes for these when building zlib without LFS */
|
||||||
#if !defined(_WIN32) && \
|
#if !defined(_WIN32) && \
|
||||||
(!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
|
(!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
|
||||||
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
|
ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off_t);
|
||||||
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
|
ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off_t);
|
||||||
ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off_t));
|
ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off_t);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* common defaults */
|
/* common defaults */
|
||||||
|
|
@ -232,16 +211,16 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||||
# define zmemzero(dest, len) memset(dest, 0, len)
|
# define zmemzero(dest, len) memset(dest, 0, len)
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
|
void ZLIB_INTERNAL zmemcpy(Bytef* dest, const Bytef* source, uInt len);
|
||||||
int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
|
int ZLIB_INTERNAL zmemcmp(const Bytef* s1, const Bytef* s2, uInt len);
|
||||||
void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));
|
void ZLIB_INTERNAL zmemzero(Bytef* dest, uInt len);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Diagnostic functions */
|
/* Diagnostic functions */
|
||||||
#ifdef ZLIB_DEBUG
|
#ifdef ZLIB_DEBUG
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
extern int ZLIB_INTERNAL z_verbose;
|
extern int ZLIB_INTERNAL z_verbose;
|
||||||
extern void ZLIB_INTERNAL z_error OF((char *m));
|
extern void ZLIB_INTERNAL z_error(char *m);
|
||||||
# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
|
# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
|
||||||
# define Trace(x) {if (z_verbose>=0) fprintf x ;}
|
# define Trace(x) {if (z_verbose>=0) fprintf x ;}
|
||||||
# define Tracev(x) {if (z_verbose>0) fprintf x ;}
|
# define Tracev(x) {if (z_verbose>0) fprintf x ;}
|
||||||
|
|
@ -258,9 +237,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef Z_SOLO
|
#ifndef Z_SOLO
|
||||||
voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
|
voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items,
|
||||||
unsigned size));
|
unsigned size);
|
||||||
void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr));
|
void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ZALLOC(strm, items, size) \
|
#define ZALLOC(strm, items, size) \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue