Reorganise external libs to separate subdirectory (#4996)

* chore(PCRE): properly detect library type on newer macOS

* chore(ZLIB): move source files to own zlib directory and update CMake files.

* chore(PCRE): move source files to own pcre2 directory and update CMake files.

* chore(UTF8PROC): move source files to own utf8proc directory and update CMake files.

* chore(ZLIB): remove header files

* chore(PDJSON): move source files to own pdjson directory and update CMake files.

* chore(SQLite3): move source files to own sqlite3 directory and update CMake files.

* chore(UNBUNDLED): Correct includes.

* chore(expat): move source files to own expat directory and update CMake files.

* chore(wepoll): move source files to own wepoll directory and update CMake files.

* chore(7zip): move source files to own 7zip directory and update CMake files.

* chore(CMake): fix compile and link flags for dependent static libraries

* chore(CMake): set PCRE2_STATIC when building PCRE2.

* chore(SQLite3): Set SQLITE_THREADSAFE for unbundled build, add warnings.

* chore(CMake): Modifications to build and link properly static target libraries (using OBJECT library type and link using BUILD_LOCAL_INTERFACE)

* chore(CMake): fix order of includes in main CMakeLists.txt.

* chore(CI): Build mysql tests with cmake.

* chore(CI): Build mongodb, redis, sqlite no parser tests with cmake.

* chore(CI): Build odbc tests with cmake.

* chore(CI): Build more ations with cmake, other fixes.

* chore(CI): Fixes for macOS

* chore(CMake): extract hpdf and png files to own directories in dependencies

* fix(CMake): include dependencies after all module dependencies are resolved.

* fix(CMake): Improve dependency handling of dependencies to compile them only when necessary.

* fix(CMake): PDF: move t4.h to proper directory, modify include.

* fix(CMake): Fixes to link properly on all platforms.

* fix(CMAKE): Wrong ENABLE for SQLITE

* enh(PDF): Remove dependencies on hpdf headers from Poco::PDF interface and make usage of hpdf only internal.

* enh(CI): Convert more jobs to use cmake.

* enh(CI): Convert macOS sanitizer jobs to use cmake.

* enh(mkrelease): Copy dependencies when creating release package.

* eng(CMake): Add missing POCO_SO option to enable/disable small object optimization.

* enh(CI): Run linux sanitizer with cmake, various fixes and improvements.

* fix(CMake): bundled build: ZLIB::ZLIB is already linked with Foundation, no need to link again to Poco::Zip

* fix(CI): vptr undefined sanitizer causes foundation tests to fail when linking, disable it

* chore(tests): Minor code improvements.

* fix(AsyncNotificationCenter): fix a data race with member _listsEmpty by making it atomic.

* eng(CI): Add a few more time sensitive tests to cppignore.lnx

* chore(Thread): Code updates.

* eng(CI): Add a few more time sensitive tests to cppignore.lnx

* fix(AsyncNotificationCenter): must join threads to avoid data race in dtor.

* chore(CI): Pass TSAN_OPTIONS to jobs where necessary

* chore(CI): run rests without sudo, compile with parallelism

* chore(CI): Use POCO_MINIMAL_BUILD to simplify CMake configure lines.

* chore(CI): Add 32-bit Windows VS build

* chore(CMake): Printout cmake generator platform.

* chore(CMake): linux-gcc-make-armv7l -> linux-gcc-cmake-armv7l

* chore(ci): windows-2025-msvc-cmake-32bit -> windows-2025-msvc-cmake-Win32

* chore(CI): Convert all remaining jobs to CMake.

* chore(make): Prevent building with make.

* chore(CodeQL): exclude all external code from CodeQL checks.

* chore(macOS): Set min support version to 13.3 to properly support C++20 standard.
This commit is contained in:
Matej Kenda
2025-09-11 17:11:29 +02:00
committed by GitHub
parent ac270824ad
commit 7a23a039f9
377 changed files with 2491 additions and 27452 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -72,29 +72,6 @@ jobs:
overwrite: true
retention-days: 1
linux-gcc-make-mkrelease:
runs-on: ubuntu-22.04
needs: mkrelease
steps:
- uses: actions/download-artifact@v4
with:
name: posix-archives
- run: sudo apt -y update && sudo apt -y install libssl-dev unixodbc-dev redis-server libmysqlclient-dev
- run: rm poco-*-all.tar.gz
- run: mkdir poco && cd poco && tar xfz ../poco-*.tar.gz --strip-components=1
- run: cd poco && ./configure --everything && make all -s -j`nproc`
linux-gcc-make-mkrelease-all:
runs-on: ubuntu-22.04
needs: mkrelease
steps:
- uses: actions/download-artifact@v4
with:
name: posix-archives
- run: sudo apt -y update && sudo apt -y install libssl-dev unixodbc-dev redis-server libmysqlclient-dev
- run: mkdir poco && cd poco && tar xfz ../poco-*-all.tar.gz --strip-components=1
- run: cd poco && ./configure --everything && make all -s -j`nproc`
linux-gcc-cmake-mkrelease:
runs-on: ubuntu-22.04
needs: mkrelease
@@ -118,31 +95,6 @@ jobs:
- run: mkdir poco && cd poco && tar xfz ../poco-*-all.tar.gz --strip-components=1
- run: cmake -Spoco -Bcmake-build -GNinja -DENABLE_PDF=OFF -DENABLE_TESTS=ON && cmake --build cmake-build --target all
windows-2022-msvc-buildwin-x64-mkrelease-all:
runs-on: windows-2022
needs: mkrelease_win
steps:
- uses: actions/download-artifact@v4
with:
name: windows-archives
- run: |
7z x poco-*-all.zip
cd poco-*-all
.\buildwin.ps1 -poco_base . -vs 170 -action build -linkmode all -config release -platform x64 -samples -tests -omit "Crypto,NetSSL_OpenSSL,Data/MySQL,Data/PostgreSQL,JWT"
windows-2022-msvc-buildwin-x64-mkrelease:
runs-on: windows-2022
needs: mkrelease_win
steps:
- uses: actions/download-artifact@v4
with:
name: windows-archives
- run: |
rm poco-*-all.zip
7z x poco-*.zip
cd poco-*
.\buildwin.ps1 -poco_base . -vs 170 -action build -linkmode all -config release -platform x64 -samples -tests
windows-2022-msvc-cmake-mkrelease-all:
runs-on: windows-2022
needs: mkrelease_win

View File

@@ -1,4 +1,8 @@
cmake_minimum_required(VERSION 3.15.0)
cmake_minimum_required(VERSION 3.26.0)
# MacOS version that has support for C++20
# Must be set before the project.
set(CMAKE_OSX_DEPLOYMENT_TARGET "13.3" CACHE STRING "macOS minimum supported target")
project(Poco)
@@ -227,6 +231,9 @@ option(POCO_UNBUNDLED
option(POCO_SQLITE_UNBUNDLED
"Set to OFF|ON (default is OFF) to control linking sqlite dependency as external" OFF)
option(POCO_SOO
"Set to OFF|ON (default is ON) to control small object optimization in Poco::Foundation" ON)
if (POCO_UNBUNDLED)
set(POCO_SQLITE_UNBUNDLED ON CACHE BOOL "Enable Unbundled SQLite" FORCE)
endif()
@@ -257,10 +264,12 @@ if(ENABLE_FUZZING)
endif()
if(POCO_UNBUNDLED)
message(STATUS "Using external sqlite, zlib, pcre2, expat, libpng, ...")
elseif (POCO_SQLITE_UNBUNDLED)
message(STATUS "Using external sqlite")
message(STATUS "Using internal zlib, pcre2, expat, libpng, ...")
if (POCO_SQLITE_UNBUNDLED)
message(STATUS "Using external sqlite")
message(STATUS "Using internal zlib, pcre2, expat, libpng, ...")
else()
message(STATUS "Using external sqlite, zlib, pcre2, expat, libpng, ...")
endif()
else()
message(STATUS "Using internal sqlite, zlib, pcre2, expat, libpng, ...")
endif()
@@ -402,6 +411,8 @@ endif()
# - add required subdirectories
add_subdirectory(dependencies)
if(ENABLE_FOUNDATION)
add_subdirectory(Foundation)
list(APPEND Poco_COMPONENTS "Foundation")
@@ -623,8 +634,8 @@ install(
Devel
)
message(STATUS "CMake ${CMAKE_VERSION} successfully configured ${PROJECT_NAME} using ${CMAKE_GENERATOR} generator")
message(STATUS "${PROJECT_NAME} package version: ${PROJECT_VERSION}")
message(STATUS "CMake '${CMAKE_VERSION}' successfully configured '${PROJECT_NAME}'")
message(STATUS "${PROJECT_NAME} package version: '${PROJECT_VERSION}'")
if(BUILD_SHARED_LIBS)
message(STATUS "Building dynamic libraries")
else()
@@ -637,6 +648,8 @@ endif()
message(STATUS "[cmake] Build for OS type: ${CMAKE_SYSTEM_NAME}")
message(STATUS "[cmake] Build for OS version: ${CMAKE_SYSTEM_VERSION}")
message(STATUS "[cmake] Build for CPU type: ${CMAKE_SYSTEM_PROCESSOR}")
message(STATUS "[cmake] Generator: ${CMAKE_GENERATOR}")
message(STATUS "[cmake] Generator platorm: ${CMAKE_GENERATOR_PLATFORM}")
message(STATUS "[cmake] Build type: ${CMAKE_BUILD_TYPE}")
string(TOUPPER "${CMAKE_BUILD_TYPE}" BUILD_TYPE)
message(STATUS "[cmake] Build with C++ flags: ${CMAKE_CXX_FLAGS_${BUILD_TYPE}} ${CMAKE_CXX_FLAGS}")

View File

@@ -6,15 +6,6 @@ POCO_SOURCES_AUTO(SQLITE_SRCS ${SRCS_G})
file(GLOB_RECURSE HDRS_G "include/*.h")
POCO_HEADERS_AUTO(SQLITE_SRCS ${HDRS_G})
if(POCO_SQLITE_UNBUNDLED)
find_package(SQLite3 REQUIRED)
else()
# sqlite3
POCO_SOURCES(SQLITE_SRCS sqlite3
src/sqlite3.c
)
endif()
# Version Resource
if(MSVC AND BUILD_SHARED_LIBS)
source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc)
@@ -22,6 +13,12 @@ if(MSVC AND BUILD_SHARED_LIBS)
endif()
add_library(DataSQLite ${SQLITE_SRCS})
if (POCO_UNBUNDLED)
target_link_libraries(DataSQLite PRIVATE SQLite::SQLite3)
target_compile_definitions(DataSQLite PUBLIC POCO_SQLITE_UNBUNDLED)
else()
target_link_libraries(DataSQLite PRIVATE "$<BUILD_LOCAL_INTERFACE:SQLite::SQLite3>")
endif()
add_library(Poco::DataSQLite ALIAS DataSQLite)
set_target_properties(DataSQLite
@@ -38,28 +35,6 @@ target_include_directories(DataSQLite
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
if(POCO_SQLITE_UNBUNDLED)
target_link_libraries(DataSQLite PUBLIC SQLite::SQLite3)
target_compile_definitions(DataSQLite PUBLIC POCO_SQLITE_UNBUNDLED)
target_compile_definitions(DataSQLite PRIVATE
SQLITE_THREADSAFE=1
)
else()
target_compile_definitions(DataSQLite PRIVATE
SQLITE_THREADSAFE=1
SQLITE_DISABLE_LFS
SQLITE_OMIT_UTF16
SQLITE_OMIT_PROGRESS_CALLBACK
SQLITE_OMIT_COMPLETE
SQLITE_OMIT_TCL_VARIABLE
SQLITE_OMIT_DEPRECATED
)
option(ENABLE_DATA_SQLITE_FTS5 "Enable SQLite FTS5 Extension" OFF)
if(ENABLE_DATA_SQLITE_FTS5)
target_compile_definitions(DataSQLite PRIVATE SQLITE_ENABLE_FTS5)
endif()
endif()
POCO_INSTALL(DataSQLite)
POCO_GENERATE_PACKAGE(DataSQLite)

View File

@@ -23,7 +23,7 @@
#include "Poco/Data/LOB.h"
#include "Poco/Any.h"
#include "Poco/Dynamic/Var.h"
#include "sqlite3.h"
#include <sqlite3.h>
namespace Poco {

View File

@@ -33,7 +33,7 @@
#include "Poco/UTFString.h"
#include "Poco/Any.h"
#include "Poco/Dynamic/Var.h"
#include "sqlite3.h"
#include <sqlite3.h>
#include <vector>
#include <utility>

View File

@@ -15,12 +15,7 @@
#include "Poco/Data/SQLite/Connector.h"
#include "Poco/Data/SQLite/SessionImpl.h"
#include "Poco/Data/SessionFactory.h"
#if defined(POCO_SQLITE_UNBUNDLED)
#include <sqlite3.h>
#else
#include "sqlite3.h"
#endif
namespace Poco {
namespace Data {

View File

@@ -21,11 +21,7 @@
#include "Poco/DateTimeParser.h"
#include "Poco/Exception.h"
#include "Poco/Debugger.h"
#if defined(POCO_SQLITE_UNBUNDLED)
#include <sqlite3.h>
#else
#include "sqlite3.h"
#endif
#include <cstdlib>

View File

@@ -18,11 +18,7 @@
#include "Poco/String.h"
#include <cstdlib>
#include <cstring>
#if defined(POCO_SQLITE_UNBUNDLED)
#include <sqlite3.h>
#else
#include "sqlite3.h"
#endif
namespace Poco {

View File

@@ -21,11 +21,7 @@
#include "Poco/String.h"
#include "Poco/Mutex.h"
#include "Poco/Data/DataException.h"
#if defined(POCO_SQLITE_UNBUNDLED)
#include <sqlite3.h>
#else
#include "sqlite3.h"
#endif
#include <cstdlib>

View File

@@ -20,11 +20,7 @@
#include "Poco/String.h"
#include "Poco/Any.h"
#include "Poco/Exception.h"
#if defined(POCO_SQLITE_UNBUNDLED)
#include <sqlite3.h>
#else
#include "sqlite3.h"
#endif
#ifndef SQLITE_OPEN_URI
@@ -42,6 +38,11 @@ const std::string Utility::TRANSACTION_TYPE_PROPERTY_KEY = "transactionType";
const int Utility::THREAD_MODE_SINGLE = SQLITE_CONFIG_SINGLETHREAD;
const int Utility::THREAD_MODE_MULTI = SQLITE_CONFIG_MULTITHREAD;
const int Utility::THREAD_MODE_SERIAL = SQLITE_CONFIG_SERIALIZED;
#if defined(POCO_SQLITE_UNBUNDLED)
#warning "Utility::_threadMode is set based on SQLITE_THREADSAFE, which may not reflect the actual threading mode used by unbundled SQLite"
#endif
int Utility::_threadMode =
#if (SQLITE_THREADSAFE == 0)
SQLITE_CONFIG_SINGLETHREAD;

View File

@@ -2882,7 +2882,7 @@ void SQLiteTest::testThreadModes()
typedef std::vector<int> ModeVec;
assertTrue (Utility::isThreadSafe());
assertTrue (Utility::getThreadMode() == Utility::THREAD_MODE_SERIAL);
assertEqual (Utility::getThreadMode(), Utility::THREAD_MODE_SERIAL);
const int datasize = 100;
ModeVec mode;

View File

@@ -27,19 +27,14 @@ POCO_MESSAGES(SRCS Logging src/pocomsg.mc)
# If POCO_UNBUNDLED is enabled we try to find the required packages
# The configuration will fail if the packages are not found
if(POCO_UNBUNDLED)
find_package(PCRE2 REQUIRED)
find_package(ZLIB REQUIRED)
find_package(Utf8Proc REQUIRED)
# pcre2 source files are linked with Foundation when shared library pcre2 is linked.
# When linking pcre2 as static library the symbols are accessible.
get_target_property(_PCRE2TYPE Pcre2::Pcre2 TYPE)
if("${_PCRE2TYPE}" STREQUAL "SHARED_LIBRARY")
#HACK: Unicode.cpp requires functions from these files. The can't be taken from the library
POCO_SOURCES(SRCS RegExp
src/pcre2_ucd.c
src/pcre2_tables.c
)
# HACK: Unicode.cpp requires functions from these files.
# They can't be used directly from the library
POCO_SOURCES(SRCS RegExp ${EMBEDDED_PCRE2_SOURCES} )
elseif ("${_PCRE2TYPE}" STREQUAL "STATIC_LIBRARY")
message(STATUS "PCRE2: linking static library.")
else()
@@ -47,60 +42,29 @@ if(POCO_UNBUNDLED)
endif()
unset(_PCRE2TYPE)
else()
# pcre2
POCO_SOURCES(SRCS pcre2
src/pcre2_auto_possess.c
src/pcre2_chartables.c
src/pcre2_chkdint.c
src/pcre2_compile.c
src/pcre2_config.c
src/pcre2_context.c
src/pcre2_convert.c
src/pcre2_dfa_match.c
src/pcre2_error.c
src/pcre2_extuni.c
src/pcre2_find_bracket.c
src/pcre2_jit_compile.c
src/pcre2_maketables.c
src/pcre2_match.c
src/pcre2_match_data.c
src/pcre2_newline.c
src/pcre2_ord2utf.c
src/pcre2_pattern_info.c
src/pcre2_script_run.c
src/pcre2_serialize.c
src/pcre2_string_utils.c
src/pcre2_study.c
src/pcre2_substitute.c
src/pcre2_substring.c
src/pcre2_tables.c
src/pcre2_ucd.c
src/pcre2_valid_utf.c
src/pcre2_xclass.c
)
POCO_SOURCES(SRCS zlib
src/adler32.c
src/compress.c
src/crc32.c
src/deflate.c
src/infback.c
src/inffast.c
src/inflate.c
src/inftrees.c
src/trees.c
src/zutil.c
)
POCO_SOURCES(SRCS utf8proc
src/utf8proc.c
)
endif(POCO_UNBUNDLED)
add_library(Foundation ${SRCS})
if (POCO_UNBUNDLED)
target_link_libraries(Foundation PRIVATE ZLIB::ZLIB Pcre2::Pcre2 Utf8Proc::Utf8Proc)
target_include_directories(Foundation PRIVATE ${EMBEDDED_PCRE2_INCLUDE})
target_compile_definitions(Foundation PUBLIC POCO_UNBUNDLED)
else()
# BUILD_LOCAL_INTERFACE is used to ensure that the dependent libraries are used
# only in the build process and are not exported.
# See also:
# https://discourse.cmake.org/t/cmake-error-install-export-projecttargets-includes-target-xxx-which-requires-target-yyy-that-is-not-in-any-export-set/7344/2
# https://cmake.org/cmake/help/latest/release/3.26.html#generator-expressions
target_link_libraries(
Foundation
PRIVATE
"$<BUILD_LOCAL_INTERFACE:ZLIB::ZLIB>"
"$<BUILD_LOCAL_INTERFACE:Pcre2::Pcre2>"
"$<BUILD_LOCAL_INTERFACE:Utf8Proc::Utf8Proc>"
)
target_compile_definitions(Foundation PUBLIC UTF8PROC_STATIC)
endif()
add_library(Poco::Foundation ALIAS Foundation)
set_target_properties(Foundation
PROPERTIES
@@ -109,12 +73,9 @@ set_target_properties(Foundation
DEFINE_SYMBOL Foundation_EXPORTS
)
if(POCO_UNBUNDLED)
target_link_libraries(Foundation PRIVATE Pcre2::Pcre2 ZLIB::ZLIB Utf8Proc::Utf8Proc)
target_compile_definitions(Foundation PUBLIC POCO_UNBUNDLED)
else()
target_compile_definitions(Foundation PUBLIC UTF8PROC_STATIC)
endif(POCO_UNBUNDLED)
if (NOT POCO_SOO)
target_compile_definitions(Foundation PUBLIC POCO_NO_SOO)
endif()
target_compile_definitions(Foundation PUBLIC POCO_CMAKE)

View File

@@ -167,7 +167,7 @@ private:
std::mutex _listsMutex;
/// Mutex to protect access to the lists of notifications.
/// It is used to ensure that workers can safely access the lists.
bool _listsEmpty { true };
std::atomic<bool> _listsEmpty { true };
std::condition_variable _listsEmptyCondition;
// Condition variable to notify workers when new notifications are added to lists.

View File

@@ -191,6 +191,10 @@ void AsyncNotificationCenter::stop()
{
t.request_stop();
}
for (auto& t: _workers)
{
if (t.joinable()) t.join();
}
// TODO: Should the observer lists be cleared here or
// shall the workers send all of them to observers and then finish?

View File

@@ -13,11 +13,7 @@
#include "Poco/Checksum.h"
#if defined(POCO_UNBUNDLED)
#include <zlib.h>
#else
#include "zlib.h"
#endif
namespace Poco {

View File

@@ -15,11 +15,7 @@
#include "Poco/DeflatingStream.h"
#include "Poco/Exception.h"
#include <memory>
#if defined(POCO_UNBUNDLED)
#include <zlib.h>
#else
#include "zlib.h"
#endif
namespace Poco {

View File

@@ -16,11 +16,7 @@
#include "Poco/Exception.h"
#include <cstring>
#include <memory>
#if defined(POCO_UNBUNDLED)
#include <zlib.h>
#else
#include "zlib.h"
#endif
namespace Poco {

View File

@@ -15,13 +15,9 @@
#include "Poco/RegularExpression.h"
#include "Poco/Exception.h"
#include <sstream>
#if defined(POCO_UNBUNDLED)
#define PCRE2_CODE_UNIT_WIDTH 8
#include <pcre2.h>
#else
#include "pcre2_config.h"
#include "pcre2.h"
#endif
namespace

View File

@@ -43,11 +43,9 @@ public:
{
}
~RunnableHolder()
{
}
~RunnableHolder() override = default;
void run()
void run() override
{
_target.run();
}

View File

@@ -24,13 +24,7 @@
#include "Poco/Exception.h"
#include <algorithm>
#include <iterator>
#if defined(POCO_UNBUNDLED)
#include <utf8proc.h>
#else
#include "utf8proc.h"
#endif
#if !defined(POCO_OS_FAMILY_WINDOWS)

View File

@@ -17,8 +17,8 @@
extern "C"
{
#include "pcre2_config.h"
#include "pcre2_internal.h"
#include <pcre2_config.h>
#include <pcre2_internal.h>
}

View File

@@ -1,543 +0,0 @@
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#ifndef ZCONF_H
#define ZCONF_H
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
* Even better than compiling with -DZ_PREFIX would be to use configure to set
* this permanently in zconf.h using "./configure --zprefix".
*/
#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
# define Z_PREFIX_SET
/* all linked symbols and init macros */
# define _dist_code z__dist_code
# define _length_code z__length_code
# define _tr_align z__tr_align
# define _tr_flush_bits z__tr_flush_bits
# define _tr_flush_block z__tr_flush_block
# define _tr_init z__tr_init
# define _tr_stored_block z__tr_stored_block
# define _tr_tally z__tr_tally
# define adler32 z_adler32
# define adler32_combine z_adler32_combine
# define adler32_combine64 z_adler32_combine64
# define adler32_z z_adler32_z
# ifndef Z_SOLO
# define compress z_compress
# define compress2 z_compress2
# define compressBound z_compressBound
# endif
# define crc32 z_crc32
# define crc32_combine z_crc32_combine
# define crc32_combine64 z_crc32_combine64
# define crc32_combine_gen z_crc32_combine_gen
# define crc32_combine_gen64 z_crc32_combine_gen64
# define crc32_combine_op z_crc32_combine_op
# define crc32_z z_crc32_z
# define deflate z_deflate
# define deflateBound z_deflateBound
# define deflateCopy z_deflateCopy
# define deflateEnd z_deflateEnd
# define deflateGetDictionary z_deflateGetDictionary
# define deflateInit z_deflateInit
# define deflateInit2 z_deflateInit2
# define deflateInit2_ z_deflateInit2_
# define deflateInit_ z_deflateInit_
# define deflateParams z_deflateParams
# define deflatePending z_deflatePending
# define deflatePrime z_deflatePrime
# define deflateReset z_deflateReset
# define deflateResetKeep z_deflateResetKeep
# define deflateSetDictionary z_deflateSetDictionary
# define deflateSetHeader z_deflateSetHeader
# define deflateTune z_deflateTune
# define deflate_copyright z_deflate_copyright
# define get_crc_table z_get_crc_table
# ifndef Z_SOLO
# define gz_error z_gz_error
# define gz_intmax z_gz_intmax
# define gz_strwinerror z_gz_strwinerror
# define gzbuffer z_gzbuffer
# define gzclearerr z_gzclearerr
# define gzclose z_gzclose
# define gzclose_r z_gzclose_r
# define gzclose_w z_gzclose_w
# define gzdirect z_gzdirect
# define gzdopen z_gzdopen
# define gzeof z_gzeof
# define gzerror z_gzerror
# define gzflush z_gzflush
# define gzfread z_gzfread
# define gzfwrite z_gzfwrite
# define gzgetc z_gzgetc
# define gzgetc_ z_gzgetc_
# define gzgets z_gzgets
# define gzoffset z_gzoffset
# define gzoffset64 z_gzoffset64
# define gzopen z_gzopen
# define gzopen64 z_gzopen64
# ifdef _WIN32
# define gzopen_w z_gzopen_w
# endif
# define gzprintf z_gzprintf
# define gzputc z_gzputc
# define gzputs z_gzputs
# define gzread z_gzread
# define gzrewind z_gzrewind
# define gzseek z_gzseek
# define gzseek64 z_gzseek64
# define gzsetparams z_gzsetparams
# define gztell z_gztell
# define gztell64 z_gztell64
# define gzungetc z_gzungetc
# define gzvprintf z_gzvprintf
# define gzwrite z_gzwrite
# endif
# define inflate z_inflate
# define inflateBack z_inflateBack
# define inflateBackEnd z_inflateBackEnd
# define inflateBackInit z_inflateBackInit
# define inflateBackInit_ z_inflateBackInit_
# define inflateCodesUsed z_inflateCodesUsed
# define inflateCopy z_inflateCopy
# define inflateEnd z_inflateEnd
# define inflateGetDictionary z_inflateGetDictionary
# define inflateGetHeader z_inflateGetHeader
# define inflateInit z_inflateInit
# define inflateInit2 z_inflateInit2
# define inflateInit2_ z_inflateInit2_
# define inflateInit_ z_inflateInit_
# define inflateMark z_inflateMark
# define inflatePrime z_inflatePrime
# define inflateReset z_inflateReset
# define inflateReset2 z_inflateReset2
# define inflateResetKeep z_inflateResetKeep
# define inflateSetDictionary z_inflateSetDictionary
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateUndermine z_inflateUndermine
# define inflateValidate z_inflateValidate
# define inflate_copyright z_inflate_copyright
# define inflate_fast z_inflate_fast
# define inflate_table z_inflate_table
# ifndef Z_SOLO
# define uncompress z_uncompress
# define uncompress2 z_uncompress2
# endif
# define zError z_zError
# ifndef Z_SOLO
# define zcalloc z_zcalloc
# define zcfree z_zcfree
# endif
# define zlibCompileFlags z_zlibCompileFlags
# define zlibVersion z_zlibVersion
/* all zlib typedefs in zlib.h and zconf.h */
# define Byte z_Byte
# define Bytef z_Bytef
# define alloc_func z_alloc_func
# define charf z_charf
# define free_func z_free_func
# ifndef Z_SOLO
# define gzFile z_gzFile
# endif
# define gz_header z_gz_header
# define gz_headerp z_gz_headerp
# define in_func z_in_func
# define intf z_intf
# define out_func z_out_func
# define uInt z_uInt
# define uIntf z_uIntf
# define uLong z_uLong
# define uLongf z_uLongf
# define voidp z_voidp
# define voidpc z_voidpc
# define voidpf z_voidpf
/* all zlib structs in zlib.h and zconf.h */
# define gz_header_s z_gz_header_s
# define internal_state z_internal_state
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS
#endif
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
# define OS2
#endif
#if defined(_WINDOWS) && !defined(WINDOWS)
# define WINDOWS
#endif
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
# ifndef WIN32
# define WIN32
# endif
#endif
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
# ifndef SYS16BIT
# define SYS16BIT
# endif
# endif
#endif
/*
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
* than 64k bytes at a time (needed on systems with 16-bit int).
*/
#ifdef SYS16BIT
# define MAXSEG_64K
#endif
#ifdef MSDOS
# define UNALIGNED_OK
#endif
#ifdef __STDC_VERSION__
# ifndef STDC
# define STDC
# endif
# if __STDC_VERSION__ >= 199901L
# ifndef STDC99
# define STDC99
# endif
# endif
#endif
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
# define STDC
#endif
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
# define STDC
#endif
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
# define STDC
#endif
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
# define STDC
#endif
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
# define STDC
#endif
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const /* note: need a more gentle solution here */
# endif
#endif
#if defined(ZLIB_CONST) && !defined(z_const)
# define z_const const
#else
# define z_const
#endif
#ifdef Z_SOLO
# ifdef _WIN64
typedef unsigned long long z_size_t;
# else
typedef unsigned long z_size_t;
# endif
#else
# define z_longlong long long
# if defined(NO_SIZE_T)
typedef unsigned NO_SIZE_T z_size_t;
# elif defined(STDC)
# include <stddef.h>
typedef size_t z_size_t;
# else
typedef unsigned long z_size_t;
# endif
# undef z_longlong
#endif
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8
# else
# define MAX_MEM_LEVEL 9
# endif
#endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
* created by gzip. (Files created by minigzip can still be extracted by
* gzip.)
*/
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
(1 << (windowBits+2)) + (1 << (memLevel+9))
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
for small objects.
*/
/* Type declarations */
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* just define FAR to be empty.
*/
#ifdef SYS16BIT
# if defined(M_I86SM) || defined(M_I86MM)
/* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR _far
# else
# define FAR far
# endif
# endif
# if (defined(__SMALL__) || defined(__MEDIUM__))
/* Turbo C small or medium model */
# define SMALL_MEDIUM
# ifdef __BORLANDC__
# define FAR _far
# else
# define FAR far
# endif
# endif
#endif
#if defined(WINDOWS) || defined(WIN32)
/* If building or using zlib as a DLL, define ZLIB_DLL.
* This is not mandatory, but it offers a little performance increase.
*/
# ifdef ZLIB_DLL
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
# ifdef ZLIB_INTERNAL
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
# endif
# endif /* ZLIB_DLL */
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
* define ZLIB_WINAPI.
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
*/
# ifdef ZLIB_WINAPI
# ifdef FAR
# undef FAR
# endif
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
# include <windows.h>
/* No need for _export, use ZLIB.DEF instead. */
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
# define ZEXPORT WINAPI
# ifdef WIN32
# define ZEXPORTVA WINAPIV
# else
# define ZEXPORTVA FAR CDECL
# endif
# endif
#endif
#if defined (__BEOS__)
# ifdef ZLIB_DLL
# ifdef ZLIB_INTERNAL
# define ZEXPORT __declspec(dllexport)
# define ZEXPORTVA __declspec(dllexport)
# else
# define ZEXPORT __declspec(dllimport)
# define ZEXPORTVA __declspec(dllimport)
# endif
# endif
#endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif
#ifndef ZEXPORT
# define ZEXPORT
#endif
#ifndef ZEXPORTVA
# define ZEXPORTVA
#endif
#ifndef FAR
# define FAR
#endif
#if !defined(__MACTYPES__)
typedef unsigned char Byte; /* 8 bits */
#endif
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
typedef Byte FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
#ifdef STDC
typedef void const *voidpc;
typedef void FAR *voidpf;
typedef void *voidp;
#else
typedef Byte const *voidpc;
typedef Byte FAR *voidpf;
typedef Byte *voidp;
#endif
#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
# include <limits.h>
# if (UINT_MAX == 0xffffffffUL)
# define Z_U4 unsigned
# elif (ULONG_MAX == 0xffffffffUL)
# define Z_U4 unsigned long
# elif (USHRT_MAX == 0xffffffffUL)
# define Z_U4 unsigned short
# endif
#endif
#ifdef Z_U4
typedef Z_U4 z_crc_t;
#else
typedef unsigned long z_crc_t;
#endif
#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
# define Z_HAVE_UNISTD_H
#endif
#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
# define Z_HAVE_STDARG_H
#endif
#ifdef STDC
# ifndef Z_SOLO
# include <sys/types.h> /* for off_t */
# endif
#endif
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
# ifndef Z_SOLO
# include <stdarg.h> /* for va_list */
# endif
#endif
#ifdef _WIN32
# ifndef Z_SOLO
# include <stddef.h> /* for wchar_t */
# endif
#endif
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
* though the former does not conform to the LFS document), but considering
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
* equivalently requesting no 64-bit operations
*/
#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
# undef _LARGEFILE64_SOURCE
#endif
#ifndef Z_HAVE_UNISTD_H
# ifdef __WATCOMC__
# define Z_HAVE_UNISTD_H
# endif
#endif
#ifndef Z_HAVE_UNISTD_H
# if defined(_LARGEFILE64_SOURCE) && !defined(_WIN32)
# define Z_HAVE_UNISTD_H
# endif
#endif
#ifndef Z_SOLO
# if defined(Z_HAVE_UNISTD_H)
# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
# ifdef VMS
# include <unixio.h> /* for off_t */
# endif
# ifndef z_off_t
# define z_off_t off_t
# endif
# endif
#endif
#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
# define Z_LFS64
#endif
#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
# define Z_LARGE64
#endif
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
# define Z_WANT64
#endif
#if !defined(SEEK_SET) && !defined(Z_SOLO)
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
#endif
#if !defined(_WIN32) && defined(Z_LARGE64)
# define z_off64_t off64_t
#else
# if defined(_WIN32) && !defined(__GNUC__)
# define z_off64_t __int64
# else
# define z_off64_t z_off_t
# endif
#endif
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
#pragma map(deflateInit_,"DEIN")
#pragma map(deflateInit2_,"DEIN2")
#pragma map(deflateEnd,"DEEND")
#pragma map(deflateBound,"DEBND")
#pragma map(inflateInit_,"ININ")
#pragma map(inflateInit2_,"ININ2")
#pragma map(inflateEnd,"INEND")
#pragma map(inflateSync,"INSY")
#pragma map(inflateSetDictionary,"INSEDI")
#pragma map(compressBound,"CMBND")
#pragma map(inflate_table,"INTABL")
#pragma map(inflate_fast,"INFA")
#pragma map(inflate_copyright,"INCOPY")
#endif
#endif /* ZCONF_H */

File diff suppressed because it is too large Load Diff

View File

@@ -43,9 +43,7 @@ namespace
{
}
~ActiveObject()
{
}
~ActiveObject() override = default;
ActiveMethod<int, int, ActiveObject, ActiveStarter<ActiveDispatcher> > testMethod;
@@ -96,9 +94,7 @@ ActiveDispatcherTest::ActiveDispatcherTest(const std::string& name): CppUnit::Te
}
ActiveDispatcherTest::~ActiveDispatcherTest()
{
}
ActiveDispatcherTest::~ActiveDispatcherTest() = default;
void ActiveDispatcherTest::testWait()

View File

@@ -19,15 +19,11 @@ extern "C" int POCO_LIBRARY_API gimmeFive();
class PluginA: public TestPlugin
{
public:
PluginA()
{
}
PluginA() = default;
~PluginA()
{
}
~PluginA() override = default;
std::string name() const
std::string name() const override
{
return "PluginA";
}
@@ -37,15 +33,11 @@ public:
class PluginB: public TestPlugin
{
public:
PluginB()
{
}
PluginB() = default;
~PluginB()
{
}
~PluginB() override = default;
std::string name() const
std::string name() const override
{
return "PluginB";
}
@@ -55,15 +47,11 @@ public:
class PluginC: public TestPlugin
{
public:
PluginC()
{
}
PluginC() = default;
~PluginC()
{
}
~PluginC() override = default;
std::string name() const
std::string name() const override
{
return "PluginC";
}

View File

@@ -11,11 +11,7 @@
#include "TestPlugin.h"
TestPlugin::TestPlugin()
{
}
TestPlugin::TestPlugin() = default;
TestPlugin::~TestPlugin()
{
}
TestPlugin::~TestPlugin() = default;

View File

@@ -16,8 +16,15 @@
#include "Poco/Foundation.h"
#include <string>
class TestPlugin
#if !defined(POCO_OS_FAMILY_WINDOWS)
#define PLUGIN_EXPORT __attribute__((visibility("default")))
#else
#define PLUGIN_EXPORT
#endif
class PLUGIN_EXPORT TestPlugin
{
public:
TestPlugin();

View File

@@ -5,7 +5,6 @@ POCO_SOURCES_AUTO(SRCS ${SRCS_G})
# Headers
file(GLOB_RECURSE HDRS_G "include/*.h")
POCO_HEADERS_AUTO(SRCS ${HDRS_G})
POCO_SOURCES(SRCS pdjson src/pdjson.c)
# Version Resource
if(MSVC AND BUILD_SHARED_LIBS)
@@ -15,6 +14,9 @@ endif()
add_library(JSON ${SRCS})
add_library(Poco::JSON ALIAS JSON)
target_link_libraries(JSON PRIVATE "$<BUILD_LOCAL_INTERFACE:PDJson::PDJson>")
set_target_properties(JSON
PROPERTIES
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
@@ -30,14 +32,6 @@ target_include_directories(JSON
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
if(WIN32)
target_compile_definitions(JSON PRIVATE _CRT_SECURE_NO_WARNINGS)
set_source_files_properties(src/pdjson.c PROPERTIES LANGUAGE CXX)
set_property(TARGET JSON PROPERTY C_STANDARD 99)
else()
target_compile_features(JSON PUBLIC c_variadic_macros)
endif()
POCO_INSTALL(JSON)
POCO_GENERATE_PACKAGE(JSON)

View File

@@ -21,7 +21,7 @@
#include <istream>
#include <streambuf>
#include <clocale>
#include "pdjson.h"
#include <pdjson.h>
using json_stream = struct json_stream;

View File

@@ -4,6 +4,8 @@
# The global Makefile for POCO [generated by mkrelease]
#
$(error Please build Poco with CMake)
sinclude config.make
sinclude config.build
POCO_CONFIG_INCLUDED = 1

View File

@@ -6,10 +6,6 @@ POCO_SOURCES_AUTO(SRCS ${SRCS_G})
file(GLOB_RECURSE HDRS_G "include/*.h")
POCO_HEADERS_AUTO(SRCS ${HDRS_G})
# Platform Specific
POCO_SOURCES_AUTO_PLAT(SRCS WIN32 src/wepoll.c)
POCO_HEADERS_AUTO(SRCS src/wepoll.h)
if (MSVC OR MINGW)
set(HAVE_SENDFILE ON)
else()
@@ -38,7 +34,12 @@ if(MSVC AND BUILD_SHARED_LIBS)
list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc)
endif()
add_library(Net ${SRCS})
if(WIN32)
target_link_libraries(Net PRIVATE "$<BUILD_LOCAL_INTERFACE:WEPoll::WEPoll>")
endif()
add_library(Poco::Net ALIAS Net)
set_target_properties(Net
PROPERTIES

View File

@@ -6,124 +6,26 @@ POCO_SOURCES_AUTO(SRCS ${SRCS_G})
file(GLOB_RECURSE HDRS_G "include/*.h")
POCO_HEADERS_AUTO(SRCS ${HDRS_G})
# If POCO_UNBUNDLED is enabled we try to find the required packages
# The configuration will fail if the packages are not found
if(POCO_UNBUNDLED)
find_package(ZLIB REQUIRED)
else()
# zlib
POCO_SOURCES(SRCS zlib
src/adler32.c
src/compress.c
src/crc32.c
src/deflate.c
src/infback.c
src/inffast.c
src/inflate.c
src/inftrees.c
src/trees.c
src/zutil.c
)
endif(POCO_UNBUNDLED)
# TODO: Currently only bundled is supported, in future this should also be possible
# with an unbundled version of hpdf
# hpdf
POCO_SOURCES(SRCS hpdf
src/hpdf_3dmeasure.c
src/hpdf_annotation.c
src/hpdf_array.c
src/hpdf_binary.c
src/hpdf_boolean.c
src/hpdf_catalog.c
src/hpdf_destination.c
src/hpdf_dict.c
src/hpdf_doc.c
src/hpdf_doc_png.c
src/hpdf_encoder.c
src/hpdf_encoder_cns.c
src/hpdf_encoder_cnt.c
src/hpdf_encoder_jp.c
src/hpdf_encoder_kr.c
src/hpdf_encoder_utf.c
src/hpdf_encrypt.c
src/hpdf_encryptdict.c
src/hpdf_error.c
src/hpdf_exdata.c
src/hpdf_ext_gstate.c
src/hpdf_font.c
src/hpdf_font_cid.c
src/hpdf_font_tt.c
src/hpdf_font_type1.c
src/hpdf_fontdef.c
src/hpdf_fontdef_base14.c
src/hpdf_fontdef_cid.c
src/hpdf_fontdef_cns.c
src/hpdf_fontdef_cnt.c
src/hpdf_fontdef_jp.c
src/hpdf_fontdef_kr.c
src/hpdf_fontdef_tt.c
src/hpdf_fontdef_type1.c
src/hpdf_gstate.c
src/hpdf_image.c
src/hpdf_image_ccitt.c
src/hpdf_image_png.c
src/hpdf_info.c
src/hpdf_list.c
src/hpdf_mmgr.c
src/hpdf_name.c
src/hpdf_namedict.c
src/hpdf_null.c
src/hpdf_number.c
src/hpdf_objects.c
src/hpdf_outline.c
src/hpdf_page_label.c
src/hpdf_page_operator.c
src/hpdf_pages.c
src/hpdf_pdfa.c
src/hpdf_real.c
src/hpdf_streams.c
src/hpdf_string.c
src/hpdf_u3d.c
src/hpdf_utils.c
src/hpdf_xref.c
)
if(POCO_UNBUNDLED)
find_package(PNG REQUIRED)
else()
POCO_SOURCES(SRCS libpng
src/png.c
src/pngerror.c
src/pnggccrd.c
src/pngget.c
src/pngmem.c
src/pngpread.c
src/pngread.c
src/pngrio.c
src/pngrtran.c
src/pngrutil.c
src/pngset.c
src/pngtest.c
src/pngtrans.c
src/pngvcrd.c
src/pngwio.c
src/pngwrite.c
src/pngwtran.c
src/pngwutil.c
)
endif(POCO_UNBUNDLED)
# Version Resource
if(MSVC AND BUILD_SHARED_LIBS)
source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc)
list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc)
endif()
#TODO: Can we put this with the below includes? PRIVAT eg.
include_directories("include/Poco/PDF") # zip src
add_library(PDF ${SRCS})
# TODO: Currently only bundled is supported, in future this should also be possible
# with an unbundled version of hpdf
target_link_libraries(PDF PRIVATE "$<BUILD_LOCAL_INTERFACE:HPDF::HPDF>")
if (POCO_UNBUNDLED)
target_link_libraries(PDF PRIVATE PNG::PNG)
else()
target_link_libraries(PDF PRIVATE "$<BUILD_LOCAL_INTERFACE:PNG::PNG>")
endif()
add_library(Poco::PDF ALIAS PDF)
set_target_properties(PDF
PROPERTIES
@@ -132,17 +34,6 @@ set_target_properties(PDF
DEFINE_SYMBOL PDF_EXPORTS
)
if(POCO_UNBUNDLED)
include_directories(${PNG_INCLUDE_DIR})
target_link_libraries(PDF PUBLIC ZLIB::ZLIB)
target_link_libraries(PDF PUBLIC ${PNG_LIBRARY})
target_compile_definitions(PDF PUBLIC POCO_UNBUNDLED)
else()
# libpng: Do not try to use ARM intrinsics on ARM architecture: source files not included
target_compile_definitions(PDF PRIVATE PNG_ARM_NEON_OPT=0)
endif(POCO_UNBUNDLED)
target_link_libraries(PDF PUBLIC Poco::XML Poco::Util)
target_include_directories(PDF
PUBLIC

View File

@@ -8,7 +8,6 @@
#include "Poco/PDF/PDF.h"
#include "Poco/PDF/Font.h"
#include "Poco/Dynamic/Var.h"
@@ -62,30 +61,6 @@ private:
};
//
// inlines
//
inline AttributedString& AttributedString::operator=(const std::string& content)
{
_content = content;
return *this;
}
inline AttributedString& AttributedString::operator=(const char* content)
{
_content = content;
return *this;
}
inline AttributedString::operator const std::string&()
{
return _content;
}
} } // namespace Poco::PDF

View File

@@ -21,9 +21,9 @@ namespace PDF {
class PDF_API Cell
{
public:
typedef SharedPtr<Cell> Ptr;
typedef std::map<int, std::string> FontMap;
typedef SharedPtr<FontMap> FontMapPtr;
using Ptr = SharedPtr<Cell>;
using FontMap = std::map<int, std::string>;
using FontMapPtr = SharedPtr<FontMap>;
enum Outline
{
@@ -34,7 +34,9 @@ public:
OUTLINE_BOTTOM = 8
};
Cell(const AttributedString& content = "", const std::string& name = "", FontMapPtr pFontMap = 0);
Cell(const AttributedString& content = "",
const std::string& name = "",
FontMapPtr pFontMap = nullptr);
Cell(const AttributedString& content, FontMapPtr pFontMap, const std::string& encoding = "UTF-8" , bool trueType = true, int widthAsPct=-1);
~Cell();
@@ -71,106 +73,8 @@ private:
int _widthAsPct;
};
typedef std::vector<Cell> TableRow;
//
// inlines
//
inline const std::string& Cell::getName() const
{
return _name;
}
inline void Cell::setName(const std::string& name)
{
_name = name;
}
inline const AttributedString& Cell::getContent() const
{
return _content;
}
inline void Cell::setContent(const AttributedString& content)
{
_content = content;
}
inline unsigned Cell::getOutline() const
{
return _outline;
}
inline void Cell::setOutline(Cell::Outline outline, bool show)
{
if (show) _outline |= outline;
else _outline &= ~outline;
}
inline void Cell::borderLeft(bool show)
{
setOutline(OUTLINE_LEFT, show);
}
inline void Cell::borderTop(bool show)
{
setOutline(OUTLINE_TOP, show);
}
inline void Cell::borderRight(bool show)
{
setOutline(OUTLINE_RIGHT, show);
}
inline void Cell::borderBottom(bool show)
{
setOutline(OUTLINE_BOTTOM, show);
}
inline float Cell::getLineWidth() const
{
return _lineWidth;
}
inline void Cell::setLineWidth(float width)
{
_lineWidth = width;
}
inline int Cell::getWidthAsPct() const
{
return _widthAsPct;
}
inline void Cell::setWidthAsPct(int width)
{
_widthAsPct = width;
}
inline bool Cell::hasWidth() const
{
return _widthAsPct > 0;
}
using TableRow = std::vector<Cell>;
} } // namespace Poco::PDF
#endif // PDF_Cell_INCLUDED

View File

@@ -0,0 +1,132 @@
//
// Page.h
//
// Library: PDF
// Package: PDFCore
// Module: Page
//
// Definition of the Page class.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef PDF_Declarations_INCLUDED
#define PDF_Declarations_INCLUDED
#include <vector>
// HPDF forward declatations to avoid including hpdf.h in header files
struct _HPDF_TransMatrix;
using HPDF_TransMatrix =_HPDF_TransMatrix;
struct _HPDF_Rect;
using HPDF_Rect =_HPDF_Rect;
struct _HPDF_Point;
using HPDF_Point =_HPDF_Point;
//enum _HPDF_LineJoin;
//using HPDF_LineJoin =_HPDF_LineJoin;
struct _HPDF_DashMode;
using HPDF_DashMode =_HPDF_DashMode;
struct _HPDF_RGBColor;
using HPDF_RGBColor =_HPDF_RGBColor;
struct _HPDF_CMYKColor;
using HPDF_CMYKColor =_HPDF_CMYKColor;
struct _HPDF_TextWidth;
using HPDF_TextWidth = _HPDF_TextWidth;
struct _HPDF_Doc_Rec;
using HPDF_Doc_Rec = _HPDF_Doc_Rec;
using HPDF_Doc = _HPDF_Doc_Rec*;
using HPDF_BYTE = unsigned char;
using HPDF_UINT16 = unsigned short;
using HPDF_UINT32 = unsigned int;
using HPDF_STATUS = unsigned long;
struct _HPDF_Dict_Rec;
using HPDF_Dict = _HPDF_Dict_Rec*;
struct _HPDF_Array_Rec;
using HPDF_Array = _HPDF_Array_Rec*;
using HPDF_EmbeddedFile = HPDF_Dict;
using HPDF_NameDict = HPDF_Dict;
using HPDF_NameTree = HPDF_Dict;
using HPDF_Pages = HPDF_Dict;
using HPDF_Page = HPDF_Dict;
using HPDF_Annotation = HPDF_Dict;
using HPDF_3DMeasure = HPDF_Dict;
using HPDF_ExData = HPDF_Dict;
using HPDF_XObject = HPDF_Dict;
using HPDF_Image = HPDF_Dict;
using HPDF_Outline = HPDF_Dict;
using HPDF_EncryptDict = HPDF_Dict;
using HPDF_Action = HPDF_Dict;
using HPDF_ExtGState = HPDF_Dict;
using HPDF_Destination = HPDF_Array;
using HPDF_U3D = HPDF_Dict;
using HPDF_OutputIntent = HPDF_Dict;
using HPDF_JavaScript = HPDF_Dict;
using HPDF_Font = HPDF_Dict;
struct _HPDF_Encoder_Rec;
using HPDF_Encoder_Rec = _HPDF_Encoder_Rec;
using HPDF_Encoder = HPDF_Encoder_Rec*;
namespace Poco::PDF {
using TransMatrix = HPDF_TransMatrix;
using Rectangle = HPDF_Rect;
using Point = HPDF_Point;
using DashMode = HPDF_DashMode;
using RGBColor = HPDF_RGBColor;
using CMYKColor = HPDF_CMYKColor;
using PatternVec = std::vector<HPDF_UINT16>;
using TextWidth = HPDF_TextWidth;
// Note: constants must match the ones in hpdf_consts.h
static constexpr int HPDF_ENABLE_READ = 0;
static constexpr int HPDF_ENABLE_PRINT = 4;
static constexpr int HPDF_ENABLE_EDIT_ALL = 8;
static constexpr int HPDF_ENABLE_COPY = 16;
static constexpr int HPDF_ENABLE_EDIT = 32;
// Note: constants must match the ones in hpdf_consts.h
static constexpr int HPDF_COMP_NONE = 0x00;
static constexpr int HPDF_COMP_TEXT = 0x01;
static constexpr int HPDF_COMP_IMAGE = 0x02;
static constexpr int HPDF_COMP_METADATA = 0x04;
static constexpr int HPDF_COMP_ALL = 0x0F;
// Note: values must match the ones in hpdf_types.h
enum LineCap {
HPDF_BUTT_END = 0,
HPDF_ROUND_END,
HPDF_PROJECTING_SCUARE_END,
HPDF_LINECAP_EOF
};
// Note: values must match the ones in hpdf_types.h
enum LineJoin {
HPDF_MITER_JOIN = 0,
HPDF_ROUND_JOIN,
HPDF_BEVEL_JOIN,
HPDF_LINEJOIN_EOF
};
}
#endif // PDF_Declarations_INCLUDED

View File

@@ -19,6 +19,7 @@
#include "Poco/PDF/PDF.h"
#include "Poco/PDF/Declarations.h"
#include "Poco/PDF/Resource.h"
@@ -33,7 +34,7 @@ public:
Destination(HPDF_Doc* pPDF, const HPDF_Destination& resource, const std::string& name = "");
/// Creates the destination.
~Destination();
~Destination() override;
/// Destroys the destination.
void positionAndZoom(float x, float y, float zoom);
@@ -72,58 +73,6 @@ public:
};
//
// inlines
//
inline void Destination::positionAndZoom(float x, float y, float zoom)
{
HPDF_Destination_SetXYZ(handle(), x, y, zoom);
}
inline void Destination::fit()
{
HPDF_Destination_SetFit(handle());
}
inline void Destination::fitHorizontal(float top)
{
HPDF_Destination_SetFitH(handle(), top);
}
inline void Destination::fitVertical(float left)
{
HPDF_Destination_SetFitV(handle(), left);
}
inline void Destination::fitRectangle(float left, float top, float right, float bottom)
{
HPDF_Destination_SetFitR(handle(), left, bottom, right, top);
}
inline void Destination::fitWindow()
{
HPDF_Destination_SetFitB(handle());
}
inline void Destination::fitWindowHorizontal(float top)
{
HPDF_Destination_SetFitBH(handle(), top);
}
inline void Destination::fitWindowVertical(float left)
{
HPDF_Destination_SetFitBV(handle(), left);
}
} } // namespace Poco::PDF

View File

@@ -19,9 +19,9 @@
#include "Poco/PDF/PDF.h"
#include "Poco/PDF/Declarations.h"
#include "Poco/PDF/Page.h"
#include "Poco/PDF/Outline.h"
#include "Poco/PDF/Resource.h"
#include <deque>
#include <map>
@@ -39,23 +39,24 @@ class PDF_API Document
/// A Document represents a PDF document object.
{
public:
typedef HPDF_BYTE* DataPtr;
typedef HPDF_UINT32 SizeType;
typedef std::deque<Page> PageContainer;
typedef std::deque<Outline> OutlineContainer;
typedef std::map<std::string, Font> FontContainer;
typedef std::map<std::string, Encoder> EncoderContainer;
typedef std::map<std::string, Image> ImageContainer;
using DataPtr = HPDF_BYTE*;
using SizeType = HPDF_UINT32;
using PageContainer = std::deque<Page>;
using OutlineContainer = std::deque<Outline>;
using FontContainer = std::map<std::string, Font>;
using EncoderContainer = std::map<std::string, Encoder>;
using ImageContainer = std::map<std::string, Image>;
enum Info
{
INFO_CREATION_DATE = HPDF_INFO_CREATION_DATE,
INFO_MOD_DATE = HPDF_INFO_MOD_DATE,
INFO_AUTHOR = HPDF_INFO_AUTHOR,
INFO_CREATOR = HPDF_INFO_CREATOR,
INFO_TITLE = HPDF_INFO_TITLE,
INFO_SUBJECT = HPDF_INFO_SUBJECT,
INFO_KEYWORDS = HPDF_INFO_KEYWORDS
INFO_CREATION_DATE = 0,
INFO_MOD_DATE,
INFO_AUTHOR,
INFO_CREATOR,
INFO_PRODUCER,
INFO_TITLE,
INFO_SUBJECT,
INFO_KEYWORDS
};
enum Permission
@@ -74,25 +75,26 @@ public:
enum PageLayout
{
PAGE_LAYOUT_SINGLE = HPDF_PAGE_LAYOUT_SINGLE,
PAGE_LAYOUT_SINGLE = 0,
/// Only one page is displayed.
PAGE_LAYOUT_ONE_COLUMN = HPDF_PAGE_LAYOUT_ONE_COLUMN,
PAGE_LAYOUT_ONE_COLUMN,
/// Display the pages in one column.
PAGE_LAYOUT_TWO_COLUMN_LEFT = HPDF_PAGE_LAYOUT_TWO_COLUMN_LEFT,
PAGE_LAYOUT_TWO_COLUMN_LEFT,
/// Display the pages in two column. The page of the odd number is displayed left.
PAGE_LAYOUT_TWO_COLUMN_RIGHT = HPDF_PAGE_LAYOUT_TWO_COLUMN_RIGHT
PAGE_LAYOUT_TWO_COLUMN_RIGHT
/// Display the pages in two column. The page of the odd number is displayed right.
};
enum PageMode
{
PAGE_MODE_USE_NONE = HPDF_PAGE_MODE_USE_NONE,
PAGE_MODE_USE_NONE = 0,
/// Display the document with neither outline nor thumbnail.
PAGE_MODE_USE_OUTLINE = HPDF_PAGE_MODE_USE_OUTLINE,
PAGE_MODE_USE_OUTLINE,
/// Display the document with outline pain.
PAGE_MODE_USE_THUMBS = HPDF_PAGE_MODE_USE_THUMBS,
PAGE_MODE_USE_THUMBS,
///Display the document with thumbnail pain.
PAGE_MODE_FULL_SCREEN = HPDF_PAGE_MODE_FULL_SCREEN
PAGE_MODE_FULL_SCREEN
/// Display the document with full screen mode.
};
@@ -113,25 +115,25 @@ public:
enum Encryption
{
ENCRYPT_R2 = HPDF_ENCRYPT_R2,
ENCRYPT_R2 = 2,
/// Use "Revision 2" algorithm.
/// The length of key is automatically set to 5(40bit).
ENCRYPT_R3 = HPDF_ENCRYPT_R3
ENCRYPT_R3 = 3
/// Use "Revision 3" algorithm.
/// Between 5(40bit) and 16(128bit) can be specified for length of the key.
};
enum PageNumberStyle
{
PAGE_NUM_STYLE_DECIMAL = HPDF_PAGE_NUM_STYLE_DECIMAL,
PAGE_NUM_STYLE_DECIMAL = 0,
/// Page label is displayed by Arabic numerals.
PAGE_NUM_STYLE_UPPER_ROMAN = HPDF_PAGE_NUM_STYLE_UPPER_ROMAN,
PAGE_NUM_STYLE_UPPER_ROMAN,
/// Page label is displayed by Uppercase roman numerals.
PAGE_NUM_STYLE_LOWER_ROMAN = HPDF_PAGE_NUM_STYLE_LOWER_ROMAN,
PAGE_NUM_STYLE_LOWER_ROMAN,
/// Page label is displayed by Lowercase roman numerals.
PAGE_NUM_STYLE_UPPER_LETTERS = HPDF_PAGE_NUM_STYLE_UPPER_LETTERS,
PAGE_NUM_STYLE_UPPER_LETTERS,
/// Page label is displayed by Uppercase letters (using A to Z).
PAGE_NUM_STYLE_LOWER_LETTERS = HPDF_PAGE_NUM_STYLE_LOWER_LETTERS,
PAGE_NUM_STYLE_LOWER_LETTERS,
/// Page label is displayed by Lowercase letters (using a to z).
};
@@ -335,171 +337,6 @@ private:
};
//
// inlines
//
inline void Document::setPages(std::size_t pagePerPages)
{
HPDF_SetPagesConfiguration(_pdf, static_cast<HPDF_UINT>(pagePerPages));
}
inline void Document::setPageLayout(PageLayout pageLayout)
{
HPDF_SetPageLayout(_pdf, static_cast<HPDF_PageLayout>(pageLayout));
}
inline Document::PageLayout Document::getPageLayout() const
{
return static_cast<PageLayout>(HPDF_GetPageLayout(_pdf));
}
inline void Document::setPageMode(PageMode pageMode)
{
HPDF_SetPageMode(_pdf, static_cast<HPDF_PageMode>(pageMode));
}
inline Document::PageMode Document::getPageMode() const
{
return static_cast<PageMode>(HPDF_GetPageMode(_pdf));
}
/*
inline void openAction()
{
HPDF_SetOpenAction(_pdf, HPDF_Destination open_action);
}
*/
inline const Page& Document::getPage(int index)
{
return _pages.at(index);
}
inline const Page& Document::operator [] (int index)
{
return _pages[index];
}
inline void Document::compression(Compression mode)
{
HPDF_SetCompressionMode(_pdf, mode);
}
inline void Document::addPageLabel(int pageNum, PageNumberStyle style, int firstPage, const std::string& prefix)
{
HPDF_AddPageLabel(_pdf,
static_cast<HPDF_UINT>(pageNum),
static_cast<HPDF_PageNumStyle>(style),
static_cast<HPDF_UINT>(firstPage),
prefix.c_str());
}
inline void Document::useUTF8Encoding()
{
HPDF_UseUTFEncodings(_pdf);
}
inline void Document::useJapaneseFonts()
{
HPDF_UseJPFonts(_pdf);
}
inline void Document::useKoreanFonts()
{
HPDF_UseKRFonts(_pdf);
}
inline void Document::useChineseFonts()
{
HPDF_UseCNSFonts(_pdf);
}
inline void Document::useChineseTraditionalFonts()
{
HPDF_UseCNTFonts(_pdf);
}
inline void Document::useJapaneseEncodings()
{
HPDF_UseJPEncodings(_pdf);
}
inline void Document::useKoreanEncodings()
{
HPDF_UseKREncodings(_pdf);
}
inline void Document::useChineseEncodings()
{
HPDF_UseCNSEncodings(_pdf);
}
inline void Document::useChineseTraditionalEncodings()
{
HPDF_UseCNTEncodings(_pdf);
}
inline void Document::extendedGraphicState()
{
HPDF_CreateExtGState(_pdf);
}
inline const Image& Document::loadPNGImage(const std::string& fileName)
{
return loadPNGImageImpl(fileName, true);
}
inline const Image& Document::loadPNGImageInfo(const std::string& fileName)
{
return loadPNGImageImpl(fileName, false);
}
inline std::string Document::getInfo(Info info)
{
return HPDF_GetInfoAttr(_pdf, static_cast<HPDF_InfoType>(info));
}
inline void Document::setPermission(Permission perm)
{
HPDF_SetPermission(_pdf, static_cast<HPDF_UINT>(perm));
}
inline std::size_t Document::pageCount() const
{
return _pages.size();
}
inline HPDF_Doc& Document::handle()
{
return _pdf;
}
} } // namespace Poco::PDF

View File

@@ -20,7 +20,6 @@
#include "Poco/PDF/PDF.h"
#include "Poco/PDF/Resource.h"
#include "Poco/Exception.h"
namespace Poco {
@@ -33,40 +32,40 @@ class PDF_API Encoder: public Resource<HPDF_Encoder>
public:
enum Type
{
ENCODER_TYPE_SINGLE_BYTE = HPDF_ENCODER_TYPE_SINGLE_BYTE,
ENCODER_TYPE_SINGLE_BYTE = 0,
/// This encoder is an encoder for single byte characters.
ENCODER_TYPE_DOUBLE_BYTE = HPDF_ENCODER_TYPE_DOUBLE_BYTE,
ENCODER_TYPE_DOUBLE_BYTE,
/// This encoder is an encoder for multi byte characters.
ENCODER_TYPE_UNINITIALIZED = HPDF_ENCODER_TYPE_UNINITIALIZED,
ENCODER_TYPE_UNINITIALIZED,
/// This encoder is uninitialized. (May be it is an encoder for multi byte characters.)
ENCODER_TYPE_UNKNOWN = HPDF_ENCODER_UNKNOWN
ENCODER_TYPE_UNKNOWN
/// Invalid encoder.
};
enum ByteType
{
ENCODER_BYTE_TYPE_SINGLE = HPDF_BYTE_TYPE_SINGLE,
ENCODER_BYTE_TYPE_SINGLE,
/// Single byte character.
ENCODER_BYTE_TYPE_LEAD = HPDF_BYTE_TYPE_LEAD,
ENCODER_BYTE_TYPE_LEAD,
/// Lead byte of a double-byte character.
ENCODER_BYTE_TYPE_TRIAL = HPDF_BYTE_TYPE_TRIAL,
ENCODER_BYTE_TYPE_TRIAL,
/// Trailing byte of a double-byte character.
ENCODER_BYTE_TYPE_UNKNOWN = HPDF_BYTE_TYPE_UNKNOWN
ENCODER_BYTE_TYPE_UNKNOWN
/// Invalid encoder or cannot judge the byte type.
};
enum WriteMode
{
WRITE_MODE_HORIZONTAL = HPDF_WMODE_HORIZONTAL,
WRITE_MODE_HORIZONTAL = 0,
/// Horizontal writing mode.
WRITE_MODE_VERTICAL = HPDF_WMODE_VERTICAL
WRITE_MODE_VERTICAL
/// Vertical writing mode;
};
Encoder(HPDF_Doc* pPDF, const HPDF_Encoder& resource, const std::string& name = "");
/// Creates the encoder.
~Encoder();
~Encoder() override;
/// Destroys the encoder.
Type getType() const;
@@ -80,33 +79,6 @@ public:
};
//
// inlines
//
inline Encoder::Type Encoder::getType() const
{
return static_cast<Type>(HPDF_Encoder_GetType(handle()));
}
inline Encoder::ByteType Encoder::getByteType(const std::string& text, int index) const
{
if (index < 0)
throw InvalidArgumentException("Negative values not allowed.");
return static_cast<ByteType>(HPDF_Encoder_GetByteType(handle(),
text.c_str(),
static_cast<HPDF_UINT>(index)));
}
inline Encoder::WriteMode Encoder::writeMode()
{
return static_cast<WriteMode>(HPDF_Encoder_GetWritingMode(handle()));
}
} } // namespace Poco::PDF

View File

@@ -19,6 +19,7 @@
#include "Poco/PDF/PDF.h"
#include "Poco/PDF/Declarations.h"
#include "Poco/PDF/Resource.h"
@@ -33,7 +34,7 @@ public:
Font(HPDF_Doc* pPDF, HPDF_Font resource);
/// Creates the font.
~Font();
~Font() override;
/// Destroys the font.
std::string encodingName() const;
@@ -69,80 +70,6 @@ public:
/// Calculates the byte length which can be included within the specified width.
};
//
// inlines
//
inline std::string Font::encodingName() const
{
return HPDF_Font_GetEncodingName(handle());
}
inline int Font::unicodeWidth(Poco::UInt16 ch) const
{
return HPDF_Font_GetUnicodeWidth(handle(), ch);
}
inline Rectangle Font::boundingBox() const
{
return HPDF_Font_GetBBox(handle());
}
inline int Font::ascent() const
{
return HPDF_Font_GetAscent(handle());
}
inline int Font::descent() const
{
return HPDF_Font_GetDescent(handle());
}
inline int Font::lowerHeight() const
{
return static_cast<int>(HPDF_Font_GetXHeight(handle()));
}
inline int Font::upperHeight() const
{
return static_cast<int>(HPDF_Font_GetCapHeight(handle()));
}
inline TextWidth Font::textWidth(const std::string& text)
{
return HPDF_Font_TextWidth(handle(),
reinterpret_cast<const HPDF_BYTE*>(text.data()),
static_cast<HPDF_UINT>(text.size()));
}
inline int Font::measureText(const std::string& text,
float width,
float fontSize,
float charSpace,
float wordSpace,
bool wordWrap)
{
return static_cast<int>(HPDF_Font_MeasureText(handle(),
reinterpret_cast<const HPDF_BYTE*>(text.data()),
static_cast<HPDF_UINT>(text.size()),
width,
fontSize,
charSpace,
wordSpace,
wordWrap,
0));
}
} } // namespace Poco::PDF

View File

@@ -33,7 +33,7 @@ public:
Image(HPDF_Doc* pPDF, const HPDF_Image& resource, const std::string& name = "");
/// Creates the image.
~Image();
~Image() override;
/// Destroys the image.
Point size() const;
@@ -62,56 +62,6 @@ public:
};
//
// inlines
//
inline Point Image::size() const
{
return HPDF_Image_GetSize(handle());
}
inline float Image::width() const
{
return static_cast<float>(HPDF_Image_GetWidth(handle()));
}
inline float Image::height() const
{
return static_cast<float>(HPDF_Image_GetHeight(handle()));
}
inline Poco::UInt32 Image::bitsPerColor() const
{
return HPDF_Image_GetBitsPerComponent(handle());
}
inline std::string Image::colorSpace() const
{
return HPDF_Image_GetColorSpace(handle());
}
inline void Image::colorMask(Poco::UInt32 redMin,
Poco::UInt32 redMax,
Poco::UInt32 greenMin,
Poco::UInt32 greenMax,
Poco::UInt32 blueMin,
Poco::UInt32 blueMax)
{
HPDF_Image_SetColorMask(handle(),
redMin,
redMax,
greenMin,
greenMax,
blueMin,
blueMax);
}
} } // namespace Poco::PDF

