From 92fe3a04b2f7c23df48788315a6ff05bbcd164e2 Mon Sep 17 00:00:00 2001 From: Bobbey Reese Date: Wed, 30 Nov 2022 22:12:45 -0500 Subject: [PATCH 1/3] lzham: Add 1.0.0 --- recipes/lzham/all/conandata.yml | 29 + recipes/lzham/all/conanfile.py | 221 ++++ .../all/patches/aarch64-yield-1.0.0.patch | 16 + .../patches/cmake-min-req-swap-1.0.0.patch | 55 + recipes/lzham/all/patches/commits-1.0.0.patch | 1083 +++++++++++++++++ recipes/lzham/all/patches/fix-osx-1.0.0.patch | 28 + .../all/patches/use-lzham-types-1.0.0.patch | 142 +++ recipes/lzham/all/test_package/CMakeLists.txt | 7 + recipes/lzham/all/test_package/conanfile.py | 27 + .../lzham/all/test_package/test_package.cpp | 23 + .../lzham/all/test_v1_package/CMakeLists.txt | 10 + .../lzham/all/test_v1_package/conanfile.py | 17 + recipes/lzham/config.yml | 3 + 13 files changed, 1661 insertions(+) create mode 100644 recipes/lzham/all/conandata.yml create mode 100644 recipes/lzham/all/conanfile.py create mode 100644 recipes/lzham/all/patches/aarch64-yield-1.0.0.patch create mode 100644 recipes/lzham/all/patches/cmake-min-req-swap-1.0.0.patch create mode 100644 recipes/lzham/all/patches/commits-1.0.0.patch create mode 100644 recipes/lzham/all/patches/fix-osx-1.0.0.patch create mode 100644 recipes/lzham/all/patches/use-lzham-types-1.0.0.patch create mode 100644 recipes/lzham/all/test_package/CMakeLists.txt create mode 100644 recipes/lzham/all/test_package/conanfile.py create mode 100644 recipes/lzham/all/test_package/test_package.cpp create mode 100644 recipes/lzham/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/lzham/all/test_v1_package/conanfile.py create mode 100644 recipes/lzham/config.yml diff --git a/recipes/lzham/all/conandata.yml b/recipes/lzham/all/conandata.yml new file mode 100644 index 0000000000000..0cf799e6a204d --- /dev/null +++ b/recipes/lzham/all/conandata.yml @@ -0,0 +1,29 @@ +sources: + "1.0.0": + sha256: "4f4f874706763b3a6e3d6dfff666a1e850ca1d92fd9240b2a14365c5864a0057" + url: "https://github.com/richgel999/lzham_codec/archive/refs/tags/v1_0_stable1.tar.gz" +patches: + "1.0.0": + - patch_file: "patches/commits-1.0.0.patch" + patch_description: 'Updates code to latest commit for the repo + https://github.com/richgel999/lzham_codec' + patch_type: official + + - patch_file: "patches/aarch64-yield-1.0.0.patch" + patch_description: 'Uses "yield" rather than "pause" mneumonic to fix + aarch64 build' + patch_type: portability + + - patch_file: "patches/cmake-min-req-swap-1.0.0.patch" + patch_description: 'Puts cmake_minimum_required before project in all + CMakeLists' + patch_type: portability + + - patch_file: "patches/fix-osx-1.0.0.patch" + patch_description: "Fixes building on OSX" + patch_type: portability + + - patch_file: "patches/use-lzham-types-1.0.0.patch" + patch_description: 'Uses typedefs prefixed with LZHAM to fix linux build + errors' + patch_type: portability diff --git a/recipes/lzham/all/conanfile.py b/recipes/lzham/all/conanfile.py new file mode 100644 index 0000000000000..78ee1d7b8c89f --- /dev/null +++ b/recipes/lzham/all/conanfile.py @@ -0,0 +1,221 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import ( + apply_conandata_patches, + copy, + export_conandata_patches, + get, + replace_in_file, + rmdir +) +from conan.tools.microsoft import ( + MSBuild, MSBuildDeps, MSBuildToolchain, VCVars, is_msvc, vs_layout +) + +required_conan_version = ">=1.52.0" + +SLN_FILE = "lzham.sln" + + +class PackageConan(ConanFile): + name = "lzham" + + description = ( + "Compression algorithm similar compression ratio and faster " + "decompression than LZMA." + ) + + license = "LicenseRef-LICENSE" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/richgel999/lzham_codec" + topics = ("compression", "lz-compression") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + def _patch_sources(self): + apply_conandata_patches(self) + + if not is_msvc(self): + # Remove lzhamtest from root CMakeLists.txt. + replace_in_file( + self, + os.path.join(self.source_folder, "CMakeLists.txt"), + "add_subdirectory(lzhamtest)\n", + "" + ) + + # This line in the root CMakeLists.txt can cause issues, see + # https://cmake.org/cmake/help/latest/policy/CMP0077.html. + replace_in_file( + self, + os.path.join(self.source_folder, "CMakeLists.txt"), + "option(BUILD_SHARED_LIBS \"build shared/static libs\" ON)", + "" + ) + return + new_sln = [] + # Remove example and test projects from sln. + with open(os.path.join( + self.source_folder, "lzham.sln" + ), encoding="utf-8") as f: + line = f.readline() + while line: + if ( + line.startswith("Project(") + and ("lzhamtest" in line or "example" in line) + ): + # Don't write the current line and skip the "EndProject" + # line. + f.readline() + else: + new_sln.append(line) + line = f.readline() + with open(os.path.join( + self.source_folder, "lzham.sln" + ), "w", encoding="utf-8") as f: + f.write("".join(new_sln)) + + # Inject conantoolchain.props so that correct platform toolset is used. + projects = [(x, f"{x}.vcxproj") for x in ( + "lzhamcomp", + "lzhamdecomp", + "lzhamlib", + )] + projects.append(("lzhamdll", "lzham.vcxproj")) + search_str = ( + ' ' + ) + + for p in projects: + replace_in_file( + self, + os.path.join(self.source_folder, *p), + search_str, + ' \n' + ' \n' + ' \n' + + search_str + ) + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + if is_msvc(self): + vs_layout(self) + else: + cmake_layout(self, src_folder="src") + + def source(self): + get( + self, + **self.conan_data["sources"][self.version], + destination=self.source_folder, + strip_root=True + ) + + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.generate() + tc = MSBuildDeps(self) + tc.generate() + tc = VCVars(self) + tc.generate() + else: + tc = CMakeToolchain(self) + tc.generate() + + def build(self): + self._patch_sources() + if is_msvc(self): + msbuild = MSBuild(self) + msbuild.build_type = ( + "Debug" if self.settings.build_type == "Debug" else "Release" + ) + msbuild.platform = ( + "Win32" if self.settings.arch == "x86" else msbuild.platform + ) + msbuild.build(sln="lzham.sln") + else: + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy( + self, + pattern="LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder + ) + + if is_msvc(self): + suffix = "x64D" if self.settings.build_type == "Debug" else "x64" + copy( + self, + pattern=f"lzham_{suffix}.lib", + dst=os.path.join(self.package_folder, "lib"), + src=os.path.join(self.build_folder, "lib", "x64"), + keep_path=False + ) + copy( + self, + pattern=f"lzham_{suffix}.dll", + dst=os.path.join(self.package_folder, "bin"), + src=os.path.join(self.build_folder, "bin"), + keep_path=False + ) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + else: + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "res")) + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread"]) + + if is_msvc(self): + lib_name = "lzham_x64" + if self.settings.build_type == "Debug": + lib_name += "D" + self.cpp_info.libs = [lib_name] + else: + self.cpp_info.libs = ["lzhamdll", "lzhamcomp", "lzhamdecomp"] + self.cpp_info.set_property("cmake_file_name", "lzham") + self.cpp_info.set_property("cmake_target_name", "lzham::lzham") + self.cpp_info.set_property("pkg_config_name", "lzham") + + # TODO: to remove in conan v2 once cmake_find_package_* generators + # removed + self.cpp_info.names["cmake_find_package"] = "lzham" + self.cpp_info.names["cmake_find_package_multi"] = "lzham" + self.cpp_info.names["pkg_config"] = "lzham" diff --git a/recipes/lzham/all/patches/aarch64-yield-1.0.0.patch b/recipes/lzham/all/patches/aarch64-yield-1.0.0.patch new file mode 100644 index 0000000000000..313029dda755c --- /dev/null +++ b/recipes/lzham/all/patches/aarch64-yield-1.0.0.patch @@ -0,0 +1,16 @@ +diff --git a/lzhamdecomp/lzham_platform.h b/lzhamdecomp/lzham_platform.h +index 01704be..920a8f4 100644 +--- a/lzhamdecomp/lzham_platform.h ++++ b/lzhamdecomp/lzham_platform.h +@@ -24,7 +24,11 @@ void lzham_fail(const char* pExp, const char* pFile, unsigned line); + #if defined(__GNUC__) && LZHAM_PLATFORM_PC + extern __inline__ __attribute__((__always_inline__,__gnu_inline__)) void lzham_yield_processor() + { ++ #if defined(__aarch64__) ++ __asm__ __volatile__("yield"); ++ #else + __asm__ __volatile__("pause"); ++ #endif + } + #elif LZHAM_PLATFORM_X360 + #define lzham_yield_processor() \ diff --git a/recipes/lzham/all/patches/cmake-min-req-swap-1.0.0.patch b/recipes/lzham/all/patches/cmake-min-req-swap-1.0.0.patch new file mode 100644 index 0000000000000..8c598c5b49697 --- /dev/null +++ b/recipes/lzham/all/patches/cmake-min-req-swap-1.0.0.patch @@ -0,0 +1,55 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 428cdfc..b8980e5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,5 @@ +-# PROJECT(lzham) + cmake_minimum_required(VERSION 2.8) ++PROJECT(lzham) + option(BUILD_X64 "build 64-bit" ON) + option(BUILD_SHARED_LIBS "build shared/static libs" ON) + +diff --git a/lzhamcomp/CMakeLists.txt b/lzhamcomp/CMakeLists.txt +index c80cc66..a3f77e7 100644 +--- a/lzhamcomp/CMakeLists.txt ++++ b/lzhamcomp/CMakeLists.txt +@@ -1,5 +1,5 @@ +-PROJECT(lzhamcomp) + cmake_minimum_required(VERSION 2.8) ++PROJECT(lzhamcomp) + option(BUILD_X64 "build 64-bit" TRUE) + + message("Initial BUILD_X64=${BUILD_X64}") +diff --git a/lzhamdecomp/CMakeLists.txt b/lzhamdecomp/CMakeLists.txt +index bf87a02..723379e 100644 +--- a/lzhamdecomp/CMakeLists.txt ++++ b/lzhamdecomp/CMakeLists.txt +@@ -1,5 +1,5 @@ +-PROJECT(lzhamdecomp) + cmake_minimum_required(VERSION 2.8) ++PROJECT(lzhamdecomp) + option(BUILD_X64 "build 64-bit" TRUE) + + message("Initial BUILD_X64=${BUILD_X64}") +diff --git a/lzhamdll/CMakeLists.txt b/lzhamdll/CMakeLists.txt +index f77f3fe..5a162b6 100644 +--- a/lzhamdll/CMakeLists.txt ++++ b/lzhamdll/CMakeLists.txt +@@ -1,5 +1,5 @@ +-PROJECT(lzhamdll) + cmake_minimum_required(VERSION 2.8) ++PROJECT(lzhamdll) + option(BUILD_X64 "build 64-bit" TRUE) + + message("Initial BUILD_X64=${BUILD_X64}") +diff --git a/lzhamtest/CMakeLists.txt b/lzhamtest/CMakeLists.txt +index 3349911..b8833b9 100644 +--- a/lzhamtest/CMakeLists.txt ++++ b/lzhamtest/CMakeLists.txt +@@ -1,5 +1,5 @@ +-PROJECT(lzhamtest) + cmake_minimum_required(VERSION 2.8) ++PROJECT(lzhamtest) + option(BUILD_X64 "build 64-bit" TRUE) + + message("Initial BUILD_X64=${BUILD_X64}") diff --git a/recipes/lzham/all/patches/commits-1.0.0.patch b/recipes/lzham/all/patches/commits-1.0.0.patch new file mode 100644 index 0000000000000..eb6c0f74337bb --- /dev/null +++ b/recipes/lzham/all/patches/commits-1.0.0.patch @@ -0,0 +1,1083 @@ +diff --git a/LICENSE b/LICENSE +index a084cf7..7122a74 100644 +--- a/LICENSE ++++ b/LICENSE +@@ -1,22 +1,56 @@ +-The MIT License (MIT) ++THIS SOFTWARE IS IN THE PUBLIC DOMAIN + +-Copyright (c) 2009-2015 Richard Geldreich, Jr. ++THIS IS FREE AND UNENCUMBERED SOFTWARE EXPLICITLY AND OVERTLY RELEASED AND ++CONTRIBUTED TO THE PUBLIC DOMAIN, PERMANENTLY, IRREVOCABLY AND UNCONDITIONALLY ++WAIVING ANY AND ALL CLAIM OF COPYRIGHT, IN PERPETUITY ON SEPTEMBER 15, 2020. + +-Permission is hereby granted, free of charge, to any person obtaining a copy +-of this software and associated documentation files (the "Software"), to deal +-in the Software without restriction, including without limitation the rights +-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +-copies of the Software, and to permit persons to whom the Software is +-furnished to do so, subject to the following conditions: ++1. FALLBACK CLAUSES + +-The above copyright notice and this permission notice shall be included in all +-copies or substantial portions of the Software. ++THIS SOFTWARE MAY BE FREELY USED, DERIVED FROM, EXECUTED, LINKED WITH, MODIFIED ++AND DISTRIBUTED FOR ANY PURPOSE, COMMERCIAL OR NON-COMMERCIAL, BY ANYONE, FOR ++ANY REASON, WITH NO ATTRIBUTION, IN PERPETUITY. ++ ++THE AUTHOR OR AUTHORS OF THIS WORK HEREBY OVERTLY, FULLY, PERMANENTLY, ++IRREVOCABLY AND UNCONDITIONALLY FORFEITS AND WAIVES ALL CLAIM OF COPYRIGHT ++(ECONOMIC AND MORAL), ANY AND ALL RIGHTS OF INTEGRITY, AND ANY AND ALL RIGHTS OF ++ATTRIBUTION. ANYONE IS FREE TO COPY, MODIFY, ENHANCE, OPTIMIZE, PUBLISH, USE, ++COMPILE, DECOMPILE, ASSEMBLE, DISASSEMBLE, DOWNLOAD, UPLOAD, TRANSMIT, RECEIVE, ++SELL, FORK, DERIVE FROM, LINK, LINK TO, CALL, REFERENCE, WRAP, THUNK, ENCODE, ++ENCRYPT, TRANSFORM, STORE, RETRIEVE, DISTORT, DESTROY, RENAME, DELETE, ++BROADCAST, OR DISTRIBUTE THIS SOFTWARE, EITHER IN SOURCE CODE FORM, IN A ++TRANSLATED FORM, AS A LIBRARY, AS TEXT, IN PRINT, OR AS A COMPILED BINARY OR ++EXECUTABLE PROGRAM, OR IN DIGITAL FORM, OR IN ANALOG FORM, OR IN PHYSICAL FORM, ++OR IN ANY OTHER REPRESENTATION, FOR ANY PURPOSE, COMMERCIAL OR NON-COMMERCIAL, ++AND BY ANY MEANS, WITH NO ATTRIBUTION, IN PERPETUITY. ++ ++2. ANTI-COPYRIGHT WAIVER AND STATEMENT OF INTENT ++ ++IN JURISDICTIONS THAT RECOGNIZE COPYRIGHT LAWS, THE AUTHOR OR AUTHORS OF THIS ++SOFTWARE OVERTLY, FULLY, PERMANENTLY, IRREVOCABLY AND UNCONDITIONALLY DEDICATE, ++FORFEIT, AND WAIVE ANY AND ALL COPYRIGHT INTEREST IN THE SOFTWARE TO THE PUBLIC ++DOMAIN. WE MAKE THIS DEDICATION AND WAIVER FOR THE BENEFIT OF THE PUBLIC AT ++LARGE AND TO THE DETRIMENT OF OUR HEIRS AND SUCCESSORS. WE INTEND THIS ++DEDICATION AND WAIVER TO BE AN OVERT ACT OF RELINQUISHMENT IN PERPETUITY OF ALL ++PRESENT AND FUTURE RIGHTS TO THIS SOFTWARE UNDER COPYRIGHT LAW. WE INTEND THIS ++SOFTWARE TO BE FREELY USED, COMPILED, EXECUTED, MODIFIED, PUBLISHED, DERIVED ++FROM, OR DISTRIBUTED BY ANYONE, FOR ANY COMMERCIAL OR NON-COMMERCIAL USE, WITH ++NO ATTRIBUTION, IN PERPETUITY. ++ ++3. NO WARRANTY CLAUSE + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +-SOFTWARE. ++IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS ++FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR OR ++AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ++ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION ++WITH THE SOFTWARE, OR DERIVING FROM THE SOFTWARE, OR LINKING WITH THE SOFTWARE, ++OR CALLING THE SOFTWARE, OR EXECUTING THE SOFTWARE, OR THE USE OR OTHER DEALINGS ++IN THE SOFTWARE. ++ ++4. FINAL ANTI-COPYRIGHT AND INTENT FALLBACK CLAUSE + ++SHOULD ANY PART OF THIS PUBLIC DOMAIN DECLARATION, OR THE FALLBACK CLAUSES, OR ++THE ANTI-COPYRIGHT WAIVER FOR ANY REASON BE JUDGED LEGALLY INVALID OR ++INEFFECTIVE UNDER APPLICABLE LAW, THEN THE PUBLIC DOMAIN DECLARATION, THE ++FALLBACK CLAUSES, AND ANTI-COPYRIGHT WAIVER SHALL BE PRESERVED TO THE MAXIMUM ++EXTENT PERMITTED BY LAW TAKING INTO ACCOUNT THE ABOVE STATEMENT OF INTENT. +diff --git a/README.md b/README.md +index 50a8d84..e465ef2 100644 +--- a/README.md ++++ b/README.md +@@ -1,12 +1,14 @@ + LZHAM - Lossless Data Compression Codec + ============= + +-