View File

@@ -19,8 +19,8 @@
#include "Poco/PDF/PDF.h"
#include "Poco/PDF/Declarations.h"
#include "Poco/PDF/Resource.h"
#include "Poco/PDF/Destination.h"
namespace Poco {
@@ -31,15 +31,17 @@ class PDF_API LinkAnnotation: public Resource<HPDF_Annotation>
/// A LinkAnnotation represents a PDF annotation resource.
{
public:
enum Highlight
/// Highlighting modes for the link annotation. Note: values must match HPDF_AnnotHighlightMode enum.
{
HIGHTLIGHT_NONE = HPDF_ANNOT_NO_HIGHTLIGHT,
HIGHTLIGHT_NONE = 0,
/// No highlighting.
HIGHTLIGHT_INVERT_BOX = HPDF_ANNOT_INVERT_BOX,
HIGHTLIGHT_INVERT_BOX,
/// Invert the contents of the area of annotation.
HIGHTLIGHT_INVERT_BORDER = HPDF_ANNOT_INVERT_BORDER,
/// Invert the annotation<EFBFBD>s border.
HIGHTLIGHT_DOWN_APPEARANCE = HPDF_ANNOT_DOWN_APPEARANCE
HIGHTLIGHT_INVERT_BORDER,
/// Invert the annotations border.
HIGHTLIGHT_DOWN_APPEARANCE
/// Dent the annotation.
};
@@ -48,7 +50,7 @@ public:
const std::string& name = "");
/// Creates the annotation.
virtual ~LinkAnnotation();
~LinkAnnotation() override;
/// Destroys the annotation.
void setHighlight(Highlight mode);
@@ -59,22 +61,6 @@ public:
};
//
// inlines
//
inline void LinkAnnotation::setHighlight(Highlight mode)
{
HPDF_LinkAnnot_SetHighlightMode(handle(),
static_cast<HPDF_AnnotHighlightMode>(mode));
}
inline void LinkAnnotation::setBorderStyle(float width, Poco::UInt32 dashOn, Poco::UInt32 dashOff)
{
HPDF_LinkAnnot_SetBorderStyle(handle(), width, dashOn, dashOff);
}
} } // namespace Poco::PDF