Copyright (c) 2009-2015 Richard Geldreich, Jr. - richgel99@gmail.com - MIT License

++Public Domain (see LICENSE) + +

LZHAM is a lossless data compression codec written in C/C++ (specifically C++03), with a compression ratio similar to LZMA but with 1.5x-8x faster decompression speed. It officially supports Linux x86/x64, Windows x86/x64, + OSX, and iOS, with Android support on the way.

+ +-

Some slightly out of date API documentation is here (I'll be migrating this to github): https://code.google.com/p/lzham/wiki/API_Docs

++An improved version of LZHAM, with better compression, is [here](https://github.com/richgel999/lzham_codec_devel). ++ ++

The old alpha version of LZHAM (bitstream incompatible with the v1.x release) is here: https://github.com/richgel999/lzham_alpha

+ +

Introduction

+ +diff --git a/example4/cfile_stream.cpp b/example4/cfile_stream.cpp +index b42a8bd..1b84e87 100644 +--- a/example4/cfile_stream.cpp ++++ b/example4/cfile_stream.cpp +@@ -1,5 +1,5 @@ + // File: cfile_stream.cpp +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #include "cfile_stream.h" + + namespace lzham_ex +diff --git a/example4/cfile_stream.h b/example4/cfile_stream.h +index 4e206a1..c1eb7e0 100644 +--- a/example4/cfile_stream.h ++++ b/example4/cfile_stream.h +@@ -1,5 +1,5 @@ + // File: cfile_stream.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + #include "data_stream.h" + #include +diff --git a/example4/comp_stream.cpp b/example4/comp_stream.cpp +index 42ce24a..77427c3 100644 +--- a/example4/comp_stream.cpp ++++ b/example4/comp_stream.cpp +@@ -1,5 +1,5 @@ + // File: comp_stream.cpp +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #include "comp_stream.h" + + namespace lzham_ex +@@ -95,8 +95,8 @@ namespace lzham_ex + if (!out_buf_size) + return true; + +- assert(out_buf_size <= UINT16_MAX); +- assert(cBufSize <= UINT16_MAX); ++ assert(out_buf_size <= LZHAM_UINT16_MAX); ++ assert(cBufSize <= LZHAM_UINT16_MAX); + + if (!m_pOutput_stream->is_seekable()) + { +@@ -385,7 +385,7 @@ namespace lzham_ex + } + } + +- m_buf.resize(UINT16_MAX); ++ m_buf.resize(LZHAM_UINT16_MAX); + + m_opened = true; + +diff --git a/example4/comp_stream.h b/example4/comp_stream.h +index fa9224f..5412beb 100644 +--- a/example4/comp_stream.h ++++ b/example4/comp_stream.h +@@ -1,5 +1,5 @@ + // File: comp_stream.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #include "data_stream.h" + + #include "lzham.h" +diff --git a/example4/data_stream.cpp b/example4/data_stream.cpp +index 9d35945..b0e58f9 100644 +--- a/example4/data_stream.cpp ++++ b/example4/data_stream.cpp +@@ -1,5 +1,5 @@ + // File: data_stream.cpp +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #include "data_stream.h" + #include + +diff --git a/example4/data_stream.h b/example4/data_stream.h +index b013b7e..89d2922 100644 +--- a/example4/data_stream.h ++++ b/example4/data_stream.h +@@ -1,5 +1,5 @@ + // File: data_stream.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + #include "stream_common.h" + +@@ -12,8 +12,8 @@ namespace lzham_ex + cDataStreamSeekable = 4 + }; + +- const int64 DATA_STREAM_SIZE_UNKNOWN = INT64_MAX; +- const int64 DATA_STREAM_SIZE_INFINITE = UINT64_MAX; ++ const int64 DATA_STREAM_SIZE_UNKNOWN = LZHAM_INT64_MAX; ++ const int64 DATA_STREAM_SIZE_INFINITE = LZHAM_UINT64_MAX; + + class data_stream + { +diff --git a/example4/data_stream_serializer.h b/example4/data_stream_serializer.h +index 9408681..7be64db 100644 +--- a/example4/data_stream_serializer.h ++++ b/example4/data_stream_serializer.h +@@ -1,5 +1,5 @@ + // File: data_stream_serializer.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + #include "data_stream.h" + +diff --git a/example4/dynamic_stream.cpp b/example4/dynamic_stream.cpp +index 0f15170..0bd1286 100644 +--- a/example4/dynamic_stream.cpp ++++ b/example4/dynamic_stream.cpp +@@ -1,5 +1,5 @@ + // File: dynamic_stream.cpp +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #include "dynamic_stream.h" + + namespace lzham_ex +diff --git a/example4/dynamic_stream.h b/example4/dynamic_stream.h +index 66c07c3..6160dfe 100644 +--- a/example4/dynamic_stream.h ++++ b/example4/dynamic_stream.h +@@ -1,5 +1,5 @@ + // File: dynamic_stream.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + #include "data_stream.h" + +diff --git a/example4/mem_stream.cpp b/example4/mem_stream.cpp +index 4e300b3..2ddb16d 100644 +--- a/example4/mem_stream.cpp ++++ b/example4/mem_stream.cpp +@@ -1,5 +1,5 @@ + // File: mem_stream.cpp +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #include "mem_stream.h" + + namespace lzham_ex +diff --git a/example4/mem_stream.h b/example4/mem_stream.h +index d67ffe3..d8c67bc 100644 +--- a/example4/mem_stream.h ++++ b/example4/mem_stream.h +@@ -1,5 +1,5 @@ + // File: mem_stream.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + #include "data_stream.h" + +diff --git a/example4/stream_common.h b/example4/stream_common.h +index 54f4a3a..a5b0f2c 100644 +--- a/example4/stream_common.h ++++ b/example4/stream_common.h +@@ -1,5 +1,5 @@ + // File: stream_common.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + + #include +@@ -32,12 +32,12 @@ namespace lzham_ex + typedef signed __int64 int64; + typedef unsigned __int64 uint64; + +- const uint16 UINT16_MIN = 0; +- const uint16 UINT16_MAX = 0xFFFFU; +- const uint64 UINT64_MIN = 0; +- const uint64 UINT64_MAX = 0xFFFFFFFFFFFFFFFFULL; //0xFFFFFFFFFFFFFFFFui64; +- const int64 INT64_MIN = (int64)0x8000000000000000ULL; //(-9223372036854775807i64 - 1); +- const int64 INT64_MAX = (int64)0x7FFFFFFFFFFFFFFFULL; //9223372036854775807i64; ++ const uint16 LZHAM_UINT16_MIN = 0; ++ const uint16 LZHAM_UINT16_MAX = 0xFFFFU; ++ const uint64 LZHAM_UINT64_MIN = 0; ++ const uint64 LZHAM_UINT64_MAX = 0xFFFFFFFFFFFFFFFFULL; //0xFFFFFFFFFFFFFFFFui64; ++ const int64 LZHAM_INT64_MIN = (int64)0x8000000000000000ULL; //(-9223372036854775807i64 - 1); ++ const int64 LZHAM_INT64_MAX = (int64)0x7FFFFFFFFFFFFFFFULL; //9223372036854775807i64; + + template inline void zero_object(T& obj) { memset(&obj, 0, sizeof(obj)); } + } // namespace lzham_ex +diff --git a/include/lzham.h b/include/lzham.h +index 2c2cf15..2030fc9 100644 +--- a/include/lzham.h ++++ b/include/lzham.h +@@ -1,5 +1,5 @@ + // File: lzham.h - Copyright (c) 2009-2012 Richard Geldreich, Jr. +-// LZHAM uses the MIT License. See Copyright Notice and license at the end of this file. ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of this file. + // + // This is the main header file, includable from C or C++ files, which defines all the publically available API's, structs, and types used by the LZHAM codec. + // +@@ -757,25 +757,61 @@ public: + + #endif // #ifndef __LZHAM_H__ + +-// Copyright (c) 2009-2012 Richard Geldreich, Jr. +-// +-// LZHAM uses the MIT License: +-// +-// Permission is hereby granted, free of charge, to any person obtaining a copy +-// of this software and associated documentation files (the "Software"), to deal +-// in the Software without restriction, including without limitation the rights +-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +-// copies of the Software, and to permit persons to whom the Software is +-// furnished to do so, subject to the following conditions: +-// +-// The above copyright notice and this permission notice shall be included in +-// all copies or substantial portions of the Software. +-// +-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +-// THE SOFTWARE. +- ++/* ++ THIS SOFTWARE IS IN THE PUBLIC DOMAIN ++ ++ THIS IS FREE AND UNENCUMBERED SOFTWARE EXPLICITLY AND OVERTLY RELEASED AND ++ CONTRIBUTED TO THE PUBLIC DOMAIN, PERMANENTLY, IRREVOCABLY AND UNCONDITIONALLY ++ WAIVING ANY AND ALL CLAIM OF COPYRIGHT, IN PERPETUITY ON SEPTEMBER 15, 2020. ++ ++ 1. FALLBACK CLAUSES ++ ++ THIS SOFTWARE MAY BE FREELY USED, DERIVED FROM, EXECUTED, LINKED WITH, MODIFIED ++ AND DISTRIBUTED FOR ANY PURPOSE, COMMERCIAL OR NON-COMMERCIAL, BY ANYONE, FOR ++ ANY REASON, WITH NO ATTRIBUTION, IN PERPETUITY. ++ ++ THE AUTHOR OR AUTHORS OF THIS WORK HEREBY OVERTLY, FULLY, PERMANENTLY, ++ IRREVOCABLY AND UNCONDITIONALLY FORFEITS AND WAIVES ALL CLAIM OF COPYRIGHT ++ (ECONOMIC AND MORAL), ANY AND ALL RIGHTS OF INTEGRITY, AND ANY AND ALL RIGHTS OF ++ ATTRIBUTION. ANYONE IS FREE TO COPY, MODIFY, ENHANCE, OPTIMIZE, PUBLISH, USE, ++ COMPILE, DECOMPILE, ASSEMBLE, DISASSEMBLE, DOWNLOAD, UPLOAD, TRANSMIT, RECEIVE, ++ SELL, FORK, DERIVE FROM, LINK, LINK TO, CALL, REFERENCE, WRAP, THUNK, ENCODE, ++ ENCRYPT, TRANSFORM, STORE, RETRIEVE, DISTORT, DESTROY, RENAME, DELETE, ++ BROADCAST, OR DISTRIBUTE THIS SOFTWARE, EITHER IN SOURCE CODE FORM, IN A ++ TRANSLATED FORM, AS A LIBRARY, AS TEXT, IN PRINT, OR AS A COMPILED BINARY OR ++ EXECUTABLE PROGRAM, OR IN DIGITAL FORM, OR IN ANALOG FORM, OR IN PHYSICAL FORM, ++ OR IN ANY OTHER REPRESENTATION, FOR ANY PURPOSE, COMMERCIAL OR NON-COMMERCIAL, ++ AND BY ANY MEANS, WITH NO ATTRIBUTION, IN PERPETUITY. ++ ++ 2. ANTI-COPYRIGHT WAIVER AND STATEMENT OF INTENT ++ ++ IN JURISDICTIONS THAT RECOGNIZE COPYRIGHT LAWS, THE AUTHOR OR AUTHORS OF THIS ++ SOFTWARE OVERTLY, FULLY, PERMANENTLY, IRREVOCABLY AND UNCONDITIONALLY DEDICATE, ++ FORFEIT, AND WAIVE ANY AND ALL COPYRIGHT INTEREST IN THE SOFTWARE TO THE PUBLIC ++ DOMAIN. WE MAKE THIS DEDICATION AND WAIVER FOR THE BENEFIT OF THE PUBLIC AT ++ LARGE AND TO THE DETRIMENT OF OUR HEIRS AND SUCCESSORS. WE INTEND THIS ++ DEDICATION AND WAIVER TO BE AN OVERT ACT OF RELINQUISHMENT IN PERPETUITY OF ALL ++ PRESENT AND FUTURE RIGHTS TO THIS SOFTWARE UNDER COPYRIGHT LAW. WE INTEND THIS ++ SOFTWARE TO BE FREELY USED, COMPILED, EXECUTED, MODIFIED, PUBLISHED, DERIVED ++ FROM, OR DISTRIBUTED BY ANYONE, FOR ANY COMMERCIAL OR NON-COMMERCIAL USE, WITH ++ NO ATTRIBUTION, IN PERPETUITY. ++ ++ 3. NO WARRANTY CLAUSE ++ ++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS ++ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR OR ++ AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ++ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION ++ WITH THE SOFTWARE, OR DERIVING FROM THE SOFTWARE, OR LINKING WITH THE SOFTWARE, ++ OR CALLING THE SOFTWARE, OR EXECUTING THE SOFTWARE, OR THE USE OR OTHER DEALINGS ++ IN THE SOFTWARE. ++ ++ 4. FINAL ANTI-COPYRIGHT AND INTENT FALLBACK CLAUSE ++ ++ SHOULD ANY PART OF THIS PUBLIC DOMAIN DECLARATION, OR THE FALLBACK CLAUSES, OR ++ THE ANTI-COPYRIGHT WAIVER FOR ANY REASON BE JUDGED LEGALLY INVALID OR ++ INEFFECTIVE UNDER APPLICABLE LAW, THEN THE PUBLIC DOMAIN DECLARATION, THE ++ FALLBACK CLAUSES, AND ANTI-COPYRIGHT WAIVER SHALL BE PRESERVED TO THE MAXIMUM ++ EXTENT PERMITTED BY LAW TAKING INTO ACCOUNT THE ABOVE STATEMENT OF INTENT. ++*/ +diff --git a/lzhamcomp/lzham_comp.h b/lzhamcomp/lzham_comp.h +index 88652d9..50af743 100644 +--- a/lzhamcomp/lzham_comp.h ++++ b/lzhamcomp/lzham_comp.h +@@ -1,5 +1,5 @@ + // File: lzham_comp.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + #include "lzham.h" + +diff --git a/lzhamcomp/lzham_lzbase.cpp b/lzhamcomp/lzham_lzbase.cpp +index a43a318..afeeb7e 100644 +--- a/lzhamcomp/lzham_lzbase.cpp ++++ b/lzhamcomp/lzham_lzbase.cpp +@@ -1,5 +1,5 @@ + // File: lzham_lzbase.cpp +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #include "lzham_core.h" + #include "lzham_lzbase.h" + +diff --git a/lzhamcomp/lzham_lzbase.h b/lzhamcomp/lzham_lzbase.h +index 073175d..73ac9ee 100644 +--- a/lzhamcomp/lzham_lzbase.h ++++ b/lzhamcomp/lzham_lzbase.h +@@ -1,5 +1,5 @@ + // File: lzham_lzbase.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + + #include "lzham_lzdecompbase.h" +diff --git a/lzhamcomp/lzham_lzcomp.cpp b/lzhamcomp/lzham_lzcomp.cpp +index 5081134..32170c5 100644 +--- a/lzhamcomp/lzham_lzcomp.cpp ++++ b/lzhamcomp/lzham_lzcomp.cpp +@@ -1,5 +1,5 @@ + // File: lzham_lzcomp.cpp +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #include "lzham_core.h" + #include "lzham.h" + #include "lzham_comp.h" +@@ -315,7 +315,7 @@ namespace lzham + + if (sizeof(size_t) > sizeof(uint32)) + { +- if (src_len > UINT32_MAX) ++ if (src_len > LZHAM_UINT32_MAX) + return LZHAM_COMP_STATUS_INVALID_PARAMETER; + } + +diff --git a/lzhamcomp/lzham_lzcomp_internal.cpp b/lzhamcomp/lzham_lzcomp_internal.cpp +index 27df701..5f44c5b 100644 +--- a/lzhamcomp/lzham_lzcomp_internal.cpp ++++ b/lzhamcomp/lzham_lzcomp_internal.cpp +@@ -1,5 +1,5 @@ + // File: lzham_lzcomp_internal.cpp +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #include "lzham_core.h" + #include "lzham_lzcomp_internal.h" + #include "lzham_checksum.h" +diff --git a/lzhamcomp/lzham_lzcomp_internal.h b/lzhamcomp/lzham_lzcomp_internal.h +index 8036b26..01b3ba3 100644 +--- a/lzhamcomp/lzham_lzcomp_internal.h ++++ b/lzhamcomp/lzham_lzcomp_internal.h +@@ -1,5 +1,5 @@ + // File: lzham_lzcomp_internal.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + #include "lzham_match_accel.h" + #include "lzham_symbol_codec.h" +diff --git a/lzhamcomp/lzham_lzcomp_state.cpp b/lzhamcomp/lzham_lzcomp_state.cpp +index e989b62..39013e6 100644 +--- a/lzhamcomp/lzham_lzcomp_state.cpp ++++ b/lzhamcomp/lzham_lzcomp_state.cpp +@@ -1,5 +1,5 @@ + // File: lzham_lzcomp_state.cpp +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #include "lzham_core.h" + #include "lzham_lzcomp_internal.h" + +diff --git a/lzhamcomp/lzham_match_accel.cpp b/lzhamcomp/lzham_match_accel.cpp +index 8554653..da5ed33 100644 +--- a/lzhamcomp/lzham_match_accel.cpp ++++ b/lzhamcomp/lzham_match_accel.cpp +@@ -1,5 +1,5 @@ + // File: lzham_match_accel.cpp +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #include "lzham_core.h" + #include "lzham_match_accel.h" + #include "lzham_timer.h" +@@ -153,7 +153,7 @@ namespace lzham + c0 = c1; + c1 = c2; + +- LZHAM_ASSERT(!m_hash_thread_index.size() || (m_hash_thread_index[h] != UINT8_MAX)); ++ LZHAM_ASSERT(!m_hash_thread_index.size() || (m_hash_thread_index[h] != LZHAM_UINT8_MAX)); + + // Only process those strings that this worker thread was assigned to - this allows us to manipulate multiple trees in parallel with no worries about synchronization. + if (m_hash_thread_index.size() && (m_hash_thread_index[h] != thread_index)) +@@ -449,7 +449,7 @@ namespace lzham + + pDict++; + +- if (m_hash_thread_index[t] == UINT8_MAX) ++ if (m_hash_thread_index[t] == LZHAM_UINT8_MAX) + { + num_unique_trigrams++; + +diff --git a/lzhamcomp/lzham_match_accel.h b/lzhamcomp/lzham_match_accel.h +index 384ea7d..bb54dea 100644 +--- a/lzhamcomp/lzham_match_accel.h ++++ b/lzhamcomp/lzham_match_accel.h +@@ -1,5 +1,5 @@ + // File: lzham_match_accel.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + #include "lzham_lzbase.h" + #include "lzham_threading.h" +diff --git a/lzhamcomp/lzham_null_threading.h b/lzhamcomp/lzham_null_threading.h +index a7f7467..1239d26 100644 +--- a/lzhamcomp/lzham_null_threading.h ++++ b/lzhamcomp/lzham_null_threading.h +@@ -1,5 +1,5 @@ + // File: lzham_task_pool_null.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + + namespace lzham +@@ -23,7 +23,7 @@ namespace lzham + (void)releaseCount, (void)pPreviousCount; + } + +- inline bool wait(uint32 milliseconds = UINT32_MAX) ++ inline bool wait(uint32 milliseconds = LZHAM_UINT32_MAX) + { + (void)milliseconds; + return true; +diff --git a/lzhamcomp/lzham_pthreads_threading.cpp b/lzhamcomp/lzham_pthreads_threading.cpp +index bb2c565..da5c3f5 100644 +--- a/lzhamcomp/lzham_pthreads_threading.cpp ++++ b/lzhamcomp/lzham_pthreads_threading.cpp +@@ -1,24 +1,7 @@ + // File: lzham_task_pool_pthreads.cpp + // +-// Copyright (c) 2009-2010 Richard Geldreich, Jr. +-// +-// Permission is hereby granted, free of charge, to any person obtaining a copy +-// of this software and associated documentation files (the "Software"), to deal +-// in the Software without restriction, including without limitation the rights +-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +-// copies of the Software, and to permit persons to whom the Software is +-// furnished to do so, subject to the following conditions: +-// +-// The above copyright notice and this permission notice shall be included in +-// all copies or substantial portions of the Software. +-// +-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +-// THE SOFTWARE. ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h ++ + #include "lzham_core.h" + #include "lzham_pthreads_threading.h" + #include "lzham_timer.h" +diff --git a/lzhamcomp/lzham_pthreads_threading.h b/lzhamcomp/lzham_pthreads_threading.h +index 671387e..a76dfd8 100644 +--- a/lzhamcomp/lzham_pthreads_threading.h ++++ b/lzhamcomp/lzham_pthreads_threading.h +@@ -1,5 +1,5 @@ + // File: lzham_task_pool_pthreads.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + + #if LZHAM_USE_PTHREADS_API +@@ -160,10 +160,10 @@ namespace lzham + } + } + +- inline bool wait(uint32 milliseconds = UINT32_MAX) ++ inline bool wait(uint32 milliseconds = LZHAM_UINT32_MAX) + { + int status; +- if (milliseconds == UINT32_MAX) ++ if (milliseconds == LZHAM_UINT32_MAX) + { + status = sem_wait(&m_sem); + } +diff --git a/lzhamcomp/lzham_threading.h b/lzhamcomp/lzham_threading.h +index b8a1dbe..2b0e8d7 100644 +--- a/lzhamcomp/lzham_threading.h ++++ b/lzhamcomp/lzham_threading.h +@@ -1,5 +1,5 @@ + // File: lzham_threading.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + + #if LZHAM_USE_WIN32_API + #include "lzham_win32_threading.h" +diff --git a/lzhamcomp/lzham_win32_threading.cpp b/lzhamcomp/lzham_win32_threading.cpp +index 63a7e51..3580282 100644 +--- a/lzhamcomp/lzham_win32_threading.cpp ++++ b/lzhamcomp/lzham_win32_threading.cpp +@@ -1,5 +1,5 @@ + // File: lzham_task_pool_win32.cpp +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #include "lzham_core.h" + #include "lzham_win32_threading.h" + #include "lzham_timer.h" +diff --git a/lzhamcomp/lzham_win32_threading.h b/lzhamcomp/lzham_win32_threading.h +index 64125ac..0e1d16b 100644 +--- a/lzhamcomp/lzham_win32_threading.h ++++ b/lzhamcomp/lzham_win32_threading.h +@@ -1,5 +1,5 @@ + // File: lzham_task_pool_win32.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + + #if LZHAM_USE_WIN32_API +diff --git a/lzhamdecomp/lzham_assert.cpp b/lzhamdecomp/lzham_assert.cpp +index 7d27ed6..d4088be 100644 +--- a/lzhamdecomp/lzham_assert.cpp ++++ b/lzhamdecomp/lzham_assert.cpp +@@ -1,5 +1,5 @@ + // File: lzham_assert.cpp +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #include "lzham_core.h" + + static bool g_fail_exceptions; +diff --git a/lzhamdecomp/lzham_assert.h b/lzhamdecomp/lzham_assert.h +index d8a6851..d49949f 100644 +--- a/lzhamdecomp/lzham_assert.h ++++ b/lzhamdecomp/lzham_assert.h +@@ -1,5 +1,5 @@ + // File: lzham_assert.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + + const unsigned int LZHAM_FAIL_EXCEPTION_CODE = 256U; +diff --git a/lzhamdecomp/lzham_checksum.h b/lzhamdecomp/lzham_checksum.h +index 515f338..3369806 100644 +--- a/lzhamdecomp/lzham_checksum.h ++++ b/lzhamdecomp/lzham_checksum.h +@@ -1,5 +1,5 @@ + // File: lzham_checksum.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + + namespace lzham +diff --git a/lzhamdecomp/lzham_config.h b/lzhamdecomp/lzham_config.h +index 3681d8e..1d8c768 100644 +--- a/lzhamdecomp/lzham_config.h ++++ b/lzhamdecomp/lzham_config.h +@@ -1,5 +1,5 @@ + // File: lzham_config.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + + #if defined(_DEBUG) || defined(DEBUG) +@@ -20,4 +20,4 @@ + #endif + #endif + #define LZHAM_BUFFERED_PRINTF 0 +-#define LZHAM_PERF_SECTIONS 0 +\ No newline at end of file ++#define LZHAM_PERF_SECTIONS 0 +diff --git a/lzhamdecomp/lzham_core.h b/lzhamdecomp/lzham_core.h +index f4e2d4f..2e55362 100644 +--- a/lzhamdecomp/lzham_core.h ++++ b/lzhamdecomp/lzham_core.h +@@ -1,5 +1,5 @@ + // File: lzham_core.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + + #if defined(_MSC_VER) +diff --git a/lzhamdecomp/lzham_decomp.h b/lzhamdecomp/lzham_decomp.h +index 32b2f9a..8bb7691 100644 +--- a/lzhamdecomp/lzham_decomp.h ++++ b/lzhamdecomp/lzham_decomp.h +@@ -1,5 +1,5 @@ + // File: lzham_decomp.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + #include "lzham.h" + +diff --git a/lzhamdecomp/lzham_helpers.h b/lzhamdecomp/lzham_helpers.h +index 11e0a11..7b8bb15 100644 +--- a/lzhamdecomp/lzham_helpers.h ++++ b/lzhamdecomp/lzham_helpers.h +@@ -1,5 +1,5 @@ + // File: lzham_helpers.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + + #define LZHAM_NO_COPY_OR_ASSIGNMENT_OP(c) c(const c&); c& operator= (const c&); +diff --git a/lzhamdecomp/lzham_huffman_codes.cpp b/lzhamdecomp/lzham_huffman_codes.cpp +index 10bc494..11bdbd4 100644 +--- a/lzhamdecomp/lzham_huffman_codes.cpp ++++ b/lzhamdecomp/lzham_huffman_codes.cpp +@@ -1,5 +1,5 @@ + // File: huffman_codes.cpp +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #include "lzham_core.h" + #include "lzham_huffman_codes.h" + +diff --git a/lzhamdecomp/lzham_huffman_codes.h b/lzhamdecomp/lzham_huffman_codes.h +index caab1a6..09bfc04 100644 +--- a/lzhamdecomp/lzham_huffman_codes.h ++++ b/lzhamdecomp/lzham_huffman_codes.h +@@ -1,5 +1,5 @@ + // File: lzham_huffman_codes.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + + namespace lzham +diff --git a/lzhamdecomp/lzham_lzdecomp.cpp b/lzhamdecomp/lzham_lzdecomp.cpp +index f6183f4..6f4f371 100644 +--- a/lzhamdecomp/lzham_lzdecomp.cpp ++++ b/lzhamdecomp/lzham_lzdecomp.cpp +@@ -1,5 +1,5 @@ + // File: lzham_lzdecomp.cpp +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + // + // See "Coroutines in C": + // http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html +diff --git a/lzhamdecomp/lzham_lzdecompbase.cpp b/lzhamdecomp/lzham_lzdecompbase.cpp +index 42bc9e4..cb56cc6 100644 +--- a/lzhamdecomp/lzham_lzdecompbase.cpp ++++ b/lzhamdecomp/lzham_lzdecompbase.cpp +@@ -1,5 +1,5 @@ + // File: lzham_lzdecompbase.cpp +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #include "lzham_core.h" + #include "lzham_lzdecompbase.h" + +diff --git a/lzhamdecomp/lzham_lzdecompbase.h b/lzhamdecomp/lzham_lzdecompbase.h +index 40d941a..f92cfa8 100644 +--- a/lzhamdecomp/lzham_lzdecompbase.h ++++ b/lzhamdecomp/lzham_lzdecompbase.h +@@ -1,5 +1,5 @@ + // File: lzham_lzdecompbase.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + + //#define LZHAM_LZDEBUG +diff --git a/lzhamdecomp/lzham_math.h b/lzhamdecomp/lzham_math.h +index 6c8fbfc..1ff0d51 100644 +--- a/lzhamdecomp/lzham_math.h ++++ b/lzhamdecomp/lzham_math.h +@@ -1,5 +1,5 @@ + // File: lzham_math.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + + #if defined(LZHAM_USE_MSVC_INTRINSICS) && !defined(__MINGW32__) +diff --git a/lzhamdecomp/lzham_mem.cpp b/lzhamdecomp/lzham_mem.cpp +index 02f2324..e8163fa 100644 +--- a/lzhamdecomp/lzham_mem.cpp ++++ b/lzhamdecomp/lzham_mem.cpp +@@ -1,5 +1,5 @@ + // File: lzham_mem.cpp +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #include "lzham_core.h" + + #ifdef __APPLE__ +diff --git a/lzhamdecomp/lzham_mem.h b/lzhamdecomp/lzham_mem.h +index d258eff..9eeb8af 100644 +--- a/lzhamdecomp/lzham_mem.h ++++ b/lzhamdecomp/lzham_mem.h +@@ -1,5 +1,5 @@ + // File: lzham_mem.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + + namespace lzham +diff --git a/lzhamdecomp/lzham_platform.cpp b/lzhamdecomp/lzham_platform.cpp +index cd4f9dd..cfc85c1 100644 +--- a/lzhamdecomp/lzham_platform.cpp ++++ b/lzhamdecomp/lzham_platform.cpp +@@ -1,5 +1,5 @@ + // File: platform.cpp +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #include "lzham_core.h" + #include "lzham_timer.h" + #include +diff --git a/lzhamdecomp/lzham_platform.h b/lzhamdecomp/lzham_platform.h +index 0cc58be..01704be 100644 +--- a/lzhamdecomp/lzham_platform.h ++++ b/lzhamdecomp/lzham_platform.h +@@ -1,5 +1,5 @@ + // File: lzham_platform.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + + bool lzham_is_debugger_present(void); +diff --git a/lzhamdecomp/lzham_prefix_coding.cpp b/lzhamdecomp/lzham_prefix_coding.cpp +index 8286697..e9ada15 100644 +--- a/lzhamdecomp/lzham_prefix_coding.cpp ++++ b/lzhamdecomp/lzham_prefix_coding.cpp +@@ -1,5 +1,5 @@ + // File: lzham_prefix_coding.cpp +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #include "lzham_core.h" + #include "lzham_prefix_coding.h" + +diff --git a/lzhamdecomp/lzham_prefix_coding.h b/lzhamdecomp/lzham_prefix_coding.h +index 4e13569..cc538f0 100644 +--- a/lzhamdecomp/lzham_prefix_coding.h ++++ b/lzhamdecomp/lzham_prefix_coding.h +@@ -1,5 +1,5 @@ + // File: lzham_prefix_coding.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + + namespace lzham +diff --git a/lzhamdecomp/lzham_symbol_codec.cpp b/lzhamdecomp/lzham_symbol_codec.cpp +index 72c370b..5623584 100644 +--- a/lzhamdecomp/lzham_symbol_codec.cpp ++++ b/lzhamdecomp/lzham_symbol_codec.cpp +@@ -1,5 +1,5 @@ + // File: lzham_symbol_codec.cpp +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #include "lzham_core.h" + #include "lzham_symbol_codec.h" + #include "lzham_huffman_codes.h" +diff --git a/lzhamdecomp/lzham_symbol_codec.h b/lzhamdecomp/lzham_symbol_codec.h +index e6aa33a..306d59b 100644 +--- a/lzhamdecomp/lzham_symbol_codec.h ++++ b/lzhamdecomp/lzham_symbol_codec.h +@@ -1,5 +1,5 @@ + // File: lzham_symbol_codec.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + #include "lzham_prefix_coding.h" + +diff --git a/lzhamdecomp/lzham_timer.cpp b/lzhamdecomp/lzham_timer.cpp +index 4079353..10910e1 100644 +--- a/lzhamdecomp/lzham_timer.cpp ++++ b/lzhamdecomp/lzham_timer.cpp +@@ -1,5 +1,5 @@ + // File: lzham_timer.cpp +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #include "lzham_core.h" + #include "lzham_timer.h" + +@@ -144,4 +144,4 @@ namespace lzham + return ticks * g_inv_freq; + } + +-} // namespace lzham +\ No newline at end of file ++} // namespace lzham +diff --git a/lzhamdecomp/lzham_timer.h b/lzhamdecomp/lzham_timer.h +index a522430..e0c3cf2 100644 +--- a/lzhamdecomp/lzham_timer.h ++++ b/lzhamdecomp/lzham_timer.h +@@ -1,5 +1,5 @@ + // File: lzham_timer.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + + namespace lzham +diff --git a/lzhamdecomp/lzham_traits.h b/lzhamdecomp/lzham_traits.h +index 950c3fd..ea7214f 100644 +--- a/lzhamdecomp/lzham_traits.h ++++ b/lzhamdecomp/lzham_traits.h +@@ -1,5 +1,5 @@ + // File: lzham_traits.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + + namespace lzham +diff --git a/lzhamdecomp/lzham_types.h b/lzhamdecomp/lzham_types.h +index 47f68a3..2ea6a10 100644 +--- a/lzhamdecomp/lzham_types.h ++++ b/lzhamdecomp/lzham_types.h +@@ -1,30 +1,7 @@ + // File: types.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + +-// TODO +-#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) +- #undef INT8_MIN +- #undef INT8_MAX +- #undef UINT8_MIN +- #undef UINT8_MAX +- +- #undef INT16_MIN +- #undef INT16_MAX +- #undef UINT16_MIN +- #undef UINT16_MAX +- +- #undef INT32_MIN +- #undef INT32_MAX +- #undef UINT32_MIN +- #undef UINT32_MAX +- +- #undef INT64_MIN +- #undef INT64_MAX +- #undef UINT64_MIN +- #undef UINT64_MAX +-#endif +- + namespace lzham + { + typedef unsigned char uint8; +@@ -44,23 +21,23 @@ namespace lzham + typedef long long int64; + #endif + +- const uint8 UINT8_MIN = 0; +- const uint8 UINT8_MAX = 0xFFU; +- const uint16 UINT16_MIN = 0; +- const uint16 UINT16_MAX = 0xFFFFU; +- const uint32 UINT32_MIN = 0; +- const uint32 UINT32_MAX = 0xFFFFFFFFU; +- const uint64 UINT64_MIN = 0; +- const uint64 UINT64_MAX = 0xFFFFFFFFFFFFFFFFULL; //0xFFFFFFFFFFFFFFFFui64; ++ const uint8 LZHAM_UINT8_MIN = 0; ++ const uint8 LZHAM_UINT8_MAX = 0xFFU; ++ const uint16 LZHAM_UINT16_MIN = 0; ++ const uint16 LZHAM_UINT16_MAX = 0xFFFFU; ++ const uint32 LZHAM_UINT32_MIN = 0; ++ const uint32 LZHAM_UINT32_MAX = 0xFFFFFFFFU; ++ const uint64 LZHAM_UINT64_MIN = 0; ++ const uint64 LZHAM_UINT64_MAX = 0xFFFFFFFFFFFFFFFFULL; //0xFFFFFFFFFFFFFFFFui64; + +- const int8 INT8_MIN = -128; +- const int8 INT8_MAX = 127; +- const int16 INT16_MIN = -32768; +- const int16 INT16_MAX = 32767; +- const int32 INT32_MIN = (-2147483647 - 1); +- const int32 INT32_MAX = 2147483647; +- const int64 INT64_MIN = (int64)0x8000000000000000ULL; //(-9223372036854775807i64 - 1); +- const int64 INT64_MAX = (int64)0x7FFFFFFFFFFFFFFFULL; //9223372036854775807i64; ++ const int8 LZHAM_INT8_MIN = -128; ++ const int8 LZHAM_INT8_MAX = 127; ++ const int16 LZHAM_INT16_MIN = -32768; ++ const int16 LZHAM_INT16_MAX = 32767; ++ const int32 LZHAM_INT32_MIN = (-2147483647 - 1); ++ const int32 LZHAM_INT32_MAX = 2147483647; ++ const int64 LZHAM_INT64_MIN = (int64)0x8000000000000000ULL; //(-9223372036854775807i64 - 1); ++ const int64 LZHAM_INT64_MAX = (int64)0x7FFFFFFFFFFFFFFFULL; //9223372036854775807i64; + + #if LZHAM_64BIT_POINTERS + typedef uint64 uint_ptr; +@@ -84,13 +61,13 @@ namespace lzham + const uint cIntBits = sizeof(uint) * CHAR_BIT; + + template struct int_traits { enum { cMin = INT_MIN, cMax = INT_MAX, cSigned = true }; }; +- template<> struct int_traits { enum { cMin = INT8_MIN, cMax = INT8_MAX, cSigned = true }; }; +- template<> struct int_traits { enum { cMin = INT16_MIN, cMax = INT16_MAX, cSigned = true }; }; +- template<> struct int_traits { enum { cMin = INT32_MIN, cMax = INT32_MAX, cSigned = true }; }; ++ template<> struct int_traits { enum { cMin = LZHAM_INT8_MIN, cMax = LZHAM_INT8_MAX, cSigned = true }; }; ++ template<> struct int_traits { enum { cMin = LZHAM_INT16_MIN, cMax = LZHAM_INT16_MAX, cSigned = true }; }; ++ template<> struct int_traits { enum { cMin = LZHAM_INT32_MIN, cMax = LZHAM_INT32_MAX, cSigned = true }; }; + + template<> struct int_traits { enum { cMin = 0, cMax = UINT_MAX, cSigned = false }; }; +- template<> struct int_traits { enum { cMin = 0, cMax = UINT8_MAX, cSigned = false }; }; +- template<> struct int_traits { enum { cMin = 0, cMax = UINT16_MAX, cSigned = false }; }; ++ template<> struct int_traits { enum { cMin = 0, cMax = LZHAM_UINT8_MAX, cSigned = false }; }; ++ template<> struct int_traits { enum { cMin = 0, cMax = LZHAM_UINT16_MAX, cSigned = false }; }; + + struct empty_type { }; + +diff --git a/lzhamdecomp/lzham_utils.h b/lzhamdecomp/lzham_utils.h +index 0e8f5e8..b157c9d 100644 +--- a/lzhamdecomp/lzham_utils.h ++++ b/lzhamdecomp/lzham_utils.h +@@ -1,5 +1,5 @@ + // File: lzham_utils.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + + #define LZHAM_GET_ALIGNMENT(v) ((!sizeof(v)) ? 1 : (__alignof(v) ? __alignof(v) : sizeof(uint32))) +diff --git a/lzhamdecomp/lzham_vector.cpp b/lzhamdecomp/lzham_vector.cpp +index e8a33bd..4a66dac 100644 +--- a/lzhamdecomp/lzham_vector.cpp ++++ b/lzhamdecomp/lzham_vector.cpp +@@ -1,5 +1,5 @@ + // File: lzham_vector.cpp +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #include "lzham_core.h" + #include "lzham_vector.h" + +diff --git a/lzhamdecomp/lzham_vector.h b/lzhamdecomp/lzham_vector.h +index 90f3236..badc540 100644 +--- a/lzhamdecomp/lzham_vector.h ++++ b/lzhamdecomp/lzham_vector.h +@@ -1,5 +1,5 @@ + // File: lzham_vector.h +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #pragma once + + namespace lzham +diff --git a/lzhamdll/lzham_api.cpp b/lzhamdll/lzham_api.cpp +index 6e473b1..cfdbb87 100644 +--- a/lzhamdll/lzham_api.cpp ++++ b/lzhamdll/lzham_api.cpp +@@ -1,5 +1,5 @@ + // File: lzham_api.cpp - Dynamic DLL entrypoints. +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #include "lzham_core.h" + #include "lzham_decomp.h" + #include "lzham_comp.h" +diff --git a/lzhamdll/lzham_dll_main.cpp b/lzhamdll/lzham_dll_main.cpp +index ad8a3ce..fa6280f 100644 +--- a/lzhamdll/lzham_dll_main.cpp ++++ b/lzhamdll/lzham_dll_main.cpp +@@ -1,5 +1,5 @@ + // File: lzham_dll_main.cpp +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #include "lzham_core.h" + + BOOL APIENTRY DllMain(HANDLE hModule, DWORD fdwReason, LPVOID lpReserved) +diff --git a/lzhamlib/lzham_lib.cpp b/lzhamlib/lzham_lib.cpp +index 946a4b4..11f5481 100644 +--- a/lzhamlib/lzham_lib.cpp ++++ b/lzhamlib/lzham_lib.cpp +@@ -1,5 +1,5 @@ + // File: lzham_lib.cpp - Static library entrypoints. +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #include "lzham_core.h" + #include "lzham_decomp.h" + #include "lzham_comp.h" +diff --git a/lzhamtest/lzhamtest.cpp b/lzhamtest/lzhamtest.cpp +index 14bb3d1..01bca51 100644 +--- a/lzhamtest/lzhamtest.cpp ++++ b/lzhamtest/lzhamtest.cpp +@@ -4,7 +4,7 @@ + // See the decompress_file() function to see how to use the decompression API, and the compress_file() function for the compression API. + // See include/lzham.h for documentation on the public LZHAM API. + // Tested on Windows, Linux, and OSX. On iOS, I use a small "Hello World" test app to test the codec. +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #if defined(__GNUC__) + #define _FILE_OFFSET_BITS 64 + #endif +diff --git a/lzhamtest/timer.cpp b/lzhamtest/timer.cpp +index affd260..bf5844a 100644 +--- a/lzhamtest/timer.cpp ++++ b/lzhamtest/timer.cpp +@@ -1,5 +1,5 @@ + // File: timer.cpp +-// See Copyright Notice and license at the end of include/lzham.h ++// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h + #include + #include + #include +diff --git a/lzhamtest/timer.h b/lzhamtest/timer.h +index 6852933..2499d66 100644 +--- a/lzhamtest/timer.h ++++ b/lzhamtest/timer.h +@@ -1,5 +1,5 @@ + // File: timer.h +-// See Copyright Notice and license at the end of include/lzham.h ++// This software is in the Public Domain. Please see the end of include/lzham.h + #pragma once + + typedef unsigned long long timer_ticks; diff --git a/recipes/lzham/all/patches/fix-osx-1.0.0.patch b/recipes/lzham/all/patches/fix-osx-1.0.0.patch new file mode 100644 index 0000000000000..156502e346443 --- /dev/null +++ b/recipes/lzham/all/patches/fix-osx-1.0.0.patch @@ -0,0 +1,28 @@ +diff --git a/lzhamdecomp/lzham_platform.cpp b/lzhamdecomp/lzham_platform.cpp +index cfc85c1..599a847 100644 +--- a/lzhamdecomp/lzham_platform.cpp ++++ b/lzhamdecomp/lzham_platform.cpp +@@ -61,7 +61,7 @@ void lzham_debug_break(void) + { + #if LZHAM_USE_WIN32_API + DebugBreak(); +-#elif (TARGET_OS_MAC == 1) && (TARGET_IPHONE_SIMULATOR == 0) && (TARGET_OS_IPHONE == 0) ++#elif (TARGET_OS_MAC == 1) && (TARGET_IPHONE_SIMULATOR == 0) && (TARGET_OS_IPHONE == 0) && !defined(__clang__) + __asm {int 3} + #else + assert(0); +diff --git a/lzhamdecomp/lzham_traits.h b/lzhamdecomp/lzham_traits.h +index ea7214f..e103bad 100644 +--- a/lzhamdecomp/lzham_traits.h ++++ b/lzhamdecomp/lzham_traits.h +@@ -67,7 +67,9 @@ namespace lzham + // Defines type Q as bitwise copyable. + #define LZHAM_DEFINE_BITWISE_COPYABLE(Q) template<> struct bitwise_copyable { enum { cFlag = true }; }; + +-#if defined(__APPLE__) || defined(__NetBSD__) ++#if defined(__APPLE__) ++ #define LZHAM_IS_POD(T) std::is_pod::value ++#elif defined(__NetBSD__) + #define LZHAM_IS_POD(T) std::__is_pod::__value + #else + #define LZHAM_IS_POD(T) __is_pod(T) diff --git a/recipes/lzham/all/patches/use-lzham-types-1.0.0.patch b/recipes/lzham/all/patches/use-lzham-types-1.0.0.patch new file mode 100644 index 0000000000000..db6f4925fa490 --- /dev/null +++ b/recipes/lzham/all/patches/use-lzham-types-1.0.0.patch @@ -0,0 +1,142 @@ +diff --git a/lzhamcomp/lzham_win32_threading.h b/lzhamcomp/lzham_win32_threading.h +index 0e1d16b..4aaff8c 100644 +--- a/lzhamcomp/lzham_win32_threading.h ++++ b/lzhamcomp/lzham_win32_threading.h +@@ -43,9 +43,9 @@ namespace lzham + } + } + +- bool wait(uint32 milliseconds = UINT32_MAX) ++ bool wait(uint32 milliseconds = LZHAM_UINT32_MAX) + { +- LZHAM_ASSUME(INFINITE == UINT32_MAX); ++ LZHAM_ASSUME(INFINITE == LZHAM_UINT32_MAX); + + DWORD result = WaitForSingleObject(m_handle, milliseconds); + +diff --git a/lzhamdecomp/lzham_huffman_codes.cpp b/lzhamdecomp/lzham_huffman_codes.cpp +index 11bdbd4..788414a 100644 +--- a/lzhamdecomp/lzham_huffman_codes.cpp ++++ b/lzhamdecomp/lzham_huffman_codes.cpp +@@ -224,7 +224,7 @@ namespace lzham + + sym_freq& sf = state.syms0[num_used_syms]; + sf.m_left = (uint16)i; +- sf.m_right = UINT16_MAX; ++ sf.m_right = LZHAM_UINT16_MAX; + sf.m_freq = freq; + num_used_syms++; + } +diff --git a/lzhamdecomp/lzham_prefix_coding.cpp b/lzhamdecomp/lzham_prefix_coding.cpp +index e9ada15..52377c9 100644 +--- a/lzhamdecomp/lzham_prefix_coding.cpp ++++ b/lzhamdecomp/lzham_prefix_coding.cpp +@@ -149,7 +149,7 @@ namespace lzham + { + uint c = pCodesizes[i]; + +- LZHAM_ASSERT(!c || (next_code[c] <= UINT16_MAX)); ++ LZHAM_ASSERT(!c || (next_code[c] <= LZHAM_UINT16_MAX)); + + pCodes[i] = static_cast(next_code[c]++); + +@@ -296,7 +296,7 @@ namespace lzham + + LZHAM_ASSERT(t < (1U << table_bits)); + +- LZHAM_ASSERT(pTables->m_lookup[t] == UINT32_MAX); ++ LZHAM_ASSERT(pTables->m_lookup[t] == LZHAM_UINT32_MAX); + + pTables->m_lookup[t] = sym_index | (codesize << 16U); + } +diff --git a/lzhamdecomp/lzham_symbol_codec.cpp b/lzhamdecomp/lzham_symbol_codec.cpp +index 5623584..b2ea7ee 100644 +--- a/lzhamdecomp/lzham_symbol_codec.cpp ++++ b/lzhamdecomp/lzham_symbol_codec.cpp +@@ -581,7 +581,7 @@ namespace lzham + freq++; + m_sym_freq[sym] = static_cast(freq); + +- LZHAM_ASSERT(freq <= UINT16_MAX); ++ LZHAM_ASSERT(freq <= LZHAM_UINT16_MAX); + + if (--m_symbols_until_update == 0) + { +@@ -828,7 +828,7 @@ namespace lzham + freq++; + model.m_sym_freq[sym] = static_cast(freq); + +- LZHAM_ASSERT(freq <= UINT16_MAX); ++ LZHAM_ASSERT(freq <= LZHAM_UINT16_MAX); + + if (--model.m_symbols_until_update == 0) + { +@@ -1265,8 +1265,8 @@ namespace lzham + { + uint32 t = pTables->m_lookup[m_bit_buf >> (cBitBufSize - pTables->m_table_bits)]; + +- LZHAM_ASSERT(t != UINT32_MAX); +- sym = t & UINT16_MAX; ++ LZHAM_ASSERT(t != LZHAM_UINT32_MAX); ++ sym = t & LZHAM_UINT16_MAX; + len = t >> 16; + + LZHAM_ASSERT(model.m_code_sizes[sym] == len); +@@ -1301,7 +1301,7 @@ namespace lzham + freq++; + model.m_sym_freq[sym] = static_cast(freq); + +- LZHAM_ASSERT(freq <= UINT16_MAX); ++ LZHAM_ASSERT(freq <= LZHAM_UINT16_MAX); + + if (--model.m_symbols_until_update == 0) + { +diff --git a/lzhamdecomp/lzham_symbol_codec.h b/lzhamdecomp/lzham_symbol_codec.h +index 306d59b..b231530 100644 +--- a/lzhamdecomp/lzham_symbol_codec.h ++++ b/lzhamdecomp/lzham_symbol_codec.h +@@ -19,7 +19,7 @@ namespace lzham + typedef uint64 bit_cost_t; + const uint32 cBitCostScaleShift = 24; + const uint32 cBitCostScale = (1U << cBitCostScaleShift); +- const bit_cost_t cBitCostMax = UINT64_MAX; ++ const bit_cost_t cBitCostMax = LZHAM_UINT64_MAX; + + inline bit_cost_t convert_to_scaled_bitcost(uint bits) { LZHAM_ASSERT(bits <= 255); uint32 scaled_bits = bits << cBitCostScaleShift; return static_cast(scaled_bits); } + +@@ -444,7 +444,7 @@ namespace lzham + if (LZHAM_BUILTIN_EXPECT(k <= pTables->m_table_max_code, 1)) \ + { \ + uint32 t = pTables->m_lookup[bit_buf >> (symbol_codec::cBitBufSize - pTables->m_table_bits)]; \ +- result = t & UINT16_MAX; \ ++ result = t & LZHAM_UINT16_MAX; \ + len = t >> 16; \ + } \ + else \ +@@ -465,7 +465,7 @@ namespace lzham + uint freq = pModel->m_sym_freq[result]; \ + freq++; \ + pModel->m_sym_freq[result] = static_cast(freq); \ +- LZHAM_ASSERT(freq <= UINT16_MAX); \ ++ LZHAM_ASSERT(freq <= LZHAM_UINT16_MAX); \ + if (LZHAM_BUILTIN_EXPECT(--pModel->m_symbols_until_update == 0, 0)) \ + { \ + pModel->update_tables(); \ +@@ -501,7 +501,7 @@ namespace lzham + if (LZHAM_BUILTIN_EXPECT(k <= pTables->m_table_max_code, 1)) \ + { \ + uint32 t = pTables->m_lookup[bit_buf >> (symbol_codec::cBitBufSize - pTables->m_table_bits)]; \ +- result = t & UINT16_MAX; \ ++ result = t & LZHAM_UINT16_MAX; \ + len = t >> 16; \ + } \ + else \ +@@ -522,7 +522,7 @@ namespace lzham + uint freq = pModel->m_sym_freq[result]; \ + freq++; \ + pModel->m_sym_freq[result] = static_cast(freq); \ +- LZHAM_ASSERT(freq <= UINT16_MAX); \ ++ LZHAM_ASSERT(freq <= LZHAM_UINT16_MAX); \ + if (LZHAM_BUILTIN_EXPECT(--pModel->m_symbols_until_update == 0, 0)) \ + { \ + pModel->update_tables(); \ diff --git a/recipes/lzham/all/test_package/CMakeLists.txt b/recipes/lzham/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..c4780ae45756c --- /dev/null +++ b/recipes/lzham/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +find_package(lzham REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PUBLIC lzham::lzham) diff --git a/recipes/lzham/all/test_package/conanfile.py b/recipes/lzham/all/test_package/conanfile.py new file mode 100644 index 0000000000000..eea09bfb32ab1 --- /dev/null +++ b/recipes/lzham/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +import os + +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/lzham/all/test_package/test_package.cpp b/recipes/lzham/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..c588215577f5f --- /dev/null +++ b/recipes/lzham/all/test_package/test_package.cpp @@ -0,0 +1,23 @@ +#include +#include + +#include + +int main() { + unsigned char in[] = "Hello Conan Center!"; + unsigned char out[sizeof(in)]; + + lzham_z_stream stream; + std::memset(&stream, 0, sizeof(stream)); + stream.next_in = in; + stream.avail_in = sizeof(in); + stream.next_out = out; + stream.avail_out = sizeof(out); + if (lzham_z_deflateInit(&stream, LZHAM_Z_BEST_COMPRESSION) != LZHAM_Z_OK) + return EXIT_FAILURE; + + if (lzham_z_deflate(&stream, LZHAM_Z_FULL_FLUSH) != LZHAM_Z_OK) + return EXIT_FAILURE; + + return EXIT_SUCCESS; +} diff --git a/recipes/lzham/all/test_v1_package/CMakeLists.txt b/recipes/lzham/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..231cec51e4ab9 --- /dev/null +++ b/recipes/lzham/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(lzham REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PUBLIC lzham::lzham) diff --git a/recipes/lzham/all/test_v1_package/conanfile.py b/recipes/lzham/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..0f735b51a2642 --- /dev/null +++ b/recipes/lzham/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/lzham/config.yml b/recipes/lzham/config.yml new file mode 100644 index 0000000000000..40341aa3db6cd --- /dev/null +++ b/recipes/lzham/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.0": + folder: all From 0af7d32b4ee239fbb02f5bdca9221491d85d6ee2 Mon Sep 17 00:00:00 2001 From: Bobbey Reese Date: Sat, 17 Dec 2022 12:28:27 -0500 Subject: [PATCH 2/3] Respond to comments --- recipes/lzham/all/conandata.yml | 30 +- recipes/lzham/all/conanfile.py | 72 +- ...patch => aarch64-yield-cci.20220103.patch} | 0 ... => cmake-min-req-swap-cci.20220103.patch} | 0 .../patches/cmake-rm-tests-cci.20220103.patch | 12 + recipes/lzham/all/patches/commits-1.0.0.patch | 1083 ----------------- ...1.0.0.patch => fix-osx-cci.20220103.patch} | 0 .../all/patches/msvc-conan-cci.20220103.patch | 83 ++ ...tch => use-lzham-types-cci.20220103.patch} | 0 recipes/lzham/config.yml | 2 +- 10 files changed, 118 insertions(+), 1164 deletions(-) rename recipes/lzham/all/patches/{aarch64-yield-1.0.0.patch => aarch64-yield-cci.20220103.patch} (100%) rename recipes/lzham/all/patches/{cmake-min-req-swap-1.0.0.patch => cmake-min-req-swap-cci.20220103.patch} (100%) create mode 100644 recipes/lzham/all/patches/cmake-rm-tests-cci.20220103.patch delete mode 100644 recipes/lzham/all/patches/commits-1.0.0.patch rename recipes/lzham/all/patches/{fix-osx-1.0.0.patch => fix-osx-cci.20220103.patch} (100%) create mode 100644 recipes/lzham/all/patches/msvc-conan-cci.20220103.patch rename recipes/lzham/all/patches/{use-lzham-types-1.0.0.patch => use-lzham-types-cci.20220103.patch} (100%) diff --git a/recipes/lzham/all/conandata.yml b/recipes/lzham/all/conandata.yml index 0cf799e6a204d..3e2193aef600a 100644 --- a/recipes/lzham/all/conandata.yml +++ b/recipes/lzham/all/conandata.yml @@ -1,29 +1,33 @@ sources: - "1.0.0": - sha256: "4f4f874706763b3a6e3d6dfff666a1e850ca1d92fd9240b2a14365c5864a0057" - url: "https://github.com/richgel999/lzham_codec/archive/refs/tags/v1_0_stable1.tar.gz" + "cci.20220103": + sha256: "3e3ccf7a57b1e6a90099784597aa7da30de3249a5f7fe532cefb3a77db5acbfb" + url: "https://github.com/richgel999/lzham_codec/archive/d379b1f9121e2197881c61cfc4713c78848bdfe7.zip" patches: - "1.0.0": - - patch_file: "patches/commits-1.0.0.patch" - patch_description: 'Updates code to latest commit for the repo - https://github.com/richgel999/lzham_codec' - patch_type: official - - - patch_file: "patches/aarch64-yield-1.0.0.patch" + "cci.20220103": + - patch_file: "patches/aarch64-yield-cci.20220103.patch" patch_description: 'Uses "yield" rather than "pause" mneumonic to fix aarch64 build' patch_type: portability - - patch_file: "patches/cmake-min-req-swap-1.0.0.patch" + - patch_file: "patches/cmake-min-req-swap-cci.20220103.patch" patch_description: 'Puts cmake_minimum_required before project in all CMakeLists' patch_type: portability - - patch_file: "patches/fix-osx-1.0.0.patch" + - patch_file: "patches/fix-osx-cci.20220103.patch" patch_description: "Fixes building on OSX" patch_type: portability - - patch_file: "patches/use-lzham-types-1.0.0.patch" + - patch_file: "patches/use-lzham-types-cci.20220103.patch" patch_description: 'Uses typedefs prefixed with LZHAM to fix linux build errors' patch_type: portability + + - patch_file: "patches/cmake-rm-tests-cci.20220103.patch" + patch_description: "Skips building of lzhamtest for CMake" + patch_type: conan + + - patch_file: "patches/msvc-conan-cci.20220103.patch" + patch_description: 'Skips building of lzhamtest and examples for MSVC, + and injects conan toolchain for MSVC' + patch_type: conan diff --git a/recipes/lzham/all/conanfile.py b/recipes/lzham/all/conanfile.py index 78ee1d7b8c89f..dc2b71a60c9f6 100644 --- a/recipes/lzham/all/conanfile.py +++ b/recipes/lzham/all/conanfile.py @@ -41,72 +41,6 @@ class PackageConan(ConanFile): "fPIC": True, } - def _patch_sources(self): - apply_conandata_patches(self) - - if not is_msvc(self): - # Remove lzhamtest from root CMakeLists.txt. - replace_in_file( - self, - os.path.join(self.source_folder, "CMakeLists.txt"), - "add_subdirectory(lzhamtest)\n", - "" - ) - - # This line in the root CMakeLists.txt can cause issues, see - # https://cmake.org/cmake/help/latest/policy/CMP0077.html. - replace_in_file( - self, - os.path.join(self.source_folder, "CMakeLists.txt"), - "option(BUILD_SHARED_LIBS \"build shared/static libs\" ON)", - "" - ) - return - new_sln = [] - # Remove example and test projects from sln. - with open(os.path.join( - self.source_folder, "lzham.sln" - ), encoding="utf-8") as f: - line = f.readline() - while line: - if ( - line.startswith("Project(") - and ("lzhamtest" in line or "example" in line) - ): - # Don't write the current line and skip the "EndProject" - # line. - f.readline() - else: - new_sln.append(line) - line = f.readline() - with open(os.path.join( - self.source_folder, "lzham.sln" - ), "w", encoding="utf-8") as f: - f.write("".join(new_sln)) - - # Inject conantoolchain.props so that correct platform toolset is used. - projects = [(x, f"{x}.vcxproj") for x in ( - "lzhamcomp", - "lzhamdecomp", - "lzhamlib", - )] - projects.append(("lzhamdll", "lzham.vcxproj")) - search_str = ( - ' ' - ) - - for p in projects: - replace_in_file( - self, - os.path.join(self.source_folder, *p), - search_str, - ' \n' - ' \n' - ' \n' - + search_str - ) - def export_sources(self): export_conandata_patches(self) @@ -142,10 +76,14 @@ def generate(self): tc.generate() else: tc = CMakeToolchain(self) + + # Honor BUILD_SHARED_LIBS from conan_toolchain (see + # https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() def build(self): - self._patch_sources() + apply_conandata_patches(self) if is_msvc(self): msbuild = MSBuild(self) msbuild.build_type = ( diff --git a/recipes/lzham/all/patches/aarch64-yield-1.0.0.patch b/recipes/lzham/all/patches/aarch64-yield-cci.20220103.patch similarity index 100% rename from recipes/lzham/all/patches/aarch64-yield-1.0.0.patch rename to recipes/lzham/all/patches/aarch64-yield-cci.20220103.patch diff --git a/recipes/lzham/all/patches/cmake-min-req-swap-1.0.0.patch b/recipes/lzham/all/patches/cmake-min-req-swap-cci.20220103.patch similarity index 100% rename from recipes/lzham/all/patches/cmake-min-req-swap-1.0.0.patch rename to recipes/lzham/all/patches/cmake-min-req-swap-cci.20220103.patch diff --git a/recipes/lzham/all/patches/cmake-rm-tests-cci.20220103.patch b/recipes/lzham/all/patches/cmake-rm-tests-cci.20220103.patch new file mode 100644 index 0000000000000..7b5cf8afef5f7 --- /dev/null +++ b/recipes/lzham/all/patches/cmake-rm-tests-cci.20220103.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 428cdfc..1857db2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,7 +6,6 @@ option(BUILD_SHARED_LIBS "build shared/static libs" ON) + add_subdirectory(lzhamdecomp) + add_subdirectory(lzhamcomp) + add_subdirectory(lzhamdll) +-add_subdirectory(lzhamtest) + + install(FILES include/lzham_dynamic_lib.h + include/lzham_exports.inc diff --git a/recipes/lzham/all/patches/commits-1.0.0.patch b/recipes/lzham/all/patches/commits-1.0.0.patch deleted file mode 100644 index eb6c0f74337bb..0000000000000 --- a/recipes/lzham/all/patches/commits-1.0.0.patch +++ /dev/null @@ -1,1083 +0,0 @@ -diff --git a/LICENSE b/LICENSE -index a084cf7..7122a74 100644 ---- a/LICENSE -+++ b/LICENSE -@@ -1,22 +1,56 @@ --The MIT License (MIT) -+THIS SOFTWARE IS IN THE PUBLIC DOMAIN - --Copyright (c) 2009-2015 Richard Geldreich, Jr. -+THIS IS FREE AND UNENCUMBERED SOFTWARE EXPLICITLY AND OVERTLY RELEASED AND -+CONTRIBUTED TO THE PUBLIC DOMAIN, PERMANENTLY, IRREVOCABLY AND UNCONDITIONALLY -+WAIVING ANY AND ALL CLAIM OF COPYRIGHT, IN PERPETUITY ON SEPTEMBER 15, 2020. - --Permission is hereby granted, free of charge, to any person obtaining a copy --of this software and associated documentation files (the "Software"), to deal --in the Software without restriction, including without limitation the rights --to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --copies of the Software, and to permit persons to whom the Software is --furnished to do so, subject to the following conditions: -+1. FALLBACK CLAUSES - --The above copyright notice and this permission notice shall be included in all --copies or substantial portions of the Software. -+THIS SOFTWARE MAY BE FREELY USED, DERIVED FROM, EXECUTED, LINKED WITH, MODIFIED -+AND DISTRIBUTED FOR ANY PURPOSE, COMMERCIAL OR NON-COMMERCIAL, BY ANYONE, FOR -+ANY REASON, WITH NO ATTRIBUTION, IN PERPETUITY. -+ -+THE AUTHOR OR AUTHORS OF THIS WORK HEREBY OVERTLY, FULLY, PERMANENTLY, -+IRREVOCABLY AND UNCONDITIONALLY FORFEITS AND WAIVES ALL CLAIM OF COPYRIGHT -+(ECONOMIC AND MORAL), ANY AND ALL RIGHTS OF INTEGRITY, AND ANY AND ALL RIGHTS OF -+ATTRIBUTION. ANYONE IS FREE TO COPY, MODIFY, ENHANCE, OPTIMIZE, PUBLISH, USE, -+COMPILE, DECOMPILE, ASSEMBLE, DISASSEMBLE, DOWNLOAD, UPLOAD, TRANSMIT, RECEIVE, -+SELL, FORK, DERIVE FROM, LINK, LINK TO, CALL, REFERENCE, WRAP, THUNK, ENCODE, -+ENCRYPT, TRANSFORM, STORE, RETRIEVE, DISTORT, DESTROY, RENAME, DELETE, -+BROADCAST, OR DISTRIBUTE THIS SOFTWARE, EITHER IN SOURCE CODE FORM, IN A -+TRANSLATED FORM, AS A LIBRARY, AS TEXT, IN PRINT, OR AS A COMPILED BINARY OR -+EXECUTABLE PROGRAM, OR IN DIGITAL FORM, OR IN ANALOG FORM, OR IN PHYSICAL FORM, -+OR IN ANY OTHER REPRESENTATION, FOR ANY PURPOSE, COMMERCIAL OR NON-COMMERCIAL, -+AND BY ANY MEANS, WITH NO ATTRIBUTION, IN PERPETUITY. -+ -+2. ANTI-COPYRIGHT WAIVER AND STATEMENT OF INTENT -+ -+IN JURISDICTIONS THAT RECOGNIZE COPYRIGHT LAWS, THE AUTHOR OR AUTHORS OF THIS -+SOFTWARE OVERTLY, FULLY, PERMANENTLY, IRREVOCABLY AND UNCONDITIONALLY DEDICATE, -+FORFEIT, AND WAIVE ANY AND ALL COPYRIGHT INTEREST IN THE SOFTWARE TO THE PUBLIC -+DOMAIN. WE MAKE THIS DEDICATION AND WAIVER FOR THE BENEFIT OF THE PUBLIC AT -+LARGE AND TO THE DETRIMENT OF OUR HEIRS AND SUCCESSORS. WE INTEND THIS -+DEDICATION AND WAIVER TO BE AN OVERT ACT OF RELINQUISHMENT IN PERPETUITY OF ALL -+PRESENT AND FUTURE RIGHTS TO THIS SOFTWARE UNDER COPYRIGHT LAW. WE INTEND THIS -+SOFTWARE TO BE FREELY USED, COMPILED, EXECUTED, MODIFIED, PUBLISHED, DERIVED -+FROM, OR DISTRIBUTED BY ANYONE, FOR ANY COMMERCIAL OR NON-COMMERCIAL USE, WITH -+NO ATTRIBUTION, IN PERPETUITY. -+ -+3. NO WARRANTY CLAUSE - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE --SOFTWARE. -+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR OR -+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -+WITH THE SOFTWARE, OR DERIVING FROM THE SOFTWARE, OR LINKING WITH THE SOFTWARE, -+OR CALLING THE SOFTWARE, OR EXECUTING THE SOFTWARE, OR THE USE OR OTHER DEALINGS -+IN THE SOFTWARE. -+ -+4. FINAL ANTI-COPYRIGHT AND INTENT FALLBACK CLAUSE - -+SHOULD ANY PART OF THIS PUBLIC DOMAIN DECLARATION, OR THE FALLBACK CLAUSES, OR -+THE ANTI-COPYRIGHT WAIVER FOR ANY REASON BE JUDGED LEGALLY INVALID OR -+INEFFECTIVE UNDER APPLICABLE LAW, THEN THE PUBLIC DOMAIN DECLARATION, THE -+FALLBACK CLAUSES, AND ANTI-COPYRIGHT WAIVER SHALL BE PRESERVED TO THE MAXIMUM -+EXTENT PERMITTED BY LAW TAKING INTO ACCOUNT THE ABOVE STATEMENT OF INTENT. -diff --git a/README.md b/README.md -index 50a8d84..e465ef2 100644 ---- a/README.md -+++ b/README.md -@@ -1,12 +1,14 @@ - LZHAM - Lossless Data Compression Codec - ============= - --

Copyright (c) 2009-2015 Richard Geldreich, Jr. - richgel99@gmail.com - MIT License

-+Public Domain (see LICENSE) - -

LZHAM is a lossless data compression codec written in C/C++ (specifically C++03), with a compression ratio similar to LZMA but with 1.5x-8x faster decompression speed. It officially supports Linux x86/x64, Windows x86/x64, - OSX, and iOS, with Android support on the way.

- --

Some slightly out of date API documentation is here (I'll be migrating this to github): https://code.google.com/p/lzham/wiki/API_Docs

-+An improved version of LZHAM, with better compression, is [here](https://github.com/richgel999/lzham_codec_devel). -+ -+

The old alpha version of LZHAM (bitstream incompatible with the v1.x release) is here: https://github.com/richgel999/lzham_alpha

- -

Introduction

- -diff --git a/example4/cfile_stream.cpp b/example4/cfile_stream.cpp -index b42a8bd..1b84e87 100644 ---- a/example4/cfile_stream.cpp -+++ b/example4/cfile_stream.cpp -@@ -1,5 +1,5 @@ - // File: cfile_stream.cpp --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #include "cfile_stream.h" - - namespace lzham_ex -diff --git a/example4/cfile_stream.h b/example4/cfile_stream.h -index 4e206a1..c1eb7e0 100644 ---- a/example4/cfile_stream.h -+++ b/example4/cfile_stream.h -@@ -1,5 +1,5 @@ - // File: cfile_stream.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - #include "data_stream.h" - #include -diff --git a/example4/comp_stream.cpp b/example4/comp_stream.cpp -index 42ce24a..77427c3 100644 ---- a/example4/comp_stream.cpp -+++ b/example4/comp_stream.cpp -@@ -1,5 +1,5 @@ - // File: comp_stream.cpp --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #include "comp_stream.h" - - namespace lzham_ex -@@ -95,8 +95,8 @@ namespace lzham_ex - if (!out_buf_size) - return true; - -- assert(out_buf_size <= UINT16_MAX); -- assert(cBufSize <= UINT16_MAX); -+ assert(out_buf_size <= LZHAM_UINT16_MAX); -+ assert(cBufSize <= LZHAM_UINT16_MAX); - - if (!m_pOutput_stream->is_seekable()) - { -@@ -385,7 +385,7 @@ namespace lzham_ex - } - } - -- m_buf.resize(UINT16_MAX); -+ m_buf.resize(LZHAM_UINT16_MAX); - - m_opened = true; - -diff --git a/example4/comp_stream.h b/example4/comp_stream.h -index fa9224f..5412beb 100644 ---- a/example4/comp_stream.h -+++ b/example4/comp_stream.h -@@ -1,5 +1,5 @@ - // File: comp_stream.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #include "data_stream.h" - - #include "lzham.h" -diff --git a/example4/data_stream.cpp b/example4/data_stream.cpp -index 9d35945..b0e58f9 100644 ---- a/example4/data_stream.cpp -+++ b/example4/data_stream.cpp -@@ -1,5 +1,5 @@ - // File: data_stream.cpp --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #include "data_stream.h" - #include - -diff --git a/example4/data_stream.h b/example4/data_stream.h -index b013b7e..89d2922 100644 ---- a/example4/data_stream.h -+++ b/example4/data_stream.h -@@ -1,5 +1,5 @@ - // File: data_stream.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - #include "stream_common.h" - -@@ -12,8 +12,8 @@ namespace lzham_ex - cDataStreamSeekable = 4 - }; - -- const int64 DATA_STREAM_SIZE_UNKNOWN = INT64_MAX; -- const int64 DATA_STREAM_SIZE_INFINITE = UINT64_MAX; -+ const int64 DATA_STREAM_SIZE_UNKNOWN = LZHAM_INT64_MAX; -+ const int64 DATA_STREAM_SIZE_INFINITE = LZHAM_UINT64_MAX; - - class data_stream - { -diff --git a/example4/data_stream_serializer.h b/example4/data_stream_serializer.h -index 9408681..7be64db 100644 ---- a/example4/data_stream_serializer.h -+++ b/example4/data_stream_serializer.h -@@ -1,5 +1,5 @@ - // File: data_stream_serializer.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - #include "data_stream.h" - -diff --git a/example4/dynamic_stream.cpp b/example4/dynamic_stream.cpp -index 0f15170..0bd1286 100644 ---- a/example4/dynamic_stream.cpp -+++ b/example4/dynamic_stream.cpp -@@ -1,5 +1,5 @@ - // File: dynamic_stream.cpp --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #include "dynamic_stream.h" - - namespace lzham_ex -diff --git a/example4/dynamic_stream.h b/example4/dynamic_stream.h -index 66c07c3..6160dfe 100644 ---- a/example4/dynamic_stream.h -+++ b/example4/dynamic_stream.h -@@ -1,5 +1,5 @@ - // File: dynamic_stream.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - #include "data_stream.h" - -diff --git a/example4/mem_stream.cpp b/example4/mem_stream.cpp -index 4e300b3..2ddb16d 100644 ---- a/example4/mem_stream.cpp -+++ b/example4/mem_stream.cpp -@@ -1,5 +1,5 @@ - // File: mem_stream.cpp --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #include "mem_stream.h" - - namespace lzham_ex -diff --git a/example4/mem_stream.h b/example4/mem_stream.h -index d67ffe3..d8c67bc 100644 ---- a/example4/mem_stream.h -+++ b/example4/mem_stream.h -@@ -1,5 +1,5 @@ - // File: mem_stream.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - #include "data_stream.h" - -diff --git a/example4/stream_common.h b/example4/stream_common.h -index 54f4a3a..a5b0f2c 100644 ---- a/example4/stream_common.h -+++ b/example4/stream_common.h -@@ -1,5 +1,5 @@ - // File: stream_common.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - - #include -@@ -32,12 +32,12 @@ namespace lzham_ex - typedef signed __int64 int64; - typedef unsigned __int64 uint64; - -- const uint16 UINT16_MIN = 0; -- const uint16 UINT16_MAX = 0xFFFFU; -- const uint64 UINT64_MIN = 0; -- const uint64 UINT64_MAX = 0xFFFFFFFFFFFFFFFFULL; //0xFFFFFFFFFFFFFFFFui64; -- const int64 INT64_MIN = (int64)0x8000000000000000ULL; //(-9223372036854775807i64 - 1); -- const int64 INT64_MAX = (int64)0x7FFFFFFFFFFFFFFFULL; //9223372036854775807i64; -+ const uint16 LZHAM_UINT16_MIN = 0; -+ const uint16 LZHAM_UINT16_MAX = 0xFFFFU; -+ const uint64 LZHAM_UINT64_MIN = 0; -+ const uint64 LZHAM_UINT64_MAX = 0xFFFFFFFFFFFFFFFFULL; //0xFFFFFFFFFFFFFFFFui64; -+ const int64 LZHAM_INT64_MIN = (int64)0x8000000000000000ULL; //(-9223372036854775807i64 - 1); -+ const int64 LZHAM_INT64_MAX = (int64)0x7FFFFFFFFFFFFFFFULL; //9223372036854775807i64; - - template inline void zero_object(T& obj) { memset(&obj, 0, sizeof(obj)); } - } // namespace lzham_ex -diff --git a/include/lzham.h b/include/lzham.h -index 2c2cf15..2030fc9 100644 ---- a/include/lzham.h -+++ b/include/lzham.h -@@ -1,5 +1,5 @@ - // File: lzham.h - Copyright (c) 2009-2012 Richard Geldreich, Jr. --// LZHAM uses the MIT License. See Copyright Notice and license at the end of this file. -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of this file. - // - // This is the main header file, includable from C or C++ files, which defines all the publically available API's, structs, and types used by the LZHAM codec. - // -@@ -757,25 +757,61 @@ public: - - #endif // #ifndef __LZHAM_H__ - --// Copyright (c) 2009-2012 Richard Geldreich, Jr. --// --// LZHAM uses the MIT License: --// --// Permission is hereby granted, free of charge, to any person obtaining a copy --// of this software and associated documentation files (the "Software"), to deal --// in the Software without restriction, including without limitation the rights --// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --// copies of the Software, and to permit persons to whom the Software is --// furnished to do so, subject to the following conditions: --// --// The above copyright notice and this permission notice shall be included in --// all copies or substantial portions of the Software. --// --// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN --// THE SOFTWARE. -- -+/* -+ THIS SOFTWARE IS IN THE PUBLIC DOMAIN -+ -+ THIS IS FREE AND UNENCUMBERED SOFTWARE EXPLICITLY AND OVERTLY RELEASED AND -+ CONTRIBUTED TO THE PUBLIC DOMAIN, PERMANENTLY, IRREVOCABLY AND UNCONDITIONALLY -+ WAIVING ANY AND ALL CLAIM OF COPYRIGHT, IN PERPETUITY ON SEPTEMBER 15, 2020. -+ -+ 1. FALLBACK CLAUSES -+ -+ THIS SOFTWARE MAY BE FREELY USED, DERIVED FROM, EXECUTED, LINKED WITH, MODIFIED -+ AND DISTRIBUTED FOR ANY PURPOSE, COMMERCIAL OR NON-COMMERCIAL, BY ANYONE, FOR -+ ANY REASON, WITH NO ATTRIBUTION, IN PERPETUITY. -+ -+ THE AUTHOR OR AUTHORS OF THIS WORK HEREBY OVERTLY, FULLY, PERMANENTLY, -+ IRREVOCABLY AND UNCONDITIONALLY FORFEITS AND WAIVES ALL CLAIM OF COPYRIGHT -+ (ECONOMIC AND MORAL), ANY AND ALL RIGHTS OF INTEGRITY, AND ANY AND ALL RIGHTS OF -+ ATTRIBUTION. ANYONE IS FREE TO COPY, MODIFY, ENHANCE, OPTIMIZE, PUBLISH, USE, -+ COMPILE, DECOMPILE, ASSEMBLE, DISASSEMBLE, DOWNLOAD, UPLOAD, TRANSMIT, RECEIVE, -+ SELL, FORK, DERIVE FROM, LINK, LINK TO, CALL, REFERENCE, WRAP, THUNK, ENCODE, -+ ENCRYPT, TRANSFORM, STORE, RETRIEVE, DISTORT, DESTROY, RENAME, DELETE, -+ BROADCAST, OR DISTRIBUTE THIS SOFTWARE, EITHER IN SOURCE CODE FORM, IN A -+ TRANSLATED FORM, AS A LIBRARY, AS TEXT, IN PRINT, OR AS A COMPILED BINARY OR -+ EXECUTABLE PROGRAM, OR IN DIGITAL FORM, OR IN ANALOG FORM, OR IN PHYSICAL FORM, -+ OR IN ANY OTHER REPRESENTATION, FOR ANY PURPOSE, COMMERCIAL OR NON-COMMERCIAL, -+ AND BY ANY MEANS, WITH NO ATTRIBUTION, IN PERPETUITY. -+ -+ 2. ANTI-COPYRIGHT WAIVER AND STATEMENT OF INTENT -+ -+ IN JURISDICTIONS THAT RECOGNIZE COPYRIGHT LAWS, THE AUTHOR OR AUTHORS OF THIS -+ SOFTWARE OVERTLY, FULLY, PERMANENTLY, IRREVOCABLY AND UNCONDITIONALLY DEDICATE, -+ FORFEIT, AND WAIVE ANY AND ALL COPYRIGHT INTEREST IN THE SOFTWARE TO THE PUBLIC -+ DOMAIN. WE MAKE THIS DEDICATION AND WAIVER FOR THE BENEFIT OF THE PUBLIC AT -+ LARGE AND TO THE DETRIMENT OF OUR HEIRS AND SUCCESSORS. WE INTEND THIS -+ DEDICATION AND WAIVER TO BE AN OVERT ACT OF RELINQUISHMENT IN PERPETUITY OF ALL -+ PRESENT AND FUTURE RIGHTS TO THIS SOFTWARE UNDER COPYRIGHT LAW. WE INTEND THIS -+ SOFTWARE TO BE FREELY USED, COMPILED, EXECUTED, MODIFIED, PUBLISHED, DERIVED -+ FROM, OR DISTRIBUTED BY ANYONE, FOR ANY COMMERCIAL OR NON-COMMERCIAL USE, WITH -+ NO ATTRIBUTION, IN PERPETUITY. -+ -+ 3. NO WARRANTY CLAUSE -+ -+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR OR -+ AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -+ WITH THE SOFTWARE, OR DERIVING FROM THE SOFTWARE, OR LINKING WITH THE SOFTWARE, -+ OR CALLING THE SOFTWARE, OR EXECUTING THE SOFTWARE, OR THE USE OR OTHER DEALINGS -+ IN THE SOFTWARE. -+ -+ 4. FINAL ANTI-COPYRIGHT AND INTENT FALLBACK CLAUSE -+ -+ SHOULD ANY PART OF THIS PUBLIC DOMAIN DECLARATION, OR THE FALLBACK CLAUSES, OR -+ THE ANTI-COPYRIGHT WAIVER FOR ANY REASON BE JUDGED LEGALLY INVALID OR -+ INEFFECTIVE UNDER APPLICABLE LAW, THEN THE PUBLIC DOMAIN DECLARATION, THE -+ FALLBACK CLAUSES, AND ANTI-COPYRIGHT WAIVER SHALL BE PRESERVED TO THE MAXIMUM -+ EXTENT PERMITTED BY LAW TAKING INTO ACCOUNT THE ABOVE STATEMENT OF INTENT. -+*/ -diff --git a/lzhamcomp/lzham_comp.h b/lzhamcomp/lzham_comp.h -index 88652d9..50af743 100644 ---- a/lzhamcomp/lzham_comp.h -+++ b/lzhamcomp/lzham_comp.h -@@ -1,5 +1,5 @@ - // File: lzham_comp.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - #include "lzham.h" - -diff --git a/lzhamcomp/lzham_lzbase.cpp b/lzhamcomp/lzham_lzbase.cpp -index a43a318..afeeb7e 100644 ---- a/lzhamcomp/lzham_lzbase.cpp -+++ b/lzhamcomp/lzham_lzbase.cpp -@@ -1,5 +1,5 @@ - // File: lzham_lzbase.cpp --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #include "lzham_core.h" - #include "lzham_lzbase.h" - -diff --git a/lzhamcomp/lzham_lzbase.h b/lzhamcomp/lzham_lzbase.h -index 073175d..73ac9ee 100644 ---- a/lzhamcomp/lzham_lzbase.h -+++ b/lzhamcomp/lzham_lzbase.h -@@ -1,5 +1,5 @@ - // File: lzham_lzbase.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - - #include "lzham_lzdecompbase.h" -diff --git a/lzhamcomp/lzham_lzcomp.cpp b/lzhamcomp/lzham_lzcomp.cpp -index 5081134..32170c5 100644 ---- a/lzhamcomp/lzham_lzcomp.cpp -+++ b/lzhamcomp/lzham_lzcomp.cpp -@@ -1,5 +1,5 @@ - // File: lzham_lzcomp.cpp --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #include "lzham_core.h" - #include "lzham.h" - #include "lzham_comp.h" -@@ -315,7 +315,7 @@ namespace lzham - - if (sizeof(size_t) > sizeof(uint32)) - { -- if (src_len > UINT32_MAX) -+ if (src_len > LZHAM_UINT32_MAX) - return LZHAM_COMP_STATUS_INVALID_PARAMETER; - } - -diff --git a/lzhamcomp/lzham_lzcomp_internal.cpp b/lzhamcomp/lzham_lzcomp_internal.cpp -index 27df701..5f44c5b 100644 ---- a/lzhamcomp/lzham_lzcomp_internal.cpp -+++ b/lzhamcomp/lzham_lzcomp_internal.cpp -@@ -1,5 +1,5 @@ - // File: lzham_lzcomp_internal.cpp --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #include "lzham_core.h" - #include "lzham_lzcomp_internal.h" - #include "lzham_checksum.h" -diff --git a/lzhamcomp/lzham_lzcomp_internal.h b/lzhamcomp/lzham_lzcomp_internal.h -index 8036b26..01b3ba3 100644 ---- a/lzhamcomp/lzham_lzcomp_internal.h -+++ b/lzhamcomp/lzham_lzcomp_internal.h -@@ -1,5 +1,5 @@ - // File: lzham_lzcomp_internal.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - #include "lzham_match_accel.h" - #include "lzham_symbol_codec.h" -diff --git a/lzhamcomp/lzham_lzcomp_state.cpp b/lzhamcomp/lzham_lzcomp_state.cpp -index e989b62..39013e6 100644 ---- a/lzhamcomp/lzham_lzcomp_state.cpp -+++ b/lzhamcomp/lzham_lzcomp_state.cpp -@@ -1,5 +1,5 @@ - // File: lzham_lzcomp_state.cpp --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #include "lzham_core.h" - #include "lzham_lzcomp_internal.h" - -diff --git a/lzhamcomp/lzham_match_accel.cpp b/lzhamcomp/lzham_match_accel.cpp -index 8554653..da5ed33 100644 ---- a/lzhamcomp/lzham_match_accel.cpp -+++ b/lzhamcomp/lzham_match_accel.cpp -@@ -1,5 +1,5 @@ - // File: lzham_match_accel.cpp --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #include "lzham_core.h" - #include "lzham_match_accel.h" - #include "lzham_timer.h" -@@ -153,7 +153,7 @@ namespace lzham - c0 = c1; - c1 = c2; - -- LZHAM_ASSERT(!m_hash_thread_index.size() || (m_hash_thread_index[h] != UINT8_MAX)); -+ LZHAM_ASSERT(!m_hash_thread_index.size() || (m_hash_thread_index[h] != LZHAM_UINT8_MAX)); - - // Only process those strings that this worker thread was assigned to - this allows us to manipulate multiple trees in parallel with no worries about synchronization. - if (m_hash_thread_index.size() && (m_hash_thread_index[h] != thread_index)) -@@ -449,7 +449,7 @@ namespace lzham - - pDict++; - -- if (m_hash_thread_index[t] == UINT8_MAX) -+ if (m_hash_thread_index[t] == LZHAM_UINT8_MAX) - { - num_unique_trigrams++; - -diff --git a/lzhamcomp/lzham_match_accel.h b/lzhamcomp/lzham_match_accel.h -index 384ea7d..bb54dea 100644 ---- a/lzhamcomp/lzham_match_accel.h -+++ b/lzhamcomp/lzham_match_accel.h -@@ -1,5 +1,5 @@ - // File: lzham_match_accel.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - #include "lzham_lzbase.h" - #include "lzham_threading.h" -diff --git a/lzhamcomp/lzham_null_threading.h b/lzhamcomp/lzham_null_threading.h -index a7f7467..1239d26 100644 ---- a/lzhamcomp/lzham_null_threading.h -+++ b/lzhamcomp/lzham_null_threading.h -@@ -1,5 +1,5 @@ - // File: lzham_task_pool_null.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - - namespace lzham -@@ -23,7 +23,7 @@ namespace lzham - (void)releaseCount, (void)pPreviousCount; - } - -- inline bool wait(uint32 milliseconds = UINT32_MAX) -+ inline bool wait(uint32 milliseconds = LZHAM_UINT32_MAX) - { - (void)milliseconds; - return true; -diff --git a/lzhamcomp/lzham_pthreads_threading.cpp b/lzhamcomp/lzham_pthreads_threading.cpp -index bb2c565..da5c3f5 100644 ---- a/lzhamcomp/lzham_pthreads_threading.cpp -+++ b/lzhamcomp/lzham_pthreads_threading.cpp -@@ -1,24 +1,7 @@ - // File: lzham_task_pool_pthreads.cpp - // --// Copyright (c) 2009-2010 Richard Geldreich, Jr. --// --// Permission is hereby granted, free of charge, to any person obtaining a copy --// of this software and associated documentation files (the "Software"), to deal --// in the Software without restriction, including without limitation the rights --// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --// copies of the Software, and to permit persons to whom the Software is --// furnished to do so, subject to the following conditions: --// --// The above copyright notice and this permission notice shall be included in --// all copies or substantial portions of the Software. --// --// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN --// THE SOFTWARE. -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h -+ - #include "lzham_core.h" - #include "lzham_pthreads_threading.h" - #include "lzham_timer.h" -diff --git a/lzhamcomp/lzham_pthreads_threading.h b/lzhamcomp/lzham_pthreads_threading.h -index 671387e..a76dfd8 100644 ---- a/lzhamcomp/lzham_pthreads_threading.h -+++ b/lzhamcomp/lzham_pthreads_threading.h -@@ -1,5 +1,5 @@ - // File: lzham_task_pool_pthreads.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - - #if LZHAM_USE_PTHREADS_API -@@ -160,10 +160,10 @@ namespace lzham - } - } - -- inline bool wait(uint32 milliseconds = UINT32_MAX) -+ inline bool wait(uint32 milliseconds = LZHAM_UINT32_MAX) - { - int status; -- if (milliseconds == UINT32_MAX) -+ if (milliseconds == LZHAM_UINT32_MAX) - { - status = sem_wait(&m_sem); - } -diff --git a/lzhamcomp/lzham_threading.h b/lzhamcomp/lzham_threading.h -index b8a1dbe..2b0e8d7 100644 ---- a/lzhamcomp/lzham_threading.h -+++ b/lzhamcomp/lzham_threading.h -@@ -1,5 +1,5 @@ - // File: lzham_threading.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - - #if LZHAM_USE_WIN32_API - #include "lzham_win32_threading.h" -diff --git a/lzhamcomp/lzham_win32_threading.cpp b/lzhamcomp/lzham_win32_threading.cpp -index 63a7e51..3580282 100644 ---- a/lzhamcomp/lzham_win32_threading.cpp -+++ b/lzhamcomp/lzham_win32_threading.cpp -@@ -1,5 +1,5 @@ - // File: lzham_task_pool_win32.cpp --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #include "lzham_core.h" - #include "lzham_win32_threading.h" - #include "lzham_timer.h" -diff --git a/lzhamcomp/lzham_win32_threading.h b/lzhamcomp/lzham_win32_threading.h -index 64125ac..0e1d16b 100644 ---- a/lzhamcomp/lzham_win32_threading.h -+++ b/lzhamcomp/lzham_win32_threading.h -@@ -1,5 +1,5 @@ - // File: lzham_task_pool_win32.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - - #if LZHAM_USE_WIN32_API -diff --git a/lzhamdecomp/lzham_assert.cpp b/lzhamdecomp/lzham_assert.cpp -index 7d27ed6..d4088be 100644 ---- a/lzhamdecomp/lzham_assert.cpp -+++ b/lzhamdecomp/lzham_assert.cpp -@@ -1,5 +1,5 @@ - // File: lzham_assert.cpp --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #include "lzham_core.h" - - static bool g_fail_exceptions; -diff --git a/lzhamdecomp/lzham_assert.h b/lzhamdecomp/lzham_assert.h -index d8a6851..d49949f 100644 ---- a/lzhamdecomp/lzham_assert.h -+++ b/lzhamdecomp/lzham_assert.h -@@ -1,5 +1,5 @@ - // File: lzham_assert.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - - const unsigned int LZHAM_FAIL_EXCEPTION_CODE = 256U; -diff --git a/lzhamdecomp/lzham_checksum.h b/lzhamdecomp/lzham_checksum.h -index 515f338..3369806 100644 ---- a/lzhamdecomp/lzham_checksum.h -+++ b/lzhamdecomp/lzham_checksum.h -@@ -1,5 +1,5 @@ - // File: lzham_checksum.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - - namespace lzham -diff --git a/lzhamdecomp/lzham_config.h b/lzhamdecomp/lzham_config.h -index 3681d8e..1d8c768 100644 ---- a/lzhamdecomp/lzham_config.h -+++ b/lzhamdecomp/lzham_config.h -@@ -1,5 +1,5 @@ - // File: lzham_config.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - - #if defined(_DEBUG) || defined(DEBUG) -@@ -20,4 +20,4 @@ - #endif - #endif - #define LZHAM_BUFFERED_PRINTF 0 --#define LZHAM_PERF_SECTIONS 0 -\ No newline at end of file -+#define LZHAM_PERF_SECTIONS 0 -diff --git a/lzhamdecomp/lzham_core.h b/lzhamdecomp/lzham_core.h -index f4e2d4f..2e55362 100644 ---- a/lzhamdecomp/lzham_core.h -+++ b/lzhamdecomp/lzham_core.h -@@ -1,5 +1,5 @@ - // File: lzham_core.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - - #if defined(_MSC_VER) -diff --git a/lzhamdecomp/lzham_decomp.h b/lzhamdecomp/lzham_decomp.h -index 32b2f9a..8bb7691 100644 ---- a/lzhamdecomp/lzham_decomp.h -+++ b/lzhamdecomp/lzham_decomp.h -@@ -1,5 +1,5 @@ - // File: lzham_decomp.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - #include "lzham.h" - -diff --git a/lzhamdecomp/lzham_helpers.h b/lzhamdecomp/lzham_helpers.h -index 11e0a11..7b8bb15 100644 ---- a/lzhamdecomp/lzham_helpers.h -+++ b/lzhamdecomp/lzham_helpers.h -@@ -1,5 +1,5 @@ - // File: lzham_helpers.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - - #define LZHAM_NO_COPY_OR_ASSIGNMENT_OP(c) c(const c&); c& operator= (const c&); -diff --git a/lzhamdecomp/lzham_huffman_codes.cpp b/lzhamdecomp/lzham_huffman_codes.cpp -index 10bc494..11bdbd4 100644 ---- a/lzhamdecomp/lzham_huffman_codes.cpp -+++ b/lzhamdecomp/lzham_huffman_codes.cpp -@@ -1,5 +1,5 @@ - // File: huffman_codes.cpp --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #include "lzham_core.h" - #include "lzham_huffman_codes.h" - -diff --git a/lzhamdecomp/lzham_huffman_codes.h b/lzhamdecomp/lzham_huffman_codes.h -index caab1a6..09bfc04 100644 ---- a/lzhamdecomp/lzham_huffman_codes.h -+++ b/lzhamdecomp/lzham_huffman_codes.h -@@ -1,5 +1,5 @@ - // File: lzham_huffman_codes.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - - namespace lzham -diff --git a/lzhamdecomp/lzham_lzdecomp.cpp b/lzhamdecomp/lzham_lzdecomp.cpp -index f6183f4..6f4f371 100644 ---- a/lzhamdecomp/lzham_lzdecomp.cpp -+++ b/lzhamdecomp/lzham_lzdecomp.cpp -@@ -1,5 +1,5 @@ - // File: lzham_lzdecomp.cpp --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - // - // See "Coroutines in C": - // http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html -diff --git a/lzhamdecomp/lzham_lzdecompbase.cpp b/lzhamdecomp/lzham_lzdecompbase.cpp -index 42bc9e4..cb56cc6 100644 ---- a/lzhamdecomp/lzham_lzdecompbase.cpp -+++ b/lzhamdecomp/lzham_lzdecompbase.cpp -@@ -1,5 +1,5 @@ - // File: lzham_lzdecompbase.cpp --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #include "lzham_core.h" - #include "lzham_lzdecompbase.h" - -diff --git a/lzhamdecomp/lzham_lzdecompbase.h b/lzhamdecomp/lzham_lzdecompbase.h -index 40d941a..f92cfa8 100644 ---- a/lzhamdecomp/lzham_lzdecompbase.h -+++ b/lzhamdecomp/lzham_lzdecompbase.h -@@ -1,5 +1,5 @@ - // File: lzham_lzdecompbase.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - - //#define LZHAM_LZDEBUG -diff --git a/lzhamdecomp/lzham_math.h b/lzhamdecomp/lzham_math.h -index 6c8fbfc..1ff0d51 100644 ---- a/lzhamdecomp/lzham_math.h -+++ b/lzhamdecomp/lzham_math.h -@@ -1,5 +1,5 @@ - // File: lzham_math.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - - #if defined(LZHAM_USE_MSVC_INTRINSICS) && !defined(__MINGW32__) -diff --git a/lzhamdecomp/lzham_mem.cpp b/lzhamdecomp/lzham_mem.cpp -index 02f2324..e8163fa 100644 ---- a/lzhamdecomp/lzham_mem.cpp -+++ b/lzhamdecomp/lzham_mem.cpp -@@ -1,5 +1,5 @@ - // File: lzham_mem.cpp --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #include "lzham_core.h" - - #ifdef __APPLE__ -diff --git a/lzhamdecomp/lzham_mem.h b/lzhamdecomp/lzham_mem.h -index d258eff..9eeb8af 100644 ---- a/lzhamdecomp/lzham_mem.h -+++ b/lzhamdecomp/lzham_mem.h -@@ -1,5 +1,5 @@ - // File: lzham_mem.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - - namespace lzham -diff --git a/lzhamdecomp/lzham_platform.cpp b/lzhamdecomp/lzham_platform.cpp -index cd4f9dd..cfc85c1 100644 ---- a/lzhamdecomp/lzham_platform.cpp -+++ b/lzhamdecomp/lzham_platform.cpp -@@ -1,5 +1,5 @@ - // File: platform.cpp --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #include "lzham_core.h" - #include "lzham_timer.h" - #include -diff --git a/lzhamdecomp/lzham_platform.h b/lzhamdecomp/lzham_platform.h -index 0cc58be..01704be 100644 ---- a/lzhamdecomp/lzham_platform.h -+++ b/lzhamdecomp/lzham_platform.h -@@ -1,5 +1,5 @@ - // File: lzham_platform.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - - bool lzham_is_debugger_present(void); -diff --git a/lzhamdecomp/lzham_prefix_coding.cpp b/lzhamdecomp/lzham_prefix_coding.cpp -index 8286697..e9ada15 100644 ---- a/lzhamdecomp/lzham_prefix_coding.cpp -+++ b/lzhamdecomp/lzham_prefix_coding.cpp -@@ -1,5 +1,5 @@ - // File: lzham_prefix_coding.cpp --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #include "lzham_core.h" - #include "lzham_prefix_coding.h" - -diff --git a/lzhamdecomp/lzham_prefix_coding.h b/lzhamdecomp/lzham_prefix_coding.h -index 4e13569..cc538f0 100644 ---- a/lzhamdecomp/lzham_prefix_coding.h -+++ b/lzhamdecomp/lzham_prefix_coding.h -@@ -1,5 +1,5 @@ - // File: lzham_prefix_coding.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - - namespace lzham -diff --git a/lzhamdecomp/lzham_symbol_codec.cpp b/lzhamdecomp/lzham_symbol_codec.cpp -index 72c370b..5623584 100644 ---- a/lzhamdecomp/lzham_symbol_codec.cpp -+++ b/lzhamdecomp/lzham_symbol_codec.cpp -@@ -1,5 +1,5 @@ - // File: lzham_symbol_codec.cpp --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #include "lzham_core.h" - #include "lzham_symbol_codec.h" - #include "lzham_huffman_codes.h" -diff --git a/lzhamdecomp/lzham_symbol_codec.h b/lzhamdecomp/lzham_symbol_codec.h -index e6aa33a..306d59b 100644 ---- a/lzhamdecomp/lzham_symbol_codec.h -+++ b/lzhamdecomp/lzham_symbol_codec.h -@@ -1,5 +1,5 @@ - // File: lzham_symbol_codec.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - #include "lzham_prefix_coding.h" - -diff --git a/lzhamdecomp/lzham_timer.cpp b/lzhamdecomp/lzham_timer.cpp -index 4079353..10910e1 100644 ---- a/lzhamdecomp/lzham_timer.cpp -+++ b/lzhamdecomp/lzham_timer.cpp -@@ -1,5 +1,5 @@ - // File: lzham_timer.cpp --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #include "lzham_core.h" - #include "lzham_timer.h" - -@@ -144,4 +144,4 @@ namespace lzham - return ticks * g_inv_freq; - } - --} // namespace lzham -\ No newline at end of file -+} // namespace lzham -diff --git a/lzhamdecomp/lzham_timer.h b/lzhamdecomp/lzham_timer.h -index a522430..e0c3cf2 100644 ---- a/lzhamdecomp/lzham_timer.h -+++ b/lzhamdecomp/lzham_timer.h -@@ -1,5 +1,5 @@ - // File: lzham_timer.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - - namespace lzham -diff --git a/lzhamdecomp/lzham_traits.h b/lzhamdecomp/lzham_traits.h -index 950c3fd..ea7214f 100644 ---- a/lzhamdecomp/lzham_traits.h -+++ b/lzhamdecomp/lzham_traits.h -@@ -1,5 +1,5 @@ - // File: lzham_traits.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - - namespace lzham -diff --git a/lzhamdecomp/lzham_types.h b/lzhamdecomp/lzham_types.h -index 47f68a3..2ea6a10 100644 ---- a/lzhamdecomp/lzham_types.h -+++ b/lzhamdecomp/lzham_types.h -@@ -1,30 +1,7 @@ - // File: types.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - --// TODO --#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) -- #undef INT8_MIN -- #undef INT8_MAX -- #undef UINT8_MIN -- #undef UINT8_MAX -- -- #undef INT16_MIN -- #undef INT16_MAX -- #undef UINT16_MIN -- #undef UINT16_MAX -- -- #undef INT32_MIN -- #undef INT32_MAX -- #undef UINT32_MIN -- #undef UINT32_MAX -- -- #undef INT64_MIN -- #undef INT64_MAX -- #undef UINT64_MIN -- #undef UINT64_MAX --#endif -- - namespace lzham - { - typedef unsigned char uint8; -@@ -44,23 +21,23 @@ namespace lzham - typedef long long int64; - #endif - -- const uint8 UINT8_MIN = 0; -- const uint8 UINT8_MAX = 0xFFU; -- const uint16 UINT16_MIN = 0; -- const uint16 UINT16_MAX = 0xFFFFU; -- const uint32 UINT32_MIN = 0; -- const uint32 UINT32_MAX = 0xFFFFFFFFU; -- const uint64 UINT64_MIN = 0; -- const uint64 UINT64_MAX = 0xFFFFFFFFFFFFFFFFULL; //0xFFFFFFFFFFFFFFFFui64; -+ const uint8 LZHAM_UINT8_MIN = 0; -+ const uint8 LZHAM_UINT8_MAX = 0xFFU; -+ const uint16 LZHAM_UINT16_MIN = 0; -+ const uint16 LZHAM_UINT16_MAX = 0xFFFFU; -+ const uint32 LZHAM_UINT32_MIN = 0; -+ const uint32 LZHAM_UINT32_MAX = 0xFFFFFFFFU; -+ const uint64 LZHAM_UINT64_MIN = 0; -+ const uint64 LZHAM_UINT64_MAX = 0xFFFFFFFFFFFFFFFFULL; //0xFFFFFFFFFFFFFFFFui64; - -- const int8 INT8_MIN = -128; -- const int8 INT8_MAX = 127; -- const int16 INT16_MIN = -32768; -- const int16 INT16_MAX = 32767; -- const int32 INT32_MIN = (-2147483647 - 1); -- const int32 INT32_MAX = 2147483647; -- const int64 INT64_MIN = (int64)0x8000000000000000ULL; //(-9223372036854775807i64 - 1); -- const int64 INT64_MAX = (int64)0x7FFFFFFFFFFFFFFFULL; //9223372036854775807i64; -+ const int8 LZHAM_INT8_MIN = -128; -+ const int8 LZHAM_INT8_MAX = 127; -+ const int16 LZHAM_INT16_MIN = -32768; -+ const int16 LZHAM_INT16_MAX = 32767; -+ const int32 LZHAM_INT32_MIN = (-2147483647 - 1); -+ const int32 LZHAM_INT32_MAX = 2147483647; -+ const int64 LZHAM_INT64_MIN = (int64)0x8000000000000000ULL; //(-9223372036854775807i64 - 1); -+ const int64 LZHAM_INT64_MAX = (int64)0x7FFFFFFFFFFFFFFFULL; //9223372036854775807i64; - - #if LZHAM_64BIT_POINTERS - typedef uint64 uint_ptr; -@@ -84,13 +61,13 @@ namespace lzham - const uint cIntBits = sizeof(uint) * CHAR_BIT; - - template struct int_traits { enum { cMin = INT_MIN, cMax = INT_MAX, cSigned = true }; }; -- template<> struct int_traits { enum { cMin = INT8_MIN, cMax = INT8_MAX, cSigned = true }; }; -- template<> struct int_traits { enum { cMin = INT16_MIN, cMax = INT16_MAX, cSigned = true }; }; -- template<> struct int_traits { enum { cMin = INT32_MIN, cMax = INT32_MAX, cSigned = true }; }; -+ template<> struct int_traits { enum { cMin = LZHAM_INT8_MIN, cMax = LZHAM_INT8_MAX, cSigned = true }; }; -+ template<> struct int_traits { enum { cMin = LZHAM_INT16_MIN, cMax = LZHAM_INT16_MAX, cSigned = true }; }; -+ template<> struct int_traits { enum { cMin = LZHAM_INT32_MIN, cMax = LZHAM_INT32_MAX, cSigned = true }; }; - - template<> struct int_traits { enum { cMin = 0, cMax = UINT_MAX, cSigned = false }; }; -- template<> struct int_traits { enum { cMin = 0, cMax = UINT8_MAX, cSigned = false }; }; -- template<> struct int_traits { enum { cMin = 0, cMax = UINT16_MAX, cSigned = false }; }; -+ template<> struct int_traits { enum { cMin = 0, cMax = LZHAM_UINT8_MAX, cSigned = false }; }; -+ template<> struct int_traits { enum { cMin = 0, cMax = LZHAM_UINT16_MAX, cSigned = false }; }; - - struct empty_type { }; - -diff --git a/lzhamdecomp/lzham_utils.h b/lzhamdecomp/lzham_utils.h -index 0e8f5e8..b157c9d 100644 ---- a/lzhamdecomp/lzham_utils.h -+++ b/lzhamdecomp/lzham_utils.h -@@ -1,5 +1,5 @@ - // File: lzham_utils.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - - #define LZHAM_GET_ALIGNMENT(v) ((!sizeof(v)) ? 1 : (__alignof(v) ? __alignof(v) : sizeof(uint32))) -diff --git a/lzhamdecomp/lzham_vector.cpp b/lzhamdecomp/lzham_vector.cpp -index e8a33bd..4a66dac 100644 ---- a/lzhamdecomp/lzham_vector.cpp -+++ b/lzhamdecomp/lzham_vector.cpp -@@ -1,5 +1,5 @@ - // File: lzham_vector.cpp --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #include "lzham_core.h" - #include "lzham_vector.h" - -diff --git a/lzhamdecomp/lzham_vector.h b/lzhamdecomp/lzham_vector.h -index 90f3236..badc540 100644 ---- a/lzhamdecomp/lzham_vector.h -+++ b/lzhamdecomp/lzham_vector.h -@@ -1,5 +1,5 @@ - // File: lzham_vector.h --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #pragma once - - namespace lzham -diff --git a/lzhamdll/lzham_api.cpp b/lzhamdll/lzham_api.cpp -index 6e473b1..cfdbb87 100644 ---- a/lzhamdll/lzham_api.cpp -+++ b/lzhamdll/lzham_api.cpp -@@ -1,5 +1,5 @@ - // File: lzham_api.cpp - Dynamic DLL entrypoints. --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #include "lzham_core.h" - #include "lzham_decomp.h" - #include "lzham_comp.h" -diff --git a/lzhamdll/lzham_dll_main.cpp b/lzhamdll/lzham_dll_main.cpp -index ad8a3ce..fa6280f 100644 ---- a/lzhamdll/lzham_dll_main.cpp -+++ b/lzhamdll/lzham_dll_main.cpp -@@ -1,5 +1,5 @@ - // File: lzham_dll_main.cpp --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #include "lzham_core.h" - - BOOL APIENTRY DllMain(HANDLE hModule, DWORD fdwReason, LPVOID lpReserved) -diff --git a/lzhamlib/lzham_lib.cpp b/lzhamlib/lzham_lib.cpp -index 946a4b4..11f5481 100644 ---- a/lzhamlib/lzham_lib.cpp -+++ b/lzhamlib/lzham_lib.cpp -@@ -1,5 +1,5 @@ - // File: lzham_lib.cpp - Static library entrypoints. --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #include "lzham_core.h" - #include "lzham_decomp.h" - #include "lzham_comp.h" -diff --git a/lzhamtest/lzhamtest.cpp b/lzhamtest/lzhamtest.cpp -index 14bb3d1..01bca51 100644 ---- a/lzhamtest/lzhamtest.cpp -+++ b/lzhamtest/lzhamtest.cpp -@@ -4,7 +4,7 @@ - // See the decompress_file() function to see how to use the decompression API, and the compress_file() function for the compression API. - // See include/lzham.h for documentation on the public LZHAM API. - // Tested on Windows, Linux, and OSX. On iOS, I use a small "Hello World" test app to test the codec. --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #if defined(__GNUC__) - #define _FILE_OFFSET_BITS 64 - #endif -diff --git a/lzhamtest/timer.cpp b/lzhamtest/timer.cpp -index affd260..bf5844a 100644 ---- a/lzhamtest/timer.cpp -+++ b/lzhamtest/timer.cpp -@@ -1,5 +1,5 @@ - // File: timer.cpp --// See Copyright Notice and license at the end of include/lzham.h -+// LZHAM is in the Public Domain. Please see the Public Domain declaration at the end of include/lzham.h - #include - #include - #include -diff --git a/lzhamtest/timer.h b/lzhamtest/timer.h -index 6852933..2499d66 100644 ---- a/lzhamtest/timer.h -+++ b/lzhamtest/timer.h -@@ -1,5 +1,5 @@ - // File: timer.h --// See Copyright Notice and license at the end of include/lzham.h -+// This software is in the Public Domain. Please see the end of include/lzham.h - #pragma once - - typedef unsigned long long timer_ticks; diff --git a/recipes/lzham/all/patches/fix-osx-1.0.0.patch b/recipes/lzham/all/patches/fix-osx-cci.20220103.patch similarity index 100% rename from recipes/lzham/all/patches/fix-osx-1.0.0.patch rename to recipes/lzham/all/patches/fix-osx-cci.20220103.patch diff --git a/recipes/lzham/all/patches/msvc-conan-cci.20220103.patch b/recipes/lzham/all/patches/msvc-conan-cci.20220103.patch new file mode 100644 index 0000000000000..ca0b641855eed --- /dev/null +++ b/recipes/lzham/all/patches/msvc-conan-cci.20220103.patch @@ -0,0 +1,83 @@ +diff --git a/lzham.sln b/lzham.sln +index 5c0edb6..63343f3 100644 +--- a/lzham.sln ++++ b/lzham.sln +@@ -3,22 +3,12 @@ Microsoft Visual Studio Solution File, Format Version 11.00 + # Visual Studio 2010 + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzhamdll", "lzhamdll\lzham.vcxproj", "{763BE79D-1280-41B7-81C5-7DC41E2BDB44}" + EndProject +-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzhamtest", "lzhamtest\lzhamtest.vcxproj", "{BBE16587-150E-460C-8AB4-F18B92D0B981}" +-EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzhamdecomp", "lzhamdecomp\lzhamdecomp.vcxproj", "{8DA0CD32-701D-48D7-AE92-728338501500}" + EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzhamcomp", "lzhamcomp\lzhamcomp.vcxproj", "{8DA0CD46-791D-48D7-AE92-728338501500}" + EndProject +-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example1", "example1\example1.vcxproj", "{BBE16587-150E-460C-8AB4-E18B92D0B982}" +-EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzhamlib", "lzhamlib\lzhamlib.vcxproj", "{83A2F0B5-1D02-4A13-B579-714F60E31774}" + EndProject +-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example2", "example2\example2.vcxproj", "{CBE16587-150E-460C-8AB4-E18B92D0B983}" +-EndProject +-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example3", "example3\example3.vcxproj", "{1BE16587-150E-460C-8AB4-E18B92D0BA87}" +-EndProject +-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example4", "example4\example4.vcxproj", "{1BE16587-260E-460C-8AB4-E18B92D0BA87}" +-EndProject + Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 +diff --git a/lzhamcomp/lzhamcomp.vcxproj b/lzhamcomp/lzhamcomp.vcxproj +index 5fd6155..b45f3dc 100644 +--- a/lzhamcomp/lzhamcomp.vcxproj ++++ b/lzhamcomp/lzhamcomp.vcxproj +@@ -23,6 +23,9 @@ + lzhamcomp + Win32Proj + ++ ++ ++ + + + StaticLibrary +diff --git a/lzhamdecomp/lzhamdecomp.vcxproj b/lzhamdecomp/lzhamdecomp.vcxproj +index dbaf54c..5f78ca5 100644 +--- a/lzhamdecomp/lzhamdecomp.vcxproj ++++ b/lzhamdecomp/lzhamdecomp.vcxproj +@@ -23,6 +23,9 @@ + lzhamdecomp + Win32Proj + ++ ++ ++ + + + StaticLibrary +diff --git a/lzhamdll/lzham.vcxproj b/lzhamdll/lzham.vcxproj +index ec0a280..5536234 100644 +--- a/lzhamdll/lzham.vcxproj ++++ b/lzhamdll/lzham.vcxproj +@@ -24,6 +24,9 @@ + lzham + Win32Proj + ++ ++ ++ + + + DynamicLibrary +diff --git a/lzhamlib/lzhamlib.vcxproj b/lzhamlib/lzhamlib.vcxproj +index 954dd99..cdd2c26 100644 +--- a/lzhamlib/lzhamlib.vcxproj ++++ b/lzhamlib/lzhamlib.vcxproj +@@ -23,6 +23,9 @@ + lzhamlib + Win32Proj + ++ ++ ++ + + + StaticLibrary diff --git a/recipes/lzham/all/patches/use-lzham-types-1.0.0.patch b/recipes/lzham/all/patches/use-lzham-types-cci.20220103.patch similarity index 100% rename from recipes/lzham/all/patches/use-lzham-types-1.0.0.patch rename to recipes/lzham/all/patches/use-lzham-types-cci.20220103.patch diff --git a/recipes/lzham/config.yml b/recipes/lzham/config.yml index 40341aa3db6cd..d334d7a80bf72 100644 --- a/recipes/lzham/config.yml +++ b/recipes/lzham/config.yml @@ -1,3 +1,3 @@ versions: - "1.0.0": + "cci.20220103": folder: all From 3048124ab2529c6f8cafebb5245a6a350b537b46 Mon Sep 17 00:00:00 2001 From: Bobbey Reese Date: Sat, 17 Dec 2022 12:54:03 -0500 Subject: [PATCH 3/3] Fix lint error --- recipes/lzham/all/conandata.yml | 2 +- recipes/lzham/all/conanfile.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/recipes/lzham/all/conandata.yml b/recipes/lzham/all/conandata.yml index 3e2193aef600a..17b541de9d7b8 100644 --- a/recipes/lzham/all/conandata.yml +++ b/recipes/lzham/all/conandata.yml @@ -28,6 +28,6 @@ patches: patch_type: conan - patch_file: "patches/msvc-conan-cci.20220103.patch" - patch_description: 'Skips building of lzhamtest and examples for MSVC, + patch_description: 'Skips building of lzhamtest and examples for MSVC, and injects conan toolchain for MSVC' patch_type: conan diff --git a/recipes/lzham/all/conanfile.py b/recipes/lzham/all/conanfile.py index dc2b71a60c9f6..b1b9dc2a684e4 100644 --- a/recipes/lzham/all/conanfile.py +++ b/recipes/lzham/all/conanfile.py @@ -7,7 +7,6 @@ copy, export_conandata_patches, get, - replace_in_file, rmdir ) from conan.tools.microsoft import (