View File

@@ -31,7 +31,7 @@ class PDF_API Outline: public Resource<HPDF_Outline>
/// A Outline represents a PDF outline resource.
{
public:
typedef HPDF_Outline Type;
using Type = HPDF_Outline;
Outline(HPDF_Doc* pPDF, const HPDF_Outline& outline, const std::string& name = "");
/// Creates the outline.
@@ -39,7 +39,7 @@ public:
Outline(const Outline& other);
/// Copy creates the resource.
~Outline();
~Outline() override;
/// Destroys the outline.
Outline& operator = (const Outline& resource);
@@ -56,28 +56,6 @@ public:
};
//
// inlines
//
inline void Outline::open()
{
HPDF_Outline_SetOpened(handle(), HPDF_TRUE);
}
inline void Outline::close()
{
HPDF_Outline_SetOpened(handle(), HPDF_FALSE);
}
inline void Outline::destination(const Destination& dest)
{
HPDF_Outline_SetDestination(handle(), dest);
}
} } // namespace Poco::PDF

View File

@@ -29,7 +29,6 @@
#endif
#include "Poco/Foundation.h"
#include "hpdf.h"
//

View File

@@ -19,6 +19,7 @@
#include "Poco/PDF/PDF.h"
#include "Poco/PDF/Declarations.h"
#include "Poco/Exception.h"

View File

@@ -26,7 +26,6 @@
#include "Poco/PDF/Destination.h"
#include "Poco/PDF/TextAnnotation.h"
#include "Poco/PDF/LinkAnnotation.h"
#include "Poco/Exception.h"
#include <map>
@@ -41,106 +40,106 @@ class PDF_API Page
/// A Page represents a PDF page object.
{
public:
typedef HPDF_Page Type;
typedef std::map<std::string, Destination> DestinationContainer;
typedef std::map<std::string, TextAnnotation> TextAnnotationContainer;
typedef std::map<std::string, LinkAnnotation> LinkAnnotationContainer;
using Type = HPDF_Page;
using DestinationContainer = std::map<std::string, Destination>;
using TextAnnotationContainer = std::map<std::string, TextAnnotation>;
using LinkAnnotationContainer = std::map<std::string, LinkAnnotation>;
enum Size
{
PAGE_SIZE_LETTER = HPDF_PAGE_SIZE_LETTER,
PAGE_SIZE_LETTER = 0,
/// 8½ x 11 (Inches), 612 x 792 px
PAGE_SIZE_LEGAL = HPDF_PAGE_SIZE_LEGAL,
PAGE_SIZE_LEGAL,
/// 8½ x 14 (Inches), 612 x 1008 px
PAGE_SIZE_A3 = HPDF_PAGE_SIZE_A3,
PAGE_SIZE_A3,
/// 297 × 420 (mm), 841.89 x 1199.551 px
PAGE_SIZE_A4 = HPDF_PAGE_SIZE_A4,
PAGE_SIZE_A4,
/// 210 × 297 (mm), 595.276 x 841.89 px
PAGE_SIZE_A5 = HPDF_PAGE_SIZE_A5,
PAGE_SIZE_A5,
/// 148 × 210 (mm), 419.528 x 595.276 px
PAGE_SIZE_B4 = HPDF_PAGE_SIZE_B4,
PAGE_SIZE_B4,
/// 250 × 353 (mm), 708.661 x 1000.63 px
PAGE_SIZE_B5 = HPDF_PAGE_SIZE_B5,
PAGE_SIZE_B5,
/// 176 × 250 (mm), 498.898 x 708.661 px
PAGE_SIZE_EXECUTIVE = HPDF_PAGE_SIZE_EXECUTIVE,
PAGE_SIZE_EXECUTIVE,
/// 7½ x 10½ (Inches), 522 x 756 px
PAGE_SIZE_US4x6 = HPDF_PAGE_SIZE_US4x6,
PAGE_SIZE_US4x6,
/// 4 x 6 (Inches), 288 x 432 px
PAGE_SIZE_US4x8 = HPDF_PAGE_SIZE_US4x8,
PAGE_SIZE_US4x8,
/// 4 x 8 (Inches), 288 x 576 px
PAGE_SIZE_US5x7 = HPDF_PAGE_SIZE_US5x7,
PAGE_SIZE_US5x7,
/// 5 x 7 (Inches), 360 x 504 px
PAGE_SIZE_COMM10 = HPDF_PAGE_SIZE_COMM10
PAGE_SIZE_COMM10
/// 4.125 x 9.5 (Inches) 297x 684 px
};
enum Orientation
{
ORIENTATION_PORTRAIT = HPDF_PAGE_PORTRAIT,
ORIENTATION_PORTRAIT = 0,
// Portrait orientation.
ORIENTATION_LANDSCAPE = HPDF_PAGE_LANDSCAPE
ORIENTATION_LANDSCAPE
// Landscape orientation.
};
enum RenderMode
{
RENDER_FILL = HPDF_FILL,
RENDER_STROKE = HPDF_STROKE,
RENDER_FILL_THEN_STROKE = HPDF_FILL_THEN_STROKE,
RENDER_INVISIBLE = HPDF_INVISIBLE,
RENDER_FILL_CLIPPING = HPDF_FILL_CLIPPING,
RENDER_STROKE_CLIPPING = HPDF_STROKE_CLIPPING,
RENDER_FILL_STROKE_CLIPPING = HPDF_FILL_STROKE_CLIPPING,
RENDER_CLIPPING = HPDF_CLIPPING,
RENDER_RENDERING_MODE_EOF = HPDF_RENDERING_MODE_EOF
RENDER_FILL = 0,
RENDER_STROKE,
RENDER_FILL_THEN_STROKE,
RENDER_INVISIBLE,
RENDER_FILL_CLIPPING,
RENDER_STROKE_CLIPPING,
RENDER_FILL_STROKE_CLIPPING,
RENDER_CLIPPING,
RENDER_RENDERING_MODE_EOF
};
enum ColorSpace
{
CS_DEVICE_GRAY = HPDF_CS_DEVICE_GRAY,
CS_DEVICE_RGB = HPDF_CS_DEVICE_RGB,
CS_DEVICE_CMYK = HPDF_CS_DEVICE_CMYK,
CS_CAL_GRAY = HPDF_CS_CAL_GRAY,
CS_CAL_RGB = HPDF_CS_CAL_RGB,
CS_LAB = HPDF_CS_LAB,
CS_ICC_BASED = HPDF_CS_ICC_BASED,
CS_SEPARATION = HPDF_CS_SEPARATION,
CS_DEVICE_N = HPDF_CS_DEVICE_N,
CS_INDEXED = HPDF_CS_INDEXED,
CS_PATTERN = HPDF_CS_PATTERN,
CS_EOF = HPDF_CS_EOF
CS_DEVICE_GRAY = 0,
CS_DEVICE_RGB,
CS_DEVICE_CMYK,
CS_CAL_GRAY,
CS_CAL_RGB,
CS_LAB,
CS_ICC_BASED,
CS_SEPARATION,
CS_DEVICE_N,
CS_INDEXED,
CS_PATTERN,
CS_EOF
};
enum TransitionStyle
{
TS_WIPE_RIGHT = HPDF_TS_WIPE_RIGHT,
TS_WIPE_UP = HPDF_TS_WIPE_UP,
TS_WIPE_LEFT = HPDF_TS_WIPE_LEFT,
TS_WIPE_DOWN = HPDF_TS_WIPE_DOWN,
TS_BARN_DOORS_HORIZONTAL_OUT = HPDF_TS_BARN_DOORS_HORIZONTAL_OUT,
TS_BARN_DOORS_HORIZONTAL_IN = HPDF_TS_BARN_DOORS_HORIZONTAL_IN,
TS_BARN_DOORS_VERTICAL_OUT = HPDF_TS_BARN_DOORS_VERTICAL_OUT,
TS_BARN_DOORS_VERTICAL_IN = HPDF_TS_BARN_DOORS_VERTICAL_IN,
TS_BOX_OUT = HPDF_TS_BOX_OUT,
TS_BOX_IN = HPDF_TS_BOX_IN,
TS_BLINDS_HORIZONTAL = HPDF_TS_BLINDS_HORIZONTAL,
TS_BLINDS_VERTICAL = HPDF_TS_BLINDS_VERTICAL,
TS_DISSOLVE = HPDF_TS_DISSOLVE,
TS_GLITTER_RIGHT = HPDF_TS_GLITTER_RIGHT,
TS_GLITTER_DOWN = HPDF_TS_GLITTER_DOWN,
TS_GLITTER_TOP_LEFT_TO_BOTTOM_RIGHT = HPDF_TS_GLITTER_TOP_LEFT_TO_BOTTOM_RIGHT,
TS_REPLACE = HPDF_TS_REPLACE
TS_WIPE_RIGHT = 0,
TS_WIPE_UP,
TS_WIPE_LEFT,
TS_WIPE_DOWN,
TS_BARN_DOORS_HORIZONTAL_OUT,
TS_BARN_DOORS_HORIZONTAL_IN,
TS_BARN_DOORS_VERTICAL_OUT,
TS_BARN_DOORS_VERTICAL_IN,
TS_BOX_OUT,
TS_BOX_IN,
TS_BLINDS_HORIZONTAL,
TS_BLINDS_VERTICAL,
TS_DISSOLVE,
TS_GLITTER_RIGHT,
TS_GLITTER_DOWN,
TS_GLITTER_TOP_LEFT_TO_BOTTOM_RIGHT,
TS_REPLACE
};
enum TextAlignment
{
TEXT_ALIGN_LEFT = HPDF_TALIGN_LEFT,
TEXT_ALIGN_LEFT = 0,
/// The text is aligned to left.
TEXT_ALIGN_RIGHT = HPDF_TALIGN_RIGHT,
TEXT_ALIGN_RIGHT,
/// The text is aligned to right.
TEXT_ALIGN_CENTER = HPDF_TALIGN_CENTER,
TEXT_ALIGN_CENTER,
/// The text is aligned to center.
TEXT_ALIGN_JUSTIFY = HPDF_TALIGN_JUSTIFY
TEXT_ALIGN_JUSTIFY
/// Add spaces between the words to justify both left and right side.
};
@@ -532,604 +531,6 @@ private:
};
//
// inlines
//
inline Page::operator const Page::Type& () const
{
return _page;
}
inline void Page::setWidth(float value)
{
HPDF_Page_SetWidth(_page, value);
}
inline float Page::getWidth() const
{
return HPDF_Page_GetWidth(_page);
}
inline void Page::setHeight(float value)
{
HPDF_Page_SetHeight(_page, value);
}
inline float Page::getHeight() const
{
return HPDF_Page_GetHeight(_page);
}
inline void Page::setSizeAndOrientation(Size size, Orientation orientation)
{
_size = size;
_orientation = orientation;
HPDF_Page_SetSize(_page, static_cast<HPDF_PageSizes>(size), static_cast<HPDF_PageDirection>(orientation));
}
inline void Page::setSize(Size size)
{
_size = size;
HPDF_Page_SetSize(_page, static_cast<HPDF_PageSizes>(size), static_cast<HPDF_PageDirection>(_orientation));
}
inline void Page::setOrientation(Orientation orientation)
{
_orientation = orientation;
HPDF_Page_SetSize(_page, static_cast<HPDF_PageSizes>(_size), static_cast<HPDF_PageDirection>(orientation));
}
inline Page::Size Page::getSize() const
{
return _size;
}
inline Page::Orientation Page::getOrientation() const
{
return _orientation;
}
inline void Page::setFont(const Font& font, float size)
{
HPDF_Page_SetFontAndSize(_page, font, size);
}
inline int Page::getGraphicsMode() const
{
return HPDF_Page_GetGMode(_page);
}
inline int Page::getGraphicStateDepth() const
{
return HPDF_Page_GetGStateDepth(_page);
}
inline void Page::setExtGraphicsState(ExtGraphicsState state)
{
HPDF_Page_SetExtGState(_page, state);
}
inline void Page::saveGraphics()
{
HPDF_Page_GSave(_page);
}
inline void Page::restoreGraphics()
{
HPDF_Page_GRestore(_page);
}
inline void Page::concatenate(const std::vector<float>& values)
{
if (values.size() < 6)
throw InvalidArgumentException("Needs six values");
HPDF_Page_Concat(_page,
values[0],
values[1],
values[2],
values[3],
values[4],
values[5]);
}
inline void Page::moveTo(float x, float y)
{
HPDF_Page_MoveTo(_page, x, y);
}
inline void Page::lineTo(float x, float y)
{
HPDF_Page_LineTo(_page, x, y);
}
inline void Page::curveTo(const std::vector<float>& values)
{
if (values.size() < 6)
throw InvalidArgumentException("Needs six values");
HPDF_Page_CurveTo(_page,
values[0],
values[1],
values[2],
values[3],
values[4],
values[5]);
}
inline void Page::curveToRight(float x2, float y2, float x3, float y3)
{
HPDF_Page_CurveTo2(_page, x2, y2, x3, y3);
}
inline void Page::curveToLeft(float x2, float y2, float x3, float y3)
{
HPDF_Page_CurveTo3(_page, x2, y2, x3, y3);
}
inline void Page::closePath()
{
HPDF_Page_ClosePath(_page);
}
inline void Page::rectangle(float x, float y, float width, float height)
{
HPDF_Page_Rectangle(_page, x, y, width, height);
}
inline void Page::stroke()
{
HPDF_Page_Stroke(_page);
}
inline void Page::closeAndStroke()
{
HPDF_Page_ClosePathStroke(_page);
}
inline void Page::fill()
{
HPDF_Page_Fill(_page);
}
inline void Page::EOFill()
{
HPDF_Page_Eofill(_page);
}
inline void Page::fillStroke()
{
HPDF_Page_FillStroke(_page);
}
inline void Page::EOFillStroke()
{
HPDF_Page_EofillStroke(_page);
}
inline void Page::closeFillAndStroke()
{
HPDF_Page_ClosePathFillStroke(_page);
}
inline void Page::closeFillAndEOStroke()
{
HPDF_Page_ClosePathEofillStroke(_page);
}
inline void Page::endPath()
{
HPDF_Page_EndPath(_page);
}
inline void Page::clip()
{
HPDF_Page_Clip(_page);
}
inline void Page::eoClip()
{
HPDF_Page_Eoclip(_page);
}
inline Point Page::getPos() const
{
return HPDF_Page_GetCurrentPos(_page);
}
inline Point Page::getTextPos() const
{
return HPDF_Page_GetCurrentTextPos(_page);
}
inline void Page::moveTextPos(float x, float y)
{
HPDF_Page_MoveTextPos(_page, x, y);
}
inline void Page::moveTextNextLine(float x, float y)
{
HPDF_Page_MoveTextPos2(_page, x, y);
}
inline void Page::moveTextNextLine()
{
HPDF_Page_MoveToNextLine(_page);
}
inline float Page::getFontSize() const
{
return HPDF_Page_GetCurrentFontSize(_page);
}
inline TransMatrix Page::getTransMatrix() const
{
return HPDF_Page_GetTransMatrix(_page);
}
inline TransMatrix Page::getTextMatrix() const
{
return HPDF_Page_GetTextMatrix(_page);
}
inline float Page::getLineWidth() const
{
return HPDF_Page_GetLineWidth(_page);
}
inline void Page::setLineWidth(float width)
{
HPDF_Page_SetLineWidth(_page, width);
}
inline LineCap Page::getLineCap() const
{
return HPDF_Page_GetLineCap(_page);
}
inline void Page::setLineCap(LineCap cap) const
{
HPDF_Page_SetLineCap(_page, cap);
}
inline LineJoin Page::getLineJoin() const
{
return HPDF_Page_GetLineJoin(_page);
}
inline void Page::setLineJoin(LineJoin join) const
{
HPDF_Page_SetLineJoin(_page, join);
}
inline float Page::getMiterLimit() const
{
return HPDF_Page_GetMiterLimit(_page);
}
inline void Page::setMiterLimit(float limit) const
{
HPDF_Page_SetMiterLimit(_page, limit);
}
inline DashMode Page::getDashMode() const
{
return HPDF_Page_GetDash(_page);
}
inline void Page::setDashMode(const PatternVec& pattern, int paramNo, int phase) const
{
HPDF_Page_SetDash(_page, &pattern[0],
static_cast<HPDF_UINT>(paramNo),
static_cast<HPDF_UINT>(phase));
}
inline float Page::getFlatness() const
{
return HPDF_Page_GetFlat(_page);
}
inline float Page::getCharSpace() const
{
return HPDF_Page_GetCharSpace(_page);
}
inline void Page::setCharSpace(float value)
{
HPDF_Page_SetCharSpace(_page, value);
}
inline float Page::getWordSpace() const
{
return HPDF_Page_GetWordSpace(_page);
}
inline void Page::setWordSpace(float value)
{
HPDF_Page_SetWordSpace(_page, value);
}
inline float Page::getHorizontalScale() const
{
return HPDF_Page_GetHorizontalScalling(_page);
}
inline void Page::setHorizontalScale(float value)
{
HPDF_Page_SetHorizontalScalling(_page, value);
}
inline float Page::getTextLead() const
{
return HPDF_Page_GetTextLeading(_page);
}
inline void Page::setTextLead(float value)
{
HPDF_Page_SetTextLeading(_page, value);
}
inline Page::RenderMode Page::getTextRenderMode() const
{
return static_cast<RenderMode>(HPDF_Page_GetTextRenderingMode(_page));
}
inline void Page::setTextRenderMode(RenderMode value)
{
HPDF_Page_SetTextRenderingMode(_page, static_cast<HPDF_TextRenderingMode>(value));
}
inline float Page::getTextRise() const
{
return HPDF_Page_GetTextRise(_page);
}
inline void Page::setTextRise(float value)
{
HPDF_Page_SetTextRise(_page, value);
}
inline RGBColor Page::getRGBFill() const
{
return HPDF_Page_GetRGBFill(_page);
}
inline void Page::setRGBFill(RGBColor value)
{
HPDF_Page_SetRGBFill(_page, value.r, value.g, value.b);
}
inline RGBColor Page::getRGBStroke() const
{
return HPDF_Page_GetRGBStroke(_page);
}
inline void Page::setRGBStroke(RGBColor value)
{
HPDF_Page_SetRGBStroke(_page, value.r, value.g, value.b);
}
inline CMYKColor Page::getCMYKFill() const
{
return HPDF_Page_GetCMYKFill(_page);
}
inline void Page::setCMYKFill(CMYKColor value)
{
HPDF_Page_SetCMYKFill(_page, value.c, value.m, value.y, value.k);
}
inline CMYKColor Page::getCMYKStroke() const
{
return HPDF_Page_GetCMYKStroke(_page);
}
inline void Page::setCMYKStroke(CMYKColor value)
{
HPDF_Page_SetCMYKStroke(_page, value.c, value.m, value.y, value.k);
}
inline float Page::getGreyFill() const
{
return HPDF_Page_GetGrayFill(_page);
}
inline void Page::setGreyFill(float value)
{
HPDF_Page_SetGrayFill(_page, value);
}
inline float Page::getGreyStroke() const
{
return HPDF_Page_GetGrayStroke(_page);
}
inline void Page::setGreyStroke(float value)
{
HPDF_Page_SetGrayStroke(_page, value);
}
inline Page::ColorSpace Page::getStrokeColorSpace() const
{
return static_cast<ColorSpace>(HPDF_Page_GetStrokingColorSpace(_page));
}
inline Page::ColorSpace Page::getFillColorSpace() const
{
return static_cast<ColorSpace>(HPDF_Page_GetFillingColorSpace(_page));
}
inline void Page::setSlideShow(TransitionStyle type, float displayTime, float transitionTime)
{
HPDF_Page_SetSlideShow(_page,
static_cast<HPDF_TransitionStyle>(type),
displayTime,
transitionTime);
}
inline void Page::beginText()
{
HPDF_Page_BeginText(_page);
}
inline void Page::endText()
{
HPDF_Page_EndText(_page);
}
inline void Page::write(float xPos, float yPos, const std::string& text)
{
HPDF_Page_TextOut(_page, xPos, yPos, text.c_str());
}
inline void Page::write(const std::string& text)
{
HPDF_Page_ShowText(_page, text.c_str());
}
inline void Page::writeNextLine(const std::string& text)
{
HPDF_Page_ShowTextNextLine(_page, text.c_str());
}
inline void Page::writeNextLineEx(float wordSpace, float charSpace, const std::string& text)
{
HPDF_Page_ShowTextNextLineEx(_page, wordSpace, charSpace, text.c_str());
}
inline int Page::writeInRectangle(float left,
float top,
float right,
float bottom,
const std::string& text,
TextAlignment align)
{
HPDF_UINT ret = 0;
HPDF_Page_TextRect(_page,
left,
top,
right,
bottom,
text.c_str(),
static_cast<HPDF_TextAlignment>(align),
&ret);
return static_cast<int>(ret);
}
inline void Page::drawImage(Image image, float x, float y, float width, float height)
{
HPDF_Page_DrawImage(_page, image, x, y, width, height);
}
inline void Page::circle(float x, float y, float radius)
{
HPDF_Page_Circle(_page, x, y, radius);
}
inline void Page::arc(float x, float y, float radius, float beginAngle, float endAngle)
{
HPDF_Page_Arc(_page, x, y, radius, beginAngle, endAngle);
}
inline void Page::ellipse(float x, float y, float xRadius, float yRadius)
{
HPDF_Page_Ellipse(_page, x, y, xRadius, yRadius);
}
} } // namespace Poco::PDF

View File

@@ -19,7 +19,7 @@
#include "Poco/PDF/PDF.h"
#include <vector>
#include "Poco/PDF/Declarations.h"
namespace Poco {
@@ -31,7 +31,9 @@ class Resource
/// A Resource represents a PDF resource resource.
{
public:
typedef R Type;
using Type = R;
Resource() = delete;
Resource(HPDF_Doc* pPDF, const R& resource, const std::string& name = ""):
_pPDF(pPDF),
@@ -51,8 +53,7 @@ public:
virtual ~Resource()
/// Destroys the resource.
{
}
= default;
Resource& operator = (const Resource& resource)
/// Assignment operator.
@@ -95,31 +96,19 @@ protected:
}
private:
Resource();
HPDF_Doc* _pPDF;
R _resource;
std::string _name;
};
//
// typedefs
//
//typedef Resource<HPDF_Annotation> Annotation;
typedef Resource<HPDF_ExtGState> ExtGraphicsState;
using ExtGraphicsState = Resource<HPDF_ExtGState>;
typedef HPDF_TransMatrix TransMatrix;
typedef HPDF_Rect Rectangle;
typedef HPDF_Point Point;
typedef HPDF_LineCap LineCap;
typedef HPDF_LineJoin LineJoin;
typedef HPDF_DashMode DashMode;
typedef HPDF_RGBColor RGBColor;
typedef HPDF_CMYKColor CMYKColor;
typedef std::vector<HPDF_UINT16> PatternVec;
typedef HPDF_TextWidth TextWidth;
} } // namespace Poco::PDF

View File

@@ -21,10 +21,10 @@ namespace PDF {
class PDF_API Table
{
public:
typedef SharedPtr<Table> Ptr;
typedef std::vector<TableRow> Cells;
using Ptr = SharedPtr<Table>;
using Cells = std::vector<TableRow>;
Table(int columnCount, int rowCount, const std::string& name, Cell::FontMapPtr pFontMap = 0);
Table(int columnCount, int rowCount, const std::string& name, Cell::FontMapPtr pFontMap = nullptr);
~Table();
void setCell(int col, int row, const Cell& cell);
@@ -51,34 +51,6 @@ private:
};
//
// inlines
//
inline const std::string Table::name() const
{
return _name;
}
inline const Table::Cells& Table::cells() const
{
return _cells;
}
inline std::size_t Table::rows() const
{
return _cells.size();
}
inline std::size_t Table::columns() const
{
return _cells[0].size();
}
} } // namespace Poco::PDF

View File

@@ -20,7 +20,7 @@
#include "Poco/PDF/PDF.h"
#include "Poco/PDF/Resource.h"
#include "Poco/PDF/Destination.h"
#include "Poco/PDF/Declarations.h"
namespace Poco {
@@ -33,13 +33,13 @@ class PDF_API TextAnnotation: public Resource<HPDF_Annotation>
public:
enum IconType
{
ANNOTATION_ICON_COMMENT = HPDF_ANNOT_ICON_COMMENT,
ANNOTATION_ICON_KEY = HPDF_ANNOT_ICON_KEY,
ANNOTATION_ICON_NOTE = HPDF_ANNOT_ICON_NOTE,
ANNOTATION_ICON_HELP = HPDF_ANNOT_ICON_HELP,
ANNOTATION_ICON_NEW_PARAGRAPH = HPDF_ANNOT_ICON_NEW_PARAGRAPH,
ANNOTATION_ICON_PARAGRAPH = HPDF_ANNOT_ICON_PARAGRAPH,
ANNOTATION_ICON_INSERT = HPDF_ANNOT_ICON_INSERT
ANNOTATION_ICON_COMMENT = 0,
ANNOTATION_ICON_KEY,
ANNOTATION_ICON_NOTE,
ANNOTATION_ICON_HELP,
ANNOTATION_ICON_NEW_PARAGRAPH,
ANNOTATION_ICON_PARAGRAPH,
ANNOTATION_ICON_INSERT
};
TextAnnotation(HPDF_Doc* pPDF,
@@ -47,7 +47,7 @@ public:
const std::string& name = "");
/// Creates the annotation.
virtual ~TextAnnotation();
~TextAnnotation() override;
/// Destroys the annotation.
void open();
@@ -60,28 +60,6 @@ public:
};
//
// inlines
//
inline void TextAnnotation::open()
{
HPDF_TextAnnot_SetOpened(handle(), HPDF_TRUE);
}
inline void TextAnnotation::close()
{
HPDF_TextAnnot_SetOpened(handle(), HPDF_FALSE);
}
inline void TextAnnotation::icon(IconType iconType)
{
HPDF_TextAnnot_SetIcon(handle(), static_cast<HPDF_AnnotIcon>(iconType));
}
} } // namespace Poco::PDF

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,377 +0,0 @@
/* deflate.h -- internal compression state
* Copyright (C) 1995-2024 Jean-loup Gailly
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* WARNING: this file should *not* be used by applications. It is
part of the implementation of the compression library and is
subject to change. Applications should only use zlib.h.
*/
/* @(#) $Id$ */
#ifndef DEFLATE_H
#define DEFLATE_H
#include "zutil.h"
/* define NO_GZIP when compiling if you want to disable gzip header and
trailer creation by deflate(). NO_GZIP would be used to avoid linking in
the crc code when it is not needed. For shared libraries, gzip encoding
should be left enabled. */
#ifndef NO_GZIP
# define GZIP
#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.
*/
#define LENGTH_CODES 29
/* number of length codes, not counting the special END_BLOCK code */
#define LITERALS 256
/* number of literal bytes 0..255 */
#define L_CODES (LITERALS+1+LENGTH_CODES)
/* number of Literal or Length codes, including the END_BLOCK code */
#define D_CODES 30
/* number of distance codes */
#define BL_CODES 19
/* number of codes used to transfer the bit lengths */
#define HEAP_SIZE (2*L_CODES+1)
/* maximum heap size */
#define MAX_BITS 15
/* All codes must not exceed MAX_BITS bits */
#define Buf_size 16
/* size of bit buffer in bi_buf */
#define INIT_STATE 42 /* zlib header -> BUSY_STATE */
#ifdef GZIP
# define GZIP_STATE 57 /* gzip header -> BUSY_STATE | EXTRA_STATE */
#endif
#define EXTRA_STATE 69 /* gzip extra block -> NAME_STATE */
#define NAME_STATE 73 /* gzip file name -> COMMENT_STATE */
#define COMMENT_STATE 91 /* gzip comment -> HCRC_STATE */
#define HCRC_STATE 103 /* gzip header CRC -> BUSY_STATE */
#define BUSY_STATE 113 /* deflate -> FINISH_STATE */
#define FINISH_STATE 666 /* stream complete */
/* Stream status */
/* Data structure describing a single value and its code string. */
typedef struct ct_data_s {
union {
ush freq; /* frequency count */
ush code; /* bit string */
} fc;
union {
ush dad; /* father node in Huffman tree */
ush len; /* length of bit string */
} dl;
} FAR ct_data;
#define Freq fc.freq
#define Code fc.code
#define Dad dl.dad
#define Len dl.len
typedef struct static_tree_desc_s static_tree_desc;
typedef struct tree_desc_s {
ct_data *dyn_tree; /* the dynamic tree */
int max_code; /* largest code with non zero frequency */
const static_tree_desc *stat_desc; /* the corresponding static tree */
} FAR tree_desc;
typedef ush Pos;
typedef Pos FAR Posf;
typedef unsigned IPos;
/* A Pos is an index in the character window. We use short instead of int to
* save space in the various tables. IPos is used only for parameter passing.
*/
typedef struct internal_state {
z_streamp strm; /* pointer back to this zlib stream */
int status; /* as the name implies */
Bytef *pending_buf; /* output still pending */
ulg pending_buf_size; /* size of pending_buf */
Bytef *pending_out; /* next pending byte to output to the stream */
ulg pending; /* nb of bytes in the pending buffer */
int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
gz_headerp gzhead; /* gzip header information to write */
ulg gzindex; /* where in extra, name, or comment */
Byte method; /* can only be DEFLATED */
int last_flush; /* value of flush param for previous deflate call */
/* used by deflate.c: */
uInt w_size; /* LZ77 window size (32K by default) */
uInt w_bits; /* log2(w_size) (8..16) */
uInt w_mask; /* w_size - 1 */
Bytef *window;
/* Sliding window. Input bytes are read into the second half of the window,
* and move to the first half later to keep a dictionary of at least wSize
* bytes. With this organization, matches are limited to a distance of
* wSize-MAX_MATCH bytes, but this ensures that IO is always
* performed with a length multiple of the block size. Also, it limits
* the window size to 64K, which is quite useful on MSDOS.
* To do: use the user input buffer as sliding window.
*/
ulg window_size;
/* Actual size of window: 2*wSize, except when the user input buffer
* is directly used as sliding window.
*/
Posf *prev;
/* Link to older string with same hash index. To limit the size of this
* array to 64K, this link is maintained only for the last 32K strings.
* An index in this array is thus a window index modulo 32K.
*/
Posf *head; /* Heads of the hash chains or NIL. */
uInt ins_h; /* hash index of string to be inserted */
uInt hash_size; /* number of elements in hash table */
uInt hash_bits; /* log2(hash_size) */
uInt hash_mask; /* hash_size-1 */
uInt hash_shift;
/* Number of bits by which ins_h must be shifted at each input
* step. It must be such that after MIN_MATCH steps, the oldest
* byte no longer takes part in the hash key, that is:
* hash_shift * MIN_MATCH >= hash_bits
*/
long block_start;
/* Window position at the beginning of the current output block. Gets
* negative when the window is moved backwards.
*/
uInt match_length; /* length of best match */
IPos prev_match; /* previous match */
int match_available; /* set if previous match exists */
uInt strstart; /* start of string to insert */
uInt match_start; /* start of matching string */
uInt lookahead; /* number of valid bytes ahead in window */
uInt prev_length;
/* Length of the best match at previous step. Matches not greater than this
* are discarded. This is used in the lazy match evaluation.
*/
uInt max_chain_length;
/* To speed up deflation, hash chains are never searched beyond this
* length. A higher limit improves compression ratio but degrades the
* speed.
*/
uInt max_lazy_match;
/* Attempt to find a better match only when the current match is strictly
* smaller than this value. This mechanism is used only for compression
* levels >= 4.
*/
# define max_insert_length max_lazy_match
/* Insert new strings in the hash table only if the match length is not
* greater than this length. This saves time but degrades compression.
* max_insert_length is used only for compression levels <= 3.
*/
int level; /* compression level (1..9) */
int strategy; /* favor or force Huffman coding*/
uInt good_match;
/* Use a faster search when the previous match is longer than this */
int nice_match; /* Stop searching when current match exceeds this */
/* used by trees.c: */
/* Didn't use ct_data typedef below to suppress compiler warning */
struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
struct tree_desc_s l_desc; /* desc. for literal tree */
struct tree_desc_s d_desc; /* desc. for distance tree */
struct tree_desc_s bl_desc; /* desc. for bit length tree */
ush bl_count[MAX_BITS+1];
/* number of codes at each bit length for an optimal tree */
int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */
int heap_len; /* number of elements in the heap */
int heap_max; /* element of largest frequency */
/* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
* The same heap array is used to build all trees.
*/
uch depth[2*L_CODES+1];
/* 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 */
#endif
uInt lit_bufsize;
/* Size of match buffer for literals/lengths. There are 4 reasons for
* limiting lit_bufsize to 64K:
* - frequencies can be kept in 16 bit counters
* - if compression is not successful for the first block, all input
* data is still in the window so we can still emit a stored block even
* when input comes from standard input. (This can also be done for
* all blocks if lit_bufsize is not greater than 32K.)
* - if compression is not successful for a file smaller than 64K, we can
* even emit a stored file instead of a stored block (saving 5 bytes).
* This is applicable only for zip (not gzip or zlib).
* - creating new Huffman trees less frequently may not provide fast
* adaptation to changes in the input data statistics. (Take for
* example a binary file with poorly compressible code followed by
* a highly compressible string table.) Smaller buffer sizes give
* fast adaptation but have of course the overhead of transmitting
* trees more frequently.
* - I can't count above 4
*/
uInt sym_next; /* running index in symbol buffer */
uInt sym_end; /* symbol table full when sym_next reaches this */
ulg opt_len; /* bit length of current block with optimal trees */
ulg static_len; /* bit length of current block with static trees */
uInt matches; /* number of string matches in current block */
uInt insert; /* bytes at end of window left to insert */
#ifdef ZLIB_DEBUG
ulg compressed_len; /* total bit length of compressed file mod 2^32 */
ulg bits_sent; /* bit length of compressed data sent mod 2^32 */
#endif
ush bi_buf;
/* Output buffer. bits are inserted starting at the bottom (least
* significant bits).
*/
int bi_valid;
/* Number of valid bits in bi_buf. All bits above the last valid bit
* are always zero.
*/
ulg high_water;
/* High water mark offset in window for initialized bytes -- bytes above
* this are set to zero in order to avoid memory check warnings when
* longest match routines access bytes past the input. This is then
* updated to the new high water mark.
*/
} FAR deflate_state;
/* Output a byte on the stream.
* IN assertion: there is enough room in pending_buf.
*/
#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
/* Minimum amount of lookahead, except at the end of the input file.
* See deflate.c for comments about the MIN_MATCH+1.
*/
#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD)
/* In order to simplify the code, particularly on 16 bit machines, match
* distances are limited to MAX_DIST instead of WSIZE.
*/
#define WIN_INIT MAX_MATCH
/* Number of bytes after end of data in window to initialize in order to avoid
memory checker errors from longest match routines */
/* in trees.c */
void ZLIB_INTERNAL _tr_init(deflate_state *s);
int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc);
void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf,
ulg stored_len, int last);
void ZLIB_INTERNAL _tr_flush_bits(deflate_state *s);
void ZLIB_INTERNAL _tr_align(deflate_state *s);
void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, charf *buf,
ulg stored_len, int last);
#define d_code(dist) \
((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
/* Mapping from a distance to a distance code. dist is the distance - 1 and
* must not have side effects. _dist_code[256] and _dist_code[257] are never
* used.
*/
#ifndef ZLIB_DEBUG
/* Inline versions of _tr_tally for speed: */
#if defined(GEN_TREES_H) || !defined(STDC)
extern uch ZLIB_INTERNAL _length_code[];
extern uch ZLIB_INTERNAL _dist_code[];
#else
extern const uch ZLIB_INTERNAL _length_code[];
extern const uch ZLIB_INTERNAL _dist_code[];
#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) \
{ uch cc = (c); \
s->sym_buf[s->sym_next++] = 0; \
s->sym_buf[s->sym_next++] = 0; \
s->sym_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->sym_buf[s->sym_next++] = (uch)dist; \
s->sym_buf[s->sym_next++] = (uch)(dist >> 8); \
s->sym_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); \
}
#endif
#else
# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
# define _tr_tally_dist(s, distance, length, flush) \
flush = _tr_tally(s, distance, length)
#endif
#endif /* DEFLATE_H */

View File

@@ -1,214 +0,0 @@
/* gzguts.h -- zlib internal header definitions for gz* operations
* Copyright (C) 2004-2024 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
#ifdef _LARGEFILE64_SOURCE
# ifndef _LARGEFILE_SOURCE
# define _LARGEFILE_SOURCE 1
# endif
# undef _FILE_OFFSET_BITS
# undef _TIME_BITS
#endif
#ifdef HAVE_HIDDEN
# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
#else
# define ZLIB_INTERNAL
#endif
#include <stdio.h>
#include "zlib.h"
#ifdef STDC
# include <string.h>
# include <stdlib.h>
# include <limits.h>
#endif
#ifndef _POSIX_SOURCE
# define _POSIX_SOURCE
#endif
#include <fcntl.h>
#ifdef _WIN32
# include <stddef.h>
#endif
#if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32)
# include <io.h>
#endif
#if defined(_WIN32)
# define WIDECHAR
#endif
#ifdef WINAPI_FAMILY
# define open _open
# define read _read
# define write _write
# define close _close
#endif
#ifdef NO_DEFLATE /* for compatibility with old definition */
# define NO_GZCOMPRESS
#endif
#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
# ifndef HAVE_VSNPRINTF
# define HAVE_VSNPRINTF
# endif
#endif
#if defined(__CYGWIN__)
# ifndef HAVE_VSNPRINTF
# define HAVE_VSNPRINTF
# endif
#endif
#if defined(MSDOS) && defined(__BORLANDC__) && (BORLANDC > 0x410)
# ifndef HAVE_VSNPRINTF
# define HAVE_VSNPRINTF
# endif
#endif
#ifndef HAVE_VSNPRINTF
# ifdef MSDOS
/* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
but for now we just assume it doesn't. */
# define NO_vsnprintf
# endif
# ifdef __TURBOC__
# define NO_vsnprintf
# endif
# ifdef WIN32
/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
# if !defined(vsnprintf) && !defined(NO_vsnprintf)
# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
# define vsnprintf _vsnprintf
# endif
# endif
# endif
# ifdef __SASC
# define NO_vsnprintf
# endif
# ifdef VMS
# define NO_vsnprintf
# endif
# ifdef __OS400__
# define NO_vsnprintf
# endif
# ifdef __MVS__
# define NO_vsnprintf
# endif
#endif
/* unlike snprintf (which is required in C99), _snprintf does not guarantee
null termination of the result -- however this is only used in gzlib.c where
the result is assured to fit in the space provided */
#if defined(_MSC_VER) && _MSC_VER < 1900
# define snprintf _snprintf
#endif
#ifndef local
# define local static
#endif
/* since "static" is used to mean two completely different things in C, we
define "local" for the non-static meaning of "static", for readability
(compile with -Dlocal if your debugger can't find static symbols) */
/* gz* functions always use library allocation functions */
#ifndef STDC
extern voidp malloc(uInt size);
extern void free(voidpf ptr);
#endif
/* get errno and strerror definition */
#if defined UNDER_CE
# include <windows.h>
# define zstrerror() gz_strwinerror((DWORD)GetLastError())
#else
# ifndef NO_STRERROR
# include <errno.h>
# define zstrerror() strerror(errno)
# else
# define zstrerror() "stdio error (consult errno)"
# endif
#endif
/* provide prototypes for these when building zlib without LFS */
#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *);
ZEXTERN z_off64_t ZEXPORT gzseek64(gzFile, z_off64_t, int);
ZEXTERN z_off64_t ZEXPORT gztell64(gzFile);
ZEXTERN z_off64_t ZEXPORT gzoffset64(gzFile);
#endif
/* default memLevel */
#if MAX_MEM_LEVEL >= 8
# define DEF_MEM_LEVEL 8
#else
# define DEF_MEM_LEVEL MAX_MEM_LEVEL
#endif
/* default i/o buffer size -- double this for output when reading (this and
twice this must be able to fit in an unsigned type) */
#define GZBUFSIZE 8192
/* gzip modes, also provide a little integrity check on the passed structure */
#define GZ_NONE 0
#define GZ_READ 7247
#define GZ_WRITE 31153
#define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */
/* values for gz_state how */
#define LOOK 0 /* look for a gzip header */
#define COPY 1 /* copy input directly */
#define GZIP 2 /* decompress a gzip stream */
/* internal gzip file state data structure */
typedef struct {
/* exposed contents for gzgetc() macro */
struct gzFile_s x; /* "x" for exposed */
/* x.have: number of bytes available at x.next */
/* x.next: next output data to deliver or write */
/* x.pos: current position in uncompressed data */
/* used for both reading and writing */
int mode; /* see gzip modes above */
int fd; /* file descriptor */
char *path; /* path or fd for error messages */
unsigned size; /* buffer size, zero if not allocated yet */
unsigned want; /* requested buffer size, default is GZBUFSIZE */
unsigned char *in; /* input buffer (double-sized when writing) */
unsigned char *out; /* output buffer (double-sized when reading) */
int direct; /* 0 if processing gzip, 1 if transparent */
/* just for reading */
int how; /* 0: get header, 1: copy, 2: decompress */
z_off64_t start; /* where the gzip data started, for rewinding */
int eof; /* true if end of input file reached */
int past; /* true if read requested past end */
/* just for writing */
int level; /* compression level */
int strategy; /* compression strategy */
int reset; /* true if a reset is pending after a Z_FINISH */
/* seek request */
z_off64_t skip; /* amount to skip (already rewound if backwards) */
int seek; /* true if seek request pending */
/* error information */
int err; /* error code */
char *msg; /* error message */
/* zlib inflate or deflate stream */
z_stream strm; /* stream structure in-place (not a pointer) */
} gz_state;
typedef gz_state FAR *gz_statep;
/* shared functions */
void ZLIB_INTERNAL gz_error(gz_statep, int, const char *);
#if defined UNDER_CE
char ZLIB_INTERNAL *gz_strwinerror(DWORD error);
#endif
/* 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
(possible z_off64_t types off_t, off64_t, and long are all signed) */
unsigned ZLIB_INTERNAL gz_intmax(void);
#define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())

View File

@@ -1,11 +0,0 @@
/* inffast.h -- header to use inffast.c
* Copyright (C) 1995-2003, 2010 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* WARNING: this file should *not* be used by applications. It is
part of the implementation of the compression library and is
subject to change. Applications should only use zlib.h.
*/
void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start);

View File

@@ -1,94 +0,0 @@
/* inffixed.h -- table for decoding fixed codes
* Generated automatically by makefixed().
*/
/* WARNING: this file should *not* be used by applications.
It is part of the implementation of this library and is
subject to change. Applications should only use zlib.h.
*/
static const code lenfix[512] = {
{96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
{0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
{0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
{0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},
{0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
{21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},
{0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
{0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},
{18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},
{0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},
{0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},
{0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},
{20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},
{0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},
{0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},
{0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},
{16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},
{0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
{0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},
{0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},
{0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},
{0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},
{0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},
{0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202},
{17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},
{0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},
{0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},
{0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},
{19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},
{0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},
{0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},
{0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},
{16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55},
{0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},
{0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},
{0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},
{0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},
{20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},
{0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},
{0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},
{17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},
{0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},
{0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},
{0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},
{20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},
{0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},
{0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},
{0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
{16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},
{0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},
{0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51},
{0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},
{0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},
{0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},
{0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},
{0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},
{16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},
{0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},
{0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},
{0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258},
{19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},
{0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},
{0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},
{0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},
{16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},
{0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
{0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},
{0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},
{0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},
{64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},
{0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},
{0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},
{18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},
{0,9,255}
};
static const code distfix[32] = {
{16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},
{21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},
{18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385},
{19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},
{16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},
{22,5,193},{64,5,0}
};

View File

@@ -1,126 +0,0 @@
/* inflate.h -- internal inflate state definition
* Copyright (C) 1995-2019 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* WARNING: this file should *not* be used by applications. It is
part of the implementation of the compression library and is
subject to change. Applications should only use zlib.h.
*/
/* define NO_GZIP when compiling if you want to disable gzip header and
trailer decoding by inflate(). NO_GZIP would be used to avoid linking in
the crc code when it is not needed. For shared libraries, gzip decoding
should be left enabled. */
#ifndef NO_GZIP
# define GUNZIP
#endif
/* Possible inflate modes between inflate() calls */
typedef enum {
HEAD = 16180, /* i: waiting for magic header */
FLAGS, /* i: waiting for method and flags (gzip) */
TIME, /* i: waiting for modification time (gzip) */
OS, /* i: waiting for extra flags and operating system (gzip) */
EXLEN, /* i: waiting for extra length (gzip) */
EXTRA, /* i: waiting for extra bytes (gzip) */
NAME, /* i: waiting for end of file name (gzip) */
COMMENT, /* i: waiting for end of comment (gzip) */
HCRC, /* i: waiting for header crc (gzip) */
DICTID, /* i: waiting for dictionary check value */
DICT, /* waiting for inflateSetDictionary() call */
TYPE, /* i: waiting for type bits, including last-flag bit */
TYPEDO, /* i: same, but skip check to exit inflate on new block */
STORED, /* i: waiting for stored size (length and complement) */
COPY_, /* i/o: same as COPY below, but only first time in */
COPY, /* i/o: waiting for input or output to copy stored block */
TABLE, /* i: waiting for dynamic block table lengths */
LENLENS, /* i: waiting for code length code lengths */
CODELENS, /* i: waiting for length/lit and distance code lengths */
LEN_, /* i: same as LEN below, but only first time in */
LEN, /* i: waiting for length/lit/eob code */
LENEXT, /* i: waiting for length extra bits */
DIST, /* i: waiting for distance code */
DISTEXT, /* i: waiting for distance extra bits */
MATCH, /* o: waiting for output space to copy string */
LIT, /* o: waiting for output space to write literal */
CHECK, /* i: waiting for 32-bit check value */
LENGTH, /* i: waiting for 32-bit length (gzip) */
DONE, /* finished check, done -- remain here until reset */
BAD, /* got a data error -- remain here until reset */
MEM, /* got an inflate() memory error -- remain here until reset */
SYNC /* looking for synchronization bytes to restart inflate() */
} inflate_mode;
/*
State transitions between above modes -
(most modes can go to BAD or MEM on error -- not shown for clarity)
Process header:
HEAD -> (gzip) or (zlib) or (raw)
(gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT ->
HCRC -> TYPE
(zlib) -> DICTID or TYPE
DICTID -> DICT -> TYPE
(raw) -> TYPEDO
Read deflate blocks:
TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK
STORED -> COPY_ -> COPY -> TYPE
TABLE -> LENLENS -> CODELENS -> LEN_
LEN_ -> LEN
Read deflate codes in fixed or dynamic block:
LEN -> LENEXT or LIT or TYPE
LENEXT -> DIST -> DISTEXT -> MATCH -> LEN
LIT -> LEN
Process trailer:
CHECK -> LENGTH -> DONE
*/
/* State maintained between inflate() calls -- approximately 7K bytes, not
including the allocated sliding window, which is up to 32K bytes. */
struct inflate_state {
z_streamp strm; /* pointer back to this zlib stream */
inflate_mode mode; /* current inflate mode */
int last; /* true if processing last block */
int wrap; /* bit 0 true for zlib, bit 1 true for gzip,
bit 2 true to validate check value */
int havedict; /* true if dictionary provided */
int flags; /* gzip header method and flags, 0 if zlib, or
-1 if raw or no header yet */
unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
unsigned long check; /* protected copy of check value */
unsigned long total; /* protected copy of output count */
gz_headerp head; /* where to save gzip header information */
/* sliding window */
unsigned wbits; /* log base 2 of requested window size */
unsigned wsize; /* window size or zero if not using window */
unsigned whave; /* valid bytes in the window */
unsigned wnext; /* window write index */
unsigned char FAR *window; /* allocated sliding window, if needed */
/* bit accumulator */
unsigned long hold; /* input bit accumulator */
unsigned bits; /* number of bits in "in" */
/* for string and stored block copying */
unsigned length; /* literal or length of data to copy */
unsigned offset; /* distance back to copy string from */
/* for table and code decoding */
unsigned extra; /* extra bits needed */
/* fixed and dynamic code tables */
code const FAR *lencode; /* starting table for length/literal codes */
code const FAR *distcode; /* starting table for distance codes */
unsigned lenbits; /* index bits for lencode */
unsigned distbits; /* index bits for distcode */
/* dynamic table building */
unsigned ncode; /* number of code length code lengths */
unsigned nlen; /* number of length code lengths */
unsigned ndist; /* number of distance code lengths */
unsigned have; /* number of code lengths in lens[] */
code FAR *next; /* next available space in codes[] */
unsigned short lens[320]; /* temporary storage for code lengths */
unsigned short work[288]; /* work area for code table building */
code codes[ENOUGH]; /* space for code tables */
int sane; /* if false, allow invalid distance too far */
int back; /* bits back of last unprocessed length/lit */
unsigned was; /* initial length of match */
};

View File

@@ -1,62 +0,0 @@
/* inftrees.h -- header to use inftrees.c
* Copyright (C) 1995-2005, 2010 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* WARNING: this file should *not* be used by applications. It is
part of the implementation of the compression library and is
subject to change. Applications should only use zlib.h.
*/
/* Structure for decoding tables. Each entry provides either the
information needed to do the operation requested by the code that
indexed that table entry, or it provides a pointer to another
table that indexes more bits of the code. op indicates whether
the entry is a pointer to another table, a literal, a length or
distance, an end-of-block, or an invalid code. For a table
pointer, the low four bits of op is the number of index bits of
that table. For a length or distance, the low four bits of op
is the number of extra bits to get after the code. bits is
the number of bits in this code or part of the code to drop off
of the bit buffer. val is the actual byte to output in the case
of a literal, the base length or distance, or the offset from
the current table to the next table. Each entry is four bytes. */
typedef struct {
unsigned char op; /* operation, extra bits, table bits */
unsigned char bits; /* bits in this part of the code */
unsigned short val; /* offset in table or code value */
} code;
/* op values as set by inflate_table():
00000000 - literal
0000tttt - table link, tttt != 0 is the number of table index bits
0001eeee - length or distance, eeee is the number of extra bits
01100000 - end of block
01000000 - invalid code
*/
/* Maximum size of the dynamic table. The maximum number of code structures is
1444, which is the sum of 852 for literal/length codes and 592 for distance
codes. These values were found by exhaustive searches using the program
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
maximum bit length of a code. "enough 286 9 15" for literal/length codes
returns 852, and "enough 30 6 15" for distance codes returns 592. 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
changed, then these maximum sizes would be need to be recalculated and
updated. */
#define ENOUGH_LENS 852
#define ENOUGH_DISTS 592
#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS)
/* Type of code to build for inflate_table() */
typedef enum {
CODES,
LENS,
DISTS
} codetype;
int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens,
unsigned codes, code FAR * FAR *table,
unsigned FAR *bits, unsigned short FAR *work);

View File

@@ -1,128 +0,0 @@
/* header created automatically with -DGEN_TREES_H */
local const ct_data static_ltree[L_CODES+2] = {
{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}},
{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}},
{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}},
{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}},
{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}},
{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}},
{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}},
{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}},
{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}},
{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}},
{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}},
{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}},
{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}},
{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}},
{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}},
{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}},
{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}},
{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}},
{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}},
{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}},
{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}},
{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}},
{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}},
{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}},
{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}},
{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}},
{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}},
{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}},
{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}},
{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}},
{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}},
{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}},
{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}},
{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}},
{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}},
{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}},
{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}},
{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}},
{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}},
{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}},
{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}},
{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}},
{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}},
{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}},
{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}},
{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}},
{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}},
{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}},
{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}},
{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}},
{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}},
{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}},
{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}},
{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}},
{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}},
{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}},
{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}},
{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}}
};
local const ct_data static_dtree[D_CODES] = {
{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}},
{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}},
{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}},
{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}},
{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}},
{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}
};
const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {
0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13,
13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17,
18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22,
23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27,
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
};
const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {
0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12,
13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22,
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26,
26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28
};
local const int base_length[LENGTH_CODES] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56,
64, 80, 96, 112, 128, 160, 192, 224, 0
};
local const int base_dist[D_CODES] = {
0, 1, 2, 3, 4, 6, 8, 12, 16, 24,
32, 48, 64, 96, 128, 192, 256, 384, 512, 768,
1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576
};

View File

@@ -1,543 +0,0 @@
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#ifndef ZCONF_H
#define ZCONF_H
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
* Even better than compiling with -DZ_PREFIX would be to use configure to set
* this permanently in zconf.h using "./configure --zprefix".
*/
#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
# define Z_PREFIX_SET
/* all linked symbols and init macros */
# define _dist_code z__dist_code
# define _length_code z__length_code
# define _tr_align z__tr_align
# define _tr_flush_bits z__tr_flush_bits
# define _tr_flush_block z__tr_flush_block
# define _tr_init z__tr_init
# define _tr_stored_block z__tr_stored_block
# define _tr_tally z__tr_tally
# define adler32 z_adler32
# define adler32_combine z_adler32_combine
# define adler32_combine64 z_adler32_combine64
# define adler32_z z_adler32_z
# ifndef Z_SOLO
# define compress z_compress
# define compress2 z_compress2
# define compressBound z_compressBound
# endif
# define crc32 z_crc32
# define crc32_combine z_crc32_combine
# define crc32_combine64 z_crc32_combine64
# define crc32_combine_gen z_crc32_combine_gen
# define crc32_combine_gen64 z_crc32_combine_gen64
# define crc32_combine_op z_crc32_combine_op
# define crc32_z z_crc32_z
# define deflate z_deflate
# define deflateBound z_deflateBound
# define deflateCopy z_deflateCopy
# define deflateEnd z_deflateEnd
# define deflateGetDictionary z_deflateGetDictionary
# define deflateInit z_deflateInit
# define deflateInit2 z_deflateInit2
# define deflateInit2_ z_deflateInit2_
# define deflateInit_ z_deflateInit_
# define deflateParams z_deflateParams
# define deflatePending z_deflatePending
# define deflatePrime z_deflatePrime
# define deflateReset z_deflateReset
# define deflateResetKeep z_deflateResetKeep
# define deflateSetDictionary z_deflateSetDictionary
# define deflateSetHeader z_deflateSetHeader
# define deflateTune z_deflateTune
# define deflate_copyright z_deflate_copyright
# define get_crc_table z_get_crc_table
# ifndef Z_SOLO
# define gz_error z_gz_error
# define gz_intmax z_gz_intmax
# define gz_strwinerror z_gz_strwinerror
# define gzbuffer z_gzbuffer
# define gzclearerr z_gzclearerr
# define gzclose z_gzclose
# define gzclose_r z_gzclose_r
# define gzclose_w z_gzclose_w
# define gzdirect z_gzdirect
# define gzdopen z_gzdopen
# define gzeof z_gzeof
# define gzerror z_gzerror
# define gzflush z_gzflush
# define gzfread z_gzfread
# define gzfwrite z_gzfwrite
# define gzgetc z_gzgetc
# define gzgetc_ z_gzgetc_
# define gzgets z_gzgets
# define gzoffset z_gzoffset
# define gzoffset64 z_gzoffset64
# define gzopen z_gzopen
# define gzopen64 z_gzopen64
# ifdef _WIN32
# define gzopen_w z_gzopen_w
# endif
# define gzprintf z_gzprintf
# define gzputc z_gzputc
# define gzputs z_gzputs
# define gzread z_gzread
# define gzrewind z_gzrewind
# define gzseek z_gzseek
# define gzseek64 z_gzseek64
# define gzsetparams z_gzsetparams
# define gztell z_gztell
# define gztell64 z_gztell64
# define gzungetc z_gzungetc
# define gzvprintf z_gzvprintf
# define gzwrite z_gzwrite
# endif
# define inflate z_inflate
# define inflateBack z_inflateBack
# define inflateBackEnd z_inflateBackEnd
# define inflateBackInit z_inflateBackInit
# define inflateBackInit_ z_inflateBackInit_
# define inflateCodesUsed z_inflateCodesUsed
# define inflateCopy z_inflateCopy
# define inflateEnd z_inflateEnd
# define inflateGetDictionary z_inflateGetDictionary
# define inflateGetHeader z_inflateGetHeader
# define inflateInit z_inflateInit
# define inflateInit2 z_inflateInit2
# define inflateInit2_ z_inflateInit2_
# define inflateInit_ z_inflateInit_
# define inflateMark z_inflateMark
# define inflatePrime z_inflatePrime
# define inflateReset z_inflateReset
# define inflateReset2 z_inflateReset2
# define inflateResetKeep z_inflateResetKeep
# define inflateSetDictionary z_inflateSetDictionary
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateUndermine z_inflateUndermine
# define inflateValidate z_inflateValidate
# define inflate_copyright z_inflate_copyright
# define inflate_fast z_inflate_fast
# define inflate_table z_inflate_table
# ifndef Z_SOLO
# define uncompress z_uncompress
# define uncompress2 z_uncompress2
# endif
# define zError z_zError
# ifndef Z_SOLO
# define zcalloc z_zcalloc
# define zcfree z_zcfree
# endif
# define zlibCompileFlags z_zlibCompileFlags
# define zlibVersion z_zlibVersion
/* all zlib typedefs in zlib.h and zconf.h */
# define Byte z_Byte
# define Bytef z_Bytef
# define alloc_func z_alloc_func
# define charf z_charf
# define free_func z_free_func
# ifndef Z_SOLO
# define gzFile z_gzFile
# endif
# define gz_header z_gz_header
# define gz_headerp z_gz_headerp
# define in_func z_in_func
# define intf z_intf
# define out_func z_out_func
# define uInt z_uInt
# define uIntf z_uIntf
# define uLong z_uLong
# define uLongf z_uLongf
# define voidp z_voidp
# define voidpc z_voidpc
# define voidpf z_voidpf
/* all zlib structs in zlib.h and zconf.h */
# define gz_header_s z_gz_header_s
# define internal_state z_internal_state
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS
#endif
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
# define OS2
#endif
#if defined(_WINDOWS) && !defined(WINDOWS)
# define WINDOWS
#endif
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
# ifndef WIN32
# define WIN32
# endif
#endif
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
# ifndef SYS16BIT
# define SYS16BIT
# endif
# endif
#endif
/*
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
* than 64k bytes at a time (needed on systems with 16-bit int).
*/
#ifdef SYS16BIT
# define MAXSEG_64K
#endif
#ifdef MSDOS
# define UNALIGNED_OK
#endif
#ifdef __STDC_VERSION__
# ifndef STDC
# define STDC
# endif
# if __STDC_VERSION__ >= 199901L
# ifndef STDC99
# define STDC99
# endif
# endif
#endif
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
# define STDC
#endif
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
# define STDC
#endif
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
# define STDC
#endif
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
# define STDC
#endif
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
# define STDC
#endif
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const /* note: need a more gentle solution here */
# endif
#endif
#if defined(ZLIB_CONST) && !defined(z_const)
# define z_const const
#else
# define z_const
#endif
#ifdef Z_SOLO
# ifdef _WIN64
typedef unsigned long long z_size_t;
# else
typedef unsigned long z_size_t;
# endif
#else
# define z_longlong long long
# if defined(NO_SIZE_T)
typedef unsigned NO_SIZE_T z_size_t;
# elif defined(STDC)
# include <stddef.h>
typedef size_t z_size_t;
# else
typedef unsigned long z_size_t;
# endif
# undef z_longlong
#endif
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8
# else
# define MAX_MEM_LEVEL 9
# endif
#endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
* created by gzip. (Files created by minigzip can still be extracted by
* gzip.)
*/
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
(1 << (windowBits+2)) + (1 << (memLevel+9))
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
for small objects.
*/
/* Type declarations */
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* just define FAR to be empty.
*/
#ifdef SYS16BIT
# if defined(M_I86SM) || defined(M_I86MM)
/* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR _far
# else
# define FAR far
# endif
# endif
# if (defined(__SMALL__) || defined(__MEDIUM__))
/* Turbo C small or medium model */
# define SMALL_MEDIUM
# ifdef __BORLANDC__
# define FAR _far
# else
# define FAR far
# endif
# endif
#endif
#if defined(WINDOWS) || defined(WIN32)
/* If building or using zlib as a DLL, define ZLIB_DLL.
* This is not mandatory, but it offers a little performance increase.
*/
# ifdef ZLIB_DLL
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
# ifdef ZLIB_INTERNAL
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
# endif
# endif /* ZLIB_DLL */
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
* define ZLIB_WINAPI.
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
*/
# ifdef ZLIB_WINAPI
# ifdef FAR
# undef FAR
# endif
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
# include <windows.h>
/* No need for _export, use ZLIB.DEF instead. */
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
# define ZEXPORT WINAPI
# ifdef WIN32
# define ZEXPORTVA WINAPIV
# else
# define ZEXPORTVA FAR CDECL
# endif
# endif
#endif
#if defined (__BEOS__)
# ifdef ZLIB_DLL
# ifdef ZLIB_INTERNAL
# define ZEXPORT __declspec(dllexport)
# define ZEXPORTVA __declspec(dllexport)
# else
# define ZEXPORT __declspec(dllimport)
# define ZEXPORTVA __declspec(dllimport)
# endif
# endif
#endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif
#ifndef ZEXPORT
# define ZEXPORT
#endif
#ifndef ZEXPORTVA
# define ZEXPORTVA
#endif
#ifndef FAR
# define FAR
#endif
#if !defined(__MACTYPES__)
typedef unsigned char Byte; /* 8 bits */
#endif
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
typedef Byte FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
#ifdef STDC
typedef void const *voidpc;
typedef void FAR *voidpf;
typedef void *voidp;
#else
typedef Byte const *voidpc;
typedef Byte FAR *voidpf;
typedef Byte *voidp;
#endif
#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
# include <limits.h>
# if (UINT_MAX == 0xffffffffUL)
# define Z_U4 unsigned
# elif (ULONG_MAX == 0xffffffffUL)
# define Z_U4 unsigned long
# elif (USHRT_MAX == 0xffffffffUL)
# define Z_U4 unsigned short
# endif
#endif
#ifdef Z_U4
typedef Z_U4 z_crc_t;
#else
typedef unsigned long z_crc_t;
#endif
#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
# define Z_HAVE_UNISTD_H
#endif
#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
# define Z_HAVE_STDARG_H
#endif
#ifdef STDC
# ifndef Z_SOLO
# include <sys/types.h> /* for off_t */
# endif
#endif
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
# ifndef Z_SOLO
# include <stdarg.h> /* for va_list */
# endif
#endif
#ifdef _WIN32
# ifndef Z_SOLO
# include <stddef.h> /* for wchar_t */
# endif
#endif
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
* though the former does not conform to the LFS document), but considering
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
* equivalently requesting no 64-bit operations
*/
#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
# undef _LARGEFILE64_SOURCE
#endif
#ifndef Z_HAVE_UNISTD_H
# ifdef __WATCOMC__
# define Z_HAVE_UNISTD_H
# endif
#endif
#ifndef Z_HAVE_UNISTD_H
# if defined(_LARGEFILE64_SOURCE) && !defined(_WIN32)
# define Z_HAVE_UNISTD_H
# endif
#endif
#ifndef Z_SOLO
# if defined(Z_HAVE_UNISTD_H)
# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
# ifdef VMS
# include <unixio.h> /* for off_t */
# endif
# ifndef z_off_t
# define z_off_t off_t
# endif
# endif
#endif
#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
# define Z_LFS64
#endif
#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
# define Z_LARGE64
#endif
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
# define Z_WANT64
#endif
#if !defined(SEEK_SET) && !defined(Z_SOLO)
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
#endif
#if !defined(_WIN32) && defined(Z_LARGE64)
# define z_off64_t off64_t
#else
# if defined(_WIN32) && !defined(__GNUC__)
# define z_off64_t __int64
# else
# define z_off64_t z_off_t
# endif
#endif
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
#pragma map(deflateInit_,"DEIN")
#pragma map(deflateInit2_,"DEIN2")
#pragma map(deflateEnd,"DEEND")
#pragma map(deflateBound,"DEBND")
#pragma map(inflateInit_,"ININ")
#pragma map(inflateInit2_,"ININ2")
#pragma map(inflateEnd,"INEND")
#pragma map(inflateSync,"INSY")
#pragma map(inflateSetDictionary,"INSEDI")
#pragma map(compressBound,"CMBND")
#pragma map(inflate_table,"INTABL")
#pragma map(inflate_fast,"INFA")
#pragma map(inflate_copyright,"INCOPY")
#endif
#endif /* ZCONF_H */

File diff suppressed because it is too large Load Diff

View File

@@ -1,254 +0,0 @@
/* zutil.h -- internal interface and configuration of the compression library
* Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* WARNING: this file should *not* be used by applications. It is
part of the implementation of the compression library and is
subject to change. Applications should only use zlib.h.
*/
/* @(#) $Id$ */
#ifndef ZUTIL_H
#define ZUTIL_H
#ifdef HAVE_HIDDEN
# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
#else
# define ZLIB_INTERNAL
#endif
#include "zlib.h"
#if defined(STDC) && !defined(Z_SOLO)
# if !(defined(_WIN32_WCE) && defined(_MSC_VER))
# include <stddef.h>
# endif
# include <string.h>
# include <stdlib.h>
#endif
#ifndef local
# define local static
#endif
/* since "static" is used to mean two completely different things in C, we
define "local" for the non-static meaning of "static", for readability
(compile with -Dlocal if your debugger can't find static symbols) */
typedef unsigned char uch;
typedef uch FAR uchf;
typedef unsigned short ush;
typedef ush FAR ushf;
typedef unsigned long ulg;
#if !defined(Z_U8) && !defined(Z_SOLO) && defined(STDC)
# include <limits.h>
# if (ULONG_MAX == 0xffffffffffffffff)
# define Z_U8 unsigned long
# elif (ULLONG_MAX == 0xffffffffffffffff)
# define Z_U8 unsigned long long
# elif (UINT_MAX == 0xffffffffffffffff)
# define Z_U8 unsigned
# endif
#endif
extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
/* (size given to avoid silly warnings with Visual C++) */
#define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)]
#define ERR_RETURN(strm,err) \
return (strm->msg = ERR_MSG(err), (err))
/* To be used only when the state is known to be valid */
/* common constants */
#ifndef DEF_WBITS
# define DEF_WBITS MAX_WBITS
#endif
/* default windowBits for decompression. MAX_WBITS is for compression only */
#if MAX_MEM_LEVEL >= 8
# define DEF_MEM_LEVEL 8
#else
# define DEF_MEM_LEVEL MAX_MEM_LEVEL
#endif
/* default memLevel */
#define STORED_BLOCK 0
#define STATIC_TREES 1
#define DYN_TREES 2
/* The three kinds of block type */
#define MIN_MATCH 3
#define MAX_MATCH 258
/* The minimum and maximum match lengths */
#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
/* target dependencies */
#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
# define OS_CODE 0x00
# ifndef Z_SOLO
# if defined(__TURBOC__) || defined(__BORLANDC__)
# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
/* Allow compilation with ANSI keywords only enabled */
void _Cdecl farfree( void *block );
void *_Cdecl farmalloc( unsigned long nbytes );
# else
# include <alloc.h>
# endif
# else /* MSC or DJGPP */
# include <malloc.h>
# endif
# endif
#endif
#ifdef AMIGA
# define OS_CODE 1
#endif
#if defined(VAXC) || defined(VMS)
# define OS_CODE 2
# define F_OPEN(name, mode) \
fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
#endif
#ifdef __370__
# if __TARGET_LIB__ < 0x20000000
# define OS_CODE 4
# elif __TARGET_LIB__ < 0x40000000
# define OS_CODE 11
# else
# define OS_CODE 8
# endif
#endif
#if defined(ATARI) || defined(atarist)
# define OS_CODE 5
#endif
#ifdef OS2
# define OS_CODE 6
# if defined(M_I86) && !defined(Z_SOLO)
# include <malloc.h>
# endif
#endif
#if defined(MACOS)
# define OS_CODE 7
#endif
#ifdef __acorn
# define OS_CODE 13
#endif
#if defined(WIN32) && !defined(__CYGWIN__)
# define OS_CODE 10
#endif
#ifdef _BEOS_
# define OS_CODE 16
#endif
#ifdef __TOS_OS400__
# define OS_CODE 18
#endif
#ifdef __APPLE__
# define OS_CODE 19
#endif
#if defined(__BORLANDC__) && !defined(MSDOS)
#pragma warn -8004
#pragma warn -8008
#pragma warn -8066
#endif
/* provide prototypes for these when building zlib without LFS */
#if !defined(_WIN32) && \
(!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off_t);
ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off_t);
ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off_t);
#endif
/* common defaults */
#ifndef OS_CODE
# define OS_CODE 3 /* assume Unix */
#endif
#ifndef F_OPEN
# define F_OPEN(name, mode) fopen((name), (mode))
#endif
/* functions */
#if defined(pyr) || defined(Z_SOLO)
# define NO_MEMCPY
#endif
#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
/* Use our own functions for small and medium model with MSC <= 5.0.
* You may have to use the same strategy for Borland C (untested).
* The __SC__ check is for Symantec.
*/
# define NO_MEMCPY
#endif
#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
# define HAVE_MEMCPY
#endif
#ifdef HAVE_MEMCPY
# ifdef SMALL_MEDIUM /* MSDOS small or medium model */
# define zmemcpy _fmemcpy
# define zmemcmp _fmemcmp
# define zmemzero(dest, len) _fmemset(dest, 0, len)
# else
# define zmemcpy memcpy
# define zmemcmp memcmp
# define zmemzero(dest, len) memset(dest, 0, len)
# endif
#else
void ZLIB_INTERNAL zmemcpy(Bytef* dest, const Bytef* source, uInt len);
int ZLIB_INTERNAL zmemcmp(const Bytef* s1, const Bytef* s2, uInt len);
void ZLIB_INTERNAL zmemzero(Bytef* dest, uInt len);
#endif
/* Diagnostic functions */
#ifdef ZLIB_DEBUG
# include <stdio.h>
extern int ZLIB_INTERNAL z_verbose;
extern void ZLIB_INTERNAL z_error(char *m);
# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
# define Trace(x) {if (z_verbose>=0) fprintf x ;}
# define Tracev(x) {if (z_verbose>0) fprintf x ;}
# define Tracevv(x) {if (z_verbose>1) fprintf x ;}
# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
#else
# define Assert(cond,msg)
# define Trace(x)
# define Tracev(x)
# define Tracevv(x)
# define Tracec(c,x)
# define Tracecv(c,x)
#endif
#ifndef Z_SOLO
voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items,
unsigned size);
void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr);
#endif
#define ZALLOC(strm, items, size) \
(*((strm)->zalloc))((strm)->opaque, (items), (size))
#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
/* Reverse the bytes in a 32-bit value */
#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
(((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
#endif /* ZUTIL_H */

View File

@@ -37,9 +37,25 @@ AttributedString::AttributedString(const std::string& content, Alignment align,
{
}
AttributedString::~AttributedString() = default;
AttributedString::~AttributedString()
AttributedString& AttributedString::operator=(const std::string& content)
{
_content = content;
return *this;
}
AttributedString& AttributedString::operator=(const char* content)
{
_content = content;
return *this;
}
AttributedString::operator const std::string&()
{
return _content;
}

View File

@@ -33,9 +33,96 @@ Cell::Cell(const AttributedString& content, FontMapPtr pFontMap, const std::stri
setFonts(pFontMap);
}
Cell::~Cell() = default;
Cell::~Cell()
const std::string& Cell::getName() const
{
return _name;
}
void Cell::setName(const std::string& name)
{
_name = name;
}
const AttributedString& Cell::getContent() const
{
return _content;
}
void Cell::setContent(const AttributedString& content)
{
_content = content;
}
unsigned Cell::getOutline() const
{
return _outline;
}
void Cell::setOutline(Cell::Outline outline, bool show)
{
if (show) _outline |= outline;
else _outline &= ~outline;
}
void Cell::borderLeft(bool show)
{
setOutline(OUTLINE_LEFT, show);
}
void Cell::borderTop(bool show)
{
setOutline(OUTLINE_TOP, show);
}
void Cell::borderRight(bool show)
{
setOutline(OUTLINE_RIGHT, show);
}
void Cell::borderBottom(bool show)
{
setOutline(OUTLINE_BOTTOM, show);
}
float Cell::getLineWidth() const
{
return _lineWidth;
}
void Cell::setLineWidth(float width)
{
_lineWidth = width;
}
int Cell::getWidthAsPct() const
{
return _widthAsPct;
}
void Cell::setWidthAsPct(int width)
{
_widthAsPct = width;
}
bool Cell::hasWidth() const
{
return _widthAsPct > 0;
}

View File

@@ -14,6 +14,7 @@
#include "Poco/PDF/Destination.h"
#include <hpdf.h>
namespace Poco {
namespace PDF {
@@ -26,11 +27,55 @@ Destination::Destination(HPDF_Doc* pPDF,
{
}
Destination::~Destination() = default;
Destination::~Destination()
void Destination::positionAndZoom(float x, float y, float zoom)
{
HPDF_Destination_SetXYZ(handle(), x, y, zoom);
}
void Destination::fit()
{
HPDF_Destination_SetFit(handle());
}
void Destination::fitHorizontal(float top)
{
HPDF_Destination_SetFitH(handle(), top);
}
void Destination::fitVertical(float left)
{
HPDF_Destination_SetFitV(handle(), left);
}
void Destination::fitRectangle(float left, float top, float right, float bottom)
{
HPDF_Destination_SetFitR(handle(), left, bottom, right, top);
}
void Destination::fitWindow()
{
HPDF_Destination_SetFitB(handle());
}
void Destination::fitWindowHorizontal(float top)
{
HPDF_Destination_SetFitBH(handle(), top);
}
void Destination::fitWindowVertical(float left)
{
HPDF_Destination_SetFitBV(handle(), left);
}
} } // namespace Poco::PDF

View File

@@ -20,31 +20,43 @@
#include "Poco/DateTimeFormatter.h"
#include "Poco/StringTokenizer.h"
#include "Poco/NumberParser.h"
#include <hpdf.h>
#include <utility>
namespace Poco {
namespace PDF {
static_assert(static_cast<int>(Document::Info::INFO_CREATION_DATE) == HPDF_INFO_CREATION_DATE, "Document info value mismatch");
static_assert(static_cast<int>(Document::Info::INFO_KEYWORDS) == HPDF_INFO_KEYWORDS, "Document info value mismatch");
static_assert(static_cast<int>(Document::PageLayout::PAGE_LAYOUT_SINGLE) == HPDF_PAGE_LAYOUT_SINGLE, "Page layout value mismatch");
static_assert(static_cast<int>(Document::PageLayout::PAGE_LAYOUT_TWO_COLUMN_RIGHT) == HPDF_PAGE_LAYOUT_TWO_COLUMN_RIGHT, "Page layout value mismatch");
static_assert(static_cast<int>(Document::PageMode::PAGE_MODE_USE_NONE) == HPDF_PAGE_MODE_USE_NONE, "Page mode value mismatch");
static_assert(static_cast<int>(Document::PageMode::PAGE_MODE_FULL_SCREEN) == HPDF_PAGE_MODE_FULL_SCREEN, "Page mode value mismatch");
static_assert(static_cast<int>(Document::Encryption::ENCRYPT_R2) == HPDF_ENCRYPT_R2, "Encryption value mismatch");
static_assert(static_cast<int>(Document::Encryption::ENCRYPT_R3) == HPDF_ENCRYPT_R3, "Encryption value mismatch");
static_assert(static_cast<int>(Document::PageNumberStyle::PAGE_NUM_STYLE_DECIMAL) == HPDF_PAGE_NUM_STYLE_DECIMAL, "Page number value mismatch");
static_assert(static_cast<int>(Document::PageNumberStyle::PAGE_NUM_STYLE_LOWER_LETTERS) == HPDF_PAGE_NUM_STYLE_LOWER_LETTERS, "Page number value mismatch");
Document::Document(const std::string fileName,
Poco::UInt32 pageCount,
Page::Size pageSize,
Page::Orientation orientation):
_pdf(HPDF_New(HPDF_Error_Handler, 0)),
Poco::UInt32 pageCount,
Page::Size pageSize,
Page::Orientation orientation) :
_pdf(HPDF_New(HPDF_Error_Handler, nullptr)),
_fileName(fileName),
_pRawData(0),
_pRawData(nullptr),
_size(0)
{
init(pageCount, pageSize, orientation);
}
Document::Document(Poco::UInt32 pageCount,
Page::Size pageSize,
Page::Orientation orientation):
_pdf(HPDF_New(HPDF_Error_Handler, 0)),
_pRawData(0),
Document::Document(Poco::UInt32 pageCount, Page::Size pageSize, Page::Orientation orientation) :
_pdf(HPDF_New(HPDF_Error_Handler, nullptr)),
_pRawData(nullptr),
_size(0)
{
init(pageCount, pageSize, orientation);
@@ -57,6 +69,166 @@ Document::~Document()
delete _pRawData;
}
void Document::setPages(std::size_t pagePerPages)
{
HPDF_SetPagesConfiguration(_pdf, static_cast<HPDF_UINT>(pagePerPages));
}
void Document::setPageLayout(PageLayout pageLayout)
{
HPDF_SetPageLayout(_pdf, static_cast<HPDF_PageLayout>(pageLayout));
}
Document::PageLayout Document::getPageLayout() const
{
return static_cast<PageLayout>(HPDF_GetPageLayout(_pdf));
}
void Document::setPageMode(PageMode pageMode)
{
HPDF_SetPageMode(_pdf, static_cast<HPDF_PageMode>(pageMode));
}
Document::PageMode Document::getPageMode() const
{
return static_cast<PageMode>(HPDF_GetPageMode(_pdf));
}
/*
void openAction()
{
HPDF_SetOpenAction(_pdf, HPDF_Destination open_action);
}
*/
const Page& Document::getPage(int index)
{
return _pages.at(index);
}
const Page& Document::operator [] (int index)
{
return _pages[index];
}
void Document::compression(Compression mode)
{
HPDF_SetCompressionMode(_pdf, mode);
}
void Document::addPageLabel(int pageNum, PageNumberStyle style, int firstPage, const std::string& prefix)
{
HPDF_AddPageLabel(_pdf,
static_cast<HPDF_UINT>(pageNum),
static_cast<HPDF_PageNumStyle>(style),
static_cast<HPDF_UINT>(firstPage),
prefix.c_str());
}
void Document::useUTF8Encoding()
{
HPDF_UseUTFEncodings(_pdf);
}
void Document::useJapaneseFonts()
{
HPDF_UseJPFonts(_pdf);
}
void Document::useKoreanFonts()
{
HPDF_UseKRFonts(_pdf);
}
void Document::useChineseFonts()
{
HPDF_UseCNSFonts(_pdf);
}
void Document::useChineseTraditionalFonts()
{
HPDF_UseCNTFonts(_pdf);
}
void Document::useJapaneseEncodings()
{
HPDF_UseJPEncodings(_pdf);
}
void Document::useKoreanEncodings()
{
HPDF_UseKREncodings(_pdf);
}
void Document::useChineseEncodings()
{
HPDF_UseCNSEncodings(_pdf);
}
void Document::useChineseTraditionalEncodings()
{
HPDF_UseCNTEncodings(_pdf);
}
void Document::extendedGraphicState()
{
HPDF_CreateExtGState(_pdf);
}
const Image& Document::loadPNGImage(const std::string& fileName)
{
return loadPNGImageImpl(fileName, true);
}
const Image& Document::loadPNGImageInfo(const std::string& fileName)
{
return loadPNGImageImpl(fileName, false);
}
std::string Document::getInfo(Info info)
{
return HPDF_GetInfoAttr(_pdf, static_cast<HPDF_InfoType>(info));
}
void Document::setPermission(Permission perm)
{
HPDF_SetPermission(_pdf, static_cast<HPDF_UINT>(perm));
}
std::size_t Document::pageCount() const
{
return _pages.size();
}
HPDF_Doc& Document::handle()
{
return _pdf;
}
void Document::init(Poco::UInt32 pageCount,
Page::Size pageSize, Page::Orientation orientation)
@@ -130,8 +302,8 @@ const Page& Document::insertPage(int index,
const Page& Document::getCurrentPage()
{
Page p(this, HPDF_GetCurrentPage(_pdf));
PageContainer::iterator it = _pages.begin();
PageContainer::iterator end = _pages.end();
auto it = _pages.begin();
auto end = _pages.end();
for (;it != end; ++it)
if (*it == p) return *it;
@@ -141,7 +313,8 @@ const Page& Document::getCurrentPage()
const Font& Document::loadFont(const std::string& name, const std::string& encoding)
{
Font font(&_pdf, HPDF_GetFont(_pdf, name.c_str(), encoding.empty() ? 0 : encoding.c_str()));
Font font(&_pdf,
HPDF_GetFont(_pdf, name.c_str(), encoding.empty() ? nullptr : encoding.c_str()));
std::pair<FontContainer::iterator, bool> ret =
_fonts.insert(FontContainer::value_type(name, font));
@@ -153,7 +326,7 @@ const Font& Document::loadFont(const std::string& name, const std::string& encod
const Font& Document::font(const std::string& name, const std::string& encoding)
{
FontContainer::iterator it = _fonts.find(name);
auto it = _fonts.find(name);
if (_fonts.end() != it) return it->second;
return loadFont(name, encoding);
@@ -241,7 +414,7 @@ void Document::encryption(Encryption mode, Poco::UInt32 keyLength)
const Encoder& Document::loadEncoder(const std::string& name)
{
EncoderContainer::iterator it = _encoders.find(name);
auto it = _encoders.find(name);
if (_encoders.end() == it) return it->second;
Encoder enc(&_pdf, HPDF_GetEncoder(_pdf, name.c_str()), name);
@@ -258,7 +431,7 @@ const Encoder& Document::getCurrentEncoder()
{
HPDF_Encoder enc = HPDF_GetCurrentEncoder(_pdf);
std::string name = enc->name;
EncoderContainer::iterator it = _encoders.find(name);
auto it = _encoders.find(name);
if (_encoders.end() == it)
{
std::pair<EncoderContainer::iterator, bool> ret =
@@ -281,7 +454,7 @@ const Encoder& Document::setCurrentEncoder(const std::string& name)
const Outline& Document::createOutline(const std::string& title, const Outline& parent, const Encoder& encoder)
{
_outlines.push_back(Outline(&_pdf, HPDF_CreateOutline(_pdf, parent, title.c_str(), encoder)));
_outlines.emplace_back(&_pdf, HPDF_CreateOutline(_pdf, parent, title.c_str(), encoder));
return _outlines.back();
}

View File

@@ -13,7 +13,9 @@
#include "Poco/PDF/Encoder.h"
#include "Poco/Exception.h"
#include <hpdf.h>
namespace Poco {
namespace PDF {
@@ -26,11 +28,30 @@ Encoder::Encoder(HPDF_Doc* pPDF,
{
}
Encoder::~Encoder() = default;
Encoder::~Encoder()
Encoder::Type Encoder::getType() const
{
return static_cast<Type>(HPDF_Encoder_GetType(handle()));
}
Encoder::ByteType Encoder::getByteType(const std::string& text, int index) const
{
if (index < 0)
throw InvalidArgumentException("Negative values not allowed.");
return static_cast<ByteType>(HPDF_Encoder_GetByteType(handle(),
text.c_str(),
static_cast<HPDF_UINT>(index)));
}
Encoder::WriteMode Encoder::writeMode()
{
return static_cast<WriteMode>(HPDF_Encoder_GetWritingMode(handle()));
}
} } // namespace Poco::PDF

View File

@@ -14,6 +14,7 @@
#include "Poco/PDF/Font.h"
#include <hpdf.h>
namespace Poco {
namespace PDF {
@@ -24,10 +25,74 @@ Font::Font(HPDF_Doc* pPDF, HPDF_Font font):
{
}
Font::~Font() = default;
Font::~Font()
std::string Font::encodingName() const
{
return HPDF_Font_GetEncodingName(handle());
}
int Font::unicodeWidth(Poco::UInt16 ch) const
{
return HPDF_Font_GetUnicodeWidth(handle(), ch);
}
Rectangle Font::boundingBox() const
{
return HPDF_Font_GetBBox(handle());
}
int Font::ascent() const
{
return HPDF_Font_GetAscent(handle());
}
int Font::descent() const
{
return HPDF_Font_GetDescent(handle());
}
int Font::lowerHeight() const
{
return static_cast<int>(HPDF_Font_GetXHeight(handle()));
}
int Font::upperHeight() const
{
return static_cast<int>(HPDF_Font_GetCapHeight(handle()));
}
TextWidth Font::textWidth(const std::string& text)
{
return HPDF_Font_TextWidth(handle(),
reinterpret_cast<const HPDF_BYTE*>(text.data()),
static_cast<HPDF_UINT>(text.size()));
}
int Font::measureText(const std::string& text,
float width,
float fontSize,
float charSpace,
float wordSpace,
bool wordWrap)
{
return static_cast<int>(HPDF_Font_MeasureText(handle(),
reinterpret_cast<const HPDF_BYTE*>(text.data()),
static_cast<HPDF_UINT>(text.size()),
width,
fontSize,
charSpace,
wordSpace,
wordWrap,
nullptr));
}

View File

@@ -14,6 +14,7 @@
#include "Poco/PDF/Image.h"
#include <hpdf.h>
namespace Poco {
namespace PDF {
@@ -24,11 +25,52 @@ Image::Image(HPDF_Doc* pPDF, const HPDF_Image& resource, const std::string& name
{
}
Image::~Image() = default;
Image::~Image()
Point Image::size() const
{
return HPDF_Image_GetSize(handle());
}
float Image::width() const
{
return static_cast<float>(HPDF_Image_GetWidth(handle()));
}
float Image::height() const
{
return static_cast<float>(HPDF_Image_GetHeight(handle()));
}
Poco::UInt32 Image::bitsPerColor() const
{
return HPDF_Image_GetBitsPerComponent(handle());
}
std::string Image::colorSpace() const
{
return HPDF_Image_GetColorSpace(handle());
}
void Image::colorMask(Poco::UInt32 redMin,
Poco::UInt32 redMax,
Poco::UInt32 greenMin,
Poco::UInt32 greenMax,
Poco::UInt32 blueMin,
Poco::UInt32 blueMax)
{
HPDF_Image_SetColorMask(handle(),
redMin,
redMax,
greenMin,
greenMax,
blueMin,
blueMax);
}
} } // namespace Poco::PDF

View File

@@ -13,8 +13,7 @@
#include "Poco/PDF/LinkAnnotation.h"
#include "Poco/PDF/PDFException.h"
#include <hpdf.h>
namespace Poco {
namespace PDF {
@@ -27,10 +26,19 @@ LinkAnnotation::LinkAnnotation(HPDF_Doc* pPDF,
{
}
LinkAnnotation::~LinkAnnotation() = default;
LinkAnnotation::~LinkAnnotation()
void LinkAnnotation::setHighlight(Highlight mode)
{
HPDF_LinkAnnot_SetHighlightMode(handle(),
static_cast<HPDF_AnnotHighlightMode>(mode));
}
void LinkAnnotation::setBorderStyle(float width, Poco::UInt32 dashOn, Poco::UInt32 dashOff)
{
HPDF_LinkAnnot_SetBorderStyle(handle(), width, dashOn, dashOff);
}
} } // namespace Poco::PDF

View File

@@ -15,6 +15,7 @@
#include "Poco/PDF/Outline.h"
#include "Poco/PDF/PDFException.h"
#include <hpdf.h>
namespace Poco {
namespace PDF {
@@ -26,19 +27,11 @@ Outline::Outline(HPDF_Doc* pPDF, const HPDF_Outline& outline, const std::string&
open();
}
Outline::~Outline() = default;
Outline::~Outline()
{
}
Outline::Outline(const Outline& other) = default;
Outline::Outline(const Outline& other):
Resource<HPDF_Outline>(other)
{
}
Outline& Outline::operator = (const Outline& outline)
Outline& Outline::operator=(const Outline& outline)
{
Outline tmp(outline);
swap(tmp);
@@ -46,4 +39,22 @@ Outline& Outline::operator = (const Outline& outline)
}
void Outline::open()
{
HPDF_Outline_SetOpened(handle(), HPDF_TRUE);
}
void Outline::close()
{
HPDF_Outline_SetOpened(handle(), HPDF_FALSE);
}
void Outline::destination(const Destination& dest)
{
HPDF_Outline_SetDestination(handle(), dest);
}
} } // namespace Poco::PDF

View File

@@ -13,9 +13,8 @@
#include "Poco/PDF/PDFException.h"
#include "Poco/Format.h"
#include <hpdf.h>
#include <string>
#include <typeinfo>
namespace Poco {

View File

@@ -13,8 +13,9 @@
#include "Poco/PDF/Page.h"
#include "Poco/Exception.h"
#include "Poco/PDF/Document.h"
#include "Poco/PDF/PDFException.h"
#include <hpdf.h>
#undef min
#undef max
#include <limits>
@@ -23,26 +24,39 @@
namespace Poco {
namespace PDF {
static_assert(static_cast<int>(Page::Size::PAGE_SIZE_LETTER) == HPDF_PAGE_SIZE_LETTER, "Page size value mismatch");
static_assert(static_cast<int>(Page::Size::PAGE_SIZE_COMM10) == HPDF_PAGE_SIZE_COMM10, "Page size value mismatch");
Page::Page(Document* pDocument,
const HPDF_Page& page,
Size pageSize,
Orientation orientation):
_pDocument(pDocument),
_page(page),
_size(pageSize),
_orientation(orientation),
_pCurrentFont(0)
static_assert(static_cast<int>(Page::Orientation::ORIENTATION_PORTRAIT) == HPDF_PAGE_PORTRAIT, "Page orientation value mismatch");
static_assert(static_cast<int>(Page::Orientation::ORIENTATION_LANDSCAPE) == HPDF_PAGE_LANDSCAPE, "Page orientation value mismatch");
static_assert(static_cast<int>(Page::RenderMode::RENDER_FILL) == HPDF_FILL, "Render mode value mismatch");
static_assert(static_cast<int>(Page::RenderMode::RENDER_RENDERING_MODE_EOF) == HPDF_RENDERING_MODE_EOF, "render mode value mismatch");
static_assert(static_cast<int>(Page::ColorSpace::CS_DEVICE_GRAY) == HPDF_CS_DEVICE_GRAY, "Page color space value mismatch");
static_assert(static_cast<int>(Page::ColorSpace::CS_EOF) == HPDF_CS_EOF, "Page color space value mismatch");
static_assert(static_cast<int>(Page::TransitionStyle::TS_WIPE_RIGHT) == HPDF_TS_WIPE_RIGHT, "Transition style value mismatch");
static_assert(static_cast<int>(Page::TransitionStyle::TS_REPLACE) == HPDF_TS_REPLACE, "Transition style value mismatch");
static_assert(static_cast<int>(Page::TextAlignment::TEXT_ALIGN_LEFT) == HPDF_TALIGN_LEFT, "Text alignment value mismatch");
static_assert(static_cast<int>(Page::TextAlignment::TEXT_ALIGN_JUSTIFY) == HPDF_TALIGN_JUSTIFY, "Text alignment value mismatch");
Page::Page(Document* pDocument, const HPDF_Page& page, Size pageSize, Orientation orientation)
: _pDocument(pDocument)
, _page(page)
, _size(pageSize)
, _orientation(orientation)
, _pCurrentFont(nullptr)
{
}
Page::Page(const Page& other):
_pDocument(other._pDocument),
_page(other._page),
_size(other._size),
_orientation(other._orientation),
_pCurrentFont(other._pCurrentFont ? new Font(*other._pCurrentFont) : (Font*)0)
Page::Page(const Page& other)
: _pDocument(other._pDocument)
, _page(other._page)
, _size(other._size)
, _orientation(other._orientation)
, _pCurrentFont(other._pCurrentFont ? new Font(*other._pCurrentFont) : (Font*) nullptr)
{
}
@@ -79,6 +93,598 @@ void Page::swap(Page& other) noexcept
}
Page::operator const Page::Type& () const
{
return _page;
}
void Page::setWidth(float value)
{
HPDF_Page_SetWidth(_page, value);
}
float Page::getWidth() const
{
return HPDF_Page_GetWidth(_page);
}
void Page::setHeight(float value)
{
HPDF_Page_SetHeight(_page, value);
}
float Page::getHeight() const
{
return HPDF_Page_GetHeight(_page);
}
void Page::setSizeAndOrientation(Size size, Orientation orientation)
{
_size = size;
_orientation = orientation;
HPDF_Page_SetSize(_page, static_cast<HPDF_PageSizes>(size), static_cast<HPDF_PageDirection>(orientation));
}
void Page::setSize(Size size)
{
_size = size;
HPDF_Page_SetSize(_page, static_cast<HPDF_PageSizes>(size), static_cast<HPDF_PageDirection>(_orientation));
}
void Page::setOrientation(Orientation orientation)
{
_orientation = orientation;
HPDF_Page_SetSize(_page, static_cast<HPDF_PageSizes>(_size), static_cast<HPDF_PageDirection>(orientation));
}
Page::Size Page::getSize() const
{
return _size;
}
Page::Orientation Page::getOrientation() const
{
return _orientation;
}
void Page::setFont(const Font& font, float size)
{
HPDF_Page_SetFontAndSize(_page, font, size);
}
int Page::getGraphicsMode() const
{
return HPDF_Page_GetGMode(_page);
}
int Page::getGraphicStateDepth() const
{
return HPDF_Page_GetGStateDepth(_page);
}
void Page::setExtGraphicsState(ExtGraphicsState state)
{
HPDF_Page_SetExtGState(_page, state);
}
void Page::saveGraphics()
{
HPDF_Page_GSave(_page);
}
void Page::restoreGraphics()
{
HPDF_Page_GRestore(_page);
}
void Page::concatenate(const std::vector<float>& values)
{
if (values.size() < 6)
throw InvalidArgumentException("Needs six values");
HPDF_Page_Concat(_page,
values[0],
values[1],
values[2],
values[3],
values[4],
values[5]);
}
void Page::moveTo(float x, float y)
{
HPDF_Page_MoveTo(_page, x, y);
}
void Page::lineTo(float x, float y)
{
HPDF_Page_LineTo(_page, x, y);
}
void Page::curveTo(const std::vector<float>& values)
{
if (values.size() < 6)
throw InvalidArgumentException("Needs six values");
HPDF_Page_CurveTo(_page,
values[0],
values[1],
values[2],
values[3],
values[4],
values[5]);
}
void Page::curveToRight(float x2, float y2, float x3, float y3)
{
HPDF_Page_CurveTo2(_page, x2, y2, x3, y3);
}
void Page::curveToLeft(float x2, float y2, float x3, float y3)
{
HPDF_Page_CurveTo3(_page, x2, y2, x3, y3);
}
void Page::closePath()
{
HPDF_Page_ClosePath(_page);
}
void Page::rectangle(float x, float y, float width, float height)
{
HPDF_Page_Rectangle(_page, x, y, width, height);
}
void Page::stroke()
{
HPDF_Page_Stroke(_page);
}
void Page::closeAndStroke()
{
HPDF_Page_ClosePathStroke(_page);
}
void Page::fill()
{
HPDF_Page_Fill(_page);
}
void Page::EOFill()
{
HPDF_Page_Eofill(_page);
}
void Page::fillStroke()
{
HPDF_Page_FillStroke(_page);
}
void Page::EOFillStroke()
{
HPDF_Page_EofillStroke(_page);
}
void Page::closeFillAndStroke()
{
HPDF_Page_ClosePathFillStroke(_page);
}
void Page::closeFillAndEOStroke()
{
HPDF_Page_ClosePathEofillStroke(_page);
}
void Page::endPath()
{
HPDF_Page_EndPath(_page);
}
void Page::clip()
{
HPDF_Page_Clip(_page);
}
void Page::eoClip()
{
HPDF_Page_Eoclip(_page);
}
Point Page::getPos() const
{
return HPDF_Page_GetCurrentPos(_page);
}
Point Page::getTextPos() const
{
return HPDF_Page_GetCurrentTextPos(_page);
}
void Page::moveTextPos(float x, float y)
{
HPDF_Page_MoveTextPos(_page, x, y);
}
void Page::moveTextNextLine(float x, float y)
{
HPDF_Page_MoveTextPos2(_page, x, y);
}
void Page::moveTextNextLine()
{
HPDF_Page_MoveToNextLine(_page);
}
float Page::getFontSize() const
{
return HPDF_Page_GetCurrentFontSize(_page);
}
TransMatrix Page::getTransMatrix() const
{
return HPDF_Page_GetTransMatrix(_page);
}
TransMatrix Page::getTextMatrix() const
{
return HPDF_Page_GetTextMatrix(_page);
}
float Page::getLineWidth() const
{
return HPDF_Page_GetLineWidth(_page);
}
void Page::setLineWidth(float width)
{
HPDF_Page_SetLineWidth(_page, width);
}
LineCap Page::getLineCap() const
{
return static_cast<LineCap>(HPDF_Page_GetLineCap(_page));
}
void Page::setLineCap(LineCap cap) const
{
HPDF_Page_SetLineCap(_page, static_cast<HPDF_LineCap>(cap));
}
LineJoin Page::getLineJoin() const
{
return static_cast<LineJoin>(HPDF_Page_GetLineJoin(_page));
}
void Page::setLineJoin(LineJoin join) const
{
HPDF_Page_SetLineJoin(_page, static_cast<HPDF_LineJoin>(join));
}
float Page::getMiterLimit() const
{
return HPDF_Page_GetMiterLimit(_page);
}
void Page::setMiterLimit(float limit) const
{
HPDF_Page_SetMiterLimit(_page, limit);
}
DashMode Page::getDashMode() const
{
return HPDF_Page_GetDash(_page);
}
void Page::setDashMode(const PatternVec& pattern, int paramNo, int phase) const
{
HPDF_Page_SetDash(_page, &pattern[0],
static_cast<HPDF_UINT>(paramNo),
static_cast<HPDF_UINT>(phase));
}
float Page::getFlatness() const
{
return HPDF_Page_GetFlat(_page);
}
float Page::getCharSpace() const
{
return HPDF_Page_GetCharSpace(_page);
}
void Page::setCharSpace(float value)
{
HPDF_Page_SetCharSpace(_page, value);
}
float Page::getWordSpace() const
{
return HPDF_Page_GetWordSpace(_page);
}
void Page::setWordSpace(float value)
{
HPDF_Page_SetWordSpace(_page, value);
}
float Page::getHorizontalScale() const
{
return HPDF_Page_GetHorizontalScalling(_page);
}
void Page::setHorizontalScale(float value)
{
HPDF_Page_SetHorizontalScalling(_page, value);
}
float Page::getTextLead() const
{
return HPDF_Page_GetTextLeading(_page);
}
void Page::setTextLead(float value)
{
HPDF_Page_SetTextLeading(_page, value);
}
Page::RenderMode Page::getTextRenderMode() const
{
return static_cast<RenderMode>(HPDF_Page_GetTextRenderingMode(_page));
}
void Page::setTextRenderMode(RenderMode value)
{
HPDF_Page_SetTextRenderingMode(_page, static_cast<HPDF_TextRenderingMode>(value));
}
float Page::getTextRise() const
{
return HPDF_Page_GetTextRise(_page);
}
void Page::setTextRise(float value)
{
HPDF_Page_SetTextRise(_page, value);
}
RGBColor Page::getRGBFill() const
{
return HPDF_Page_GetRGBFill(_page);
}
void Page::setRGBFill(RGBColor value)
{
HPDF_Page_SetRGBFill(_page, value.r, value.g, value.b);
}
RGBColor Page::getRGBStroke() const
{
return HPDF_Page_GetRGBStroke(_page);
}
void Page::setRGBStroke(RGBColor value)
{
HPDF_Page_SetRGBStroke(_page, value.r, value.g, value.b);
}
CMYKColor Page::getCMYKFill() const
{
return HPDF_Page_GetCMYKFill(_page);
}
void Page::setCMYKFill(CMYKColor value)
{
HPDF_Page_SetCMYKFill(_page, value.c, value.m, value.y, value.k);
}
CMYKColor Page::getCMYKStroke() const
{
return HPDF_Page_GetCMYKStroke(_page);
}
void Page::setCMYKStroke(CMYKColor value)
{
HPDF_Page_SetCMYKStroke(_page, value.c, value.m, value.y, value.k);
}
float Page::getGreyFill() const
{
return HPDF_Page_GetGrayFill(_page);
}
void Page::setGreyFill(float value)
{
HPDF_Page_SetGrayFill(_page, value);
}
float Page::getGreyStroke() const
{
return HPDF_Page_GetGrayStroke(_page);
}
void Page::setGreyStroke(float value)
{
HPDF_Page_SetGrayStroke(_page, value);
}
Page::ColorSpace Page::getStrokeColorSpace() const
{
return static_cast<ColorSpace>(HPDF_Page_GetStrokingColorSpace(_page));
}
Page::ColorSpace Page::getFillColorSpace() const
{
return static_cast<ColorSpace>(HPDF_Page_GetFillingColorSpace(_page));
}
void Page::setSlideShow(TransitionStyle type, float displayTime, float transitionTime)
{
HPDF_Page_SetSlideShow(_page,
static_cast<HPDF_TransitionStyle>(type),
displayTime,
transitionTime);
}
void Page::beginText()
{
HPDF_Page_BeginText(_page);
}
void Page::endText()
{
HPDF_Page_EndText(_page);
}
void Page::write(float xPos, float yPos, const std::string& text)
{
HPDF_Page_TextOut(_page, xPos, yPos, text.c_str());
}
void Page::write(const std::string& text)
{
HPDF_Page_ShowText(_page, text.c_str());
}
void Page::writeNextLine(const std::string& text)
{
HPDF_Page_ShowTextNextLine(_page, text.c_str());
}
void Page::writeNextLineEx(float wordSpace, float charSpace, const std::string& text)
{
HPDF_Page_ShowTextNextLineEx(_page, wordSpace, charSpace, text.c_str());
}
int Page::writeInRectangle(float left,
float top,
float right,
float bottom,
const std::string& text,
TextAlignment align)
{
HPDF_UINT ret = 0;
HPDF_Page_TextRect(_page,
left,
top,
right,
bottom,
text.c_str(),
static_cast<HPDF_TextAlignment>(align),
&ret);
return static_cast<int>(ret);
}
void Page::drawImage(Image image, float x, float y, float width, float height)
{
HPDF_Page_DrawImage(_page, image, x, y, width, height);
}
void Page::circle(float x, float y, float radius)
{
HPDF_Page_Circle(_page, x, y, radius);
}
void Page::arc(float x, float y, float radius, float beginAngle, float endAngle)
{
HPDF_Page_Arc(_page, x, y, radius, beginAngle, endAngle);
}
void Page::ellipse(float x, float y, float xRadius, float yRadius)
{
HPDF_Page_Ellipse(_page, x, y, xRadius, yRadius);
}
void Page::writeOnce(float xPos, float yPos, const std::string& text)
{
beginText();
@@ -121,7 +727,8 @@ void Page::setTTFont(const std::string& name, float size, const std::string& enc
const Font& Page::getFont() const
{
delete _pCurrentFont; _pCurrentFont = 0;
delete _pCurrentFont;
_pCurrentFont = nullptr;
HPDF_Font pCurFont = HPDF_Page_GetCurrentFont(_page);
if (!pCurFont) throw Poco::NullPointerException("PDF::Page has no font set.");
_pCurrentFont = new Font(&_pDocument->handle(), pCurFont);
@@ -140,7 +747,7 @@ void Page::setRotation(int angle)
const Destination& Page::createDestination(const std::string& name)
{
DestinationContainer::iterator it = _destinations.find(name);
auto it = _destinations.find(name);
if (_destinations.end() != it)
throw InvalidArgumentException("Destination already exists.");
@@ -159,7 +766,7 @@ const TextAnnotation& Page::createTextAnnotation(const std::string& name,
const std::string& text,
const Encoder& encoder)
{
TextAnnotationContainer::iterator it = _textAnnotations.find(name);
auto it = _textAnnotations.find(name);
if (_textAnnotations.end() != it)
throw InvalidArgumentException("Annotation already exists.");
@@ -180,7 +787,7 @@ const LinkAnnotation& Page::createLinkAnnotation(const std::string& name,
const Rectangle& rect,
const Destination& dest)
{
LinkAnnotationContainer::iterator it = _linkAnnotations.find(name);
auto it = _linkAnnotations.find(name);
if (_linkAnnotations.end() != it)
throw InvalidArgumentException("Annotation already exists.");
@@ -200,7 +807,7 @@ const LinkAnnotation& Page::createURILinkAnnotation(const std::string& name,
const Rectangle& rect,
const std::string& uri)
{
LinkAnnotationContainer::iterator it = _linkAnnotations.find(name);
auto it = _linkAnnotations.find(name);
if (_linkAnnotations.end() != it)
throw InvalidArgumentException("Annotation already exists.");

View File

@@ -3,7 +3,7 @@
//
#include "Poco/PDF/Table.h"
#include <hpdf.h>
namespace Poco {
namespace PDF {
@@ -15,15 +15,34 @@ Table::Table(int columnCount, int rowCount, const std::string& name, Cell::FontM
setFonts(pFontMap);
}
Table::~Table() = default;
Table::~Table()
const std::string Table::name() const
{
return _name;
}
const Table::Cells& Table::cells() const
{
return _cells;
}
std::size_t Table::rows() const
{
return _cells.size();
}
std::size_t Table::columns() const
{
return _cells[0].size();
}
void Table::addRow()
{
_cells.push_back(TableRow(columns()));
_cells.emplace_back(columns());
}
@@ -67,15 +86,13 @@ void Table::draw(Page& page, float x, float y, float width, float height)
int rows = static_cast<int>(_cells.size());
int cols = static_cast<int>(_cells[0].size());
int r = 0;
for (Cells::iterator it = _cells.begin(); it != _cells.end(); ++it)
for (auto& row : _cells)
{
TableRow& row(*it);
float h = height / rows;
int c = 0;
float lastX = x;
for (TableRow::iterator itr = row.begin(); itr != row.end(); ++itr)
for (auto& cell : row)
{
Cell& cell(*itr);
float w = width / cols;
if (!cell.hasWidth())
{
@@ -88,7 +105,6 @@ void Table::draw(Page& page, float x, float y, float width, float height)
cell.draw(page, lastX, y - (h * r), w, h);
lastX += w;
}
++c;
}
++r;

View File

@@ -13,8 +13,8 @@
#include "Poco/PDF/TextAnnotation.h"
#include "Poco/PDF/PDFException.h"
#include <hpdf.h>
namespace Poco {
namespace PDF {
@@ -35,4 +35,22 @@ TextAnnotation::~TextAnnotation()
}
void TextAnnotation::open()
{
HPDF_TextAnnot_SetOpened(handle(), HPDF_TRUE);
}
void TextAnnotation::close()
{
HPDF_TextAnnot_SetOpened(handle(), HPDF_FALSE);
}
void TextAnnotation::icon(IconType iconType)
{
HPDF_TextAnnot_SetIcon(handle(), static_cast<HPDF_AnnotIcon>(iconType));
}
} } // namespace Poco::PDF

View File

@@ -2,37 +2,36 @@
// XMLTemplate.cpp
//
#include "Poco/PDF/XMLTemplate.h"
#include "Poco/PDF/Table.h"
#include "Poco/SAX/SAXParser.h"
#include "Poco/SAX/DefaultHandler.h"
#include "Poco/SAX/Attributes.h"
#include "Poco/SAX/InputSource.h"
#include "Poco/Util/PropertyFileConfiguration.h"
#include "Poco/FileStream.h"
#include "Poco/AutoPtr.h"
#include "Poco/String.h"
#include "Poco/Exception.h"
#include "Poco/FileStream.h"
#include "Poco/PDF/Table.h"
#include "Poco/Path.h"
#include "Poco/SAX/Attributes.h"
#include "Poco/SAX/DefaultHandler.h"
#include "Poco/SAX/InputSource.h"
#include "Poco/SAX/SAXParser.h"
#include "Poco/String.h"
#include "Poco/TextConverter.h"
#include "Poco/UTF8Encoding.h"
#include "Poco/UTF8String.h"
#include <vector>
#include "Poco/Util/PropertyFileConfiguration.h"
#include <algorithm>
#include <hpdf.h>
#include <ranges>
#include <set>
#include <sstream>
#include <algorithm>
#include <vector>
namespace Poco {
namespace PDF {
class StackedConfiguration : public Poco::Util::AbstractConfiguration
{
public:
typedef Poco::AutoPtr<Poco::Util::AbstractConfiguration> ConfigPtr;
typedef std::vector<ConfigPtr> ConfigStack;
using ConfigPtr = Poco::AutoPtr<Poco::Util::AbstractConfiguration>;
using ConfigStack = std::vector<ConfigPtr>;
void push(ConfigPtr pConfig)
{
@@ -61,43 +60,43 @@ public:
}
// AbstractConfiguration
bool getRaw(const std::string& key, std::string& value) const
bool getRaw(const std::string& key, std::string& value) const override
{
for (ConfigStack::const_reverse_iterator it = _stack.rbegin(); it != _stack.rend(); ++it)
for (const auto& it : std::ranges::reverse_view(_stack))
{
if ((*it)->has(key))
if (it->has(key))
{
value = (*it)->getRawString(key);
value = it->getRawString(key);
return true;
}
}
return false;
}
void setRaw(const std::string& key, const std::string& value)
void setRaw(const std::string& key, const std::string& value) override
{
throw Poco::InvalidAccessException("not writable");
}
void enumerate(const std::string& key, Poco::Util::AbstractConfiguration::Keys& range) const
void enumerate(const std::string& key, Poco::Util::AbstractConfiguration::Keys& range) const override
{
std::set<std::string> keys;
for (ConfigStack::const_iterator itc = _stack.begin(); itc != _stack.end(); ++itc)
for (const auto& itc : _stack)
{
Poco::Util::AbstractConfiguration::Keys partRange;
(*itc)->keys(key, partRange);
for (Poco::Util::AbstractConfiguration::Keys::const_iterator itr = partRange.begin(); itr != partRange.end(); ++itr)
itc->keys(key, partRange);
for (const auto& itr : partRange)
{
if (keys.find(*itr) == keys.end())
if (keys.find(itr) == keys.end())
{
range.push_back(*itr);
keys.insert(*itr);
range.push_back(itr);
keys.insert(itr);
}
}
}
}
void removeRaw(const std::string& key)
void removeRaw(const std::string& key) override
{
throw Poco::InvalidAccessException("not writable");
}
@@ -106,7 +105,6 @@ private:
std::vector<ConfigPtr> _stack;
};
class Box
{
public:
@@ -127,17 +125,8 @@ public:
}
Box(const Box& box) :
_x(box._x),
_y(box._y),
_width(box._width),
_height(box._height)
{
}
~Box()
{
}
Box(const Box& box) = default;
~Box() = default;
Box& operator = (const Box& box)
{
@@ -216,18 +205,14 @@ private:
class TemplateHandler : public Poco::XML::DefaultHandler
{
public:
typedef Poco::AutoPtr<Poco::Util::AbstractConfiguration> StylePtr;
using StylePtr = Poco::AutoPtr<Poco::Util::AbstractConfiguration>;
TemplateHandler(const Poco::Path& base) :
_base(base),
_pDocument(0),
_pPage(0),
_y(0)
TemplateHandler(const Poco::Path& base) : _base(base)
{
_styles.push(parseStyle("font-family: Helvetica; font-size: 12; line-height: 1.2"));
}
~TemplateHandler()
~TemplateHandler() override
{
_styles.pop();
delete _pPage;
@@ -237,7 +222,7 @@ public:
Document* document()
{
Document* pDocument = _pDocument;
_pDocument = 0;
_pDocument = nullptr;
return pDocument;
}
@@ -289,7 +274,7 @@ public:
Font font = loadFont(fontFamily, fontStyle, fontWeight);
_pPage->setFont(font, fontSize);
_boxes.push_back(Box(0, 0, _pPage->getWidth(), _pPage->getHeight()));
_boxes.emplace_back(0, 0, _pPage->getWidth(), _pPage->getHeight());
float margin = _styles.getFloat("margin", 0);
float marginLeft = _styles.getFloat("margin-left", margin);
@@ -306,7 +291,7 @@ public:
{
_boxes.pop_back();
delete _pPage;
_pPage = 0;
_pPage = nullptr;
popStyle();
}
@@ -426,7 +411,7 @@ public:
moveY(y);
}
_pTable = 0;
_pTable = nullptr;
popStyle();
}
@@ -548,15 +533,15 @@ public:
}
// DocumentHandler
void startDocument()
void startDocument() override
{
}
void endDocument()
void endDocument() override
{
}
void startElement(const Poco::XML::XMLString& uri, const Poco::XML::XMLString& localName, const Poco::XML::XMLString& qname, const Poco::XML::Attributes& attributes)
void startElement(const Poco::XML::XMLString& uri, const Poco::XML::XMLString& localName, const Poco::XML::XMLString& qname, const Poco::XML::Attributes& attributes) override
{
if (localName == "document")
startDoc(attributes);
@@ -576,7 +561,7 @@ public:
startHr(attributes);
}
void endElement(const Poco::XML::XMLString& uri, const Poco::XML::XMLString& localName, const Poco::XML::XMLString& qname)
void endElement(const Poco::XML::XMLString& uri, const Poco::XML::XMLString& localName, const Poco::XML::XMLString& qname) override
{
if (localName == "document")
endDoc();
@@ -596,7 +581,7 @@ public:
endHr();
}
void characters(const Poco::XML::XMLChar ch[], int start, int length)
void characters(const Poco::XML::XMLChar ch[], int start, int length) override
{
_text.append(ch + start, length);
}
@@ -827,8 +812,8 @@ protected:
private:
Poco::Path _base;
std::string _encoding;
Document* _pDocument;
Page* _pPage;
Document* _pDocument{nullptr};
Page* _pPage{nullptr};
Table::Ptr _pTable;
TableRow _row;
StackedConfiguration _styles;
@@ -836,13 +821,13 @@ private:
std::string _size;
std::string _orientation;
std::string _text;
float _y;
float _y{0};
};
XMLTemplate::XMLTemplate(std::istream& xmlStream, const std::string& base) :
_base(base),
_pDocument(0)
_pDocument(nullptr)
{
load(xmlStream);
}
@@ -850,7 +835,7 @@ XMLTemplate::XMLTemplate(std::istream& xmlStream, const std::string& base) :
XMLTemplate::XMLTemplate(const std::string& path) :
_base(path),
_pDocument(0)
_pDocument(nullptr)
{
Poco::FileInputStream xmlStream(path);
load(xmlStream);

View File

@@ -1,164 +0,0 @@
/* adler32.c -- compute the Adler-32 checksum of a data stream
* Copyright (C) 1995-2011, 2016 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#include "zutil.h"
#define BASE 65521U /* largest prime smaller than 65536 */
#define NMAX 5552
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
#define DO16(buf) DO8(buf,0); DO8(buf,8);
/* use NO_DIVIDE if your processor does not do division in hardware --
try it both ways to see which is faster */
#ifdef NO_DIVIDE
/* note that this assumes BASE is 65521, where 65536 % 65521 == 15
(thank you to John Reiser for pointing this out) */
# define CHOP(a) \
do { \
unsigned long tmp = a >> 16; \
a &= 0xffffUL; \
a += (tmp << 4) - tmp; \
} while (0)
# define MOD28(a) \
do { \
CHOP(a); \
if (a >= BASE) a -= BASE; \
} while (0)
# define MOD(a) \
do { \
CHOP(a); \
MOD28(a); \
} while (0)
# define MOD63(a) \
do { /* this assumes a is not negative */ \
z_off64_t tmp = a >> 32; \
a &= 0xffffffffL; \
a += (tmp << 8) - (tmp << 5) + tmp; \
tmp = a >> 16; \
a &= 0xffffL; \
a += (tmp << 4) - tmp; \
tmp = a >> 16; \
a &= 0xffffL; \
a += (tmp << 4) - tmp; \
if (a >= BASE) a -= BASE; \
} while (0)
#else
# define MOD(a) a %= BASE
# define MOD28(a) a %= BASE
# define MOD63(a) a %= BASE
#endif
/* ========================================================================= */
uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, z_size_t len) {
unsigned long sum2;
unsigned n;
/* split Adler-32 into component sums */
sum2 = (adler >> 16) & 0xffff;
adler &= 0xffff;
/* in case user likes doing a byte at a time, keep it fast */
if (len == 1) {
adler += buf[0];
if (adler >= BASE)
adler -= BASE;
sum2 += adler;
if (sum2 >= BASE)
sum2 -= BASE;
return adler | (sum2 << 16);
}
/* initial Adler-32 value (deferred check for len == 1 speed) */
if (buf == Z_NULL)
return 1L;
/* in case short lengths are provided, keep it somewhat fast */
if (len < 16) {
while (len--) {
adler += *buf++;
sum2 += adler;
}
if (adler >= BASE)
adler -= BASE;
MOD28(sum2); /* only added so many BASE's */
return adler | (sum2 << 16);
}
/* do length NMAX blocks -- requires just one modulo operation */
while (len >= NMAX) {
len -= NMAX;
n = NMAX / 16; /* NMAX is divisible by 16 */
do {
DO16(buf); /* 16 sums unrolled */
buf += 16;
} while (--n);
MOD(adler);
MOD(sum2);
}
/* do remaining bytes (less than NMAX, still just one modulo) */
if (len) { /* avoid modulos if none remaining */
while (len >= 16) {
len -= 16;
DO16(buf);
buf += 16;
}
while (len--) {
adler += *buf++;
sum2 += adler;
}
MOD(adler);
MOD(sum2);
}
/* return recombined sums */
return adler | (sum2 << 16);
}
/* ========================================================================= */
uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len) {
return adler32_z(adler, buf, len);
}
/* ========================================================================= */
local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2) {
unsigned long sum1;
unsigned long sum2;
unsigned rem;
/* for negative len, return invalid adler32 as a clue for debugging */
if (len2 < 0)
return 0xffffffffUL;
/* the derivation of this formula is left as an exercise for the reader */
MOD63(len2); /* assumes len2 >= 0 */
rem = (unsigned)len2;
sum1 = adler1 & 0xffff;
sum2 = rem * sum1;
MOD(sum2);
sum1 += (adler2 & 0xffff) + BASE - 1;
sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
if (sum1 >= BASE) sum1 -= BASE;
if (sum1 >= BASE) sum1 -= BASE;
if (sum2 >= ((unsigned long)BASE << 1)) sum2 -= ((unsigned long)BASE << 1);
if (sum2 >= BASE) sum2 -= BASE;
return sum1 | (sum2 << 16);
}
/* ========================================================================= */
uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2, z_off_t len2) {
return adler32_combine_(adler1, adler2, len2);
}
uLong ZEXPORT adler32_combine64(uLong adler1, uLong adler2, z_off64_t len2) {
return adler32_combine_(adler1, adler2, len2);
}

View File

@@ -1,75 +0,0 @@
/* compress.c -- compress a memory buffer
* Copyright (C) 1995-2005, 2014, 2016 Jean-loup Gailly, Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#define ZLIB_INTERNAL
#include "zlib.h"
/* ===========================================================================
Compresses the source buffer into the destination buffer. The level
parameter has the same meaning as in deflateInit. sourceLen is the byte
length of the source buffer. Upon entry, destLen is the total size of the
destination buffer, which must be at least 0.1% larger than sourceLen plus
12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
Z_STREAM_ERROR if the level parameter is invalid.
*/
int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source,
uLong sourceLen, int level) {
z_stream stream;
int err;
const uInt max = (uInt)-1;
uLong left;
left = *destLen;
*destLen = 0;
stream.zalloc = (alloc_func)0;
stream.zfree = (free_func)0;
stream.opaque = (voidpf)0;
err = deflateInit(&stream, level);
if (err != Z_OK) return err;
stream.next_out = dest;
stream.avail_out = 0;
stream.next_in = (z_const Bytef *)source;
stream.avail_in = 0;
do {
if (stream.avail_out == 0) {
stream.avail_out = left > (uLong)max ? max : (uInt)left;
left -= stream.avail_out;
}
if (stream.avail_in == 0) {
stream.avail_in = sourceLen > (uLong)max ? max : (uInt)sourceLen;
sourceLen -= stream.avail_in;
}
err = deflate(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH);
} while (err == Z_OK);
*destLen = stream.total_out;
deflateEnd(&stream);
return err == Z_STREAM_END ? Z_OK : err;
}
/* ===========================================================================
*/
int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source,
uLong sourceLen) {
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
}
/* ===========================================================================
If the default memLevel or windowBits for deflateInit() is changed, then
this function needs to be updated.
*/
uLong ZEXPORT compressBound(uLong sourceLen) {
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
(sourceLen >> 25) + 13;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,628 +0,0 @@
/* infback.c -- inflate using a call-back interface
* Copyright (C) 1995-2022 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/*
This code is largely copied from inflate.c. Normally either infback.o or
inflate.o would be linked into an application--not both. The interface
with inffast.c is retained so that optimized assembler-coded versions of
inflate_fast() can be used with either inflate.c or infback.c.
*/
#include "zutil.h"
#include "inftrees.h"
#include "inflate.h"
#include "inffast.h"
/*
strm provides memory allocation functions in zalloc and zfree, or
Z_NULL to use the library memory allocation functions.
windowBits is in the range 8..15, and window is a user-supplied
window and output buffer that is 2**windowBits bytes.
*/
int ZEXPORT inflateBackInit_(z_streamp strm, int windowBits,
unsigned char FAR *window, const char *version,
int stream_size) {
struct inflate_state FAR *state;
if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
stream_size != (int)(sizeof(z_stream)))
return Z_VERSION_ERROR;
if (strm == Z_NULL || window == Z_NULL ||
windowBits < 8 || windowBits > 15)
return Z_STREAM_ERROR;
strm->msg = Z_NULL; /* in case we return an error */
if (strm->zalloc == (alloc_func)0) {
#ifdef Z_SOLO
return Z_STREAM_ERROR;
#else
strm->zalloc = zcalloc;
strm->opaque = (voidpf)0;
#endif
}
if (strm->zfree == (free_func)0)
#ifdef Z_SOLO
return Z_STREAM_ERROR;
#else
strm->zfree = zcfree;
#endif
state = (struct inflate_state FAR *)ZALLOC(strm, 1,
sizeof(struct inflate_state));
if (state == Z_NULL) return Z_MEM_ERROR;
Tracev((stderr, "inflate: allocated\n"));
strm->state = (struct internal_state FAR *)state;
state->dmax = 32768U;
state->wbits = (uInt)windowBits;
state->wsize = 1U << windowBits;
state->window = window;
state->wnext = 0;
state->whave = 0;
state->sane = 1;
return Z_OK;
}
/*
Return state with length and distance decoding tables and index sizes set to
fixed code decoding. Normally this returns fixed tables from inffixed.h.
If BUILDFIXED is defined, then instead this routine builds the tables the
first time it's called, and returns those tables the first time and
thereafter. This reduces the size of the code by about 2K bytes, in
exchange for a little execution time. However, BUILDFIXED should not be
used for threaded applications, since the rewriting of the tables and virgin
may not be thread-safe.
*/
local void fixedtables(struct inflate_state FAR *state) {
#ifdef BUILDFIXED
static int virgin = 1;
static code *lenfix, *distfix;
static code fixed[544];
/* build fixed huffman tables if first call (may not be thread safe) */
if (virgin) {
unsigned sym, bits;
static code *next;
/* literal/length table */
sym = 0;
while (sym < 144) state->lens[sym++] = 8;
while (sym < 256) state->lens[sym++] = 9;
while (sym < 280) state->lens[sym++] = 7;
while (sym < 288) state->lens[sym++] = 8;
next = fixed;
lenfix = next;
bits = 9;
inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
/* distance table */
sym = 0;
while (sym < 32) state->lens[sym++] = 5;
distfix = next;
bits = 5;
inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
/* do this just once */
virgin = 0;
}
#else /* !BUILDFIXED */
# include "inffixed.h"
#endif /* BUILDFIXED */
state->lencode = lenfix;
state->lenbits = 9;
state->distcode = distfix;
state->distbits = 5;
}
/* Macros for inflateBack(): */
/* Load returned state from inflate_fast() */
#define LOAD() \
do { \
put = strm->next_out; \
left = strm->avail_out; \
next = strm->next_in; \
have = strm->avail_in; \
hold = state->hold; \
bits = state->bits; \
} while (0)
/* Set state from registers for inflate_fast() */
#define RESTORE() \
do { \
strm->next_out = put; \
strm->avail_out = left; \
strm->next_in = next; \
strm->avail_in = have; \
state->hold = hold; \
state->bits = bits; \
} while (0)
/* Clear the input bit accumulator */
#define INITBITS() \
do { \
hold = 0; \
bits = 0; \
} while (0)
/* Assure that some input is available. If input is requested, but denied,
then return a Z_BUF_ERROR from inflateBack(). */
#define PULL() \
do { \
if (have == 0) { \
have = in(in_desc, &next); \
if (have == 0) { \
next = Z_NULL; \
ret = Z_BUF_ERROR; \
goto inf_leave; \
} \
} \
} while (0)
/* Get a byte of input into the bit accumulator, or return from inflateBack()
with an error if there is no input available. */
#define PULLBYTE() \
do { \
PULL(); \
have--; \
hold += (unsigned long)(*next++) << bits; \
bits += 8; \
} while (0)
/* Assure that there are at least n bits in the bit accumulator. If there is
not enough available input to do that, then return from inflateBack() with
an error. */
#define NEEDBITS(n) \
do { \
while (bits < (unsigned)(n)) \
PULLBYTE(); \
} while (0)
/* Return the low n bits of the bit accumulator (n < 16) */
#define BITS(n) \
((unsigned)hold & ((1U << (n)) - 1))
/* Remove n bits from the bit accumulator */
#define DROPBITS(n) \
do { \
hold >>= (n); \
bits -= (unsigned)(n); \
} while (0)
/* Remove zero to seven bits as needed to go to a byte boundary */
#define BYTEBITS() \
do { \
hold >>= bits & 7; \
bits -= bits & 7; \
} while (0)
/* Assure that some output space is available, by writing out the window
if it's full. If the write fails, return from inflateBack() with a
Z_BUF_ERROR. */
#define ROOM() \
do { \
if (left == 0) { \
put = state->window; \
left = state->wsize; \
state->whave = left; \
if (out(out_desc, put, left)) { \
ret = Z_BUF_ERROR; \
goto inf_leave; \
} \
} \
} while (0)
/*
strm provides the memory allocation functions and window buffer on input,
and provides information on the unused input on return. For Z_DATA_ERROR
returns, strm will also provide an error message.
in() and out() are the call-back input and output functions. When
inflateBack() needs more input, it calls in(). When inflateBack() has
filled the window with output, or when it completes with data in the
window, it calls out() to write out the data. The application must not
change the provided input until in() is called again or inflateBack()
returns. The application must not change the window/output buffer until
inflateBack() returns.
in() and out() are called with a descriptor parameter provided in the
inflateBack() call. This parameter can be a structure that provides the
information required to do the read or write, as well as accumulated
information on the input and output such as totals and check values.
in() should return zero on failure. out() should return non-zero on
failure. If either in() or out() fails, than inflateBack() returns a
Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it
was in() or out() that caused in the error. Otherwise, inflateBack()
returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format
error, or Z_MEM_ERROR if it could not allocate memory for the state.
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.
*/
int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc,
out_func out, void FAR *out_desc) {
struct inflate_state FAR *state;
z_const unsigned char FAR *next; /* next input */
unsigned char FAR *put; /* next output */
unsigned have, left; /* available input and output */
unsigned long hold; /* bit buffer */
unsigned bits; /* bits in bit buffer */
unsigned copy; /* number of stored or match bytes to copy */
unsigned char FAR *from; /* where to copy match bytes from */
code here; /* current decoding table entry */
code last; /* parent table entry */
unsigned len; /* length to copy for repeats, bits to drop */
int ret; /* return code */
static const unsigned short order[19] = /* permutation of code lengths */
{16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
/* Check that the strm exists and that the state was initialized */
if (strm == Z_NULL || strm->state == Z_NULL)
return Z_STREAM_ERROR;
state = (struct inflate_state FAR *)strm->state;
/* Reset the state */
strm->msg = Z_NULL;
state->mode = TYPE;
state->last = 0;
state->whave = 0;
next = strm->next_in;
have = next != Z_NULL ? strm->avail_in : 0;
hold = 0;
bits = 0;
put = state->window;
left = state->wsize;
/* Inflate until end of block marked as last */
for (;;)
switch (state->mode) {
case TYPE:
/* determine and dispatch block type */
if (state->last) {
BYTEBITS();
state->mode = DONE;
break;
}
NEEDBITS(3);
state->last = BITS(1);
DROPBITS(1);
switch (BITS(2)) {
case 0: /* stored block */
Tracev((stderr, "inflate: stored block%s\n",
state->last ? " (last)" : ""));
state->mode = STORED;
break;
case 1: /* fixed block */
fixedtables(state);
Tracev((stderr, "inflate: fixed codes block%s\n",
state->last ? " (last)" : ""));
state->mode = LEN; /* decode codes */
break;
case 2: /* dynamic block */
Tracev((stderr, "inflate: dynamic codes block%s\n",
state->last ? " (last)" : ""));
state->mode = TABLE;
break;
case 3:
strm->msg = (char *)"invalid block type";
state->mode = BAD;
}
DROPBITS(2);
break;
case STORED:
/* get and verify stored block length */
BYTEBITS(); /* go to byte boundary */
NEEDBITS(32);
if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
strm->msg = (char *)"invalid stored block lengths";
state->mode = BAD;
break;
}
state->length = (unsigned)hold & 0xffff;
Tracev((stderr, "inflate: stored length %u\n",
state->length));
INITBITS();
/* copy stored block from input to output */
while (state->length != 0) {
copy = state->length;
PULL();
ROOM();
if (copy > have) copy = have;
if (copy > left) copy = left;
zmemcpy(put, next, copy);
have -= copy;
next += copy;
left -= copy;
put += copy;
state->length -= copy;
}
Tracev((stderr, "inflate: stored end\n"));
state->mode = TYPE;
break;
case TABLE:
/* get dynamic table entries descriptor */
NEEDBITS(14);
state->nlen = BITS(5) + 257;
DROPBITS(5);
state->ndist = BITS(5) + 1;
DROPBITS(5);
state->ncode = BITS(4) + 4;
DROPBITS(4);
#ifndef PKZIP_BUG_WORKAROUND
if (state->nlen > 286 || state->ndist > 30) {
strm->msg = (char *)"too many length or distance symbols";
state->mode = BAD;
break;
}
#endif
Tracev((stderr, "inflate: table sizes ok\n"));
/* get code length code lengths (not a typo) */
state->have = 0;
while (state->have < state->ncode) {
NEEDBITS(3);
state->lens[order[state->have++]] = (unsigned short)BITS(3);
DROPBITS(3);
}
while (state->have < 19)
state->lens[order[state->have++]] = 0;
state->next = state->codes;
state->lencode = (code const FAR *)(state->next);
state->lenbits = 7;
ret = inflate_table(CODES, state->lens, 19, &(state->next),
&(state->lenbits), state->work);
if (ret) {
strm->msg = (char *)"invalid code lengths set";
state->mode = BAD;
break;
}
Tracev((stderr, "inflate: code lengths ok\n"));
/* get length and distance code code lengths */
state->have = 0;
while (state->have < state->nlen + state->ndist) {
for (;;) {
here = state->lencode[BITS(state->lenbits)];
if ((unsigned)(here.bits) <= bits) break;
PULLBYTE();
}
if (here.val < 16) {
DROPBITS(here.bits);
state->lens[state->have++] = here.val;
}
else {
if (here.val == 16) {
NEEDBITS(here.bits + 2);
DROPBITS(here.bits);
if (state->have == 0) {
strm->msg = (char *)"invalid bit length repeat";
state->mode = BAD;
break;
}
len = (unsigned)(state->lens[state->have - 1]);
copy = 3 + BITS(2);
DROPBITS(2);
}
else if (here.val == 17) {
NEEDBITS(here.bits + 3);
DROPBITS(here.bits);
len = 0;
copy = 3 + BITS(3);
DROPBITS(3);
}
else {
NEEDBITS(here.bits + 7);
DROPBITS(here.bits);
len = 0;
copy = 11 + BITS(7);
DROPBITS(7);
}
if (state->have + copy > state->nlen + state->ndist) {
strm->msg = (char *)"invalid bit length repeat";
state->mode = BAD;
break;
}
while (copy--)
state->lens[state->have++] = (unsigned short)len;
}
}
/* handle error breaks in while */
if (state->mode == BAD) break;
/* check for end-of-block code (better have one) */
if (state->lens[256] == 0) {
strm->msg = (char *)"invalid code -- missing end-of-block";
state->mode = BAD;
break;
}
/* build code tables -- note: do not change the lenbits or distbits
values here (9 and 6) without reading the comments in inftrees.h
concerning the ENOUGH constants, which depend on those values */
state->next = state->codes;
state->lencode = (code const FAR *)(state->next);
state->lenbits = 9;
ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
&(state->lenbits), state->work);
if (ret) {
strm->msg = (char *)"invalid literal/lengths set";
state->mode = BAD;
break;
}
state->distcode = (code const FAR *)(state->next);
state->distbits = 6;
ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
&(state->next), &(state->distbits), state->work);
if (ret) {
strm->msg = (char *)"invalid distances set";
state->mode = BAD;
break;
}
Tracev((stderr, "inflate: codes ok\n"));
state->mode = LEN;
/* fallthrough */
case LEN:
/* use inflate_fast() if we have enough input and output */
if (have >= 6 && left >= 258) {
RESTORE();
if (state->whave < state->wsize)
state->whave = state->wsize - left;
inflate_fast(strm, state->wsize);
LOAD();
break;
}
/* get a literal, length, or end-of-block code */
for (;;) {
here = state->lencode[BITS(state->lenbits)];
if ((unsigned)(here.bits) <= bits) break;
PULLBYTE();
}
if (here.op && (here.op & 0xf0) == 0) {
last = here;
for (;;) {
here = state->lencode[last.val +
(BITS(last.bits + last.op) >> last.bits)];
if ((unsigned)(last.bits + here.bits) <= bits) break;
PULLBYTE();
}
DROPBITS(last.bits);
}
DROPBITS(here.bits);
state->length = (unsigned)here.val;
/* process literal */
if (here.op == 0) {
Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
"inflate: literal '%c'\n" :
"inflate: literal 0x%02x\n", here.val));
ROOM();
*put++ = (unsigned char)(state->length);
left--;
state->mode = LEN;
break;
}
/* process end of block */
if (here.op & 32) {
Tracevv((stderr, "inflate: end of block\n"));
state->mode = TYPE;
break;
}
/* invalid code */
if (here.op & 64) {
strm->msg = (char *)"invalid literal/length code";
state->mode = BAD;
break;
}
/* length code -- get extra bits, if any */
state->extra = (unsigned)(here.op) & 15;
if (state->extra != 0) {
NEEDBITS(state->extra);
state->length += BITS(state->extra);
DROPBITS(state->extra);
}
Tracevv((stderr, "inflate: length %u\n", state->length));
/* get distance code */
for (;;) {
here = state->distcode[BITS(state->distbits)];
if ((unsigned)(here.bits) <= bits) break;
PULLBYTE();
}
if ((here.op & 0xf0) == 0) {
last = here;
for (;;) {
here = state->distcode[last.val +
(BITS(last.bits + last.op) >> last.bits)];
if ((unsigned)(last.bits + here.bits) <= bits) break;
PULLBYTE();
}
DROPBITS(last.bits);
}
DROPBITS(here.bits);
if (here.op & 64) {
strm->msg = (char *)"invalid distance code";
state->mode = BAD;
break;
}
state->offset = (unsigned)here.val;
/* get distance extra bits, if any */
state->extra = (unsigned)(here.op) & 15;
if (state->extra != 0) {
NEEDBITS(state->extra);
state->offset += BITS(state->extra);
DROPBITS(state->extra);
}
if (state->offset > state->wsize - (state->whave < state->wsize ?
left : 0)) {
strm->msg = (char *)"invalid distance too far back";
state->mode = BAD;
break;
}
Tracevv((stderr, "inflate: distance %u\n", state->offset));
/* copy match from window to output */
do {
ROOM();
copy = state->wsize - state->offset;
if (copy < left) {
from = put + copy;
copy = left - copy;
}
else {
from = put - state->offset;
copy = left;
}
if (copy > state->length) copy = state->length;
state->length -= copy;
left -= copy;
do {
*put++ = *from++;
} while (--copy);
} while (state->length != 0);
break;
case DONE:
/* inflate stream terminated properly */
ret = Z_STREAM_END;
goto inf_leave;
case BAD:
ret = Z_DATA_ERROR;
goto inf_leave;
default:
/* can't happen, but makes compilers happy */
ret = Z_STREAM_ERROR;
goto inf_leave;
}
/* Write leftover output and return unused input */
inf_leave:
if (left < state->wsize) {
if (out(out_desc, state->window, state->wsize - left) &&
ret == Z_STREAM_END)
ret = Z_BUF_ERROR;
}
strm->next_in = next;
strm->avail_in = have;
return ret;
}
int ZEXPORT inflateBackEnd(z_streamp strm) {
if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
return Z_STREAM_ERROR;
ZFREE(strm, strm->state);
strm->state = Z_NULL;
Tracev((stderr, "inflate: end\n"));
return Z_OK;
}

View File

@@ -1,320 +0,0 @@
/* inffast.c -- fast decoding
* Copyright (C) 1995-2017 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
#include "zutil.h"
#include "inftrees.h"
#include "inflate.h"
#include "inffast.h"
#ifdef ASMINF
# pragma message("Assembler code may have bugs -- use at your own risk")
#else
/*
Decode literal, length, and distance codes and write out the resulting
literal and match bytes until either not enough input or output is
available, an end-of-block is encountered, or a data error is encountered.
When large enough input and output buffers are supplied to inflate(), for
example, a 16K input buffer and a 64K output buffer, more than 95% of the
inflate execution time is spent in this routine.
Entry assumptions:
state->mode == LEN
strm->avail_in >= 6
strm->avail_out >= 258
start >= strm->avail_out
state->bits < 8
On return, state->mode is one of:
LEN -- ran out of enough output space or enough available input
TYPE -- reached end of block code, inflate() to interpret next block
BAD -- error in block data
Notes:
- The maximum input bits used by a length/distance pair is 15 bits for the
length code, 5 bits for the length extra, 15 bits for the distance code,
and 13 bits for the distance extra. This totals 48 bits, or six bytes.
Therefore if strm->avail_in >= 6, then there is enough input to avoid
checking for available input while decoding.
- The maximum bytes that a single length/distance pair can output is 258
bytes, which is the maximum length that can be coded. inflate_fast()
requires strm->avail_out >= 258 for each loop to avoid checking for
output space.
*/
void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) {
struct inflate_state FAR *state;
z_const unsigned char FAR *in; /* local strm->next_in */
z_const unsigned char FAR *last; /* have enough input while in < last */
unsigned char FAR *out; /* local strm->next_out */
unsigned char FAR *beg; /* inflate()'s initial strm->next_out */
unsigned char FAR *end; /* while out < end, enough space available */
#ifdef INFLATE_STRICT
unsigned dmax; /* maximum distance from zlib header */
#endif
unsigned wsize; /* window size or zero if not using window */
unsigned whave; /* valid bytes in the window */
unsigned wnext; /* window write index */
unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */
unsigned long hold; /* local strm->hold */
unsigned bits; /* local strm->bits */
code const FAR *lcode; /* local strm->lencode */
code const FAR *dcode; /* local strm->distcode */
unsigned lmask; /* mask for first level of length codes */
unsigned dmask; /* mask for first level of distance codes */
code const *here; /* retrieved table entry */
unsigned op; /* code bits, operation, extra bits, or */
/* window position, window bytes to copy */
unsigned len; /* match length, unused bytes */
unsigned dist; /* match distance */
unsigned char FAR *from; /* where to copy match from */
/* copy state to local variables */
state = (struct inflate_state FAR *)strm->state;
in = strm->next_in;
last = in + (strm->avail_in - 5);
out = strm->next_out;
beg = out - (start - strm->avail_out);
end = out + (strm->avail_out - 257);
#ifdef INFLATE_STRICT
dmax = state->dmax;
#endif
wsize = state->wsize;
whave = state->whave;
wnext = state->wnext;
window = state->window;
hold = state->hold;
bits = state->bits;
lcode = state->lencode;
dcode = state->distcode;
lmask = (1U << state->lenbits) - 1;
dmask = (1U << state->distbits) - 1;
/* decode literals and length/distances until end-of-block or not enough
input data or output space */
do {
if (bits < 15) {
hold += (unsigned long)(*in++) << bits;
bits += 8;
hold += (unsigned long)(*in++) << bits;
bits += 8;
}
here = lcode + (hold & lmask);
dolen:
op = (unsigned)(here->bits);
hold >>= op;
bits -= op;
op = (unsigned)(here->op);
if (op == 0) { /* literal */
Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
"inflate: literal '%c'\n" :
"inflate: literal 0x%02x\n", here->val));
*out++ = (unsigned char)(here->val);
}
else if (op & 16) { /* length base */
len = (unsigned)(here->val);
op &= 15; /* number of extra bits */
if (op) {
if (bits < op) {
hold += (unsigned long)(*in++) << bits;
bits += 8;
}
len += (unsigned)hold & ((1U << op) - 1);
hold >>= op;
bits -= op;
}
Tracevv((stderr, "inflate: length %u\n", len));
if (bits < 15) {
hold += (unsigned long)(*in++) << bits;
bits += 8;
hold += (unsigned long)(*in++) << bits;
bits += 8;
}
here = dcode + (hold & dmask);
dodist:
op = (unsigned)(here->bits);
hold >>= op;
bits -= op;
op = (unsigned)(here->op);
if (op & 16) { /* distance base */
dist = (unsigned)(here->val);
op &= 15; /* number of extra bits */
if (bits < op) {
hold += (unsigned long)(*in++) << bits;
bits += 8;
if (bits < op) {
hold += (unsigned long)(*in++) << bits;
bits += 8;
}
}
dist += (unsigned)hold & ((1U << op) - 1);
#ifdef INFLATE_STRICT
if (dist > dmax) {
strm->msg = (char *)"invalid distance too far back";
state->mode = BAD;
break;
}
#endif
hold >>= op;
bits -= op;
Tracevv((stderr, "inflate: distance %u\n", dist));
op = (unsigned)(out - beg); /* max distance in output */
if (dist > op) { /* see if copy from window */
op = dist - op; /* distance back in window */
if (op > whave) {
if (state->sane) {
strm->msg =
(char *)"invalid distance too far back";
state->mode = BAD;
break;
}
#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
if (len <= op - whave) {
do {
*out++ = 0;
} while (--len);
continue;
}
len -= op - whave;
do {
*out++ = 0;
} while (--op > whave);
if (op == 0) {
from = out - dist;
do {
*out++ = *from++;
} while (--len);
continue;
}
#endif
}
from = window;
if (wnext == 0) { /* very common case */
from += wsize - op;
if (op < len) { /* some from window */
len -= op;
do {
*out++ = *from++;
} while (--op);
from = out - dist; /* rest from output */
}
}
else if (wnext < op) { /* wrap around window */
from += wsize + wnext - op;
op -= wnext;
if (op < len) { /* some from end of window */
len -= op;
do {
*out++ = *from++;
} while (--op);
from = window;
if (wnext < len) { /* some from start of window */
op = wnext;
len -= op;
do {
*out++ = *from++;
} while (--op);
from = out - dist; /* rest from output */
}
}
}
else { /* contiguous in window */
from += wnext - op;
if (op < len) { /* some from window */
len -= op;
do {
*out++ = *from++;
} while (--op);
from = out - dist; /* rest from output */
}
}
while (len > 2) {
*out++ = *from++;
*out++ = *from++;
*out++ = *from++;
len -= 3;
}
if (len) {
*out++ = *from++;
if (len > 1)
*out++ = *from++;
}
}
else {
from = out - dist; /* copy direct from output */
do { /* minimum length is three */
*out++ = *from++;
*out++ = *from++;
*out++ = *from++;
len -= 3;
} while (len > 2);
if (len) {
*out++ = *from++;
if (len > 1)
*out++ = *from++;
}
}
}
else if ((op & 64) == 0) { /* 2nd level distance code */
here = dcode + here->val + (hold & ((1U << op) - 1));
goto dodist;
}
else {
strm->msg = (char *)"invalid distance code";
state->mode = BAD;
break;
}
}
else if ((op & 64) == 0) { /* 2nd level length code */
here = lcode + here->val + (hold & ((1U << op) - 1));
goto dolen;
}
else if (op & 32) { /* end-of-block */
Tracevv((stderr, "inflate: end of block\n"));
state->mode = TYPE;
break;
}
else {
strm->msg = (char *)"invalid literal/length code";
state->mode = BAD;
break;
}
} while (in < last && out < end);
/* return unused bytes (on entry, bits < 8, so in won't go too far back) */
len = bits >> 3;
in -= len;
bits -= len << 3;
hold &= (1U << bits) - 1;
/* update state and return */
strm->next_in = in;
strm->next_out = out;
strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
strm->avail_out = (unsigned)(out < end ?
257 + (end - out) : 257 - (out - end));
state->hold = hold;
state->bits = bits;
return;
}
/*
inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe):
- Using bit fields for code structure
- Different op definition to avoid & for extra bits (do & for table bits)
- Three separate decoding do-loops for direct, window, and wnext == 0
- Special case for distance > 1 copies to do overlapped load and store copy
- Explicit branch predictions (based on measured branch probabilities)
- Deferring match copy and interspersed it with decoding subsequent codes
- Swapping literal/length else
- Swapping window/direct else
- Larger unrolled copy loops (three is about right)
- Moving len -= 3 statement into middle of loop
*/
#endif /* !ASMINF */

File diff suppressed because it is too large Load Diff

View File

@@ -1,299 +0,0 @@
/* inftrees.c -- generate Huffman trees for efficient decoding
* Copyright (C) 1995-2024 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
#include "zutil.h"
#include "inftrees.h"
#define MAXBITS 15
const char inflate_copyright[] =
" inflate 1.3.1 Copyright 1995-2024 Mark Adler ";
/*
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
include such an acknowledgment, I would appreciate that you keep this
copyright string in the executable of your product.
*/
/*
Build a set of tables to decode the provided canonical Huffman code.
The code lengths are lens[0..codes-1]. The result starts at *table,
whose indices are 0..2^bits-1. work is a writable array of at least
lens shorts, which is used as a work area. type is the type of code
to be generated, CODES, LENS, or DISTS. On return, zero is success,
-1 is an invalid code, and +1 means that ENOUGH isn't enough. table
on return points to the next available entry's address. bits is the
requested root table index bits, and on return it is the actual root
table index bits. It will differ if the request is greater than the
longest code or if it is less than the shortest code.
*/
int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens,
unsigned codes, code FAR * FAR *table,
unsigned FAR *bits, unsigned short FAR *work) {
unsigned len; /* a code's length in bits */
unsigned sym; /* index of code symbols */
unsigned min, max; /* minimum and maximum code lengths */
unsigned root; /* number of index bits for root table */
unsigned curr; /* number of index bits for current table */
unsigned drop; /* code bits to drop for sub-table */
int left; /* number of prefix codes available */
unsigned used; /* code entries in table used */
unsigned huff; /* Huffman code */
unsigned incr; /* for incrementing code, index */
unsigned fill; /* index for replicating entries */
unsigned low; /* low bits for current root entry */
unsigned mask; /* mask for low root bits */
code here; /* table entry for duplication */
code FAR *next; /* next available space in table */
const unsigned short FAR *base; /* base value table to use */
const unsigned short FAR *extra; /* extra bits table to use */
unsigned match; /* use base and extra for symbol >= match */
unsigned short count[MAXBITS+1]; /* number of codes of each length */
unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
static const unsigned short lbase[31] = { /* Length codes 257..285 base */
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
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,
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 */
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
8193, 12289, 16385, 24577, 0, 0};
static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
28, 28, 29, 29, 64, 64};
/*
Process a set of code lengths to create a canonical Huffman code. The
code lengths are lens[0..codes-1]. Each length corresponds to the
symbols 0..codes-1. The Huffman code is generated by first sorting the
symbols by length from short to long, and retaining the symbol order
for codes with equal lengths. Then the code starts with all zero bits
for the first code of the shortest length, and the codes are integer
increments for the same length, and zeros are appended as the length
increases. For the deflate format, these bits are stored backwards
from their more natural integer increment ordering, and so when the
decoding tables are built in the large loop below, the integer codes
are incremented backwards.
This routine assumes, but does not check, that all of the entries in
lens[] are in the range 0..MAXBITS. The caller must assure this.
1..MAXBITS is interpreted as that code length. zero means that that
symbol does not occur in this code.
The codes are sorted by computing a count of codes for each length,
creating from that a table of starting indices for each length in the
sorted table, and then entering the symbols in order in the sorted
table. The sorted table is work[], with that space being provided by
the caller.
The length counts are used for other purposes as well, i.e. finding
the minimum and maximum length codes, determining if there are any
codes at all, checking for a valid set of lengths, and looking ahead
at length counts to determine sub-table sizes when building the
decoding tables.
*/
/* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
for (len = 0; len <= MAXBITS; len++)
count[len] = 0;
for (sym = 0; sym < codes; sym++)
count[lens[sym]]++;
/* bound code lengths, force root to be within code lengths */
root = *bits;
for (max = MAXBITS; max >= 1; max--)
if (count[max] != 0) break;
if (root > max) root = max;
if (max == 0) { /* no symbols to code at all */
here.op = (unsigned char)64; /* invalid code marker */
here.bits = (unsigned char)1;
here.val = (unsigned short)0;
*(*table)++ = here; /* make a table to force an error */
*(*table)++ = here;
*bits = 1;
return 0; /* no symbols, but wait for decoding to report error */
}
for (min = 1; min < max; min++)
if (count[min] != 0) break;
if (root < min) root = min;
/* check for an over-subscribed or incomplete set of lengths */
left = 1;
for (len = 1; len <= MAXBITS; len++) {
left <<= 1;
left -= count[len];
if (left < 0) return -1; /* over-subscribed */
}
if (left > 0 && (type == CODES || max != 1))
return -1; /* incomplete set */
/* generate offsets into symbol table for each length for sorting */
offs[1] = 0;
for (len = 1; len < MAXBITS; len++)
offs[len + 1] = offs[len] + count[len];
/* sort symbols by length, by symbol order within each length */
for (sym = 0; sym < codes; sym++)
if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
/*
Create and fill in decoding tables. In this loop, the table being
filled is at next and has curr index bits. The code being used is huff
with length len. That code is converted to an index by dropping drop
bits off of the bottom. For codes where len is less than drop + curr,
those top drop + curr - len bits are incremented through all values to
fill the table with replicated entries.
root is the number of index bits for the root table. When len exceeds
root, sub-tables are created pointed to by the root entry with an index
of the low root bits of huff. This is saved in low to check for when a
new sub-table should be started. drop is zero when the root table is
being filled, and drop is root when sub-tables are being filled.
When a new sub-table is needed, it is necessary to look ahead in the
code lengths to determine what size sub-table is needed. The length
counts are used for this, and so count[] is decremented as codes are
entered in the tables.
used keeps track of how many table entries have been allocated from the
provided *table space. It is checked for LENS and DIST tables against
the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
the initial root table size constants. See the comments in inftrees.h
for more information.
sym increments through all symbols, and the loop terminates when
all codes of length max, i.e. all codes, have been processed. This
routine permits incomplete codes, so another loop after this one fills
in the rest of the decoding tables with invalid code markers.
*/
/* set up for code type */
switch (type) {
case CODES:
base = extra = work; /* dummy value--not used */
match = 20;
break;
case LENS:
base = lbase;
extra = lext;
match = 257;
break;
default: /* DISTS */
base = dbase;
extra = dext;
match = 0;
}
/* initialize state for loop */
huff = 0; /* starting code */
sym = 0; /* starting code symbol */
len = min; /* starting code length */
next = *table; /* current table to fill in */
curr = root; /* current table index bits */
drop = 0; /* current bits to drop from code for index */
low = (unsigned)(-1); /* trigger new sub-table when len > root */
used = 1U << root; /* use root table entries */
mask = used - 1; /* mask for comparing low */
/* check available table space */
if ((type == LENS && used > ENOUGH_LENS) ||
(type == DISTS && used > ENOUGH_DISTS))
return 1;
/* process all codes and make table entries */
for (;;) {
/* create table entry */
here.bits = (unsigned char)(len - drop);
if (work[sym] + 1U < match) {
here.op = (unsigned char)0;
here.val = work[sym];
}
else if (work[sym] >= match) {
here.op = (unsigned char)(extra[work[sym] - match]);
here.val = base[work[sym] - match];
}
else {
here.op = (unsigned char)(32 + 64); /* end of block */
here.val = 0;
}
/* replicate for those indices with low len bits equal to huff */
incr = 1U << (len - drop);
fill = 1U << curr;
min = fill; /* save offset to next table */
do {
fill -= incr;
next[(huff >> drop) + fill] = here;
} while (fill != 0);
/* backwards increment the len-bit code huff */
incr = 1U << (len - 1);
while (huff & incr)
incr >>= 1;
if (incr != 0) {
huff &= incr - 1;
huff += incr;
}
else
huff = 0;
/* go to next symbol, update count, len */
sym++;
if (--(count[len]) == 0) {
if (len == max) break;
len = lens[work[sym]];
}
/* create new sub-table if needed */
if (len > root && (huff & mask) != low) {
/* if first time, transition to sub-tables */
if (drop == 0)
drop = root;
/* increment past last table */
next += min; /* here min is 1 << curr */
/* determine length of next table */
curr = len - drop;
left = (int)(1 << curr);
while (curr + drop < max) {
left -= count[curr + drop];
if (left <= 0) break;
curr++;
left <<= 1;
}
/* check for enough space */
used += 1U << curr;
if ((type == LENS && used > ENOUGH_LENS) ||
(type == DISTS && used > ENOUGH_DISTS))
return 1;
/* point entry in root table to sub-table */
low = huff & mask;
(*table)[low].op = (unsigned char)curr;
(*table)[low].bits = (unsigned char)root;
(*table)[low].val = (unsigned short)(next - *table);
}
}
/* fill in remaining table entry if code is incomplete (guaranteed to have
at most one remaining entry, since if the code is incomplete, the
maximum code length that was allowed to get this far is one bit) */
if (huff != 0) {
here.op = (unsigned char)64; /* invalid code marker */
here.bits = (unsigned char)(len - drop);
here.val = (unsigned short)0;
next[huff] = here;
}
/* set return parameters */
*table += used;
*bits = root;
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,299 +0,0 @@
/* zutil.c -- target dependent utility functions for the compression library
* Copyright (C) 1995-2017 Jean-loup Gailly
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#include "zutil.h"
#ifndef Z_SOLO
# include "gzguts.h"
#endif
z_const char * const z_errmsg[10] = {
(z_const char *)"need dictionary", /* Z_NEED_DICT 2 */
(z_const char *)"stream end", /* Z_STREAM_END 1 */
(z_const char *)"", /* Z_OK 0 */
(z_const char *)"file error", /* Z_ERRNO (-1) */
(z_const char *)"stream error", /* Z_STREAM_ERROR (-2) */
(z_const char *)"data error", /* Z_DATA_ERROR (-3) */
(z_const char *)"insufficient memory", /* Z_MEM_ERROR (-4) */
(z_const char *)"buffer error", /* Z_BUF_ERROR (-5) */
(z_const char *)"incompatible version",/* Z_VERSION_ERROR (-6) */
(z_const char *)""
};
const char * ZEXPORT zlibVersion(void) {
return ZLIB_VERSION;
}
uLong ZEXPORT zlibCompileFlags(void) {
uLong flags;
flags = 0;
switch ((int)(sizeof(uInt))) {
case 2: break;
case 4: flags += 1; break;
case 8: flags += 2; break;
default: flags += 3;
}
switch ((int)(sizeof(uLong))) {
case 2: break;
case 4: flags += 1 << 2; break;
case 8: flags += 2 << 2; break;
default: flags += 3 << 2;
}
switch ((int)(sizeof(voidpf))) {
case 2: break;
case 4: flags += 1 << 4; break;
case 8: flags += 2 << 4; break;
default: flags += 3 << 4;
}
switch ((int)(sizeof(z_off_t))) {
case 2: break;
case 4: flags += 1 << 6; break;
case 8: flags += 2 << 6; break;
default: flags += 3 << 6;
}
#ifdef ZLIB_DEBUG
flags += 1 << 8;
#endif
/*
#if defined(ASMV) || defined(ASMINF)
flags += 1 << 9;
#endif
*/
#ifdef ZLIB_WINAPI
flags += 1 << 10;
#endif
#ifdef BUILDFIXED
flags += 1 << 12;
#endif
#ifdef DYNAMIC_CRC_TABLE
flags += 1 << 13;
#endif
#ifdef NO_GZCOMPRESS
flags += 1L << 16;
#endif
#ifdef NO_GZIP
flags += 1L << 17;
#endif
#ifdef PKZIP_BUG_WORKAROUND
flags += 1L << 20;
#endif
#ifdef FASTEST
flags += 1L << 21;
#endif
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
# ifdef NO_vsnprintf
flags += 1L << 25;
# ifdef HAS_vsprintf_void
flags += 1L << 26;
# endif
# else
# ifdef HAS_vsnprintf_void
flags += 1L << 26;
# endif
# endif
#else
flags += 1L << 24;
# ifdef NO_snprintf
flags += 1L << 25;
# ifdef HAS_sprintf_void
flags += 1L << 26;
# endif
# else
# ifdef HAS_snprintf_void
flags += 1L << 26;
# endif
# endif
#endif
return flags;
}
#ifdef ZLIB_DEBUG
#include <stdlib.h>
# ifndef verbose
# define verbose 0
# endif
int ZLIB_INTERNAL z_verbose = verbose;
void ZLIB_INTERNAL z_error(char *m) {
fprintf(stderr, "%s\n", m);
exit(1);
}
#endif
/* exported to allow conversion of error code to string for compress() and
* uncompress()
*/
const char * ZEXPORT zError(int err) {
return ERR_MSG(err);
}
#if defined(_WIN32_WCE) && _WIN32_WCE < 0x800
/* The older Microsoft C Run-Time Library for Windows CE doesn't have
* errno. We define it as a global variable to simplify porting.
* Its value is always 0 and should not be used.
*/
int errno = 0;
#endif
#ifndef HAVE_MEMCPY
void ZLIB_INTERNAL zmemcpy(Bytef* dest, const Bytef* source, uInt len) {
if (len == 0) return;
do {
*dest++ = *source++; /* ??? to be unrolled */
} while (--len != 0);
}
int ZLIB_INTERNAL zmemcmp(const Bytef* s1, const Bytef* s2, uInt len) {
uInt j;
for (j = 0; j < len; j++) {
if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
}
return 0;
}
void ZLIB_INTERNAL zmemzero(Bytef* dest, uInt len) {
if (len == 0) return;
do {
*dest++ = 0; /* ??? to be unrolled */
} while (--len != 0);
}
#endif
#ifndef Z_SOLO
#ifdef SYS16BIT
#ifdef __TURBOC__
/* Turbo C in 16-bit mode */
# define MY_ZCALLOC
/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
* and farmalloc(64K) returns a pointer with an offset of 8, so we
* must fix the pointer. Warning: the pointer must be put back to its
* original form in order to free it, use zcfree().
*/
#define MAX_PTR 10
/* 10*64K = 640K */
local int next_ptr = 0;
typedef struct ptr_table_s {
voidpf org_ptr;
voidpf new_ptr;
} ptr_table;
local ptr_table table[MAX_PTR];
/* This table is used to remember the original form of pointers
* to large buffers (64K). Such pointers are normalized with a zero offset.
* Since MSDOS is not a preemptive multitasking OS, this table is not
* protected from concurrent access. This hack doesn't work anyway on
* a protected system like OS/2. Use Microsoft C instead.
*/
voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) {
voidpf buf;
ulg bsize = (ulg)items*size;
(void)opaque;
/* If we allocate less than 65520 bytes, we assume that farmalloc
* will return a usable pointer which doesn't have to be normalized.
*/
if (bsize < 65520L) {
buf = farmalloc(bsize);
if (*(ush*)&buf != 0) return buf;
} else {
buf = farmalloc(bsize + 16L);
}
if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
table[next_ptr].org_ptr = buf;
/* Normalize the pointer to seg:0 */
*((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
*(ush*)&buf = 0;
table[next_ptr++].new_ptr = buf;
return buf;
}
void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
int n;
(void)opaque;
if (*(ush*)&ptr != 0) { /* object < 64K */
farfree(ptr);
return;
}
/* Find the original pointer */
for (n = 0; n < next_ptr; n++) {
if (ptr != table[n].new_ptr) continue;
farfree(table[n].org_ptr);
while (++n < next_ptr) {
table[n-1] = table[n];
}
next_ptr--;
return;
}
Assert(0, "zcfree: ptr not found");
}
#endif /* __TURBOC__ */
#ifdef M_I86
/* Microsoft C in 16-bit mode */
# define MY_ZCALLOC
#if (!defined(_MSC_VER) || (_MSC_VER <= 600))
# define _halloc halloc
# define _hfree hfree
#endif
voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, uInt items, uInt size) {
(void)opaque;
return _halloc((long)items, size);
}
void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
(void)opaque;
_hfree(ptr);
}
#endif /* M_I86 */
#endif /* SYS16BIT */
#ifndef MY_ZCALLOC /* Any system without a special alloc function */
#ifndef STDC
extern voidp malloc(uInt size);
extern voidp calloc(uInt items, uInt size);
extern void free(voidpf ptr);
#endif
voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) {
(void)opaque;
return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
(voidpf)calloc(items, size);
}
void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
(void)opaque;
free(ptr);
}
#endif /* MY_ZCALLOC */
#endif /* !Z_SOLO */

View File

@@ -6,47 +6,6 @@ POCO_SOURCES_AUTO(SRCS ${SRCS_G})
file(GLOB_RECURSE HDRS_G "include/*.h")
POCO_HEADERS_AUTO(SRCS ${HDRS_G})
# TODO: Currently only bundled is supported, in future this should also be possible
# with an unbundled version of 7z
POCO_SOURCES(SRCS 7z
src/7zAlloc.c
src/7zBuf2.c
src/7zBuf.c
src/7zCrc.c
src/7zCrcOpt.c
src/7zDec.c
src/7zFile.c
src/7zIn.c
src/7zStream.c
src/Alloc.c
src/Bcj2.c
src/Bra86.c
src/Bra.c
# src/BraIA64.c
src/CpuArch.c
# src/Delta.c
# src/LzFind.c
# src/LzFindMt.c
src/Lzma2Dec.c
# src/Lzma2Enc.c
src/Lzma86Dec.c
# src/Lzma86Enc.c
src/LzmaDec.c
# src/LzmaEnc.c
# src/LzmaLib.c
# src/MtCoder.c
src/Ppmd7.c
src/Ppmd7Dec.c
# src/Ppmd7Enc.c
# src/Sha256.c
# src/Threads.c
# src/Xz.c
# src/XzCrc64.c
# src/XzDec.c
# src/XzEnc.c
# src/XzIn.c
)
# Version Resource
if(MSVC AND BUILD_SHARED_LIBS)
source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc)
@@ -55,6 +14,9 @@ endif()
add_library(SevenZip ${SRCS})
add_library(Poco::SevenZip ALIAS SevenZip)
target_link_libraries(SevenZip PRIVATE "$<BUILD_LOCAL_INTERFACE:7Zip::7Zip>")
set_target_properties(SevenZip
PROPERTIES
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
@@ -63,6 +25,7 @@ set_target_properties(SevenZip
)
target_link_libraries(SevenZip PUBLIC Poco::Foundation)
target_include_directories(SevenZip
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>

View File

@@ -2,7 +2,7 @@
// Archive.h
//
// Library: SevenZip
// Package: Archive
// Package: SevenZip
// Module: Archive
//
// Definition of the Archive class.

View File

@@ -2,7 +2,7 @@
// ArchiveEntry.h
//
// Library: SevenZip
// Package: Archive
// Package: SevenZip
// Module: ArchiveEntry
//
// Definition of the ArchiveEntry class.

View File

@@ -2,7 +2,7 @@
// Archive.cpp
//
// Library: SevenZip
// Package: Archive
// Package: SevenZip
// Module: Archive
//
// Definition of the Archive class.

View File

@@ -2,7 +2,7 @@
// ArchiveEntry.cpp
//
// Library: SevenZip
// Package: Archive
// Package: SevenZip
// Module: ArchiveEntry
//
// Copyright (c) 2014, Applied Informatics Software Engineering GmbH.

View File

@@ -17,21 +17,13 @@ if(MSVC AND BUILD_SHARED_LIBS)
list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc)
endif()
# If POCO_UNBUNDLED is enabled we try to find the required packages
# The configuration will fail if the packages are not found
if(POCO_UNBUNDLED)
find_package(EXPAT REQUIRED)
else()
POCO_SOURCES(SRCS expat
src/xmlparse.cpp
src/xmlrole.c
src/xmltok.c
src/xmltok_impl.c
src/xmltok_ns.c
)
endif(POCO_UNBUNDLED)
add_library(XML ${SRCS})
if (POCO_UNBUNDLED)
target_link_libraries(XML PRIVATE EXPAT::EXPAT)
target_compile_definitions(XML PUBLIC POCO_UNBUNDLED)
else()
target_link_libraries(XML PRIVATE "$<BUILD_LOCAL_INTERFACE:EXPAT::EXPAT>")
endif()
add_library(Poco::XML ALIAS XML)
set_target_properties(XML
@@ -49,19 +41,6 @@ target_include_directories(XML
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
if(POCO_UNBUNDLED)
target_link_libraries(XML PRIVATE EXPAT::EXPAT)
target_compile_definitions(XML PUBLIC POCO_UNBUNDLED)
else()
if(WIN32)
#TODO: Is XML_STATIC only required with Windows? What does it do?
target_compile_definitions(XML PUBLIC XML_STATIC)
endif()
target_compile_definitions(XML
PUBLIC XML_DTD XML_GE
PRIVATE XML_NS HAVE_EXPAT_CONFIG_H)
endif()
POCO_INSTALL(XML)
POCO_GENERATE_PACKAGE(XML)

View File

@@ -18,15 +18,11 @@
#include "Poco/XML/XML.h"
#if defined(POCO_UNBUNDLED)
#include <expat.h>
#else
#include "expat.h"
#endif
#include "Poco/XML/XMLString.h"
#include "Poco/XML/XMLStream.h"
#include "Poco/SAX/Locator.h"
#include "Poco/TextEncoding.h"
#include <expat.h>
#include <map>
#include <vector>

View File

@@ -17,16 +17,11 @@
#include "Poco/XML/XMLStreamParser.h"
#include "Poco/XML/XMLString.h"
#if defined(POCO_UNBUNDLED)
#include <expat.h>
#else
#include "expat.h"
#endif
#include <new>
#include <cstring>
#include <istream>
#include <ostream>
#include <sstream>
namespace Poco {

View File

@@ -13,6 +13,16 @@ if(MSVC AND BUILD_SHARED_LIBS)
endif()
add_library(Zip ${SRCS})
if (POCO_UNBUNDLED)
target_link_libraries(Zip PRIVATE ZLIB::ZLIB)
target_compile_definitions(Zip PUBLIC POCO_UNBUNDLED)
else()
# zlib is already linked with Foundation, we only needs headers.
target_include_directories(Zip
PRIVATE $<TARGET_PROPERTY:ZLIB::ZLIB,INCLUDE_DIRECTORIES>
)
endif()
add_library(Poco::Zip ALIAS Zip)
set_target_properties(Zip
PROPERTIES
@@ -29,11 +39,6 @@ target_include_directories(Zip
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
if(POCO_UNBUNDLED)
find_package(ZLIB REQUIRED)
target_link_libraries(Zip PRIVATE ZLIB::ZLIB)
endif()
POCO_INSTALL(Zip)
POCO_GENERATE_PACKAGE(Zip)

View File

@@ -22,13 +22,8 @@
#include "Poco/InflatingStream.h"
#include "Poco/DeflatingStream.h"
#include "Poco/Format.h"
#if defined(POCO_UNBUNDLED)
#include <zlib.h>
#else
// Quirk before we move zlib to external libs.
#include "../../Foundation/src/zlib.h"
#endif
#include <zlib.h>
namespace Poco {
namespace Zip {

View File

@@ -84,9 +84,6 @@ else(BUILD_SHARED_LIBS)
set(CMAKE_RELWITHDEBINFO_POSTFIX "${STATIC_POSTFIX}" CACHE STRING "Set RelWithDebInfo library postfix" FORCE)
endif()
# MacOS version that has full support for C++17
set(CMAKE_OSX_DEPLOYMENT_TARGET, 10.15)
# OS Detection
include(CheckTypeSize)
find_package(Cygwin)

View File

@@ -96,11 +96,14 @@ if(PCRE2_FOUND AND NOT TARGET Pcre2::Pcre2)
# Determine PCRE2 library type
set(_PCRE2_LIB_TYPE UNKNOWN)
# cmake_path(GET PCRE2_LIBRARY EXTENSION LAST_ONLY _PCRE2_SUFFIX) # CMake 3.20+
get_filename_component(_PCRE2_SUFFIX ${PCRE2_LIBRARY} LAST_EXT)
if ("${_PCRE2_SUFFIX}" STREQUAL "${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(_PCRE2_LIB_TYPE STATIC)
elseif ("${_PCRE2_SUFFIX}" STREQUAL "${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(_PCRE2_LIB_TYPE SHARED)
elseif ("${_PCRE2_SUFFIX}" STREQUAL ".tbd") # new versions of macOS
set(_PCRE2_LIB_TYPE SHARED)
endif()
add_library(Pcre2::Pcre2 ${_PCRE2_LIB_TYPE} IMPORTED)

View File

@@ -1,8 +1,12 @@
CppUnit::TestCaller<ThreadTest>.testSleep
CppUnit::TestCaller<ExpireCacheTest>.testAccessExpireN
CppUnit::TestCaller<ExpireLRUCacheTest>.testAccessExpireN
CppUnit::TestCaller<ExpireCacheTest>.testExpireN
CppUnit::TestCaller<ExpireLRUCacheTest>.testAccessExpireN
CppUnit::TestCaller<ExpireLRUCacheTest>.testExpireN
CppUnit::TestCaller<UniqueExpireCacheTest>.testAccessExpireN
CppUnit::TestCaller<UniqueExpireCacheTest>.testExpireN
CppUnit::TestCaller<UniqueExpireLRUCacheTest>.testAccessExpireN
CppUnit::TestCaller<UniqueExpireLRUCacheTest>.testExpireN
CppUnit::TestCaller<FileChannelTest>.testPurgeAge
CppUnit::TestCaller<FileTest>.testFileAttributes2
CppUnit::TestCaller<PathTest>.testExpand
@@ -14,6 +18,7 @@ CppUnit::TestCaller<TimerTest>.testScheduleInterval
CppUnit::TestCaller<TimerTest>.testScheduleIntervalClock
CppUnit::TestCaller<TimerTest>.testScheduleIntervalTimestamp
CppUnit::TestCaller<TimerTest>.testTimer
CppUnit::TestCaller<TimestampTest>.testTimestamp
CppUnit::TestCaller<SocketAddressTest>.testSocketAddress
CppUnit::TestCaller<RawSocketTest>.testEchoIPv4
CppUnit::TestCaller<RawSocketTest>.testSendToReceiveFromIPv4

62
dependencies/7zip/CMakeLists.txt vendored Normal file
View File

@@ -0,0 +1,62 @@
# Sources
#file(GLOB SRCS_G "src/*.c")
#POCO_SOURCES(SRCS 7zip ${SRCS_G})
# TODO: Currently only bundled is supported, in future this should also be possible
# with an unbundled version of 7z
POCO_SOURCES(SRCS 7zip
src/7zAlloc.c
src/7zBuf2.c
src/7zBuf.c
src/7zCrc.c
src/7zCrcOpt.c
src/7zDec.c
src/7zFile.c
src/7zIn.c
src/7zStream.c
src/Alloc.c
src/Bcj2.c
src/Bra86.c
src/Bra.c
# src/BraIA64.c
src/CpuArch.c
# src/Delta.c
# src/LzFind.c
# src/LzFindMt.c
src/Lzma2Dec.c
# src/Lzma2Enc.c
src/Lzma86Dec.c
# src/Lzma86Enc.c
src/LzmaDec.c
# src/LzmaEnc.c
# src/LzmaLib.c
# src/MtCoder.c
src/Ppmd7.c
src/Ppmd7Dec.c
# src/Ppmd7Enc.c
# src/Sha256.c
# src/Threads.c
# src/Xz.c
# src/XzCrc64.c
# src/XzDec.c
# src/XzEnc.c
# src/XzIn.c
)
# Headers
file(GLOB_RECURSE HDRS_G "src/*.h")
POCO_HEADERS(SRCS 7zip ${HDRS_G})
# NOTE: We use object library to be able to link it with static or shared libraries
add_library(_BUNDLED_7ZIP OBJECT EXCLUDE_FROM_ALL ${SRCS})
set_property(TARGET _BUNDLED_7ZIP PROPERTY POSITION_INDEPENDENT_CODE ON)
target_include_directories(_BUNDLED_7ZIP
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
)
add_library(7Zip::7Zip ALIAS _BUNDLED_7ZIP)

Some files were not shown because too many files have changed in this diff Show More